diff options
author | markster <markster@f38db490-d61c-443f-a65b-d21fe96a405b> | 2003-10-22 03:46:36 +0000 |
---|---|---|
committer | markster <markster@f38db490-d61c-443f-a65b-d21fe96a405b> | 2003-10-22 03:46:36 +0000 |
commit | 7040d7c5a6ef354e599103c67e3a69a5ec4fc46e (patch) | |
tree | b11f0ab335f7731536e8b8bd3de21de3ff7f3756 /asterisk.c | |
parent | 107bde23f9a705535e1857345a30d520b1e26fff (diff) |
Fix help issue
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@1650 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'asterisk.c')
-rwxr-xr-x | asterisk.c | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/asterisk.c b/asterisk.c index f419ac5c4..8e64773f6 100755 --- a/asterisk.c +++ b/asterisk.c @@ -568,6 +568,7 @@ static void consolehandler(char *s) ast_el_add_history(s); /* Give the console access to the shell */ if (s) { + /* The real handler for bang */ if (s[0] == '!') { if (s[1]) system(s+1); @@ -575,8 +576,6 @@ static void consolehandler(char *s) system(getenv("SHELL") ? getenv("SHELL") : "/bin/sh"); } else ast_cli_command(STDOUT_FILENO, s); - if (!strcasecmp(s, "help")) - fprintf(stdout, " !<command> Executes a given shell command\n"); } else fprintf(stdout, "\nUse \"quit\" to exit\n"); } @@ -589,6 +588,7 @@ static int remoteconsolehandler(char *s) ast_el_add_history(s); /* Give the console access to the shell */ if (s) { + /* The real handler for bang */ if (s[0] == '!') { if (s[1]) system(s+1); @@ -596,10 +596,6 @@ static int remoteconsolehandler(char *s) system(getenv("SHELL") ? getenv("SHELL") : "/bin/sh"); ret = 1; } - if (strncasecmp(s, "help", 4) == 0 && (s[4] == '\0' || isspace(s[4]))) { - fprintf(stdout, " !<command> Executes a given shell command\n"); - ret = 0; - } if ((strncasecmp(s, "quit", 4) == 0 || strncasecmp(s, "exit", 4) == 0) && (s[4] == '\0' || isspace(s[4]))) { quit_handler(0, 0, 0, 0); @@ -647,6 +643,10 @@ static char restart_when_convenient_help[] = "Usage: restart when convenient\n" " Causes Asterisk to perform a cold restart when all active calls have ended.\n"; +static char bang_help[] = +"Usage: !<command>\n" +" Executes a given shell command\n"; + #if 0 static int handle_quit(int fd, int argc, char *argv[]) { @@ -723,6 +723,11 @@ static int handle_abort_halt(int fd, int argc, char *argv[]) return RESULT_SUCCESS; } +static int handle_bang(int fd, int argc, char *argv[]) +{ + return RESULT_SUCCESS; +} + #define ASTERISK_PROMPT "*CLI> " #define ASTERISK_PROMPT2 "%s*CLI> " @@ -738,6 +743,7 @@ static struct ast_cli_entry astshutdownwhenconvenient = { { "stop", "when","con static struct ast_cli_entry astrestartnow = { { "restart", "now", NULL }, handle_restart_now, "Restart Asterisk immediately", restart_now_help }; static struct ast_cli_entry astrestartgracefully = { { "restart", "gracefully", NULL }, handle_restart_gracefully, "Restart Asterisk gracefully", restart_gracefully_help }; static struct ast_cli_entry astrestartwhenconvenient= { { "restart", "when", "convenient", NULL }, handle_restart_when_convenient, "Restart Asterisk at empty call volume", restart_when_convenient_help }; +static struct ast_cli_entry astbang = { { "!", NULL }, handle_bang, "Execute a shell command", bang_help }; static int ast_el_read_char(EditLine *el, char *cp) { @@ -1444,6 +1450,7 @@ int main(int argc, char *argv[]) ast_cli_register(&astrestartwhenconvenient); ast_cli_register(&astshutdownwhenconvenient); ast_cli_register(&aborthalt); + ast_cli_register(&astbang); if (option_console) { /* Console stuff now... */ /* Register our quit function */ |