diff options
author | Ben Hutchings <ben@decadent.org.uk> | 2008-11-27 04:11:12 +0000 |
---|---|---|
committer | Jeff Garzik <jgarzik@redhat.com> | 2009-03-06 05:59:32 -0500 |
commit | 4ec0a795e52ca8effd622d8b3c49c6b927aceef5 (patch) | |
tree | 58b30f2a283f79041d7b3163967f7d296f3268e8 /ethtool.c | |
parent | 5c368cd47d390555f17d9dfb0b04ef48d0a42a21 (diff) | |
download | ethtool-4ec0a795e52ca8effd622d8b3c49c6b927aceef5.tar.gz |
ethtool: Show short message for syntax error
In case of a syntax error it's likely to be more helpful to just say
that rather than showing the entire usage information, which is now
very long.
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
Diffstat (limited to 'ethtool.c')
-rw-r--r-- | ethtool.c | 23 |
1 files changed, 16 insertions, 7 deletions
@@ -197,15 +197,24 @@ static struct option { static void show_usage(int badarg) { int i; - fprintf(stderr, PACKAGE " version " VERSION "\n"); - fprintf(stderr, + if (badarg != 0) { + fprintf(stderr, + "ethtool: bad command line argument(s)\n" + "For more information run ethtool -h\n" + ); + } + else { + /* ethtool -h */ + fprintf(stdout, PACKAGE " version " VERSION "\n"); + fprintf(stdout, "Usage:\n" "ethtool DEVNAME\tDisplay standard information about device\n"); - for (i = 0; args[i].srt; i++) { - fprintf(stderr, " ethtool %s|%s DEVNAME\t%s\n%s", - args[i].srt, args[i].lng, - args[i].help, - args[i].opthelp ? args[i].opthelp : ""); + for (i = 0; args[i].srt; i++) { + fprintf(stdout, " ethtool %s|%s DEVNAME\t%s\n%s", + args[i].srt, args[i].lng, + args[i].help, + args[i].opthelp ? args[i].opthelp : ""); + } } exit(badarg); } |