From 0d0367ca087b90bde8acf73b27ef97b82cf4918b Mon Sep 17 00:00:00 2001 From: Kelvin Sherlock Date: Thu, 11 Feb 2016 21:50:25 -0500 Subject: [PATCH] builtin about box, bump version number. --- builtins.cpp | 47 +++++++++++++++++++++++++++++++++++++++++++++++ builtins.h | 1 + command.cpp | 1 + mpw-shell.cpp | 2 +- 4 files changed, 50 insertions(+), 1 deletion(-) diff --git a/builtins.cpp b/builtins.cpp index 354a3a5..5ee6c62 100644 --- a/builtins.cpp +++ b/builtins.cpp @@ -606,3 +606,50 @@ int builtin_which(Environment &env, const std::vector &tokens, cons fprintf(stderr, "### Which - Command \"%s\" was not found.\n", target.c_str()); return 2; // not found. } + +int builtin_aboutbox(Environment &env, const std::vector &tokens, const fdmask &fds) { + // the most important command of all! + + if (tokens.size() == 2 && tokens[1] == "--moof") { + + fputs( + "\n" + " ## \n" + " ## ## #### \n" + " ## #### ## \n" + " ## ## \n" + " ## ## ## ## \n" + " ## ## #### \n" + " ## ## ## ## \n" + " ######## #### ## ## \n" + " ## #################### ## \n" + " ## ############## ## \n" + " #### ############ ## \n" + " ###### ###### ## \n" + " ###### ## \n" + " #### ## \n" + " ## ## \n" + " ## ################ ## \n" + " ## ## ## ## \n" + " ## ## ## ## \n" + " ## ## ## ## \n" + " ## ## ## ## \n" + " ## ## ## ## \n" + " ###### ###### \n" + "\n" + ,stdout); + + return 0; + } + + + fputs( +"+--------------------------------------+\n" +"| MPW Shell 0.1 - February 2016 |\n" +"| |\n" +"| |\n" +"| (c) 2016 Kelvin W Sherlock |\n" +"+--------------------------------------+\n" + ,stdout); + return 0; +} diff --git a/builtins.h b/builtins.h index 3620fa2..54428a0 100644 --- a/builtins.h +++ b/builtins.h @@ -17,6 +17,7 @@ int builtin_unset(Environment &e, const std::vector &, const fdmask int builtin_export(Environment &e, const std::vector &, const fdmask &); int builtin_unexport(Environment &e, const std::vector &, const fdmask &); int builtin_which(Environment &e, const std::vector &, const fdmask &); +int builtin_aboutbox(Environment &e, const std::vector &, const fdmask &); int builtin_evaluate(Environment &e, std::vector &&, const fdmask &); diff --git a/command.cpp b/command.cpp index c55233b..1357a3f 100644 --- a/command.cpp +++ b/command.cpp @@ -93,6 +93,7 @@ namespace { } std::unordered_map &, const fdmask &)> builtins = { + {"aboutbox", builtin_aboutbox}, {"directory", builtin_directory}, {"echo", builtin_echo}, {"export", builtin_export}, diff --git a/mpw-shell.cpp b/mpw-shell.cpp index 002ef8d..1259b90 100644 --- a/mpw-shell.cpp +++ b/mpw-shell.cpp @@ -476,7 +476,7 @@ int main(int argc, char **argv) { } }; - if (!cflag) fprintf(stdout, "MPW Shell 0.0\n"); + if (!cflag) fprintf(stdout, "MPW Shell 0.1\n"); e.startup(true); read_file(p1, root() / "Startup"); e.startup(false);