netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Phil Sutter <phil@nwl.cc>
To: Stephen Hemminger <shemming@brocade.com>
Cc: netdev@vger.kernel.org
Subject: [iproute PATCH 2/6] iplink: bond_slave: Add missing help functions
Date: Sat,  9 Jul 2016 11:22:46 +0200	[thread overview]
Message-ID: <1468056170-6056-3-git-send-email-phil@nwl.cc> (raw)
In-Reply-To: <1468056170-6056-1-git-send-email-phil@nwl.cc>

Signed-off-by: Phil Sutter <phil@nwl.cc>
---
 ip/iplink_bond_slave.c | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/ip/iplink_bond_slave.c b/ip/iplink_bond_slave.c
index d67793237edfc..9c60dea8a2757 100644
--- a/ip/iplink_bond_slave.c
+++ b/ip/iplink_bond_slave.c
@@ -17,6 +17,16 @@
 #include "utils.h"
 #include "ip_common.h"
 
+static void print_explain(FILE *f)
+{
+	fprintf(f, "Usage: ... bond_slave [ queue_id ID ]\n");
+}
+
+static void explain(void)
+{
+	print_explain(stderr);
+}
+
 static const char *slave_states[] = {
 	[BOND_STATE_ACTIVE] = "ACTIVE",
 	[BOND_STATE_BACKUP] = "BACKUP",
@@ -99,6 +109,13 @@ static int bond_slave_parse_opt(struct link_util *lu, int argc, char **argv,
 			if (get_u16(&queue_id, *argv, 0))
 				invarg("queue_id is invalid", *argv);
 			addattr16(n, 1024, IFLA_BOND_SLAVE_QUEUE_ID, queue_id);
+		} else {
+			if (matches(*argv, "help") != 0)
+				fprintf(stderr,
+					"bond_slave: unknown option \"%s\"?\n",
+					*argv);
+			explain();
+			return -1;
 		}
 		argc--, argv++;
 	}
@@ -106,10 +123,17 @@ static int bond_slave_parse_opt(struct link_util *lu, int argc, char **argv,
 	return 0;
 }
 
+static void bond_slave_print_help(struct link_util *lu, int argc, char **argv,
+				  FILE *f)
+{
+	print_explain(f);
+}
+
 struct link_util bond_slave_link_util = {
 	.id		= "bond",
 	.maxattr	= IFLA_BOND_SLAVE_MAX,
 	.print_opt	= bond_slave_print_opt,
 	.parse_opt	= bond_slave_parse_opt,
+	.print_help	= bond_slave_print_help,
 	.slave		= true,
 };
-- 
2.8.2

  parent reply	other threads:[~2016-07-09  9:23 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-09  9:22 [iproute PATCH 0/6] iplink: Improve documentation Phil Sutter
2016-07-09  9:22 ` [iproute PATCH 1/6] iplink: List valid 'type' argument in ip link help text Phil Sutter
2016-07-09  9:22 ` Phil Sutter [this message]
2016-07-09  9:22 ` [iproute PATCH 3/6] ip-link.8: Extend type list in synopsis Phil Sutter
2016-07-09  9:22 ` [iproute PATCH 4/6] ip-link.8: Place 'ip link set' warning more prominently Phil Sutter
2016-07-09  9:22 ` [iproute PATCH 5/6] ip-link.8: Add slave type option descriptions Phil Sutter
2016-07-09  9:22 ` [iproute PATCH 6/6] ip-link.8: Fix font choices Phil Sutter
2016-07-20 19:13 ` [iproute PATCH 0/6] iplink: Improve documentation 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=1468056170-6056-3-git-send-email-phil@nwl.cc \
    --to=phil@nwl.cc \
    --cc=netdev@vger.kernel.org \
    --cc=shemming@brocade.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;
as well as URLs for NNTP newsgroup(s).