]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
(PAGES_OPTION, COLUMNS_OPTION): Define these and use them instead of
authorJim Meyering <jim@meyering.net>
Sat, 8 Jan 2000 18:02:42 +0000 (18:02 +0000)
committerJim Meyering <jim@meyering.net>
Sat, 8 Jan 2000 18:02:42 +0000 (18:02 +0000)
`CHAR_MAX + n'.

src/pr.c

index 1e62c3bfd337fbd96b045ee66155aab4a77095f0..115b6a4a5f3555fa50c5a0af7d3295ed2b4cf5cc 100644 (file)
--- 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