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

From: Willy Tarreau
Date: Fri Jun 18 2004 - 23:27:02 EST


Hi,

On Sat, Jun 19, 2004 at 12:52:23AM +0100, matthew-lkml@xxxxxxxxxxxxxxxxxxxxx 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

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/