summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>1999-12-09 15:46:39 +0000
committerJim Meyering <jim@meyering.net>1999-12-09 15:46:39 +0000
commit46b6c26e4f49a031cd2a386a63ec104c32011895 (patch)
tree44226eee95cd7ce5df12eeecf24f0b7297a35b1b /src
parent919f2ce3da2d09a1fc390525eb909b8329afc1ec (diff)
downloadcoreutils-46b6c26e4f49a031cd2a386a63ec104c32011895.tar.xz
(BLOCK_SIZE_OPTION, EXCLUDE_OPTION, MAX_DEPTH_OPTION):
Define these and use them instead of `CHAR_MAX + n'.
Diffstat (limited to 'src')
-rw-r--r--src/du.c21
1 files changed, 15 insertions, 6 deletions
diff --git a/src/du.c b/src/du.c
index a5c5888c1..7f1e76fe1 100644
--- a/src/du.c
+++ b/src/du.c
@@ -161,20 +161,29 @@ static struct exclude *exclude;
/* Grand total size of all args, in units of ST_NBLOCKSIZE-byte blocks. */
static uintmax_t tot_size = 0;
+/* For long options that have no equivalent short option, use a
+ non-character as a pseudo short option, starting with CHAR_MAX + 1. */
+enum
+{
+ EXCLUDE_OPTION = CHAR_MAX + 1,
+ BLOCK_SIZE_OPTION,
+ MAX_DEPTH_OPTION
+};
+
static struct option const long_options[] =
{
{"all", no_argument, NULL, 'a'},
- {"block-size", required_argument, 0, CHAR_MAX + 2},
+ {"block-size", required_argument, 0, BLOCK_SIZE_OPTION},
{"bytes", no_argument, NULL, 'b'},
{"count-links", no_argument, NULL, 'l'},
{"dereference", no_argument, NULL, 'L'},
{"dereference-args", no_argument, NULL, 'D'},
- {"exclude", required_argument, 0, CHAR_MAX + 1},
+ {"exclude", required_argument, 0, EXCLUDE_OPTION},
{"exclude-from", required_argument, 0, 'X'},
{"human-readable", no_argument, NULL, 'h'},
{"si", no_argument, 0, 'H'},
{"kilobytes", no_argument, NULL, 'k'},
- {"max-depth", required_argument, NULL, CHAR_MAX + 3},
+ {"max-depth", required_argument, NULL, MAX_DEPTH_OPTION},
{"megabytes", no_argument, NULL, 'm'},
{"one-file-system", no_argument, NULL, 'x'},
{"separate-dirs", no_argument, NULL, 'S'},
@@ -695,7 +704,7 @@ main (int argc, char **argv)
output_block_size = 1024;
break;
- case CHAR_MAX + 3: /* --max-depth=N */
+ case MAX_DEPTH_OPTION: /* --max-depth=N */
if (xstrtol (optarg, NULL, 0, &tmp_long, NULL) != LONGINT_OK
|| tmp_long < 0 || tmp_long > INT_MAX)
error (1, 0, _("invalid maximum depth `%s'"), optarg);
@@ -737,11 +746,11 @@ main (int argc, char **argv)
error (1, errno, "%s", optarg);
break;
- case CHAR_MAX + 1:
+ case EXCLUDE_OPTION:
add_exclude (exclude, optarg);
break;
- case CHAR_MAX + 2:
+ case BLOCK_SIZE_OPTION:
human_block_size (optarg, 1, &output_block_size);
break;