X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=lib%2Fargmatch.h;h=ea0f46800e689a0b6fc6089ed4905a48b904fc76;hb=794b55ff3dcebba4518b555161f97ef6524a7270;hp=5595ee4361ef1d86c0af47e0e344606d65cd77d9;hpb=c23539445579d59e0e6c1f37330e346f50c5aef4;p=gnulib.git diff --git a/lib/argmatch.h b/lib/argmatch.h index 5595ee436..ea0f46800 100644 --- a/lib/argmatch.h +++ b/lib/argmatch.h @@ -1,5 +1,7 @@ /* argmatch.h -- definitions and prototypes for argmatch.c - Copyright (C) 1990, 1998, 1999, 2001, 2002 Free Software Foundation, Inc. + + Copyright (C) 1990, 1998, 1999, 2001, 2002, 2004 Free Software + Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -13,7 +15,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ /* Written by David MacKenzie Modified by Akim Demaille */ @@ -30,7 +32,7 @@ /* Assert there are as many real arguments as there are values (argument list ends with a NULL guard). ARGMATCH_VERIFY is - preferred, since it is guaranteed to be chedk at compile-time. + preferred, since it is guaranteed to be checked at compile-time. ARGMATCH_ASSERT is for backward compatibility only. */ # define ARGMATCH_VERIFY(Arglist, Vallist) \ @@ -47,26 +49,22 @@ false ambiguities (i.e., different matches of ARG but corresponding to the same values in VALLIST). */ -int argmatch (char const *arg, char const *const *arglist, - char const *vallist, size_t valsize); -int argcasematch (char const *arg, char const *const *arglist, - char const *vallist, size_t valsize); +ptrdiff_t argmatch (char const *arg, char const *const *arglist, + char const *vallist, size_t valsize); # define ARGMATCH(Arg, Arglist, Vallist) \ argmatch (Arg, Arglist, (char const *) (Vallist), sizeof *(Vallist)) -# define ARGCASEMATCH(Arg, Arglist, Vallist) \ - argcasematch (Arg, Arglist, (char const *) (Vallist), sizeof *(Vallist)) - /* xargmatch calls this function when it fails. This function should not return. By default, this is a function that calls ARGMATCH_DIE which - in turn defaults to `exit (EXIT_FAILURE)'. */ + in turn defaults to `exit (exit_failure)'. */ typedef void (*argmatch_exit_fn) (void); extern argmatch_exit_fn argmatch_die; /* Report on stderr why argmatch failed. Report correct values. */ -void argmatch_invalid (char const *context, char const *value, int problem); +void argmatch_invalid (char const *context, char const *value, + ptrdiff_t problem); /* Left for compatibility with the old name invalid_arg */ @@ -88,10 +86,10 @@ void argmatch_valid (char const *const *arglist, /* Same as argmatch, but upon failure, reports a explanation on the failure, and exits using the function EXIT_FN. */ -int __xargmatch_internal (char const *context, - char const *arg, char const *const *arglist, - char const *vallist, size_t valsize, - int case_sensitive, argmatch_exit_fn exit_fn); +ptrdiff_t __xargmatch_internal (char const *context, + char const *arg, char const *const *arglist, + char const *vallist, size_t valsize, + argmatch_exit_fn exit_fn); /* Programmer friendly interface to __xargmatch_internal. */ @@ -99,13 +97,7 @@ int __xargmatch_internal (char const *context, ((Vallist) [__xargmatch_internal (Context, Arg, Arglist, \ (char const *) (Vallist), \ sizeof *(Vallist), \ - 1, argmatch_die)]) - -# define XARGCASEMATCH(Context, Arg, Arglist, Vallist) \ - ((Vallist) [__xargmatch_internal (Context, Arg, Arglist, \ - (char const *) (Vallist), \ - sizeof *(Vallist), \ - 0, argmatch_die)]) + argmatch_die)]) /* Convert a value into a corresponding argument. */