1
1
/* argmatch.h -- definitions and prototypes for argmatch.c
2
Copyright (C) 1990, 1998, 1999, 2001, 2002 Free Software Foundation, Inc.
3
Copyright (C) 1990, 1998, 1999, 2001, 2002, 2004 Free Software
4
6
This program is free software; you can redistribute it and/or modify
5
7
it under the terms of the GNU General Public License as published by
14
16
You should have received a copy of the GNU General Public License
15
17
along with this program; if not, write to the Free Software Foundation,
16
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
18
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
18
20
/* Written by David MacKenzie <djm@ai.mit.edu>
19
21
Modified by Akim Demaille <demaille@inf.enst.fr> */
47
49
false ambiguities (i.e., different matches of ARG but corresponding
48
50
to the same values in VALLIST). */
50
int argmatch (char const *arg, char const *const *arglist,
51
char const *vallist, size_t valsize);
52
ptrdiff_t argmatch (char const *arg, char const *const *arglist,
53
char const *vallist, size_t valsize);
53
55
# define ARGMATCH(Arg, Arglist, Vallist) \
54
56
argmatch (Arg, Arglist, (char const *) (Vallist), sizeof *(Vallist))
56
58
/* xargmatch calls this function when it fails. This function should not
57
59
return. By default, this is a function that calls ARGMATCH_DIE which
58
in turn defaults to `exit (EXIT_FAILURE)'. */
60
in turn defaults to `exit (exit_failure)'. */
59
61
typedef void (*argmatch_exit_fn) (void);
60
62
extern argmatch_exit_fn argmatch_die;
62
64
/* Report on stderr why argmatch failed. Report correct values. */
64
void argmatch_invalid (char const *context, char const *value, int problem);
66
void argmatch_invalid (char const *context, char const *value,
66
69
/* Left for compatibility with the old name invalid_arg */
83
86
/* Same as argmatch, but upon failure, reports a explanation on the
84
87
failure, and exits using the function EXIT_FN. */
86
int __xargmatch_internal (char const *context,
87
char const *arg, char const *const *arglist,
88
char const *vallist, size_t valsize,
89
argmatch_exit_fn exit_fn);
89
ptrdiff_t __xargmatch_internal (char const *context,
90
char const *arg, char const *const *arglist,
91
char const *vallist, size_t valsize,
92
argmatch_exit_fn exit_fn);
91
94
/* Programmer friendly interface to __xargmatch_internal. */