13 #define BADCH (int)'?'
14 #define BADARG (int)':'
30 static const char *place =
EMSG;
33 if (opt->
reset || !*place) {
35 if (opt->
ind >= opt->
argc || *(place = opt->
argv[opt->
ind]) !=
'-') {
39 if (place[1] && *++place ==
'-') {
46 if ((opt->
opt = (
int)*place++) == (
int)
':' || !(oli = strchr(opt->
ostr, opt->
opt))) {
51 if (opt->
opt == (
int)
'-') {
63 if (opt->
err && *opt->
ostr !=
':') {
64 (void)
eprintf(
"%s: illegal option -- %c\n", opt->
argv[0], opt->
opt);
71 }
else if (opt->
argc <= ++opt->
ind) {
73 if (*opt->
ostr ==
':') {
77 (void)
eprintf(
"%s: option requires an argument -- %c\n", opt->
argv[0], opt->
opt);
return memset(p, 0, total)
RZ_API void rz_getopt_init(RzGetopt *opt, int argc, const char **argv, const char *ostr)
RZ_API int rz_getopt_next(RzGetopt *opt)
static static fork const void static count static fd const char const char static newpath char char argv