/[emacs]/emacs/lib-src/getopt.c
ViewVC logotype

Diff of /emacs/lib-src/getopt.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.19 by eggert, Tue Oct 19 07:17:15 1999 UTC revision 1.19.18.1 by miles, Fri Apr 4 06:19:55 2003 UTC
# Line 1  Line 1 
1  /* Getopt for GNU.  /* Getopt for GNU.
2     NOTE: The canonical source of this file is maintained with the GNU     NOTE: getopt is now part of the C library, so if you don't know what
3     C Library.  Bugs can be reported to bug-glibc@gnu.org.     "Keep this file name-space clean" means, talk to drepper@gnu.org
4       before changing it!
5     Copyright (C) 1987, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99     Copyright (C) 1987,88,89,90,91,92,93,94,95,96,98,99,2000,2001,2002
6          Free Software Foundation, Inc.          Free Software Foundation, Inc.
7       This file is part of the GNU C Library.
8    
9     This program is free software; you can redistribute it and/or modify it     This program is free software; you can redistribute it and/or modify
10     under the terms of the GNU General Public License as published by the     it under the terms of the GNU General Public License as published by
11     Free Software Foundation; either version 2, or (at your option) any     the Free Software Foundation; either version 2, or (at your option)
12     later version.     any later version.
13    
14     This program is distributed in the hope that it will be useful,     This program is distributed in the hope that it will be useful,
15     but WITHOUT ANY WARRANTY; without even the implied warranty of     but WITHOUT ANY WARRANTY; without even the implied warranty of
16     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17     GNU General Public License for more details.     GNU General Public License for more details.
18    
19     You should have received a copy of the GNU General Public License     You should have received a copy of the GNU General Public License along
20     along with this program; if not, write to the Free Software Foundation,     with this program; if not, write to the Free Software Foundation,
21     Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */     Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
22    
23  /* This tells Alpha OSF/1 not to define a getopt prototype in <stdio.h>.  /* This tells Alpha OSF/1 not to define a getopt prototype in <stdio.h>.
# Line 27  Line 28 
28    
29  #ifdef HAVE_CONFIG_H  #ifdef HAVE_CONFIG_H
30  # include <config.h>  # include <config.h>
31  #else  #endif
32  # if !defined __STDC__ || !__STDC__  
33    #if !defined __STDC__ || !__STDC__
34  /* This is a separate conditional since some stdc systems  /* This is a separate conditional since some stdc systems
35     reject `defined (const)'.  */     reject `defined (const)'.  */
36  #  ifndef const  # ifndef const
37  #   define const  #  define const
 #  endif  
38  # endif  # endif
39  #endif  #endif
40    
# Line 74  Line 75 
75  # endif  # endif
76  #endif  #endif
77    
78  #ifndef _  #if HAVE_LIBINTL_H
79  /* This is for other GNU distributions with internationalized messages.  # include <libintl.h>
80     When compiling libc, the _ macro is predefined.  */  #endif /* HAVE_LIBINTL_H */
81  # ifdef HAVE_LIBINTL_H  
82  #  include <libintl.h>  #if 0
83  #  define _(msgid)      gettext (msgid)  #  ifdef _LIBC
84  # else  #    include <libintl.h>
85  #  define _(msgid)      (msgid)  #  else  /* not #ifdef _LIBC */
86  # endif  /* This is for other GNU distributions with internationalized messages.  */
87    #    include "gettext.h"
88    #  endif  /* end #ifdef _LIBC */
89    #endif  /* end #if 0 */
90    
91    #if HAVE_LIBINTL_H
92      /* Should I include libintl.h here as in regex.c ? */
93    #  define _(msgid) gettext (msgid)
94    #else  /* not #if HAVE_LIBINTL_H */
95    #  define _(msgid) (msgid)
96    #endif  /* end #if HAVE_LIBINTL_H */
97    
98    #if defined _LIBC && defined USE_IN_LIBIO
99    # include <wchar.h>
100    #endif
101    
102    #ifndef attribute_hidden
103    # define attribute_hidden
104  #endif  #endif
105    
106  /* This version of `getopt' appears to the caller like standard Unix `getopt'  /* This version of `getopt' appears to the caller like standard Unix `getopt'
# Line 128  int optind = 1; Line 146  int optind = 1;
146     causes problems with re-calling getopt as programs generally don't     causes problems with re-calling getopt as programs generally don't
147     know that. */     know that. */
148    
149  int __getopt_initialized;  int __getopt_initialized attribute_hidden;
150    
151  /* The next char to be scanned in the option-element  /* The next char to be scanned in the option-element
152     in which the last option character we returned was found.     in which the last option character we returned was found.
# Line 247  static int first_nonopt; Line 265  static int first_nonopt;
265  static int last_nonopt;  static int last_nonopt;
266    
267  #ifdef _LIBC  #ifdef _LIBC
268    /* Stored original parameters.
269       XXX This is no good solution.  We should rather copy the args so
270       that we can compare them later.  But we must not use malloc(3).  */
271    extern int __libc_argc;
272    extern char **__libc_argv;
273    
274  /* Bash 2.0 gives us an environment variable containing flags  /* Bash 2.0 gives us an environment variable containing flags
275     indicating ARGV elements that should not be considered arguments.  */     indicating ARGV elements that should not be considered arguments.  */
276    
277    # ifdef USE_NONOPTION_FLAGS
278  /* Defined in getopt_init.c  */  /* Defined in getopt_init.c  */
279  extern char *__getopt_nonoption_flags;  extern char *__getopt_nonoption_flags;
280    
281  static int nonoption_flags_max_len;  static int nonoption_flags_max_len;
282  static int nonoption_flags_len;  static int nonoption_flags_len;
283    # endif
284    
285  static int original_argc;  # ifdef USE_NONOPTION_FLAGS
286  static char *const *original_argv;  #  define SWAP_FLAGS(ch1, ch2) \
   
 /* Make sure the environment variable bash 2.0 puts in the environment  
    is valid for the getopt call we must make sure that the ARGV passed  
    to getopt is that one passed to the process.  */  
 static void  
 __attribute__ ((unused))  
 store_args_and_env (int argc, char *const *argv)  
 {  
   /* XXX This is no good solution.  We should rather copy the args so  
      that we can compare them later.  But we must not use malloc(3).  */  
   original_argc = argc;  
   original_argv = argv;  
 }  
 # ifdef text_set_element  
 text_set_element (__libc_subinit, store_args_and_env);  
 # endif /* text_set_element */  
   
 # define SWAP_FLAGS(ch1, ch2) \  
