Updated by gnulib-sync
Showing
109 changed files
with
1297 additions
and
795 deletions
... | @@ -23,8 +23,7 @@ INCLUDES = -I${top_srcdir}/include -I${top_srcdir}/mailbox -I${top_builddir}/inc | ... | @@ -23,8 +23,7 @@ INCLUDES = -I${top_srcdir}/include -I${top_srcdir}/mailbox -I${top_builddir}/inc |
23 | libmuaux_la_SOURCES = \ | 23 | libmuaux_la_SOURCES = \ |
24 | daemon.c\ | 24 | daemon.c\ |
25 | mailcap.c\ | 25 | mailcap.c\ |
26 | mu_dbm.c\ | 26 | mu_dbm.c |
27 | xalloc_die.c | ||
28 | 27 | ||
29 | EXTRA_DIST = utmp.c | 28 | EXTRA_DIST = utmp.c |
30 | 29 | ||
... | @@ -45,33 +44,19 @@ EXTRA_DIST += allocsa.valgrind | ... | @@ -45,33 +44,19 @@ EXTRA_DIST += allocsa.valgrind |
45 | 44 | ||
46 | libmuaux_la_SOURCES += exit.h | 45 | libmuaux_la_SOURCES += exit.h |
47 | 46 | ||
48 | libmuaux_la_SOURCES += exitfail.h exitfail.c | ||
49 | 47 | ||
50 | BUILT_SOURCES += $(STDBOOL_H) | ||
51 | EXTRA_DIST += stdbool_.h | ||
52 | 48 | ||
53 | # We need the following in order to create an <stdbool.h> when the system | ||
54 | # doesn't have one that works. | ||
55 | all-local $(libmuaux_la_OBJECTS): $(STDBOOL_H) | ||
56 | stdbool.h: stdbool_.h | ||
57 | sed -e 's/@''HAVE__BOOL''@/$(HAVE__BOOL)/g' < $(srcdir)/stdbool_.h > $@-t | ||
58 | mv $@-t $@ | ||
59 | MOSTLYCLEANFILES += stdbool.h stdbool.h-t | ||
60 | |||
61 | libmuaux_la_SOURCES += xalloc.h xmalloc.c | ||
62 | 49 | ||
63 | BUILT_SOURCES += $(FNMATCH_H) | 50 | BUILT_SOURCES += $(FNMATCH_H) |
64 | EXTRA_DIST += fnmatch_.h fnmatch_loop.c | 51 | EXTRA_DIST += fnmatch_.h fnmatch_loop.c |
65 | 52 | ||
66 | # We need the following in order to create an <fnmatch.h> when the system | 53 | # We need the following in order to create <fnmatch.h> when the system |
67 | # doesn't have one that supports the required API. | 54 | # doesn't have one that supports the required API. |
68 | all-local $(libmuaux_la_OBJECTS): $(FNMATCH_H) | ||
69 | fnmatch.h: fnmatch_.h | 55 | fnmatch.h: fnmatch_.h |
70 | cp $(srcdir)/fnmatch_.h $@-t | 56 | cp $(srcdir)/fnmatch_.h $@-t |
71 | mv $@-t $@ | 57 | mv $@-t $@ |
72 | MOSTLYCLEANFILES += fnmatch.h fnmatch.h-t | 58 | MOSTLYCLEANFILES += fnmatch.h fnmatch.h-t |
73 | 59 | ||
74 | libmuaux_la_SOURCES += getpass.h | ||
75 | 60 | ||
76 | 61 | ||
77 | libmuaux_la_SOURCES += mbswidth.h mbswidth.c | 62 | libmuaux_la_SOURCES += mbswidth.h mbswidth.c |
... | @@ -82,9 +67,10 @@ libmuaux_la_SOURCES += setenv.h | ... | @@ -82,9 +67,10 @@ libmuaux_la_SOURCES += setenv.h |
82 | 67 | ||
83 | libmuaux_la_SOURCES += snprintf.h | 68 | libmuaux_la_SOURCES += snprintf.h |
84 | 69 | ||
85 | libmuaux_la_SOURCES += xstrtol.h xstrtol.c xstrtoul.c | ||
86 | 70 | ||
87 | libmuaux_la_SOURCES += vasprintf.h | 71 | libmuaux_la_SOURCES += vasprintf.h |
88 | 72 | ||
73 | libmuaux_la_SOURCES += xalloc-die.c | ||
74 | |||
89 | libmuaux_la_SOURCES += xsize.h | 75 | libmuaux_la_SOURCES += xsize.h |
90 | 76 | ... | ... |
... | @@ -25,8 +25,20 @@ | ... | @@ -25,8 +25,20 @@ |
25 | # include <config.h> | 25 | # include <config.h> |
26 | #endif | 26 | #endif |
27 | 27 | ||
28 | #include <alloca.h> | ||
29 | |||
30 | #include <string.h> | ||
31 | #include <stdlib.h> | ||
32 | |||
28 | #ifdef emacs | 33 | #ifdef emacs |
34 | # include "lisp.h" | ||
29 | # include "blockinput.h" | 35 | # include "blockinput.h" |
36 | # ifdef EMACS_FREE | ||
37 | # undef free | ||
38 | # define free EMACS_FREE | ||
39 | # endif | ||
40 | #else | ||
41 | # define memory_full() abort () | ||
30 | #endif | 42 | #endif |
31 | 43 | ||
32 | /* If compiling with GCC 2, this file's not needed. */ | 44 | /* If compiling with GCC 2, this file's not needed. */ |
... | @@ -46,6 +58,8 @@ | ... | @@ -46,6 +58,8 @@ |
46 | you | 58 | you |
47 | lose | 59 | lose |
48 | -- must know STACK_DIRECTION at compile-time | 60 | -- must know STACK_DIRECTION at compile-time |
61 | /* Using #error here is not wise since this file should work for | ||
62 | old and obscure compilers. */ | ||
49 | # endif /* STACK_DIRECTION undefined */ | 63 | # endif /* STACK_DIRECTION undefined */ |
50 | # endif /* static */ | 64 | # endif /* static */ |
51 | # endif /* emacs */ | 65 | # endif /* emacs */ |
... | @@ -60,31 +74,6 @@ long i00afunc (); | ... | @@ -60,31 +74,6 @@ long i00afunc (); |
60 | # define ADDRESS_FUNCTION(arg) &(arg) | 74 | # define ADDRESS_FUNCTION(arg) &(arg) |
61 | # endif | 75 | # endif |
62 | 76 | ||
63 | # if __STDC__ | ||
64 | typedef void *pointer; | ||
65 | # else | ||
66 | typedef char *pointer; | ||
67 | # endif | ||
68 | |||
69 | # ifndef NULL | ||
70 | # define NULL 0 | ||
71 | # endif | ||
72 | |||
73 | /* Different portions of Emacs need to call different versions of | ||
74 | malloc. The Emacs executable needs alloca to call xmalloc, because | ||
75 | ordinary malloc isn't protected from input signals. On the other | ||
76 | hand, the utilities in lib-src need alloca to call malloc; some of | ||
77 | them are very simple, and don't have an xmalloc routine. | ||
78 | |||
79 | Non-Emacs programs expect this to call xmalloc. | ||
80 | |||
81 | Callers below should use malloc. */ | ||
82 | |||
83 | # ifndef emacs | ||
84 | # define malloc xmalloc | ||
85 | # endif | ||
86 | extern pointer malloc (); | ||
87 | |||
88 | /* Define STACK_DIRECTION if you know the direction of stack | 77 | /* Define STACK_DIRECTION if you know the direction of stack |
89 | growth for your system; otherwise it will be automatically | 78 | growth for your system; otherwise it will be automatically |
90 | deduced at run-time. | 79 | deduced at run-time. |
... | @@ -107,7 +96,7 @@ static int stack_dir; /* 1 or -1 once known. */ | ... | @@ -107,7 +96,7 @@ static int stack_dir; /* 1 or -1 once known. */ |
107 | # define STACK_DIR stack_dir | 96 | # define STACK_DIR stack_dir |
108 | 97 | ||
109 | static void | 98 | static void |
110 | find_stack_direction () | 99 | find_stack_direction (void) |
111 | { | 100 | { |
112 | static char *addr = NULL; /* Address of first `dummy', once known. */ | 101 | static char *addr = NULL; /* Address of first `dummy', once known. */ |
113 | auto char dummy; /* To get stack address. */ | 102 | auto char dummy; /* To get stack address. */ |
... | @@ -160,9 +149,8 @@ static header *last_alloca_header = NULL; /* -> last alloca header. */ | ... | @@ -160,9 +149,8 @@ static header *last_alloca_header = NULL; /* -> last alloca header. */ |
160 | caller, but that method cannot be made to work for some | 149 | caller, but that method cannot be made to work for some |
161 | implementations of C, for example under Gould's UTX/32. */ | 150 | implementations of C, for example under Gould's UTX/32. */ |
162 | 151 | ||
163 | pointer | 152 | void * |
164 | alloca (size) | 153 | alloca (size_t size) |
165 | unsigned size; | ||
166 | { | 154 | { |
167 | auto char probe; /* Probes stack depth: */ | 155 | auto char probe; /* Probes stack depth: */ |
168 | register char *depth = ADDRESS_FUNCTION (probe); | 156 | register char *depth = ADDRESS_FUNCTION (probe); |
... | @@ -188,7 +176,7 @@ alloca (size) | ... | @@ -188,7 +176,7 @@ alloca (size) |
188 | { | 176 | { |
189 | register header *np = hp->h.next; | 177 | register header *np = hp->h.next; |
190 | 178 | ||
191 | free ((pointer) hp); /* Collect garbage. */ | 179 | free (hp); /* Collect garbage. */ |
192 | 180 | ||
193 | hp = np; /* -> next header. */ | 181 | hp = np; /* -> next header. */ |
194 | } | 182 | } |
... | @@ -208,17 +196,26 @@ alloca (size) | ... | @@ -208,17 +196,26 @@ alloca (size) |
208 | /* Allocate combined header + user data storage. */ | 196 | /* Allocate combined header + user data storage. */ |
209 | 197 | ||
210 | { | 198 | { |
211 | register pointer new = malloc (sizeof (header) + size); | ||
212 | /* Address of header. */ | 199 | /* Address of header. */ |
200 | register header *new; | ||
201 | |||
202 | size_t combined_size = sizeof (header) + size; | ||
203 | if (combined_size < sizeof (header)) | ||
204 | memory_full (); | ||
205 | |||
206 | new = malloc (combined_size); | ||
207 | |||
208 | if (! new) | ||
209 | memory_full (); | ||
213 | 210 | ||
214 | ((header *) new)->h.next = last_alloca_header; | 211 | new->h.next = last_alloca_header; |
215 | ((header *) new)->h.deep = depth; | 212 | new->h.deep = depth; |
216 | 213 | ||
217 | last_alloca_header = (header *) new; | 214 | last_alloca_header = new; |
218 | 215 | ||
219 | /* User storage begins just after header. */ | 216 | /* User storage begins just after header. */ |
220 | 217 | ||
221 | return (pointer) ((char *) new + sizeof (header)); | 218 | return (void *) (new + 1); |
222 | } | 219 | } |
223 | } | 220 | } |
224 | 221 | ... | ... |
... | @@ -12,10 +12,9 @@ | ... | @@ -12,10 +12,9 @@ |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public | 15 | You should have received a copy of the GNU General Public License |
16 | License along with this program; if not, write to the Free | 16 | along with this program; if not, write to the Free Software Foundation, |
17 | Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 17 | Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ |
18 | Boston, MA 02110-1301 USA. */ | ||
19 | 18 | ||
20 | #ifdef HAVE_CONFIG_H | 19 | #ifdef HAVE_CONFIG_H |
21 | # include <config.h> | 20 | # include <config.h> | ... | ... |
... | @@ -12,10 +12,9 @@ | ... | @@ -12,10 +12,9 @@ |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public | 15 | You should have received a copy of the GNU General Public License |
16 | License along with this program; if not, write to the Free | 16 | along with this program; if not, write to the Free Software Foundation, |
17 | Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 17 | Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ |
18 | Boston, MA 02110-1301 USA. */ | ||
19 | 18 | ||
20 | #ifndef _ALLOCSA_H | 19 | #ifndef _ALLOCSA_H |
21 | #define _ALLOCSA_H | 20 | #define _ALLOCSA_H | ... | ... |
... | @@ -11,10 +11,9 @@ | ... | @@ -11,10 +11,9 @@ |
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 | GNU General Public License for more details. | 12 | GNU General Public License for more details. |
13 | 13 | ||
14 | You should have received a copy of the GNU General Public | 14 | You should have received a copy of the GNU General Public License along |
15 | License along with this program; if not, write to the Free | 15 | with this program; if not, write to the Free Software Foundation, |
16 | Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 16 | Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ |
17 | Boston, MA 02110-1301 USA. */ | ||
18 | 17 | ||
19 | #ifdef HAVE_CONFIG_H | 18 | #ifdef HAVE_CONFIG_H |
20 | # include <config.h> | 19 | # include <config.h> | ... | ... |
... | @@ -12,10 +12,9 @@ | ... | @@ -12,10 +12,9 @@ |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public | 15 | You should have received a copy of the GNU General Public License along |
16 | License along with this program; if not, write to the Free | 16 | with this program; if not, write to the Free Software Foundation, |
17 | Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 17 | Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ |
18 | Boston, MA 02110-1301 USA. */ | ||
19 | 18 | ||
20 | /* Written by David MacKenzie <djm@gnu.ai.mit.edu>. */ | 19 | /* Written by David MacKenzie <djm@gnu.ai.mit.edu>. */ |
21 | 20 | ... | ... |
... | @@ -12,10 +12,9 @@ | ... | @@ -12,10 +12,9 @@ |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public | 15 | You should have received a copy of the GNU General Public License along |
16 | License along with this program; if not, write to the Free | 16 | with this program; if not, write to the Free Software Foundation, |
17 | Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 17 | Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ |
18 | Boston, MA 02110-1301 USA. */ | ||
19 | 18 | ||
20 | #ifndef _ERROR_H | 19 | #ifndef _ERROR_H |
21 | #define _ERROR_H 1 | 20 | #define _ERROR_H 1 | ... | ... |
... | @@ -11,10 +11,9 @@ | ... | @@ -11,10 +11,9 @@ |
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 | GNU General Public License for more details. | 12 | GNU General Public License for more details. |
13 | 13 | ||
14 | You should have received a copy of the GNU General Public | 14 | You should have received a copy of the GNU General Public License |
15 | License along with this program; if not, write to the Free | 15 | along with this program; if not, write to the Free Software Foundation, |
16 | Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 16 | Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ |
17 | Boston, MA 02110-1301 USA. */ | ||
18 | 17 | ||
19 | #ifndef _EXIT_H | 18 | #ifndef _EXIT_H |
20 | #define _EXIT_H | 19 | #define _EXIT_H | ... | ... |
... | @@ -13,9 +13,9 @@ | ... | @@ -13,9 +13,9 @@ |
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; see the file COPYING. If not, write to | 16 | along with this program; see the file COPYING. |
17 | the Free Software Foundation, 51 Franklin Street, Fifth Floor, | 17 | If not, write to the Free Software Foundation, |
18 | Boston, MA 02110-1301 USA. */ | 18 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ |
19 | 19 | ||
20 | #if HAVE_CONFIG_H | 20 | #if HAVE_CONFIG_H |
21 | # include <config.h> | 21 | # include <config.h> | ... | ... |
... | @@ -13,8 +13,8 @@ | ... | @@ -13,8 +13,8 @@ |
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; see the file COPYING. If not, write to | 16 | along with this program; see the file COPYING. |
17 | the Free Software Foundation, 51 Franklin Street, Fifth Floor, | 17 | If not, write to the Free Software Foundation, |
18 | Boston, MA 02110-1301 USA. */ | 18 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ |
19 | 19 | ||
20 | extern int volatile exit_failure; | 20 | extern int volatile exit_failure; | ... | ... |
1 | /* Copyright (C) 1991,1992,1993,1996,1997,1998,1999,2000,2001,2002,2003,2004 | 1 | /* Copyright (C) 1991,1992,1993,1996,1997,1998,1999,2000,2001,2002,2003,2004,2005 |
2 | Free Software Foundation, Inc. | 2 | 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 |
... | @@ -13,7 +13,7 @@ | ... | @@ -13,7 +13,7 @@ |
13 | 13 | ||
14 | You should have received a copy of the GNU General Public License | 14 | You should have received a copy of the GNU General Public License |
15 | along with this program; if not, write to the Free Software Foundation, | 15 | along with this program; if not, write to the Free Software Foundation, |
16 | Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ | 16 | Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ |
17 | 17 | ||
18 | #if HAVE_CONFIG_H | 18 | #if HAVE_CONFIG_H |
19 | # include <config.h> | 19 | # include <config.h> |
... | @@ -319,54 +319,51 @@ fnmatch (const char *pattern, const char *string, int flags) | ... | @@ -319,54 +319,51 @@ fnmatch (const char *pattern, const char *string, int flags) |
319 | wide characters. */ | 319 | wide characters. */ |
320 | memset (&ps, '\0', sizeof (ps)); | 320 | memset (&ps, '\0', sizeof (ps)); |
321 | patsize = mbsrtowcs (NULL, &pattern, 0, &ps) + 1; | 321 | patsize = mbsrtowcs (NULL, &pattern, 0, &ps) + 1; |
322 | if (__builtin_expect (patsize == 0, 0)) | 322 | if (__builtin_expect (patsize != 0, 1)) |
323 | /* Something wrong. | ||
324 | XXX Do we have to set `errno' to something which mbsrtows hasn't | ||
325 | already done? */ | ||
326 | return -1; | ||
327 | assert (mbsinit (&ps)); | ||
328 | strsize = mbsrtowcs (NULL, &string, 0, &ps) + 1; | ||
329 | if (__builtin_expect (strsize == 0, 0)) | ||
330 | /* Something wrong. | ||
331 | XXX Do we have to set `errno' to something which mbsrtows hasn't | ||
332 | already done? */ | ||
333 | return -1; | ||
334 | assert (mbsinit (&ps)); | ||
335 | totsize = patsize + strsize; | ||
336 | if (__builtin_expect (! (patsize <= totsize | ||
337 | && totsize <= SIZE_MAX / sizeof (wchar_t)), | ||
338 | 0)) | ||
339 | { | 323 | { |
340 | errno = ENOMEM; | 324 | assert (mbsinit (&ps)); |
341 | return -1; | 325 | strsize = mbsrtowcs (NULL, &string, 0, &ps) + 1; |
342 | } | 326 | if (__builtin_expect (strsize != 0, 1)) |
343 | |||
344 | /* Allocate room for the wide characters. */ | ||
345 | if (__builtin_expect (totsize < ALLOCA_LIMIT, 1)) | ||
346 | wpattern = (wchar_t *) alloca (totsize * sizeof (wchar_t)); | ||
347 | else | ||
348 | { | ||
349 | wpattern = malloc (totsize * sizeof (wchar_t)); | ||
350 | if (__builtin_expect (! wpattern, 0)) | ||
351 | { | 327 | { |
352 | errno = ENOMEM; | 328 | assert (mbsinit (&ps)); |
353 | return -1; | 329 | totsize = patsize + strsize; |
330 | if (__builtin_expect (! (patsize <= totsize | ||
331 | && totsize <= SIZE_MAX / sizeof (wchar_t)), | ||
332 | 0)) | ||
333 | { | ||
334 | errno = ENOMEM; | ||
335 | return -1; | ||
336 | } | ||
337 | |||
338 | /* Allocate room for the wide characters. */ | ||
339 | if (__builtin_expect (totsize < ALLOCA_LIMIT, 1)) | ||
340 | wpattern = (wchar_t *) alloca (totsize * sizeof (wchar_t)); | ||
341 | else | ||
342 | { | ||
343 | wpattern = malloc (totsize * sizeof (wchar_t)); | ||
344 | if (__builtin_expect (! wpattern, 0)) | ||
345 | { | ||
346 | errno = ENOMEM; | ||
347 | return -1; | ||
348 | } | ||
349 | } | ||
350 | wstring = wpattern + patsize; | ||
351 | |||
352 | /* Convert the strings into wide characters. */ | ||
353 | mbsrtowcs (wpattern, &pattern, patsize, &ps); | ||
354 | assert (mbsinit (&ps)); | ||
355 | mbsrtowcs (wstring, &string, strsize, &ps); | ||
356 | |||
357 | res = internal_fnwmatch (wpattern, wstring, wstring + strsize - 1, | ||
358 | flags & FNM_PERIOD, flags); | ||
359 | |||
360 | if (__builtin_expect (! (totsize < ALLOCA_LIMIT), 0)) | ||
361 | free (wpattern); | ||
362 | return res; | ||
354 | } | 363 | } |
355 | } | 364 | } |
356 | wstring = wpattern + patsize; | ||
357 | |||
358 | /* Convert the strings into wide characters. */ | ||
359 | mbsrtowcs (wpattern, &pattern, patsize, &ps); | ||
360 | assert (mbsinit (&ps)); | ||
361 | mbsrtowcs (wstring, &string, strsize, &ps); | ||
362 | |||
363 | res = internal_fnwmatch (wpattern, wstring, wstring + strsize - 1, | ||
364 | flags & FNM_PERIOD, flags); | ||
365 | |||
366 | if (__builtin_expect (! (totsize < ALLOCA_LIMIT), 0)) | ||
367 | free (wpattern); | ||
368 | return res; | ||
369 | } | 365 | } |
366 | |||
370 | # endif /* HANDLE_MULTIBYTE */ | 367 | # endif /* HANDLE_MULTIBYTE */ |
371 | 368 | ||
372 | return internal_fnmatch (pattern, string, string + strlen (string), | 369 | return internal_fnmatch (pattern, string, string + strlen (string), | ... | ... |
1 | /* Copyright (C) 1991, 1992, 1993, 1996, 1997, 1998, 1999, 2001, 2002, 2003 | 1 | /* Copyright (C) 1991, 1992, 1993, 1996, 1997, 1998, 1999, 2001, 2002, 2003, |
2 | Free Software Foundation, Inc. | 2 | 2005 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 |
... | @@ -11,10 +11,9 @@ | ... | @@ -11,10 +11,9 @@ |
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 | GNU General Public License for more details. | 12 | GNU General Public License for more details. |
13 | 13 | ||
14 | You should have received a copy of the GNU General Public | 14 | You should have received a copy of the GNU General Public License |
15 | License along with this program; if not, write to the Free | 15 | along with this program; if not, write to the Free Software Foundation, |
16 | Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 16 | Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ |
17 | Boston, MA 02110-1301 USA. */ | ||
18 | 17 | ||
19 | #ifndef _FNMATCH_H | 18 | #ifndef _FNMATCH_H |
20 | # define _FNMATCH_H 1 | 19 | # define _FNMATCH_H 1 |
... | @@ -52,7 +51,7 @@ extern "C" { | ... | @@ -52,7 +51,7 @@ extern "C" { |
52 | # define FNM_NOSYS (-1) | 51 | # define FNM_NOSYS (-1) |
53 | # endif | 52 | # endif |
54 | 53 | ||
55 | /* Match NAME against the filename pattern PATTERN, | 54 | /* Match NAME against the file name pattern PATTERN, |
56 | returning zero if it matches, FNM_NOMATCH if not. */ | 55 | returning zero if it matches, FNM_NOMATCH if not. */ |
57 | extern int fnmatch (const char *__pattern, const char *__name, | 56 | extern int fnmatch (const char *__pattern, const char *__name, |
58 | int __flags); | 57 | int __flags); | ... | ... |
1 | /* Copyright (C) 1991,1992,1993,1996,1997,1998,1999,2000,2001,2002,2003,2004 | 1 | /* Copyright (C) 1991,1992,1993,1996,1997,1998,1999,2000,2001,2002,2003,2004,2005 |
2 | Free Software Foundation, Inc. | 2 | 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 |
... | @@ -11,12 +11,11 @@ | ... | @@ -11,12 +11,11 @@ |
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 | GNU General Public License for more details. | 12 | GNU General Public License for more details. |
13 | 13 | ||
14 | You should have received a copy of the GNU General Public | 14 | You should have received a copy of the GNU General Public License |
15 | License along with this program; if not, write to the Free | 15 | along with this program; if not, write to the Free Software Foundation, |
16 | Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 16 | Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ |
17 | Boston, MA 02110-1301 USA. */ | ||
18 | 17 | ||
19 | /* Match STRING against the filename pattern PATTERN, returning zero if | 18 | /* Match STRING against the file name pattern PATTERN, returning zero if |
20 | it matches, nonzero if not. */ | 19 | it matches, nonzero if not. */ |
21 | static int EXT (INT opt, const CHAR *pattern, const CHAR *string, | 20 | static int EXT (INT opt, const CHAR *pattern, const CHAR *string, |
22 | const CHAR *string_end, bool no_leading_period, int flags) | 21 | const CHAR *string_end, bool no_leading_period, int flags) | ... | ... |
... | @@ -11,10 +11,9 @@ | ... | @@ -11,10 +11,9 @@ |
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 | GNU General Public License for more details. | 12 | GNU General Public License for more details. |
13 | 13 | ||
14 | You should have received a copy of the GNU General Public | 14 | You should have received a copy of the GNU General Public License along |
15 | License along with this program; if not, write to the Free | 15 | with this program; if not, write to the Free Software Foundation, |
16 | Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 16 | Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ |
17 | Boston, MA 02110-1301 USA. */ | ||
18 | 17 | ||
19 | #if HAVE_CONFIG_H | 18 | #if HAVE_CONFIG_H |
20 | # include <config.h> | 19 | # include <config.h> | ... | ... |
... | @@ -12,21 +12,20 @@ | ... | @@ -12,21 +12,20 @@ |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public | 15 | You should have received a copy of the GNU General Public License |
16 | License along with this program; if not, write to the Free | 16 | along with this program; if not, write to the Free Software Foundation, |
17 | Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 17 | Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ |
18 | Boston, MA 02110-1301 USA. */ | ||
19 | 18 | ||
20 | #ifndef GETPASS_H | 19 | #ifndef GETPASS_H |
21 | #define GETPASS_H | 20 | # define GETPASS_H |
22 | 21 | ||
23 | /* Get getpass declaration, if available. */ | 22 | /* Get getpass declaration, if available. */ |
24 | #include <unistd.h> | 23 | # include <unistd.h> |
25 | 24 | ||
26 | #if defined HAVE_DECL_GETPASS && !HAVE_DECL_GETPASS | 25 | # if defined HAVE_DECL_GETPASS && !HAVE_DECL_GETPASS |
27 | /* Read a password of arbitrary length from /dev/tty or stdin. */ | 26 | /* Read a password of arbitrary length from /dev/tty or stdin. */ |
28 | char *getpass (const char *prompt); | 27 | char *getpass (const char *prompt); |
29 | 28 | ||
30 | #endif | 29 | # endif |
31 | 30 | ||
32 | #endif /* GETPASS_H */ | 31 | #endif /* GETPASS_H */ | ... | ... |
... | @@ -11,10 +11,9 @@ | ... | @@ -11,10 +11,9 @@ |
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 | GNU General Public License for more details. | 12 | GNU General Public License for more details. |
13 | 13 | ||
14 | You should have received a copy of the GNU General Public | 14 | You should have received a copy of the GNU General Public License |
15 | License along with this program; if not, write to the Free | 15 | along with this program; if not, write to the Free Software Foundation, |
16 | Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 16 | Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ |
17 | Boston, MA 02110-1301 USA. */ | ||
18 | 17 | ||
19 | /* written by Jim Meyering */ | 18 | /* written by Jim Meyering */ |
20 | 19 | ... | ... |
1 | /* Determine the number of screen columns needed for a string. | 1 | /* Determine the number of screen columns needed for a string. |
2 | Copyright (C) 2000-2004 Free Software Foundation, Inc. | 2 | Copyright (C) 2000-2005 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 |
... | @@ -11,10 +11,9 @@ | ... | @@ -11,10 +11,9 @@ |
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 | GNU General Public License for more details. | 12 | GNU General Public License for more details. |
13 | 13 | ||
14 | You should have received a copy of the GNU General Public | 14 | You should have received a copy of the GNU General Public License |
15 | License along with this program; if not, write to the Free | 15 | along with this program; if not, write to the Free Software Foundation, |
16 | Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 16 | Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ |
17 | Boston, MA 02110-1301 USA. */ | ||
18 | 17 | ||
19 | /* Written by Bruno Haible <haible@clisp.cons.org>. */ | 18 | /* Written by Bruno Haible <haible@clisp.cons.org>. */ |
20 | 19 | ||
... | @@ -92,7 +91,8 @@ int wcwidth (); | ... | @@ -92,7 +91,8 @@ int wcwidth (); |
92 | character string pointed to by STRING. If a non-printable character | 91 | character string pointed to by STRING. If a non-printable character |
93 | occurs, and MBSW_REJECT_UNPRINTABLE is specified, -1 is returned. | 92 | occurs, and MBSW_REJECT_UNPRINTABLE is specified, -1 is returned. |
94 | With flags = MBSW_REJECT_INVALID | MBSW_REJECT_UNPRINTABLE, this is | 93 | With flags = MBSW_REJECT_INVALID | MBSW_REJECT_UNPRINTABLE, this is |
95 | the multibyte analogue of the wcswidth function. */ | 94 | the multibyte analogue of the wcswidth function. |
95 | If STRING is not of length < INT_MAX / 2, integer overflow can occur. */ | ||
96 | int | 96 | int |
97 | mbswidth (const char *string, int flags) | 97 | mbswidth (const char *string, int flags) |
98 | { | 98 | { |
... | @@ -102,7 +102,8 @@ mbswidth (const char *string, int flags) | ... | @@ -102,7 +102,8 @@ mbswidth (const char *string, int flags) |
102 | /* Returns the number of columns needed to represent the multibyte | 102 | /* Returns the number of columns needed to represent the multibyte |
103 | character string pointed to by STRING of length NBYTES. If a | 103 | character string pointed to by STRING of length NBYTES. If a |
104 | non-printable character occurs, and MBSW_REJECT_UNPRINTABLE is | 104 | non-printable character occurs, and MBSW_REJECT_UNPRINTABLE is |
105 | specified, -1 is returned. */ | 105 | specified, -1 is returned. |
106 | If NBYTES is not < INT_MAX / 2, integer overflow can occur. */ | ||
106 | int | 107 | int |
107 | mbsnwidth (const char *string, size_t nbytes, int flags) | 108 | mbsnwidth (const char *string, size_t nbytes, int flags) |
108 | { | 109 | { | ... | ... |
... | @@ -11,10 +11,9 @@ | ... | @@ -11,10 +11,9 @@ |
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 | GNU General Public License for more details. | 12 | GNU General Public License for more details. |
13 | 13 | ||
14 | You should have received a copy of the GNU General Public | 14 | You should have received a copy of the GNU General Public License |
15 | License along with this program; if not, write to the Free | 15 | along with this program; if not, write to the Free Software Foundation, |
16 | Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 16 | Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ |
17 | Boston, MA 02110-1301 USA. */ | ||
18 | 17 | ||
19 | #include <stddef.h> | 18 | #include <stddef.h> |
20 | 19 | ... | ... |
... | @@ -14,10 +14,9 @@ | ... | @@ -14,10 +14,9 @@ |
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
15 | GNU General Public License for more details. | 15 | GNU General Public License for more details. |
16 | 16 | ||
17 | You should have received a copy of the GNU General Public | 17 | You should have received a copy of the GNU General Public License along |
18 | License along with this program; if not, write to the Free | 18 | with this program; if not, write to the Free Software Foundation, |
19 | Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 19 | Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ |
20 | Boston, MA 02110-1301 USA. */ | ||
21 | 20 | ||
22 | #ifdef HAVE_CONFIG_H | 21 | #ifdef HAVE_CONFIG_H |
23 | # include <config.h> | 22 | # include <config.h> | ... | ... |
... | @@ -17,10 +17,9 @@ | ... | @@ -17,10 +17,9 @@ |
17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
18 | GNU General Public License for more details. | 18 | GNU General Public License for more details. |
19 | 19 | ||
20 | You should have received a copy of the GNU General Public | 20 | You should have received a copy of the GNU General Public License along |
21 | License along with this program; if not, write to the Free | 21 | with this program; if not, write to the Free Software Foundation, |
22 | Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 22 | Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ |
23 | Boston, MA 02110-1301 USA. */ | ||
24 | 23 | ||
25 | /* Summary: | 24 | /* Summary: |
26 | 25 | ... | ... |
... | @@ -11,10 +11,9 @@ | ... | @@ -11,10 +11,9 @@ |
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 | GNU General Public License for more details. | 12 | GNU General Public License for more details. |
13 | 13 | ||
14 | You should have received a copy of the GNU General Public | 14 | You should have received a copy of the GNU General Public License |
15 | License along with this program; if not, write to the Free | 15 | along with this program; if not, write to the Free Software Foundation, |
16 | Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 16 | Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ |
17 | Boston, MA 02110-1301 USA. */ | ||
18 | 17 | ||
19 | /* written by Jim Meyering */ | 18 | /* written by Jim Meyering */ |
20 | 19 | ... | ... |
1 | /* Copyright (C) 1992,1995-1999,2000-2004 Free Software Foundation, Inc. | 1 | /* Copyright (C) 1992,1995-1999,2000-2003 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 | 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 |
... | @@ -11,10 +11,9 @@ | ... | @@ -11,10 +11,9 @@ |
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 | GNU General Public License for more details. | 12 | GNU General Public License for more details. |
13 | 13 | ||
14 | You should have received a copy of the GNU General Public | 14 | You should have received a copy of the GNU General Public License along |
15 | License along with this program; if not, write to the Free | 15 | with this program; if not, write to the Free Software Foundation, |
16 | Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 16 | Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ |
17 | Boston, MA 02110-1301 USA. */ | ||
18 | 17 | ||
19 | #if HAVE_CONFIG_H | 18 | #if HAVE_CONFIG_H |
20 | # include <config.h> | 19 | # include <config.h> | ... | ... |
... | @@ -11,10 +11,9 @@ | ... | @@ -11,10 +11,9 @@ |
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 | GNU General Public License for more details. | 12 | GNU General Public License for more details. |
13 | 13 | ||
14 | You should have received a copy of the GNU General Public | 14 | You should have received a copy of the GNU General Public License |
15 | License along with this program; if not, write to the Free | 15 | along with this program; if not, write to the Free Software Foundation, |
16 | Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 16 | Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ |
17 | Boston, MA 02110-1301 USA. */ | ||
18 | 17 | ||
19 | #if HAVE_SETENV || HAVE_UNSETENV | 18 | #if HAVE_SETENV || HAVE_UNSETENV |
20 | 19 | ... | ... |
... | @@ -12,10 +12,9 @@ | ... | @@ -12,10 +12,9 @@ |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public | 15 | You should have received a copy of the GNU General Public License along |
16 | License along with this program; if not, write to the Free | 16 | with this program; if not, write to the Free Software Foundation, |
17 | Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 17 | Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ |
18 | Boston, MA 02110-1301 USA. */ | ||
19 | 18 | ||
20 | #ifdef HAVE_CONFIG_H | 19 | #ifdef HAVE_CONFIG_H |
21 | # include <config.h> | 20 | # include <config.h> | ... | ... |
... | @@ -12,10 +12,9 @@ | ... | @@ -12,10 +12,9 @@ |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public | 15 | You should have received a copy of the GNU General Public License along |
16 | License along with this program; if not, write to the Free | 16 | with this program; if not, write to the Free Software Foundation, |
17 | Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 17 | Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ |
18 | Boston, MA 02110-1301 USA. */ | ||
19 | 18 | ||
20 | #ifndef SNPRINTF_H | 19 | #ifndef SNPRINTF_H |
21 | #define SNPRINTF_H | 20 | #define SNPRINTF_H | ... | ... |
1 | /* strcasecmp.c -- case insensitive string comparator | 1 | /* Case-insensitive string comparison function. |
2 | Copyright (C) 1998, 1999 Free Software Foundation, Inc. | 2 | Copyright (C) 1998, 1999, 2005 Free Software Foundation, Inc. |
3 | Written by Bruno Haible <bruno@clisp.org>, 2005, | ||
4 | based on earlier glibc code. | ||
3 | 5 | ||
4 | This program is free software; you can redistribute it and/or modify | 6 | 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 | 7 | it under the terms of the GNU General Public License as published by |
... | @@ -13,54 +15,227 @@ | ... | @@ -13,54 +15,227 @@ |
13 | 15 | ||
14 | You should have received a copy of the GNU General Public License | 16 | You should have received a copy of the GNU General Public License |
15 | along with this program; if not, write to the Free Software Foundation, | 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. */ |
17 | 19 | ||
18 | #if HAVE_CONFIG_H | 20 | #ifdef HAVE_CONFIG_H |
19 | # include <config.h> | 21 | # include <config.h> |
20 | #endif | 22 | #endif |
21 | 23 | ||
22 | #ifdef LENGTH_LIMIT | 24 | /* Specification. */ |
23 | # define STRXCASECMP_FUNCTION strncasecmp | 25 | #include "strcase.h" |
24 | # define STRXCASECMP_DECLARE_N , size_t n | ||
25 | # define LENGTH_LIMIT_EXPR(Expr) Expr | ||
26 | #else | ||
27 | # define STRXCASECMP_FUNCTION strcasecmp | ||
28 | # define STRXCASECMP_DECLARE_N /* empty */ | ||
29 | # define LENGTH_LIMIT_EXPR(Expr) 0 | ||
30 | #endif | ||
31 | 26 | ||
32 | #include <sys/types.h> | ||
33 | #include <ctype.h> | 27 | #include <ctype.h> |
34 | 28 | ||
35 | #define TOLOWER(Ch) (isupper (Ch) ? tolower (Ch) : (Ch)) | 29 | #if HAVE_MBRTOWC |
36 | 30 | ||
37 | /* Compare {{no more than N characters of }}strings S1 and S2, | 31 | #include "strnlen1.h" |
38 | ignoring case, returning less than, equal to or | ||
39 | greater than zero if S1 is lexicographically less | ||
40 | than, equal to or greater than S2. */ | ||
41 | 32 | ||
42 | int | 33 | /* Like mbiter.h, except it doesn't look at the entire string. */ |
43 | STRXCASECMP_FUNCTION (const char *s1, const char *s2 STRXCASECMP_DECLARE_N) | 34 | |
35 | #include "mbchar.h" | ||
36 | |||
37 | #include <assert.h> | ||
38 | #include <stdbool.h> | ||
39 | #include <stdlib.h> | ||
40 | #include <wchar.h> | ||
41 | #include <wctype.h> | ||
42 | |||
43 | struct mbiter_multi | ||
44 | { | ||
45 | bool at_end; /* true if the end of the string has been reached */ | ||
46 | bool in_shift; /* true if next byte may not be interpreted as ASCII */ | ||
47 | mbstate_t state; /* if in_shift: current shift state */ | ||
48 | bool next_done; /* true if mbi_avail has already filled the following */ | ||
49 | struct mbchar cur; /* the current character: | ||
50 | const char *cur.ptr pointer to current character | ||
51 | The following are only valid after mbi_avail. | ||
52 | size_t cur.bytes number of bytes of current character | ||
53 | bool cur.wc_valid true if wc is a valid wide character | ||
54 | wchar_t cur.wc if wc_valid: the current character | ||
55 | */ | ||
56 | }; | ||
57 | |||
58 | static inline void | ||
59 | mbiter_multi_next (struct mbiter_multi *iter) | ||
44 | { | 60 | { |
45 | register const unsigned char *p1 = (const unsigned char *) s1; | 61 | if (iter->next_done) |
46 | register const unsigned char *p2 = (const unsigned char *) s2; | 62 | return; |
47 | unsigned char c1, c2; | 63 | if (iter->in_shift) |
64 | goto with_shift; | ||
65 | /* Handle most ASCII characters quickly, without calling mbrtowc(). */ | ||
66 | if (is_basic (*iter->cur.ptr)) | ||
67 | { | ||
68 | /* These characters are part of the basic character set. ISO C 99 | ||
69 | guarantees that their wide character code is identical to their | ||
70 | char code. */ | ||
71 | iter->cur.bytes = 1; | ||
72 | iter->cur.wc = *iter->cur.ptr; | ||
73 | iter->cur.wc_valid = true; | ||
74 | } | ||
75 | else | ||
76 | { | ||
77 | assert (mbsinit (&iter->state)); | ||
78 | iter->in_shift = true; | ||
79 | with_shift: | ||
80 | iter->cur.bytes = mbrtowc (&iter->cur.wc, iter->cur.ptr, | ||
81 | strnlen1 (iter->cur.ptr, MB_CUR_MAX), | ||
82 | &iter->state); | ||
83 | if (iter->cur.bytes == (size_t) -1) | ||
84 | { | ||
85 | /* An invalid multibyte sequence was encountered. */ | ||
86 | iter->cur.bytes = 1; | ||
87 | iter->cur.wc_valid = false; | ||
88 | /* Whether to set iter->in_shift = false and reset iter->state | ||
89 | or not is not very important; the string is bogus anyway. */ | ||
90 | } | ||
91 | else if (iter->cur.bytes == (size_t) -2) | ||
92 | { | ||
93 | /* An incomplete multibyte character at the end. */ | ||
94 | iter->cur.bytes = strlen (iter->cur.ptr) + 1; | ||
95 | iter->cur.wc_valid = false; | ||
96 | /* Whether to set iter->in_shift = false and reset iter->state | ||
97 | or not is not important; the string end is reached anyway. */ | ||
98 | } | ||
99 | else | ||
100 | { | ||
101 | if (iter->cur.bytes == 0) | ||
102 | { | ||
103 | /* A null wide character was encountered. */ | ||
104 | iter->cur.bytes = 1; | ||
105 | assert (*iter->cur.ptr == '\0'); | ||
106 | assert (iter->cur.wc == 0); | ||
107 | } | ||
108 | iter->cur.wc_valid = true; | ||
109 | |||
110 | /* When in the initial state, we can go back treating ASCII | ||
111 | characters more quickly. */ | ||
112 | if (mbsinit (&iter->state)) | ||
113 | iter->in_shift = false; | ||
114 | } | ||
115 | } | ||
116 | iter->next_done = true; | ||
117 | } | ||
118 | |||
119 | static inline void | ||
120 | mbiter_multi_reloc (struct mbiter_multi *iter, ptrdiff_t ptrdiff) | ||
121 | { | ||
122 | iter->cur.ptr += ptrdiff; | ||
123 | } | ||
48 | 124 | ||
49 | if (p1 == p2 || LENGTH_LIMIT_EXPR (n == 0)) | 125 | /* Iteration macros. */ |
126 | typedef struct mbiter_multi mbi_iterator_t; | ||
127 | #define mbi_init(iter, startptr) \ | ||
128 | ((iter).cur.ptr = (startptr), (iter).at_end = false, \ | ||
129 | (iter).in_shift = false, memset (&(iter).state, '\0', sizeof (mbstate_t)), \ | ||
130 | (iter).next_done = false) | ||
131 | #define mbi_avail(iter) \ | ||
132 | (!(iter).at_end && (mbiter_multi_next (&(iter)), true)) | ||
133 | #define mbi_advance(iter) \ | ||
134 | ((mb_isnul ((iter).cur) ? ((iter).at_end = true) : 0), \ | ||
135 | (iter).cur.ptr += (iter).cur.bytes, (iter).next_done = false) | ||
136 | |||
137 | /* Access to the current character. */ | ||
138 | #define mbi_cur(iter) (iter).cur | ||
139 | #define mbi_cur_ptr(iter) (iter).cur.ptr | ||
140 | |||
141 | #endif | ||
142 | |||
143 | #define TOLOWER(Ch) (isupper (Ch) ? tolower (Ch) : (Ch)) | ||
144 | |||
145 | /* Compare strings S1 and S2, ignoring case, returning less than, equal to or | ||
146 | greater than zero if S1 is lexicographically less than, equal to or greater | ||
147 | than S2. | ||
148 | Note: This function may, in multibyte locales, return 0 for strings of | ||
149 | different lengths! */ | ||
150 | int | ||
151 | strcasecmp (const char *s1, const char *s2) | ||
152 | { | ||
153 | if (s1 == s2) | ||
50 | return 0; | 154 | return 0; |
51 | 155 | ||
52 | do | 156 | /* Be careful not to look at the entire extent of s1 or s2 until needed. |
157 | This is useful because when two strings differ, the difference is | ||
158 | most often already in the very few first characters. */ | ||
159 | #if HAVE_MBRTOWC | ||
160 | if (MB_CUR_MAX > 1) | ||
53 | { | 161 | { |
54 | c1 = TOLOWER (*p1); | 162 | mbi_iterator_t iter1; |
55 | c2 = TOLOWER (*p2); | 163 | mbi_iterator_t iter2; |
56 | 164 | ||
57 | if (LENGTH_LIMIT_EXPR (--n == 0) || c1 == '\0') | 165 | mbi_init (iter1, s1); |
58 | break; | 166 | mbi_init (iter2, s2); |
59 | 167 | ||
60 | ++p1; | 168 | while (mbi_avail (iter1) && mbi_avail (iter2)) |
61 | ++p2; | 169 | { |
170 | /* Sort invalid characters after all valid ones. */ | ||
171 | if (!mbi_cur (iter1).wc_valid) | ||
172 | { | ||
173 | if (!mbi_cur (iter2).wc_valid) | ||
174 | { | ||
175 | /* Compare two invalid characters. */ | ||
176 | int cmp; | ||
177 | |||
178 | if (mbi_cur (iter1).bytes > mbi_cur (iter2).bytes) | ||
179 | return 1; | ||
180 | if (mbi_cur (iter1).bytes < mbi_cur (iter2).bytes) | ||
181 | return -1; | ||
182 | cmp = memcmp (mbi_cur_ptr (iter1), mbi_cur_ptr (iter2), | ||
183 | mbi_cur (iter1).bytes); | ||
184 | if (cmp != 0) | ||
185 | return cmp; | ||
186 | } | ||
187 | else | ||
188 | /* mbi_cur (iter1) invalid, mbi_cur (iter2) valid. */ | ||
189 | return 1; | ||
190 | } | ||
191 | else | ||
192 | { | ||
193 | if (!mbi_cur (iter2).wc_valid) | ||
194 | /* mbi_cur (iter1) valid, mbi_cur (iter2) invalid. */ | ||
195 | return -1; | ||
196 | else | ||
197 | { | ||
198 | /* Compare two valid characters. */ | ||
199 | wchar_t c1 = towlower (mbi_cur (iter1).wc); | ||
200 | wchar_t c2 = towlower (mbi_cur (iter2).wc); | ||
201 | |||
202 | if (c1 > c2) | ||
203 | return 1; | ||
204 | if (c1 < c2) | ||
205 | return -1; | ||
206 | } | ||
207 | } | ||
208 | mbi_advance (iter1); | ||
209 | mbi_advance (iter2); | ||
210 | } | ||
211 | if (mbi_avail (iter1)) | ||
212 | /* s2 terminated before s1. */ | ||
213 | return 1; | ||
214 | if (mbi_avail (iter2)) | ||
215 | /* s1 terminated before s2. */ | ||
216 | return -1; | ||
217 | return 0; | ||
62 | } | 218 | } |
63 | while (c1 == c2); | 219 | else |
220 | #endif | ||
221 | { | ||
222 | const unsigned char *p1 = (const unsigned char *) s1; | ||
223 | const unsigned char *p2 = (const unsigned char *) s2; | ||
224 | unsigned char c1, c2; | ||
64 | 225 | ||
65 | return c1 - c2; | 226 | do |
227 | { | ||
228 | c1 = TOLOWER (*p1); | ||
229 | c2 = TOLOWER (*p2); | ||
230 | |||
231 | if (c1 == '\0') | ||
232 | break; | ||
233 | |||
234 | ++p1; | ||
235 | ++p2; | ||
236 | } | ||
237 | while (c1 == c2); | ||
238 | |||
239 | return c1 - c2; | ||
240 | } | ||
66 | } | 241 | } | ... | ... |
1 | #define LENGTH_LIMIT | 1 | /* strncasecmp.c -- case insensitive string comparator |
2 | #include "strcasecmp.c" | 2 | Copyright (C) 1998, 1999 Free Software Foundation, Inc. |
3 | |||
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 | ||
6 | the Free Software Foundation; either version 2, or (at your option) | ||
7 | any later version. | ||
8 | |||
9 | This program is distributed in the hope that it will be useful, | ||
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | GNU General Public License for more details. | ||
13 | |||
14 | You should have received a copy of the GNU General Public License | ||
15 | along with this program; if not, write to the Free Software Foundation, | ||
16 | Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ | ||
17 | |||
18 | #if HAVE_CONFIG_H | ||
19 | # include <config.h> | ||
20 | #endif | ||
21 | |||
22 | /* Specification. */ | ||
23 | #include "strcase.h" | ||
24 | |||
25 | #include <ctype.h> | ||
26 | |||
27 | #define TOLOWER(Ch) (isupper (Ch) ? tolower (Ch) : (Ch)) | ||
28 | |||
29 | /* Compare no more than N bytes of strings S1 and S2, | ||
30 | ignoring case, returning less than, equal to or | ||
31 | greater than zero if S1 is lexicographically less | ||
32 | than, equal to or greater than S2. */ | ||
33 | |||
34 | int | ||
35 | strncasecmp (const char *s1, const char *s2, size_t n) | ||
36 | { | ||
37 | register const unsigned char *p1 = (const unsigned char *) s1; | ||
38 | register const unsigned char *p2 = (const unsigned char *) s2; | ||
39 | unsigned char c1, c2; | ||
40 | |||
41 | if (p1 == p2 || n == 0) | ||
42 | return 0; | ||
43 | |||
44 | do | ||
45 | { | ||
46 | c1 = TOLOWER (*p1); | ||
47 | c2 = TOLOWER (*p2); | ||
48 | |||
49 | if (--n == 0 || c1 == '\0') | ||
50 | break; | ||
51 | |||
52 | ++p1; | ||
53 | ++p2; | ||
54 | } | ||
55 | while (c1 == c2); | ||
56 | |||
57 | return c1 - c2; | ||
58 | } | ... | ... |
... | @@ -11,10 +11,9 @@ | ... | @@ -11,10 +11,9 @@ |
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 | GNU General Public License for more details. | 12 | GNU General Public License for more details. |
13 | 13 | ||
14 | You should have received a copy of the GNU General Public | 14 | You should have received a copy of the GNU General Public License along |
15 | License along with this program; if not, write to the Free | 15 | with this program; if not, write to the Free Software Foundation, |
16 | Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 16 | Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ |
17 | Boston, MA 02110-1301 USA. */ | ||
18 | 17 | ||
19 | #if HAVE_CONFIG_H | 18 | #if HAVE_CONFIG_H |
20 | # include <config.h> | 19 | # include <config.h> | ... | ... |
1 | /* Formatted output to strings. | 1 | /* Formatted output to strings. |
2 | Copyright (C) 1999, 2002-2004 Free Software Foundation, Inc. | 2 | Copyright (C) 1999, 2002 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 |
... | @@ -11,10 +11,9 @@ | ... | @@ -11,10 +11,9 @@ |
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 | GNU General Public License for more details. | 12 | GNU General Public License for more details. |
13 | 13 | ||
14 | You should have received a copy of the GNU General Public | 14 | You should have received a copy of the GNU General Public License along |
15 | License along with this program; if not, write to the Free | 15 | with this program; if not, write to the Free Software Foundation, |
16 | Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 16 | Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ |
17 | Boston, MA 02110-1301 USA. */ | ||
18 | 17 | ||
19 | #ifdef HAVE_CONFIG_H | 18 | #ifdef HAVE_CONFIG_H |
20 | # include <config.h> | 19 | # include <config.h> | ... | ... |
... | @@ -11,10 +11,9 @@ | ... | @@ -11,10 +11,9 @@ |
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 | GNU General Public License for more details. | 12 | GNU General Public License for more details. |
13 | 13 | ||
14 | You should have received a copy of the GNU General Public | 14 | You should have received a copy of the GNU General Public License along |
15 | License along with this program; if not, write to the Free | 15 | with this program; if not, write to the Free Software Foundation, |
16 | Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 16 | Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ |
17 | Boston, MA 02110-1301 USA. */ | ||
18 | 17 | ||
19 | #ifndef _VASPRINTF_H | 18 | #ifndef _VASPRINTF_H |
20 | #define _VASPRINTF_H | 19 | #define _VASPRINTF_H | ... | ... |
... | @@ -13,10 +13,9 @@ | ... | @@ -13,10 +13,9 @@ |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 | GNU General Public License for more details. | 14 | GNU General Public License for more details. |
15 | 15 | ||
16 | You should have received a copy of the GNU General Public | 16 | You should have received a copy of the GNU General Public License |
17 | License along with this program; if not, write to the Free | 17 | along with this program; if not, write to the Free Software Foundation, |
18 | Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 18 | Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ |
19 | Boston, MA 02110-1301 USA. */ | ||
20 | 19 | ||
21 | #ifndef XALLOC_H_ | 20 | #ifndef XALLOC_H_ |
22 | # define XALLOC_H_ | 21 | # define XALLOC_H_ | ... | ... |
1 | /* xmalloc.c -- malloc with out of memory checking | 1 | /* xmalloc.c -- malloc with out of memory checking |
2 | 2 | ||
3 | Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, | 3 | Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, |
4 | 1999, 2000, 2002, 2003, 2004 Free Software Foundation, Inc. | 4 | 1999, 2000, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. |
5 | 5 | ||
6 | This program is free software; you can redistribute it and/or modify | 6 | This program is free software; you can redistribute it and/or modify |
7 | it under the terms of the GNU General Public License as published by | 7 | it under the terms of the GNU General Public License as published by |
... | @@ -13,10 +13,9 @@ | ... | @@ -13,10 +13,9 @@ |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 | GNU General Public License for more details. | 14 | GNU General Public License for more details. |
15 | 15 | ||
16 | You should have received a copy of the GNU General Public | 16 | You should have received a copy of the GNU General Public License |
17 | License along with this program; if not, write to the Free | 17 | along with this program; if not, write to the Free Software Foundation, |
18 | Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 18 | Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ |
19 | Boston, MA 02110-1301 USA. */ | ||
20 | 19 | ||
21 | #if HAVE_CONFIG_H | 20 | #if HAVE_CONFIG_H |
22 | # include <config.h> | 21 | # include <config.h> |
... | @@ -31,6 +30,15 @@ | ... | @@ -31,6 +30,15 @@ |
31 | # define SIZE_MAX ((size_t) -1) | 30 | # define SIZE_MAX ((size_t) -1) |
32 | #endif | 31 | #endif |
33 | 32 | ||
33 | /* 1 if calloc is known to be compatible with GNU calloc. This | ||
34 | matters if we are not also using the calloc module, which defines | ||
35 | HAVE_CALLOC and supports the GNU API even on non-GNU platforms. */ | ||
36 | #if defined HAVE_CALLOC || defined __GLIBC__ | ||
37 | enum { HAVE_GNU_CALLOC = 1 }; | ||
38 | #else | ||
39 | enum { HAVE_GNU_CALLOC = 0 }; | ||
40 | #endif | ||
41 | |||
34 | /* Allocate an array of N objects, each with S bytes of memory, | 42 | /* Allocate an array of N objects, each with S bytes of memory, |
35 | dynamically, with error checking. S must be nonzero. */ | 43 | dynamically, with error checking. S must be nonzero. */ |
36 | 44 | ||
... | @@ -205,8 +213,11 @@ xcalloc (size_t n, size_t s) | ... | @@ -205,8 +213,11 @@ xcalloc (size_t n, size_t s) |
205 | { | 213 | { |
206 | void *p; | 214 | void *p; |
207 | /* Test for overflow, since some calloc implementations don't have | 215 | /* Test for overflow, since some calloc implementations don't have |
208 | proper overflow checks. */ | 216 | proper overflow checks. But omit overflow and size-zero tests if |
209 | if (xalloc_oversized (n, s) || (! (p = calloc (n, s)) && n != 0)) | 217 | HAVE_GNU_CALLOC, since GNU calloc catches overflow and never |
218 | returns NULL if successful. */ | ||
219 | if ((! HAVE_GNU_CALLOC && xalloc_oversized (n, s)) | ||
220 | || (! (p = calloc (n, s)) && (HAVE_GNU_CALLOC || n != 0))) | ||
210 | xalloc_die (); | 221 | xalloc_die (); |
211 | return p; | 222 | return p; |
212 | } | 223 | } | ... | ... |
... | @@ -12,10 +12,9 @@ | ... | @@ -12,10 +12,9 @@ |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public | 15 | You should have received a copy of the GNU General Public License |
16 | License along with this program; if not, write to the Free | 16 | along with this program; if not, write to the Free Software Foundation, |
17 | Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 17 | Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ |
18 | Boston, MA 02110-1301 USA. */ | ||
19 | 18 | ||
20 | #ifndef _XSIZE_H | 19 | #ifndef _XSIZE_H |
21 | #define _XSIZE_H | 20 | #define _XSIZE_H | ... | ... |
1 | /* A more useful interface to strtol. | 1 | /* A more useful interface to strtol. |
2 | 2 | ||
3 | Copyright (C) 1995, 1996, 1998, 1999, 2000, 2001, 2003, 2004 Free | 3 | Copyright (C) 1995, 1996, 1998, 1999, 2000, 2001, 2003, 2004, 2005 |
4 | Software Foundation, Inc. | 4 | Free Software Foundation, Inc. |
5 | 5 | ||
6 | This program is free software; you can redistribute it and/or modify | 6 | This program is free software; you can redistribute it and/or modify |
7 | it under the terms of the GNU General Public License as published by | 7 | it under the terms of the GNU General Public License as published by |
... | @@ -13,10 +13,9 @@ | ... | @@ -13,10 +13,9 @@ |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 | GNU General Public License for more details. | 14 | GNU General Public License for more details. |
15 | 15 | ||
16 | You should have received a copy of the GNU General Public | 16 | You should have received a copy of the GNU General Public License |
17 | License along with this program; if not, write to the Free | 17 | along with this program; if not, write to the Free Software Foundation, |
18 | Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 18 | Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ |
19 | Boston, MA 02110-1301 USA. */ | ||
20 | 19 | ||
21 | /* Written by Jim Meyering. */ | 20 | /* Written by Jim Meyering. */ |
22 | 21 | ||
... | @@ -24,6 +23,8 @@ | ... | @@ -24,6 +23,8 @@ |
24 | # include <config.h> | 23 | # include <config.h> |
25 | #endif | 24 | #endif |
26 | 25 | ||
26 | #include "xstrtol.h" | ||
27 | |||
27 | #ifndef __strtol | 28 | #ifndef __strtol |
28 | # define __strtol strtol | 29 | # define __strtol strtol |
29 | # define __strtol_t long int | 30 | # define __strtol_t long int |
... | @@ -43,12 +44,7 @@ | ... | @@ -43,12 +44,7 @@ |
43 | #include <stdlib.h> | 44 | #include <stdlib.h> |
44 | #include <string.h> | 45 | #include <string.h> |
45 | 46 | ||
46 | /* The extra casts work around common compiler bugs. */ | 47 | #include "intprops.h" |
47 | #define TYPE_SIGNED(t) (! ((t) 0 < (t) -1)) | ||
48 | #define TYPE_MINIMUM(t) ((t) (TYPE_SIGNED (t) \ | ||
49 | ? ~ (t) 0 << (sizeof (t) * CHAR_BIT - 1) \ | ||
50 | : (t) 0)) | ||
51 | #define TYPE_MAXIMUM(t) ((t) (~ (t) 0 - TYPE_MINIMUM (t))) | ||
52 | 48 | ||
53 | #ifndef STRTOL_T_MINIMUM | 49 | #ifndef STRTOL_T_MINIMUM |
54 | # define STRTOL_T_MINIMUM TYPE_MINIMUM (__strtol_t) | 50 | # define STRTOL_T_MINIMUM TYPE_MINIMUM (__strtol_t) |
... | @@ -63,8 +59,6 @@ | ... | @@ -63,8 +59,6 @@ |
63 | 59 | ||
64 | #define ISSPACE(c) (IN_CTYPE_DOMAIN (c) && isspace (c)) | 60 | #define ISSPACE(c) (IN_CTYPE_DOMAIN (c) && isspace (c)) |
65 | 61 | ||
66 | #include "xstrtol.h" | ||
67 | |||
68 | #if !HAVE_DECL_STRTOIMAX && !defined strtoimax | 62 | #if !HAVE_DECL_STRTOIMAX && !defined strtoimax |
69 | intmax_t strtoimax (); | 63 | intmax_t strtoimax (); |
70 | #endif | 64 | #endif | ... | ... |
... | @@ -13,10 +13,9 @@ | ... | @@ -13,10 +13,9 @@ |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 | GNU General Public License for more details. | 14 | GNU General Public License for more details. |
15 | 15 | ||
16 | You should have received a copy of the GNU General Public | 16 | You should have received a copy of the GNU General Public License |
17 | License along with this program; if not, write to the Free | 17 | along with this program; if not, write to the Free Software Foundation, |
18 | Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 18 | Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ |
19 | Boston, MA 02110-1301 USA. */ | ||
20 | 19 | ||
21 | #ifndef XSTRTOL_H_ | 20 | #ifndef XSTRTOL_H_ |
22 | # define XSTRTOL_H_ 1 | 21 | # define XSTRTOL_H_ 1 | ... | ... |
1 | # argp.m4 serial 4 | 1 | # argp.m4 serial 5 |
2 | dnl Copyright (C) 2003, 2004 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 2003-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, |
5 | dnl with or without modifications, as long as this notice is preserved. | 5 | dnl with or without modifications, as long as this notice is preserved. |
... | @@ -7,11 +7,15 @@ dnl with or without modifications, as long as this notice is preserved. | ... | @@ -7,11 +7,15 @@ dnl with or without modifications, as long as this notice is preserved. |
7 | AC_DEFUN([gl_ARGP], | 7 | AC_DEFUN([gl_ARGP], |
8 | [ | 8 | [ |
9 | AC_REQUIRE([AC_C_INLINE]) | 9 | AC_REQUIRE([AC_C_INLINE]) |
10 | AC_REQUIRE([gl_FUNC_GLIBC_UNLOCKED_IO]) | ||
11 | AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) | 10 | AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) |
12 | AC_REQUIRE([gl_GETOPT_SUBSTITUTE]) | 11 | AC_REQUIRE([gl_GETOPT_SUBSTITUTE]) |
13 | AC_CHECK_DECLS([program_invocation_name, program_invocation_short_name],,, | 12 | AC_CHECK_DECLS([program_invocation_name, program_invocation_short_name],,, |
14 | [#include <errno.h>]) | 13 | [#include <errno.h>]) |
14 | AC_CHECK_DECLS_ONCE( | ||
15 | [clearerr_unlocked feof_unlocked ferror_unlocked | ||
16 | fflush_unlocked fgets_unlocked fputc_unlocked fputs_unlocked | ||
17 | fread_unlocked fwrite_unlocked getc_unlocked | ||
18 | getchar_unlocked putc_unlocked putchar_unlocked]) | ||
15 | AC_CHECK_FUNCS_ONCE([flockfile funlockfile]) | 19 | AC_CHECK_FUNCS_ONCE([flockfile funlockfile]) |
16 | AC_CHECK_HEADERS_ONCE([features.h linewrap.h]) | 20 | AC_CHECK_HEADERS_ONCE([features.h linewrap.h]) |
17 | ]) | 21 | ]) | ... | ... |
1 | # exitfail.m4 serial 4 | 1 | # exitfail.m4 serial 5 |
2 | dnl Copyright (C) 2002, 2003 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 2002, 2003, 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, |
5 | dnl with or without modifications, as long as this notice is preserved. | 5 | dnl with or without modifications, as long as this notice is preserved. |
6 | 6 | ||
7 | AC_DEFUN([gl_EXITFAIL], | 7 | AC_DEFUN([gl_EXITFAIL], |
8 | [ | 8 | [ |
9 | AC_LIBSOURCES([exitfail.c, exitfail.h]) | ||
10 | AC_LIBOBJ([exitfail]) | ||
11 | |||
9 | dnl No prerequisites of lib/exitfail.c. | 12 | dnl No prerequisites of lib/exitfail.c. |
10 | : | 13 | : |
11 | ]) | 14 | ]) | ... | ... |
... | @@ -21,6 +21,10 @@ AC_DEFUN([gl_USE_SYSTEM_EXTENSIONS], [ | ... | @@ -21,6 +21,10 @@ AC_DEFUN([gl_USE_SYSTEM_EXTENSIONS], [ |
21 | [/* Enable extensions on Solaris. */ | 21 | [/* Enable extensions on Solaris. */ |
22 | #ifndef __EXTENSIONS__ | 22 | #ifndef __EXTENSIONS__ |
23 | # undef __EXTENSIONS__ | 23 | # undef __EXTENSIONS__ |
24 | #endif | ||
25 | #ifndef _POSIX_PTHREAD_SEMANTICS | ||
26 | # undef _POSIX_PTHREAD_SEMANTICS | ||
24 | #endif]) | 27 | #endif]) |
25 | AC_DEFINE([__EXTENSIONS__]) | 28 | AC_DEFINE([__EXTENSIONS__]) |
29 | AC_DEFINE([_POSIX_PTHREAD_SEMANTICS]) | ||
26 | ]) | 30 | ]) | ... | ... |
1 | # getline.m4 serial 11 | 1 | # getline.m4 serial 13 |
2 | 2 | ||
3 | dnl Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Free Software | 3 | dnl Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2005 Free Software |
4 | dnl Foundation, Inc. | 4 | dnl Foundation, Inc. |
5 | dnl | 5 | dnl |
6 | dnl This file is free software; the Free Software Foundation | 6 | dnl This file is free software; the Free Software Foundation |
... | @@ -13,17 +13,21 @@ dnl See if there's a working, system-supplied version of the getline function. | ... | @@ -13,17 +13,21 @@ dnl See if there's a working, system-supplied version of the getline function. |
13 | dnl We can't just do MU_REPLACE_FUNCS(getline) because some systems | 13 | dnl We can't just do MU_REPLACE_FUNCS(getline) because some systems |
14 | dnl have a function by that name in -linet that doesn't have anything | 14 | dnl have a function by that name in -linet that doesn't have anything |
15 | dnl to do with the function we need. | 15 | dnl to do with the function we need. |
16 | AC_DEFUN([AM_FUNC_GETLINE], | 16 | AC_DEFUN([gl_FUNC_GETLINE], |
17 | [ | 17 | [ |
18 | dnl Persuade glibc <stdio.h> to declare getline() and getdelim(). | 18 | MU_LIBSOURCES([getline.c, getline.h]) |
19 | |||
20 | dnl Persuade glibc <stdio.h> to declare getline(). | ||
19 | AC_REQUIRE([AC_GNU_SOURCE]) | 21 | AC_REQUIRE([AC_GNU_SOURCE]) |
20 | 22 | ||
21 | am_getline_needs_run_time_check=no | 23 | AC_CHECK_DECLS([getline]) |
24 | |||
25 | gl_getline_needs_run_time_check=no | ||
22 | AC_CHECK_FUNC(getline, | 26 | AC_CHECK_FUNC(getline, |
23 | dnl Found it in some library. Verify that it works. | 27 | dnl Found it in some library. Verify that it works. |
24 | am_getline_needs_run_time_check=yes, | 28 | gl_getline_needs_run_time_check=yes, |
25 | am_cv_func_working_getline=no) | 29 | am_cv_func_working_getline=no) |
26 | if test $am_getline_needs_run_time_check = yes; then | 30 | if test $gl_getline_needs_run_time_check = yes; then |
27 | AC_CACHE_CHECK([for working getline function], am_cv_func_working_getline, | 31 | AC_CACHE_CHECK([for working getline function], am_cv_func_working_getline, |
28 | [echo fooN |tr -d '\012'|tr N '\012' > conftest.data | 32 | [echo fooN |tr -d '\012'|tr N '\012' > conftest.data |
29 | AC_TRY_RUN([ | 33 | AC_TRY_RUN([ |
... | @@ -55,20 +59,12 @@ AC_DEFUN([AM_FUNC_GETLINE], | ... | @@ -55,20 +59,12 @@ AC_DEFUN([AM_FUNC_GETLINE], |
55 | [Define to a replacement function name for getline().]) | 59 | [Define to a replacement function name for getline().]) |
56 | MU_LIBOBJ(getline) | 60 | MU_LIBOBJ(getline) |
57 | 61 | ||
58 | # Avoid multiple inclusions of getndelim2.o into LIBOBJS. | ||
59 | # This hack won't be needed after gnulib requires Autoconf 2.58 or later. | ||
60 | case " $LIB@&t@OBJS " in | ||
61 | *" getndelim2.$ac_objext "* ) ;; | ||
62 | *) MU_LIBOBJ(getndelim2);; | ||
63 | esac | ||
64 | |||
65 | gl_PREREQ_GETLINE | 62 | gl_PREREQ_GETLINE |
66 | gl_PREREQ_GETNDELIM2 | ||
67 | fi | 63 | fi |
68 | ]) | 64 | ]) |
69 | 65 | ||
70 | # Prerequisites of lib/getline.c. | 66 | # Prerequisites of lib/getline.c. |
71 | AC_DEFUN([gl_PREREQ_GETLINE], | 67 | AC_DEFUN([gl_PREREQ_GETLINE], |
72 | [ | 68 | [ |
73 | AC_CHECK_FUNCS(getdelim) | 69 | gl_FUNC_GETDELIM |
74 | ]) | 70 | ]) | ... | ... |
1 | # getopt.m4 serial 7 | 1 | # getopt.m4 serial 10 |
2 | dnl Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 2002, 2003, 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, |
5 | dnl with or without modifications, as long as this notice is preserved. | 5 | dnl with or without modifications, as long as this notice is preserved. |
... | @@ -10,33 +10,69 @@ dnl with or without modifications, as long as this notice is preserved. | ... | @@ -10,33 +10,69 @@ dnl with or without modifications, as long as this notice is preserved. |
10 | 10 | ||
11 | AC_DEFUN([gl_GETOPT_SUBSTITUTE], | 11 | AC_DEFUN([gl_GETOPT_SUBSTITUTE], |
12 | [ | 12 | [ |
13 | GETOPT_H=getopt.h | ||
14 | MU_LIBOBJ([getopt]) | 13 | MU_LIBOBJ([getopt]) |
15 | MU_LIBOBJ([getopt1]) | 14 | MU_LIBOBJ([getopt1]) |
15 | gl_GETOPT_SUBSTITUTE_HEADER | ||
16 | gl_PREREQ_GETOPT | ||
17 | ]) | ||
18 | |||
19 | AC_DEFUN([gl_GETOPT_SUBSTITUTE_HEADER], | ||
20 | [ | ||
21 | GETOPT_H=getopt.h | ||
16 | AC_DEFINE([__GETOPT_PREFIX], [[rpl_]], | 22 | AC_DEFINE([__GETOPT_PREFIX], [[rpl_]], |
17 | [Define to rpl_ if the getopt replacement functions and variables | 23 | [Define to rpl_ if the getopt replacement functions and variables |
18 | should be used.]) | 24 | should be used.]) |
19 | AC_SUBST([GETOPT_H]) | 25 | AC_SUBST([GETOPT_H]) |
20 | ]) | 26 | ]) |
21 | 27 | ||
22 | AC_DEFUN([gl_GETOPT], | 28 | AC_DEFUN([gl_GETOPT_CHECK_HEADERS], |
23 | [ | 29 | [ |
24 | gl_PREREQ_GETOPT | 30 | GETOPT_H= |
25 | 31 | AC_CHECK_HEADERS([getopt.h], [], [GETOPT_H=getopt.h]) | |
26 | if test -z "$GETOPT_H"; then | 32 | if test -z "$GETOPT_H"; then |
27 | GETOPT_H= | ||
28 | AC_CHECK_HEADERS([getopt.h], [], [GETOPT_H=getopt.h]) | ||
29 | AC_CHECK_FUNCS([getopt_long_only], [], [GETOPT_H=getopt.h]) | 33 | AC_CHECK_FUNCS([getopt_long_only], [], [GETOPT_H=getopt.h]) |
34 | fi | ||
30 | 35 | ||
31 | dnl BSD getopt_long uses an incompatible method to reset option processing, | 36 | dnl BSD getopt_long uses an incompatible method to reset option processing, |
32 | dnl and (as of 2004-10-15) mishandles optional option-arguments. | 37 | dnl and (as of 2004-10-15) mishandles optional option-arguments. |
38 | if test -z "$GETOPT_H"; then | ||
33 | AC_CHECK_DECL([optreset], [GETOPT_H=getopt.h], [], [#include <getopt.h>]) | 39 | AC_CHECK_DECL([optreset], [GETOPT_H=getopt.h], [], [#include <getopt.h>]) |
40 | fi | ||
34 | 41 | ||
35 | if test -n "$GETOPT_H"; then | 42 | dnl Solaris 10 getopt doesn't handle `+' as a leading character in an |
36 | gl_GETOPT_SUBSTITUTE | 43 | dnl option string (as of 2005-05-05). |
44 | if test -z "$GETOPT_H"; then | ||
45 | AC_CACHE_CHECK([for working GNU getopt function], [gl_cv_func_gnu_getopt], | ||
46 | [AC_RUN_IFELSE( | ||
47 | [AC_LANG_PROGRAM([#include <getopt.h>], | ||
48 | [[ | ||
49 | char *myargv[3]; | ||
50 | myargv[0] = "conftest"; | ||
51 | myargv[1] = "-+"; | ||
52 | myargv[2] = 0; | ||
53 | return getopt (2, myargv, "+a") != '?'; | ||
54 | ]])], | ||
55 | [gl_cv_func_gnu_getopt=yes], | ||
56 | [gl_cv_func_gnu_getopt=no], | ||
57 | [dnl cross compiling - pessimistically guess based on decls | ||
58 | dnl Solaris 10 getopt doesn't handle `+' as a leading character in an | ||
59 | dnl option string (as of 2005-05-05). | ||
60 | AC_CHECK_DECL([getopt_clip], | ||
61 | [gl_cv_func_gnu_getopt=no], [gl_cv_func_gnu_getopt=yes], | ||
62 | [#include <getopt.h>])])]) | ||
63 | if test "$gl_cv_func_gnu_getopt" = "no"; then | ||
64 | GETOPT_H=getopt.h | ||
37 | fi | 65 | fi |
38 | fi | 66 | fi |
39 | ]) | 67 | ]) |
40 | 68 | ||
69 | AC_DEFUN([gl_GETOPT_IFELSE], | ||
70 | [ | ||
71 | AC_REQUIRE([gl_GETOPT_CHECK_HEADERS]) | ||
72 | AS_IF([test -n "$GETOPT_H"], [$1], [$2]) | ||
73 | ]) | ||
74 | |||
75 | AC_DEFUN([gl_GETOPT], [gl_GETOPT_IFELSE([gl_GETOPT_SUBSTITUTE])]) | ||
76 | |||
41 | # Prerequisites of lib/getopt*. | 77 | # Prerequisites of lib/getopt*. |
42 | AC_DEFUN([gl_PREREQ_GETOPT], [:]) | 78 | AC_DEFUN([gl_PREREQ_GETOPT], [:]) | ... | ... |
1 | # getpass.m4 serial 5 | 1 | # getpass.m4 serial 6 |
2 | dnl Copyright (C) 2002-2003 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 2002-2003, 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, |
5 | dnl with or without modifications, as long as this notice is preserved. | 5 | dnl with or without modifications, as long as this notice is preserved. |
... | @@ -7,6 +7,8 @@ dnl with or without modifications, as long as this notice is preserved. | ... | @@ -7,6 +7,8 @@ dnl with or without modifications, as long as this notice is preserved. |
7 | # Provide a getpass() function if the system doesn't have it. | 7 | # Provide a getpass() function if the system doesn't have it. |
8 | AC_DEFUN([gl_FUNC_GETPASS], | 8 | AC_DEFUN([gl_FUNC_GETPASS], |
9 | [ | 9 | [ |
10 | AC_LIBSOURCES([getpass.c, getpass.h]) | ||
11 | |||
10 | AC_REPLACE_FUNCS(getpass) | 12 | AC_REPLACE_FUNCS(getpass) |
11 | AC_CHECK_DECLS_ONCE(getpass) | 13 | AC_CHECK_DECLS_ONCE(getpass) |
12 | if test $ac_cv_func_getpass = no; then | 14 | if test $ac_cv_func_getpass = no; then |
... | @@ -18,6 +20,8 @@ AC_DEFUN([gl_FUNC_GETPASS], | ... | @@ -18,6 +20,8 @@ AC_DEFUN([gl_FUNC_GETPASS], |
18 | # arbitrary length (not just 8 bytes as on HP-UX). | 20 | # arbitrary length (not just 8 bytes as on HP-UX). |
19 | AC_DEFUN([gl_FUNC_GETPASS_GNU], | 21 | AC_DEFUN([gl_FUNC_GETPASS_GNU], |
20 | [ | 22 | [ |
23 | AC_LIBSOURCES([getpass.c, getpass.h]) | ||
24 | |||
21 | AC_CHECK_DECLS_ONCE(getpass) | 25 | AC_CHECK_DECLS_ONCE(getpass) |
22 | dnl TODO: Detect when GNU getpass() is already found in glibc. | 26 | dnl TODO: Detect when GNU getpass() is already found in glibc. |
23 | AC_LIBOBJ(getpass) | 27 | AC_LIBOBJ(getpass) | ... | ... |
1 | # This file is generated automatically. Please, do not edit. | 1 | # This file is generated automatically. Please, do not edit. |
2 | # | 2 | # |
3 | AC_DEFUN([libmailutils_GNULIB],[ | 3 | AC_DEFUN([libmuaux_GNULIB],[ |
4 | # allocsa | 4 | # allocsa |
5 | gl_ALLOCSA | 5 | gl_ALLOCSA |
6 | 6 | ||
... | @@ -12,8 +12,8 @@ gl_ERROR | ... | @@ -12,8 +12,8 @@ gl_ERROR |
12 | # exitfail | 12 | # exitfail |
13 | gl_EXITFAIL | 13 | gl_EXITFAIL |
14 | 14 | ||
15 | # stdbool | 15 | # xalloc |
16 | AM_STDBOOL_H | 16 | gl_XALLOC |
17 | 17 | ||
18 | # xalloc | 18 | # xalloc |
19 | gl_XALLOC | 19 | gl_XALLOC |
... | @@ -48,11 +48,13 @@ gl_XSTRTOL | ... | @@ -48,11 +48,13 @@ gl_XSTRTOL |
48 | # vasprintf | 48 | # vasprintf |
49 | gl_FUNC_VASPRINTF | 49 | gl_FUNC_VASPRINTF |
50 | 50 | ||
51 | # xalloc-die | ||
52 | |||
51 | # xsize | 53 | # xsize |
52 | gl_XSIZE | 54 | gl_XSIZE |
53 | 55 | ||
54 | ]) | 56 | ]) |
55 | AC_DEFUN([libmailbox_GNULIB],[ | 57 | AC_DEFUN([libmailutils_GNULIB],[ |
56 | # alloca | 58 | # alloca |
57 | 59 | ||
58 | # alloca-opt | 60 | # alloca-opt |
... | @@ -62,7 +64,7 @@ gl_FUNC_ALLOCA | ... | @@ -62,7 +64,7 @@ gl_FUNC_ALLOCA |
62 | gl_ARGP | 64 | gl_ARGP |
63 | 65 | ||
64 | # getline | 66 | # getline |
65 | AM_FUNC_GETLINE | 67 | gl_FUNC_GETLINE |
66 | 68 | ||
67 | # regex | 69 | # regex |
68 | gl_REGEX | 70 | gl_REGEX |
... | @@ -76,19 +78,35 @@ gl_MD5 | ... | @@ -76,19 +78,35 @@ gl_MD5 |
76 | # extensions | 78 | # extensions |
77 | dnl gl_USE_SYSTEM_EXTENSIONS must be added quite early to configure.ac. | 79 | dnl gl_USE_SYSTEM_EXTENSIONS must be added quite early to configure.ac. |
78 | 80 | ||
81 | # getdelim | ||
82 | gl_FUNC_GETDELIM | ||
83 | |||
79 | # getopt | 84 | # getopt |
80 | gl_GETOPT | 85 | gl_GETOPT |
81 | 86 | ||
82 | # gettext | 87 | # gettext-h |
88 | |||
89 | # mbchar | ||
90 | gl_MBCHAR | ||
91 | |||
92 | # memchr | ||
93 | gl_FUNC_MEMCHR | ||
83 | 94 | ||
84 | # mempcpy | 95 | # mempcpy |
85 | gl_FUNC_MEMPCPY | 96 | gl_FUNC_MEMPCPY |
86 | 97 | ||
87 | # minmax | 98 | # minmax |
99 | gl_MINMAX | ||
88 | 100 | ||
89 | # restrict | 101 | # restrict |
90 | gl_C_RESTRICT | 102 | gl_C_RESTRICT |
91 | 103 | ||
104 | # size_max | ||
105 | gl_SIZE_MAX | ||
106 | |||
107 | # stdbool | ||
108 | AM_STDBOOL_H | ||
109 | |||
92 | # strcase | 110 | # strcase |
93 | gl_STRCASE | 111 | gl_STRCASE |
94 | 112 | ||
... | @@ -101,6 +119,8 @@ gl_FUNC_STRNDUP | ... | @@ -101,6 +119,8 @@ gl_FUNC_STRNDUP |
101 | # strnlen | 119 | # strnlen |
102 | gl_FUNC_STRNLEN | 120 | gl_FUNC_STRNLEN |
103 | 121 | ||
122 | # strnlen1 | ||
123 | |||
104 | # sysexits | 124 | # sysexits |
105 | gl_SYSEXITS | 125 | gl_SYSEXITS |
106 | 126 | ... | ... |
1 | # longdouble.m4 serial 1 (gettext-0.12) | 1 | # longdouble.m4 serial 1 (gettext-0.12) |
2 | dnl Copyright (C) 2002-2003 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 2002-2003 Free Software Foundation, Inc. |
3 | dnl This file is free software, distributed under the terms of the GNU | 3 | dnl This file is free software; the Free Software Foundation |
4 | dnl General Public License. As a special exception to the GNU General | 4 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl Public License, this file may be distributed as part of a program | 5 | dnl with or without modifications, as long as this notice is preserved. |
6 | dnl that contains a configuration script generated by Autoconf, under | ||
7 | dnl the same distribution terms as the rest of that program. | ||
8 | 6 | ||
9 | dnl From Bruno Haible. | 7 | dnl From Bruno Haible. |
10 | dnl Test whether the compiler supports the 'long double' type. | 8 | dnl Test whether the compiler supports the 'long double' type. | ... | ... |
1 | # mbrtowc.m4 serial 7 | 1 | # mbrtowc.m4 serial 8 |
2 | dnl Copyright (C) 2001-2002, 2004 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, |
5 | dnl with or without modifications, as long as this notice is preserved. | 5 | dnl with or without modifications, as long as this notice is preserved. |
... | @@ -7,19 +7,25 @@ dnl with or without modifications, as long as this notice is preserved. | ... | @@ -7,19 +7,25 @@ dnl with or without modifications, as long as this notice is preserved. |
7 | dnl From Paul Eggert | 7 | dnl From Paul Eggert |
8 | 8 | ||
9 | dnl This file can be removed, and gl_FUNC_MBRTOWC replaced with | 9 | dnl This file can be removed, and gl_FUNC_MBRTOWC replaced with |
10 | dnl AC_FUNC_MBRTOWC, when autoconf 2.57 can be assumed everywhere. | 10 | dnl AC_FUNC_MBRTOWC, when autoconf 2.60 can be assumed everywhere. |
11 | 11 | ||
12 | AC_DEFUN([gl_FUNC_MBRTOWC], | 12 | AC_DEFUN([gl_FUNC_MBRTOWC], |
13 | [ | 13 | [ |
14 | dnl Same as AC_FUNC_MBRTOWC in autoconf-2.60. | ||
14 | AC_CACHE_CHECK([whether mbrtowc and mbstate_t are properly declared], | 15 | AC_CACHE_CHECK([whether mbrtowc and mbstate_t are properly declared], |
15 | gl_cv_func_mbrtowc, | 16 | gl_cv_func_mbrtowc, |
16 | [AC_TRY_LINK( | 17 | [AC_LINK_IFELSE( |
17 | [#include <wchar.h>], | 18 | [AC_LANG_PROGRAM( |
18 | [mbstate_t state; return ! (sizeof state && mbrtowc);], | 19 | [[#include <wchar.h>]], |
20 | [[wchar_t wc; | ||
21 | char const s[] = ""; | ||
22 | size_t n = 1; | ||
23 | mbstate_t state; | ||
24 | return ! (sizeof state && (mbrtowc) (&wc, s, n, &state));]])], | ||
19 | gl_cv_func_mbrtowc=yes, | 25 | gl_cv_func_mbrtowc=yes, |
20 | gl_cv_func_mbrtowc=no)]) | 26 | gl_cv_func_mbrtowc=no)]) |
21 | if test $gl_cv_func_mbrtowc = yes; then | 27 | if test $gl_cv_func_mbrtowc = yes; then |
22 | AC_DEFINE(HAVE_MBRTOWC, 1, | 28 | AC_DEFINE([HAVE_MBRTOWC], 1, |
23 | [Define to 1 if mbrtowc and mbstate_t are properly declared.]) | 29 | [Define to 1 if mbrtowc and mbstate_t are properly declared.]) |
24 | fi | 30 | fi |
25 | ]) | 31 | ]) | ... | ... |
1 | # md5.m4 serial 6 | 1 | # md5.m4 serial 7 |
2 | dnl Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 2002, 2003, 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, |
5 | dnl with or without modifications, as long as this notice is preserved. | 5 | dnl with or without modifications, as long as this notice is preserved. |
6 | 6 | ||
7 | AC_DEFUN([gl_MD5], | 7 | AC_DEFUN([gl_MD5], |
8 | [ | 8 | [ |
9 | MU_LIBSOURCES([md5.c, md5.h]) | ||
10 | MU_LIBOBJ([md5]) | ||
11 | |||
9 | dnl Prerequisites of lib/md5.h. | 12 | dnl Prerequisites of lib/md5.h. |
10 | AC_REQUIRE([gl_AC_TYPE_UINT32_T]) | 13 | AC_REQUIRE([gl_AC_TYPE_UINT32_T]) |
11 | 14 | ... | ... |
1 | # onceonly_2_57.m4 serial 3 | 1 | # onceonly_2_57.m4 serial 3 |
2 | dnl Copyright (C) 2002-2003 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 2002-2003, 2005 Free Software Foundation, Inc. |
3 | dnl This file is free software, distributed under the terms of the GNU | 3 | dnl This file is free software, distributed under the terms of the GNU |
4 | dnl General Public License. As a special exception to the GNU General | 4 | dnl General Public License. As a special exception to the GNU General |
5 | dnl Public License, this file may be distributed as part of a program | 5 | dnl Public License, this file may be distributed as part of a program |
... | @@ -27,7 +27,7 @@ dnl thus reducing the size of 'configure'. Works with autoconf-2.57. The | ... | @@ -27,7 +27,7 @@ dnl thus reducing the size of 'configure'. Works with autoconf-2.57. The |
27 | dnl size reduction is ca. 9%. | 27 | dnl size reduction is ca. 9%. |
28 | 28 | ||
29 | dnl Autoconf version 2.57 or newer is recommended. | 29 | dnl Autoconf version 2.57 or newer is recommended. |
30 | AC_PREREQ(2.54) | 30 | AC_PREREQ(2.57) |
31 | 31 | ||
32 | # AC_CHECK_HEADERS_ONCE(HEADER1 HEADER2 ...) is a once-only variant of | 32 | # AC_CHECK_HEADERS_ONCE(HEADER1 HEADER2 ...) is a once-only variant of |
33 | # AC_CHECK_HEADERS(HEADER1 HEADER2 ...). | 33 | # AC_CHECK_HEADERS(HEADER1 HEADER2 ...). | ... | ... |
1 | #serial 22 | 1 | #serial 24 |
2 | 2 | ||
3 | # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004 Free | 3 | # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005 Free |
4 | # Software Foundation, Inc. | 4 | # Software Foundation, Inc. |
5 | # | 5 | # |
6 | # This file is free software; the Free Software Foundation | 6 | # This file is free software; the Free Software Foundation |
... | @@ -19,6 +19,10 @@ dnl Usage: gl_INCLUDED_REGEX([lib/regex.c]) | ... | @@ -19,6 +19,10 @@ dnl Usage: gl_INCLUDED_REGEX([lib/regex.c]) |
19 | dnl | 19 | dnl |
20 | AC_DEFUN([gl_INCLUDED_REGEX], | 20 | AC_DEFUN([gl_INCLUDED_REGEX], |
21 | [ | 21 | [ |
22 | MU_LIBSOURCES( | ||
23 | [regcomp.c, regex.c, regex.h, | ||
24 | regex_internal.c, regex_internal.h, regexec.c]) | ||
25 | |||
22 | dnl Even packages that don't use regex.c can use this macro. | 26 | dnl Even packages that don't use regex.c can use this macro. |
23 | dnl Of course, for them it doesn't do anything. | 27 | dnl Of course, for them it doesn't do anything. |
24 | 28 | ||
... | @@ -31,75 +35,86 @@ AC_DEFUN([gl_INCLUDED_REGEX], | ... | @@ -31,75 +35,86 @@ AC_DEFUN([gl_INCLUDED_REGEX], |
31 | # regex.c. The first failing regular expression is from `Spencer ere | 35 | # regex.c. The first failing regular expression is from `Spencer ere |
32 | # test #75' in grep-2.3. | 36 | # test #75' in grep-2.3. |
33 | AC_CACHE_CHECK([for working re_compile_pattern], | 37 | AC_CACHE_CHECK([for working re_compile_pattern], |
34 | jm_cv_func_working_re_compile_pattern, | 38 | [gl_cv_func_working_re_compile_pattern], |
35 | AC_TRY_RUN( | 39 | [AC_RUN_IFELSE( |
36 | [#include <stdio.h> | 40 | [AC_LANG_PROGRAM( |
37 | #include <string.h> | 41 | [AC_INCLUDES_DEFAULT |
38 | #include <regex.h> | 42 | #include <regex.h>], |
39 | int | 43 | [[static struct re_pattern_buffer regex; |
40 | main () | 44 | const char *s; |
41 | { | 45 | struct re_registers regs; |
42 | static struct re_pattern_buffer regex; | 46 | re_set_syntax (RE_SYNTAX_POSIX_EGREP); |
43 | const char *s; | 47 | memset (®ex, 0, sizeof (regex)); |
44 | struct re_registers regs; | 48 | s = re_compile_pattern ("a[:@:>@:]b\n", 9, ®ex); |
45 | re_set_syntax (RE_SYNTAX_POSIX_EGREP); | 49 | /* This should fail with _Invalid character class name_ error. */ |
46 | memset (®ex, 0, sizeof (regex)); | 50 | if (!s) |
47 | [s = re_compile_pattern ("a[[:@:>@:]]b\n", 9, ®ex);] | 51 | exit (1); |
48 | /* This should fail with _Invalid character class name_ error. */ | 52 | |
49 | if (!s) | 53 | /* This should succeed, but does not for e.g. glibc-2.1.3. */ |
50 | exit (1); | 54 | memset (®ex, 0, sizeof (regex)); |
51 | 55 | s = re_compile_pattern ("{1", 2, ®ex); | |
52 | /* This should succeed, but doesn't for e.g. glibc-2.1.3. */ | 56 | |
53 | memset (®ex, 0, sizeof (regex)); | 57 | if (s) |
54 | s = re_compile_pattern ("{1", 2, ®ex); | 58 | exit (1); |
55 | 59 | ||
56 | if (s) | 60 | /* The following example is derived from a problem report |
57 | exit (1); | 61 | against gawk from Jorge Stolfi <stolfi@ic.unicamp.br>. */ |
58 | 62 | memset (®ex, 0, sizeof (regex)); | |
59 | /* The following example is derived from a problem report | 63 | s = re_compile_pattern ("[an\371]*n", 7, ®ex); |
60 | against gawk from Jorge Stolfi <stolfi@ic.unicamp.br>. */ | 64 | if (s) |
61 | memset (®ex, 0, sizeof (regex)); | 65 | exit (1); |
62 | s = re_compile_pattern ("[[an\371]]*n", 7, ®ex); | 66 | |
63 | if (s) | 67 | /* This should match, but does not for e.g. glibc-2.2.1. */ |
64 | exit (1); | 68 | if (re_match (®ex, "an", 2, 0, ®s) != 2) |
65 | 69 | exit (1); | |
66 | /* This should match, but doesn't for e.g. glibc-2.2.1. */ | 70 | |
67 | if (re_match (®ex, "an", 2, 0, ®s) != 2) | 71 | memset (®ex, 0, sizeof (regex)); |
68 | exit (1); | 72 | s = re_compile_pattern ("x", 1, ®ex); |
69 | 73 | if (s) | |
70 | memset (®ex, 0, sizeof (regex)); | 74 | exit (1); |
71 | s = re_compile_pattern ("x", 1, ®ex); | 75 | |
72 | if (s) | 76 | /* The version of regex.c in e.g. GNU libc-2.2.93 did not |
73 | exit (1); | 77 | work with a negative RANGE argument. */ |
74 | 78 | if (re_search (®ex, "wxy", 3, 2, -2, ®s) != 1) | |
75 | /* The version of regex.c in e.g. GNU libc-2.2.93 didn't | 79 | exit (1); |
76 | work with a negative RANGE argument. */ | 80 | |
77 | if (re_search (®ex, "wxy", 3, 2, -2, ®s) != 1) | 81 | /* The version of regex.c in older versions of gnulib |
78 | exit (1); | 82 | * ignored RE_ICASE. Detect that problem too. */ |
79 | 83 | memset (®ex, 0, sizeof (regex)); | |
80 | exit (0); | 84 | re_set_syntax(RE_SYNTAX_EMACS|RE_ICASE); |
81 | } | 85 | s = re_compile_pattern ("x", 1, ®ex); |
82 | ], | 86 | if (s) |
83 | jm_cv_func_working_re_compile_pattern=yes, | 87 | exit (1); |
84 | jm_cv_func_working_re_compile_pattern=no, | 88 | |
85 | dnl When crosscompiling, assume it's broken. | 89 | if (re_search (®ex, "WXY", 3, 0, 3, ®s) < 0) |
86 | jm_cv_func_working_re_compile_pattern=no)) | 90 | exit (1); |
87 | if test $jm_cv_func_working_re_compile_pattern = yes; then | 91 | |
92 | /* REG_STARTEND was added to glibc on 2004-01-15. | ||
93 | Reject older versions. */ | ||
94 | if (! REG_STARTEND) | ||
95 | exit (1); | ||
96 | |||
97 | exit (0);]])], | ||
98 | [gl_cv_func_working_re_compile_pattern=yes], | ||
99 | [gl_cv_func_working_re_compile_pattern=no], | ||
100 | dnl When crosscompiling, assume it is broken. | ||
101 | [gl_cv_func_working_re_compile_pattern=no])]) | ||
102 | if test $gl_cv_func_working_re_compile_pattern = yes; then | ||
88 | ac_use_included_regex=no | 103 | ac_use_included_regex=no |
89 | fi | 104 | fi |
90 | 105 | ||
91 | test -n "$1" || AC_MSG_ERROR([missing argument]) | 106 | test -n "$1" || AC_MSG_ERROR([missing argument]) |
92 | m4_syscmd([test -f $1]) | 107 | m4_syscmd([test -f '$1']) |
93 | ifelse(m4_sysval, 0, | 108 | ifelse(m4_sysval, 0, |
94 | [ | 109 | [ |
95 | AC_ARG_WITH(included-regex, | 110 | AC_ARG_WITH([included-regex], |
96 | [ --without-included-regex don't compile regex; this is the default on | 111 | [ --without-included-regex don't compile regex; this is the default on |
97 | systems with version 2 of the GNU C library | 112 | systems with recent-enough versions of the GNU C |
98 | (use with caution on other system)], | 113 | Library (use with caution on other systems)], |
99 | jm_with_regex=$withval, | 114 | [gl_with_regex=$withval], |
100 | jm_with_regex=$ac_use_included_regex) | 115 | [gl_with_regex=$ac_use_included_regex]) |
101 | if test "$jm_with_regex" = yes; then | 116 | if test "X$gl_with_regex" = Xyes; then |
102 | MU_LIBOBJ(regex) | 117 | MU_LIBOBJ([regex]) |
103 | gl_PREREQ_REGEX | 118 | gl_PREREQ_REGEX |
104 | fi | 119 | fi |
105 | ], | 120 | ], |
... | @@ -107,20 +122,11 @@ AC_DEFUN([gl_INCLUDED_REGEX], | ... | @@ -107,20 +122,11 @@ AC_DEFUN([gl_INCLUDED_REGEX], |
107 | ] | 122 | ] |
108 | ) | 123 | ) |
109 | 124 | ||
110 | # Prerequisites of lib/regex.c. | 125 | # Prerequisites of lib/regex.c and lib/regex_internal.c. |
111 | AC_DEFUN([gl_PREREQ_REGEX], | 126 | AC_DEFUN([gl_PREREQ_REGEX], |
112 | [ | 127 | [ |
113 | dnl FIXME: Maybe provide a btowc replacement someday: Solaris 2.5.1 lacks it. | ||
114 | dnl FIXME: Check for wctype and iswctype, and and add -lw if necessary | ||
115 | dnl to get them. | ||
116 | |||
117 | dnl Persuade glibc <string.h> to declare mempcpy(). | ||
118 | AC_REQUIRE([AC_GNU_SOURCE]) | ||
119 | |||
120 | AC_REQUIRE([gl_C_RESTRICT]) | 128 | AC_REQUIRE([gl_C_RESTRICT]) |
121 | AC_REQUIRE([AC_FUNC_ALLOCA]) | 129 | AC_REQUIRE([AM_LANGINFO_CODESET]) |
122 | AC_REQUIRE([AC_HEADER_STDC]) | 130 | AC_CHECK_HEADERS_ONCE([locale.h wchar.h wctype.h]) |
123 | AC_CHECK_HEADERS_ONCE(wchar.h wctype.h) | 131 | AC_CHECK_FUNCS_ONCE([isblank mbrtowc mempcpy wcrtomb wcscoll]) |
124 | AC_CHECK_FUNCS_ONCE(isascii mempcpy) | ||
125 | AC_CHECK_FUNCS(btowc) | ||
126 | ]) | 132 | ]) | ... | ... |
1 | # signed.m4 serial 1 (gettext-0.10.40) | 1 | # signed.m4 serial 1 (gettext-0.10.40) |
2 | dnl Copyright (C) 2001-2002 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 2001-2002 Free Software Foundation, Inc. |
3 | dnl This file is free software, distributed under the terms of the GNU | 3 | dnl This file is free software; the Free Software Foundation |
4 | dnl General Public License. As a special exception to the GNU General | 4 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl Public License, this file may be distributed as part of a program | 5 | dnl with or without modifications, as long as this notice is preserved. |
6 | dnl that contains a configuration script generated by Autoconf, under | ||
7 | dnl the same distribution terms as the rest of that program. | ||
8 | 6 | ||
9 | dnl From Bruno Haible. | 7 | dnl From Bruno Haible. |
10 | 8 | ... | ... |
1 | # size_max.m4 serial 2 | 1 | # size_max.m4 serial 3 |
2 | dnl Copyright (C) 2003 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 2003, 2005 Free Software Foundation, Inc. |
3 | dnl This file is free software, distributed under the terms of the GNU | 3 | dnl This file is free software; the Free Software Foundation |
4 | dnl General Public License. As a special exception to the GNU General | 4 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl Public License, this file may be distributed as part of a program | 5 | dnl with or without modifications, as long as this notice is preserved. |
6 | dnl that contains a configuration script generated by Autoconf, under | ||
7 | dnl the same distribution terms as the rest of that program. | ||
8 | 6 | ||
9 | dnl From Bruno Haible. | 7 | dnl From Bruno Haible. |
10 | 8 | ||
... | @@ -28,9 +26,9 @@ Found it | ... | @@ -28,9 +26,9 @@ Found it |
28 | dnl than the type 'unsigned long'. | 26 | dnl than the type 'unsigned long'. |
29 | dnl The _AC_COMPUTE_INT macro works up to LONG_MAX, since it uses 'expr', | 27 | dnl The _AC_COMPUTE_INT macro works up to LONG_MAX, since it uses 'expr', |
30 | dnl which is guaranteed to work from LONG_MIN to LONG_MAX. | 28 | dnl which is guaranteed to work from LONG_MIN to LONG_MAX. |
31 | _AC_COMPUTE_INT([~(size_t)0 / 10], res_hi, | 29 | _AC_COMPUTE_INT([(size_t)~(size_t)0 / 10], res_hi, |
32 | [#include <stddef.h>], result=?) | 30 | [#include <stddef.h>], result=?) |
33 | _AC_COMPUTE_INT([~(size_t)0 % 10], res_lo, | 31 | _AC_COMPUTE_INT([(size_t)~(size_t)0 % 10], res_lo, |
34 | [#include <stddef.h>], result=?) | 32 | [#include <stddef.h>], result=?) |
35 | _AC_COMPUTE_INT([sizeof (size_t) <= sizeof (unsigned int)], fits_in_uint, | 33 | _AC_COMPUTE_INT([sizeof (size_t) <= sizeof (unsigned int)], fits_in_uint, |
36 | [#include <stddef.h>], result=?) | 34 | [#include <stddef.h>], result=?) |
... | @@ -50,7 +48,7 @@ Found it | ... | @@ -50,7 +48,7 @@ Found it |
50 | fi | 48 | fi |
51 | else | 49 | else |
52 | dnl Shouldn't happen, but who knows... | 50 | dnl Shouldn't happen, but who knows... |
53 | result='~(size_t)0' | 51 | result='((size_t)~(size_t)0)' |
54 | fi | 52 | fi |
55 | fi | 53 | fi |
56 | AC_MSG_RESULT([$result]) | 54 | AC_MSG_RESULT([$result]) | ... | ... |
1 | # strcase.m4 serial 1 | 1 | # strcase.m4 serial 2 |
2 | dnl Copyright (C) 2002 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 2002, 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, |
5 | dnl with or without modifications, as long as this notice is preserved. | 5 | dnl with or without modifications, as long as this notice is preserved. |
... | @@ -12,10 +12,11 @@ AC_DEFUN([gl_STRCASE], | ... | @@ -12,10 +12,11 @@ AC_DEFUN([gl_STRCASE], |
12 | 12 | ||
13 | AC_DEFUN([gl_FUNC_STRCASECMP], | 13 | AC_DEFUN([gl_FUNC_STRCASECMP], |
14 | [ | 14 | [ |
15 | MU_REPLACE_FUNCS(strcasecmp) | 15 | dnl No known system has a strcasecmp() function that works correctly in |
16 | if test $ac_cv_func_strcasecmp = no; then | 16 | dnl multibyte locales. Therefore we use our version always. |
17 | gl_PREREQ_STRCASECMP | 17 | MU_LIBOBJ(strcasecmp) |
18 | fi | 18 | AC_DEFINE(strcasecmp, rpl_strcasecmp, [Define to rpl_strcasecmp always.]) |
19 | gl_PREREQ_STRCASECMP | ||
19 | ]) | 20 | ]) |
20 | 21 | ||
21 | AC_DEFUN([gl_FUNC_STRNCASECMP], | 22 | AC_DEFUN([gl_FUNC_STRNCASECMP], |
... | @@ -28,7 +29,7 @@ AC_DEFUN([gl_FUNC_STRNCASECMP], | ... | @@ -28,7 +29,7 @@ AC_DEFUN([gl_FUNC_STRNCASECMP], |
28 | 29 | ||
29 | # Prerequisites of lib/strcasecmp.c. | 30 | # Prerequisites of lib/strcasecmp.c. |
30 | AC_DEFUN([gl_PREREQ_STRCASECMP], [ | 31 | AC_DEFUN([gl_PREREQ_STRCASECMP], [ |
31 | : | 32 | gl_FUNC_MBRTOWC |
32 | ]) | 33 | ]) |
33 | 34 | ||
34 | # Prerequisites of lib/strncasecmp.c. | 35 | # Prerequisites of lib/strncasecmp.c. | ... | ... |
1 | # strndup.m4 serial 3 | 1 | # strndup.m4 serial 5 |
2 | dnl Copyright (C) 2002, 2003 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 2002, 2003, 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, |
5 | dnl with or without modifications, as long as this notice is preserved. | 5 | dnl with or without modifications, as long as this notice is preserved. |
6 | 6 | ||
7 | AC_DEFUN([gl_FUNC_STRNDUP], | 7 | AC_DEFUN([gl_FUNC_STRNDUP], |
8 | [ | 8 | [ |
9 | MU_LIBSOURCES([strndup.c, strndup.h]) | ||
10 | |||
9 | dnl Persuade glibc <string.h> to declare strndup(). | 11 | dnl Persuade glibc <string.h> to declare strndup(). |
10 | AC_REQUIRE([AC_GNU_SOURCE]) | 12 | AC_REQUIRE([AC_GNU_SOURCE]) |
11 | 13 | ||
... | @@ -16,6 +18,4 @@ AC_DEFUN([gl_FUNC_STRNDUP], | ... | @@ -16,6 +18,4 @@ AC_DEFUN([gl_FUNC_STRNDUP], |
16 | ]) | 18 | ]) |
17 | 19 | ||
18 | # Prerequisites of lib/strndup.c. | 20 | # Prerequisites of lib/strndup.c. |
19 | AC_DEFUN([gl_PREREQ_STRNDUP], [ | 21 | AC_DEFUN([gl_PREREQ_STRNDUP], [:]) |
20 | AC_CHECK_DECLS(strnlen) | ||
21 | ]) | ... | ... |
1 | # strnlen.m4 serial 4 | 1 | # strnlen.m4 serial 5 |
2 | dnl Copyright (C) 2002-2003 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 2002-2003, 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, |
5 | dnl with or without modifications, as long as this notice is preserved. | 5 | dnl with or without modifications, as long as this notice is preserved. |
6 | 6 | ||
7 | AC_DEFUN([gl_FUNC_STRNLEN], | 7 | AC_DEFUN([gl_FUNC_STRNLEN], |
8 | [ | 8 | [ |
9 | MU_LIBSOURCES([strnlen.c, strnlen.h]) | ||
10 | |||
9 | dnl Persuade glibc <string.h> to declare strnlen(). | 11 | dnl Persuade glibc <string.h> to declare strnlen(). |
10 | AC_REQUIRE([AC_GNU_SOURCE]) | 12 | AC_REQUIRE([AC_GNU_SOURCE]) |
11 | 13 | ||
... | @@ -22,4 +24,6 @@ AC_DEFUN([gl_FUNC_STRNLEN], | ... | @@ -22,4 +24,6 @@ AC_DEFUN([gl_FUNC_STRNLEN], |
22 | ]) | 24 | ]) |
23 | 25 | ||
24 | # Prerequisites of lib/strnlen.c. | 26 | # Prerequisites of lib/strnlen.c. |
25 | AC_DEFUN([gl_PREREQ_STRNLEN], [:]) | 27 | AC_DEFUN([gl_PREREQ_STRNLEN], [ |
28 | AC_CHECK_DECLS_ONCE(strnlen) | ||
29 | ]) | ... | ... |
1 | # unlocked-io.m4 serial 11 | 1 | # unlocked-io.m4 serial 12 |
2 | 2 | ||
3 | # Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free Software | 3 | # Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software |
4 | # Foundation, Inc. | 4 | # Foundation, Inc. |
5 | # | 5 | # |
6 | # This file is free software; the Free Software Foundation | 6 | # This file is free software; the Free Software Foundation |
... | @@ -17,6 +17,8 @@ dnl on Solaris 2.6). | ... | @@ -17,6 +17,8 @@ dnl on Solaris 2.6). |
17 | 17 | ||
18 | AC_DEFUN([gl_FUNC_GLIBC_UNLOCKED_IO], | 18 | AC_DEFUN([gl_FUNC_GLIBC_UNLOCKED_IO], |
19 | [ | 19 | [ |
20 | MU_LIBSOURCES([unlocked-io.h]) | ||
21 | |||
20 | AC_DEFINE([USE_UNLOCKED_IO], 1, | 22 | AC_DEFINE([USE_UNLOCKED_IO], 1, |
21 | [Define to 1 if you want getc etc. to use unlocked I/O if available. | 23 | [Define to 1 if you want getc etc. to use unlocked I/O if available. |
22 | Unlocked I/O can improve performance in unithreaded apps, | 24 | Unlocked I/O can improve performance in unithreaded apps, | ... | ... |
1 | # wchar_t.m4 serial 1 (gettext-0.12) | 1 | # wchar_t.m4 serial 1 (gettext-0.12) |
2 | dnl Copyright (C) 2002-2003 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 2002-2003 Free Software Foundation, Inc. |
3 | dnl This file is free software, distributed under the terms of the GNU | 3 | dnl This file is free software; the Free Software Foundation |
4 | dnl General Public License. As a special exception to the GNU General | 4 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl Public License, this file may be distributed as part of a program | 5 | dnl with or without modifications, as long as this notice is preserved. |
6 | dnl that contains a configuration script generated by Autoconf, under | ||
7 | dnl the same distribution terms as the rest of that program. | ||
8 | 6 | ||
9 | dnl From Bruno Haible. | 7 | dnl From Bruno Haible. |
10 | dnl Test whether <stddef.h> has the 'wchar_t' type. | 8 | dnl Test whether <stddef.h> has the 'wchar_t' type. | ... | ... |
1 | # wint_t.m4 serial 1 (gettext-0.12) | 1 | # wint_t.m4 serial 1 (gettext-0.12) |
2 | dnl Copyright (C) 2003 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 2003 Free Software Foundation, Inc. |
3 | dnl This file is free software, distributed under the terms of the GNU | 3 | dnl This file is free software; the Free Software Foundation |
4 | dnl General Public License. As a special exception to the GNU General | 4 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl Public License, this file may be distributed as part of a program | 5 | dnl with or without modifications, as long as this notice is preserved. |
6 | dnl that contains a configuration script generated by Autoconf, under | ||
7 | dnl the same distribution terms as the rest of that program. | ||
8 | 6 | ||
9 | dnl From Bruno Haible. | 7 | dnl From Bruno Haible. |
10 | dnl Test whether <wchar.h> has the 'wint_t' type. | 8 | dnl Test whether <wchar.h> has the 'wint_t' type. | ... | ... |
1 | # xalloc.m4 serial 11 | 1 | # xalloc.m4 serial 12 |
2 | dnl Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 2002, 2003, 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, |
5 | dnl with or without modifications, as long as this notice is preserved. | 5 | dnl with or without modifications, as long as this notice is preserved. |
6 | 6 | ||
7 | AC_DEFUN([gl_XALLOC], | 7 | AC_DEFUN([gl_XALLOC], |
8 | [ | 8 | [ |
9 | AC_LIBSOURCES([xmalloc.c, xalloc.h]) | ||
10 | AC_LIBOBJ([xmalloc]) | ||
11 | |||
9 | gl_PREREQ_XALLOC | 12 | gl_PREREQ_XALLOC |
10 | gl_PREREQ_XMALLOC | 13 | gl_PREREQ_XMALLOC |
11 | ]) | 14 | ]) | ... | ... |
1 | # xsize.m4 serial 2 | 1 | # xsize.m4 serial 3 |
2 | dnl Copyright (C) 2003 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 2003-2004 Free Software Foundation, Inc. |
3 | dnl This file is free software, distributed under the terms of the GNU | 3 | dnl This file is free software; the Free Software Foundation |
4 | dnl General Public License. As a special exception to the GNU General | 4 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl Public License, this file may be distributed as part of a program | 5 | dnl with or without modifications, as long as this notice is preserved. |
6 | dnl that contains a configuration script generated by Autoconf, under | ||
7 | dnl the same distribution terms as the rest of that program. | ||
8 | 6 | ||
9 | AC_DEFUN([gl_XSIZE], | 7 | AC_DEFUN([gl_XSIZE], |
10 | [ | 8 | [ |
11 | dnl Prerequisites of lib/xsize.h. | 9 | dnl Prerequisites of lib/xsize.h. |
12 | AC_REQUIRE([gl_SIZE_MAX]) | 10 | AC_REQUIRE([gl_SIZE_MAX]) |
11 | AC_REQUIRE([AC_C_INLINE]) | ||
13 | AC_CHECK_HEADERS(stdint.h) | 12 | AC_CHECK_HEADERS(stdint.h) |
14 | ]) | 13 | ]) | ... | ... |
1 | # xstrtol.m4 serial 5 | 1 | #serial 7 |
2 | dnl Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 2002, 2003, 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, |
5 | dnl with or without modifications, as long as this notice is preserved. | 5 | dnl with or without modifications, as long as this notice is preserved. |
6 | 6 | ||
7 | AC_DEFUN([gl_XSTRTOL], | 7 | AC_DEFUN([gl_XSTRTOL], |
8 | [ | 8 | [ |
9 | AC_LIBSOURCES([xstrtol.c, xstrtol.h, xstrtoul.c, intprops.h]) | ||
10 | AC_LIBOBJ([xstrtol]) | ||
11 | AC_LIBOBJ([xstrtoul]) | ||
12 | |||
9 | AC_REQUIRE([gl_PREREQ_XSTRTOL]) | 13 | AC_REQUIRE([gl_PREREQ_XSTRTOL]) |
10 | AC_REQUIRE([gl_PREREQ_XSTRTOUL]) | 14 | AC_REQUIRE([gl_PREREQ_XSTRTOUL]) |
11 | ]) | 15 | ]) | ... | ... |
... | @@ -111,9 +111,8 @@ libmailutils_la_LDFLAGS = -version-info 0:0:0 | ... | @@ -111,9 +111,8 @@ libmailutils_la_LDFLAGS = -version-info 0:0:0 |
111 | BUILT_SOURCES += $(ALLOCA_H) | 111 | BUILT_SOURCES += $(ALLOCA_H) |
112 | EXTRA_DIST += alloca_.h | 112 | EXTRA_DIST += alloca_.h |
113 | 113 | ||
114 | # We need the following in order to create an <alloca.h> when the system | 114 | # We need the following in order to create <alloca.h> when the system |
115 | # doesn't have one that works with the given compiler. | 115 | # doesn't have one that works with the given compiler. |
116 | all-local $(libmailutils_la_OBJECTS): $(ALLOCA_H) | ||
117 | alloca.h: alloca_.h | 116 | alloca.h: alloca_.h |
118 | cp $(srcdir)/alloca_.h $@-t | 117 | cp $(srcdir)/alloca_.h $@-t |
119 | mv $@-t $@ | 118 | mv $@-t $@ |
... | @@ -123,22 +122,18 @@ libmailutils_la_SOURCES += argp.h argp-ba.c argp-eexst.c \ | ... | @@ -123,22 +122,18 @@ libmailutils_la_SOURCES += argp.h argp-ba.c argp-eexst.c \ |
123 | argp-fmtstream.c argp-fmtstream.h argp-fs-xinl.c argp-help.c \ | 122 | argp-fmtstream.c argp-fmtstream.h argp-fs-xinl.c argp-help.c \ |
124 | argp-namefrob.h argp-parse.c argp-pv.c argp-pvh.c argp-xinl.c | 123 | argp-namefrob.h argp-parse.c argp-pv.c argp-pvh.c argp-xinl.c |
125 | 124 | ||
126 | libmailutils_la_SOURCES += getline.h | ||
127 | EXTRA_DIST += getndelim2.h getndelim2.c | ||
128 | 125 | ||
129 | libmailutils_la_SOURCES += regex.h | ||
130 | 126 | ||
131 | libmailutils_la_SOURCES += strtok_r.h | 127 | libmailutils_la_SOURCES += strtok_r.h |
132 | 128 | ||
133 | libmailutils_la_SOURCES += md5.h md5.c | 129 | |
134 | 130 | ||
135 | 131 | ||
136 | BUILT_SOURCES += $(GETOPT_H) | 132 | BUILT_SOURCES += $(GETOPT_H) |
137 | EXTRA_DIST += getopt_.h getopt_int.h | 133 | EXTRA_DIST += getopt_.h getopt_int.h |
138 | 134 | ||
139 | # We need the following in order to create an <getopt.h> when the system | 135 | # We need the following in order to create <getopt.h> when the system |
140 | # doesn't have one that works with the given compiler. | 136 | # doesn't have one that works with the given compiler. |
141 | all-local $(libmailutils_la_OBJECTS): $(GETOPT_H) | ||
142 | getopt.h: getopt_.h | 137 | getopt.h: getopt_.h |
143 | cp $(srcdir)/getopt_.h $@-t | 138 | cp $(srcdir)/getopt_.h $@-t |
144 | mv $@-t $@ | 139 | mv $@-t $@ |
... | @@ -146,28 +141,42 @@ MOSTLYCLEANFILES += getopt.h getopt.h-t | ... | @@ -146,28 +141,42 @@ MOSTLYCLEANFILES += getopt.h getopt.h-t |
146 | 141 | ||
147 | libmailutils_la_SOURCES += gettext.h | 142 | libmailutils_la_SOURCES += gettext.h |
148 | 143 | ||
144 | libmailutils_la_SOURCES += mbchar.h mbchar.c | ||
145 | |||
146 | |||
149 | 147 | ||
150 | libmailutils_la_SOURCES += minmax.h | 148 | libmailutils_la_SOURCES += minmax.h |
151 | 149 | ||
152 | 150 | ||
151 | |||
152 | BUILT_SOURCES += $(STDBOOL_H) | ||
153 | EXTRA_DIST += stdbool_.h | ||
154 | |||
155 | # We need the following in order to create <stdbool.h> when the system | ||
156 | # doesn't have one that works. | ||
157 | stdbool.h: stdbool_.h | ||
158 | sed -e 's/@''HAVE__BOOL''@/$(HAVE__BOOL)/g' < $(srcdir)/stdbool_.h > $@-t | ||
159 | mv $@-t $@ | ||
160 | MOSTLYCLEANFILES += stdbool.h stdbool.h-t | ||
161 | |||
153 | libmailutils_la_SOURCES += strcase.h | 162 | libmailutils_la_SOURCES += strcase.h |
154 | 163 | ||
155 | libmailutils_la_SOURCES += strchrnul.h | 164 | libmailutils_la_SOURCES += strchrnul.h |
156 | 165 | ||
157 | libmailutils_la_SOURCES += strndup.h | ||
158 | 166 | ||
159 | 167 | ||
168 | libmailutils_la_SOURCES += strnlen1.h strnlen1.c | ||
169 | |||
170 | BUILT_SOURCES += $(SYSEXITS_H) | ||
160 | EXTRA_DIST += sysexit_.h | 171 | EXTRA_DIST += sysexit_.h |
161 | 172 | ||
162 | # We need the following in order to create a <sysexits.h> when the system | 173 | # We need the following in order to create <sysexits.h> when the system |
163 | # doesn't have one that works with the given compiler. | 174 | # doesn't have one that works with the given compiler. |
164 | all-local $(libmailutils_la_OBJECTS): $(SYSEXITS_H) | ||
165 | sysexits.h: sysexit_.h | 175 | sysexits.h: sysexit_.h |
166 | cp $(srcdir)/sysexit_.h sysexits.h-t | 176 | cp $(srcdir)/sysexit_.h sysexits.h-t |
167 | mv sysexits.h-t sysexits.h | 177 | mv sysexits.h-t sysexits.h |
168 | MOSTLYCLEANFILES += sysexits.h sysexits.h-t | 178 | MOSTLYCLEANFILES += sysexits.h sysexits.h-t |
169 | 179 | ||
170 | libmailutils_la_SOURCES += unlocked-io.h | ||
171 | 180 | ||
172 | libmailutils_la_SOURCES += printf-args.h printf-parse.h vasnprintf.h | 181 | libmailutils_la_SOURCES += printf-args.h printf-parse.h vasnprintf.h |
173 | 182 | ||
... | @@ -175,4 +184,4 @@ libmailutils_la_SOURCES += vsnprintf.h | ... | @@ -175,4 +184,4 @@ libmailutils_la_SOURCES += vsnprintf.h |
175 | 184 | ||
176 | libmailutils_la_SOURCES += xsize.h | 185 | libmailutils_la_SOURCES += xsize.h |
177 | 186 | ||
178 | EXTRA_DIST += regex.c getline.c getline.c getndelim2.c getndelim2.c getopt.c getopt1.c mempcpy.c mempcpy.h mempcpy.c strcasecmp.c strncasecmp.c strchrnul.c strndup.c strnlen.c strtok_r.c vasnprintf.c printf-args.c printf-parse.c asnprintf.c vsnprintf.c | 187 | EXTRA_DIST += getdelim.c getdelim.h getdelim.c getopt.c getopt1.c md5.c md5.h md5.c memchr.c mempcpy.c mempcpy.h mempcpy.c vasnprintf.c printf-args.c printf-parse.c asnprintf.c getline.c getline.c getline.h getline.c getndelim2.c vsnprintf.c unlocked-io.h strchrnul.c regex.c strcasecmp.c strncasecmp.c strndup.c strndup.h strndup.c strnlen.c strnlen.h strnlen.c strtok_r.c | ... | ... |
... | @@ -14,9 +14,9 @@ | ... | @@ -14,9 +14,9 @@ |
14 | General Public License for more details. | 14 | General Public License for more details. |
15 | 15 | ||
16 | You should have received a copy of the GNU General Public | 16 | You should have received a copy of the GNU General Public |
17 | License along with this program; if not, write to the Free | 17 | License along with this program; if not, write to the Free Software |
18 | Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 18 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, |
19 | Boston, MA 02110-1301 USA. */ | 19 | USA. */ |
20 | 20 | ||
21 | /* Avoid using the symbol _ALLOCA_H here, as Bison assumes _ALLOCA_H | 21 | /* Avoid using the symbol _ALLOCA_H here, as Bison assumes _ALLOCA_H |
22 | means there is a real alloca function. */ | 22 | means there is a real alloca function. */ | ... | ... |
... | @@ -14,9 +14,9 @@ | ... | @@ -14,9 +14,9 @@ |
14 | General Public License for more details. | 14 | General Public License for more details. |
15 | 15 | ||
16 | You should have received a copy of the GNU General Public | 16 | You should have received a copy of the GNU General Public |
17 | License along with this program; if not, write to the Free | 17 | License along with this program; if not, write to the Free Software |
18 | Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 18 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, |
19 | Boston, MA 02110-1301 USA. */ | 19 | USA. */ |
20 | 20 | ||
21 | /* Avoid using the symbol _ALLOCA_H here, as Bison assumes _ALLOCA_H | 21 | /* Avoid using the symbol _ALLOCA_H here, as Bison assumes _ALLOCA_H |
22 | means there is a real alloca function. */ | 22 | means there is a real alloca function. */ | ... | ... |
... | @@ -13,10 +13,9 @@ | ... | @@ -13,10 +13,9 @@ |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 | GNU General Public License for more details. | 14 | GNU General Public License for more details. |
15 | 15 | ||
16 | You should have received a copy of the GNU General Public | 16 | You should have received a copy of the GNU General Public License along |
17 | License along with this program; if not, write to the Free | 17 | with this program; if not, write to the Free Software Foundation, |
18 | Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 18 | Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ |
19 | Boston, MA 02110-1301 USA. */ | ||
20 | 19 | ||
21 | /* If set by the user program, it should point to string that is the | 20 | /* If set by the user program, it should point to string that is the |
22 | bug-reporting address for the program. It will be printed by argp_help if | 21 | bug-reporting address for the program. It will be printed by argp_help if | ... | ... |
... | @@ -13,10 +13,9 @@ | ... | @@ -13,10 +13,9 @@ |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 | GNU General Public License for more details. | 14 | GNU General Public License for more details. |
15 | 15 | ||
16 | You should have received a copy of the GNU General Public | 16 | You should have received a copy of the GNU General Public License along |
17 | License along with this program; if not, write to the Free | 17 | with this program; if not, write to the Free Software Foundation, |
18 | Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 18 | Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ |
19 | Boston, MA 02110-1301 USA. */ | ||
20 | 19 | ||
21 | #ifdef HAVE_CONFIG_H | 20 | #ifdef HAVE_CONFIG_H |
22 | #include <config.h> | 21 | #include <config.h> | ... | ... |
1 | /* Word-wrapping and line-truncating streams | 1 | /* Word-wrapping and line-truncating streams |
2 | Copyright (C) 1997,1998,1999,2001,2002,2003 Free Software Foundation, Inc. | 2 | Copyright (C) 1997-1999,2001,2002,2003,2005 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 | ||
... | @@ -13,10 +13,9 @@ | ... | @@ -13,10 +13,9 @@ |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 | GNU General Public License for more details. | 14 | GNU General Public License for more details. |
15 | 15 | ||
16 | You should have received a copy of the GNU General Public | 16 | You should have received a copy of the GNU General Public License along |
17 | License along with this program; if not, write to the Free | 17 | with this program; if not, write to the Free Software Foundation, |
18 | Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 18 | Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ |
19 | Boston, MA 02110-1301 USA. */ | ||
20 | 19 | ||
21 | /* This package emulates glibc `line_wrap_stream' semantics for systems that | 20 | /* This package emulates glibc `line_wrap_stream' semantics for systems that |
22 | don't have that. */ | 21 | don't have that. */ |
... | @@ -102,11 +101,10 @@ __argp_fmtstream_free (argp_fmtstream_t fs) | ... | @@ -102,11 +101,10 @@ __argp_fmtstream_free (argp_fmtstream_t fs) |
102 | if (fs->p > fs->buf) | 101 | if (fs->p > fs->buf) |
103 | { | 102 | { |
104 | #ifdef USE_IN_LIBIO | 103 | #ifdef USE_IN_LIBIO |
105 | if (_IO_fwide (fs->stream, 0) > 0) | 104 | __fxprintf (fs->stream, "%.*s", (int) (fs->p - fs->buf), fs->buf); |
106 | __fwprintf (fs->stream, L"%.*s", (int) (fs->p - fs->buf), fs->buf); | 105 | #else |
107 | else | 106 | fwrite_unlocked (fs->buf, 1, fs->p - fs->buf, fs->stream); |
108 | #endif | 107 | #endif |
109 | fwrite_unlocked (fs->buf, 1, fs->p - fs->buf, fs->stream); | ||
110 | } | 108 | } |
111 | free (fs->buf); | 109 | free (fs->buf); |
112 | free (fs); | 110 | free (fs); |
... | @@ -291,17 +289,15 @@ __argp_fmtstream_update (argp_fmtstream_t fs) | ... | @@ -291,17 +289,15 @@ __argp_fmtstream_update (argp_fmtstream_t fs) |
291 | else | 289 | else |
292 | /* Output the first line so we can use the space. */ | 290 | /* Output the first line so we can use the space. */ |
293 | { | 291 | { |
294 | #ifdef USE_IN_LIBIO | 292 | #ifdef _LIBC |
295 | if (_IO_fwide (fs->stream, 0) > 0) | 293 | __fxprintf (fs->stream, "%.*s\n", |
296 | __fwprintf (fs->stream, L"%.*s\n", | 294 | (int) (nl - fs->buf), fs->buf); |
297 | (int) (nl - fs->buf), fs->buf); | 295 | #else |
298 | else | 296 | if (nl > fs->buf) |
297 | fwrite_unlocked (fs->buf, 1, nl - fs->buf, fs->stream); | ||
298 | putc_unlocked ('\n', fs->stream); | ||
299 | #endif | 299 | #endif |
300 | { | 300 | |
301 | if (nl > fs->buf) | ||
302 | fwrite_unlocked (fs->buf, 1, nl - fs->buf, fs->stream); | ||
303 | putc_unlocked ('\n', fs->stream); | ||
304 | } | ||
305 | len += buf - fs->buf; | 301 | len += buf - fs->buf; |
306 | nl = buf = fs->buf; | 302 | nl = buf = fs->buf; |
307 | } | 303 | } |
... | @@ -360,15 +356,12 @@ __argp_fmtstream_ensure (struct argp_fmtstream *fs, size_t amount) | ... | @@ -360,15 +356,12 @@ __argp_fmtstream_ensure (struct argp_fmtstream *fs, size_t amount) |
360 | /* Flush FS's buffer. */ | 356 | /* Flush FS's buffer. */ |
361 | __argp_fmtstream_update (fs); | 357 | __argp_fmtstream_update (fs); |
362 | 358 | ||
363 | #ifdef USE_IN_LIBIO | 359 | #ifdef _LIBC |
364 | if (_IO_fwide (fs->stream, 0) > 0) | 360 | __fxprintf (fs->stream, "%.*s", (int) (fs->p - fs->buf), fs->buf); |
365 | { | 361 | wrote = fs->p - fs->buf; |
366 | __fwprintf (fs->stream, L"%.*s", (int) (fs->p - fs->buf), fs->buf); | 362 | #else |
367 | wrote = fs->p - fs->buf; | 363 | wrote = fwrite_unlocked (fs->buf, 1, fs->p - fs->buf, fs->stream); |
368 | } | ||
369 | else | ||
370 | #endif | 364 | #endif |
371 | wrote = fwrite_unlocked (fs->buf, 1, fs->p - fs->buf, fs->stream); | ||
372 | if (wrote == fs->p - fs->buf) | 365 | if (wrote == fs->p - fs->buf) |
373 | { | 366 | { |
374 | fs->p = fs->buf; | 367 | fs->p = fs->buf; | ... | ... |
... | @@ -13,10 +13,9 @@ | ... | @@ -13,10 +13,9 @@ |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 | GNU General Public License for more details. | 14 | GNU General Public License for more details. |
15 | 15 | ||
16 | You should have received a copy of the GNU General Public | 16 | You should have received a copy of the GNU General Public License along |
17 | License along with this program; if not, write to the Free | 17 | with this program; if not, write to the Free Software Foundation, |
18 | Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 18 | Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ |
19 | Boston, MA 02110-1301 USA. */ | ||
20 | 19 | ||
21 | /* This package emulates glibc `line_wrap_stream' semantics for systems that | 20 | /* This package emulates glibc `line_wrap_stream' semantics for systems that |
22 | don't have that. If the system does have it, it is just a wrapper for | 21 | don't have that. If the system does have it, it is just a wrapper for | ... | ... |
... | @@ -13,10 +13,9 @@ | ... | @@ -13,10 +13,9 @@ |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 | GNU General Public License for more details. | 14 | GNU General Public License for more details. |
15 | 15 | ||
16 | You should have received a copy of the GNU General Public | 16 | You should have received a copy of the GNU General Public License along |
17 | License along with this program; if not, write to the Free | 17 | with this program; if not, write to the Free Software Foundation, |
18 | Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 18 | Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ |
19 | Boston, MA 02110-1301 USA. */ | ||
20 | 19 | ||
21 | #ifdef HAVE_CONFIG_H | 20 | #ifdef HAVE_CONFIG_H |
22 | #include <config.h> | 21 | #include <config.h> | ... | ... |
... | @@ -13,10 +13,9 @@ | ... | @@ -13,10 +13,9 @@ |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 | GNU General Public License for more details. | 14 | GNU General Public License for more details. |
15 | 15 | ||
16 | You should have received a copy of the GNU General Public | 16 | You should have received a copy of the GNU General Public License along |
17 | License along with this program; if not, write to the Free | 17 | with this program; if not, write to the Free Software Foundation, |
18 | Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 18 | Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ |
19 | Boston, MA 02110-1301 USA. */ | ||
20 | 19 | ||
21 | #ifndef _GNU_SOURCE | 20 | #ifndef _GNU_SOURCE |
22 | # define _GNU_SOURCE 1 | 21 | # define _GNU_SOURCE 1 | ... | ... |
... | @@ -13,10 +13,9 @@ | ... | @@ -13,10 +13,9 @@ |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 | GNU General Public License for more details. | 14 | GNU General Public License for more details. |
15 | 15 | ||
16 | You should have received a copy of the GNU General Public | 16 | You should have received a copy of the GNU General Public License along |
17 | License along with this program; if not, write to the Free | 17 | with this program; if not, write to the Free Software Foundation, |
18 | Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 18 | Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ |
19 | Boston, MA 02110-1301 USA. */ | ||
20 | 19 | ||
21 | #if !_LIBC | 20 | #if !_LIBC |
22 | /* This code is written for inclusion in gnu-libc, and uses names in the | 21 | /* This code is written for inclusion in gnu-libc, and uses names in the | ... | ... |
... | @@ -13,10 +13,9 @@ | ... | @@ -13,10 +13,9 @@ |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 | GNU General Public License for more details. | 14 | GNU General Public License for more details. |
15 | 15 | ||
16 | You should have received a copy of the GNU General Public | 16 | You should have received a copy of the GNU General Public License along |
17 | License along with this program; if not, write to the Free | 17 | with this program; if not, write to the Free Software Foundation, |
18 | Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 18 | Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ |
19 | Boston, MA 02110-1301 USA. */ | ||
20 | 19 | ||
21 | #ifdef HAVE_CONFIG_H | 20 | #ifdef HAVE_CONFIG_H |
22 | #include <config.h> | 21 | #include <config.h> | ... | ... |
... | @@ -13,10 +13,9 @@ | ... | @@ -13,10 +13,9 @@ |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 | GNU General Public License for more details. | 14 | GNU General Public License for more details. |
15 | 15 | ||
16 | You should have received a copy of the GNU General Public | 16 | You should have received a copy of the GNU General Public License along |
17 | License along with this program; if not, write to the Free | 17 | with this program; if not, write to the Free Software Foundation, |
18 | Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 18 | Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ |
19 | Boston, MA 02110-1301 USA. */ | ||
20 | 19 | ||
21 | /* If set by the user program to a non-zero value, then a default option | 20 | /* If set by the user program to a non-zero value, then a default option |
22 | --version is added (unless the ARGP_NO_HELP flag is used), which will | 21 | --version is added (unless the ARGP_NO_HELP flag is used), which will | ... | ... |
... | @@ -13,10 +13,9 @@ | ... | @@ -13,10 +13,9 @@ |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 | GNU General Public License for more details. | 14 | GNU General Public License for more details. |
15 | 15 | ||
16 | You should have received a copy of the GNU General Public | 16 | You should have received a copy of the GNU General Public License along |
17 | License along with this program; if not, write to the Free | 17 | with this program; if not, write to the Free Software Foundation, |
18 | Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 18 | Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ |
19 | Boston, MA 02110-1301 USA. */ | ||
20 | 19 | ||
21 | #ifdef HAVE_CONFIG_H | 20 | #ifdef HAVE_CONFIG_H |
22 | #include <config.h> | 21 | #include <config.h> | ... | ... |
... | @@ -13,10 +13,9 @@ | ... | @@ -13,10 +13,9 @@ |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 | GNU General Public License for more details. | 14 | GNU General Public License for more details. |
15 | 15 | ||
16 | You should have received a copy of the GNU General Public | 16 | You should have received a copy of the GNU General Public License along |
17 | License along with this program; if not, write to the Free | 17 | with this program; if not, write to the Free Software Foundation, |
18 | Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 18 | Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ |
19 | Boston, MA 02110-1301 USA. */ | ||
20 | 19 | ||
21 | #ifdef HAVE_CONFIG_H | 20 | #ifdef HAVE_CONFIG_H |
22 | #include <config.h> | 21 | #include <config.h> | ... | ... |
... | @@ -13,10 +13,9 @@ | ... | @@ -13,10 +13,9 @@ |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 | GNU General Public License for more details. | 14 | GNU General Public License for more details. |
15 | 15 | ||
16 | You should have received a copy of the GNU General Public | 16 | You should have received a copy of the GNU General Public License along |
17 | License along with this program; if not, write to the Free | 17 | with this program; if not, write to the Free Software Foundation, |
18 | Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 18 | Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ |
19 | Boston, MA 02110-1301 USA. */ | ||
20 | 19 | ||
21 | #ifndef _ARGP_H | 20 | #ifndef _ARGP_H |
22 | #define _ARGP_H | 21 | #define _ARGP_H |
... | @@ -24,6 +23,7 @@ | ... | @@ -24,6 +23,7 @@ |
24 | #include <stdio.h> | 23 | #include <stdio.h> |
25 | #include <ctype.h> | 24 | #include <ctype.h> |
26 | #include <getopt.h> | 25 | #include <getopt.h> |
26 | #include <limits.h> | ||
27 | 27 | ||
28 | #define __need_error_t | 28 | #define __need_error_t |
29 | #include <errno.h> | 29 | #include <errno.h> |
... | @@ -580,7 +580,7 @@ __NTH (__option_is_short (__const struct argp_option *__opt)) | ... | @@ -580,7 +580,7 @@ __NTH (__option_is_short (__const struct argp_option *__opt)) |
580 | else | 580 | else |
581 | { | 581 | { |
582 | int __key = __opt->key; | 582 | int __key = __opt->key; |
583 | return __key > 0 && isprint (__key); | 583 | return __key > 0 && __key <= UCHAR_MAX && isprint (__key); |
584 | } | 584 | } |
585 | } | 585 | } |
586 | 586 | ... | ... |
... | @@ -11,10 +11,9 @@ | ... | @@ -11,10 +11,9 @@ |
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 | GNU General Public License for more details. | 12 | GNU General Public License for more details. |
13 | 13 | ||
14 | You should have received a copy of the GNU General Public | 14 | You should have received a copy of the GNU General Public License along |
15 | License along with this program; if not, write to the Free | 15 | with this program; if not, write to the Free Software Foundation, |
16 | Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 16 | Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ |
17 | Boston, MA 02110-1301 USA. */ | ||
18 | 17 | ||
19 | #ifdef HAVE_CONFIG_H | 18 | #ifdef HAVE_CONFIG_H |
20 | # include <config.h> | 19 | # include <config.h> | ... | ... |
1 | /* getline.c -- Replacement for GNU C library function getline | 1 | /* getline.c --- Implementation of replacement getline function. |
2 | Copyright (C) 2005 Free Software Foundation, Inc. | ||
2 | 3 | ||
3 | Copyright (C) 1993, 1996, 1997, 1998, 2000, 2003, 2004 Free | 4 | This program is free software; you can redistribute it and/or |
4 | Software Foundation, Inc. | 5 | modify it under the terms of the GNU General Public License as |
6 | published by the Free Software Foundation; either version 2, or (at | ||
7 | your option) any later version. | ||
5 | 8 | ||
6 | This program is free software; you can redistribute it and/or modify | 9 | This program is distributed in the hope that it will be useful, but |
7 | it under the terms of the GNU General Public License as published by | 10 | WITHOUT ANY WARRANTY; without even the implied warranty of |
8 | the Free Software Foundation; either version 2, or (at your option) | 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
9 | any later version. | 12 | General Public License for more details. |
10 | 13 | ||
11 | This program is distributed in the hope that it will be useful, | 14 | You should have received a copy of the GNU General Public License |
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 15 | along with this program; if not, write to the Free Software |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 16 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
14 | GNU General Public License for more details. | 17 | 02110-1301, USA. */ |
15 | 18 | ||
16 | You should have received a copy of the GNU General Public | 19 | /* Written by Simon Josefsson. */ |
17 | License along with this program; if not, write to the Free | ||
18 | Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
19 | Boston, MA 02110-1301 USA. */ | ||
20 | |||
21 | /* Written by Jan Brittenson, bson@gnu.ai.mit.edu. */ | ||
22 | 20 | ||
23 | #if HAVE_CONFIG_H | 21 | #if HAVE_CONFIG_H |
24 | # include <config.h> | 22 | # include <config.h> |
25 | #endif | 23 | #endif |
26 | 24 | ||
25 | #include "getdelim.h" | ||
27 | #include "getline.h" | 26 | #include "getline.h" |
28 | 27 | ||
29 | #if ! (defined __GNU_LIBRARY__ && HAVE_GETDELIM) | ||
30 | |||
31 | # include "getndelim2.h" | ||
32 | |||
33 | ssize_t | ||
34 | getdelim (char **lineptr, size_t *linesize, int delimiter, FILE *stream) | ||
35 | { | ||
36 | return getndelim2 (lineptr, linesize, 0, GETNLINE_NO_LIMIT, delimiter, EOF, | ||
37 | stream); | ||
38 | } | ||
39 | #endif | ||
40 | |||
41 | ssize_t | 28 | ssize_t |
42 | getline (char **lineptr, size_t *linesize, FILE *stream) | 29 | getline (char **lineptr, size_t *n, FILE *stream) |
43 | { | 30 | { |
44 | return getdelim (lineptr, linesize, '\n', stream); | 31 | return getdelim (lineptr, n, '\n', stream); |
45 | } | 32 | } | ... | ... |
1 | /* Replacement for GNU C library function getline | 1 | /* getline.h --- Prototype for replacement getline function. |
2 | Copyright (C) 2005 Free Software Foundation, Inc. | ||
2 | 3 | ||
3 | Copyright (C) 1995, 1997, 1999, 2000, 2001, 2002, 2003 Free | 4 | This program is free software; you can redistribute it and/or |
4 | Software Foundation, Inc. | 5 | modify it under the terms of the GNU General Public License as |
6 | published by the Free Software Foundation; either version 2, or (at | ||
7 | your option) any later version. | ||
5 | 8 | ||
6 | This program is free software; you can redistribute it and/or modify | 9 | This program is distributed in the hope that it will be useful, but |
7 | it under the terms of the GNU General Public License as published by | 10 | WITHOUT ANY WARRANTY; without even the implied warranty of |
8 | the Free Software Foundation; either version 2, or (at your option) | 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
9 | any later version. | 12 | General Public License for more details. |
10 | 13 | ||
11 | This program is distributed in the hope that it will be useful, | 14 | You should have received a copy of the GNU General Public License |
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 15 | along with this program; if not, write to the Free Software |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 16 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
14 | GNU General Public License for more details. | 17 | 02110-1301, USA. */ |
15 | 18 | ||
16 | You should have received a copy of the GNU General Public | 19 | /* Written by Simon Josefsson. */ |
17 | Licensealong with this program; if not, write to the Free | ||
18 | SoftwareFoundation, Inc., 51 Franklin Street, Fifth Floor, Boston, | ||
19 | MA 02110-1301 USA. */ | ||
20 | |||
21 | #ifndef GETLINE_H_ | ||
22 | # define GETLINE_H_ 1 | ||
23 | 20 | ||
21 | /* Get size_t, FILE, ssize_t. And getline, if available. */ | ||
24 | # include <stddef.h> | 22 | # include <stddef.h> |
25 | # include <stdio.h> | 23 | # include <stdio.h> |
26 | |||
27 | /* Get ssize_t. */ | ||
28 | # include <sys/types.h> | 24 | # include <sys/types.h> |
29 | 25 | ||
30 | /* glibc2 has these functions declared in <stdio.h>. Avoid redeclarations. */ | 26 | #if !HAVE_DECL_GETLINE |
31 | # if __GLIBC__ < 2 | 27 | ssize_t getline (char **lineptr, size_t *n, FILE *stream); |
32 | 28 | #endif /* !HAVE_GETLINE */ | |
33 | extern ssize_t getline (char **_lineptr, size_t *_linesize, FILE *_stream); | ||
34 | |||
35 | extern ssize_t getdelim (char **_lineptr, size_t *_linesize, int _delimiter, | ||
36 | FILE *_stream); | ||
37 | |||
38 | # endif | ||
39 | |||
40 | #endif /* not GETLINE_H_ */ | ... | ... |
... | @@ -16,10 +16,9 @@ | ... | @@ -16,10 +16,9 @@ |
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
17 | GNU General Public License for more details. | 17 | GNU General Public License for more details. |
18 | 18 | ||
19 | You should have received a copy of the GNU General Public | 19 | You should have received a copy of the GNU General Public License along |
20 | License along with this program; if not, write to the Free | 20 | with this program; if not, write to the Free Software Foundation, |
21 | Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 21 | Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ |
22 | Boston, MA 02110-1301 USA. */ | ||
23 | 22 | ||
24 | /* This tells Alpha OSF/1 not to define a getopt prototype in <stdio.h>. | 23 | /* This tells Alpha OSF/1 not to define a getopt prototype in <stdio.h>. |
25 | Ditto for AIX 3.2 and <stdlib.h>. */ | 24 | Ditto for AIX 3.2 and <stdlib.h>. */ | ... | ... |
... | @@ -13,10 +13,9 @@ | ... | @@ -13,10 +13,9 @@ |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 | GNU General Public License for more details. | 14 | GNU General Public License for more details. |
15 | 15 | ||
16 | You should have received a copy of the GNU General Public | 16 | You should have received a copy of the GNU General Public License along |
17 | License along with this program; if not, write to the Free | 17 | with this program; if not, write to the Free Software Foundation, |
18 | Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 18 | Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ |
19 | Boston, MA 02110-1301 USA. */ | ||
20 | 19 | ||
21 | #ifdef HAVE_CONFIG_H | 20 | #ifdef HAVE_CONFIG_H |
22 | #include <config.h> | 21 | #include <config.h> | ... | ... |
... | @@ -13,10 +13,9 @@ | ... | @@ -13,10 +13,9 @@ |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 | GNU General Public License for more details. | 14 | GNU General Public License for more details. |
15 | 15 | ||
16 | You should have received a copy of the GNU General Public | 16 | You should have received a copy of the GNU General Public License along |
17 | License along with this program; if not, write to the Free | 17 | with this program; if not, write to the Free Software Foundation, |
18 | Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 18 | Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ |
19 | Boston, MA 02110-1301 USA. */ | ||
20 | 19 | ||
21 | #ifndef _GETOPT_H | 20 | #ifndef _GETOPT_H |
22 | 21 | ... | ... |
... | @@ -13,10 +13,9 @@ | ... | @@ -13,10 +13,9 @@ |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 | GNU General Public License for more details. | 14 | GNU General Public License for more details. |
15 | 15 | ||
16 | You should have received a copy of the GNU General Public | 16 | You should have received a copy of the GNU General Public License along |
17 | License along with this program; if not, write to the Free | 17 | with this program; if not, write to the Free Software Foundation, |
18 | Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 18 | Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ |
19 | Boston, MA 02110-1301 USA. */ | ||
20 | 19 | ||
21 | #ifndef _GETOPT_INT_H | 20 | #ifndef _GETOPT_INT_H |
22 | #define _GETOPT_INT_H 1 | 21 | #define _GETOPT_INT_H 1 | ... | ... |
1 | /* Convenience header for conditional use of GNU <libintl.h>. | 1 | /* Convenience header for conditional use of GNU <libintl.h>. |
2 | Copyright (C) 1995-1998, 2000-2002 Free Software Foundation, Inc. | 2 | Copyright (C) 1995-1998, 2000-2002, 2004 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 |
... | @@ -11,10 +11,9 @@ | ... | @@ -11,10 +11,9 @@ |
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 | GNU General Public License for more details. | 12 | GNU General Public License for more details. |
13 | 13 | ||
14 | You should have received a copy of the GNU General Public | 14 | You should have received a copy of the GNU General Public License along |
15 | License along with this program; if not, write to the Free | 15 | with this program; if not, write to the Free Software Foundation, |
16 | Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 16 | Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ |
17 | Boston, MA 02110-1301 USA. */ | ||
18 | 17 | ||
19 | #ifndef _LIBGETTEXT_H | 18 | #ifndef _LIBGETTEXT_H |
20 | #define _LIBGETTEXT_H 1 | 19 | #define _LIBGETTEXT_H 1 |
... | @@ -37,6 +36,16 @@ | ... | @@ -37,6 +36,16 @@ |
37 | # include <locale.h> | 36 | # include <locale.h> |
38 | #endif | 37 | #endif |
39 | 38 | ||
39 | /* Many header files from the libstdc++ coming with g++ 3.3 or newer include | ||
40 | <libintl.h>, which chokes if dcgettext is defined as a macro. So include | ||
41 | it now, to make later inclusions of <libintl.h> a NOP. */ | ||
42 | #if defined(__cplusplus) && defined(__GNUG__) && (__GNUC__ >= 3) | ||
43 | # include <cstdlib> | ||
44 | # if (__GLIBC__ >= 2) || _GLIBCXX_HAVE_LIBINTL_H | ||
45 | # include <libintl.h> | ||
46 | # endif | ||
47 | #endif | ||
48 | |||
40 | /* Disabled NLS. | 49 | /* Disabled NLS. |
41 | The casts to 'const char *' serve the purpose of producing warnings | 50 | The casts to 'const char *' serve the purpose of producing warnings |
42 | for invalid uses of the value returned from these functions. | 51 | for invalid uses of the value returned from these functions. | ... | ... |
... | @@ -14,10 +14,9 @@ | ... | @@ -14,10 +14,9 @@ |
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
15 | GNU General Public License for more details. | 15 | GNU General Public License for more details. |
16 | 16 | ||
17 | You should have received a copy of the GNU General Public | 17 | You should have received a copy of the GNU General Public License |
18 | License along with this program; if not, write to the Free | 18 | along with this program; if not, write to the Free Software Foundation, |
19 | Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 19 | Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ |
20 | Boston, MA 02110-1301 USA. */ | ||
21 | 20 | ||
22 | /* Written by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995. */ | 21 | /* Written by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995. */ |
23 | 22 | ... | ... |
... | @@ -17,10 +17,9 @@ | ... | @@ -17,10 +17,9 @@ |
17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
18 | GNU General Public License for more details. | 18 | GNU General Public License for more details. |
19 | 19 | ||
20 | You should have received a copy of the GNU General Public | 20 | You should have received a copy of the GNU General Public License |
21 | License along with this program; if not, write to the Free | 21 | along with this program; if not, write to the Free Software Foundation, |
22 | Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 22 | Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ |
23 | Boston, MA 02110-1301 USA. */ | ||
24 | 23 | ||
25 | #ifndef _MD5_H | 24 | #ifndef _MD5_H |
26 | #define _MD5_H 1 | 25 | #define _MD5_H 1 | ... | ... |
... | @@ -11,10 +11,9 @@ | ... | @@ -11,10 +11,9 @@ |
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 | GNU General Public License for more details. | 12 | GNU General Public License for more details. |
13 | 13 | ||
14 | You should have received a copy of the GNU General Public | 14 | You should have received a copy of the GNU General Public License |
15 | License along with this program; if not, write to the Free | 15 | along with this program; if not, write to the Free Software Foundation, |
16 | Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 16 | Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ |
17 | Boston, MA 02110-1301 USA. */ | ||
18 | 17 | ||
19 | /* Specification. */ | 18 | /* Specification. */ |
20 | #include "mempcpy.h" | 19 | #include "mempcpy.h" | ... | ... |
... | @@ -11,10 +11,9 @@ | ... | @@ -11,10 +11,9 @@ |
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 | GNU General Public License for more details. | 12 | GNU General Public License for more details. |
13 | 13 | ||
14 | You should have received a copy of the GNU General Public | 14 | You should have received a copy of the GNU General Public License |
15 | License along with this program; if not, write to the Free | 15 | along with this program; if not, write to the Free Software Foundation, |
16 | Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 16 | Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ |
17 | Boston, MA 02110-1301 USA. */ | ||
18 | 17 | ||
19 | #ifndef mempcpy | 18 | #ifndef mempcpy |
20 | 19 | ... | ... |
1 | /* MIN, MAX macros. | 1 | /* MIN, MAX macros. |
2 | Copyright (C) 1995, 1998, 2001, 2003 Free Software Foundation, Inc. | 2 | Copyright (C) 1995, 1998, 2001, 2003, 2005 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 |
... | @@ -11,10 +11,9 @@ | ... | @@ -11,10 +11,9 @@ |
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 | GNU General Public License for more details. | 12 | GNU General Public License for more details. |
13 | 13 | ||
14 | You should have received a copy of the GNU General Public | 14 | You should have received a copy of the GNU General Public License |
15 | License along with this program; if not, write to the Free | 15 | along with this program; if not, write to the Free Software Foundation, |
16 | Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 16 | Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ |
17 | Boston, MA 02110-1301 USA. */ | ||
18 | 17 | ||
19 | #ifndef _MINMAX_H | 18 | #ifndef _MINMAX_H |
20 | #define _MINMAX_H | 19 | #define _MINMAX_H |
... | @@ -25,8 +24,15 @@ | ... | @@ -25,8 +24,15 @@ |
25 | #include this file as the last one among the #include list. */ | 24 | #include this file as the last one among the #include list. */ |
26 | 25 | ||
27 | /* Before we define the following symbols we get the <limits.h> file | 26 | /* Before we define the following symbols we get the <limits.h> file |
28 | since otherwise we get redefinitions on some systems. */ | 27 | since otherwise we get redefinitions on some systems if <limits.h> is |
29 | #include <limits.h> | 28 | included after this file. Likewise for <sys/param.h>. |
29 | If more than one of these system headers define MIN and MAX, pick just | ||
30 | one of the headers (because the definitions most likely are the same). */ | ||
31 | #if HAVE_MINMAX_IN_LIMITS_H | ||
32 | # include <limits.h> | ||
33 | #elif HAVE_MINMAX_IN_SYS_PARAM_H | ||
34 | # include <sys/param.h> | ||
35 | #endif | ||
30 | 36 | ||
31 | /* Note: MIN and MAX should be used with two arguments of the | 37 | /* Note: MIN and MAX should be used with two arguments of the |
32 | same type. They might not return the minimum and maximum of their two | 38 | same type. They might not return the minimum and maximum of their two | ... | ... |
... | @@ -11,10 +11,9 @@ | ... | @@ -11,10 +11,9 @@ |
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 | GNU General Public License for more details. | 12 | GNU General Public License for more details. |
13 | 13 | ||
14 | You should have received a copy of the GNU General Public | 14 | You should have received a copy of the GNU General Public License along |
15 | License along with this program; if not, write to the Free | 15 | with this program; if not, write to the Free Software Foundation, |
16 | Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 16 | Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ |
17 | Boston, MA 02110-1301 USA. */ | ||
18 | 17 | ||
19 | #ifdef HAVE_CONFIG_H | 18 | #ifdef HAVE_CONFIG_H |
20 | # include <config.h> | 19 | # include <config.h> | ... | ... |
... | @@ -11,10 +11,9 @@ | ... | @@ -11,10 +11,9 @@ |
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 | GNU General Public License for more details. | 12 | GNU General Public License for more details. |
13 | 13 | ||
14 | You should have received a copy of the GNU General Public | 14 | You should have received a copy of the GNU General Public License along |
15 | License along with this program; if not, write to the Free | 15 | with this program; if not, write to the Free Software Foundation, |
16 | Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 16 | Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ |
17 | Boston, MA 02110-1301 USA. */ | ||
18 | 17 | ||
19 | #ifndef _PRINTF_ARGS_H | 18 | #ifndef _PRINTF_ARGS_H |
20 | #define _PRINTF_ARGS_H | 19 | #define _PRINTF_ARGS_H | ... | ... |
... | @@ -11,10 +11,9 @@ | ... | @@ -11,10 +11,9 @@ |
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 | GNU General Public License for more details. | 12 | GNU General Public License for more details. |
13 | 13 | ||
14 | You should have received a copy of the GNU General Public | 14 | You should have received a copy of the GNU General Public License along |
15 | License along with this program; if not, write to the Free | 15 | with this program; if not, write to the Free Software Foundation, |
16 | Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 16 | Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ |
17 | Boston, MA 02110-1301 USA. */ | ||
18 | 17 | ||
19 | #ifdef HAVE_CONFIG_H | 18 | #ifdef HAVE_CONFIG_H |
20 | # include <config.h> | 19 | # include <config.h> | ... | ... |
... | @@ -11,10 +11,9 @@ | ... | @@ -11,10 +11,9 @@ |
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 | GNU General Public License for more details. | 12 | GNU General Public License for more details. |
13 | 13 | ||
14 | You should have received a copy of the GNU General Public | 14 | You should have received a copy of the GNU General Public License along |
15 | License along with this program; if not, write to the Free | 15 | with this program; if not, write to the Free Software Foundation, |
16 | Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 16 | Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ |
17 | Boston, MA 02110-1301 USA. */ | ||
18 | 17 | ||
19 | #ifndef _PRINTF_PARSE_H | 18 | #ifndef _PRINTF_PARSE_H |
20 | #define _PRINTF_PARSE_H | 19 | #define _PRINTF_PARSE_H | ... | ... |
This diff could not be displayed because it is too large.
... | @@ -14,10 +14,9 @@ | ... | @@ -14,10 +14,9 @@ |
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
15 | GNU General Public License for more details. | 15 | GNU General Public License for more details. |
16 | 16 | ||
17 | You should have received a copy of the GNU General Public | 17 | You should have received a copy of the GNU General Public License along |
18 | License along with this program; if not, write to the Free | 18 | with this program; if not, write to the Free Software Foundation, |
19 | Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 19 | Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ |
20 | Boston, MA 02110-1301 USA. */ | ||
21 | 20 | ||
22 | #ifndef _REGEX_H | 21 | #ifndef _REGEX_H |
23 | #define _REGEX_H 1 | 22 | #define _REGEX_H 1 |
... | @@ -170,6 +169,19 @@ typedef unsigned long int reg_syntax_t; | ... | @@ -170,6 +169,19 @@ typedef unsigned long int reg_syntax_t; |
170 | If not set, then case is significant. */ | 169 | If not set, then case is significant. */ |
171 | #define RE_ICASE (RE_INVALID_INTERVAL_ORD << 1) | 170 | #define RE_ICASE (RE_INVALID_INTERVAL_ORD << 1) |
172 | 171 | ||
172 | /* This bit is used internally like RE_CONTEXT_INDEP_ANCHORS but only | ||
173 | for ^, because it is difficult to scan the regex backwards to find | ||
174 | whether ^ should be special. */ | ||
175 | #define RE_CARET_ANCHORS_HERE (RE_ICASE << 1) | ||
176 | |||
177 | /* If this bit is set, then \{ cannot be first in an bre or | ||
178 | immediately after an alternation or begin-group operator. */ | ||
179 | #define RE_CONTEXT_INVALID_DUP (RE_CARET_ANCHORS_HERE << 1) | ||
180 | |||
181 | /* If this bit is set, then no_sub will be set to 1 during | ||
182 | re_compile_pattern. */ | ||
183 | #define RE_NO_SUB (RE_CONTEXT_INVALID_DUP << 1) | ||
184 | |||
173 | /* This global variable defines the particular regexp syntax to use (for | 185 | /* This global variable defines the particular regexp syntax to use (for |
174 | some interfaces). When a regexp is compiled, the syntax used is | 186 | some interfaces). When a regexp is compiled, the syntax used is |
175 | stored in the pattern buffer, so changing this does not affect | 187 | stored in the pattern buffer, so changing this does not affect |
... | @@ -224,7 +236,7 @@ extern reg_syntax_t re_syntax_options; | ... | @@ -224,7 +236,7 @@ extern reg_syntax_t re_syntax_options; |
224 | | RE_INTERVALS | RE_NO_EMPTY_RANGES) | 236 | | RE_INTERVALS | RE_NO_EMPTY_RANGES) |
225 | 237 | ||
226 | #define RE_SYNTAX_POSIX_BASIC \ | 238 | #define RE_SYNTAX_POSIX_BASIC \ |
227 | (_RE_SYNTAX_POSIX_COMMON | RE_BK_PLUS_QM) | 239 | (_RE_SYNTAX_POSIX_COMMON | RE_BK_PLUS_QM | RE_CONTEXT_INVALID_DUP) |
228 | 240 | ||
229 | /* Differs from ..._POSIX_BASIC only in that RE_BK_PLUS_QM becomes | 241 | /* Differs from ..._POSIX_BASIC only in that RE_BK_PLUS_QM becomes |
230 | RE_LIMITED_OPS, i.e., \? \+ \| are not recognized. Actually, this | 242 | RE_LIMITED_OPS, i.e., \? \+ \| are not recognized. Actually, this |
... | @@ -289,6 +301,10 @@ extern reg_syntax_t re_syntax_options; | ... | @@ -289,6 +301,10 @@ extern reg_syntax_t re_syntax_options; |
289 | /* Like REG_NOTBOL, except for the end-of-line. */ | 301 | /* Like REG_NOTBOL, except for the end-of-line. */ |
290 | #define REG_NOTEOL (1 << 1) | 302 | #define REG_NOTEOL (1 << 1) |
291 | 303 | ||
304 | /* Use PMATCH[0] to delimit the start and end of the search in the | ||
305 | buffer. */ | ||
306 | #define REG_STARTEND (1 << 2) | ||
307 | |||
292 | 308 | ||
293 | /* If any error codes are removed, changed, or added, update the | 309 | /* If any error codes are removed, changed, or added, update the |
294 | `re_error_msg' table in regex.c. */ | 310 | `re_error_msg' table in regex.c. */ |
... | @@ -304,7 +320,7 @@ typedef enum | ... | @@ -304,7 +320,7 @@ typedef enum |
304 | /* POSIX regcomp return error codes. (In the order listed in the | 320 | /* POSIX regcomp return error codes. (In the order listed in the |
305 | standard.) */ | 321 | standard.) */ |
306 | REG_BADPAT, /* Invalid pattern. */ | 322 | REG_BADPAT, /* Invalid pattern. */ |
307 | REG_ECOLLATE, /* Not implemented. */ | 323 | REG_ECOLLATE, /* Inalid collating element. */ |
308 | REG_ECTYPE, /* Invalid character class name. */ | 324 | REG_ECTYPE, /* Invalid character class name. */ |
309 | REG_EESCAPE, /* Trailing backslash. */ | 325 | REG_EESCAPE, /* Trailing backslash. */ |
310 | REG_ESUBREG, /* Invalid back reference. */ | 326 | REG_ESUBREG, /* Invalid back reference. */ |
... | @@ -435,21 +451,38 @@ typedef struct | ... | @@ -435,21 +451,38 @@ typedef struct |
435 | 451 | ||
436 | /* Declarations for routines. */ | 452 | /* Declarations for routines. */ |
437 | 453 | ||
454 | /* To avoid duplicating every routine declaration -- once with a | ||
455 | prototype (if we are ANSI), and once without (if we aren't) -- we | ||
456 | use the following macro to declare argument types. This | ||
457 | unfortunately clutters up the declarations a bit, but I think it's | ||
458 | worth it. */ | ||
459 | |||
460 | #if __STDC__ | ||
461 | |||
462 | # define _RE_ARGS(args) args | ||
463 | |||
464 | #else /* not __STDC__ */ | ||
465 | |||
466 | # define _RE_ARGS(args) () | ||
467 | |||
468 | #endif /* not __STDC__ */ | ||
469 | |||
438 | /* Sets the current default syntax to SYNTAX, and return the old syntax. | 470 | /* Sets the current default syntax to SYNTAX, and return the old syntax. |
439 | You can also simply assign to the `re_syntax_options' variable. */ | 471 | You can also simply assign to the `re_syntax_options' variable. */ |
440 | extern reg_syntax_t re_set_syntax (reg_syntax_t syntax); | 472 | extern reg_syntax_t re_set_syntax _RE_ARGS ((reg_syntax_t syntax)); |
441 | 473 | ||
442 | /* Compile the regular expression PATTERN, with length LENGTH | 474 | /* Compile the regular expression PATTERN, with length LENGTH |
443 | and syntax given by the global `re_syntax_options', into the buffer | 475 | and syntax given by the global `re_syntax_options', into the buffer |
444 | BUFFER. Return NULL if successful, and an error string if not. */ | 476 | BUFFER. Return NULL if successful, and an error string if not. */ |
445 | extern const char *re_compile_pattern (const char *pattern, size_t length, | 477 | extern const char *re_compile_pattern |
446 | struct re_pattern_buffer *buffer); | 478 | _RE_ARGS ((const char *pattern, size_t length, |
479 | struct re_pattern_buffer *buffer)); | ||
447 | 480 | ||
448 | 481 | ||
449 | /* Compile a fastmap for the compiled pattern in BUFFER; used to | 482 | /* Compile a fastmap for the compiled pattern in BUFFER; used to |
450 | accelerate searches. Return 0 if successful and -2 if was an | 483 | accelerate searches. Return 0 if successful and -2 if was an |
451 | internal error. */ | 484 | internal error. */ |
452 | extern int re_compile_fastmap (struct re_pattern_buffer *buffer); | 485 | extern int re_compile_fastmap _RE_ARGS ((struct re_pattern_buffer *buffer)); |
453 | 486 | ||
454 | 487 | ||
455 | /* Search in the string STRING (with length LENGTH) for the pattern | 488 | /* Search in the string STRING (with length LENGTH) for the pattern |
... | @@ -457,29 +490,31 @@ extern int re_compile_fastmap (struct re_pattern_buffer *buffer); | ... | @@ -457,29 +490,31 @@ extern int re_compile_fastmap (struct re_pattern_buffer *buffer); |
457 | characters. Return the starting position of the match, -1 for no | 490 | characters. Return the starting position of the match, -1 for no |
458 | match, or -2 for an internal error. Also return register | 491 | match, or -2 for an internal error. Also return register |
459 | information in REGS (if REGS and BUFFER->no_sub are nonzero). */ | 492 | information in REGS (if REGS and BUFFER->no_sub are nonzero). */ |
460 | extern int re_search (struct re_pattern_buffer *buffer, const char *string, | 493 | extern int re_search |
461 | int length, int start, int range, | 494 | _RE_ARGS ((struct re_pattern_buffer *buffer, const char *string, |
462 | struct re_registers *regs); | 495 | int length, int start, int range, struct re_registers *regs)); |
463 | 496 | ||
464 | 497 | ||
465 | /* Like `re_search', but search in the concatenation of STRING1 and | 498 | /* Like `re_search', but search in the concatenation of STRING1 and |
466 | STRING2. Also, stop searching at index START + STOP. */ | 499 | STRING2. Also, stop searching at index START + STOP. */ |
467 | extern int re_search_2 (struct re_pattern_buffer *buffer, const char *string1, | 500 | extern int re_search_2 |
468 | int length1, const char *string2, int length2, | 501 | _RE_ARGS ((struct re_pattern_buffer *buffer, const char *string1, |
469 | int start, int range, struct re_registers *regs, | 502 | int length1, const char *string2, int length2, |
470 | int stop); | 503 | int start, int range, struct re_registers *regs, int stop)); |
471 | 504 | ||
472 | 505 | ||
473 | /* Like `re_search', but return how many characters in STRING the regexp | 506 | /* Like `re_search', but return how many characters in STRING the regexp |
474 | in BUFFER matched, starting at position START. */ | 507 | in BUFFER matched, starting at position START. */ |
475 | extern int re_match (struct re_pattern_buffer *buffer, const char *string, | 508 | extern int re_match |
476 | int length, int start, struct re_registers *regs); | 509 | _RE_ARGS ((struct re_pattern_buffer *buffer, const char *string, |
510 | int length, int start, struct re_registers *regs)); | ||
477 | 511 | ||
478 | 512 | ||
479 | /* Relates to `re_match' as `re_search_2' relates to `re_search'. */ | 513 | /* Relates to `re_match' as `re_search_2' relates to `re_search'. */ |
480 | extern int re_match_2 (struct re_pattern_buffer *buffer, const char *string1, | 514 | extern int re_match_2 |
481 | int length1, const char *string2, int length2, | 515 | _RE_ARGS ((struct re_pattern_buffer *buffer, const char *string1, |
482 | int start, struct re_registers *regs, int stop); | 516 | int length1, const char *string2, int length2, |
517 | int start, struct re_registers *regs, int stop)); | ||
483 | 518 | ||
484 | 519 | ||
485 | /* Set REGS to hold NUM_REGS registers, storing them in STARTS and | 520 | /* Set REGS to hold NUM_REGS registers, storing them in STARTS and |
... | @@ -494,15 +529,15 @@ extern int re_match_2 (struct re_pattern_buffer *buffer, const char *string1, | ... | @@ -494,15 +529,15 @@ extern int re_match_2 (struct re_pattern_buffer *buffer, const char *string1, |
494 | Unless this function is called, the first search or match using | 529 | Unless this function is called, the first search or match using |
495 | PATTERN_BUFFER will allocate its own register data, without | 530 | PATTERN_BUFFER will allocate its own register data, without |
496 | freeing the old data. */ | 531 | freeing the old data. */ |
497 | extern void re_set_registers (struct re_pattern_buffer *buffer, | 532 | extern void re_set_registers |
498 | struct re_registers *regs, unsigned num_regs, | 533 | _RE_ARGS ((struct re_pattern_buffer *buffer, struct re_registers *regs, |
499 | regoff_t *starts, regoff_t *ends); | 534 | unsigned num_regs, regoff_t *starts, regoff_t *ends)); |
500 | 535 | ||
501 | #if defined _REGEX_RE_COMP || defined _LIBC | 536 | #if defined _REGEX_RE_COMP || defined _LIBC |
502 | # ifndef _CRAY | 537 | # ifndef _CRAY |
503 | /* 4.2 bsd compatibility. */ | 538 | /* 4.2 bsd compatibility. */ |
504 | extern char *re_comp (const char *); | 539 | extern char *re_comp _RE_ARGS ((const char *)); |
505 | extern int re_exec (const char *); | 540 | extern int re_exec _RE_ARGS ((const char *)); |
506 | # endif | 541 | # endif |
507 | #endif | 542 | #endif |
508 | 543 | ||
... | @@ -517,9 +552,9 @@ extern int re_exec (const char *); | ... | @@ -517,9 +552,9 @@ extern int re_exec (const char *); |
517 | # endif | 552 | # endif |
518 | # endif | 553 | # endif |
519 | #endif | 554 | #endif |
520 | /* gcc 3.1 and up support the [restrict] syntax. */ | 555 | /* gcc 3.1 and up support the [restrict] syntax, but g++ doesn't. */ |
521 | #ifndef __restrict_arr | 556 | #ifndef __restrict_arr |
522 | # if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1) | 557 | # if (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1)) && !defined __cplusplus |
523 | # define __restrict_arr __restrict | 558 | # define __restrict_arr __restrict |
524 | # else | 559 | # else |
525 | # define __restrict_arr | 560 | # define __restrict_arr |
... | @@ -527,19 +562,19 @@ extern int re_exec (const char *); | ... | @@ -527,19 +562,19 @@ extern int re_exec (const char *); |
527 | #endif | 562 | #endif |
528 | 563 | ||
529 | /* POSIX compatibility. */ | 564 | /* POSIX compatibility. */ |
530 | extern int regcomp (regex_t *__restrict __preg, | 565 | extern int regcomp _RE_ARGS ((regex_t *__restrict __preg, |
531 | const char *__restrict __pattern, | 566 | const char *__restrict __pattern, |
532 | int __cflags); | 567 | int __cflags)); |
533 | 568 | ||
534 | extern int regexec (const regex_t *__restrict __preg, | 569 | extern int regexec _RE_ARGS ((const regex_t *__restrict __preg, |
535 | const char *__restrict __string, size_t __nmatch, | 570 | const char *__restrict __string, size_t __nmatch, |
536 | regmatch_t __pmatch[__restrict_arr], | 571 | regmatch_t __pmatch[__restrict_arr], |
537 | int __eflags); | 572 | int __eflags)); |
538 | 573 | ||
539 | extern size_t regerror (int __errcode, const regex_t *__preg, | 574 | extern size_t regerror _RE_ARGS ((int __errcode, const regex_t *__preg, |
540 | char *__errbuf, size_t __errbuf_size); | 575 | char *__errbuf, size_t __errbuf_size)); |
541 | 576 | ||
542 | extern void regfree (regex_t *__preg); | 577 | extern void regfree _RE_ARGS ((regex_t *__preg)); |
543 | 578 | ||
544 | 579 | ||
545 | #ifdef __cplusplus | 580 | #ifdef __cplusplus | ... | ... |
1 | /* Case-insensitive string comparison functions. | 1 | /* Case-insensitive string comparison functions. |
2 | Copyright (C) 1995-1996, 2001, 2003 Free Software Foundation, Inc. | 2 | Copyright (C) 1995-1996, 2001, 2003, 2005 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 |
... | @@ -11,10 +11,9 @@ | ... | @@ -11,10 +11,9 @@ |
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 | GNU General Public License for more details. | 12 | GNU General Public License for more details. |
13 | 13 | ||
14 | You should have received a copy of the GNU General Public | 14 | You should have received a copy of the GNU General Public License |
15 | License along with this program; if not, write to the Free | 15 | along with this program; if not, write to the Free Software Foundation, |
16 | Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 16 | Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ |
17 | Boston, MA 02110-1301 USA. */ | ||
18 | 17 | ||
19 | #ifndef _STRCASE_H | 18 | #ifndef _STRCASE_H |
20 | #define _STRCASE_H | 19 | #define _STRCASE_H |
... | @@ -30,7 +29,8 @@ extern "C" { | ... | @@ -30,7 +29,8 @@ extern "C" { |
30 | /* Compare strings S1 and S2, ignoring case, returning less than, equal to or | 29 | /* Compare strings S1 and S2, ignoring case, returning less than, equal to or |
31 | greater than zero if S1 is lexicographically less than, equal to or greater | 30 | greater than zero if S1 is lexicographically less than, equal to or greater |
32 | than S2. | 31 | than S2. |
33 | Note: This function does not work correctly in multibyte locales. */ | 32 | Note: This function may, in multibyte locales, return 0 for strings of |
33 | different lengths! */ | ||
34 | extern int strcasecmp (const char *s1, const char *s2); | 34 | extern int strcasecmp (const char *s1, const char *s2); |
35 | 35 | ||
36 | /* Compare no more than N characters of strings S1 and S2, ignoring case, | 36 | /* Compare no more than N characters of strings S1 and S2, ignoring case, | ... | ... |
1 | /* strcasecmp.c -- case insensitive string comparator | 1 | /* Case-insensitive string comparison function. |
2 | Copyright (C) 1998, 1999 Free Software Foundation, Inc. | 2 | Copyright (C) 1998, 1999, 2005 Free Software Foundation, Inc. |
3 | Written by Bruno Haible <bruno@clisp.org>, 2005, | ||
4 | based on earlier glibc code. | ||
3 | 5 | ||
4 | This program is free software; you can redistribute it and/or modify | 6 | 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 | 7 | it under the terms of the GNU General Public License as published by |
... | @@ -11,57 +13,229 @@ | ... | @@ -11,57 +13,229 @@ |
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 | GNU General Public License for more details. | 14 | GNU General Public License for more details. |
13 | 15 | ||
14 | You should have received a copy of the GNU General Public | 16 | You should have received a copy of the GNU General Public License |
15 | License along with this program; if not, write to the Free | 17 | along with this program; if not, write to the Free Software Foundation, |
16 | Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 18 | Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ |
17 | Boston, MA 02110-1301 USA. */ | ||
18 | 19 | ||
19 | #if HAVE_CONFIG_H | 20 | #ifdef HAVE_CONFIG_H |
20 | # include <config.h> | 21 | # include <config.h> |
21 | #endif | 22 | #endif |
22 | 23 | ||
23 | #ifdef LENGTH_LIMIT | 24 | /* Specification. */ |
24 | # define STRXCASECMP_FUNCTION strncasecmp | 25 | #include "strcase.h" |
25 | # define STRXCASECMP_DECLARE_N , size_t n | ||
26 | # define LENGTH_LIMIT_EXPR(Expr) Expr | ||
27 | #else | ||
28 | # define STRXCASECMP_FUNCTION strcasecmp | ||
29 | # define STRXCASECMP_DECLARE_N /* empty */ | ||
30 | # define LENGTH_LIMIT_EXPR(Expr) 0 | ||
31 | #endif | ||
32 | 26 | ||
33 | #include <stddef.h> | ||
34 | #include <ctype.h> | 27 | #include <ctype.h> |
35 | 28 | ||
36 | #define TOLOWER(Ch) (isupper (Ch) ? tolower (Ch) : (Ch)) | 29 | #if HAVE_MBRTOWC |
37 | 30 | ||
38 | /* Compare {{no more than N characters of }}strings S1 and S2, | 31 | #include "strnlen1.h" |
39 | ignoring case, returning less than, equal to or | ||
40 | greater than zero if S1 is lexicographically less | ||
41 | than, equal to or greater than S2. */ | ||
42 | 32 | ||
43 | int | 33 | /* Like mbiter.h, except it doesn't look at the entire string. */ |
44 | STRXCASECMP_FUNCTION (const char *s1, const char *s2 STRXCASECMP_DECLARE_N) | 34 | |
35 | #include "mbchar.h" | ||
36 | |||
37 | #include <assert.h> | ||
38 | #include <stdbool.h> | ||
39 | #include <stdlib.h> | ||
40 | #include <wchar.h> | ||
41 | #include <wctype.h> | ||
42 | |||
43 | struct mbiter_multi | ||
44 | { | ||
45 | bool at_end; /* true if the end of the string has been reached */ | ||
46 | bool in_shift; /* true if next byte may not be interpreted as ASCII */ | ||
47 | mbstate_t state; /* if in_shift: current shift state */ | ||
48 | bool next_done; /* true if mbi_avail has already filled the following */ | ||
49 | struct mbchar cur; /* the current character: | ||
50 | const char *cur.ptr pointer to current character | ||
51 | The following are only valid after mbi_avail. | ||
52 | size_t cur.bytes number of bytes of current character | ||
53 | bool cur.wc_valid true if wc is a valid wide character | ||
54 | wchar_t cur.wc if wc_valid: the current character | ||
55 | */ | ||
56 | }; | ||
57 | |||
58 | static inline void | ||
59 | mbiter_multi_next (struct mbiter_multi *iter) | ||
45 | { | 60 | { |
46 | register const unsigned char *p1 = (const unsigned char *) s1; | 61 | if (iter->next_done) |
47 | register const unsigned char *p2 = (const unsigned char *) s2; | 62 | return; |
48 | unsigned char c1, c2; | 63 | if (iter->in_shift) |
64 | goto with_shift; | ||
65 | /* Handle most ASCII characters quickly, without calling mbrtowc(). */ | ||
66 | if (is_basic (*iter->cur.ptr)) | ||
67 | { | ||
68 | /* These characters are part of the basic character set. ISO C 99 | ||
69 | guarantees that their wide character code is identical to their | ||
70 | char code. */ | ||
71 | iter->cur.bytes = 1; | ||
72 | iter->cur.wc = *iter->cur.ptr; | ||
73 | iter->cur.wc_valid = true; | ||
74 | } | ||
75 | else | ||
76 | { | ||
77 | assert (mbsinit (&iter->state)); | ||
78 | iter->in_shift = true; | ||
79 | with_shift: | ||
80 | iter->cur.bytes = mbrtowc (&iter->cur.wc, iter->cur.ptr, | ||
81 | strnlen1 (iter->cur.ptr, MB_CUR_MAX), | ||
82 | &iter->state); | ||
83 | if (iter->cur.bytes == (size_t) -1) | ||
84 | { | ||
85 | /* An invalid multibyte sequence was encountered. */ | ||
86 | iter->cur.bytes = 1; | ||
87 | iter->cur.wc_valid = false; | ||
88 | /* Whether to set iter->in_shift = false and reset iter->state | ||
89 | or not is not very important; the string is bogus anyway. */ | ||
90 | } | ||
91 | else if (iter->cur.bytes == (size_t) -2) | ||
92 | { | ||
93 | /* An incomplete multibyte character at the end. */ | ||
94 | iter->cur.bytes = strlen (iter->cur.ptr) + 1; | ||
95 | iter->cur.wc_valid = false; | ||
96 | /* Whether to set iter->in_shift = false and reset iter->state | ||
97 | or not is not important; the string end is reached anyway. */ | ||
98 | } | ||
99 | else | ||
100 | { | ||
101 | if (iter->cur.bytes == 0) | ||
102 | { | ||
103 | /* A null wide character was encountered. */ | ||
104 | iter->cur.bytes = 1; | ||
105 | assert (*iter->cur.ptr == '\0'); | ||
106 | assert (iter->cur.wc == 0); | ||
107 | } | ||
108 | iter->cur.wc_valid = true; | ||
109 | |||
110 | /* When in the initial state, we can go back treating ASCII | ||
111 | characters more quickly. */ | ||
112 | if (mbsinit (&iter->state)) | ||
113 | iter->in_shift = false; | ||
114 | } | ||
115 | } | ||
116 | iter->next_done = true; | ||
117 | } | ||
118 | |||
119 | static inline void | ||
120 | mbiter_multi_reloc (struct mbiter_multi *iter, ptrdiff_t ptrdiff) | ||
121 | { | ||
122 | iter->cur.ptr += ptrdiff; | ||
123 | } | ||
49 | 124 | ||
50 | if (p1 == p2 || LENGTH_LIMIT_EXPR (n == 0)) | 125 | /* Iteration macros. */ |
126 | typedef struct mbiter_multi mbi_iterator_t; | ||
127 | #define mbi_init(iter, startptr) \ | ||
128 | ((iter).cur.ptr = (startptr), (iter).at_end = false, \ | ||
129 | (iter).in_shift = false, memset (&(iter).state, '\0', sizeof (mbstate_t)), \ | ||
130 | (iter).next_done = false) | ||
131 | #define mbi_avail(iter) \ | ||
132 | (!(iter).at_end && (mbiter_multi_next (&(iter)), true)) | ||
133 | #define mbi_advance(iter) \ | ||
134 | ((mb_isnul ((iter).cur) ? ((iter).at_end = true) : 0), \ | ||
135 | (iter).cur.ptr += (iter).cur.bytes, (iter).next_done = false) | ||
136 | |||
137 | /* Access to the current character. */ | ||
138 | #define mbi_cur(iter) (iter).cur | ||
139 | #define mbi_cur_ptr(iter) (iter).cur.ptr | ||
140 | |||
141 | #endif | ||
142 | |||
143 | #define TOLOWER(Ch) (isupper (Ch) ? tolower (Ch) : (Ch)) | ||
144 | |||
145 | /* Compare strings S1 and S2, ignoring case, returning less than, equal to or | ||
146 | greater than zero if S1 is lexicographically less than, equal to or greater | ||
147 | than S2. | ||
148 | Note: This function may, in multibyte locales, return 0 for strings of | ||
149 | different lengths! */ | ||
150 | int | ||
151 | strcasecmp (const char *s1, const char *s2) | ||
152 | { | ||
153 | if (s1 == s2) | ||
51 | return 0; | 154 | return 0; |
52 | 155 | ||
53 | do | 156 | /* Be careful not to look at the entire extent of s1 or s2 until needed. |
157 | This is useful because when two strings differ, the difference is | ||
158 | most often already in the very few first characters. */ | ||
159 | #if HAVE_MBRTOWC | ||
160 | if (MB_CUR_MAX > 1) | ||
54 | { | 161 | { |
55 | c1 = TOLOWER (*p1); | 162 | mbi_iterator_t iter1; |
56 | c2 = TOLOWER (*p2); | 163 | mbi_iterator_t iter2; |
57 | 164 | ||
58 | if (LENGTH_LIMIT_EXPR (--n == 0) || c1 == '\0') | 165 | mbi_init (iter1, s1); |
59 | break; | 166 | mbi_init (iter2, s2); |
60 | 167 | ||
61 | ++p1; | 168 | while (mbi_avail (iter1) && mbi_avail (iter2)) |
62 | ++p2; | 169 | { |
170 | /* Sort invalid characters after all valid ones. */ | ||
171 | if (!mbi_cur (iter1).wc_valid) | ||
172 | { | ||
173 | if (!mbi_cur (iter2).wc_valid) | ||
174 | { | ||
175 | /* Compare two invalid characters. */ | ||
176 | int cmp; | ||
177 | |||
178 | if (mbi_cur (iter1).bytes > mbi_cur (iter2).bytes) | ||
179 | return 1; | ||
180 | if (mbi_cur (iter1).bytes < mbi_cur (iter2).bytes) | ||
181 | return -1; | ||
182 | cmp = memcmp (mbi_cur_ptr (iter1), mbi_cur_ptr (iter2), | ||
183 | mbi_cur (iter1).bytes); | ||
184 | if (cmp != 0) | ||
185 | return cmp; | ||
186 | } | ||
187 | else | ||
188 | /* mbi_cur (iter1) invalid, mbi_cur (iter2) valid. */ | ||
189 | return 1; | ||
190 | } | ||
191 | else | ||
192 | { | ||
193 | if (!mbi_cur (iter2).wc_valid) | ||
194 | /* mbi_cur (iter1) valid, mbi_cur (iter2) invalid. */ | ||
195 | return -1; | ||
196 | else | ||
197 | { | ||
198 | /* Compare two valid characters. */ | ||
199 | wchar_t c1 = towlower (mbi_cur (iter1).wc); | ||
200 | wchar_t c2 = towlower (mbi_cur (iter2).wc); | ||
201 | |||
202 | if (c1 > c2) | ||
203 | return 1; | ||
204 | if (c1 < c2) | ||
205 | return -1; | ||
206 | } | ||
207 | } | ||
208 | mbi_advance (iter1); | ||
209 | mbi_advance (iter2); | ||
210 | } | ||
211 | if (mbi_avail (iter1)) | ||
212 | /* s2 terminated before s1. */ | ||
213 | return 1; | ||
214 | if (mbi_avail (iter2)) | ||
215 | /* s1 terminated before s2. */ | ||
216 | return -1; | ||
217 | return 0; | ||
63 | } | 218 | } |
64 | while (c1 == c2); | 219 | else |
220 | #endif | ||
221 | { | ||
222 | const unsigned char *p1 = (const unsigned char *) s1; | ||
223 | const unsigned char *p2 = (const unsigned char *) s2; | ||
224 | unsigned char c1, c2; | ||
65 | 225 | ||
66 | return c1 - c2; | 226 | do |
227 | { | ||
228 | c1 = TOLOWER (*p1); | ||
229 | c2 = TOLOWER (*p2); | ||
230 | |||
231 | if (c1 == '\0') | ||
232 | break; | ||
233 | |||
234 | ++p1; | ||
235 | ++p2; | ||
236 | } | ||
237 | while (c1 == c2); | ||
238 | |||
239 | return c1 - c2; | ||
240 | } | ||
67 | } | 241 | } | ... | ... |
... | @@ -11,10 +11,9 @@ | ... | @@ -11,10 +11,9 @@ |
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 | GNU General Public License for more details. | 12 | GNU General Public License for more details. |
13 | 13 | ||
14 | You should have received a copy of the GNU General Public | 14 | You should have received a copy of the GNU General Public License |
15 | License along with this program; if not, write to the Free | 15 | along with this program; if not, write to the Free Software Foundation, |
16 | Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 16 | Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ |
17 | Boston, MA 02110-1301 USA. */ | ||
18 | 17 | ||
19 | /* Specification. */ | 18 | /* Specification. */ |
20 | #include "strchrnul.h" | 19 | #include "strchrnul.h" | ... | ... |
... | @@ -11,10 +11,9 @@ | ... | @@ -11,10 +11,9 @@ |
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 | GNU General Public License for more details. | 12 | GNU General Public License for more details. |
13 | 13 | ||
14 | You should have received a copy of the GNU General Public | 14 | You should have received a copy of the GNU General Public License |
15 | License along with this program; if not, write to the Free | 15 | along with this program; if not, write to the Free Software Foundation, |
16 | Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 16 | Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ |
17 | Boston, MA 02110-1301 USA. */ | ||
18 | 17 | ||
19 | #if HAVE_STRCHRNUL | 18 | #if HAVE_STRCHRNUL |
20 | 19 | ... | ... |
1 | #define LENGTH_LIMIT | 1 | /* strncasecmp.c -- case insensitive string comparator |
2 | #include "strcasecmp.c" | 2 | Copyright (C) 1998, 1999 Free Software Foundation, Inc. |
3 | |||
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 | ||
6 | the Free Software Foundation; either version 2, or (at your option) | ||
7 | any later version. | ||
8 | |||
9 | This program is distributed in the hope that it will be useful, | ||
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | GNU General Public License for more details. | ||
13 | |||
14 | You should have received a copy of the GNU General Public License | ||
15 | along with this program; if not, write to the Free Software Foundation, | ||
16 | Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ | ||
17 | |||
18 | #if HAVE_CONFIG_H | ||
19 | # include <config.h> | ||
20 | #endif | ||
21 | |||
22 | /* Specification. */ | ||
23 | #include "strcase.h" | ||
24 | |||
25 | #include <ctype.h> | ||
26 | |||
27 | #define TOLOWER(Ch) (isupper (Ch) ? tolower (Ch) : (Ch)) | ||
28 | |||
29 | /* Compare no more than N bytes of strings S1 and S2, | ||
30 | ignoring case, returning less than, equal to or | ||
31 | greater than zero if S1 is lexicographically less | ||
32 | than, equal to or greater than S2. */ | ||
33 | |||
34 | int | ||
35 | strncasecmp (const char *s1, const char *s2, size_t n) | ||
36 | { | ||
37 | register const unsigned char *p1 = (const unsigned char *) s1; | ||
38 | register const unsigned char *p2 = (const unsigned char *) s2; | ||
39 | unsigned char c1, c2; | ||
40 | |||
41 | if (p1 == p2 || n == 0) | ||
42 | return 0; | ||
43 | |||
44 | do | ||
45 | { | ||
46 | c1 = TOLOWER (*p1); | ||
47 | c2 = TOLOWER (*p2); | ||
48 | |||
49 | if (--n == 0 || c1 == '\0') | ||
50 | break; | ||
51 | |||
52 | ++p1; | ||
53 | ++p2; | ||
54 | } | ||
55 | while (c1 == c2); | ||
56 | |||
57 | return c1 - c2; | ||
58 | } | ... | ... |
1 | /* Copyright (C) 1996, 1997, 1998, 2000, 2003 Free Software Foundation, Inc. | 1 | /* Copyright (C) 1996, 1997, 1998, 2000, 2003, 2005 Free Software Foundation, Inc. |
2 | 2 | ||
3 | NOTE: The canonical source of this file is maintained with the GNU C Library. | 3 | NOTE: The canonical source of this file is maintained with the GNU C Library. |
4 | Bugs can be reported to bug-glibc@prep.ai.mit.edu. | 4 | Bugs can be reported to bug-glibc@prep.ai.mit.edu. |
... | @@ -13,10 +13,9 @@ | ... | @@ -13,10 +13,9 @@ |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 | GNU General Public License for more details. | 14 | GNU General Public License for more details. |
15 | 15 | ||
16 | You should have received a copy of the GNU General Public | 16 | You should have received a copy of the GNU General Public License |
17 | License along with this program; if not, write to the Free | 17 | along with this program; if not, write to the Free Software Foundation, |
18 | Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 18 | Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ |
19 | Boston, MA 02110-1301 USA. */ | ||
20 | 19 | ||
21 | #ifdef HAVE_CONFIG_H | 20 | #ifdef HAVE_CONFIG_H |
22 | # include "config.h" | 21 | # include "config.h" |
... | @@ -25,12 +24,8 @@ | ... | @@ -25,12 +24,8 @@ |
25 | #include <stdlib.h> | 24 | #include <stdlib.h> |
26 | #include <string.h> | 25 | #include <string.h> |
27 | 26 | ||
28 | #ifndef HAVE_DECL_STRNLEN | 27 | /* Get strnlen. */ |
29 | "this configure-time declaration test was not run" | 28 | #include "strnlen.h" |
30 | #endif | ||
31 | #if !HAVE_DECL_STRNLEN | ||
32 | size_t strnlen (); | ||
33 | #endif | ||
34 | 29 | ||
35 | #undef __strndup | 30 | #undef __strndup |
36 | #undef strndup | 31 | #undef strndup | ... | ... |
... | @@ -11,10 +11,9 @@ | ... | @@ -11,10 +11,9 @@ |
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 | GNU General Public License for more details. | 12 | GNU General Public License for more details. |
13 | 13 | ||
14 | You should have received a copy of the GNU General Public | 14 | You should have received a copy of the GNU General Public License |
15 | License along with this program; if not, write to the Free | 15 | along with this program; if not, write to the Free Software Foundation, |
16 | Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 16 | Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ |
17 | Boston, MA 02110-1301 USA. */ | ||
18 | 17 | ||
19 | #if HAVE_STRNDUP | 18 | #if HAVE_STRNDUP |
20 | 19 | ... | ... |
... | @@ -12,10 +12,9 @@ | ... | @@ -12,10 +12,9 @@ |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public | 15 | You should have received a copy of the GNU General Public License along |
16 | License along with this program; if not, write to the Free | 16 | with this program; if not, write to the Free Software Foundation, |
17 | Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 17 | Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ |
18 | Boston, MA 02110-1301 USA. */ | ||
19 | 18 | ||
20 | #if HAVE_CONFIG_H | 19 | #if HAVE_CONFIG_H |
21 | # include <config.h> | 20 | # include <config.h> | ... | ... |
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
-
Please register or sign in to post a comment