-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 According to Jim Meyering on 12/29/2008 10:22 AM: >> Would this usage text be acceptable at better describing the situation? >> >> Usage: /bin/echo [SHORT-OPTION]... [STRING]... >> or: /bin/echo LONG-OPTION > > Sure.
Here's a first patch that solves the issues that we agreed were trivial. OK to commit, or should I just push them to the next branch until we've had a day to think about it? I need to put more time into the other issues we discussed, such as: > Making [ accept no abbreviations does seem like it'd be an improvement. - -- Don't work too hard, make some time for fun as well! Eric Blake e...@byu.net -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (Cygwin) Comment: Public key at home.comcast.net/~ericblake/eblake.gpg Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iEYEARECAAYFAklmCqkACgkQ84KuGfSFAYDdRgCfSK5XFHU2CTHRhXjlM8RlcBPp vmIAnAptf8cU+wM2ZtyAxddTp2YaVhDU =r4kg -----END PGP SIGNATURE-----
From b1e1758b82550c4ee339e21d7a2763c160c24692 Mon Sep 17 00:00:00 2001 From: Eric Blake <e...@byu.net> Date: Thu, 8 Jan 2009 06:33:16 -0700 Subject: [PATCH] option handling: make exceptions more consistent * doc/coreutils.texi (Common options): Not all utilities reject option abbreviations. * src/chroot.c (main): Report correct name on failure. * src/echo.c (usage): Clarify long option usage. * src/setuidgid.c (usage): Likewise. * src/hostid.c (usage): Condense. --- doc/coreutils.texi | 2 +- src/chroot.c | 5 +++-- src/echo.c | 7 +++++-- src/hostid.c | 5 ++--- src/setuidgid.c | 6 +++--- 5 files changed, 14 insertions(+), 11 deletions(-) diff --git a/doc/coreutils.texi b/doc/coreutils.texi index 51145de..1cc237c 100644 --- a/doc/coreutils.texi +++ b/doc/coreutils.texi @@ -681,7 +681,7 @@ Common options Some of these programs recognize the @option{--help} and @option{--version} options only when one of them is the sole command line argument. For -these programs, abbreviations of the long options are not recognized. +these programs, abbreviations of the long options are not always recognized. @table @samp diff --git a/src/chroot.c b/src/chroot.c index 1eb443c..6d3fddf 100644 --- a/src/chroot.c +++ b/src/chroot.c @@ -1,5 +1,5 @@ /* chroot -- run command or shell with special root directory - Copyright (C) 95, 96, 1997, 1999-2004, 2007-2008 + Copyright (C) 95, 96, 1997, 1999-2004, 2007-2009 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify @@ -83,7 +83,8 @@ main (int argc, char **argv) } if (chroot (argv[optind]) != 0) - error (EXIT_FAILURE, errno, _("cannot change root directory to %s"), argv[1]); + error (EXIT_FAILURE, errno, _("cannot change root directory to %s"), + argv[optind]); if (chdir ("/")) error (EXIT_FAILURE, errno, _("cannot chdir to root directory")); diff --git a/src/echo.c b/src/echo.c index d549cda..c4b7ca9 100644 --- a/src/echo.c +++ b/src/echo.c @@ -1,5 +1,5 @@ /* echo.c, derived from code echo.c in Bash. - Copyright (C) 87,89, 1991-1997, 1999-2005, 2007-2008 Free Software + Copyright (C) 87,89, 1991-1997, 1999-2005, 2007-2009 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify @@ -41,7 +41,10 @@ usage (int status) program_name); else { - printf (_("Usage: %s [OPTION]... [STRING]...\n"), program_name); + printf (_("\ +Usage: %s [SHORT-OPTION]... [STRING]...\n\ + or: %s LONG-OPTION\n\ +"), program_name, program_name); fputs (_("\ Echo the STRING(s) to standard output.\n\ \n\ diff --git a/src/hostid.c b/src/hostid.c index f3cabc4..4482bd5 100644 --- a/src/hostid.c +++ b/src/hostid.c @@ -1,6 +1,6 @@ /* print the hexadecimal identifier for the current host - Copyright (C) 1997, 1999, 2000, 2001, 2002, 2003, 2004, 2007-2008 Free + Copyright (C) 1997, 1999, 2000, 2001, 2002, 2003, 2004, 2007-2009 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify @@ -42,8 +42,7 @@ usage (int status) else { printf (_("\ -Usage: %s\n\ - or: %s OPTION\n\ +Usage: %s [OPTION]\n\ Print the numeric identifier (in hexadecimal) for the current host.\n\ \n\ "), diff --git a/src/setuidgid.c b/src/setuidgid.c index 057002c..beff04a 100644 --- a/src/setuidgid.c +++ b/src/setuidgid.c @@ -1,5 +1,5 @@ /* setuidgid - run a command with the UID and GID of a specified user - Copyright (C) 2003-2008 Free Software Foundation, Inc. + Copyright (C) 2003-2009 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -48,8 +48,8 @@ usage (int status) else { printf (_("\ -Usage: %s OPTION USER COMMAND [ARGUMENT]...\n\ - or: %s OPTION\n\ +Usage: %s [SHORT-OPTION]... USER COMMAND [ARGUMENT]...\n\ + or: %s LONG-OPTION\n\ "), program_name, program_name); -- 1.6.0.4
_______________________________________________ Bug-coreutils mailing list Bug-coreutils@gnu.org http://lists.gnu.org/mailman/listinfo/bug-coreutils