summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2000-01-08 18:02:42 +0000
committerJim Meyering <jim@meyering.net>2000-01-08 18:02:42 +0000
commite02fd6026055e30c1c26b0d69b552cf427a7c45d (patch)
tree55baa7fda8a232088922aedc8d77c10b415576f1 /src
parent299882b8a4b21bf803b88c2ffcda6538e233902c (diff)
downloadcoreutils-e02fd6026055e30c1c26b0d69b552cf427a7c45d.tar.xz
(PAGES_OPTION, COLUMNS_OPTION): Define these and use them instead of
`CHAR_MAX + n'.
Diffstat (limited to 'src')
-rw-r--r--src/pr.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/src/pr.c b/src/pr.c
index 1e62c3bfd..115b6a4a5 100644
--- a/src/pr.c
+++ b/src/pr.c
@@ -1,5 +1,5 @@
/* pr -- convert text files for printing.
- Copyright (C) 88, 91, 1995-1999 Free Software Foundation, Inc.
+ Copyright (C) 88, 91, 1995-2000 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -725,11 +725,19 @@ static int last_line = FALSE;
-h HEADER using pr test-suite */
static int test_suite;
+/* For long options that have no equivalent short option, use a
+ non-character as a pseudo short option, starting with CHAR_MAX + 1. */
+enum
+{
+ PAGES_OPTION = CHAR_MAX + 1,
+ COLUMNS_OPTION
+};
+
static struct option const long_options[] =
{
{"test", no_argument, &test_suite, 1},
- {"pages", required_argument, NULL, CHAR_MAX + 1},
- {"columns", required_argument, NULL, CHAR_MAX + 2},
+ {"pages", required_argument, NULL, PAGES_OPTION},
+ {"columns", required_argument, NULL, COLUMNS_OPTION},
{"across", no_argument, NULL, 'a'},
{"show-control-chars", no_argument, NULL, 'c'},
{"double-space", no_argument, NULL, 'd'},
@@ -901,7 +909,7 @@ main (int argc, char **argv)
case 0: /* getopt long option */
break;
- case CHAR_MAX + 1: /* --pages=FIRST_PAGE[:LAST_PAGE] */
+ case PAGES_OPTION: /* --pages=FIRST_PAGE[:LAST_PAGE] */
{ /* dominates old opt +... */
if (optarg)
first_last_page (optarg);
@@ -911,7 +919,7 @@ main (int argc, char **argv)
break;
}
- case CHAR_MAX + 2: /* --columns=COLUMN */
+ case COLUMNS_OPTION: /* --columns=COLUMN */
{
long int tmp_long;
if (xstrtol (optarg, NULL, 10, &tmp_long, "") != LONGINT_OK