Commit 65b77008 65b770085aff7b6bba421ae81a0589fe49694f01 by Sergey Poznyakoff

Updated by gnulib-sync

1 parent 50b24ab6
...@@ -9,8 +9,40 @@ AC_DEFUN([gl_ARGP], ...@@ -9,8 +9,40 @@ AC_DEFUN([gl_ARGP],
9 AC_REQUIRE([AC_C_INLINE]) 9 AC_REQUIRE([AC_C_INLINE])
10 AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) 10 AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
11 AC_REQUIRE([gl_GETOPT_SUBSTITUTE]) 11 AC_REQUIRE([gl_GETOPT_SUBSTITUTE])
12 AC_CHECK_DECLS([program_invocation_name, program_invocation_short_name],,, 12
13 [#include <errno.h>]) 13 AC_CHECK_DECL([program_invocation_name],
14 [AC_DEFINE(HAVE_DECL_PROGRAM_INVOCATION_NAME, 1,
15 [Define if program_invocation_name is declared])],
16 [AC_DEFINE(GNULIB_PROGRAM_INVOCATION_NAME, 1,
17 [Define to 1 to add extern declaration of program_invocation_name to argp-namefrob.h])],
18 [#include <errno.h>])
19 AC_CHECK_DECL([program_invocation_short_name],
20 [AC_DEFINE(HAVE_DECL_PROGRAM_INVOCATION_SHORT_NAME, 1,
21 [Define if program_invocation_short_name is declared])],
22 [AC_DEFINE(GNULIB_PROGRAM_INVOCATION_SHORT_NAME, 1,
23 [Define to 1 to add extern declaration of program_invocation_short_name to argp-namefrob.h])],
24 [#include <errno.h>])
25
26 # Check if program_invocation_name and program_invocation_short_name
27 # are defined elsewhere. It is improbable that only one of them will
28 # be defined and other not, I prefer to stay on the safe side and to
29 # test each one separately.
30 AC_MSG_CHECKING(whether program_invocation_name is defined)
31 AC_TRY_COMPILE([#include <argp.h>],
32 [ program_invocation_name = "test"; ],
33 [ AC_DEFINE(HAVE_PROGRAM_INVOCATION_NAME,1,
34 [Define if program_invocation_name is defined])
35 AC_MSG_RESULT(yes)],
36 [ AC_MSG_RESULT(no)] )
37
38 AC_MSG_CHECKING(whether program_invocation_short_name is defined)
39 AC_TRY_COMPILE([#include <argp.h>],
40 [ program_invocation_short_name = "test"; ],
41 [ AC_DEFINE(HAVE_PROGRAM_INVOCATION_SHORT_NAME,1,
42 [Define if program_invocation_short_name is defined])
43 AC_MSG_RESULT(yes)],
44 [ AC_MSG_RESULT(no)] )
45
14 AC_CHECK_DECLS_ONCE( 46 AC_CHECK_DECLS_ONCE(
15 [clearerr_unlocked feof_unlocked ferror_unlocked 47 [clearerr_unlocked feof_unlocked ferror_unlocked
16 fflush_unlocked fgets_unlocked fputc_unlocked fputs_unlocked 48 fflush_unlocked fgets_unlocked fputc_unlocked fputs_unlocked
......
1 #serial 30 1 #serial 31
2 2
3 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005 Free 3 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005 Free
4 # Software Foundation, Inc. 4 # Software Foundation, Inc.
...@@ -15,8 +15,29 @@ AC_PREREQ([2.50]) ...@@ -15,8 +15,29 @@ AC_PREREQ([2.50])
15 AC_DEFUN([gl_REGEX], 15 AC_DEFUN([gl_REGEX],
16 [ 16 [
17 AC_REQUIRE([AC_SYS_LARGEFILE]) dnl for a sufficently-wide off_t 17 AC_REQUIRE([AC_SYS_LARGEFILE]) dnl for a sufficently-wide off_t
18 AC_DEFINE([_REGEX_LARGE_OFFSETS], 1, 18
19 [Define if you want regoff_t to be at least as wide POSIX requires.]) 19 AC_CACHE_CHECK([whether off_t can be used in a switch statement],
20 [gl_cv_type_off_t_switch],
21 [AC_COMPILE_IFELSE(
22 [AC_LANG_PROGRAM(
23 [AC_INCLUDES_DEFAULT],
24 [[off_t o = -1;
25 switch (o)
26 {
27 case -2:
28 return 1;
29 case -1:
30 return 2;
31 default:
32 return 0;
33 }
34 ]])],
35 [gl_cv_type_off_t_switch=yes],
36 [gl_cv_type_off_t_switch=no])])
37 if test $gl_cv_type_off_t_switch = yes; then
38 AC_DEFINE([_REGEX_LARGE_OFFSETS], 1,
39 [Define if you want regoff_t to be at least as wide POSIX requires.])
40 fi
20 41
21 MU_LIBSOURCES( 42 MU_LIBSOURCES(
22 [regcomp.c, regex.c, regex.h, 43 [regcomp.c, regex.c, regex.h,
......
1 # stdint.m4 serial 4 1 # stdint.m4 serial 5
2 dnl Copyright (C) 2001-2002, 2004-2005 Free Software Foundation, Inc. 2 dnl Copyright (C) 2001-2002, 2004-2005 Free Software Foundation, Inc.
3 dnl This file is free software; the Free Software Foundation 3 dnl This file is free software; the Free Software Foundation
4 dnl gives unlimited permission to copy and/or distribute it, 4 dnl gives unlimited permission to copy and/or distribute it,
...@@ -12,6 +12,8 @@ AC_DEFUN([gl_STDINT_H], ...@@ -12,6 +12,8 @@ AC_DEFUN([gl_STDINT_H],
12 AC_REQUIRE([gt_HEADER_INTTYPES_H]) 12 AC_REQUIRE([gt_HEADER_INTTYPES_H])
13 dnl Check for <sys/inttypes.h>. 13 dnl Check for <sys/inttypes.h>.
14 AC_CHECK_HEADERS([sys/inttypes.h]) 14 AC_CHECK_HEADERS([sys/inttypes.h])
15 dnl Check for <sys/bitypes.h> (used in Linux libc4 >= 4.6.7 and libc5).
16 AC_CHECK_HEADERS([sys/bitypes.h])
15 17
16 AC_MSG_CHECKING([for stdint.h]) 18 AC_MSG_CHECKING([for stdint.h])
17 AC_CACHE_VAL(gl_cv_header_stdint_h, [ 19 AC_CACHE_VAL(gl_cv_header_stdint_h, [
......
1 /* Word-wrapping and line-truncating streams. 1 /* Word-wrapping and line-truncating streams.
2 Copyright (C) 1997 Free Software Foundation, Inc. 2 Copyright (C) 1997, 2006 Free Software Foundation, Inc.
3 This file is part of the GNU C Library. 3 This file is part of the GNU C Library.
4 Written by Miles Bader <miles@gnu.ai.mit.edu>. 4 Written by Miles Bader <miles@gnu.ai.mit.edu>.
5 5
...@@ -89,10 +89,6 @@ typedef FILE *argp_fmtstream_t; ...@@ -89,10 +89,6 @@ typedef FILE *argp_fmtstream_t;
89 89
90 #else /* !ARGP_FMTSTREAM_USE_LINEWRAP */ 90 #else /* !ARGP_FMTSTREAM_USE_LINEWRAP */
91 /* Guess we have to define our own version. */ 91 /* Guess we have to define our own version. */
92
93 #ifndef __const
94 #define __const const
95 #endif
96 92
97 struct argp_fmtstream 93 struct argp_fmtstream
98 { 94 {
...@@ -133,22 +129,22 @@ extern void __argp_fmtstream_free (argp_fmtstream_t __fs); ...@@ -133,22 +129,22 @@ extern void __argp_fmtstream_free (argp_fmtstream_t __fs);
133 extern void argp_fmtstream_free (argp_fmtstream_t __fs); 129 extern void argp_fmtstream_free (argp_fmtstream_t __fs);
134 130
135 extern ssize_t __argp_fmtstream_printf (argp_fmtstream_t __fs, 131 extern ssize_t __argp_fmtstream_printf (argp_fmtstream_t __fs,
136 __const char *__fmt, ...) 132 const char *__fmt, ...)
137 __attribute__ ((__format__ (printf, 2, 3))); 133 __attribute__ ((__format__ (printf, 2, 3)));
138 extern ssize_t argp_fmtstream_printf (argp_fmtstream_t __fs, 134 extern ssize_t argp_fmtstream_printf (argp_fmtstream_t __fs,
139 __const char *__fmt, ...) 135 const char *__fmt, ...)
140 __attribute__ ((__format__ (printf, 2, 3))); 136 __attribute__ ((__format__ (printf, 2, 3)));
141 137
142 extern int __argp_fmtstream_putc (argp_fmtstream_t __fs, int __ch); 138 extern int __argp_fmtstream_putc (argp_fmtstream_t __fs, int __ch);
143 extern int argp_fmtstream_putc (argp_fmtstream_t __fs, int __ch); 139 extern int argp_fmtstream_putc (argp_fmtstream_t __fs, int __ch);
144 140
145 extern int __argp_fmtstream_puts (argp_fmtstream_t __fs, __const char *__str); 141 extern int __argp_fmtstream_puts (argp_fmtstream_t __fs, const char *__str);
146 extern int argp_fmtstream_puts (argp_fmtstream_t __fs, __const char *__str); 142 extern int argp_fmtstream_puts (argp_fmtstream_t __fs, const char *__str);
147 143
148 extern size_t __argp_fmtstream_write (argp_fmtstream_t __fs, 144 extern size_t __argp_fmtstream_write (argp_fmtstream_t __fs,
149 __const char *__str, size_t __len); 145 const char *__str, size_t __len);
150 extern size_t argp_fmtstream_write (argp_fmtstream_t __fs, 146 extern size_t argp_fmtstream_write (argp_fmtstream_t __fs,
151 __const char *__str, size_t __len); 147 const char *__str, size_t __len);
152 148
153 /* Access macros for various bits of state. */ 149 /* Access macros for various bits of state. */
154 #define argp_fmtstream_lmargin(__fs) ((__fs)->lmargin) 150 #define argp_fmtstream_lmargin(__fs) ((__fs)->lmargin)
...@@ -207,7 +203,7 @@ extern int __argp_fmtstream_ensure (argp_fmtstream_t __fs, size_t __amount); ...@@ -207,7 +203,7 @@ extern int __argp_fmtstream_ensure (argp_fmtstream_t __fs, size_t __amount);
207 203
208 ARGP_FS_EI size_t 204 ARGP_FS_EI size_t
209 __argp_fmtstream_write (argp_fmtstream_t __fs, 205 __argp_fmtstream_write (argp_fmtstream_t __fs,
210 __const char *__str, size_t __len) 206 const char *__str, size_t __len)
211 { 207 {
212 if (__fs->p + __len <= __fs->end || __argp_fmtstream_ensure (__fs, __len)) 208 if (__fs->p + __len <= __fs->end || __argp_fmtstream_ensure (__fs, __len))
213 { 209 {
...@@ -220,7 +216,7 @@ __argp_fmtstream_write (argp_fmtstream_t __fs, ...@@ -220,7 +216,7 @@ __argp_fmtstream_write (argp_fmtstream_t __fs,
220 } 216 }
221 217
222 ARGP_FS_EI int 218 ARGP_FS_EI int
223 __argp_fmtstream_puts (argp_fmtstream_t __fs, __const char *__str) 219 __argp_fmtstream_puts (argp_fmtstream_t __fs, const char *__str)
224 { 220 {
225 size_t __len = strlen (__str); 221 size_t __len = strlen (__str);
226 if (__len) 222 if (__len)
......
...@@ -89,15 +89,15 @@ struct uparams ...@@ -89,15 +89,15 @@ struct uparams
89 int dup_args_note; 89 int dup_args_note;
90 90
91 /* Various output columns. */ 91 /* Various output columns. */
92 int short_opt_col; 92 int short_opt_col; /* column in which short options start */
93 int long_opt_col; 93 int long_opt_col; /* column in which long options start */
94 int doc_opt_col; 94 int doc_opt_col; /* column in which doc options start */
95 int opt_doc_col; 95 int opt_doc_col; /* column in which option text starts */
96 int header_col; 96 int header_col; /* column in which group headers are printed */
97 int usage_indent; 97 int usage_indent; /* indentation of wrapped usage lines */
98 int rmargin; 98 int rmargin; /* right margin used for wrapping */
99 99
100 int valid; /* True when the values in here are valid. */ 100 int valid; /* True when the values in here are valid. */
101 }; 101 };
102 102
103 /* This is a global variable, as user options are only ever read once. */ 103 /* This is a global variable, as user options are only ever read once. */
...@@ -131,91 +131,126 @@ static const struct uparam_name uparam_names[] = ...@@ -131,91 +131,126 @@ static const struct uparam_name uparam_names[] =
131 { 0 } 131 { 0 }
132 }; 132 };
133 133
134 /* Read user options from the environment, and fill in UPARAMS appropiately. */ 134 static void
135 validate_uparams (const struct argp_state *state, struct uparams *upptr)
136 {
137 const struct uparam_name *up;
138
139 for (up = uparam_names; up->name; up++)
140 {
141 if (up->is_bool
142 || up->uparams_offs == offsetof (struct uparams, rmargin))
143 continue;
144 if (*(int *)((char *)upptr + up->uparams_offs) >= upptr->rmargin)
145 {
146 __argp_failure (state, 0, 0,
147 dgettext (state->root_argp->argp_domain,
148 "\
149 ARGP_HELP_FMT: %s value is less then or equal to %s"),
150 "rmargin", up->name);
151 return;
152 }
153 }
154 uparams = *upptr;
155 uparams.valid = 1;
156 }
157
158 /* Read user options from the environment, and fill in UPARAMS appropiately. */
135 static void 159 static void
136 fill_in_uparams (const struct argp_state *state) 160 fill_in_uparams (const struct argp_state *state)
137 { 161 {
138 const char *var = getenv ("ARGP_HELP_FMT"); 162 const char *var = getenv ("ARGP_HELP_FMT");
139 163 struct uparams new_params = uparams;
164
140 #define SKIPWS(p) do { while (isspace (*p)) p++; } while (0); 165 #define SKIPWS(p) do { while (isspace (*p)) p++; } while (0);
141 166
142 if (var) 167 if (var)
143 /* Parse var. */ 168 {
144 while (*var) 169 /* Parse var. */
145 { 170 while (*var)
146 SKIPWS (var); 171 {
147 172 SKIPWS (var);
148 if (isalpha (*var)) 173
149 { 174 if (isalpha (*var))
150 size_t var_len; 175 {
151 const struct uparam_name *un; 176 size_t var_len;
152 int unspec = 0, val = 0; 177 const struct uparam_name *un;
153 const char *arg = var; 178 int unspec = 0, val = 0;
154 179 const char *arg = var;
155 while (isalnum (*arg) || *arg == '-' || *arg == '_')
156 arg++;
157 var_len = arg - var;
158
159 SKIPWS (arg);
160 180
161 if (*arg == '\0' || *arg == ',') 181 while (isalnum (*arg) || *arg == '-' || *arg == '_')
162 unspec = 1;
163 else if (*arg == '=')
164 {
165 arg++; 182 arg++;
166 SKIPWS (arg); 183 var_len = arg - var;
167 } 184
168 185 SKIPWS (arg);
169 if (unspec) 186
170 { 187 if (*arg == '\0' || *arg == ',')
171 if (var[0] == 'n' && var[1] == 'o' && var[2] == '-') 188 unspec = 1;
172 { 189 else if (*arg == '=')
173 val = 0; 190 {
174 var += 3;
175 var_len -= 3;
176 }
177 else
178 val = 1;
179 }
180 else if (isdigit (*arg))
181 {
182 val = atoi (arg);
183 while (isdigit (*arg))
184 arg++; 191 arg++;
185 SKIPWS (arg); 192 SKIPWS (arg);
186 } 193 }
187 194
188 for (un = uparam_names; un->name; un++) 195 if (unspec)
189 if (strlen (un->name) == var_len
190 && strncmp (var, un->name, var_len) == 0)
191 { 196 {
192 if (unspec && !un->is_bool) 197 if (var[0] == 'n' && var[1] == 'o' && var[2] == '-')
193 __argp_failure (state, 0, 0, 198 {
194 dgettext (state->root_argp->argp_domain, "\ 199 val = 0;
195 %.*s: ARGP_HELP_FMT parameter requires a value"), 200 var += 3;
196 (int) var_len, var); 201 var_len -= 3;
202 }
197 else 203 else
198 *(int *)((char *)&uparams + un->uparams_offs) = val; 204 val = 1;
199 break;
200 } 205 }
201 if (! un->name) 206 else if (isdigit (*arg))
202 __argp_failure (state, 0, 0, 207 {
203 dgettext (state->root_argp->argp_domain, "\ 208 val = atoi (arg);
209 while (isdigit (*arg))
210 arg++;
211 SKIPWS (arg);
212 }
213
214 for (un = uparam_names; un->name; un++)
215 if (strlen (un->name) == var_len
216 && strncmp (var, un->name, var_len) == 0)
217 {
218 if (unspec && !un->is_bool)
219 __argp_failure (state, 0, 0,
220 dgettext (state->root_argp->argp_domain,
221 "\
222 %.*s: ARGP_HELP_FMT parameter requires a value"),
223 (int) var_len, var);
224 else if (val < 0)
225 __argp_failure (state, 0, 0,
226 dgettext (state->root_argp->argp_domain,
227 "\
228 %.*s: ARGP_HELP_FMT parameter must be positive"),
229 (int) var_len, var);
230 else
231 *(int *)((char *)&new_params + un->uparams_offs) = val;
232 break;
233 }
234 if (! un->name)
235 __argp_failure (state, 0, 0,
236 dgettext (state->root_argp->argp_domain, "\
204 %.*s: Unknown ARGP_HELP_FMT parameter"), 237 %.*s: Unknown ARGP_HELP_FMT parameter"),
205 (int) var_len, var); 238 (int) var_len, var);
206 239
207 var = arg; 240 var = arg;
208 if (*var == ',') 241 if (*var == ',')
209 var++; 242 var++;
210 } 243 }
211 else if (*var) 244 else if (*var)
212 { 245 {
213 __argp_failure (state, 0, 0, 246 __argp_failure (state, 0, 0,
214 dgettext (state->root_argp->argp_domain, 247 dgettext (state->root_argp->argp_domain,
215 "Garbage in ARGP_HELP_FMT: %s"), var); 248 "Garbage in ARGP_HELP_FMT: %s"), var);
216 break; 249 break;
217 } 250 }
218 } 251 }
252 validate_uparams (state, &new_params);
253 }
219 } 254 }
220 255
221 /* Returns true if OPT hasn't been marked invisible. Visibility only affects 256 /* Returns true if OPT hasn't been marked invisible. Visibility only affects
...@@ -1683,8 +1718,7 @@ char * ...@@ -1683,8 +1718,7 @@ char *
1683 __argp_short_program_name (void) 1718 __argp_short_program_name (void)
1684 { 1719 {
1685 # if HAVE_DECL_PROGRAM_INVOCATION_NAME 1720 # if HAVE_DECL_PROGRAM_INVOCATION_NAME
1686 char *name = strrchr (program_invocation_name, '/'); 1721 return __argp_base_name (program_invocation_name);
1687 return name ? name + 1 : program_invocation_name;
1688 # else 1722 # else
1689 /* FIXME: What now? Miles suggests that it is better to use NULL, 1723 /* FIXME: What now? Miles suggests that it is better to use NULL,
1690 but currently the value is passed on directly to fputs_unlocked, 1724 but currently the value is passed on directly to fputs_unlocked,
......
...@@ -141,14 +141,21 @@ ...@@ -141,14 +141,21 @@
141 # define putchar_unlocked(x) putchar (x) 141 # define putchar_unlocked(x) putchar (x)
142 # endif 142 # endif
143 143
144 extern char *__argp_basename (char *name);
145
146 #endif /* !_LIBC */ 144 #endif /* !_LIBC */
147 145
148 #ifndef __set_errno 146 #ifndef __set_errno
149 #define __set_errno(e) (errno = (e)) 147 #define __set_errno(e) (errno = (e))
150 #endif 148 #endif
151 149
150 #if defined GNULIB_ARGP_DISABLE_DIRNAME
151 # define __argp_base_name(arg) arg
152 #elif defined GNULIB_ARGP_EXTERN_BASENAME
153 # extern char *__argp_base_name(const char *arg);
154 #else
155 # include "dirname.h"
156 # define __argp_base_name base_name
157 #endif
158
152 #if defined _LIBC || HAVE_DECL_PROGRAM_INVOCATION_SHORT_NAME 159 #if defined _LIBC || HAVE_DECL_PROGRAM_INVOCATION_SHORT_NAME
153 # define __argp_short_program_name() (program_invocation_short_name) 160 # define __argp_short_program_name() (program_invocation_short_name)
154 #else 161 #else
......
...@@ -97,7 +97,7 @@ argp_default_parser (int key, char *arg, struct argp_state *state) ...@@ -97,7 +97,7 @@ argp_default_parser (int key, char *arg, struct argp_state *state)
97 break; 97 break;
98 case OPT_USAGE: 98 case OPT_USAGE:
99 __argp_state_help (state, state->out_stream, 99 __argp_state_help (state, state->out_stream,
100 ARGP_HELP_USAGE | ARGP_HELP_EXIT_OK); 100 ARGP_HELP_USAGE | ARGP_HELP_EXIT_OK);
101 break; 101 break;
102 102
103 case OPT_PROGNAME: /* Set the program name. */ 103 case OPT_PROGNAME: /* Set the program name. */
...@@ -109,11 +109,7 @@ argp_default_parser (int key, char *arg, struct argp_state *state) ...@@ -109,11 +109,7 @@ argp_default_parser (int key, char *arg, struct argp_state *state)
109 to be that, so we have to be a bit careful here.] */ 109 to be that, so we have to be a bit careful here.] */
110 110
111 /* Update what we use for messages. */ 111 /* Update what we use for messages. */
112 state->name = strrchr (arg, '/'); 112 state->name = __argp_base_name (arg);
113 if (state->name)
114 state->name++;
115 else
116 state->name = arg;
117 113
118 #if defined _LIBC || HAVE_DECL_PROGRAM_INVOCATION_SHORT_NAME 114 #if defined _LIBC || HAVE_DECL_PROGRAM_INVOCATION_SHORT_NAME
119 program_invocation_short_name = state->name; 115 program_invocation_short_name = state->name;
...@@ -562,10 +558,7 @@ parser_init (struct parser *parser, const struct argp *argp, ...@@ -562,10 +558,7 @@ parser_init (struct parser *parser, const struct argp *argp,
562 558
563 if (parser->state.argv == argv && argv[0]) 559 if (parser->state.argv == argv && argv[0])
564 /* There's an argv[0]; use it for messages. */ 560 /* There's an argv[0]; use it for messages. */
565 { 561 parser->state.name = __argp_base_name (argv[0]);
566 char *short_name = strrchr (argv[0], '/');
567 parser->state.name = short_name ? short_name + 1 : argv[0];
568 }
569 else 562 else
570 parser->state.name = __argp_short_program_name (); 563 parser->state.name = __argp_short_program_name ();
571 564
......
1 /* Hierarchial argument parsing, layered over getopt. 1 /* Hierarchial argument parsing, layered over getopt.
2 Copyright (C) 1995-1999,2003,2004 Free Software Foundation, Inc. 2 Copyright (C) 1995-1999,2003-2006 Free Software Foundation, Inc.
3 This file is part of the GNU C Library. 3 This file is part of the GNU C Library.
4 Written by Miles Bader <miles@gnu.ai.mit.edu>. 4 Written by Miles Bader <miles@gnu.ai.mit.edu>.
5 5
...@@ -28,10 +28,6 @@ ...@@ -28,10 +28,6 @@
28 #define __need_error_t 28 #define __need_error_t
29 #include <errno.h> 29 #include <errno.h>
30 30
31 #ifndef __const
32 # define __const const
33 #endif
34
35 #ifndef __THROW 31 #ifndef __THROW
36 # define __THROW 32 # define __THROW
37 #endif 33 #endif
...@@ -82,7 +78,7 @@ struct argp_option ...@@ -82,7 +78,7 @@ struct argp_option
82 { 78 {
83 /* The long option name. For more than one name for the same option, you 79 /* The long option name. For more than one name for the same option, you
84 can use following options with the OPTION_ALIAS flag set. */ 80 can use following options with the OPTION_ALIAS flag set. */
85 __const char *name; 81 const char *name;
86 82
87 /* What key is returned for this option. If > 0 and printable, then it's 83 /* What key is returned for this option. If > 0 and printable, then it's
88 also accepted as a short option. */ 84 also accepted as a short option. */
...@@ -90,7 +86,7 @@ struct argp_option ...@@ -90,7 +86,7 @@ struct argp_option
90 86
91 /* If non-NULL, this is the name of the argument associated with this 87 /* If non-NULL, this is the name of the argument associated with this
92 option, which is required unless the OPTION_ARG_OPTIONAL flag is set. */ 88 option, which is required unless the OPTION_ARG_OPTIONAL flag is set. */
93 __const char *arg; 89 const char *arg;
94 90
95 /* OPTION_ flags. */ 91 /* OPTION_ flags. */
96 int flags; 92 int flags;
...@@ -99,7 +95,7 @@ struct argp_option ...@@ -99,7 +95,7 @@ struct argp_option
99 will be printed outdented from the normal option column, making it 95 will be printed outdented from the normal option column, making it
100 useful as a group header (it will be the first thing printed in its 96 useful as a group header (it will be the first thing printed in its
101 group); in this usage, it's conventional to end the string with a `:'. */ 97 group); in this usage, it's conventional to end the string with a `:'. */
102 __const char *doc; 98 const char *doc;
103 99
104 /* The group this option is in. In a long help message, options are sorted 100 /* The group this option is in. In a long help message, options are sorted
105 alphabetically within each group, and the groups presented in the order 101 alphabetically within each group, and the groups presented in the order
...@@ -227,7 +223,7 @@ struct argp ...@@ -227,7 +223,7 @@ struct argp
227 { 223 {
228 /* An array of argp_option structures, terminated by an entry with both 224 /* An array of argp_option structures, terminated by an entry with both
229 NAME and KEY having a value of 0. */ 225 NAME and KEY having a value of 0. */
230 __const struct argp_option *options; 226 const struct argp_option *options;
231 227
232 /* What to do with an option from this structure. KEY is the key 228 /* What to do with an option from this structure. KEY is the key
233 associated with the option, and ARG is any associated argument (NULL if 229 associated with the option, and ARG is any associated argument (NULL if
...@@ -243,12 +239,12 @@ struct argp ...@@ -243,12 +239,12 @@ struct argp
243 contains newlines, the strings separated by them are considered 239 contains newlines, the strings separated by them are considered
244 alternative usage patterns, and printed on separate lines (lines after 240 alternative usage patterns, and printed on separate lines (lines after
245 the first are prefix by ` or: ' instead of `Usage:'). */ 241 the first are prefix by ` or: ' instead of `Usage:'). */
246 __const char *args_doc; 242 const char *args_doc;
247 243
248 /* If non-NULL, a string containing extra text to be printed before and 244 /* If non-NULL, a string containing extra text to be printed before and
249 after the options in a long help message (separated by a vertical tab 245 after the options in a long help message (separated by a vertical tab
250 `\v' character). */ 246 `\v' character). */
251 __const char *doc; 247 const char *doc;
252 248
253 /* A vector of argp_children structures, terminated by a member with a 0 249 /* A vector of argp_children structures, terminated by a member with a 0
254 argp field, pointing to child argps should be parsed with this one. Any 250 argp field, pointing to child argps should be parsed with this one. Any
...@@ -256,7 +252,7 @@ struct argp ...@@ -256,7 +252,7 @@ struct argp
256 CHILDREN list. This field is useful if you use libraries that supply 252 CHILDREN list. This field is useful if you use libraries that supply
257 their own argp structure, which you want to use in conjunction with your 253 their own argp structure, which you want to use in conjunction with your
258 own. */ 254 own. */
259 __const struct argp_child *children; 255 const struct argp_child *children;
260 256
261 /* If non-zero, this should be a function to filter the output of help 257 /* If non-zero, this should be a function to filter the output of help
262 messages. KEY is either a key from an option, in which case TEXT is 258 messages. KEY is either a key from an option, in which case TEXT is
...@@ -268,7 +264,7 @@ struct argp ...@@ -268,7 +264,7 @@ struct argp
268 has been done, so if any of the replacement text also needs translation, 264 has been done, so if any of the replacement text also needs translation,
269 that should be done by the filter function. INPUT is either the input 265 that should be done by the filter function. INPUT is either the input
270 supplied to argp_parse, or NULL, if argp_help was called directly. */ 266 supplied to argp_parse, or NULL, if argp_help was called directly. */
271 char *(*help_filter) (int __key, __const char *__text, void *__input); 267 char *(*help_filter) (int __key, const char *__text, void *__input);
272 268
273 /* If non-zero the strings used in the argp library are translated using 269 /* If non-zero the strings used in the argp library are translated using
274 the domain described by this string. Otherwise the currently installed 270 the domain described by this string. Otherwise the currently installed
...@@ -292,7 +288,7 @@ struct argp ...@@ -292,7 +288,7 @@ struct argp
292 struct argp_child 288 struct argp_child
293 { 289 {
294 /* The child parser. */ 290 /* The child parser. */
295 __const struct argp *argp; 291 const struct argp *argp;
296 292
297 /* Flags for this child. */ 293 /* Flags for this child. */
298 int flags; 294 int flags;
...@@ -301,7 +297,7 @@ struct argp_child ...@@ -301,7 +297,7 @@ struct argp_child
301 child options. As a side-effect, a non-zero value forces the child 297 child options. As a side-effect, a non-zero value forces the child
302 options to be grouped together; to achieve this effect without actually 298 options to be grouped together; to achieve this effect without actually
303 printing a header string, use a value of "". */ 299 printing a header string, use a value of "". */
304 __const char *header; 300 const char *header;
305 301
306 /* Where to group the child options relative to the other (`consolidated') 302 /* Where to group the child options relative to the other (`consolidated')
307 options in the parent argp; the values are the same as the GROUP field 303 options in the parent argp; the values are the same as the GROUP field
...@@ -317,7 +313,7 @@ struct argp_child ...@@ -317,7 +313,7 @@ struct argp_child
317 struct argp_state 313 struct argp_state
318 { 314 {
319 /* The top level ARGP being parsed. */ 315 /* The top level ARGP being parsed. */
320 __const struct argp *root_argp; 316 const struct argp *root_argp;
321 317
322 /* The argument vector being parsed. May be modified. */ 318 /* The argument vector being parsed. May be modified. */
323 int argc; 319 int argc;
...@@ -411,11 +407,11 @@ struct argp_state ...@@ -411,11 +407,11 @@ struct argp_state
411 routine returned a non-zero value, it is returned; otherwise 0 is 407 routine returned a non-zero value, it is returned; otherwise 0 is
412 returned. This function may also call exit unless the ARGP_NO_HELP flag 408 returned. This function may also call exit unless the ARGP_NO_HELP flag
413 is set. INPUT is a pointer to a value to be passed in to the parser. */ 409 is set. INPUT is a pointer to a value to be passed in to the parser. */
414 extern error_t argp_parse (__const struct argp *__restrict __argp, 410 extern error_t argp_parse (const struct argp *__restrict __argp,
415 int __argc, char **__restrict __argv, 411 int __argc, char **__restrict __argv,
416 unsigned __flags, int *__restrict __arg_index, 412 unsigned __flags, int *__restrict __arg_index,
417 void *__restrict __input); 413 void *__restrict __input);
418 extern error_t __argp_parse (__const struct argp *__restrict __argp, 414 extern error_t __argp_parse (const struct argp *__restrict __argp,
419 int __argc, char **__restrict __argv, 415 int __argc, char **__restrict __argv,
420 unsigned __flags, int *__restrict __arg_index, 416 unsigned __flags, int *__restrict __arg_index,
421 void *__restrict __input); 417 void *__restrict __input);
...@@ -426,7 +422,7 @@ extern error_t __argp_parse (__const struct argp *__restrict __argp, ...@@ -426,7 +422,7 @@ extern error_t __argp_parse (__const struct argp *__restrict __argp,
426 option --version is added (unless the ARGP_NO_HELP flag is used), which 422 option --version is added (unless the ARGP_NO_HELP flag is used), which
427 will print this string followed by a newline and exit (unless the 423 will print this string followed by a newline and exit (unless the
428 ARGP_NO_EXIT flag is used). Overridden by ARGP_PROGRAM_VERSION_HOOK. */ 424 ARGP_NO_EXIT flag is used). Overridden by ARGP_PROGRAM_VERSION_HOOK. */
429 extern __const char *argp_program_version; 425 extern const char *argp_program_version;
430 426
431 /* If defined or set by the user program to a non-zero value, then a default 427 /* If defined or set by the user program to a non-zero value, then a default
432 option --version is added (unless the ARGP_NO_HELP flag is used), which 428 option --version is added (unless the ARGP_NO_HELP flag is used), which
...@@ -442,7 +438,7 @@ extern void (*argp_program_version_hook) (FILE *__restrict __stream, ...@@ -442,7 +438,7 @@ extern void (*argp_program_version_hook) (FILE *__restrict __stream,
442 argp_help if the ARGP_HELP_BUG_ADDR flag is set (as it is by various 438 argp_help if the ARGP_HELP_BUG_ADDR flag is set (as it is by various
443 standard help messages), embedded in a sentence that says something like 439 standard help messages), embedded in a sentence that says something like
444 `Report bugs to ADDR.'. */ 440 `Report bugs to ADDR.'. */
445 extern __const char *argp_program_bug_address; 441 extern const char *argp_program_bug_address;
446 442
447 /* The exit status that argp will use when exiting due to a parsing error. 443 /* The exit status that argp will use when exiting due to a parsing error.
448 If not defined or set by the user program, this defaults to EX_USAGE from 444 If not defined or set by the user program, this defaults to EX_USAGE from
...@@ -480,10 +476,10 @@ extern error_t argp_err_exit_status; ...@@ -480,10 +476,10 @@ extern error_t argp_err_exit_status;
480 476
481 /* Output a usage message for ARGP to STREAM. FLAGS are from the set 477 /* Output a usage message for ARGP to STREAM. FLAGS are from the set
482 ARGP_HELP_*. */ 478 ARGP_HELP_*. */
483 extern void argp_help (__const struct argp *__restrict __argp, 479 extern void argp_help (const struct argp *__restrict __argp,
484 FILE *__restrict __stream, 480 FILE *__restrict __stream,
485 unsigned __flags, char *__restrict __name); 481 unsigned __flags, char *__restrict __name);
486 extern void __argp_help (__const struct argp *__restrict __argp, 482 extern void __argp_help (const struct argp *__restrict __argp,
487 FILE *__restrict __stream, unsigned __flags, 483 FILE *__restrict __stream, unsigned __flags,
488 char *__name); 484 char *__name);
489 485
...@@ -497,25 +493,25 @@ extern void __argp_help (__const struct argp *__restrict __argp, ...@@ -497,25 +493,25 @@ extern void __argp_help (__const struct argp *__restrict __argp,
497 493
498 /* Output, if appropriate, a usage message for STATE to STREAM. FLAGS are 494 /* Output, if appropriate, a usage message for STATE to STREAM. FLAGS are
499 from the set ARGP_HELP_*. */ 495 from the set ARGP_HELP_*. */
500 extern void argp_state_help (__const struct argp_state *__restrict __state, 496 extern void argp_state_help (const struct argp_state *__restrict __state,
501 FILE *__restrict __stream, 497 FILE *__restrict __stream,
502 unsigned int __flags); 498 unsigned int __flags);
503 extern void __argp_state_help (__const struct argp_state *__restrict __state, 499 extern void __argp_state_help (const struct argp_state *__restrict __state,
504 FILE *__restrict __stream, 500 FILE *__restrict __stream,
505 unsigned int __flags); 501 unsigned int __flags);
506 502
507 /* Possibly output the standard usage message for ARGP to stderr and exit. */ 503 /* Possibly output the standard usage message for ARGP to stderr and exit. */
508 extern void argp_usage (__const struct argp_state *__state); 504 extern void argp_usage (const struct argp_state *__state);
509 extern void __argp_usage (__const struct argp_state *__state); 505 extern void __argp_usage (const struct argp_state *__state);
510 506
511 /* If appropriate, print the printf string FMT and following args, preceded 507 /* If appropriate, print the printf string FMT and following args, preceded
512 by the program name and `:', to stderr, and followed by a `Try ... --help' 508 by the program name and `:', to stderr, and followed by a `Try ... --help'
513 message, then exit (1). */ 509 message, then exit (1). */
514 extern void argp_error (__const struct argp_state *__restrict __state, 510 extern void argp_error (const struct argp_state *__restrict __state,
515 __const char *__restrict __fmt, ...) 511 const char *__restrict __fmt, ...)
516 __attribute__ ((__format__ (__printf__, 2, 3))); 512 __attribute__ ((__format__ (__printf__, 2, 3)));
517 extern void __argp_error (__const struct argp_state *__restrict __state, 513 extern void __argp_error (const struct argp_state *__restrict __state,
518 __const char *__restrict __fmt, ...) 514 const char *__restrict __fmt, ...)
519 __attribute__ ((__format__ (__printf__, 2, 3))); 515 __attribute__ ((__format__ (__printf__, 2, 3)));
520 516
521 /* Similar to the standard gnu error-reporting function error(), but will 517 /* Similar to the standard gnu error-reporting function error(), but will
...@@ -526,31 +522,31 @@ extern void __argp_error (__const struct argp_state *__restrict __state, ...@@ -526,31 +522,31 @@ extern void __argp_error (__const struct argp_state *__restrict __state,
526 difference between this function and argp_error is that the latter is for 522 difference between this function and argp_error is that the latter is for
527 *parsing errors*, and the former is for other problems that occur during 523 *parsing errors*, and the former is for other problems that occur during
528 parsing but don't reflect a (syntactic) problem with the input. */ 524 parsing but don't reflect a (syntactic) problem with the input. */
529 extern void argp_failure (__const struct argp_state *__restrict __state, 525 extern void argp_failure (const struct argp_state *__restrict __state,
530 int __status, int __errnum, 526 int __status, int __errnum,
531 __const char *__restrict __fmt, ...) 527 const char *__restrict __fmt, ...)
532 __attribute__ ((__format__ (__printf__, 4, 5))); 528 __attribute__ ((__format__ (__printf__, 4, 5)));
533 extern void __argp_failure (__const struct argp_state *__restrict __state, 529 extern void __argp_failure (const struct argp_state *__restrict __state,
534 int __status, int __errnum, 530 int __status, int __errnum,
535 __const char *__restrict __fmt, ...) 531 const char *__restrict __fmt, ...)
536 __attribute__ ((__format__ (__printf__, 4, 5))); 532 __attribute__ ((__format__ (__printf__, 4, 5)));
537 533
538 /* Returns true if the option OPT is a valid short option. */ 534 /* Returns true if the option OPT is a valid short option. */
539 extern int _option_is_short (__const struct argp_option *__opt) __THROW; 535 extern int _option_is_short (const struct argp_option *__opt) __THROW;
540 extern int __option_is_short (__const struct argp_option *__opt) __THROW; 536 extern int __option_is_short (const struct argp_option *__opt) __THROW;
541 537
542 /* Returns true if the option OPT is in fact the last (unused) entry in an 538 /* Returns true if the option OPT is in fact the last (unused) entry in an
543 options array. */ 539 options array. */
544 extern int _option_is_end (__const struct argp_option *__opt) __THROW; 540 extern int _option_is_end (const struct argp_option *__opt) __THROW;
545 extern int __option_is_end (__const struct argp_option *__opt) __THROW; 541 extern int __option_is_end (const struct argp_option *__opt) __THROW;
546 542
547 /* Return the input field for ARGP in the parser corresponding to STATE; used 543 /* Return the input field for ARGP in the parser corresponding to STATE; used
548 by the help routines. */ 544 by the help routines. */
549 extern void *_argp_input (__const struct argp *__restrict __argp, 545 extern void *_argp_input (const struct argp *__restrict __argp,
550 __const struct argp_state *__restrict __state) 546 const struct argp_state *__restrict __state)
551 __THROW; 547 __THROW;
552 extern void *__argp_input (__const struct argp *__restrict __argp, 548 extern void *__argp_input (const struct argp *__restrict __argp,
553 __const struct argp_state *__restrict __state) 549 const struct argp_state *__restrict __state)
554 __THROW; 550 __THROW;
555 551
556 #ifdef __USE_EXTERN_INLINES 552 #ifdef __USE_EXTERN_INLINES
...@@ -567,13 +563,13 @@ extern void *__argp_input (__const struct argp *__restrict __argp, ...@@ -567,13 +563,13 @@ extern void *__argp_input (__const struct argp *__restrict __argp,
567 # endif 563 # endif
568 564
569 ARGP_EI void 565 ARGP_EI void
570 __NTH (__argp_usage (__const struct argp_state *__state)) 566 __NTH (__argp_usage (const struct argp_state *__state))
571 { 567 {
572 __argp_state_help (__state, stderr, ARGP_HELP_STD_USAGE); 568 __argp_state_help (__state, stderr, ARGP_HELP_STD_USAGE);
573 } 569 }
574 570
575 ARGP_EI int 571 ARGP_EI int
576 __NTH (__option_is_short (__const struct argp_option *__opt)) 572 __NTH (__option_is_short (const struct argp_option *__opt))
577 { 573 {
578 if (__opt->flags & OPTION_DOC) 574 if (__opt->flags & OPTION_DOC)
579 return 0; 575 return 0;
...@@ -585,7 +581,7 @@ __NTH (__option_is_short (__const struct argp_option *__opt)) ...@@ -585,7 +581,7 @@ __NTH (__option_is_short (__const struct argp_option *__opt))
585 } 581 }
586 582
587 ARGP_EI int 583 ARGP_EI int
588 __NTH (__option_is_end (__const struct argp_option *__opt)) 584 __NTH (__option_is_end (const struct argp_option *__opt))
589 { 585 {
590 return !__opt->key && !__opt->name && !__opt->doc && !__opt->group; 586 return !__opt->key && !__opt->name && !__opt->doc && !__opt->group;
591 } 587 }
......
1 /* Copyright (C) 1991,92,95-98,2000,2001,2004 Free Software Foundation, Inc. 1 /* Copyright (C) 1991,92,95-98,2000,2001,2004-2006 Free Software Foundation, Inc.
2 This file is part of the GNU C Library. 2 This file is part of the GNU C Library.
3 3
4 The GNU C Library is free software; you can redistribute it and/or 4 The GNU C Library is free software; you can redistribute it and/or
...@@ -104,13 +104,13 @@ typedef struct ...@@ -104,13 +104,13 @@ typedef struct
104 #else 104 #else
105 void *(*gl_readdir) (void *); 105 void *(*gl_readdir) (void *);
106 #endif 106 #endif
107 void *(*gl_opendir) (__const char *); 107 void *(*gl_opendir) (const char *);
108 #ifdef __USE_GNU 108 #ifdef __USE_GNU
109 int (*gl_lstat) (__const char *__restrict, struct stat *__restrict); 109 int (*gl_lstat) (const char *__restrict, struct stat *__restrict);
110 int (*gl_stat) (__const char *__restrict, struct stat *__restrict); 110 int (*gl_stat) (const char *__restrict, struct stat *__restrict);
111 #else 111 #else
112 int (*gl_lstat) (__const char *__restrict, void *__restrict); 112 int (*gl_lstat) (const char *__restrict, void *__restrict);
113 int (*gl_stat) (__const char *__restrict, void *__restrict); 113 int (*gl_stat) (const char *__restrict, void *__restrict);
114 #endif 114 #endif
115 } glob_t; 115 } glob_t;
116 116
...@@ -133,13 +133,13 @@ typedef struct ...@@ -133,13 +133,13 @@ typedef struct
133 # else 133 # else
134 void *(*gl_readdir) (void *); 134 void *(*gl_readdir) (void *);
135 # endif 135 # endif
136 void *(*gl_opendir) (__const char *); 136 void *(*gl_opendir) (const char *);
137 # ifdef __USE_GNU 137 # ifdef __USE_GNU
138 int (*gl_lstat) (__const char *__restrict, struct stat64 *__restrict); 138 int (*gl_lstat) (const char *__restrict, struct stat64 *__restrict);
139 int (*gl_stat) (__const char *__restrict, struct stat64 *__restrict); 139 int (*gl_stat) (const char *__restrict, struct stat64 *__restrict);
140 # else 140 # else
141 int (*gl_lstat) (__const char *__restrict, void *__restrict); 141 int (*gl_lstat) (const char *__restrict, void *__restrict);
142 int (*gl_stat) (__const char *__restrict, void *__restrict); 142 int (*gl_stat) (const char *__restrict, void *__restrict);
143 # endif 143 # endif
144 } glob64_t; 144 } glob64_t;
145 #endif 145 #endif
...@@ -158,24 +158,24 @@ typedef struct ...@@ -158,24 +158,24 @@ typedef struct
158 If memory cannot be allocated for PGLOB, GLOB_NOSPACE is returned. 158 If memory cannot be allocated for PGLOB, GLOB_NOSPACE is returned.
159 Otherwise, `glob' returns zero. */ 159 Otherwise, `glob' returns zero. */
160 #if !defined __USE_FILE_OFFSET64 || __GNUC__ < 2 || defined __GLOB_GNULIB 160 #if !defined __USE_FILE_OFFSET64 || __GNUC__ < 2 || defined __GLOB_GNULIB
161 extern int glob (__const char *__restrict __pattern, int __flags, 161 extern int glob (const char *__restrict __pattern, int __flags,
162 int (*__errfunc) (__const char *, int), 162 int (*__errfunc) (const char *, int),
163 glob_t *__restrict __pglob) __THROW; 163 glob_t *__restrict __pglob) __THROW;
164 164
165 /* Free storage allocated in PGLOB by a previous `glob' call. */ 165 /* Free storage allocated in PGLOB by a previous `glob' call. */
166 extern void globfree (glob_t *__pglob) __THROW; 166 extern void globfree (glob_t *__pglob) __THROW;
167 #else 167 #else
168 extern int __REDIRECT_NTH (glob, (__const char *__restrict __pattern, 168 extern int __REDIRECT_NTH (glob, (const char *__restrict __pattern,
169 int __flags, 169 int __flags,
170 int (*__errfunc) (__const char *, int), 170 int (*__errfunc) (const char *, int),
171 glob_t *__restrict __pglob), glob64); 171 glob_t *__restrict __pglob), glob64);
172 172
173 extern void __REDIRECT_NTH (globfree, (glob_t *__pglob), globfree64); 173 extern void __REDIRECT_NTH (globfree, (glob_t *__pglob), globfree64);
174 #endif 174 #endif
175 175
176 #if defined __USE_LARGEFILE64 && !defined __GLOB_GNULIB 176 #if defined __USE_LARGEFILE64 && !defined __GLOB_GNULIB
177 extern int glob64 (__const char *__restrict __pattern, int __flags, 177 extern int glob64 (const char *__restrict __pattern, int __flags,
178 int (*__errfunc) (__const char *, int), 178 int (*__errfunc) (const char *, int),
179 glob64_t *__restrict __pglob) __THROW; 179 glob64_t *__restrict __pglob) __THROW;
180 180
181 extern void globfree64 (glob64_t *__pglob) __THROW; 181 extern void globfree64 (glob64_t *__pglob) __THROW;
...@@ -188,7 +188,7 @@ extern void globfree64 (glob64_t *__pglob) __THROW; ...@@ -188,7 +188,7 @@ extern void globfree64 (glob64_t *__pglob) __THROW;
188 188
189 This function is not part of the interface specified by POSIX.2 189 This function is not part of the interface specified by POSIX.2
190 but several programs want to use it. */ 190 but several programs want to use it. */
191 extern int glob_pattern_p (__const char *__pattern, int __quote) __THROW; 191 extern int glob_pattern_p (const char *__pattern, int __quote) __THROW;
192 #endif 192 #endif
193 193
194 __END_DECLS 194 __END_DECLS
......
1 /* glob_.h -- Find a path matching a pattern. 1 /* glob_.h -- Find a path matching a pattern.
2 2
3 Copyright (C) 2005 Free Software Foundation, Inc. 3 Copyright (C) 2005, 2006 Free Software Foundation, Inc.
4 4
5 Written by Derek Price <derek@ximbiot.com> & Paul Eggert <eggert@CS.UCLA.EDU> 5 Written by Derek Price <derek@ximbiot.com> & Paul Eggert <eggert@CS.UCLA.EDU>
6 6
...@@ -38,9 +38,6 @@ ...@@ -38,9 +38,6 @@
38 #ifndef __size_t 38 #ifndef __size_t
39 # define __size_t size_t 39 # define __size_t size_t
40 #endif 40 #endif
41 #ifndef __const
42 # define __const const
43 #endif
44 #ifndef __restrict 41 #ifndef __restrict
45 # define __restrict restrict 42 # define __restrict restrict
46 #endif 43 #endif
......
1 /* Functions to compute MD5 message digest of files or memory blocks. 1 /* Functions to compute MD5 message digest of files or memory blocks.
2 according to the definition of MD5 in RFC 1321 from April 1992. 2 according to the definition of MD5 in RFC 1321 from April 1992.
3 Copyright (C) 1995,1996,1997,1999,2000,2001,2005 3 Copyright (C) 1995,1996,1997,1999,2000,2001,2005,2006
4 Free Software Foundation, Inc. 4 Free Software Foundation, Inc.
5 This file is part of the GNU C Library. 5 This file is part of the GNU C Library.
6 6
...@@ -86,7 +86,7 @@ md5_init_ctx (struct md5_ctx *ctx) ...@@ -86,7 +86,7 @@ md5_init_ctx (struct md5_ctx *ctx)
86 must be in little endian byte order. 86 must be in little endian byte order.
87 87
88 IMPORTANT: On some systems it is required that RESBUF is correctly 88 IMPORTANT: On some systems it is required that RESBUF is correctly
89 aligned for a 32 bits value. */ 89 aligned for a 32-bit value. */
90 void * 90 void *
91 md5_read_ctx (const struct md5_ctx *ctx, void *resbuf) 91 md5_read_ctx (const struct md5_ctx *ctx, void *resbuf)
92 { 92 {
...@@ -102,7 +102,7 @@ md5_read_ctx (const struct md5_ctx *ctx, void *resbuf) ...@@ -102,7 +102,7 @@ md5_read_ctx (const struct md5_ctx *ctx, void *resbuf)
102 prolog according to the standard and write the result to RESBUF. 102 prolog according to the standard and write the result to RESBUF.
103 103
104 IMPORTANT: On some systems it is required that RESBUF is correctly 104 IMPORTANT: On some systems it is required that RESBUF is correctly
105 aligned for a 32 bits value. */ 105 aligned for a 32-bit value. */
106 void * 106 void *
107 md5_finish_ctx (struct md5_ctx *ctx, void *resbuf) 107 md5_finish_ctx (struct md5_ctx *ctx, void *resbuf)
108 { 108 {
...@@ -245,14 +245,8 @@ md5_process_bytes (const void *buffer, size_t len, struct md5_ctx *ctx) ...@@ -245,14 +245,8 @@ md5_process_bytes (const void *buffer, size_t len, struct md5_ctx *ctx)
245 if (len >= 64) 245 if (len >= 64)
246 { 246 {
247 #if !_STRING_ARCH_unaligned 247 #if !_STRING_ARCH_unaligned
248 /* To check alignment gcc has an appropriate operator. Other 248 # define alignof(type) offsetof (struct { char c; type x; }, x)
249 compilers don't. */ 249 # define UNALIGNED_P(p) (((size_t) p) % alignof (uint32_t) != 0)
250 # if __GNUC__ >= 2
251 # define UNALIGNED_P(p) (((uintptr_t) p) % __alignof__ (uint32_t) != 0)
252 # else
253 # define alignof(type) offsetof (struct { char c; type x; }, x)
254 # define UNALIGNED_P(p) (((size_t) p) % alignof (uint32_t) != 0)
255 # endif
256 if (UNALIGNED_P (buffer)) 250 if (UNALIGNED_P (buffer))
257 while (len > 64) 251 while (len > 64)
258 { 252 {
...@@ -382,7 +376,7 @@ md5_process_block (const void *buffer, size_t len, struct md5_ctx *ctx) ...@@ -382,7 +376,7 @@ md5_process_block (const void *buffer, size_t len, struct md5_ctx *ctx)
382 argument specifying the function to use. */ 376 argument specifying the function to use. */
383 #undef OP 377 #undef OP
384 #define OP(f, a, b, c, d, k, s, T) \ 378 #define OP(f, a, b, c, d, k, s, T) \
385 do \ 379 do \
386 { \ 380 { \
387 a += f (b, c, d) + correct_words[k] + T; \ 381 a += f (b, c, d) + correct_words[k] + T; \
388 CYCLIC (a, s); \ 382 CYCLIC (a, s); \
......
1 /* Declaration of functions and data types used for MD5 sum computing 1 /* Declaration of functions and data types used for MD5 sum computing
2 library functions. 2 library functions.
3 Copyright (C) 1995-1997,1999,2000,2001,2004,2005 3 Copyright (C) 1995-1997,1999,2000,2001,2004,2005,2006
4 Free Software Foundation, Inc. 4 Free Software Foundation, Inc.
5 This file is part of the GNU C Library. 5 This file is part of the GNU C Library.
6 6
...@@ -44,12 +44,6 @@ ...@@ -44,12 +44,6 @@
44 # endif 44 # endif
45 #endif 45 #endif
46 46
47 #ifndef __attribute__
48 # if ! __GNUC_PREREQ (2,8) || __STRICT_ANSI__
49 # define __attribute__(x)
50 # endif
51 #endif
52
53 #ifndef _LIBC 47 #ifndef _LIBC
54 # define __md5_buffer md5_buffer 48 # define __md5_buffer md5_buffer
55 # define __md5_finish_ctx md5_finish_ctx 49 # define __md5_finish_ctx md5_finish_ctx
......
1 /* Extended regular expression matching and search library. 1 /* Extended regular expression matching and search library.
2 Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc. 2 Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
3 This file is part of the GNU C Library. 3 This file is part of the GNU C Library.
4 Contributed by Isamu Hasegawa <isamu@yamato.ibm.com>. 4 Contributed by Isamu Hasegawa <isamu@yamato.ibm.com>.
5 5
...@@ -182,6 +182,10 @@ typedef unsigned long int bitset_word; ...@@ -182,6 +182,10 @@ typedef unsigned long int bitset_word;
182 # if BITSET_WORD_BITS <= SBC_MAX 182 # if BITSET_WORD_BITS <= SBC_MAX
183 # error "Invalid SBC_MAX" 183 # error "Invalid SBC_MAX"
184 # endif 184 # endif
185 #elif BITSET_WORD_MAX == (0xffffffff + 2) * 0xffffffff
186 /* Work around a bug in 64-bit PGC (before version 6.1-2), where the
187 preprocessor mishandles large unsigned values as if they were signed. */
188 # define BITSET_WORD_BITS 64
185 #else 189 #else
186 # error "Add case for new bitset_word size" 190 # error "Add case for new bitset_word size"
187 #endif 191 #endif
......
1 /* Copyright (C) 2001-2002, 2004-2005 Free Software Foundation, Inc. 1 /* Copyright (C) 2001-2002, 2004-2006 Free Software Foundation, Inc.
2 Written by Bruno Haible, Sam Steingold, Peter Burwood. 2 Written by Bruno Haible, Sam Steingold, Peter Burwood.
3 This file is part of gnulib. 3 This file is part of gnulib.
4 4
...@@ -33,6 +33,12 @@ ...@@ -33,6 +33,12 @@
33 #if defined(__FreeBSD__) 33 #if defined(__FreeBSD__)
34 # include <sys/inttypes.h> 34 # include <sys/inttypes.h>
35 #endif 35 #endif
36 #if defined(__linux__) && HAVE_SYS_BITYPES_H
37 /* Linux libc4 >= 4.6.7 and libc5 have a <sys/bitypes.h> that defines
38 int{8,16,32,64}_t and __BIT_TYPES_DEFINED__. In libc5 >= 5.2.2 it is
39 included by <sys/types.h>. */
40 # include <sys/bitypes.h>
41 #endif
36 #if defined(__sun) && HAVE_SYS_INTTYPES_H 42 #if defined(__sun) && HAVE_SYS_INTTYPES_H
37 # include <sys/inttypes.h> 43 # include <sys/inttypes.h>
38 /* Solaris 7 <sys/inttypes.h> has the types except the *_fast*_t types, and 44 /* Solaris 7 <sys/inttypes.h> has the types except the *_fast*_t types, and
...@@ -48,7 +54,7 @@ ...@@ -48,7 +54,7 @@
48 UINTPTR_MAX, PTRDIFF_MIN, PTRDIFF_MAX. */ 54 UINTPTR_MAX, PTRDIFF_MIN, PTRDIFF_MAX. */
49 # define _STDINT_H_HAVE_SYSTEM_INTTYPES 55 # define _STDINT_H_HAVE_SYSTEM_INTTYPES
50 #endif 56 #endif
51 #if !(defined(UNIX_CYGWIN32) && defined(__BIT_TYPES_DEFINED__)) 57 #if !((defined(UNIX_CYGWIN32) || defined(__linux__)) && defined(__BIT_TYPES_DEFINED__))
52 # define _STDINT_H_NEED_SIGNED_INT_TYPES 58 # define _STDINT_H_NEED_SIGNED_INT_TYPES
53 #endif 59 #endif
54 60
...@@ -133,11 +139,19 @@ typedef unsigned long uintptr_t; ...@@ -133,11 +139,19 @@ typedef unsigned long uintptr_t;
133 /* 7.18.1.5. Greatest-width integer types */ 139 /* 7.18.1.5. Greatest-width integer types */
134 140
135 #ifdef _STDINT_H_HAVE_INT64 141 #ifdef _STDINT_H_HAVE_INT64
142 # ifndef intmax_t
136 typedef int64_t intmax_t; 143 typedef int64_t intmax_t;
144 # endif
145 # ifndef uintmax_t
137 typedef uint64_t uintmax_t; 146 typedef uint64_t uintmax_t;
147 # endif
138 #else 148 #else
149 # ifndef intmax_t
139 typedef int32_t intmax_t; 150 typedef int32_t intmax_t;
151 # endif
152 # ifndef uintmax_t
140 typedef uint32_t uintmax_t; 153 typedef uint32_t uintmax_t;
154 # endif
141 #endif 155 #endif
142 156
143 /* 7.18.2. Limits of specified-width integer types */ 157 /* 7.18.2. Limits of specified-width integer types */
...@@ -230,8 +244,8 @@ typedef uint32_t uintmax_t; ...@@ -230,8 +244,8 @@ typedef uint32_t uintmax_t;
230 #define SIG_ATOMIC_MIN 0 244 #define SIG_ATOMIC_MIN 0
231 #define SIG_ATOMIC_MAX 127 245 #define SIG_ATOMIC_MAX 127
232 246
233 #ifndef SIZE_MAX 247 #ifndef SIZE_MAX /* SIZE_MAX may also be defined in config.h. */
234 # define SIZE_MAX (~(size_t)0) 248 # define SIZE_MAX ((size_t)~(size_t)0)
235 #endif 249 #endif
236 250
237 /* wchar_t limits already defined in <stddef.h>. */ 251 /* wchar_t limits already defined in <stddef.h>. */
......
1 /* exit() exit codes for some BSD system programs. 1 /* exit() exit codes for some BSD system programs.
2 Copyright (C) 2003 Free Software Foundation, Inc. 2 Copyright (C) 2003, 2006 Free Software Foundation, Inc.
3 3
4 This program is free software; you can redistribute it and/or modify 4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by 5 it under the terms of the GNU General Public License as published by
...@@ -20,6 +20,8 @@ ...@@ -20,6 +20,8 @@
20 #ifndef _SYSEXITS_H 20 #ifndef _SYSEXITS_H
21 #define _SYSEXITS_H 21 #define _SYSEXITS_H
22 22
23 #define EX_OK 0 /* same value as EXIT_SUCCESS */
24
23 #define EX_USAGE 64 25 #define EX_USAGE 64
24 #define EX_DATAERR 65 26 #define EX_DATAERR 65
25 #define EX_NOINPUT 66 27 #define EX_NOINPUT 66
......