[BusyBox] init syslog messages have ^M
Paul Fox
pgf at brightstareng.com
Wed Nov 24 20:03:08 UTC 2004
> No, it's just an embedded Linux unit with console only access. But why put
> a carriage return right after the process name? That would put the actual
> message on the next line.
the poster below meant to say "Unix ends all lines in a newline."
using a lone carriage return, as init is doing, causes the cursor
to go back to column 0 before printing its message. this is barely
okay on a console, where it can serve to ensure your messages start
in column 0 -- but you might lose text that was already on that line.
syslog encodes the '\r' as the separate characters ^M in order to
protect viewers of logs from exactly that problem.
the lines that read as:
--------
msg[0] = '\r';
va_start(arguments, fmt);
l = vsnprintf(msg + 1, sizeof(msg) - 2, fmt, arguments) + 1;
va_end(arguments);
--------
should be changed to say:
--------
va_start(arguments, fmt);
l = vsnprintf(msg, sizeof(msg) - 1, fmt, arguments) + 1;
va_end(arguments);
--------
(this is untested, which is why i'm not formalizing it as a patch.
paul
>
> >
> > ^M is a carriage return. Unix ends all lines in a carriage return.
> > Dos/Windows ends all lines in Carriage Return and Line Feed. Macs end
> > all lines with Line Feed.
> >
=---------------------
paul fox, pgf at brightstareng.com
More information about the busybox
mailing list