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

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

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?

Patch
diff mbox series

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++;