39# define fprintf __fxprintf_nocancel
40# define flockfile(fp) _IO_flockfile (fp)
41# define funlockfile(fp) _IO_funlockfile (fp)
43# define _(msgid) (msgid)
46# ifndef _POSIX_THREAD_SAFE_FUNCTIONS
48# define funlockfile(fp)
51# define __libc_use_alloca(size) 0
53# define alloca(size) (abort (), (void *)0)
130 int bottom =
d->__first_nonopt;
131 int middle =
d->__last_nonopt;
169 argv[middle +
i] = tem;
178 d->__first_nonopt += (
d->optind -
d->__last_nonopt);
179 d->__last_nonopt =
d->optind;
192 const struct option *longopts,
int *longind,
194 int print_errors,
const char *prefix)
203 for (nameend =
d->__nextchar; *nameend && *nameend !=
'='; nameend++)
209 for (
p = longopts, n_options = 0;
p->
name;
p++, n_options++)
215 option_index = n_options;
222 unsigned char *ambig_set =
NULL;
223 int ambig_malloced = 0;
224 int ambig_fallback = 0;
227 for (
p = longopts, option_index = 0;
p->
name;
p++, option_index++)
234 indfound = option_index;
238 || pfound->
flag !=
p->flag
239 || pfound->
val !=
p->val)
251 ambig_set =
alloca (n_options);
252 else if ((ambig_set =
malloc (n_options)) ==
NULL)
260 memset (ambig_set, 0, n_options);
261 ambig_set[indfound] = 1;
265 ambig_set[option_index] = 1;
270 if (ambig_set || ambig_fallback)
276 argv[0], prefix,
d->__nextchar);
281 _(
"%s: option '%s%s' is ambiguous; possibilities:"),
282 argv[0], prefix,
d->__nextchar);
284 for (option_index = 0; option_index < n_options; option_index++)
285 if (ambig_set[option_index])
287 prefix, longopts[option_index].
name);
298 d->__nextchar +=
strlen (
d->__nextchar);
304 option_index = indfound;
312 if (!long_only ||
argv[
d->optind][1] ==
'-'
317 argv[0], prefix,
d->__nextchar);
319 d->__nextchar =
NULL;
331 d->__nextchar =
NULL;
337 d->optarg = nameend + 1;
342 _(
"%s: option '%s%s' doesn't allow an argument\n"),
345 d->optopt = pfound->
val;
351 if (
d->optind <
argc)
352 d->optarg =
argv[
d->optind++];
357 _(
"%s: option '%s%s' requires an argument\n"),
360 d->optopt = pfound->
val;
361 return optstring[0] ==
':' ?
':' :
'?';
366 *longind = option_index;
379 char **
argv,
const char *optstring,
388 d->__first_nonopt =
d->__last_nonopt =
d->optind;
389 d->__nextchar =
NULL;
392 if (optstring[0] ==
'-')
397 else if (optstring[0] ==
'+')
402 else if (posixly_correct || !!
getenv (
"POSIXLY_CORRECT"))
407 d->__initialized = 1;
469 const struct option *longopts,
int *longind,
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;
701 const struct option *longopts,
int *longind,
int long_only,
724#define GETOPT_ENTRY(NAME, POSIXLY_CORRECT) \
726 NAME (int argc, char *const *argv, const char *optstring) \
728 return _getopt_internal (argc, (char **)argv, optstring, \
729 0, 0, 0, POSIXLY_CORRECT); \
749 int digit_optind = 0;
771 if (digit_optind != 0 && digit_optind != this_option_optind)
772 printf (
"digits occur in two different argv-elements.\n");
773 digit_optind = this_option_optind;
793 printf (
"?? getopt returned character code 0%o ??\n",
c);
799 printf (
"non-option ARGV-elements: ");
int strcmp(const char *String1, const char *String2)
ACPI_SIZE strlen(const char *String)
int strncmp(const char *String1, const char *String2, ACPI_SIZE Count)
char * strchr(const char *String, int ch)
int getopt(int nargc, char *const *nargv, const char *ostr)
GLdouble GLdouble GLdouble GLdouble top
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
_Check_return_ char *__cdecl getenv(_In_z_ const char *_VarName)