X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=lib%2Fargp.h;h=f06542aeb576c59dff711270b3622b53557db360;hb=ecbe47ca1c551b24c8a4d7309daba56006956849;hp=5286fc488e021ed7db792bbf02a4bf12d82a0ad3;hpb=f81666cf0bfd795a33feea079c6196ed7fc39f2b;p=gnulib.git diff --git a/lib/argp.h b/lib/argp.h index 5286fc488..f06542aeb 100644 --- a/lib/argp.h +++ b/lib/argp.h @@ -1,5 +1,5 @@ /* Hierarchial argument parsing, layered over getopt. - Copyright (C) 1995,1996,1997,1998,1999,2003 Free Software Foundation, Inc. + Copyright (C) 1995-1999,2003,2004 Free Software Foundation, Inc. This file is part of the GNU C Library. Written by Miles Bader . @@ -15,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. */ #ifndef _ARGP_H #define _ARGP_H @@ -23,6 +23,7 @@ #include #include #include +#include #define __need_error_t #include @@ -34,6 +35,9 @@ #ifndef __THROW # define __THROW #endif +#ifndef __NTH +# define __NTH(fct) fct __THROW +#endif #ifndef __attribute__ /* This feature is available in gcc versions 2.5 and later. */ @@ -48,6 +52,18 @@ # endif #endif +/* GCC 2.95 and later have "__restrict"; C99 compilers have + "restrict", and "configure" may have defined "restrict". */ +#ifndef __restrict +# if ! (2 < __GNUC__ || (2 == __GNUC__ && 95 <= __GNUC_MINOR__)) +# if defined restrict || 199901L <= __STDC_VERSION__ +# define __restrict restrict +# else +# define __restrict +# endif +# endif +#endif + #ifndef __error_t_defined typedef int error_t; # define __error_t_defined @@ -111,11 +127,12 @@ struct argp_option should be displayed in much the same manner as the options. If this flag is set, then the option NAME field is displayed unmodified (e.g., no `--' prefix is added) at the left-margin (where a *short* option would normally - be displayed), and the documentation string in the normal place. For - purposes of sorting, any leading whitespace and punctuation is ignored, - except that if the first non-whitespace character is not `-', this entry - is displayed after all options (and OPTION_DOC entries with a leading `-') - in the same group. */ + be displayed), and the documentation string in the normal place. The NAME + field will be translated using gettext, unless OPTION_NO_TRANS is set (see + below). For purposes of sorting, any leading whitespace and punctuation is + ignored, except that if the first non-whitespace character is not `-', this + entry is displayed after all options (and OPTION_DOC entries with a leading + `-') in the same group. */ #define OPTION_DOC 0x8 /* This option shouldn't be included in `long' usage messages (but is still @@ -126,6 +143,11 @@ struct argp_option distinguish these two cases, -x should probably be marked OPTION_NO_USAGE. */ #define OPTION_NO_USAGE 0x10 + +/* Valid only in conjunction with OPTION_DOC. This option disables translation + of option name. */ +#define OPTION_NO_TRANS 0x20 + struct argp; /* fwd declare this type */ struct argp_state; /* " */ @@ -545,25 +567,25 @@ extern void *__argp_input (__const struct argp *__restrict __argp, # endif ARGP_EI void -__argp_usage (__const struct argp_state *__state) __THROW +__NTH (__argp_usage (__const struct argp_state *__state)) { __argp_state_help (__state, stderr, ARGP_HELP_STD_USAGE); } ARGP_EI int -__option_is_short (__const struct argp_option *__opt) __THROW +__NTH (__option_is_short (__const struct argp_option *__opt)) { if (__opt->flags & OPTION_DOC) return 0; else { int __key = __opt->key; - return __key > 0 && isprint (__key); + return __key > 0 && __key <= UCHAR_MAX && isprint (__key); } } ARGP_EI int -__option_is_end (__const struct argp_option *__opt) __THROW +__NTH (__option_is_end (__const struct argp_option *__opt)) { return !__opt->key && !__opt->name && !__opt->doc && !__opt->group; }