[Toxine-cvs] CVS: toxine/src commands.c,1.63,1.64
Brought to you by:
f1rmb
From: Daniel Caujolle-B. <f1...@us...> - 2004-05-17 20:03:28
|
Update of /cvsroot/toxine/toxine/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18353 Modified Files: commands.c Log Message: fix stdin and << usage Index: commands.c =================================================================== RCS file: /cvsroot/toxine/toxine/src/commands.c,v retrieving revision 1.63 retrieving revision 1.64 diff -u -r1.63 -r1.64 --- commands.c 17 May 2004 19:53:24 -0000 1.63 +++ commands.c 17 May 2004 20:03:18 -0000 1.64 @@ -777,7 +777,7 @@ static void toxine_handle_stdin(toxine_t *tox) { int fd; - char c[255]; + char command[32768]; int len; fd_set set; struct timeval tv; @@ -795,11 +795,23 @@ select(fd + 1, &set, NULL, NULL, &tv); if(FD_ISSET(fd, &set)) { - len = read(fd, &c, 255); - if(len > 0) { - c[len - 1] = '\0'; - - toxine_set_command_line(tox, c); + if((len = read(fd, &command, 32767))) { + char *p = command; + command[len - 1] = '\0'; + + while(p && (*p != '\0')) { + switch(*p) { + case '\n': + *p = ';'; + p++; + break; + + default: + p++; + break; + } + } + toxine_set_command_line(tox, command); toxine_handle_command(tox, NULL); } } |