about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2016-04-15 22:50:00 +0100
committerJames Booth <boothj5@gmail.com>2016-04-15 22:50:00 +0100
commitfeeac48cf3759bc5f0a82dabff759b87e35d8b83 (patch)
tree365c40d0585144f4773e65d368e709637dec2e3c
parent8f009c3c8d373797bad5c0c604c71179dcc9d9ea (diff)
parent02bad7af28a419c0985f45e8c0eabeae2ec8f743 (diff)
downloadprofani-tty-feeac48cf3759bc5f0a82dabff759b87e35d8b83.tar.gz
Merge remote-tracking branch 'asdil12/help'
-rw-r--r--src/command/command.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/command/command.c b/src/command/command.c
index fa9b2de7..191415ae 100644
--- a/src/command/command.c
+++ b/src/command/command.c
@@ -32,6 +32,8 @@
  *
  */
 
+#define _GNU_SOURCE 1
+
 #include "config.h"
 
 #include <assert.h>
@@ -2972,7 +2974,17 @@ cmd_process_input(ProfWin *window, char *inp)
     } else if (inp[0] == '/') {
         char *inp_cpy = strdup(inp);
         char *command = strtok(inp_cpy, " ");
-        result = _cmd_execute(window, command, inp);
+        char *question_mark = strchr(command, '?');
+        if (question_mark) {
+            *question_mark = '\0';
+            char *fakeinp;
+            if (asprintf(&fakeinp, "/help %s", command+1)) {
+                result = _cmd_execute(window, "/help", fakeinp);
+                free(fakeinp);
+            }
+        } else {
+            result = _cmd_execute(window, command, inp);
+        }
         free(inp_cpy);
 
     // call a default handler if input didn't start with '/'