Go to the source code of this file.
|
int | _getopt_internal (int ___argc, char **___argv, const char *__shortopts, const struct option *__longopts, int *__longind, int __long_only, int __posixly_correct) |
|
int | _getopt_internal_r (int ___argc, char **___argv, const char *__shortopts, const struct option *__longopts, int *__longind, int __long_only, struct _getopt_data *__data, int __posixly_correct) |
|
int | _getopt_long_r (int ___argc, char **___argv, const char *__shortopts, const struct option *__longopts, int *__longind, struct _getopt_data *__data) |
|
int | _getopt_long_only_r (int ___argc, char **___argv, const char *__shortopts, const struct option *__longopts, int *__longind, struct _getopt_data *__data) |
|
◆ _GETOPT_DATA_INITIALIZER
#define _GETOPT_DATA_INITIALIZER { 1, 1 } |
◆ __ord
Enumerator |
---|
REQUIRE_ORDER | |
PERMUTE | |
RETURN_IN_ORDER | |
Definition at line 55 of file getopt_int.h.
◆ _getopt_internal()
◆ _getopt_internal_r()
Definition at line 468 of file getopt.c.
472 int print_errors =
d->opterr;
479 if (
d->optind == 0 || !
d->__initialized)
481 else if (optstring[0] ==
'-' || optstring[0] ==
'+')
484 if (optstring[0] ==
':')
488 #define NONOPTION_P (argv[d->optind][0] != '-' || argv[d->optind][1] == '\0') 490 if (
d->__nextchar ==
NULL || *
d->__nextchar ==
'\0')
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;
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;
517 d->__last_nonopt =
d->optind;
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;
542 if (
d->optind ==
argc)
546 if (
d->__first_nonopt !=
d->__last_nonopt)
547 d->optind =
d->__first_nonopt;
558 d->optarg =
argv[
d->optind++];
566 if (
argv[
d->optind][1] ==
'-')
570 d->__nextchar =
argv[
d->optind] + 2;
572 longind, long_only,
d,
588 if (long_only && (
argv[
d->optind][2]
592 d->__nextchar =
argv[
d->optind] + 1;
594 longind, long_only,
d,
602 d->__nextchar =
argv[
d->optind] + 1;
608 char c = *
d->__nextchar++;
612 if (*
d->__nextchar ==
'\0')
624 if (
temp[0] ==
'W' &&
temp[1] ==
';' && longopts !=
NULL)
627 if (*
d->__nextchar !=
'\0')
628 d->optarg =
d->__nextchar;
629 else if (
d->optind ==
argc)
633 _(
"%s: option requires an argument -- '%c'\n"),
637 if (optstring[0] ==
':')
644 d->optarg =
argv[
d->optind];
646 d->__nextchar =
d->optarg;
649 0 ,
d, print_errors,
"-W ");
656 if (*
d->__nextchar !=
'\0')
658 d->optarg =
d->__nextchar;
663 d->__nextchar =
NULL;
668 if (*
d->__nextchar !=
'\0')
670 d->optarg =
d->__nextchar;
675 else if (
d->optind ==
argc)
679 _(
"%s: option requires an argument -- '%c'\n"),
683 if (optstring[0] ==
':')
691 d->optarg =
argv[
d->optind++];
692 d->__nextchar =
NULL;
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
char * strchr(const char *String, int ch)
int strcmp(const char *String1, const char *String2)
Referenced by _getopt_internal(), _getopt_long_only_r(), and _getopt_long_r().
◆ _getopt_long_only_r()
Definition at line 55 of file getopt1.c.
static const struct option long_options[]
◆ _getopt_long_r()
Definition at line 32 of file getopt1.c.
static const struct option long_options[]