287    if (nonoption_flags_len > 0)                                                \    if (nonoption_flags_len > 0)                                                \
288      {                                                                         \      {                                                                         \
289        char __tmp = __getopt_nonoption_flags[ch1];                             \        char __tmp = __getopt_nonoption_flags[ch1];                             \
290        __getopt_nonoption_flags[ch1] = __getopt_nonoption_flags[ch2];          \        __getopt_nonoption_flags[ch1] = __getopt_nonoption_flags[ch2];          \
291        __getopt_nonoption_flags[ch2] = __tmp;                                  \        __getopt_nonoption_flags[ch2] = __tmp;                                  \
292      }      }
293    # else
294    #  define SWAP_FLAGS(ch1, ch2)
295    # endif
296  #else   /* !_LIBC */  #else   /* !_LIBC */
297  # define SWAP_FLAGS(ch1, ch2)  # define SWAP_FLAGS(ch1, ch2)
298  #endif  /* _LIBC */  #endif  /* _LIBC */
# Line 313  exchange (argv) Line 324  exchange (argv)
324       It leaves the longer segment in the right place overall,       It leaves the longer segment in the right place overall,
325       but it consists of two parts that need to be swapped next.  */       but it consists of two parts that need to be swapped next.  */
326    
327  #ifdef _LIBC  #if defined _LIBC && defined USE_NONOPTION_FLAGS
328    /* First make sure the handling of the `__getopt_nonoption_flags'    /* First make sure the handling of the `__getopt_nonoption_flags'
329       string can work normally.  Our top argument must be in the range       string can work normally.  Our top argument must be in the range
330       of the string.  */       of the string.  */
# Line 417  _getopt_initialize (argc, argv, optstrin Line 428  _getopt_initialize (argc, argv, optstrin
428    else    else
429      ordering = PERMUTE;      ordering = PERMUTE;
430    
431  #ifdef _LIBC  #if defined _LIBC && defined USE_NONOPTION_FLAGS
432    if (posixly_correct == NULL    if (posixly_correct == NULL
433        && argc == original_argc && argv == original_argv)        && argc == __libc_argc && argv == __libc_argv)
434      {      {
435        if (nonoption_flags_max_len == 0)        if (nonoption_flags_max_len == 0)
436          {          {
# Line 515  _getopt_internal (argc, argv, optstring, Line 526  _getopt_internal (argc, argv, optstring,
526       int *longind;       int *longind;
527       int long_only;       int long_only;
528  {  {
529      int print_errors = opterr;
530      if (optstring[0] == ':')
531        print_errors = 0;
532    
533      if (argc < 1)
534        return -1;
535    
536    optarg = NULL;    optarg = NULL;
537    
538    if (optind == 0 || !__getopt_initialized)    if (optind == 0 || !__getopt_initialized)
# Line 529  _getopt_internal (argc, argv, optstring, Line 547  _getopt_internal (argc, argv, optstring,
547       Either it does not have option syntax, or there is an environment flag       Either it does not have option syntax, or there is an environment flag
548       from the shell indicating it is not an option.  The later information       from the shell indicating it is not an option.  The later information
549       is only used when the used in the GNU libc.  */       is only used when the used in the GNU libc.  */
550  #ifdef _LIBC  #if defined _LIBC && defined USE_NONOPTION_FLAGS
551  # define NONOPTION_P (argv[optind][0] != '-' || argv[optind][1] == '\0'       \  # define NONOPTION_P (argv[optind][0] != '-' || argv[optind][1] == '\0'       \
552                        || (optind < nonoption_flags_len                        \                        || (optind < nonoption_flags_len                        \
553                            && __getopt_nonoption_flags[optind] == '1'))                            && __getopt_nonoption_flags[optind] == '1'))
# Line 664  _getopt_internal (argc, argv, optstring, Line 682  _getopt_internal (argc, argv, optstring,
682                  pfound = p;                  pfound = p;
683                  indfound = option_index;                  indfound = option_index;
684                }                }
685              else              else if (long_only
686                         || pfound->has_arg != p->has_arg
687                         || pfound->flag != p->flag
688                         || pfound->val != p->val)
689                /* Second or later nonexact match found.  */                /* Second or later nonexact match found.  */
690                ambig = 1;                ambig = 1;
691            }            }
692    
693        if (ambig && !exact)        if (ambig && !exact)
694          {          {
695            if (opterr)            if (print_errors)
696              fprintf (stderr, _("%s: option `%s' is ambiguous\n"),              {
697                       argv[0], argv[optind]);  #if defined _LIBC && defined USE_IN_LIBIO
698                  char *buf;
699    
700                  if (__asprintf (&buf, _("%s: option `%s' is ambiguous\n"),
701                                  argv[0], argv[optind]) >= 0)
702                    {
703    
704                      if (_IO_fwide (stderr, 0) > 0)
705                        __fwprintf (stderr, L"%s", buf);
706                      else
707                        fputs (buf, stderr);
708    
709                      free (buf);
710                    }
711    #else
712                  fprintf (stderr, _("%s: option `%s' is ambiguous\n"),
713                           argv[0], argv[optind]);
714    #endif
715                }
716            nextchar += strlen (nextchar);            nextchar += strlen (nextchar);
717            optind++;            optind++;
718            optopt = 0;            optopt = 0;
# Line 692  _getopt_internal (argc, argv, optstring, Line 731  _getopt_internal (argc, argv, optstring,
731                  optarg = nameend + 1;                  optarg = nameend + 1;
732                else                else
733                  {                  {
734                    if (opterr)                    if (print_errors)
735                      {                      {
736    #if defined _LIBC && defined USE_IN_LIBIO
737                          char *buf;
738                          int n;
739    #endif
740    
741                        if (argv[optind - 1][1] == '-')                        if (argv[optind - 1][1] == '-')
742                          /* --option */                          {
743                          fprintf (stderr,                            /* --option */
744                                   _("%s: option `--%s' doesn't allow an argument\n"),  #if defined _LIBC && defined USE_IN_LIBIO
745                                   argv[0], pfound->name);                            n = __asprintf (&buf, _("\
746    %s: option `--%s' doesn't allow an argument\n"),
747                                              argv[0], pfound->name);
748    #else
749                              fprintf (stderr, _("\
750    %s: option `--%s' doesn't allow an argument\n"),
751                                       argv[0], pfound->name);
752    #endif
753                            }
754                        else                        else
755                          /* +option or -option */                          {
756                          fprintf (stderr,                            /* +option or -option */
757                                   _("%s: option `%c%s' doesn't allow an argument\n"),  #if defined _LIBC && defined USE_IN_LIBIO
758                                   argv[0], argv[optind - 1][0], pfound->name);                            n = __asprintf (&buf, _("\
759    %s: option `%c%s' doesn't allow an argument\n"),
760                                              argv[0], argv[optind - 1][0],
761                                              pfound->name);
762    #else
763                              fprintf (stderr, _("\
764    %s: option `%c%s' doesn't allow an argument\n"),
765                                       argv[0], argv[optind - 1][0], pfound->name);
766    #endif
767                            }
768    
769    #if defined _LIBC && defined USE_IN_LIBIO
770                          if (n >= 0)
771                            {
772                              if (_IO_fwide (stderr, 0) > 0)
773                                __fwprintf (stderr, L"%s", buf);
774                              else
775                                fputs (buf, stderr);
776    
777                              free (buf);
778                            }
779    #endif
780                      }                      }
781    
782                    nextchar += strlen (nextchar);                    nextchar += strlen (nextchar);
# Line 718  _getopt_internal (argc, argv, optstring, Line 791  _getopt_internal (argc, argv, optstring,
791                  optarg = argv[optind++];                  optarg = argv[optind++];
792                else                else
793                  {                  {
794                    if (opterr)                    if (print_errors)
795                      fprintf (stderr,                      {
796                             _("%s: option `%s' requires an argument\n"),  #if defined _LIBC && defined USE_IN_LIBIO
797                             argv[0], argv[optind - 1]);                        char *buf;
798    
799                          if (__asprintf (&buf, _("\
800    %s: option `%s' requires an argument\n"),
801                                          argv[0], argv[optind - 1]) >= 0)
802                            {
803                              if (_IO_fwide (stderr, 0) > 0)
804                                __fwprintf (stderr, L"%s", buf);
805                              else
806                                fputs (buf, stderr);
807    
808                              free (buf);
809                            }
810    #else
811                          fprintf (stderr,
812                                   _("%s: option `%s' requires an argument\n"),
813                                   argv[0], argv[optind - 1]);
814    #endif
815                        }
816                    nextchar += strlen (nextchar);                    nextchar += strlen (nextchar);
817                    optopt = pfound->val;                    optopt = pfound->val;
818                    return optstring[0] == ':' ? ':' : '?';                    return optstring[0] == ':' ? ':' : '?';
# Line 745  _getopt_internal (argc, argv, optstring, Line 836  _getopt_internal (argc, argv, optstring,
836        if (!long_only || argv[optind][1] == '-'        if (!long_only || argv[optind][1] == '-'
837            || my_index (optstring, *nextchar) == NULL)            || my_index (optstring, *nextchar) == NULL)
838          {          {
839            if (opterr)            if (print_errors)
840              {              {
841    #if defined _LIBC && defined USE_IN_LIBIO
842                  char *buf;
843                  int n;
844    #endif
845    
846                if (argv[optind][1] == '-')                if (argv[optind][1] == '-')
847                  /* --option */                  {
848                  fprintf (stderr, _("%s: unrecognized option `--%s'\n"),                    /* --option */
849                           argv[0], nextchar);  #if defined _LIBC && defined USE_IN_LIBIO
850                      n = __asprintf (&buf, _("%s: unrecognized option `--%s'\n"),
851                                      argv[0], nextchar);
852    #else
853                      fprintf (stderr, _("%s: unrecognized option `--%s'\n"),
854                               argv[0], nextchar);
855    #endif
856                    }
857                else                else
858                  /* +option or -option */                  {
859                  fprintf (stderr, _("%s: unrecognized option `%c%s'\n"),                    /* +option or -option */
860                           argv[0], argv[optind][0], nextchar);  #if defined _LIBC && defined USE_IN_LIBIO
861                      n = __asprintf (&buf, _("%s: unrecognized option `%c%s'\n"),
862                                      argv[0], argv[optind][0], nextchar);
863    #else
864                      fprintf (stderr, _("%s: unrecognized option `%c%s'\n"),
865                               argv[0], argv[optind][0], nextchar);
866    #endif
867                    }
868    
869    #if defined _LIBC && defined USE_IN_LIBIO
870                  if (n >= 0)
871                    {
872                      if (_IO_fwide (stderr, 0) > 0)
873                        __fwprintf (stderr, L"%s", buf);
874                      else
875                        fputs (buf, stderr);
876    
877                      free (buf);
878                    }
879    #endif
880              }              }
881            nextchar = (char *) "";            nextchar = (char *) "";
882            optind++;            optind++;
# Line 775  _getopt_internal (argc, argv, optstring, Line 897  _getopt_internal (argc, argv, optstring,
897    
898      if (temp == NULL || c == ':')      if (temp == NULL || c == ':')
899        {        {
900          if (opterr)          if (print_errors)
901            {            {
902    #if defined _LIBC && defined USE_IN_LIBIO
903                  char *buf;
904                  int n;
905    #endif
906    
907              if (posixly_correct)              if (posixly_correct)
908                /* 1003.2 specifies the format of this message.  */                {
909                fprintf (stderr, _("%s: illegal option -- %c\n"),                  /* 1003.2 specifies the format of this message.  */
910                         argv[0], c);  #if defined _LIBC && defined USE_IN_LIBIO
911                    n = __asprintf (&buf, _("%s: illegal option -- %c\n"),
912                                    argv[0], c);
913    #else
914                    fprintf (stderr, _("%s: illegal option -- %c\n"), argv[0], c);
915    #endif
916                  }
917              else              else
918                fprintf (stderr, _("%s: invalid option -- %c\n"),                {
919                         argv[0], c);  #if defined _LIBC && defined USE_IN_LIBIO
920                    n = __asprintf (&buf, _("%s: invalid option -- %c\n"),
921                                    argv[0], c);
922    #else
923                    fprintf (stderr, _("%s: invalid option -- %c\n"), argv[0], c);
924    #endif
925                  }
926    
927    #if defined _LIBC && defined USE_IN_LIBIO
928                if (n >= 0)
929                  {
930                    if (_IO_fwide (stderr, 0) > 0)
931                      __fwprintf (stderr, L"%s", buf);
932                    else
933                      fputs (buf, stderr);
934    
935                    free (buf);
936                  }
937    #endif
938            }            }
939          optopt = c;          optopt = c;
940          return '?';          return '?';
# Line 809  _getopt_internal (argc, argv, optstring, Line 960  _getopt_internal (argc, argv, optstring,
960            }            }
961          else if (optind == argc)          else if (optind == argc)
962            {            {
963              if (opterr)              if (print_errors)
964                {                {
965                  /* 1003.2 specifies the format of this message.  */                  /* 1003.2 specifies the format of this message.  */
966    #if defined _LIBC && defined USE_IN_LIBIO
967                    char *buf;
968    
969                    if (__asprintf (&buf,
970                                    _("%s: option requires an argument -- %c\n"),
971                                    argv[0], c) >= 0)
972                      {
973                        if (_IO_fwide (stderr, 0) > 0)
974                          __fwprintf (stderr, L"%s", buf);
975                        else
976                          fputs (buf, stderr);
977    
978                        free (buf);
979                      }
980    #else
981                  fprintf (stderr, _("%s: option requires an argument -- %c\n"),                  fprintf (stderr, _("%s: option requires an argument -- %c\n"),
982                           argv[0], c);                           argv[0], c);
983    #endif
984                }                }
985              optopt = c;              optopt = c;
986              if (optstring[0] == ':')              if (optstring[0] == ':')
# Line 858  _getopt_internal (argc, argv, optstring, Line 1025  _getopt_internal (argc, argv, optstring,
1025              }              }
1026          if (ambig && !exact)          if (ambig && !exact)
1027            {            {
1028              if (opterr)              if (print_errors)
1029                fprintf (stderr, _("%s: option `-W %s' is ambiguous\n"),                {
1030                         argv[0], argv[optind]);  #if defined _LIBC && defined USE_IN_LIBIO
1031                    char *buf;
1032    
1033                    if (__asprintf (&buf, _("%s: option `-W %s' is ambiguous\n"),
1034                                    argv[0], argv[optind]) >= 0)
1035                      {
1036                        if (_IO_fwide (stderr, 0) > 0)
1037                          __fwprintf (stderr, L"%s", buf);
1038                        else
1039                          fputs (buf, stderr);
1040    
1041                        free (buf);
1042                      }
1043    #else
1044                    fprintf (stderr, _("%s: option `-W %s' is ambiguous\n"),
1045                             argv[0], argv[optind]);
1046    #endif
1047                  }
1048              nextchar += strlen (nextchar);              nextchar += strlen (nextchar);
1049              optind++;              optind++;
1050              return '?';              return '?';
# Line 876  _getopt_internal (argc, argv, optstring, Line 1060  _getopt_internal (argc, argv, optstring,
1060                    optarg = nameend + 1;                    optarg = nameend + 1;
1061                  else                  else
1062                    {                    {
1063                      if (opterr)                      if (print_errors)
1064                        fprintf (stderr, _("\                        {
1065    #if defined _LIBC && defined USE_IN_LIBIO
1066                            char *buf;
1067    
1068                            if (__asprintf (&buf, _("\
1069    %s: option `-W %s' doesn't allow an argument\n"),
1070                                            argv[0], pfound->name) >= 0)
1071                              {
1072                                if (_IO_fwide (stderr, 0) > 0)
1073                                  __fwprintf (stderr, L"%s", buf);
1074                                else
1075                                  fputs (buf, stderr);
1076    
1077                                free (buf);
1078                              }
1079    #else
1080                            fprintf (stderr, _("\
1081  %s: option `-W %s' doesn't allow an argument\n"),  %s: option `-W %s' doesn't allow an argument\n"),
1082                                 argv[0], pfound->name);                                   argv[0], pfound->name);
1083    #endif
1084                          }
1085    
1086                      nextchar += strlen (nextchar);                      nextchar += strlen (nextchar);
1087                      return '?';                      return '?';
# Line 891  _getopt_internal (argc, argv, optstring, Line 1093  _getopt_internal (argc, argv, optstring,
1093                    optarg = argv[optind++];                    optarg = argv[optind++];
1094                  else                  else
1095                    {                    {
1096                      if (opterr)                      if (print_errors)
1097                        fprintf (stderr,                        {
1098                                 _("%s: option `%s' requires an argument\n"),  #if defined _LIBC && defined USE_IN_LIBIO
1099                                 argv[0], argv[optind - 1]);                          char *buf;
1100    
1101                            if (__asprintf (&buf, _("\
1102    %s: option `%s' requires an argument\n"),
1103                                            argv[0], argv[optind - 1]) >= 0)
1104                              {
1105                                if (_IO_fwide (stderr, 0) > 0)
1106                                  __fwprintf (stderr, L"%s", buf);
1107                                else
1108                                  fputs (buf, stderr);
1109    
1110                                free (buf);
1111                              }
1112    #else
1113                            fprintf (stderr,
1114                                     _("%s: option `%s' requires an argument\n"),
1115                                     argv[0], argv[optind - 1]);
1116    #endif
1117                          }
1118                      nextchar += strlen (nextchar);                      nextchar += strlen (nextchar);
1119                      return optstring[0] == ':' ? ':' : '?';                      return optstring[0] == ':' ? ':' : '?';
1120                    }                    }
# Line 938  _getopt_internal (argc, argv, optstring, Line 1158  _getopt_internal (argc, argv, optstring,
1158                }                }
1159              else if (optind == argc)              else if (optind == argc)
1160                {                {
1161                  if (opterr)                  if (print_errors)
1162                    {                    {
1163                      /* 1003.2 specifies the format of this message.  */                      /* 1003.2 specifies the format of this message.  */
1164    #if defined _LIBC && defined USE_IN_LIBIO
1165                        char *buf;
1166    
1167                        if (__asprintf (&buf, _("\
1168    %s: option requires an argument -- %c\n"),
1169                                        argv[0], c) >= 0)
1170                          {
1171                            if (_IO_fwide (stderr, 0) > 0)
1172                              __fwprintf (stderr, L"%s", buf);
1173                            else
1174                              fputs (buf, stderr);
1175    
1176                            free (buf);
1177                          }
1178    #else
1179                      fprintf (stderr,                      fprintf (stderr,
1180                             _("%s: option requires an argument -- %c\n"),                               _("%s: option requires an argument -- %c\n"),
1181                             argv[0], c);                               argv[0], c);
1182    #endif
1183                    }                    }
1184                  optopt = c;                  optopt = c;
1185                  if (optstring[0] == ':')                  if (optstring[0] == ':')

Legend:
Removed from v.1.19  
changed lines
  Added in v.1.19.18.1

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26