From patchwork Fri Nov 2 16:58:33 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [2/6] utilities: kernelscan: tidy up the formatting of output messages. Date: Fri, 02 Nov 2012 06:58:33 -0000 From: Colin King X-Patchwork-Id: 196602 Message-Id: <1351875517-19128-3-git-send-email-colin.king@canonical.com> To: fwts-devel@lists.ubuntu.com From: Colin Ian King Just make the output look more appealing Signed-off-by: Colin Ian King Acked-by: Keng-Yu Lin Acked-by: Alex Hung --- src/utilities/kernelscan.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/utilities/kernelscan.c b/src/utilities/kernelscan.c index 7569079..9133ce9 100644 --- a/src/utilities/kernelscan.c +++ b/src/utilities/kernelscan.c @@ -386,6 +386,8 @@ static int skip_comments(parser *p) if (ch == '/') return PARSER_COMMENT_FOUND; + + unget_next(p, ch); } } } @@ -760,10 +762,10 @@ static int parse_kernel_message(parser *p, token *t) printk = (strcmp(t->token, "printk") == 0); - if (strcmp(t->token, "dev_err") == 0) { + if (strcmp(t->token, "dev_err") == 0) emit = true; - line = strdupcat(line, "dev_err"); - } + + line = strdupcat(line, t->token); token_clear(t); for (;;) { @@ -795,9 +797,10 @@ static int parse_kernel_message(parser *p, token *t) (t->type == TOKEN_IDENTIFIER) && (prev_token_type == TOKEN_PAREN_OPENED) && (strcmp(t->token, "KERN_ERR") == 0)) { - line = strdupcat(line, "printk( "); + emit = true; } + if (t->type == TOKEN_LITERAL_STRING) { literal_strip_quotes(t); str = strdupcat(str, t->token); @@ -820,6 +823,10 @@ static int parse_kernel_message(parser *p, token *t) } line = strdupcat(line, t->token); + + if (t->type == TOKEN_IDENTIFIER && prev_token_type != TOKEN_COMMA) + line = strdupcat(line, " "); + if (t->type == TOKEN_COMMA) line = strdupcat(line, " ");