diff mbox series

[iproute2] tc/mqprio: Print extra info on invalid args.

Message ID 20180905202419.238812-1-caleb.raitto@gmail.com
State Changes Requested, archived
Delegated to: stephen hemminger
Headers show
Series [iproute2] tc/mqprio: Print extra info on invalid args. | expand

Commit Message

Caleb Raitto Sept. 5, 2018, 8:24 p.m. UTC
From: Caleb Raitto <caraitto@google.com>

Print the name of the argument that wasn't understood, and also print
the usage string.

Signed-off-by: Caleb Raitto <caraitto@google.com>
---
 tc/q_mqprio.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Stephen Hemminger Sept. 6, 2018, 10:39 a.m. UTC | #1
On Wed,  5 Sep 2018 13:24:19 -0700
Caleb Raitto <caleb.raitto@gmail.com> wrote:

> From: Caleb Raitto <caraitto@google.com>
> 
> Print the name of the argument that wasn't understood, and also print
> the usage string.
> 
> Signed-off-by: Caleb Raitto <caraitto@google.com>


The standard code pattern in iproute2 is to use invarg().
Why not use that?
diff mbox series

Patch

diff --git a/tc/q_mqprio.c b/tc/q_mqprio.c
index 89b46002..cf2eceb4 100644
--- a/tc/q_mqprio.c
+++ b/tc/q_mqprio.c
@@ -167,7 +167,8 @@  static int mqprio_parse_opt(struct qdisc_util *qu, int argc,
 			explain();
 			return -1;
 		} else {
-			fprintf(stderr, "Unknown argument\n");
+			fprintf(stderr, "Unknown argument: %s\n", *argv);
+			explain();
 			return -1;
 		}
 		argc--; argv++;