Do newline conversion in the "echo" builtin.

This commit is contained in:
Stephen Heumann 2015-01-08 17:23:39 -06:00
parent 01890e4a42
commit f88111e789

View File

@ -166,6 +166,15 @@ int echo_main(int argc UNUSED_PARAM, char **argv)
}
do_write:
#ifdef __GNO__
{
char *ch;
for (ch = buffer; ch < out; ++ch) {
if (*ch == '\n')
*ch = '\r';
}
}
#endif
/* Careful to error out on partial writes too (think ENOSPC!) */
errno = 0;
/*r =*/ full_write(STDOUT_FILENO, buffer, out - buffer);