public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: Yuval Mintz <yuvalmin@broadcom.com>
Cc: bhutchings@solarflare.com, netdev@vger.kernel.org, eilong@broadcom.com
Subject: Re: [PATCH] Ethtool: Beautify private flags print
Date: Thu, 23 May 2013 11:30:17 -0700	[thread overview]
Message-ID: <1369333817.2075.34.camel@joe-AO722> (raw)
In-Reply-To: <1369331751-32543-1-git-send-email-yuvalmin@broadcom.com>

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

  reply	other threads:[~2013-05-23 18:30 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-23 17:55 [PATCH] Ethtool: Beautify private flags print Yuval Mintz
2013-05-23 18:30 ` Joe Perches [this message]
2013-05-24  3:50   ` Yuval Mintz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1369333817.2075.34.camel@joe-AO722 \
    --to=joe@perches.com \
    --cc=bhutchings@solarflare.com \
    --cc=eilong@broadcom.com \
    --cc=netdev@vger.kernel.org \
    --cc=yuvalmin@broadcom.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox