This patch, put together by Manuel Novoa III, is a merge of work
done by Evin Robertson (bug#1105) and work from Manuel to make
usage messages occupy less space and simplify how usage messages
are displayed.
diff --git a/coreutils/basename.c b/coreutils/basename.c
index cba003d..da59a86 100644
--- a/coreutils/basename.c
+++ b/coreutils/basename.c
@@ -31,7 +31,7 @@
char *s;
if ((argc < 2) || (**(argv + 1) == '-')) {
- usage(basename_usage);
+ show_usage();
}
argv++;
diff --git a/coreutils/chroot.c b/coreutils/chroot.c
index cd8101e..e721e1f 100644
--- a/coreutils/chroot.c
+++ b/coreutils/chroot.c
@@ -33,7 +33,7 @@
char *prog;
if ((argc < 2) || (**(argv + 1) == '-')) {
- usage(chroot_usage);
+ show_usage();
}
argc--;
argv++;
diff --git a/coreutils/cmp.c b/coreutils/cmp.c
index dd70261..c04b6e1 100644
--- a/coreutils/cmp.c
+++ b/coreutils/cmp.c
@@ -36,7 +36,7 @@
/* parse argv[] */
if (argc < 2 || 3 < argc)
- usage(cmp_usage);
+ show_usage();
fp1 = xfopen(argv[1], "r");
if (argv[2] != NULL) {
diff --git a/coreutils/date.c b/coreutils/date.c
index 8b6a062..21d31bb 100644
--- a/coreutils/date.c
+++ b/coreutils/date.c
@@ -151,7 +151,7 @@
case 's':
set_time = 1;
if ((date_str != NULL) || ((date_str = optarg) == NULL)) {
- usage(date_usage);
+ show_usage();
}
break;
case 'u':
@@ -162,10 +162,10 @@
case 'd':
use_arg = 1;
if ((date_str != NULL) || ((date_str = optarg) == NULL))
- usage(date_usage);
+ show_usage();
break;
default:
- usage(date_usage);
+ show_usage();
}
}
@@ -178,7 +178,7 @@
#if 0
else {
error_msg("date_str='%s' date_fmt='%s'\n", date_str, date_fmt);
- usage(date_usage);
+ show_usage();
}
#endif
diff --git a/coreutils/dd.c b/coreutils/dd.c
index 75bbfba..e445e04 100644
--- a/coreutils/dd.c
+++ b/coreutils/dd.c
@@ -84,7 +84,7 @@
buf++;
}
} else
- usage(dd_usage);
+ show_usage();
}
buf = xmalloc(bs);
diff --git a/coreutils/df.c b/coreutils/df.c
index 5591979..8b6726b 100644
--- a/coreutils/df.c
+++ b/coreutils/df.c
@@ -143,7 +143,7 @@
return status;
print_df_usage:
- usage(df_usage);
+ show_usage();
return(FALSE);
}
diff --git a/coreutils/dirname.c b/coreutils/dirname.c
index 2e11a69..e34ecf8 100644
--- a/coreutils/dirname.c
+++ b/coreutils/dirname.c
@@ -30,7 +30,7 @@
char* s;
if ((argc < 2) || (**(argv + 1) == '-'))
- usage(dirname_usage);
+ show_usage();
argv++;
s=*argv+strlen(*argv)-1;
diff --git a/coreutils/dos2unix.c b/coreutils/dos2unix.c
index 9fd952c..3242361 100644
--- a/coreutils/dos2unix.c
+++ b/coreutils/dos2unix.c
@@ -31,7 +31,7 @@
if (argc > 1) {
c = *argv[1];
if (c == '-') {
- usage(dos2unix_usage);
+ show_usage();
}
}
c = getchar();
diff --git a/coreutils/du.c b/coreutils/du.c
index c56afbc..516f4c9 100644
--- a/coreutils/du.c
+++ b/coreutils/du.c
@@ -163,7 +163,7 @@
case 'k': break;
#endif
default:
- usage(du_usage);
+ show_usage();
}
}
@@ -187,7 +187,7 @@
return status;
}
-/* $Id: du.c,v 1.36 2001/01/27 09:33:38 andersen Exp $ */
+/* $Id: du.c,v 1.37 2001/02/14 21:23:05 andersen Exp $ */
/*
Local Variables:
c-file-style: "linux"
diff --git a/coreutils/head.c b/coreutils/head.c
index 7d87f32..a2d7744 100644
--- a/coreutils/head.c
+++ b/coreutils/head.c
@@ -57,7 +57,7 @@
break;
/* fallthrough */
default:
- usage(head_usage);
+ show_usage();
}
}
diff --git a/coreutils/id.c b/coreutils/id.c
index 650e3db..3667b32 100644
--- a/coreutils/id.c
+++ b/coreutils/id.c
@@ -53,11 +53,11 @@
name_not_number++;
break;
default:
- usage(id_usage);
+ show_usage();
}
}
- if (no_user && no_group) usage(id_usage);
+ if (no_user && no_group) show_usage();
if (argv[optind] == NULL) {
if (print_real) {
diff --git a/coreutils/length.c b/coreutils/length.c
index 1ab4e3a..9119adc 100644
--- a/coreutils/length.c
+++ b/coreutils/length.c
@@ -7,7 +7,7 @@
extern int length_main(int argc, char **argv)
{
if (argc != 2 || **(argv + 1) == '-')
- usage(length_usage);
+ show_usage();
printf("%lu\n", (long)strlen(argv[1]));
return EXIT_SUCCESS;
}
diff --git a/coreutils/ln.c b/coreutils/ln.c
index 54e81f4..9dc7f5d 100644
--- a/coreutils/ln.c
+++ b/coreutils/ln.c
@@ -101,7 +101,7 @@
flag |= LN_NODEREFERENCE;
break;
default:
- usage(ln_usage);
+ show_usage();
}
}
while(optind<(argc-1)) {
diff --git a/coreutils/logname.c b/coreutils/logname.c
index d9056c6..a1887aa 100644
--- a/coreutils/logname.c
+++ b/coreutils/logname.c
@@ -30,7 +30,7 @@
char user[9];
if (argc > 1)
- usage(logname_usage);
+ show_usage();
my_getpwuid(user, geteuid());
if (*user) {
diff --git a/coreutils/ls.c b/coreutils/ls.c
index 42b2445..06e23e6 100644
--- a/coreutils/ls.c
+++ b/coreutils/ls.c
@@ -928,5 +928,5 @@
return(status);
print_usage_message:
- usage(ls_usage);
+ show_usage();
}
diff --git a/coreutils/md5sum.c b/coreutils/md5sum.c
index 97a9400..3decafd 100644
--- a/coreutils/md5sum.c
+++ b/coreutils/md5sum.c
@@ -850,7 +850,7 @@
break;
default:
- usage(md5sum_usage);
+ show_usage();
}
}
diff --git a/coreutils/mkdir.c b/coreutils/mkdir.c
index 299f298..285d34f 100644
--- a/coreutils/mkdir.c
+++ b/coreutils/mkdir.c
@@ -48,7 +48,7 @@
switch (**argv) {
case 'm':
if (--argc == 0)
- usage(mkdir_usage);
+ show_usage();
/* Find the specified modes */
mode = 0;
if (parse_mode(*(++argv), &mode) == FALSE) {
@@ -63,7 +63,7 @@
parentFlag = TRUE;
break;
default:
- usage(mkdir_usage);
+ show_usage();
}
}
argc--;
@@ -71,7 +71,7 @@
}
if (argc < 1) {
- usage(mkdir_usage);
+ show_usage();
}
while (argc > 0) {
diff --git a/coreutils/mkfifo.c b/coreutils/mkfifo.c
index b31e6f1..56a04f7 100644
--- a/coreutils/mkfifo.c
+++ b/coreutils/mkfifo.c
@@ -37,7 +37,7 @@
/* Parse any options */
while (argc > 1) {
if (**argv != '-')
- usage(mkfifo_usage);
+ show_usage();
thisarg = *argv;
thisarg++;
switch (*thisarg) {
@@ -47,13 +47,13 @@
parse_mode(*argv, &mode);
break;
default:
- usage(mkfifo_usage);
+ show_usage();
}
argc--;
argv++;
}
if (argc < 1 || *argv[0] == '-')
- usage(mkfifo_usage);
+ show_usage();
if (mkfifo(*argv, mode) < 0)
perror_msg_and_die("mkfifo");
return EXIT_SUCCESS;
diff --git a/coreutils/mknod.c b/coreutils/mknod.c
index c761aea..73f6e06 100644
--- a/coreutils/mknod.c
+++ b/coreutils/mknod.c
@@ -53,13 +53,13 @@
umask(0);
break;
default:
- usage(mknod_usage);
+ show_usage();
}
argc--;
argv++;
}
if (argc != 4 && argc != 2) {
- usage(mknod_usage);
+ show_usage();
}
switch (argv[1][0]) {
case 'c':
@@ -72,11 +72,11 @@
case 'p':
mode = S_IFIFO;
if (argc!=2) {
- usage(mknod_usage);
+ show_usage();
}
break;
default:
- usage(mknod_usage);
+ show_usage();
}
if (mode == S_IFCHR || mode == S_IFBLK) {
diff --git a/coreutils/printf.c b/coreutils/printf.c
index 72bc7ae..26a200e 100644
--- a/coreutils/printf.c
+++ b/coreutils/printf.c
@@ -143,7 +143,7 @@
exit_status = 0;
if (argc <= 1 || **(argv + 1) == '-') {
- usage(printf_usage);
+ show_usage();
}
format = argv[1];
diff --git a/coreutils/rm.c b/coreutils/rm.c
index ce293a2..5660767 100644
--- a/coreutils/rm.c
+++ b/coreutils/rm.c
@@ -84,7 +84,7 @@
stopIt = TRUE;
break;
default:
- usage(rm_usage);
+ show_usage();
}
argc--;
argv++;
@@ -94,7 +94,7 @@
}
if (argc < 1 && forceFlag == FALSE) {
- usage(rm_usage);
+ show_usage();
}
while (argc-- > 0) {
diff --git a/coreutils/rmdir.c b/coreutils/rmdir.c
index 86346dd..6266ce1 100644
--- a/coreutils/rmdir.c
+++ b/coreutils/rmdir.c
@@ -33,7 +33,7 @@
int status = EXIT_SUCCESS;
if (argc == 1 || **(argv + 1) == '-')
- usage(rmdir_usage);
+ show_usage();
while (--argc > 0) {
if (rmdir(*(++argv)) == -1) {
diff --git a/coreutils/sleep.c b/coreutils/sleep.c
index 61b7ce4..d21af19 100644
--- a/coreutils/sleep.c
+++ b/coreutils/sleep.c
@@ -29,7 +29,7 @@
extern int sleep_main(int argc, char **argv)
{
if ((argc < 2) || (**(argv + 1) == '-')) {
- usage(sleep_usage);
+ show_usage();
}
if (sleep(atoi(*(++argv))) != 0)
diff --git a/coreutils/sort.c b/coreutils/sort.c
index 2aef2d9..4984f5d 100644
--- a/coreutils/sort.c
+++ b/coreutils/sort.c
@@ -56,7 +56,7 @@
break;
#endif
default:
- usage(sort_usage);
+ show_usage();
}
}
diff --git a/coreutils/sync.c b/coreutils/sync.c
index f95c24c..fc5a42b 100644
--- a/coreutils/sync.c
+++ b/coreutils/sync.c
@@ -28,6 +28,6 @@
extern int sync_main(int argc, char **argv)
{
if (argc > 1 && **(argv + 1) == '-')
- usage(sync_usage);
+ show_usage();
return(sync());
}
diff --git a/coreutils/tail.c b/coreutils/tail.c
index d45b29c..a3b8f6d 100644
--- a/coreutils/tail.c
+++ b/coreutils/tail.c
@@ -103,7 +103,7 @@
break;
#endif
default:
- usage(tail_usage);
+ show_usage();
}
}
diff --git a/coreutils/tee.c b/coreutils/tee.c
index aa3098c..439cf7d 100644
--- a/coreutils/tee.c
+++ b/coreutils/tee.c
@@ -38,7 +38,7 @@
mode = "a";
break;
default:
- usage(tee_usage);
+ show_usage();
}
}
diff --git a/coreutils/touch.c b/coreutils/touch.c
index e174baa..a3256d5 100644
--- a/coreutils/touch.c
+++ b/coreutils/touch.c
@@ -44,13 +44,13 @@
create = FALSE;
break;
default:
- usage(touch_usage);
+ show_usage();
}
}
}
if (argc < 1) {
- usage(touch_usage);
+ show_usage();
}
while (argc > 0) {
diff --git a/coreutils/tr.c b/coreutils/tr.c
index 36f29de..92f399e 100644
--- a/coreutils/tr.c
+++ b/coreutils/tr.c
@@ -170,7 +170,7 @@
sq_fl = TRUE;
break;
default:
- usage(tr_usage);
+ show_usage();
}
}
index++;
diff --git a/coreutils/tty.c b/coreutils/tty.c
index 2a64b14..d71d8de 100644
--- a/coreutils/tty.c
+++ b/coreutils/tty.c
@@ -32,7 +32,7 @@
if (argc > 1) {
if (argv[1][0] != '-' || argv[1][1] != 's')
- usage(tty_usage);
+ show_usage();
} else {
tty = ttyname(0);
if (tty)
diff --git a/coreutils/uname.c b/coreutils/uname.c
index deaffd7..899da77 100644
--- a/coreutils/uname.c
+++ b/coreutils/uname.c
@@ -106,7 +106,7 @@
PRINT_MACHINE);
break;
default:
- usage(uname_usage);
+ show_usage();
}
}
}
diff --git a/coreutils/usleep.c b/coreutils/usleep.c
index 86dc050..c67c365 100644
--- a/coreutils/usleep.c
+++ b/coreutils/usleep.c
@@ -28,7 +28,7 @@
extern int usleep_main(int argc, char **argv)
{
if ((argc < 2) || (**(argv + 1) == '-')) {
- usage(usleep_usage);
+ show_usage();
}
usleep(atoi(*(++argv))); /* return void */
diff --git a/coreutils/uudecode.c b/coreutils/uudecode.c
index cccc528..c0e8cea 100644
--- a/coreutils/uudecode.c
+++ b/coreutils/uudecode.c
@@ -292,7 +292,7 @@
break;
default:
- usage(uudecode_usage);
+ show_usage();
}
}
diff --git a/coreutils/uuencode.c b/coreutils/uuencode.c
index 73098ba..8d5af4a 100644
--- a/coreutils/uuencode.c
+++ b/coreutils/uuencode.c
@@ -167,7 +167,7 @@
break;
default:
- usage(uuencode_usage);
+ show_usage();
}
}
@@ -188,7 +188,7 @@
case 0:
default:
- usage(uuencode_usage);
+ show_usage();
}
printf("begin%s %o %s\n", trans_ptr == uu_std ? "" : "-base64",
diff --git a/coreutils/wc.c b/coreutils/wc.c
index 619c161..f416874 100644
--- a/coreutils/wc.c
+++ b/coreutils/wc.c
@@ -126,7 +126,7 @@
print_words = 1;
break;
default:
- usage(wc_usage);
+ show_usage();
}
}
diff --git a/coreutils/whoami.c b/coreutils/whoami.c
index 398e373..54df0bf 100644
--- a/coreutils/whoami.c
+++ b/coreutils/whoami.c
@@ -31,7 +31,7 @@
uid_t uid = geteuid();
if (argc > 1)
- usage(whoami_usage);
+ show_usage();
my_getpwuid(user, uid);
if (*user) {
diff --git a/coreutils/yes.c b/coreutils/yes.c
index 0ce4949..0a8ad83 100644
--- a/coreutils/yes.c
+++ b/coreutils/yes.c
@@ -29,7 +29,7 @@
int i;
if (argc >= 2 && *argv[1] == '-')
- usage(yes_usage);
+ show_usage();
if (argc == 1) {
while (1)