Remove old main.cpp

This commit is contained in:
2024-12-10 16:58:47 +01:00
parent e81e1e9e34
commit 97c6131aca

View File

@ -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;
}
}