From 5e94ca9f060d2952ef08913234c500a815f734bf Mon Sep 17 00:00:00 2001 From: _ov4 Date: Tue, 1 Sep 2026 00:39:44 +0000 Subject: refactor --- src/command/builtin.cc | 23 +++++++++++++++++++++++ src/command/quit.cc | 13 +++++++++++++ 2 files changed, 36 insertions(+) create mode 100644 src/command/builtin.cc create mode 100644 src/command/quit.cc (limited to 'src/command') 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 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); +} + +} -- cgit v1.3.1-4-g156e