- valid_args (Arglist, (const char *) Vallist, sizeof (*Vallist))
-
-
-/* Returns matches, or, upon error, report explanatory message and
- exit. */
-
-int __xargmatch_internal
- PARAMS ((const char *kind,
- const char *arg, const char *const *arglist,
- const char *vallist, size_t valsize,
- int sensitive));
-
-# define XARGMATCH(Kind, Arg, Arglist, Vallist) \
- Vallist [__xargmatch_internal (Kind, Arg, Arglist, \
- (const char *) Vallist, sizeof (*Vallist), 1)]
-
-# define XARGCASEMATCH(Kind, Arg, Arglist, Vallist) \
- Vallist [__xargmatch_internal (Kind, Arg, Arglist, \
- (const char *) Vallist, sizeof (*Vallist), 0)]
-
+ argmatch_valid (Arglist, (const char *) Vallist, sizeof (*Vallist))
+
+
+/* Set *Result_ptr to the value in Vallist corresponding to the Arg
+ in Arglist. If Arg doesn't match any string in Arglist, give a
+ diagnostic and (presumably) exit via the Die_stmt, leaving *Result_ptr
+ unmodified. */
+
+# define XARGMATCH(Result_ptr, Kind, Arg, Arglist, Vallist, Die_stmt) \
+ do \
+ { \
+ int _i = ARGMATCH (Arg, Arglist, Vallist); \
+ if (_i >= 0) \
+ *(Result_ptr) = (Vallist) [_i]; \
+ else \
+ { \
+ argmatch_invalid ((Kind), (Arg), _i); \
+ ARGMATCH_VALID (Arglist, Vallist); \
+ Die_stmt; \
+ } \
+ } \
+ while (0)