- PARAMS ((const char *const *arglist,
- const char *vallist, size_t valsize));
-
-# define ARGMATCH_VALID(ARGLIST,VALLIST) \
- 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)]
-
+ PARAMS ((const char *const *arglist,
+ const char *vallist, size_t valsize));
+
+# define ARGMATCH_VALID(Arglist, Vallist) \
+ 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)