diff options
| author | _ov4 <ov4@ov4.org> | 2026-09-01 00:39:44 +0000 |
|---|---|---|
| committer | _ov4 <ov4@ov4.org> | 2026-09-01 00:39:44 +0000 |
| commit | 5e94ca9f060d2952ef08913234c500a815f734bf (patch) | |
| tree | 169e6c67289b70753aa76edb818f3b1f63112884 /src/command | |
| parent | 54261d62d47624e9ff4724c42aaa05eaf478e606 (diff) | |
refactor
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); +} + +} |
