- 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)
+ argmatch_valid (Arglist, (const char *) Vallist, sizeof (*(Vallist)))
+
+
+
+/* Same as argmatch, but upon failure, reports a explanation on the
+ failure, and exits using the function EXIT_FN. */
+
+int __xargmatch_internal
+ PARAMS ((const char *context,
+ const char *arg, const char *const *arglist,
+ const char *vallist, size_t valsize,
+ int case_sensitive, argmatch_exit_fn exit_fn));
+
+/* Programmer friendly interface to __xargmatch_internal. */
+
+# define XARGMATCH(Context, Arg, Arglist, Vallist) \
+ (Vallist [__xargmatch_internal ((Context), (Arg), (Arglist), \
+ (const char *) (Vallist), \
+ sizeof (*(Vallist)), \
+ 1, argmatch_die)])