From 919f2ce3da2d09a1fc390525eb909b8329afc1ec Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Thu, 9 Dec 1999 15:43:41 +0000 Subject: [PATCH] (BLOCK_SIZE_OPTION, SYNC_OPTION, NO_SYNC_OPTION): Define these and use them instead of `CHAR_MAX + n'. --- src/df.c | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/src/df.c b/src/df.c index 6d79767dae..048356856a 100644 --- a/src/df.c +++ b/src/df.c @@ -110,10 +110,19 @@ static struct mount_entry *mount_list; /* If nonzero, print filesystem type as well. */ static int print_type; +/* For long options that have no equivalent short option, use a + non-character as a pseudo short option, starting with CHAR_MAX + 1. */ +enum +{ + SYNC_OPTION = CHAR_MAX + 1, + NO_SYNC_OPTION, + BLOCK_SIZE_OPTION +}; + static struct option const long_options[] = { {"all", no_argument, NULL, 'a'}, - {"block-size", required_argument, NULL, CHAR_MAX + 3}, + {"block-size", required_argument, NULL, BLOCK_SIZE_OPTION}, {"inodes", no_argument, NULL, 'i'}, {"human-readable", no_argument, NULL, 'h'}, {"si", no_argument, NULL, 'H'}, @@ -122,8 +131,8 @@ static struct option const long_options[] = {"megabytes", no_argument, NULL, 'm'}, {"portability", no_argument, NULL, 'P'}, {"print-type", no_argument, NULL, 'T'}, - {"sync", no_argument, NULL, CHAR_MAX + 1}, - {"no-sync", no_argument, NULL, CHAR_MAX + 2}, + {"sync", no_argument, NULL, SYNC_OPTION}, + {"no-sync", no_argument, NULL, NO_SYNC_OPTION}, {"type", required_argument, NULL, 't'}, {"exclude-type", required_argument, NULL, 'x'}, {GETOPT_HELP_OPTION_DECL}, @@ -708,14 +717,14 @@ main (int argc, char **argv) case 'P': posix_format = 1; break; - case CHAR_MAX + 1: + case SYNC_OPTION: require_sync = 1; break; - case CHAR_MAX + 2: + case NO_SYNC_OPTION: require_sync = 0; break; - case CHAR_MAX + 3: + case BLOCK_SIZE_OPTION: human_block_size (optarg, 1, &output_block_size); break; -- 2.47.3