[PATCH] tests/uname.c: use print_quoted_string to print members of uname

Dmitry V. Levin ldv at altlinux.org
Sat Mar 26 03:29:24 UTC 2016


On Fri, Mar 25, 2016 at 04:46:53PM +0530, Jay Joshi wrote:
> On Fri, Mar 25, 2016 at 1:56 AM, Dmitry V. Levin wrote:
> > On Thu, Mar 24, 2016 at 03:17:48PM +0530, Jay Joshi wrote:
[...]
> >> Also, is a test for abbreviated output required?
> >
> > It surely won't harm. :)
> >
> 
> I've seen in some tests like mmap.test, $ME_ is used in run_prog. I
> think test scripts should not directly access them. What do you say?

Why do you think so?  Does the name look cryptic?

[...]
> >> --- 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?
> 
> I think it looks more readable this way, it's like the're nested inside quotes.

I don't share your PoV on this.


-- 
ldv
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.strace.io/pipermail/strace-devel/attachments/20160326/0c1a23a7/attachment.bin>


More information about the Strace-devel mailing list