]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
maint: ptx: place long options without short options after CHAR_MAX
authorCollin Funk <collin.funk1@gmail.com>
Mon, 12 Jan 2026 04:43:37 +0000 (20:43 -0800)
committerCollin Funk <collin.funk1@gmail.com>
Tue, 13 Jan 2026 01:42:16 +0000 (17:42 -0800)
* src/ptx.c (FORMAT_OPTION): New constant.
(long_options): Use FORMAT_OPTION instead of 10.
(main): Likewise.

src/ptx.c

index 2d548530d9e26771849a9a0f5ba8d677033bee31..20f61afa39738f66f697e27b994d18112488f520 100644 (file)
--- a/src/ptx.c
+++ b/src/ptx.c
@@ -1721,6 +1721,13 @@ Output a permuted index, including context, of the words in the input files.\n\
 | strings, then launch execution.                                      |
 `----------------------------------------------------------------------*/
 
+/* For long options that have no equivalent short option, use a
+   non-character as a pseudo short option, starting with CHAR_MAX + 1.  */
+enum
+{
+  FORMAT_OPTION = CHAR_MAX + 1
+};
+
 /* Long options equivalences.  */
 static struct option const long_options[] =
 {
@@ -1734,7 +1741,7 @@ static struct option const long_options[] =
   {"only-file", required_argument, nullptr, 'o'},
   {"references", no_argument, nullptr, 'r'},
   {"right-side-refs", no_argument, nullptr, 'R'},
-  {"format", required_argument, nullptr, 10},
+  {"format", required_argument, nullptr, FORMAT_OPTION},
   {"sentence-regexp", required_argument, nullptr, 'S'},
   {"traditional", no_argument, nullptr, 'G'},
   {"typeset-mode", no_argument, nullptr, 't'},
@@ -1868,7 +1875,7 @@ main (int argc, char **argv)
             word_regex.string = nullptr;
           break;
 
-        case 10:
+        case FORMAT_OPTION:
           output_format = XARGMATCH ("--format", optarg,
                                      format_args, format_vals);
           break;