]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
Both `help' command and the `unknown command' error message now tell
authorMartin Mares <mj@ucw.cz>
Wed, 31 May 2000 22:39:06 +0000 (22:39 +0000)
committerMartin Mares <mj@ucw.cz>
Wed, 31 May 2000 22:39:06 +0000 (22:39 +0000)
the user to press `?' if he wants help.

client/client.c
client/cmds.m4
client/commands.c

index ea44cdd8d39f2f5c99848ab61b8131c1c94c7b6b..8b01ce38f279e071add93aef4f95f29dfc42c874 100644 (file)
@@ -76,6 +76,22 @@ extern int _rl_vis_botlin;
 extern void _rl_move_vert(int);
 extern Function *rl_last_func;
 
+static int
+handle_internal_command(char *cmd)
+{
+  if (!strncmp(cmd, "exit", 4) || !strncmp(cmd, "quit", 4))
+    {
+      cleanup();
+      exit(0);
+    }
+  if (!strncmp(cmd, "help", 4))
+    {
+      puts("Press `?' for context sensitive help.");
+      return 1;
+    }
+  return 0;
+}
+
 static void
 got_line(char *cmd_buffer)
 {
@@ -92,15 +108,13 @@ got_line(char *cmd_buffer)
       if (cmd)
        {
          add_history(cmd);
-         if (!strcmp(cmd, "exit") || !strcmp(cmd, "quit"))
+         if (!handle_internal_command(cmd))
            {
-             cleanup();
-             exit(0);
+             server_send(cmd);
+             input_hidden = -1;
+             io_loop(0);
+             input_hidden = 0;
            }
-         server_send(cmd);
-         input_hidden = -1;
-         io_loop(0);
-         input_hidden = 0;
          free(cmd);
        }
       else
index d24bbb09f55358d2b212fc74b17d138b40affaa7..1cbb4f926bd5273959d8608dba953cdb4ebd1691 100644 (file)
@@ -8,3 +8,4 @@
 
 CF_CLI(QUIT,,, [[Quit the client]])
 CF_CLI(EXIT,,, [[Exit the client]])
+CF_CLI(HELP,,, [[Description of the help system]])
index 697cff6d1b9f250a3ac357cd195c6e04de5dc9e0..7612b64cffbdf63071905438cd90fbe185d749ab 100644 (file)
@@ -294,7 +294,7 @@ cmd_expand(char *cmd)
     }
   if (!n->cmd)
     {
-      puts("No such command.");
+      puts("No such command. Press `?' for help.");
       return NULL;
     }
   b = xmalloc(strlen(n->cmd->command) + strlen(args) + 1);