[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1369333817.2075.34.camel@joe-AO722>
Date: Thu, 23 May 2013 11:30:17 -0700
From: Joe Perches <joe@...ches.com>
To: Yuval Mintz <yuvalmin@...adcom.com>
Cc: bhutchings@...arflare.com, netdev@...r.kernel.org,
eilong@...adcom.com
Subject: Re: [PATCH] Ethtool: Beautify private flags print
On Thu, 2013-05-23 at 20:55 +0300, Yuval Mintz wrote:
> When printing the private flags of the device, align all strings
> to have the same length.
[]
> diff --git a/ethtool.c b/ethtool.c
[]
> + for (i = 0; i < strings->len; i++) {
> + int j;
> +
> + printf("%s", (const char *)strings->data +
> + i * ETH_GSTRING_LEN);
> +
> + cur_len = strlen((const char*)strings->data +
> + i * ETH_GSTRING_LEN);
> + for (j = 0; j < max_len - cur_len; j++)
> + printf(" ");
I think this isn't necessary, but this is simpler
"%-*s", max_len, strings->data + i * ETH_GSTRING_LEN
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists