[PATCH 2/6] utilities: kernelscan: tidy up the formatting of output messages.

Keng-Yu Lin kengyu at canonical.com
Wed Nov 7 02:11:54 UTC 2012


On Sat, Nov 3, 2012 at 12:58 AM, Colin King <colin.king at canonical.com> wrote:
> From: Colin Ian King <colin.king at canonical.com>
>
> Just make the output look more appealing
>
> Signed-off-by: Colin Ian King <colin.king at canonical.com>
> ---
>  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, " ");
>
> --
> 1.7.10.4
>
Acked-by: Keng-Yu Lin <kengyu at canonical.com>



More information about the fwts-devel mailing list