summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>1999-12-09 15:43:41 +0000
committerJim Meyering <jim@meyering.net>1999-12-09 15:43:41 +0000
commit919f2ce3da2d09a1fc390525eb909b8329afc1ec (patch)
tree9b9e24605ada828e480e48afc88097f9c083206c /src
parent6cbabe63d4b26342e5900d657618f0342a14053e (diff)
downloadcoreutils-919f2ce3da2d09a1fc390525eb909b8329afc1ec.tar.xz
(BLOCK_SIZE_OPTION, SYNC_OPTION, NO_SYNC_OPTION): Define
these and use them instead of `CHAR_MAX + n'.
Diffstat (limited to 'src')
-rw-r--r--src/df.c21
1 files changed, 15 insertions, 6 deletions
diff --git a/src/df.c b/src/df.c
index 6d79767da..048356856 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;