diff options
author | Your Name <you@example.com> | 2020-06-25 15:45:08 +0200 |
---|---|---|
committer | Your Name <you@example.com> | 2020-06-25 15:45:08 +0200 |
commit | 0ed96053f42bde5981ba18c4117b5345f9dea1af (patch) | |
tree | f8ebba40e24590dda71dc655f079b2760b62c811 | |
parent | Base: fixed \r implementation in the TTY (diff) | |
download | pOS-0ed96053f42bde5981ba18c4117b5345f9dea1af.tar.gz pOS-0ed96053f42bde5981ba18c4117b5345f9dea1af.tar.bz2 pOS-0ed96053f42bde5981ba18c4117b5345f9dea1af.zip |
Shell: added date command
-rw-r--r-- | src/pOS/arch/x86/kernel/shell/cmd.cpp | 4 | ||||
-rw-r--r-- | src/pOS/arch/x86/kernel/shell/cmds/date.cpp | 9 | ||||
-rw-r--r-- | src/pOS/arch/x86/kernel/shell/shell.cpp | 2 | ||||
-rw-r--r-- | src/pOS/include/kernel/pOS.h | 1 |
4 files changed, 15 insertions, 1 deletions
diff --git a/src/pOS/arch/x86/kernel/shell/cmd.cpp b/src/pOS/arch/x86/kernel/shell/cmd.cpp index 3453df1..13b99ba 100644 --- a/src/pOS/arch/x86/kernel/shell/cmd.cpp +++ b/src/pOS/arch/x86/kernel/shell/cmd.cpp @@ -17,6 +17,10 @@ int CMD_MANAGER::execute(char* cmd) case str2int("c"): return CMD_Clear().execute(cmd); + case str2int("date"): + case str2int("time"): + return CMD_Date().execute(cmd); + case str2int("halt"): case str2int("hlt"): return CMD_Halt().execute(cmd); diff --git a/src/pOS/arch/x86/kernel/shell/cmds/date.cpp b/src/pOS/arch/x86/kernel/shell/cmds/date.cpp new file mode 100644 index 0000000..3a0431b --- /dev/null +++ b/src/pOS/arch/x86/kernel/shell/cmds/date.cpp @@ -0,0 +1,9 @@ +#include <kernel/shell/cmd.h> +#include <kernel/time.h> + +int CMD_Date::execute(const char* args) +{ + UNUSED_VARIABLE(args); + printf("%s\n", Time::get_date_formatted()); + return 0; +} diff --git a/src/pOS/arch/x86/kernel/shell/shell.cpp b/src/pOS/arch/x86/kernel/shell/shell.cpp index 5e8d896..d11e206 100644 --- a/src/pOS/arch/x86/kernel/shell/shell.cpp +++ b/src/pOS/arch/x86/kernel/shell/shell.cpp @@ -35,7 +35,7 @@ void signal_handler(Signal_Type signal) int Shell::init(void) { - Shell::set_prefix("pOS#"); + Shell::set_prefix(SHELL_PREFIX); Signals::register_recieve(signal_handler); return run(); } diff --git a/src/pOS/include/kernel/pOS.h b/src/pOS/include/kernel/pOS.h index 5391765..076bbde 100644 --- a/src/pOS/include/kernel/pOS.h +++ b/src/pOS/include/kernel/pOS.h @@ -3,6 +3,7 @@ #define DEBUG #define VERSION "meme" +#define SHELL_PREFIX "pOS#" #define KB_US |