(servercmd): Remove newline for C_INFORM, C_FLUSH,

C_REDIR, C_PIPE and C_EXECUTE.
Fixes the problem created when the newline was left in io_gets().
This commit is contained in:
Ron Koenderink 2005-11-12 20:16:07 +00:00
parent 2e655eaf96
commit b7be1fe113

View file

@ -84,6 +84,11 @@ servercmd(struct ioqueue *ioq, FILE *auxfi)
p++; p++;
*p++ = 0; *p++ = 0;
} }
/*
* FIXME
* C_REDIR, C_PIPE, and C_EXECUTE will not
* work with filename longer than one buffer
*/
switch (code) { switch (code) {
case C_PROMPT: case C_PROMPT:
if (sscanf(p, "%d %d", &nmin, &nbtu) != 2) { if (sscanf(p, "%d %d", &nmin, &nbtu) != 2) {
@ -94,20 +99,30 @@ servercmd(struct ioqueue *ioq, FILE *auxfi)
prompt(auxfi); prompt(auxfi);
break; break;
case C_REDIR: case C_REDIR:
if (eol)
p[strlen(p) - 1] = '\0';
doredir(p); doredir(p);
break; break;
case C_PIPE: case C_PIPE:
if (eol)
p[strlen(p) - 1] = '\0';
dopipe(p); dopipe(p);
break; break;
case C_FLUSH: case C_FLUSH:
mode = code; mode = code;
if (eol)
p[strlen(p) - 1] = '\0';
sprintf(the_prompt, "%s", p); sprintf(the_prompt, "%s", p);
prompt(auxfi); prompt(auxfi);
break; break;
case C_EXECUTE: case C_EXECUTE:
if (eol)
p[strlen(p) - 1] = '\0';
doexecute(p, auxfi); doexecute(p, auxfi);
break; break;
case C_INFORM: case C_INFORM:
if (eol)
p[strlen(p) - 1] = '\0';
if (*p) { if (*p) {
p[strlen(p) - 1] = '\0'; p[strlen(p) - 1] = '\0';
sprintf(num_teles, "(%s) ", p + 1); sprintf(num_teles, "(%s) ", p + 1);