26 #if !LELY_HAVE_UNISTD_H
44 getopt(
int argc,
char *
const argv[],
const char *optstring)
52 if (optind >= argc || !argv[optind])
55 char *cp = argv[optind] + optoff;
59 if (*cp++ !=
'-' || !*cp)
62 if (*cp ==
'-' && !cp[1]) {
78 const char *op = optstring;
79 while (*op && (*op ==
':' || *op ==
'?' || *op != c))
83 if (opterr && *optstring !=
':')
84 fprintf(stderr,
"%s: illegal option -- %c\n", argv[0],
103 if (opterr && *optstring !=
':')
105 "%s: option requires an "
108 return *optstring ==
':' ?
':' :
'?';
110 optarg = argv[optind - 1];
This is the internal header file of the C11 and POSIX compatibility library.
This header file is part of the C11 and POSIX compatibility library; it includes <stddef....
This header file is part of the C11 and POSIX compatibility library; it includes <stdio....
This header file is part of the C11 and POSIX compatibility library; it includes <unistd....