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

Alex Hung alex.hung at canonical.com
Wed Nov 21 05:50:14 UTC 2012


On 11/03/2012 12:58 AM, Colin King 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, " ");
>
>
Acked-by: Alex Hung <alex.hung at canonical.com>



More information about the fwts-devel mailing list