netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Zhang Shengju <zhangshengju@cmss.chinamobile.com>
To: netdev@vger.kernel.org
Subject: [PATCH iproute2] ip-link: cut one level indentation
Date: Fri, 14 Aug 2015 03:13:41 +0000	[thread overview]
Message-ID: <1439522021-22613-1-git-send-email-zhangshengju@cmss.chinamobile.com> (raw)

Cut one level indentation to make things easier to read.

Signed-off-by: Zhang Shengju <zhangshengju@cmss.chinamobile.com>
---
 ip/iplink.c | 65 +++++++++++++++++++++++++++++++------------------------------
 1 file changed, 33 insertions(+), 32 deletions(-)

diff --git a/ip/iplink.c b/ip/iplink.c
index 520f750..504aa74 100644
--- a/ip/iplink.c
+++ b/ip/iplink.c
@@ -1184,40 +1184,41 @@ static void do_help(int argc, char **argv)
 
 int do_iplink(int argc, char **argv)
 {
-	if (argc > 0) {
-		if (iplink_have_newlink()) {
-			if (matches(*argv, "add") == 0)
-				return iplink_modify(RTM_NEWLINK,
-						     NLM_F_CREATE|NLM_F_EXCL,
-						     argc-1, argv+1);
-			if (matches(*argv, "set") == 0 ||
-			    matches(*argv, "change") == 0)
-				return iplink_modify(RTM_NEWLINK, 0,
-						     argc-1, argv+1);
-			if (matches(*argv, "replace") == 0)
-				return iplink_modify(RTM_NEWLINK,
-						     NLM_F_CREATE|NLM_F_REPLACE,
-						     argc-1, argv+1);
-			if (matches(*argv, "delete") == 0)
-				return iplink_modify(RTM_DELLINK, 0,
-						     argc-1, argv+1);
-		} else {
+	if (argc < 1)
+		return ipaddr_list_link(0, NULL);
+
+	if (iplink_have_newlink()) {
+		if (matches(*argv, "add") == 0)
+			return iplink_modify(RTM_NEWLINK,
+					NLM_F_CREATE|NLM_F_EXCL,
+					argc-1, argv+1);
+		if (matches(*argv, "set") == 0 ||
+				matches(*argv, "change") == 0)
+			return iplink_modify(RTM_NEWLINK, 0,
+					argc-1, argv+1);
+		if (matches(*argv, "replace") == 0)
+			return iplink_modify(RTM_NEWLINK,
+					NLM_F_CREATE|NLM_F_REPLACE,
+					argc-1, argv+1);
+		if (matches(*argv, "delete") == 0)
+			return iplink_modify(RTM_DELLINK, 0,
+					argc-1, argv+1);
+	} else {
 #if IPLINK_IOCTL_COMPAT
-			if (matches(*argv, "set") == 0)
-				return do_set(argc-1, argv+1);
+		if (matches(*argv, "set") == 0)
+			return do_set(argc-1, argv+1);
 #endif
-		}
-		if (matches(*argv, "show") == 0 ||
-		    matches(*argv, "lst") == 0 ||
-		    matches(*argv, "list") == 0)
-			return ipaddr_list_link(argc-1, argv+1);
-		if (matches(*argv, "help") == 0) {
-			do_help(argc-1, argv+1);
-			return 0;
-		}
-	} else
-		return ipaddr_list_link(0, NULL);
+	}
+	if (matches(*argv, "show") == 0 ||
+			matches(*argv, "lst") == 0 ||
+			matches(*argv, "list") == 0)
+		return ipaddr_list_link(argc-1, argv+1);
+	if (matches(*argv, "help") == 0) {
+		do_help(argc-1, argv+1);
+		return 0;
+	}
 
-	fprintf(stderr, "Command \"%s\" is unknown, try \"ip link help\".\n", *argv);
+	fprintf(stderr, "Command \"%s\" is unknown, try \"ip link help\".\n",
+			*argv);
 	exit(-1);
 }
-- 
1.8.3.1

             reply	other threads:[~2015-08-14  3:10 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-14  3:13 Zhang Shengju [this message]
2015-08-19 23:35 ` [PATCH iproute2] ip-link: cut one level indentation Stephen Hemminger

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=1439522021-22613-1-git-send-email-zhangshengju@cmss.chinamobile.com \
    --to=zhangshengju@cmss.chinamobile.com \
    --cc=netdev@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).