Merged revisions 71362 via svnmerge from
[asterisk/asterisk.git] / main / asterisk.c
index 3088c59..2e81f3d 100644 (file)
@@ -2232,9 +2232,6 @@ static void ast_remotecontrol(char * data)
        for (;;) {
                ebuf = (char *)el_gets(el, &num);
 
        for (;;) {
                ebuf = (char *)el_gets(el, &num);
 
-               if (!ebuf)
-                       break;
-
                if (!ast_strlen_zero(ebuf)) {
                        if (ebuf[strlen(ebuf)-1] == '\n')
                                ebuf[strlen(ebuf)-1] = '\0';
                if (!ast_strlen_zero(ebuf)) {
                        if (ebuf[strlen(ebuf)-1] == '\n')
                                ebuf[strlen(ebuf)-1] = '\0';
@@ -2960,14 +2957,12 @@ int main(int argc, char *argv[])
 
                for (;;) {
                        buf = (char *)el_gets(el, &num);
 
                for (;;) {
                        buf = (char *)el_gets(el, &num);
-                       if (!buf)
-                               break;
-
-                       if (buf[strlen(buf)-1] == '\n')
-                               buf[strlen(buf)-1] = '\0';
-                       consolehandler((char *)buf);
+                       if (buf) {
+                               if (buf[strlen(buf)-1] == '\n')
+                                       buf[strlen(buf)-1] = '\0';
 
 
-                       if (!buf && ast_opt_remote && (write(STDOUT_FILENO, "\nUse EXIT or QUIT to exit the asterisk console\n",
+                               consolehandler((char *)buf);
+                       } else if (ast_opt_remote && (write(STDOUT_FILENO, "\nUse EXIT or QUIT to exit the asterisk console\n",
                                   strlen("\nUse EXIT or QUIT to exit the asterisk console\n")) < 0)) {
                                /* Whoa, stdout disappeared from under us... Make /dev/null's */
                                int fd;
                                   strlen("\nUse EXIT or QUIT to exit the asterisk console\n")) < 0)) {
                                /* Whoa, stdout disappeared from under us... Make /dev/null's */
                                int fd;