On Thu, Mar 24, 2016 at 03:17:48PM +0530, Jay Joshi wrote:
> Patch is attached.
> 
> uname.test related question: When will uniq be required?

It was discussed recently, see
https://sourceforge.net/p/strace/mailman/message/34925661/

> Also, is a test for abbreviated output required?

It surely won't harm. :)

> From 05e69fac85562ec3541866caec727d2cf3446590 Mon Sep 17 00:00:00 2001
> From: JayRJoshi <[email protected]>
> Date: Thu, 24 Mar 2016 12:39:32 +0530
> Subject: [PATCH 2/2] tests/uname.c: use print_quoted_string
> 
> * tests/uname.c: Use print_quoted_string to print members of utsname.
> ---
>  tests/uname.c | 28 +++++++++++++++-------------
>  1 file changed, 15 insertions(+), 13 deletions(-)
> 
> diff --git a/tests/uname.c b/tests/uname.c
> index 0f1b5f3..6d7e572 100644
> --- a/tests/uname.c
> +++ b/tests/uname.c
> @@ -11,21 +11,23 @@ int main()
>  {
>       struct utsname *const uname = tail_alloc(sizeof(struct utsname));
>       int rc = syscall(__NR_uname, uname);
> -     printf("uname({sysname=\"%s\", nodename=\"%s\", release=\"%s\""
> -            ", version=\"%s\", machine=\"%s\""
> +     printf("uname({sysname=\"");
> +             print_quoted_string(uname->sysname);
> +     printf("\", nodename=\"");
> +             print_quoted_string(uname->nodename);
> +     printf("\", release=\"");
> +             print_quoted_string(uname->release);
> +     printf("\", version=\"");
> +             print_quoted_string(uname->version);
> +     printf("\", machine=\"");
> +             print_quoted_string(uname->machine);

Why these print_quoted_string calls are indented this way?

> +     printf("\""
>  # ifdef HAVE_STRUCT_UTSNAME_DOMAINNAME
> -            ", domainname=\"%s\""
> +             ", domainname=\"");

Note the (unintended?) change of indentation here...

> +             print_quoted_string(uname->domainname);
> +             printf("\""
>  # endif
> -            "}) = %d\n",
> -            uname->sysname,
> -            uname->nodename,
> -            uname->release,
> -            uname->version,
> -            uname->machine,
> -# ifdef HAVE_STRUCT_UTSNAME_DOMAINNAME
> -            uname->domainname,
> -# endif
> -            rc);
> +             "}) = %d\n", rc);

... and here.


-- 
ldv

Attachment: pgpwHM22GfXoc.pgp
Description: PGP signature

------------------------------------------------------------------------------
Transform Data into Opportunity.
Accelerate data analysis in your applications with
Intel Data Analytics Acceleration Library.
Click to learn more.
http://pubads.g.doubleclick.net/gampad/clk?id=278785351&iu=/4140
_______________________________________________
Strace-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/strace-devel

Reply via email to