netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH iproute2] Fix -oneline output when alias present
@ 2013-03-12 22:03 roopa
  2013-03-13  9:48 ` [iproute2] " Andreas Henriksson
  0 siblings, 1 reply; 3+ messages in thread
From: roopa @ 2013-03-12 22:03 UTC (permalink / raw)
  To: shemminger, roopa; +Cc: netdev, roopa

From: roopa <roopa@cumulusnetworks.com>

This patch removes '\n' in -oneline output when alias
present on interface

Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
---
 ip/ipaddress.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/ip/ipaddress.c b/ip/ipaddress.c
index cff503f..fdd2a74 100644
--- a/ip/ipaddress.c
+++ b/ip/ipaddress.c
@@ -468,9 +468,11 @@ int print_linkinfo(const struct sockaddr_nl *who,
 	if (do_link && tb[IFLA_LINKINFO] && show_details)
 		print_linktype(fp, tb[IFLA_LINKINFO]);
 
-	if (do_link && tb[IFLA_IFALIAS])
-		fprintf(fp,"\n    alias %s", 
+	if (do_link && tb[IFLA_IFALIAS]) {
+		fprintf(fp, "%s", _SL_);
+		fprintf(fp,"    alias %s",
 			rta_getattr_str(tb[IFLA_IFALIAS]));
+	}
 
 	if (do_link && show_stats) {
 		if (tb[IFLA_STATS64])
-- 
1.7.2.5

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [iproute2] Fix -oneline output when alias present
  2013-03-12 22:03 [PATCH iproute2] Fix -oneline output when alias present roopa
@ 2013-03-13  9:48 ` Andreas Henriksson
  2013-03-13 12:20   ` Roopa Prabhu
  0 siblings, 1 reply; 3+ messages in thread
From: Andreas Henriksson @ 2013-03-13  9:48 UTC (permalink / raw)
  To: roopa; +Cc: shemminger, netdev

Hi!

Just wanted to point out some minor style issues with your patch.
See below...

On Tue, Mar 12, 2013 at 12:03:47PM -0000, roopa@cumulusnetworks.com wrote:
[...]
> -	if (do_link && tb[IFLA_IFALIAS])
> -		fprintf(fp,"\n    alias %s", 
> +	if (do_link && tb[IFLA_IFALIAS]) {
> +		fprintf(fp, "%s", _SL_);
> +		fprintf(fp,"    alias %s",

                          ^^^ missing space here.

Also, why not use a single fprintf?

Like:
                fprintf(fp, "%s    alias %s",
                        _SL_,
>  			rta_getattr_str(tb[IFLA_IFALIAS]));
> +	}

Then you wouldn't need these brackets either...

>  
>  	if (do_link && show_stats) {
>  		if (tb[IFLA_STATS64])

-- 
Andreas Henriksson

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [iproute2] Fix -oneline output when alias present
  2013-03-13  9:48 ` [iproute2] " Andreas Henriksson
@ 2013-03-13 12:20   ` Roopa Prabhu
  0 siblings, 0 replies; 3+ messages in thread
From: Roopa Prabhu @ 2013-03-13 12:20 UTC (permalink / raw)
  To: Andreas Henriksson; +Cc: shemminger, netdev

On 3/13/13 2:48 AM, Andreas Henriksson wrote:
> Hi!
>
> Just wanted to point out some minor style issues with your patch.
> See below...
>
> On Tue, Mar 12, 2013 at 12:03:47PM -0000, roopa@cumulusnetworks.com wrote:
> [...]
>> -	if (do_link&&  tb[IFLA_IFALIAS])
>> -		fprintf(fp,"\n    alias %s",
>> +	if (do_link&&  tb[IFLA_IFALIAS]) {
>> +		fprintf(fp, "%s", _SL_);
>> +		fprintf(fp,"    alias %s",
>
>                            ^^^ missing space here.

Oh, I hadn't noticed that. I did not introduce the style problem there.
I just happened to pick the _SL_line from else where in the code.
Since this patch is in, I will submit a patch to fix the spacing.
>
> Also, why not use a single fprintf?

I was just following convention here. The SL line seems to be on a line 
of its own else where in the code. Which i did think was cleaner.


Thanks.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-03-13 12:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-03-12 22:03 [PATCH iproute2] Fix -oneline output when alias present roopa
2013-03-13  9:48 ` [iproute2] " Andreas Henriksson
2013-03-13 12:20   ` Roopa Prabhu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).