Re: [PATCH v2] ss: add option to print socket information on one line

From: Markus Elfring
Date: Thu May 30 2019 - 05:15:08 EST


This software update caught also my development attention a moment ago.


> +++ b/misc/ss.c
> @@ -3973,7 +3975,10 @@ static int packet_show_sock(struct nlmsghdr *nlh, void *arg)
>
> if (show_details) {
> if (pinfo) {
> - out("\n\tver:%d", pinfo->pdi_version);
> + if (oneline)
> + out(" ver:%d", pinfo->pdi_version);
> + else
> + out("\n\tver:%d", pinfo->pdi_version);
> out(" cpy_thresh:%d", pinfo->pdi_copy_thresh);
> out(" flags( ");
> if (pinfo->pdi_flags & PDI_RUNNING)

I would find it nicer to use the ternary operator here.

+ out(oneline ? " ver:%d" : "\n\tver:%d",
+ pinfo->pdi_version);


How do you think about to use more succinct statement variants?

Regards,
Markus