[Asterisk-cvs] asterisk asterisk.c,1.24,1.25
markster at lists.digium.com
markster at lists.digium.com
Tue Oct 21 22:20:35 CDT 2003
Update of /usr/cvsroot/asterisk
In directory mongoose.digium.com:/tmp/cvs-serv2798
Modified Files:
asterisk.c
Log Message:
Fix help issue
Index: asterisk.c
===================================================================
RCS file: /usr/cvsroot/asterisk/asterisk.c,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -d -r1.24 -r1.25
--- asterisk.c 16 Oct 2003 10:27:41 -0000 1.24
+++ asterisk.c 22 Oct 2003 03:46:36 -0000 1.25
@@ -568,6 +568,7 @@
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 @@
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 @@
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 @@
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 @@
"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 @@
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 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 @@
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 */
More information about the svn-commits
mailing list