4 #define EPR fprintf(stderr,
5 #define ERR(str, chr) if(opterr) { EPR "%s%c\n", str, chr); }
13 stgetopt(int argc
, char *const argv
[], const char *opts
)
22 argv
[optind
][0] != '-' || argv
[optind
][1] == '\0')
24 else if (strcmp(argv
[optind
], "--") == 0)
29 else if (strcmp(argv
[optind
], "-isysroot") == 0)
31 // skip Mac OS X SDK selection flags
35 optopt
= c
= argv
[optind
][sp
];
36 if (c
== ':' || (cp
= strchr(opts
, c
)) == 0)
38 ERR(": illegal option -- ", c
);
39 if (argv
[optind
][++sp
] == '\0')
48 if (argv
[optind
][sp
+ 1] != '\0')
49 optarg
= &argv
[optind
++][sp
+ 1];
53 ERR(": option requires an argument -- ", c
);
58 optarg
= argv
[optind
++];
63 if (argv
[optind
][++sp
] == '\0')