Ignore empty lines
[miniREPL.git] / Sources / _os.cpp
blobdb9d6378797b24bd34d2e52106d94fd1b5ee01ee
1 #include "Headers/_os.h"
3 bool is_verbose;
5 void signal_handler(int s)
7 if (s==SIGINT)
9 cout << "\nSIGINT (Ctrl+C) received. Code " << s << ". Exiting.\n";
10 exit(s);
13 if (s==SIGHUP)
15 cout << "\nSIGHUP received. Code " << s << ". Exiting.\n";
16 exit(s);
20 SignalHandler::SignalHandler()
22 signal_action.sa_handler = signal_handler;
23 sigemptyset(&signal_action.sa_mask);
24 signal_action.sa_flags = 0;
25 sigaction(SIGINT, &signal_action, NULL);
28 CLIInputs::CLIInputs(int argc, char **argv)
30 if(argc > 1)
32 for(short unsigned int i = 1; i < argc; i++)
34 string s_argv = argv[i];
35 if (!s_argv.compare("-h") || !s_argv.compare("--help"))
37 printf("%-20s\tObtain help.\n", "-h, --help");
38 printf("%-20s\tShows additional execution data.\n", "-v, --verbose");
39 exit(0);
41 if (!s_argv.compare("-v") || !s_argv.compare("--verbose"))
43 printf("Executing in verbose mode.\n");
44 is_verbose = true;