From 97c6131aca4f62d6f268fe9f16917e083929d414 Mon Sep 17 00:00:00 2001 From: Bob Polis Date: Tue, 10 Dec 2024 16:58:47 +0100 Subject: [PATCH] Remove old main.cpp --- main.cpp | 30 ------------------------------ 1 file changed, 30 deletions(-) delete mode 100644 main.cpp diff --git a/main.cpp b/main.cpp deleted file mode 100644 index 7c907d9..0000000 --- a/main.cpp +++ /dev/null @@ -1,30 +0,0 @@ -#include -#include -#include -#include -#include - -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; - } -}