static int RVAL(struct _scanopt_t *, int);
static int FLAGS(struct _scanopt_t *, int);
static const char *DESC(struct _scanopt_t *, int);
-static int scanopt_err(struct _scanopt_t *, int, int);
+static void scanopt_err(struct _scanopt_t *, int, int);
static int matchlongopt(char *, char **, int *, char **, int *);
static int find_opt(struct _scanopt_t *, int, char *, int, int *, int *opt_offset);
#endif /* no scanopt_usage */
-static int scanopt_err (struct _scanopt_t *s, int is_short, int err)
+static void scanopt_err(struct _scanopt_t *s, int is_short, int err)
{
const char *optname = "";
char optchar[2];
break;
}
}
- return err;
}
\f
if (!find_opt
(s, 0, pstart, namelen, &errcode, &opt_offset)) {
- return scanopt_err (s, 1, errcode);
+ scanopt_err(s, 1, errcode);
+ return errcode;
}
optarg = pstart + 1;
/* case: no args allowed */
if (auxp->flags & ARG_NONE) {
if (optarg && !is_short) {
- scanopt_err (s, is_short, errcode = SCANOPT_ERR_ARG_NOT_ALLOWED);
+ scanopt_err(s, is_short, SCANOPT_ERR_ARG_NOT_ALLOWED);
INC_INDEX (s, 1);
- return errcode;
+ return SCANOPT_ERR_ARG_NOT_ALLOWED;
}
else if (!optarg)
INC_INDEX (s, 1);
/* case: required */
if (auxp->flags & ARG_REQ) {
- if (!optarg && !has_next)
- return scanopt_err (s, is_short, SCANOPT_ERR_ARG_NOT_FOUND);
+ if (!optarg && !has_next) {
+ scanopt_err(s, is_short, SCANOPT_ERR_ARG_NOT_FOUND);
+ return SCANOPT_ERR_ARG_NOT_FOUND;
+ }
if (!optarg) {
/* Let the next argv element become the argument. */