Definition at line 60 of file getopt_long.c.
63{
64 static char *place =
EMSG;
65 char *oli;
66 static int nonopt_start = -1;
67 static bool force_nonopt = false;
68
69 if (!*place)
70 {
71 char **
args = (
char **) argv;
72
73retry:
74
75
76
77
79 {
81 nonopt_start = -1;
82 force_nonopt = false;
83 return -1;
84 }
85
87
88
89
90
91
92
93
94
95
96 if (force_nonopt || place[0] != '-' || place[1] == '\0')
97 {
100 args[argc - 1] = place;
101
102 if (nonopt_start == -1)
103 nonopt_start = argc - 1;
104 else
105 nonopt_start--;
106
107 goto retry;
108 }
109
110 place++;
111
112 if (place[0] == '-' && place[1] == '\0')
113 {
114
116 force_nonopt = true;
117 goto retry;
118 }
119
120 if (place[0] == '-' && place[1])
121 {
122
123 size_t namelen;
125
126 place++;
127
128 namelen = strcspn(place, "=");
129 for (
i = 0; longopts[
i].
name != NULL;
i++)
130 {
131 if (strlen(longopts[
i].
name) == namelen
132 && strncmp(place, longopts[
i].
name, namelen) == 0)
133 {
135
137 {
138 if (place[namelen] == '=')
139 optarg = place + namelen + 1;
140 else if (
optind < argc - 1 &&
142 {
145 }
146 else
147 {
148 if (optstring[0] == ':')
150
153 "%s: option requires an argument -- %s\n",
154 argv[0], place);
155
158
162 }
163 }
164 else
165 {
167 if (place[namelen] != 0)
168 {
169
170 }
171 }
172
174
175 if (longindex)
177
179
180 if (longopts[
i].
flag == NULL)
181 return longopts[
i].
val;
182 else
183 {
185 return 0;
186 }
187 }
188 }
189
190 if (
opterr && optstring[0] !=
':')
192 "%s: illegal option -- %s\n", argv[0], place);
196 }
197 }
198
199
201
202 oli = strchr(optstring,
optopt);
203 if (!oli)
204 {
205 if (!*place)
207 if (
opterr && *optstring !=
':')
209 "%s: illegal option -- %c\n", argv[0],
optopt);
211 }
212
213 if (oli[1] != ':')
214 {
216 if (!*place)
218 }
219 else
220 {
221 if (*place)
223 else if (argc <= ++
optind)
224 {
226 if (*optstring == ':')
230 "%s: option requires an argument -- %c\n",
233 }
234 else
235
239 }
241}
#define fprintf(file, fmt, msg)
#define required_argument
PGDLLIMPORT char * optarg
References generate_unaccent_rules::args, BADARG, BADCH, EMSG, option::flag, flag(), fprintf, option::has_arg, i, name, option::name, no_argument, optarg, opterr, optind, optopt, required_argument, and option::val.
Referenced by get_opts(), handle_args(), main(), parse_psql_options(), parseCommandLine(), and regression_main().