diff options
Diffstat (limited to 'src/command')
| -rw-r--r-- | src/command/builtin.cc | 23 | ||||
| -rw-r--r-- | src/command/quit.cc | 13 |
2 files changed, 36 insertions, 0 deletions
diff --git a/src/command/builtin.cc b/src/command/builtin.cc new file mode 100644 index 0000000..b2c3149 --- /dev/null +++ b/src/command/builtin.cc @@ -0,0 +1,23 @@ +#include "command/builtin.h" + +namespace ov4 +{ + +using namespace std; + +//array<string> builtin_cmd_list{"quit", "fg", "bg", "jobs"}; + +/* + * builtin_cmd - If the user has typed a built-in command then execute + * it immediately. + */ +bool exe_bultin_command(char **argv) +{ + if (argv == nullptr || argv[0] == nullptr) exit(1); // WTF??? + if (strcmp(argv[0], "quit") == 0) { ov4::command::quit(); return true; } + else return false; +} + + + +} diff --git a/src/command/quit.cc b/src/command/quit.cc new file mode 100644 index 0000000..917f642 --- /dev/null +++ b/src/command/quit.cc @@ -0,0 +1,13 @@ +#include "command/builtin.h" + +namespace ov4::command +{ + +using namespace ov4; + +void quit() +{ + exit(0); +} + +} |
