471{
472 int print_errors =
d->opterr;
473
475 return -1;
476
478
479 if (
d->optind == 0 || !
d->__initialized)
481 else if (optstring[0] == '-' || optstring[0] == '+')
482 optstring++;
483
484 if (optstring[0] == ':')
485 print_errors = 0;
486
487
488#define NONOPTION_P (argv[d->optind][0] != '-' || argv[d->optind][1] == '\0')
489
490 if (
d->__nextchar ==
NULL || *
d->__nextchar ==
'\0')
491 {
492
493
494
495
496 if (
d->__last_nonopt >
d->optind)
497 d->__last_nonopt =
d->optind;
498 if (
d->__first_nonopt >
d->optind)
499 d->__first_nonopt =
d->optind;
500
502 {
503
504
505
506 if (
d->__first_nonopt !=
d->__last_nonopt
507 &&
d->__last_nonopt !=
d->optind)
509 else if (
d->__last_nonopt !=
d->optind)
510 d->__first_nonopt =
d->optind;
511
512
513
514
517 d->__last_nonopt =
d->optind;
518 }
519
520
521
522
523
524
526 {
528
529 if (
d->__first_nonopt !=
d->__last_nonopt
530 &&
d->__last_nonopt !=
d->optind)
532 else if (
d->__first_nonopt ==
d->__last_nonopt)
533 d->__first_nonopt =
d->optind;
534 d->__last_nonopt =
argc;
535
537 }
538
539
540
541
542 if (
d->optind ==
argc)
543 {
544
545
546 if (
d->__first_nonopt !=
d->__last_nonopt)
547 d->optind =
d->__first_nonopt;
548 return -1;
549 }
550
551
552
553
555 {
557 return -1;
558 d->optarg =
argv[
d->optind++];
559 return 1;
560 }
561
562
563
564 if (longopts)
565 {
566 if (
argv[
d->optind][1] ==
'-')
567 {
568
569
570 d->__nextchar =
argv[
d->optind] + 2;
572 longind, long_only,
d,
573 print_errors, "--");
574 }
575
576
577
578
579
580
581
582
583
584
585
586
587
588 if (long_only && (
argv[
d->optind][2]
590 {
592 d->__nextchar =
argv[
d->optind] + 1;
594 longind, long_only,
d,
595 print_errors, "-");
598 }
599 }
600
601
602 d->__nextchar =
argv[
d->optind] + 1;
603 }
604
605
606
607 {
608 char c = *
d->__nextchar++;
610
611
612 if (*
d->__nextchar ==
'\0')
614
616 {
617 if (print_errors)
620 return '?';
621 }
622
623
624 if (
temp[0] ==
'W' &&
temp[1] ==
';' && longopts !=
NULL)
625 {
626
627 if (*
d->__nextchar !=
'\0')
628 d->optarg =
d->__nextchar;
629 else if (
d->optind ==
argc)
630 {
631 if (print_errors)
633 _(
"%s: option requires an argument -- '%c'\n"),
635
637 if (optstring[0] == ':')
639 else
642 }
643 else
644 d->optarg =
argv[
d->optind];
645
646 d->__nextchar =
d->optarg;
649 0 ,
d, print_errors,
"-W ");
650 }
652 {
654 {
655
656 if (*
d->__nextchar !=
'\0')
657 {
658 d->optarg =
d->__nextchar;
660 }
661 else
663 d->__nextchar =
NULL;
664 }
665 else
666 {
667
668 if (*
d->__nextchar !=
'\0')
669 {
670 d->optarg =
d->__nextchar;
671
672
674 }
675 else if (
d->optind ==
argc)
676 {
677 if (print_errors)
679 _(
"%s: option requires an argument -- '%c'\n"),
681
683 if (optstring[0] == ':')
685 else
687 }
688 else
689
690
691 d->optarg =
argv[
d->optind++];
692 d->__nextchar =
NULL;
693 }
694 }
696 }
697}
int strcmp(const char *String1, const char *String2)
char * strchr(const char *String, int ch)
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)