mirror of
https://gitlab.nic.cz/labs/bird.git
synced 2024-12-22 01:31:55 +00:00
Both help' command and the
unknown command' error message now tell
the user to press `?' if he wants help.
This commit is contained in:
parent
2f5e5ff9d6
commit
2983460bc0
@ -76,6 +76,22 @@ extern int _rl_vis_botlin;
|
|||||||
extern void _rl_move_vert(int);
|
extern void _rl_move_vert(int);
|
||||||
extern Function *rl_last_func;
|
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
|
static void
|
||||||
got_line(char *cmd_buffer)
|
got_line(char *cmd_buffer)
|
||||||
{
|
{
|
||||||
@ -92,15 +108,13 @@ got_line(char *cmd_buffer)
|
|||||||
if (cmd)
|
if (cmd)
|
||||||
{
|
{
|
||||||
add_history(cmd);
|
add_history(cmd);
|
||||||
if (!strcmp(cmd, "exit") || !strcmp(cmd, "quit"))
|
if (!handle_internal_command(cmd))
|
||||||
{
|
{
|
||||||
cleanup();
|
server_send(cmd);
|
||||||
exit(0);
|
input_hidden = -1;
|
||||||
|
io_loop(0);
|
||||||
|
input_hidden = 0;
|
||||||
}
|
}
|
||||||
server_send(cmd);
|
|
||||||
input_hidden = -1;
|
|
||||||
io_loop(0);
|
|
||||||
input_hidden = 0;
|
|
||||||
free(cmd);
|
free(cmd);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -8,3 +8,4 @@
|
|||||||
|
|
||||||
CF_CLI(QUIT,,, [[Quit the client]])
|
CF_CLI(QUIT,,, [[Quit the client]])
|
||||||
CF_CLI(EXIT,,, [[Exit the client]])
|
CF_CLI(EXIT,,, [[Exit the client]])
|
||||||
|
CF_CLI(HELP,,, [[Description of the help system]])
|
||||||
|
@ -294,7 +294,7 @@ cmd_expand(char *cmd)
|
|||||||
}
|
}
|
||||||
if (!n->cmd)
|
if (!n->cmd)
|
||||||
{
|
{
|
||||||
puts("No such command.");
|
puts("No such command. Press `?' for help.");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
b = xmalloc(strlen(n->cmd->command) + strlen(args) + 1);
|
b = xmalloc(strlen(n->cmd->command) + strlen(args) + 1);
|
||||||
|
Loading…
Reference in New Issue
Block a user