From b550c6bb3a0344ba33a00fce126ca571228e3651 Mon Sep 17 00:00:00 2001 From: _ov4 Date: Tue, 1 Sep 2026 00:48:48 +0000 Subject: refactor --- src/command/bg.cc | 13 +++++++++++++ src/command/builtin.cc | 4 ++++ src/command/exit.cc | 11 +++++++++++ src/command/fg.cc | 13 +++++++++++++ src/command/jobs.cc | 15 +++++++++++++++ 5 files changed, 56 insertions(+) create mode 100644 src/command/bg.cc create mode 100644 src/command/exit.cc create mode 100644 src/command/fg.cc create mode 100644 src/command/jobs.cc (limited to 'src/command') diff --git a/src/command/bg.cc b/src/command/bg.cc new file mode 100644 index 0000000..06eca45 --- /dev/null +++ b/src/command/bg.cc @@ -0,0 +1,13 @@ +#include "command/builtin.h" + +#include "ground.h" + +namespace ov4::command +{ + +void bg(char **argv) +{ + ov4::do_bgfg(argv); +} + +} diff --git a/src/command/builtin.cc b/src/command/builtin.cc index b2c3149..3e87850 100644 --- a/src/command/builtin.cc +++ b/src/command/builtin.cc @@ -15,6 +15,10 @@ 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; } + if (strcmp(argv[0], "exit") == 0) { ov4::command::exit(); return true; } + if (strcmp(argv[0], "jobs") == 0) { ov4::command::jobs(); return true; } + if (strcmp(argv[0], "bg") == 0) { ov4::command::bg(argv); return true; } + if (strcmp(argv[0], "fg") == 0) { ov4::command::fg(argv); return true; } else return false; } diff --git a/src/command/exit.cc b/src/command/exit.cc new file mode 100644 index 0000000..5d817a6 --- /dev/null +++ b/src/command/exit.cc @@ -0,0 +1,11 @@ +#include "command/builtin.h" + +namespace ov4::command +{ + +void exit() +{ + std::exit(0); +} + +} diff --git a/src/command/fg.cc b/src/command/fg.cc new file mode 100644 index 0000000..e2164ee --- /dev/null +++ b/src/command/fg.cc @@ -0,0 +1,13 @@ +#include "command/builtin.h" + +#include "ground.h" + +namespace ov4::command +{ + +void fg(char **argv) +{ + ov4::do_bgfg(argv); +} + +} diff --git a/src/command/jobs.cc b/src/command/jobs.cc new file mode 100644 index 0000000..f618d55 --- /dev/null +++ b/src/command/jobs.cc @@ -0,0 +1,15 @@ +#include "command/builtin.h" + +#include "job.h" + +namespace ov4::command +{ + +using namespace ov4; + +void jobs() +{ + listjobs(ov4::jobs); +} + +} -- cgit v1.3.1-4-g156e