summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>1993-10-26 00:11:14 +0000
committerJim Meyering <jim@meyering.net>1993-10-26 00:11:14 +0000
commitd7c526e66d7c4d3d11ca80c141b9fae18f0a9668 (patch)
tree6aad3a466a53d24a42c6b94a98edd429ff3e95b8 /src
parentcfe240bbd8520c852962f5feac1cfc5cf4903eb4 (diff)
downloadcoreutils-d7c526e66d7c4d3d11ca80c141b9fae18f0a9668.tar.xz
merge with 1.8.1i
Diffstat (limited to 'src')
-rw-r--r--src/basename.c12
-rw-r--r--src/date.c12
-rw-r--r--src/dirname.c12
-rw-r--r--src/echo.c12
-rw-r--r--src/env.c15
-rw-r--r--src/expr.c14
-rw-r--r--src/id.c12
-rw-r--r--src/logname.c12
-rw-r--r--src/nice.c14
-rw-r--r--src/pathchk.c12
-rw-r--r--src/printf.c19
-rw-r--r--src/sleep.c12
-rw-r--r--src/stty.c57
-rw-r--r--src/su.c16
-rw-r--r--src/tee.c12
-rw-r--r--src/test.c16
-rw-r--r--src/tty.c12
-rw-r--r--src/uname.c12
-rw-r--r--src/who.c12
19 files changed, 128 insertions, 167 deletions
diff --git a/src/basename.c b/src/basename.c
index 6c8e7fe55..9b7ccae8a 100644
--- a/src/basename.c
+++ b/src/basename.c
@@ -68,22 +68,18 @@ static void
usage (status)
int status;
{
- fprintf (status == 0 ? stdout : stderr, "\
-Usage: %s [OPTION]... PATH [SUFFIX]\n\
-",
- program_name);
-
if (status != 0)
fprintf (stderr, "Try `%s --help' for more information.\n",
program_name);
else
-
- printf ("\
+ {
+ printf ("Usage: %s [OPTION]... PATH [SUFFIX]\n", program_name);
+ printf ("\
\n\
--help display this help and exit\n\
--version output version information and exit\n\
");
-
+ }
exit (status);
}
diff --git a/src/date.c b/src/date.c
index 9e5605ca7..08998b2e1 100644
--- a/src/date.c
+++ b/src/date.c
@@ -224,20 +224,17 @@ static void
usage (status)
int status;
{
- fprintf (status == 0 ? stdout : stderr, "\
-Usage: %s [OPTION]... [+FORMAT] [MMDDhhmm[[CC]YY][.ss]]\n\
-",
- program_name);
-
if (status != 0)
fprintf (stderr, "Try `%s --help' for more information.\n",
program_name);
else
{
+ printf ("Usage: %s [OPTION]... [+FORMAT] [MMDDhhmm[[CC]YY][.ss]]\n",
+ program_name);
printf ("\
\n\
- -d, --date STRING display time described by STRING, not `now'\n\
- -s, --set STRING set time described by STRING\n\
+ -d, --date=STRING display time described by STRING, not `now'\n\
+ -s, --set=STRING set time described by STRING\n\
-u, --uct, --universal print or set Universal Coordinated Time\n\
--help display this help and exit\n\
--version output version information and exit\n\
@@ -278,6 +275,5 @@ FORMAT controls the output. Interpreted sequences are:\n\
%%y last two digits of year (00..99)\n\
");
}
-
exit (status);
}
diff --git a/src/dirname.c b/src/dirname.c
index a40c8267d..802713543 100644
--- a/src/dirname.c
+++ b/src/dirname.c
@@ -57,22 +57,18 @@ static void
usage (status)
int status;
{
- fprintf (status == 0 ? stdout : stderr, "\
-Usage: %s [OPTION]... PATH\n\
-",
- program_name);
-
if (status != 0)
fprintf (stderr, "Try `%s --help' for more information.\n",
program_name);
else
-
- printf ("\
+ {
+ printf ("Usage: %s [OPTION]... PATH\n", program_name);
+ printf ("\
\n\
--help display this help and exit\n\
--version output version information and exit\n\
");
-
+ }
exit (status);
}
diff --git a/src/echo.c b/src/echo.c
index 4a2f673de..65864ecf3 100644
--- a/src/echo.c
+++ b/src/echo.c
@@ -76,17 +76,13 @@ static void
usage (status)
int status;
{
- fprintf (status == 0 ? stdout : stderr, "\
-Usage: %s [OPTION]... [STRING]...\n\
-",
- program_name);
-
if (status != 0)
fprintf (stderr, "Try `%s --help' for more information.\n",
program_name);
else
-
- printf ("\
+ {
+ printf ("Usage: %s [OPTION]... [STRING]...\n", program_name);
+ printf ("\
\n\
-n do not output the trailing newline\n\
-e (unused)\n\
@@ -107,7 +103,7 @@ Without -E, the following sequences are recognized and interpolated:\n\
\\t horizontal tab\n\
\\v vertical tab\n\
");
-
+ }
exit (status);
}
diff --git a/src/env.c b/src/env.c
index 2fb0d7ec9..743cf5d0d 100644
--- a/src/env.c
+++ b/src/env.c
@@ -195,25 +195,22 @@ static void
usage (status)
int status;
{
- fprintf (status == 0 ? stdout : stderr, "\
-Usage: %s [OPTION]... [-] [NAME=VALUE]... [COMMAND [ARG]...]\n\
-",
- program_name);
-
if (status != 0)
fprintf (stderr, "Try `%s --help' for more information.\n",
program_name);
else
-
- printf ("\
+ {
+ printf ("Usage: %s [OPTION]... [-] [NAME=VALUE]... [COMMAND [ARG]...]\n",
+ program_name);
+ printf ("\
\n\
- -u, --unset NAME remove variable from the environment\n\
+ -u, --unset=NAME remove variable from the environment\n\
-i, --ignore-environment start with an empty environment\n\
--help display this help and exit\n\
--version output version information and exit\n\
\n\
A mere - implies -i. If no COMMAND, print the resulting environment.\n\
");
-
+ }
exit (status);
}
diff --git a/src/expr.c b/src/expr.c
index 22e7e83cc..26c4ffa0d 100644
--- a/src/expr.c
+++ b/src/expr.c
@@ -46,7 +46,7 @@
#include "system.h"
#include "version.h"
-#include "long-option.h"
+#include "long-options.h"
#if !defined (isascii) || defined (STDC_HEADERS)
#undef isascii
@@ -110,18 +110,17 @@ static void
usage (status)
int status;
{
- fprintf (status == 0 ? stdout : stderr, "\
-Usage: %s EXPRESSION\n\
- or: %s OPTION\n\
-",
- program_name, program_name);
-
if (status != 0)
fprintf (stderr, "Try `%s --help' for more information.\n",
program_name);
else
{
printf ("\
+Usage: %s EXPRESSION\n\
+ or: %s OPTION\n\
+",
+ program_name, program_name);
+ printf ("\
\n\
--help display this help and exit\n\
--version output version information and exit\n\
@@ -166,7 +165,6 @@ Pattern matches return the string matched between \\( and \\) or null; if\n\
\\( and \\) are not used, they return the number of characters matched or 0.\n\
");
}
-
exit (status);
}
diff --git a/src/id.c b/src/id.c
index 3f2b32c5b..a43921b93 100644
--- a/src/id.c
+++ b/src/id.c
@@ -363,17 +363,13 @@ static void
usage (status)
int status;
{
- fprintf (status == 0 ? stdout : stderr, "\
-Usage: %s [OPTION]... [USERNAME]\n\
-",
- program_name);
-
if (status != 0)
fprintf (stderr, "Try `%s --help' for more information.\n",
program_name);
else
-
- printf ("\
+ {
+ printf ("Usage: %s [OPTION]... [USERNAME]\n", program_name);
+ printf ("\
\n\
-g, --group print only the group ID\n\
-n, --name print a name instead of a number, for -ugG\n\
@@ -385,6 +381,6 @@ Usage: %s [OPTION]... [USERNAME]\n\
\n\
Without any OPTION, print some useful set of identified information.\n\
");
-
+ }
exit (status);
}
diff --git a/src/logname.c b/src/logname.c
index f8fcf3821..86f648c3d 100644
--- a/src/logname.c
+++ b/src/logname.c
@@ -53,22 +53,18 @@ static void
usage (status)
int status;
{
- fprintf (status == 0 ? stdout : stderr, "\
-Usage: %s [OPTION]...\n\
-",
- program_name);
-
if (status != 0)
fprintf (stderr, "Try `%s --help' for more information.\n",
program_name);
else
-
- printf ("\
+ {
+ printf ("Usage: %s [OPTION]...\n", program_name);
+ printf ("\
\n\
--help display this help and exit\n\
--version output version information and exit\n\
");
-
+ }
exit (status);
}
diff --git a/src/nice.c b/src/nice.c
index 616a8f31c..94f750eb5 100644
--- a/src/nice.c
+++ b/src/nice.c
@@ -174,26 +174,22 @@ static void
usage (status)
int status;
{
- fprintf (status == 0 ? stdout : stderr, "\
-Usage: %s [OPTION]... [COMMAND [ARG]...]\n\
-",
- program_name);
-
if (status != 0)
fprintf (stderr, "Try `%s --help' for more information.\n",
program_name);
else
-
- printf ("\
+ {
+ printf ("Usage: %s [OPTION]... [COMMAND [ARG]...]\n", program_name);
+ printf ("\
\n\
-ADJUST increment priority by ADJUST first\n\
- -n, --adjustment ADJUST same as -ADJUST\n\
+ -n, --adjustment=ADJUST same as -ADJUST\n\
--help display this help and exit\n\
--version output version information and exit\n\
\n\
With no COMMAND, print the current scheduling priority. ADJUST is 10\n\
by default. Range goes from -20 (highest priority) to 19 (lowest).\n\
");
-
+ }
exit (status);
}
diff --git a/src/pathchk.c b/src/pathchk.c
index afb663a62..e98b75ede 100644
--- a/src/pathchk.c
+++ b/src/pathchk.c
@@ -361,22 +361,18 @@ static void
usage (status)
int status;
{
- fprintf (status == 0 ? stdout : stderr, "\
-Usage: %s [OPTION]... PATH...\n\
-",
- program_name);
-
if (status != 0)
fprintf (stderr, "Try `%s --help' for more information.\n",
program_name);
else
-
- printf ("\
+ {
+ printf ("Usage: %s [OPTION]... PATH...\n", program_name);
+ printf ("\
\n\
-p, --portability check for all POSIX systems, not only this one\n\
--help display this help and exit\n\
--version output version information and exit\n\
");
-
+ }
exit (status);
}
diff --git a/src/printf.c b/src/printf.c
index c6d476b6f..43cc0dec3 100644
--- a/src/printf.c
+++ b/src/printf.c
@@ -61,7 +61,7 @@
#include "system.h"
#include "version.h"
-#include "long-option.h"
+#include "long-options.h"
#if !defined (isascii) || defined (STDC_HEADERS)
#undef isascii
@@ -104,18 +104,17 @@ static void
usage (status)
int status;
{
- fprintf (status == 0 ? stdout : stderr, "\
-Usage: %s FORMAT [ARGUMENT]...\n\
- or: %s OPTION\n\
-",
- program_name, program_name);
-
if (status != 0)
fprintf (stderr, "Try `%s --help' for more information.\n",
program_name);
else
-
- printf ("\
+ {
+ printf ("\
+Usage: %s FORMAT [ARGUMENT]...\n\
+ or: %s OPTION\n\
+",
+ program_name, program_name);
+ printf ("\
\n\
--help display this help and exit\n\
--version output version information and exit\n\
@@ -141,7 +140,7 @@ FORMAT controls the output as in C printf. Interpreted sequences are:\n\
and all C format specifications ending with one of diouxXfeEgGcs, with\n\
ARGUMENTs converted to proper type first. Variable widths are handled.\n\
");
-
+ }
exit (status);
}
diff --git a/src/sleep.c b/src/sleep.c
index a98ce9da9..bf15f81a4 100644
--- a/src/sleep.c
+++ b/src/sleep.c
@@ -57,24 +57,20 @@ static void
usage (status)
int status;
{
- fprintf (status == 0 ? stdout : stderr, "\
-Usage: %s [OPTION]... NUMBER[SUFFIX]\n\
-",
- program_name);
-
if (status != 0)
fprintf (stderr, "Try `%s --help' for more information.\n",
program_name);
else
-
- printf ("\
+ {
+ printf ("Usage: %s [OPTION]... NUMBER[SUFFIX]\n", program_name);
+ printf ("\
\n\
--help display this help and exit\n\
--version output version information and exit\n\
\n\
SUFFIX may be s for seconds, m for minutes, h for hours or d for days.\n\
");
-
+ }
exit (status);
}
diff --git a/src/stty.c b/src/stty.c
index c4d0946b2..07307ff37 100644
--- a/src/stty.c
+++ b/src/stty.c
@@ -446,16 +446,12 @@ static void
usage (status)
int status;
{
- fprintf (status == 0 ? stdout : stderr, "\
-Usage: %s [OPTION]... [SETTING]...\n\
-",
- program_name);
-
if (status != 0)
fprintf (stderr, "Try `%s --help' for more information.\n",
program_name);
else
{
+ printf ("Usage: %s [OPTION]... [SETTING]...\n", program_name);
printf ("\
\n\
-a, --all print all current settings in human-readable form\n\
@@ -619,7 +615,6 @@ settings, CHAR is taken literally, or coded as in ^c, 0x37, 0177 or\n\
127; special values ^- or undef used to disable special characters.\n\
");
}
-
exit (status);
}
@@ -675,7 +670,10 @@ done:;
if (optind == argc)
{
if (optc == '?')
- error (1, 0, "invalid argument `%s'", argv[--optind]);
+ {
+ error (0, 0, "invalid argument `%s'", argv[--optind]);
+ usage (1);
+ }
display_settings (output_type, &mode);
exit (0);
}
@@ -700,7 +698,10 @@ done:;
}
}
if (match_found == 0 && reversed)
- error (1, 0, "invalid argument `%s'", --argv[optind]);
+ {
+ error (0, 0, "invalid argument `%s'", --argv[optind]);
+ usage (1);
+ }
if (match_found == 0)
{
for (i = 0; control_info[i].name != NULL; ++i)
@@ -708,7 +709,10 @@ done:;
if (!strcmp (argv[optind], control_info[i].name))
{
if (optind == argc - 1)
- error (1, 0, "missing argument to `%s'", argv[optind]);
+ {
+ error (0, 0, "missing argument to `%s'", argv[optind]);
+ usage (1);
+ }
match_found = 1;
++optind;
set_control_char (&control_info[i], argv[optind], &mode);
@@ -721,14 +725,20 @@ done:;
if (!strcmp (argv[optind], "ispeed"))
{
if (optind == argc - 1)
- error (1, 0, "missing argument to `%s'", argv[optind]);
+ {
+ error (0, 0, "missing argument to `%s'", argv[optind]);
+ usage (1);
+ }
++optind;
set_speed (input_speed, argv[optind], &mode);
}
else if (!strcmp (argv[optind], "ospeed"))
{
if (optind == argc - 1)
- error (1, 0, "missing argument to `%s'", argv[optind]);
+ {
+ error (0, 0, "missing argument to `%s'", argv[optind]);
+ usage (1);
+ }
++optind;
set_speed (output_speed, argv[optind], &mode);
}
@@ -736,7 +746,10 @@ done:;
else if (!strcmp (argv[optind], "rows"))
{
if (optind == argc - 1)
- error (1, 0, "missing argument to `%s'", argv[optind]);
+ {
+ error (0, 0, "missing argument to `%s'", argv[optind]);
+ usage (1);
+ }
++optind;
set_window_size ((int) integer_arg (argv[optind]), -1);
}
@@ -744,7 +757,10 @@ done:;
|| !strcmp (argv[optind], "columns"))
{
if (optind == argc - 1)
- error (1, 0, "missing argument to `%s'", argv[optind]);
+ {
+ error (0, 0, "missing argument to `%s'", argv[optind]);
+ usage (1);
+ }
++optind;
set_window_size (-1, (int) integer_arg (argv[optind]));
}
@@ -755,7 +771,10 @@ done:;
else if (!strcmp (argv[optind], "line"))
{
if (optind == argc - 1)
- error (1, 0, "missing argument to `%s'", argv[optind]);
+ {
+ error (0, 0, "missing argument to `%s'", argv[optind]);
+ usage (1);
+ }
++optind;
mode.c_line = integer_arg (argv[optind]);
}
@@ -765,7 +784,10 @@ done:;
else if (string_to_baud (argv[optind]) != (speed_t) -1)
set_speed (both_speeds, argv[optind], &mode);
else if (recover_mode (argv[optind], &mode) == 0)
- error (1, 0, "invalid argument `%s'", argv[optind]);
+ {
+ error (0, 0, "invalid argument `%s'", argv[optind]);
+ usage (1);
+ }
}
optind++;
}
@@ -1479,6 +1501,9 @@ integer_arg (s)
p--;
if (*p)
- error (1, 0, "invalid integer argument `%s'", s);
+ {
+ error (0, 0, "invalid integer argument `%s'", s);
+ usage (1);
+ }
return value;
}
diff --git a/src/su.c b/src/su.c
index 7db31c107..7669aef1a 100644
--- a/src/su.c
+++ b/src/su.c
@@ -551,29 +551,25 @@ static void
usage (status)
int status;
{
- fprintf (status == 0 ? stdout : stderr, "\
-Usage: %s [OPTION]... [-] [USER [ARG]...]\n\
-",
- program_name);
-
if (status != 0)
fprintf (stderr, "Try `%s --help' for more information.\n",
program_name);
else
-
- printf ("\
+ {
+ printf ("Usage: %s [OPTION]... [-] [USER [ARG]...]\n", program_name);
+ printf ("\
\n\
-l, --login make the shell a login shell\n\
- -c, --commmand COMMAND pass a single COMMAND to the shell with -c\n\
+ -c, --commmand=COMMAND pass a single COMMAND to the shell with -c\n\
-f, --fast pass -f to the shell (for csh or tcsh)\n\
-m, --preserve-environment do not reset environment variables\n\
-p same as -m\n\
- -s, --shell SHELL run SHELL if /etc/shells allows it\n\
+ -s, --shell=SHELL run SHELL if /etc/shells allows it\n\
--help display this help and exit\n\
--version output version information and exit\n\
\n\
A mere - implies -l. If USER not given, assume root.\n\
");
-
+ }
exit (status);
}
diff --git a/src/tee.c b/src/tee.c
index 66fccd9f8..4cfa93ce1 100644
--- a/src/tee.c
+++ b/src/tee.c
@@ -70,24 +70,20 @@ static void
usage (status)
int status;
{
- fprintf (status == 0 ? stdout : stderr, "\
-Usage: %s [OPTION]... [FILE]...\n\
-",
- program_name);
-
if (status != 0)
fprintf (stderr, "Try `%s --help' for more information.\n",
program_name);
else
-
- printf ("\
+ {
+ printf ("Usage: %s [OPTION]... [FILE]...\n", program_name);
+ printf ("\
\n\
-a, --append append to the given FILEs, do not overwrite\n\
-i, --ignore-interrupts ignore interrupt signals\n\
--help display this help and exit\n\
--version output version information and exit\n\
");
-
+ }
exit (status);
}
diff --git a/src/test.c b/src/test.c
index c3d5c54cb..a4fd543dc 100644
--- a/src/test.c
+++ b/src/test.c
@@ -1008,25 +1008,24 @@ posixtest ()
}
#if defined (TEST_STANDALONE)
-#include "long-option.h"
+#include "long-options.h"
static void
usage (status)
int status;
{
- fprintf (status == 0 ? stdout : stderr, "\
-Usage: %s EXPRESSION\n\
- or: [ EXPRESSION ]\n\
- or: %s OPTION\n\
-",
- program_name, program_name);
-
if (status != 0)
fprintf (stderr, "Try `%s --help' for more information.\n",
program_name);
else
{
printf ("\
+Usage: %s EXPRESSION\n\
+ or: [ EXPRESSION ]\n\
+ or: %s OPTION\n\
+",
+ program_name, program_name);
+ printf ("\
\n\
--help display this help and exit\n\
--version output version information and exit\n\
@@ -1087,7 +1086,6 @@ Beware that parentheses need to be escaped by backslashes for shells.\n\
INTEGER may also be -l STRING, which evaluates to the length of STRING.\n\
");
}
-
exit (status);
}
#endif /* TEST_STANDALONE */
diff --git a/src/tty.c b/src/tty.c
index 83e3512ae..4b7aaa075 100644
--- a/src/tty.c
+++ b/src/tty.c
@@ -123,22 +123,18 @@ static void
usage (status)
int status;
{
- fprintf (status == 0 ? stdout : stderr, "\
-Usage: %s [OPTION]...\n\
-",
- program_name);
-
if (status != 0)
fprintf (stderr, "Try `%s --help' for more information.\n",
program_name);
else
-
- printf ("\
+ {
+ printf ("Usage: %s [OPTION]...\n", program_name);
+ printf ("\
\n\
-s, --silent, --quiet print nothing, only return an exit status\n\
--help display this help and exit\n\
--version output version information and exit\n\
");
-
+ }
exit (status);
}
diff --git a/src/uname.c b/src/uname.c
index 01b5f020c..65fad1c36 100644
--- a/src/uname.c
+++ b/src/uname.c
@@ -188,17 +188,13 @@ static void
usage (status)
int status;
{
- fprintf (status == 0 ? stdout : stderr, "\
-Usage: %s [OPTION]...\n\
-",
- program_name);
-
if (status != 0)
fprintf (stderr, "Try `%s --help' for more information.\n",
program_name);
else
-
- printf ("\
+ {
+ printf ("Usage: %s [OPTION]...\n", program_name);
+ printf ("\
\n\
-a, --all print all information\n\
-m, --machine print the machine (hardware) type\n\
@@ -211,6 +207,6 @@ Usage: %s [OPTION]...\n\
\n\
Without any OPTION, assume -s.\n\
");
-
+ }
exit (status);
}
diff --git a/src/who.c b/src/who.c
index 8b122c85b..f01da1b09 100644
--- a/src/who.c
+++ b/src/who.c
@@ -462,17 +462,13 @@ static void
usage (status)
int status;
{
- fprintf (status == 0 ? stdout : stderr, "\
-Usage: %s [OPTION]... [ FILE | ARG1 ARG2 ]\n\
-",
- program_name);
-
if (status != 0)
fprintf (stderr, "Try `%s --help' for more information.\n",
program_name);
else
-
- printf ("\
+ {
+ printf ("Usage: %s [OPTION]... [ FILE | ARG1 ARG2 ]\n", program_name);
+ printf ("\
\n\
-H, --heading print line of column headings\n\
-T, -w, --mesg add user's message status as +, - or ?\n\
@@ -488,6 +484,6 @@ Usage: %s [OPTION]... [ FILE | ARG1 ARG2 ]\n\
If FILE not given, uses /etc/utmp. /etc/wtmp as FILE is common.\n\
If ARG1 ARG2 given, -m presumed: `am i' or `mom likes' are usual.\n\
");
-
+ }
exit (status);
}