From 37e994a1bcf5b41c8435c741e52ad6ff587a2fb5 Mon Sep 17 00:00:00 2001 From: Tzafrir Cohen Date: Sat, 27 Sep 2008 16:13:09 +0300 Subject: [PATCH] no need for history on asterisk -rx --- main/asterisk.c | 26 ++++++++++++++------------ 1 files changed, 14 insertions(+), 12 deletions(-) diff --git a/main/asterisk.c b/main/asterisk.c index 0aa9f9a..1b42f3f 100644 --- a/main/asterisk.c +++ b/main/asterisk.c @@ -1376,7 +1376,7 @@ static void quit_handler(int num, int niceness, int safeshutdown, int restart) if (niceness) ast_module_shutdown(); } - if (ast_opt_console || ast_opt_remote) { + if (ast_opt_console || (ast_opt_remote && !ast_opt_exec) ) { if (getenv("HOME")) snprintf(filename, sizeof(filename), "%s/.asterisk_history", getenv("HOME")); if (!ast_strlen_zero(filename)) @@ -2462,17 +2462,6 @@ static void ast_remotecontrol(char * data) else printf("log and verbose output currently muted ('logger mute' to unmute)\n"); } - ast_verbose("Connected to Asterisk %s currently running on %s (pid = %d)\n", version, hostname, pid); - remotehostname = hostname; - if (getenv("HOME")) - snprintf(filename, sizeof(filename), "%s/.asterisk_history", getenv("HOME")); - if (el_hist == NULL || el == NULL) - ast_el_initialize(); - - el_set(el, EL_GETCFN, ast_el_read_char); - - if (!ast_strlen_zero(filename)) - ast_el_read_history(filename); if (ast_opt_exec && data) { /* hack to print output then exit if asterisk -rx is used */ struct pollfd fds; @@ -2509,6 +2498,19 @@ static void ast_remotecontrol(char * data) } return; } + + ast_verbose("Connected to Asterisk %s currently running on %s (pid = %d)\n", version, hostname, pid); + remotehostname = hostname; + if (getenv("HOME")) + snprintf(filename, sizeof(filename), "%s/.asterisk_history", getenv("HOME")); + if (el_hist == NULL || el == NULL) + ast_el_initialize(); + + el_set(el, EL_GETCFN, ast_el_read_char); + + if (!ast_strlen_zero(filename)) + ast_el_read_history(filename); + for (;;) { ebuf = (char *)el_gets(el, &num); -- 1.5.6.5