Little fix

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@1112 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Mark Spencer
2003-06-23 16:40:12 +00:00
parent ff7e6bda27
commit cd2d5400ce

View File

@@ -673,10 +673,12 @@ static int ast_el_read_char(EditLine *el, char *cp)
for (;;) { for (;;) {
FD_ZERO(&rfds); FD_ZERO(&rfds);
FD_SET(ast_consock, &rfds); FD_SET(ast_consock, &rfds);
FD_SET(STDIN_FILENO, &rfds);
max = ast_consock; max = ast_consock;
if (STDIN_FILENO > max) if (!option_exec) {
max = STDIN_FILENO; FD_SET(STDIN_FILENO, &rfds);
if (STDIN_FILENO > max)
max = STDIN_FILENO;
}
res = ast_select(max+1, &rfds, NULL, NULL, NULL); res = ast_select(max+1, &rfds, NULL, NULL, NULL);
if (res < 0) { if (res < 0) {
if (errno == EINTR) if (errno == EINTR)
@@ -702,7 +704,7 @@ static int ast_el_read_char(EditLine *el, char *cp)
buf[res] = '\0'; buf[res] = '\0';
if (!lastpos) if (!option_exec && !lastpos)
write(STDOUT_FILENO, "\r", 1); write(STDOUT_FILENO, "\r", 1);
write(STDOUT_FILENO, buf, res); write(STDOUT_FILENO, buf, res);
if ((buf[res-1] == '\n') || (buf[res-2] == '\n')) { if ((buf[res-1] == '\n') || (buf[res-2] == '\n')) {
@@ -1023,12 +1025,14 @@ static void ast_remotecontrol(char * data)
#if 0 #if 0
ast_cli_register(&astshutdown); ast_cli_register(&astshutdown);
#endif #endif
if (option_exec && data) { /* hack to print output then exit if asterisk -rx is used */
char tempchar;
ast_el_read_char(el, &tempchar);
return;
}
for(;;) { for(;;) {
ebuf = (char *)el_gets(el, &num); ebuf = (char *)el_gets(el, &num);
if (data) /* hack to print output then exit if asterisk -rx is used */
ebuf = strdup("quit");
if (ebuf && strlen(ebuf)) { if (ebuf && strlen(ebuf)) {
if (ebuf[strlen(ebuf)-1] == '\n') if (ebuf[strlen(ebuf)-1] == '\n')
ebuf[strlen(ebuf)-1] = '\0'; ebuf[strlen(ebuf)-1] = '\0';