165{
166 int option_index;
167
169
170
171
172
173
174
176 {
178
180
181
182
183 if (optstring[0] == '-') {
185 ++optstring;
186 } else if (optstring[0] == '+') {
188 ++optstring;
189
190
191 } else {
193 }
194 }
195
197 {
199 {
200
201
202
207 }
208
209
210
211
214 ) {
216 }
218 }
219
220
221
222
223
224
226 {
228
233 }
235
237 }
238
239
240
241
243 {
244
245
249 }
250
251
252
253
255 {
259 return 1;
260 }
261
262
263
266 }
267
271 ))
272 {
275 int exact = 0;
278 int indfound = 0;
279
280 while (*
s && *
s !=
'=')
282
283
284 for (
p = longopts, option_index = 0;
288 {
290 {
291
293 indfound = option_index;
294 exact = 1;
295 break;
296 }
else if (pfound ==
NULL) {
297
299 indfound = option_index;
300 } else {
301
303 }
304 }
305
306 if (
ambig && !exact) {
308 UDFPrint((
"%ws: option `%s' is ambiguous\n",
310 }
314 }
315
317 {
318 option_index = indfound;
321
322
325 } else {
328
330 "%ws: option `--%ws' doesn't allow an argument\n",
332 } else {
333
335 "%ws: option `%c%ws' doesn't allow an argument\n",
337 }
338 }
341 }
342 }
344 {
347 } else {
349 UDFPrint((
"%ws: option `%ws' requires an argument\n",
352 return optstring[0] ==
':' ?
':' :
BAD_OPTION;
353 }
354 }
357 *longind = option_index;
360 return 0;
361 }
363 }
364
365
366
367
370 {
372 {
374
375 UDFPrint((
"%ws: unrecognized option `--%ws'\n",
377 } else {
378
379 UDFPrint((
"%ws: unrecognized option `%c%ws'\n",
381 }
382 }
386 }
387 }
388
389
390
391 {
394
395
398
400 {
402 {
404 }
407 }
409 {
411 {
412
416 } else {
418 }
420 }
421 else
422 {
423
425 {
427
428
430 }
432 {
434 {
435 UDFPrint((
"%ws: option requires an argument -- %c\n",
437 }
439 if (optstring[0] == ':') {
441 } else {
443 }
444 }
445 else
446 {
447
448
450 }
452 }
453 }
455 }
456}
static void exchange(optarg_ctx *o, WCHAR **argv)
static enum @963 ordering
static const char ambig[]