summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/chgrp.c20
-rw-r--r--src/chmod.c19
-rw-r--r--src/chown.c19
-rw-r--r--src/cp.c16
-rw-r--r--src/dd.c20
-rw-r--r--src/df.c20
-rw-r--r--src/du.c30
-rw-r--r--src/install.c19
-rw-r--r--src/ln.c21
-rw-r--r--src/ls.c15
-rw-r--r--src/mkdir.c20
-rw-r--r--src/mkfifo.c20
-rw-r--r--src/mknod.c20
-rw-r--r--src/mv.c19
-rw-r--r--src/rm.c20
-rw-r--r--src/rmdir.c20
-rw-r--r--src/touch.c20
17 files changed, 144 insertions, 194 deletions
diff --git a/src/chgrp.c b/src/chgrp.c
index bb4a5af3e..74438ef93 100644
--- a/src/chgrp.c
+++ b/src/chgrp.c
@@ -307,13 +307,13 @@ static void
usage (status)
int status;
{
- fprintf (status == 0 ? stdout : stderr, "\
-Usage: %s [OPTION]... GROUP FILE...\n\
-",
- program_name);
-
- if (status == 0)
- printf ("\
+ if (status != 0)
+ fprintf (stderr, "Try `%s --help' for more information.\n",
+ program_name);
+ else
+ {
+ printf ("Usage: %s [OPTION]... GROUP FILE...\n", program_name);
+ printf ("\
\n\
-c, --changes like verbose but report only when a change is made\n\
-f, --silent, --quiet suppress most error messages\n\
@@ -321,10 +321,6 @@ Usage: %s [OPTION]... GROUP FILE...\n\
-R, --recursive change files and directories recursively\n\
--help display this help and exit\n\
--version output version information and exit\n");
-
- else
- fprintf (stderr, "Try `%s --help' for more information.\n",
- program_name);
-
+ }
exit (status);
}
diff --git a/src/chmod.c b/src/chmod.c
index 5143b2055..641f1ecbd 100644
--- a/src/chmod.c
+++ b/src/chmod.c
@@ -316,14 +316,17 @@ static void
usage (status)
int status;
{
- fprintf (status == 0 ? stdout : stderr, "\
+ if (status != 0)
+ fprintf (stderr, "Try `%s --help' for more information.\n",
+ program_name);
+ else
+ {
+ printf ("\
Usage: %s [OPTION]... MODE[,MODE]... FILE...\n\
or: %s [OPTION]... OCTAL_MODE FILE...\n\
",
- program_name, program_name);
-
- if (status == 0)
- printf ("\
+ program_name, program_name);
+ printf ("\
\n\
-c, --changes like verbose but report only when a change is made\n\
-f, --silent, --quiet suppress most error messages\n\
@@ -334,10 +337,6 @@ Usage: %s [OPTION]... MODE[,MODE]... FILE...\n\
\n\
Each MODE is one or more of the letters ugoa, one of the symbols +-= and\n\
one or more of the letters rwxXstugo.\n");
-
- else
- fprintf (stderr, "Try `%s --help' for more information.\n",
- program_name);
-
+ }
exit (status);
}
diff --git a/src/chown.c b/src/chown.c
index c1223b1a7..22bd4f1a9 100644
--- a/src/chown.c
+++ b/src/chown.c
@@ -295,14 +295,17 @@ static void
usage (status)
int status;
{
- fprintf (status == 0 ? stdout : stderr, "\
+ if (status != 0)
+ fprintf (stderr, "Try `%s --help' for more information.\n",
+ program_name);
+ else
+ {
+ printf ("\
Usage: %s [OPTION]... OWNER[.[GROUP]] FILE...\n\
or: %s [OPTION]... .[GROUP] FILE...\n\
",
- program_name, program_name);
-
- if (status == 0)
- printf ("\
+ program_name, program_name);
+ printf ("\
\n\
-c, --changes be verbose whenever change occurs\n\
-f, --silent, --quiet suppress most error messages\n\
@@ -313,10 +316,6 @@ Usage: %s [OPTION]... OWNER[.[GROUP]] FILE...\n\
\n\
Owner is unchanged if missing. Group is unchanged if missing, but changed\n\
to login group if implied by a period. A colon may replace the period.\n");
-
- else
- fprintf (stderr, "Try `%s --help' for more information.\n",
- program_name);
-
+ }
exit (status);
}
diff --git a/src/cp.c b/src/cp.c
index 4fca2c3f9..7c46227d3 100644
--- a/src/cp.c
+++ b/src/cp.c
@@ -268,7 +268,7 @@ main (argc, argv)
break;
default:
- usage ((char *) 0, 2);
+ usage (2, (char *) 0);
}
}
@@ -279,10 +279,10 @@ main (argc, argv)
}
if (show_help)
- usage (NULL, 0);
+ usage (0, NULL);
if (flag_hard_link && flag_symbolic_link)
- usage ("cannot make both hard and symbolic links", 2);
+ usage (2, "cannot make both hard and symbolic links");
if (make_backups)
backup_type = get_version (version);
@@ -321,9 +321,9 @@ do_copy (argc, argv)
int ret = 0;
if (optind >= argc)
- usage ("missing file arguments", 2);
+ usage (2, "missing file arguments");
if (optind >= argc - 1)
- usage ("missing file argument", 2);
+ usage (2, "missing file argument");
dest = argv[argc - 1];
@@ -427,7 +427,7 @@ do_copy (argc, argv)
struct stat source_stats;
if (flag_path)
- usage ("when preserving paths, last argument must be a directory", 2);
+ usage (2, "when preserving paths, last argument must be a directory");
source = argv[optind];
@@ -459,8 +459,8 @@ do_copy (argc, argv)
return copy (source, new_dest, new_dst, 0, (struct dir_list *) 0);
}
else
- usage ("when copying multiple files, last argument must be a directory",
- 2);
+ usage (2,
+ "when copying multiple files, last argument must be a directory");
}
/* Copy the file SRC_PATH to the file DST_PATH. The files may be of
diff --git a/src/dd.c b/src/dd.c
index c57c75195..971d7eb73 100644
--- a/src/dd.c
+++ b/src/dd.c
@@ -1073,13 +1073,13 @@ static void
usage (status)
int status;
{
- fprintf (status == 0 ? stdout : stderr, "\
-Usage: %s [OPTION]...\n\
-",
- program_name);
-
- if (status == 0)
- printf ("\
+ if (status != 0)
+ fprintf (stderr, "Try `%s --help' for more information.\n",
+ program_name);
+ else
+ {
+ printf ("Usage: %s [OPTION]...\n", program_name);
+ printf ("\
\n\
bs=BYTES force ibs=BYTES and obs=BYTES\n\
cbs=BYTES convert BYTES bytes at a time\n\
@@ -1107,10 +1107,6 @@ by w for x2, by b for x512, by k for x1024. Each KEYWORD may be:\n\
swab swap every pair of input bytes\n\
noerror continue after read errors\n\
sync pad every input block with NULs to ibs-size\n");
-
- else
- fprintf (stderr, "Try `%s --help' for more information.\n",
- program_name);
-
+ }
exit (status);
}
diff --git a/src/df.c b/src/df.c
index f4a2e7646..c73a739fa 100644
--- a/src/df.c
+++ b/src/df.c
@@ -477,13 +477,13 @@ static void
usage (status)
int status;
{
- fprintf (status == 0 ? stdout : stderr, "\
-Usage: %s [OPTION] [PATH]...\n\
-",
- program_name);
-
- if (status == 0)
- printf ("\
+ if (status != 0)
+ fprintf (stderr, "Try `%s --help' for more information.\n",
+ program_name);
+ else
+ {
+ printf ("Usage: %s [OPTION] [PATH]...\n", program_name);
+ printf ("\
\n\
-a, --all include filesystems having 0 blocks\n\
-i, --inodes list inode information instead of block usage\n\
@@ -496,10 +496,6 @@ Usage: %s [OPTION] [PATH]...\n\
--version output version information and exit\n\
\n\
If no PATHs are given, list all currently mounted filesystems.\n");
-
- else
- fprintf (stderr, "Try `%s --help' for more information.\n",
- program_name);
-
+ }
exit (status);
}
diff --git a/src/du.c b/src/du.c
index 35350f57e..c38db16c8 100644
--- a/src/du.c
+++ b/src/du.c
@@ -191,21 +191,21 @@ static struct option const long_options[] =
};
static void
-usage (reason, status)
- char *reason;
+usage (status, reason)
int status;
+ char *reason;
{
if (reason != NULL)
fprintf (status == 0 ? stdout : stderr, "%s: %s\n",
program_name, reason);
- fprintf (status == 0 ? stdout : stderr, "\
-Usage: %s [OPTION]... [PATH]...\n\
-",
- program_name);
-
- if (status == 0)
- printf ("\
+ if (status != 0)
+ fprintf (stderr, "Try `%s --help' for more information.\n",
+ program_name);
+ else
+ {
+ printf ("Usage: %s [OPTION]... [PATH]...\n", program_name);
+ printf ("\
\n\
-a, --all write counts for all files, not just directories\n\
-b, --bytes print size in bytes\n\
@@ -219,11 +219,7 @@ Usage: %s [OPTION]... [PATH]...\n\
-S, --separate-dirs do not include size of subdirectories\n\
--help display this help and exit\n\
--version output version information and exit\n");
-
- else
- fprintf (stderr, "Try `%s --help' for more information.\n",
- program_name);
-
+ }
exit (status);
}
@@ -287,7 +283,7 @@ main (argc, argv)
break;
default:
- usage ((char *) 0, 2);
+ usage (2, (char *) 0);
}
}
@@ -298,10 +294,10 @@ main (argc, argv)
}
if (show_help)
- usage (NULL, 0);
+ usage (0, NULL);
if (opt_all && opt_summarize_only)
- usage ("cannot both summarize and show all entries", 2);
+ usage (2, "cannot both summarize and show all entries");
/* Initialize the hash structure for inode numbers. */
hash_init (INITIAL_HASH_MODULE, INITIAL_ENTRY_TAB_SIZE);
diff --git a/src/install.c b/src/install.c
index b9f34f33f..a5e795e3f 100644
--- a/src/install.c
+++ b/src/install.c
@@ -540,15 +540,18 @@ static void
usage (status)
int status;
{
- fprintf (status == 0 ? stdout : stderr, "\
+ if (status != 0)
+ fprintf (stderr, "Try `%s --help' for more information.\n",
+ program_name);
+ else
+ {
+ printf ("\
Usage: %s [OPTION]... SOURCE DEST (1st format)\n\
or: %s [OPTION]... SOURCE... DIRECTORY (2nd format)\n\
or: %s [OPTION]... DIRECTORY... (3nd format)\n\
",
- program_name, program_name, program_name);
-
- if (status == 0)
- printf ("\
+ program_name, program_name, program_name);
+ printf ("\
\n\
-c (ignored)\n\
-d, --directory create [leading] directories, mandatory for 3rd format\n\
@@ -558,10 +561,6 @@ Usage: %s [OPTION]... SOURCE DEST (1st format)\n\
-s, --strip strip symbol tables, only for 1st and 2nd formats\n\
--help display this help and exit\n\
--version output version information and exit\n");
-
- else
- fprintf (stderr, "Try `%s --help' for more information.\n",
- program_name);
-
+ }
exit (status);
}
diff --git a/src/ln.c b/src/ln.c
index 94b63e0a6..c154913f3 100644
--- a/src/ln.c
+++ b/src/ln.c
@@ -353,14 +353,17 @@ static void
usage (status)
int status;
{
- fprintf (status == 0 ? stdout : stderr, "\
+ if (status != 0)
+ fprintf (stderr, "Try `%s --help' for more information.\n",
+ program_name);
+ else
+ {
+ printf ("\
Usage: %s [OPTION]... SOURCE [DEST]\n\
or: %s [OPTION]... SOURCE... DIRECTORY\n\
",
- program_name, program_name);
-
- if (status == 0)
- printf ("\
+ program_name, program_name);
+ printf ("\
\n\
-b, --backup make backups for removed files\n\
-d, -F, --directory hard link directories (super-user only)\n\
@@ -378,11 +381,7 @@ version control may be set with VERSION_CONTROL, values are:\n\
\n\
t, numbered make numbered backups\n\
nil, existing numbered if numbered backups exist, simple otherwise\n\
- never, simple always make simple backups \n");
-
- else
- fprintf (stderr, "Try `%s --help' for more information.\n",
- program_name);
-
+ never, simple always make simple backups\n");
+ }
exit (status);
}
diff --git a/src/ls.c b/src/ls.c
index b5faa9535..412759b77 100644
--- a/src/ls.c
+++ b/src/ls.c
@@ -1880,13 +1880,12 @@ static void
usage (status)
int status;
{
- fprintf (status == 0 ? stdout : stderr, "\
-Usage: %s [OPTION]... [PATH]...\n\
-",
- program_name);
-
- if (status == 0)
+ if (status != 0)
+ fprintf (stderr, "Try `%s --help' for more information.\n",
+ program_name);
+ else
{
+ printf ("Usage: %s [OPTION]... [PATH]...\n", program_name);
printf ("\
\n\
-a, --all do not hide entries starting with .\n\
@@ -1937,9 +1936,5 @@ Usage: %s [OPTION]... [PATH]...\n\
Sort entries alphabetically if none of -cftuSUX nor --sort.\n");
}
- else
- fprintf (stderr, "Try `%s --help' for more information.\n",
- program_name);
-
exit (status);
}
diff --git a/src/mkdir.c b/src/mkdir.c
index dd4abda2e..d0361d261 100644
--- a/src/mkdir.c
+++ b/src/mkdir.c
@@ -145,23 +145,19 @@ static void
usage (status)
int status;
{
- fprintf (status == 0 ? stdout : stderr, "\
-Usage: %s [OPTION] DIRECTORY...\n\
-",
- program_name);
-
- if (status == 0)
- printf ("\
+ if (status != 0)
+ fprintf (stderr, "Try `%s --help' for more information.\n",
+ program_name);
+ else
+ {
+ printf ("Usage: %s [OPTION] DIRECTORY...\n", program_name);
+ printf ("\
\n\
-p, --parents no error if existing, make parent directories as needed\n\
-m, --mode MODE set permission mode (as in chmod), not 0777 - umask\n\
--help display this help and exit\n\
--version output version information and exit\n");
-
- else
- fprintf (stderr, "Try `%s --help' for more information.\n",
- program_name);
-
+ }
exit (status);
}
diff --git a/src/mkfifo.c b/src/mkfifo.c
index 13ea51dd8..d358e183b 100644
--- a/src/mkfifo.c
+++ b/src/mkfifo.c
@@ -133,22 +133,18 @@ static void
usage (status)
int status;
{
- fprintf (status == 0 ? stdout : stderr, "\
-Usage: %s [OPTION] PATH...\n\
-",
- program_name);
-
- if (status == 0)
- printf ("\
+ if (status != 0)
+ fprintf (stderr, "Try `%s --help' for more information.\n",
+ program_name);
+ else
+ {
+ printf ("Usage: %s [OPTION] PATH...\n", program_name);
+ printf ("\
\n\
-m, --mode MODE set permission mode (as in chmod), not 0666 - umask\n\
--help display this help and exit\n\
--version output version information and exit\n");
-
- else
- fprintf (stderr, "Try `%s --help' for more information.\n",
- program_name);
-
+ }
exit (status);
}
#endif
diff --git a/src/mknod.c b/src/mknod.c
index 02d4e3df3..30bb7b6f7 100644
--- a/src/mknod.c
+++ b/src/mknod.c
@@ -168,13 +168,13 @@ static void
usage (status)
int status;
{
- fprintf (status == 0 ? stdout : stderr, "\
-Usage: %s [OPTION]... PATH TYPE [MAJOR MINOR]\n\
-",
- program_name);
-
- if (status == 0)
- printf ("\
+ if (status != 0)
+ fprintf (stderr, "Try `%s --help' for more information.\n",
+ program_name);
+ else
+ {
+ printf ("Usage: %s [OPTION]... PATH TYPE [MAJOR MINOR]\n", program_name);
+ printf ("\
\n\
-m, --mode MODE set permission mode (as in chmod), not 0666 - umask\n\
--help display this help and exit\n\
@@ -185,10 +185,6 @@ MAJOR MINOR are forbidden for TYPE p, mandatory otherwise. TYPE may be:\n\
b create a block (buffered) special file\n\
c, u create a character (unbuffered) special file \n\
p create a FIFO\n");
-
- else
- fprintf (stderr, "Try `%s --help' for more information.\n",
- program_name);
-
+ }
exit (status);
}
diff --git a/src/mv.c b/src/mv.c
index aa40ae157..0cc21d2d3 100644
--- a/src/mv.c
+++ b/src/mv.c
@@ -472,14 +472,17 @@ static void
usage (status)
int status;
{
- fprintf (status == 0 ? stdout : stderr, "\
+ if (status != 0)
+ fprintf (stderr, "Try `%s --help' for more information.\n",
+ program_name);
+ else
+ {
+ printf ("\
Usage: %s [OPTION]... SOURCE DEST\n\
or: %s [OPTION]... SOURCE... DIRECTORY\n\
",
- program_name, program_name);
-
- if (status == 0)
- printf ("\
+ program_name, program_name);
+ printf ("\
\n\
-b, --backup make backup before removal\n\
-f, --force remove existing destinations, never prompt\n\
@@ -497,10 +500,6 @@ version control may be set with VERSION_CONTROL, values are:\n\
t, numbered make numbered backups\n\
nil, existing numbered if numbered backups exist, simple otherwise\n\
never, simple always make simple backups \n");
-
- else
- fprintf (stderr, "Try `%s --help' for more information.\n",
- program_name);
-
+ }
exit (status);
}
diff --git a/src/rm.c b/src/rm.c
index ef4958704..bae9e95b3 100644
--- a/src/rm.c
+++ b/src/rm.c
@@ -530,13 +530,13 @@ static void
usage (status)
int status;
{
- fprintf (status == 0 ? stdout : stderr, "\
-Usage: %s [OPTION]... PATH...\n\
-",
- program_name);
-
- if (status == 0)
- printf ("\
+ if (status != 0)
+ fprintf (stderr, "Try `%s --help' for more information.\n",
+ program_name);
+ else
+ {
+ printf ("Usage: %s [OPTION]... PATH...\n", program_name);
+ printf ("\
\n\
-d, --directory unlink directory, even if non-empty (super-user only)\n\
-f, --force ignore nonexistent files, never prompt\n\
@@ -545,10 +545,6 @@ Usage: %s [OPTION]... PATH...\n\
-r, -R, --recursive remove the contents of directories recursively\n\
--help display this help and exit\n\
--version output version information and exit\n");
-
- else
- fprintf (stderr, "Try `%s --help' for more information.\n",
- program_name);
-
+ }
exit (status);
}
diff --git a/src/rmdir.c b/src/rmdir.c
index 8859f94ea..c863973f7 100644
--- a/src/rmdir.c
+++ b/src/rmdir.c
@@ -147,21 +147,17 @@ static void
usage (status)
int status;
{
- fprintf (status == 0 ? stdout : stderr, "\
-Usage: %s [OPTION]... DIRECTORY...\n\
-",
- program_name);
-
- if (status == 0)
- printf ("\
+ if (status != 0)
+ fprintf (stderr, "Try `%s --help' for more information.\n",
+ program_name);
+ else
+ {
+ printf ("Usage: %s [OPTION]... DIRECTORY...\n", program_name);
+ printf ("\
\n\
-p, --parents remove explicit parent directories if being emptied\n\
--help display this help and exit\n\
--version output version information and exit\n");
-
- else
- fprintf (stderr, "Try `%s --help' for more information.\n",
- program_name);
-
+ }
exit (status);
}
diff --git a/src/touch.c b/src/touch.c
index 78c2258f5..2b298e763 100644
--- a/src/touch.c
+++ b/src/touch.c
@@ -379,13 +379,13 @@ static void
usage (status)
int status;
{
- fprintf (status == 0 ? stdout : stderr, "\
-Usage: %s [OPTION]... FILE...\n\
-",
- program_name);
-
- if (status == 0)
- printf ("\
+ if (status != 0)
+ fprintf (stderr, "Try `%s --help' for more information.\n",
+ program_name);
+ else
+ {
+ printf ("Usage: %s [OPTION]... FILE...\n", program_name);
+ printf ("\
\n\
-a change only the access time\n\
-c do not create any files\n\
@@ -399,10 +399,6 @@ Usage: %s [OPTION]... FILE...\n\
--version output version information and exit\n\
\n\
STAMP may be used without -t if none of -drt, nor --, are used.\n");
-
- else
- fprintf (stderr, "Try `%s --help' for more information.\n",
- program_name);
-
+ }
exit (status);
}