#ifndef ARGMATCH_H_
# define ARGMATCH_H_ 1
# if HAVE_CONFIG_H
# include <config.h>
# endif
# include <sys/types.h>
# ifndef PARAMS
# if PROTOTYPES || (defined (__STDC__) && __STDC__)
# define PARAMS(args) args
# else
# define PARAMS(args) ()
# endif
# endif
# undef ARRAY_CARDINALITY
# define ARRAY_CARDINALITY(Array) (sizeof ((Array)) / sizeof (*(Array)))
# define ARGMATCH_ASSERT(Arglist, Vallist) \
assert (ARRAY_CARDINALITY ((Arglist)) == ARRAY_CARDINALITY ((Vallist)) + 1)
int argmatch
PARAMS ((const char *arg, const char *const *arglist,
const char *vallist, size_t valsize));
int argcasematch
PARAMS ((const char *arg, const char *const *arglist,
const char *vallist, size_t valsize));
# define ARGMATCH(Arg, Arglist, Vallist) \
argmatch ((Arg), (Arglist), (const char *) (Vallist), sizeof (*(Vallist)))
# define ARGCASEMATCH(Arg, Arglist, Vallist) \
argcasematch ((Arg), (Arglist), (const char *) (Vallist), sizeof (*(Vallist)))
typedef void (*argmatch_exit_fn) PARAMS ((void));
extern argmatch_exit_fn argmatch_die;
void argmatch_invalid
PARAMS ((const char *context, const char *value, int problem));
# define invalid_arg(Context, Value, Problem) \
argmatch_invalid ((Context), (Value), (Problem))
void argmatch_valid
PARAMS ((const char *const *arglist,
const char *vallist, size_t valsize));
# define ARGMATCH_VALID(Arglist, Vallist) \
argmatch_valid (Arglist, (const char *) Vallist, sizeof (*(Vallist)))
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));
# define XARGMATCH(Context, Arg, Arglist, Vallist) \
(Vallist [__xargmatch_internal ((Context), (Arg), (Arglist), \
(const char *) (Vallist), \
sizeof (*(Vallist)), \
1, argmatch_die)])
# define XARGCASEMATCH(Context, Arg, Arglist, Vallist) \
(Vallist [__xargmatch_internal ((Context), (Arg), (Arglist), \
(const char *) (Vallist), \
sizeof (*(Vallist)), \
0, argmatch_die)])
const char *argmatch_to_argument
PARAMS ((char const *value, const char *const *arglist,
const char *vallist, size_t valsize));
# define ARGMATCH_TO_ARGUMENT(Value, Arglist, Vallist) \
argmatch_to_argument ((char const *) &(Value), (Arglist), \
(const char *) (Vallist), sizeof (*(Vallist)))
#endif