[uClinux-dev] Odd boot message

Greg Ungerer gerg at snapgear.com
Thu Mar 20 18:30:24 EST 2003


Hi Stuart,

Stuart MacDonald wrote:
> In that case, I'll just #ifdef it for my platform.
> 
> Note: I couldn't locate where in the kernel's printk chain the
> escaped (backslashed) characters are processed. Anyone have a pointer?
> printk is in linux/kernel/printk.c and it calls vsnprintf from
> linux/lib/vsprintf.c. vsnprintf takes care of regular % style formats,
> but appears to leave \ style formats alone, leading me to suspect that
> the compiler handles them.

The compiler does this translation. A "\n" in a C code string
will not appear as separate "\" and "n" characters in the
resulting binary, it will be a single byte value of 0x0a
(10 decimal).

It is easy to see this in action. Compile some code with a
string that contains \n (or whatever), and then hexdump it.

Regards
Greg



------------------------------------------------------------------------
Greg Ungerer  --  Chief Software Wizard        EMAIL:  gerg at snapgear.com
SnapGear Pty Ltd                               PHONE:    +61 7 3435 2888
825 Stanley St,                                  FAX:    +61 7 3891 3630
Woolloongabba, QLD, 4102, Australia              WEB:   www.SnapGear.com




More information about the uClinux-dev mailing list