Re: [PATCH] Stop printk printing non-printable chars

Willy Tarreau
2004-06-19T04:24:39Z

Hi,

On Sat, Jun 19, 2004 at 12:52:23AM +0100, matthew-lkml@newtoncomputing.co.uk wrote:
> /*
> + * Emit character in numeric (octal) form
> + */

Don't most of us handle hex easier than octal ? I'd prefer to read \xE9
than \351, but that's only personal taste.

> - emit_log_char(*p);
> + switch (*p) {
> + case '\n':
> + case '\t':
> + emit_log_char(*p);
> + break;

Logically, ig you use '\' as an escape char, your should also protect it
to avoid confusion, because if you read "\351", you won't know if the
function really sent these four chars or only the \xE9 char.

Another way to do it would be to display "<XX>" like less, but '<' and '>'
are sensible because they're used to indicate the log level.

Regards,
Willy