Go to the documentation of this file.
40 #if defined(LIBC_SCCS) && !defined(lint)
41 static char sccsid[] =
"@(#)getopt.c 8.3 (Berkeley) 4/27/95";
53 #define BADCH (int)'?'
54 #define BADARG (int)':'
55 #define EMSG (char*)""
67 static char *place =
EMSG;
72 if (
optind >= nargc || *(place = nargv[
optind]) !=
'-') {
76 if (place[1] && *++place ==
'-') {
82 if ((
optopt = (
int) *place++) == (
int)
':' ||
83 !(oli = strchr(ostr,
optopt))) {
92 if (
opterr && *ostr !=
':')
93 (void) fprintf(stderr,
94 "%s: illegal option -- %c\n", __FILE__,
optopt);
104 else if (nargc <= ++
optind) {
109 (void) fprintf(stderr,
110 "%s: option requires an argument -- %c\n",
int getopt(int nargc, char *const *nargv, const char *ostr)