git.strcat.st

/strcat/minitox.git/ - summarytreelogarchive

subject
Add --help flag.
commit
45b9e3f7e1da9e6e0ead4bfabc15efa3b935589c
date
2018-06-16T16:59:05Z
message
It doesn't help much, but every toxin needs to respond to --help.

Fixes #2.

diff
 minitox.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/minitox.c b/minitox.c
index 0dba474..f021eea 100644
--- a/minitox.c
+++ b/minitox.c
@@ -1315,7 +1315,14 @@ void repl_iterate(){
 }
 
 
-int main() {
+int main(int argc, char **argv) {
+    if (argc == 2 && strcmp(argv[1], "--help") == 0) {
+        fputs("Usage: minitox\n", stdout);
+        fputs("\n", stdout);
+        fputs("Minitox does not take any arguments.\n", stdout);
+        return 0;
+    }
+
     fputs("Type `/guide` to print the guide.\n", stdout);
     fputs("Type `/help` to print command list.\n\n",stdout);