Skip to content
Snippets Groups Projects
asterisk.c 53.1 KiB
Newer Older
  • Learn to ignore specific revisions
  • 			buf = (char *)el_gets(el, &num);
    			if (buf) {
    				if (buf[strlen(buf)-1] == '\n')
    					buf[strlen(buf)-1] = '\0';
    
    				consolehandler((char *)buf);
    
    				if (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;
    					fd = open("/dev/null", O_RDWR);
    					if (fd > -1) {
    						dup2(fd, STDOUT_FILENO);
    						dup2(fd, STDIN_FILENO);
    					} else
    						ast_log(LOG_WARNING, "Failed to open /dev/null to recover from dead console.  Bad things will happen!\n");
    					break;
    				}
    
    Mark Spencer's avatar
    Mark Spencer committed
    	}
    
    	/* Do nothing */
    	for(;;) 
    		poll(silly_macos,0, -1);
    
    Mark Spencer's avatar
    Mark Spencer committed
    	return 0;
    }