Remove old main.cpp
This commit is contained in:
30
main.cpp
30
main.cpp
@ -1,30 +0,0 @@
|
||||
#include <cstdlib>
|
||||
#include <libscstring.hpp>
|
||||
#include <stdexcept>
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
|
||||
using namespace std;
|
||||
|
||||
static int check_file(istream& file) {
|
||||
string line;
|
||||
while (getline(file, line)) {
|
||||
if (!sc::is_valid_utf8(line)) return EXIT_FAILURE;
|
||||
}
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
int main(int argc, char* argv[]) {
|
||||
try {
|
||||
if (argc == 1) {
|
||||
return check_file(cin);
|
||||
} else {
|
||||
ifstream file {argv[1]};
|
||||
if (!file) throw runtime_error {"could not open file"};
|
||||
return check_file(file);
|
||||
}
|
||||
} catch (const exception& ex) {
|
||||
cerr << "valid-utf8: " << ex.what() << '\n';
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user