* [PATCH 1/2] ethtool: Show short message for syntax error
@ 2008-11-27 4:11 Ben Hutchings
2009-03-06 10:59 ` Jeff Garzik
0 siblings, 1 reply; 2+ messages in thread
From: Ben Hutchings @ 2008-11-27 4:11 UTC (permalink / raw)
To: Jeff Garzik; +Cc: netdev
[-- Attachment #1: Type: text/plain, Size: 1406 bytes --]
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>
---
This change has been in Debian for some years, made in response to
bug report http://bugs.debian.org/256249
Ben.
--- ethtool-6+20080227.orig/ethtool.c
+++ ethtool-6+20080227/ethtool.c
@@ -196,15 +196,24 @@
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);
}
--
Ben Hutchings
Time is nature's way of making sure that everything doesn't happen at once.
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH 1/2] ethtool: Show short message for syntax error
2008-11-27 4:11 [PATCH 1/2] ethtool: Show short message for syntax error Ben Hutchings
@ 2009-03-06 10:59 ` Jeff Garzik
0 siblings, 0 replies; 2+ messages in thread
From: Jeff Garzik @ 2009-03-06 10:59 UTC (permalink / raw)
To: Ben Hutchings; +Cc: netdev
Ben Hutchings wrote:
> 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>
> ---
> This change has been in Debian for some years, made in response to
> bug report http://bugs.debian.org/256249
applied
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2009-03-06 10:59 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-11-27 4:11 [PATCH 1/2] ethtool: Show short message for syntax error Ben Hutchings
2009-03-06 10:59 ` Jeff Garzik
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).