mirror of
git://git.sv.gnu.org/coreutils.git
synced 2026-08-11 19:41:13 +02:00
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.
This commit is contained in:
+1
-1
@@ -681,7 +681,7 @@ abbreviations of those options. For example, @samp{rmdir
|
||||
|
||||
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
|
||||
|
||||
|
||||
+3
-2
@@ -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"));
|
||||
|
||||
+5
-2
@@ -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\
|
||||
|
||||
+3
-5
@@ -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,12 +42,10 @@ 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\
|
||||
"),
|
||||
program_name, program_name);
|
||||
"), program_name);
|
||||
fputs (HELP_OPTION_DESCRIPTION, stdout);
|
||||
fputs (VERSION_OPTION_DESCRIPTION, stdout);
|
||||
emit_bug_reporting_address ();
|
||||
|
||||
+3
-3
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user