11 #define BADCH (int)'?'
12 #define BADARG (int)':'
20 getopt (
int nargc,
char *
const nargv[],
const char *ostr)
22 static const char *place =
EMSG;
27 if (
optind >= nargc || *(place = nargv[
optind]) !=
'-') {
31 if (place[1] && *++place ==
'-') {
37 if ((
optopt = (
int)*place++) == (
int)
':' ||
38 !(oli = strchr (ostr,
optopt))) {
47 if (
opterr && *ostr !=
':')
59 else if (nargc <= ++
optind) {
64 (void)
printf (
"option requires an argument -- %c\n",
optopt);
_Use_decl_annotations_ int __cdecl printf(const char *const _Format,...)