|
- /*!
- * \file
- * Snel.cpp
- * \brief A shell implementation for A.U.TH (Operating systems Lab)
- *
- * Created on: Feb, 2019
- * Author: Christos Choutouridis AEM: 8997
- * email : cchoutou@ece.auth.gr
- */
- #include "sequencer.h"
-
-
- int main(int argc, char* argv[]) try {
- snel::Sequencer seq{};
- std::string line, filtered;
-
- if (argc > 1) { // batch mode
- std::ifstream file(argv[1]);
-
- while (std::getline (file, line, '\n')) {
- //^ We use \n as delimiter. No further parsing here
- filtered = snel::filter(line); // simple filtering
- if (filtered == "quit")
- break;
- seq.parse(filtered).execute();
- }
- }
- else { // interactive mode
- std::cout << "Snel. A shell implementation for A.U.TH (OS Lab)." << std::endl;
- do {
- std::cout << "Choutouridis_8997>";
- std::getline (std::cin, line, '\n'); //< We use \n as delimiter. No parsing here
- filtered = snel::filter(line); // simple filtering
- if (filtered == "quit")
- break;
- seq.parse(filtered).execute();
- } while (1);
- }
- return 0;
-
- } catch (std::exception& e) {
- // we probably pollute the user's screen. Comment `cerr << ...` if you don't like it.
- // std::cerr << e.what() << '\n';
- exit(1);
- }
|