summaryrefslogtreecommitdiffstats
path: root/client
diff options
context:
space:
mode:
authorMartin Mares <mj@ucw.cz>2000-06-01 00:39:06 +0200
committerMartin Mares <mj@ucw.cz>2000-06-01 00:39:06 +0200
commit2983460bc0adabe357ba839972ea8d09c97c32a4 (patch)
tree61a2f0678bb80e1cccd6993783e8352ff6fe263c /client
parent2f5e5ff9d6e91e7a3e478b316d6b2d23003ad80e (diff)
downloadbird-2983460bc0adabe357ba839972ea8d09c97c32a4.tar
bird-2983460bc0adabe357ba839972ea8d09c97c32a4.zip
Both `help' command and the `unknown command' error message now tell
the user to press `?' if he wants help.
Diffstat (limited to 'client')
-rw-r--r--client/client.c28
-rw-r--r--client/cmds.m41
-rw-r--r--client/commands.c2
3 files changed, 23 insertions, 8 deletions
diff --git a/client/client.c b/client/client.c
index ea44cdd..8b01ce3 100644
--- a/client/client.c
+++ b/client/client.c
@@ -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
diff --git a/client/cmds.m4 b/client/cmds.m4
index d24bbb0..1cbb4f9 100644
--- a/client/cmds.m4
+++ b/client/cmds.m4
@@ -8,3 +8,4 @@
CF_CLI(QUIT,,, [[Quit the client]])
CF_CLI(EXIT,,, [[Exit the client]])
+CF_CLI(HELP,,, [[Description of the help system]])
diff --git a/client/commands.c b/client/commands.c
index 697cff6..7612b64 100644
--- a/client/commands.c
+++ b/client/commands.c
@@ -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);