]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
printenv: remove unsupported short options from getopt_long
authorCollin Funk <collin.funk1@gmail.com>
Wed, 27 May 2026 02:39:29 +0000 (19:39 -0700)
committerCollin Funk <collin.funk1@gmail.com>
Wed, 27 May 2026 02:48:52 +0000 (19:48 -0700)
This patch only improves some error messages. Here is the behavior
before the patch:

    $ printenv -i
    Try 'printenv --help' for more information.
    $ printenv -u
    printenv: option requires an argument -- 'u'
    Try 'printenv --help' for more information.
    $ printenv -u a
    Try 'printenv --help' for more information.

Here is the behavior after:

    $ ./src/printenv -i
    ./src/printenv: invalid option -- 'i'
    Try './src/printenv --help' for more information.
    $ ./src/printenv -u
    ./src/printenv: invalid option -- 'u'
    Try './src/printenv --help' for more information.
    $ ./src/printenv -u a
    ./src/printenv: invalid option -- 'u'
    Try './src/printenv --help' for more information.

* src/printenv.c (main): Remove 'i' and 'u' from the short options given
to getopt_long.

src/printenv.c

index 1f68dd2cc242b818bd529cd149a51ac8496b093b..c2b1c69cda4e1395c47bb3da1f0245061dfd0b72 100644 (file)
@@ -93,7 +93,7 @@ main (int argc, char **argv)
   atexit (close_stdout);
 
   int optc;
-  while ((optc = getopt_long (argc, argv, "+iu:0", longopts, NULL)) != -1)
+  while ((optc = getopt_long (argc, argv, "+0", longopts, NULL)) != -1)
     {
       switch (optc)
         {