(io_gets, output): Remove the removal of \n in io_gets() and the
readdition of it in output().
This commit is contained in:
parent
89e2b3b481
commit
0918d3c3fc
2 changed files with 4 additions and 8 deletions
|
@ -125,9 +125,9 @@ ioq_gets(struct ioqueue *ioq, char *buf, int cc, int *eol)
|
||||||
end = &buf[nbytes];
|
end = &buf[nbytes];
|
||||||
for (p = buf; p < end && *p; p++) {
|
for (p = buf; p < end && *p; p++) {
|
||||||
if (*p == '\n') {
|
if (*p == '\n') {
|
||||||
*p = '\0';
|
*++p = '\0';
|
||||||
*eol = 1;
|
*eol = 1;
|
||||||
dequeuecc(ioq, (p - buf) + 1);
|
dequeuecc(ioq, p - buf);
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -312,20 +312,16 @@ output(int code, char *buf, FILE *auxfi, int eol)
|
||||||
fprintf(auxfi, "%s", buf);
|
fprintf(auxfi, "%s", buf);
|
||||||
if (code == C_FLUSH)
|
if (code == C_FLUSH)
|
||||||
(void)fflush(auxfi);
|
(void)fflush(auxfi);
|
||||||
else if (eol)
|
|
||||||
(void)putc('\n', auxfi);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (redir_fp)
|
if (redir_fp)
|
||||||
fprintf(redir_fp, "%s%s", buf, eol ? "\n" : "");
|
fprintf(redir_fp, "%s", buf);
|
||||||
else if (pipe_fp)
|
else if (pipe_fp)
|
||||||
fprintf(pipe_fp, eol ? "%s\n": "%s", buf);
|
fprintf(pipe_fp, "%s", buf);
|
||||||
else {
|
else {
|
||||||
screen(buf);
|
screen(buf);
|
||||||
if (code == C_FLUSH)
|
if (code == C_FLUSH)
|
||||||
(void)fflush(stdout);
|
(void)fflush(stdout);
|
||||||
else if (eol)
|
|
||||||
(void)putc('\n', stdout);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue