-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cc
More file actions
29 lines (26 loc) · 751 Bytes
/
main.cc
File metadata and controls
29 lines (26 loc) · 751 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
/** @file main.cc
* The main program that creates a Shell instance
* and then calls it's main method.
* It also catches any exceptions thrown.
*/
#include <stdexcept> // std::exception
#include <iostream> // std::cin, std::cerr
#include <cstdlib> // EXIT_SUCCESS, EXIT_FAILURE
#include "ansi.h" // ansi color code strings (AC_RED, AA_RESET)
#include "Shell.h"
using namespace std;
int main()
{
try {
Shell shell(cin); // A shell instance reading commands from cin
shell.main(); // Do it
return EXIT_SUCCESS;
}
catch(const exception& e) {
cerr << AC_RED "Exception: " AA_RESET << e.what() << endl;
return EXIT_FAILURE;
} catch(...) {
cerr << AC_RED "OOPS: something went wrong" AA_RESET << endl;
return EXIT_FAILURE;
}
}