summaryrefslogtreecommitdiff
path: root/src/du.c
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>1993-10-08 00:51:10 +0000
committerJim Meyering <jim@meyering.net>1993-10-08 00:51:10 +0000
commit95f7eb6267b6fa36b92e247eca2728cde8130f03 (patch)
treeb667ee079ab3c23c5e8506bb92cc0650f5cee7fb /src/du.c
parentd9d6720b77c2777aefcbabdfbd6dd250872d3a36 (diff)
downloadcoreutils-95f7eb6267b6fa36b92e247eca2728cde8130f03.tar.xz
merge with 3.8.3d
Diffstat (limited to 'src/du.c')
-rw-r--r--src/du.c35
1 files changed, 27 insertions, 8 deletions
diff --git a/src/du.c b/src/du.c
index 5f538ec7f..89bc12760 100644
--- a/src/du.c
+++ b/src/du.c
@@ -191,19 +191,38 @@ static struct option const long_options[] =
};
static void
-usage (reason)
+usage (reason, status)
char *reason;
+ int status;
{
if (reason != NULL)
fprintf (stderr, "%s: %s\n", program_name, reason);
fprintf (stderr, "\
-Usage: %s [-abcklsxDLS] [--all] [--total] [--count-links] [--summarize]\n\
- [--bytes] [--kilobytes] [--one-file-system] [--separate-dirs]\n\
- [--dereference] [--dereference-args] [--help] [--version] [path...]\n",
+Usage: %s [OPTION]... [PATH]...\n\
+\n",
program_name);
- exit (2);
+ if (status == 0)
+ fprintf (stderr, "\
+ -a, --all write counts for all files, not just directories\n\
+ -b, --bytes print size in bytes\n\
+ -c, --total produce a grand total\n\
+ -k, --kilobytes use 1024 blocks, not 512 despite POSIXLY_CORRECT\n\
+ -l, --count-links count sizes many times if hard linked\n\
+ -s, --summarize display only a total for each argument\n\
+ -x, --one-file-system skip directories on different filesystems\n\
+ -D, --dereference-args dereference PATHs when symbolic link\n\
+ -L, --dereference dereference all symbolic links\n\
+ -S, --separate-dirs do not include size of subdirectories\n\
+ --help provide this help\n\
+ --version show program version\n");
+
+ else
+ fprintf (stderr, "Try `%s --help' for more information.\n",
+ program_name);
+
+ exit (status);
}
void
@@ -266,7 +285,7 @@ main (argc, argv)
break;
default:
- usage ((char *) 0);
+ usage ((char *) 0, 2);
}
}
@@ -277,10 +296,10 @@ main (argc, argv)
}
if (show_help)
- usage (NULL);
+ usage (NULL, 0);
if (opt_all && opt_summarize_only)
- usage ("cannot both summarize and show all entries");
+ usage ("cannot both summarize and show all entries", 2);
/* Initialize the hash structure for inode numbers. */
hash_init (INITIAL_HASH_MODULE, INITIAL_ENTRY_TAB_SIZE);