comparison lib/getopt_int.h @ 5453:d29dafc60cf3

Merge from coreutils to support a more-standard getopt.
author Paul Eggert <eggert@cs.ucla.edu>
date Wed, 17 Nov 2004 01:13:54 +0000
parents 1c7efeb240c3
children a48fb0e98c8c
comparison
equal deleted inserted replaced
5452:cf3e0bde637c 5453:d29dafc60cf3
18 Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ 18 Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
19 19
20 #ifndef _GETOPT_INT_H 20 #ifndef _GETOPT_INT_H
21 #define _GETOPT_INT_H 1 21 #define _GETOPT_INT_H 1
22 22
23 extern int _getopt_internal (int ___argc, char *__getopt_argv_const *___argv, 23 extern int _getopt_internal (int ___argc, char **___argv,
24 const char *__shortopts, 24 const char *__shortopts,
25 const struct option *__longopts, int *__longind, 25 const struct option *__longopts, int *__longind,
26 int __long_only); 26 int __long_only, int __posixly_correct);
27 27
28 28
29 /* Reentrant versions which can handle parsing multiple argument 29 /* Reentrant versions which can handle parsing multiple argument
30 vectors at the same time. */ 30 vectors at the same time. */
31 31
62 REQUIRE_ORDER means don't recognize them as options; 62 REQUIRE_ORDER means don't recognize them as options;
63 stop option processing when the first non-option is seen. 63 stop option processing when the first non-option is seen.
64 This is what Unix does. 64 This is what Unix does.
65 This mode of operation is selected by either setting the environment 65 This mode of operation is selected by either setting the environment
66 variable POSIXLY_CORRECT, or using `+' as the first character 66 variable POSIXLY_CORRECT, or using `+' as the first character
67 of the list of option characters. 67 of the list of option characters, or by calling getopt.
68 68
69 PERMUTE is the default. We permute the contents of ARGV as we 69 PERMUTE is the default. We permute the contents of ARGV as we
70 scan, so that eventually all the non-options are at the end. 70 scan, so that eventually all the non-options are at the end.
71 This allows options to be given in any order, even with programs 71 This allows options to be given in any order, even with programs
72 that were not written to expect this. 72 that were not written to expect this.
85 enum 85 enum
86 { 86 {
87 REQUIRE_ORDER, PERMUTE, RETURN_IN_ORDER 87 REQUIRE_ORDER, PERMUTE, RETURN_IN_ORDER
88 } __ordering; 88 } __ordering;
89 89
90 /* If the POSIXLY_CORRECT environment variable is set. */ 90 /* If the POSIXLY_CORRECT environment variable is set
91 or getopt was called. */
91 int __posixly_correct; 92 int __posixly_correct;
92 93
93 94
94 /* Handle permutation of arguments. */ 95 /* Handle permutation of arguments. */
95 96
108 109
109 /* The initializer is necessary to set OPTIND and OPTERR to their 110 /* The initializer is necessary to set OPTIND and OPTERR to their
110 default values and to clear the initialization flag. */ 111 default values and to clear the initialization flag. */
111 #define _GETOPT_DATA_INITIALIZER { 1, 1 } 112 #define _GETOPT_DATA_INITIALIZER { 1, 1 }
112 113
113 extern int _getopt_internal_r (int ___argc, char *__getopt_argv_const *___argv, 114 extern int _getopt_internal_r (int ___argc, char **___argv,
114 const char *__shortopts, 115 const char *__shortopts,
115 const struct option *__longopts, int *__longind, 116 const struct option *__longopts, int *__longind,
116 int __long_only, struct _getopt_data *__data); 117 int __long_only, int __posixly_correct,
118 struct _getopt_data *__data);
117 119
118 extern int _getopt_long_r (int ___argc, char *__getopt_argv_const *___argv, 120 extern int _getopt_long_r (int ___argc, char **___argv,
119 const char *__shortopts, 121 const char *__shortopts,
120 const struct option *__longopts, int *__longind, 122 const struct option *__longopts, int *__longind,
121 struct _getopt_data *__data); 123 struct _getopt_data *__data);
122 124
123 extern int _getopt_long_only_r (int ___argc, 125 extern int _getopt_long_only_r (int ___argc, char **___argv,
124 char *__getopt_argv_const *___argv,
125 const char *__shortopts, 126 const char *__shortopts,
126 const struct option *__longopts, 127 const struct option *__longopts,
127 int *__longind, 128 int *__longind,
128 struct _getopt_data *__data); 129 struct _getopt_data *__data);
129 130