Updated by gnulib-sync
Showing
41 changed files
with
360 additions
and
298 deletions
... | @@ -23,7 +23,7 @@ | ... | @@ -23,7 +23,7 @@ |
23 | 23 | ||
24 | #include <stdio.h> | 24 | #include <stdio.h> |
25 | 25 | ||
26 | #if !defined _WIN32 | 26 | #if !((defined _WIN32 || defined __WIN32__) && !defined __CYGWIN__) |
27 | 27 | ||
28 | #include <stdbool.h> | 28 | #include <stdbool.h> |
29 | 29 | ||
... | @@ -170,13 +170,17 @@ getpass (const char *prompt) | ... | @@ -170,13 +170,17 @@ getpass (const char *prompt) |
170 | return buf; | 170 | return buf; |
171 | } | 171 | } |
172 | 172 | ||
173 | #else /* WIN32 */ | 173 | #else /* W32 native */ |
174 | 174 | ||
175 | /* Windows implementation by Martin Lambers <marlam@marlam.de>, | 175 | /* Windows implementation by Martin Lambers <marlam@marlam.de>, |
176 | improved by Simon Josefsson. */ | 176 | improved by Simon Josefsson. */ |
177 | 177 | ||
178 | /* For PASS_MAX. */ | 178 | /* For PASS_MAX. */ |
179 | #include <limits.h> | 179 | #include <limits.h> |
180 | /* For _getch(). */ | ||
181 | #include <conio.h> | ||
182 | /* For strdup(). */ | ||
183 | #include <string.h> | ||
180 | 184 | ||
181 | #ifndef PASS_MAX | 185 | #ifndef PASS_MAX |
182 | # define PASS_MAX 512 | 186 | # define PASS_MAX 512 | ... | ... |
1 | /* Copyright (C) 1992,1995-1999,2000-2003 Free Software Foundation, Inc. | 1 | /* Copyright (C) 1992,1995-1999,2000-2003,2005 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 |
... | @@ -13,9 +13,9 @@ | ... | @@ -13,9 +13,9 @@ |
13 | 13 | ||
14 | You should have received a copy of the GNU General Public License along | 14 | You should have received a copy of the GNU General Public License along |
15 | with this program; if not, write to the Free Software Foundation, | 15 | with this program; if not, write to the Free Software Foundation, |
16 | Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ | 16 | Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ |
17 | 17 | ||
18 | #if HAVE_CONFIG_H | 18 | #ifdef HAVE_CONFIG_H |
19 | # include <config.h> | 19 | # include <config.h> |
20 | #endif | 20 | #endif |
21 | #include <alloca.h> | 21 | #include <alloca.h> |
... | @@ -27,9 +27,7 @@ | ... | @@ -27,9 +27,7 @@ |
27 | 27 | ||
28 | #include <stdlib.h> | 28 | #include <stdlib.h> |
29 | #include <string.h> | 29 | #include <string.h> |
30 | #if _LIBC || HAVE_UNISTD_H | 30 | #include <unistd.h> |
31 | # include <unistd.h> | ||
32 | #endif | ||
33 | 31 | ||
34 | #if !_LIBC | 32 | #if !_LIBC |
35 | # include "allocsa.h" | 33 | # include "allocsa.h" | ... | ... |
1 | /* Copyright (C) 1992,1995-1999,2000-2002 Free Software Foundation, Inc. | 1 | /* Copyright (C) 1992,1995-1999,2000-2002,2005-2006 Free Software Foundation, Inc. |
2 | This file is part of the GNU C Library. | 2 | This file is part of the GNU C Library. |
3 | 3 | ||
4 | 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,25 +13,20 @@ | ... | @@ -13,25 +13,20 @@ |
13 | 13 | ||
14 | You should have received a copy of the GNU General Public License along | 14 | You should have received a copy of the GNU General Public License along |
15 | with this program; if not, write to the Free Software Foundation, | 15 | with this program; if not, write to the Free Software Foundation, |
16 | Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ | 16 | Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ |
17 | 17 | ||
18 | #if HAVE_CONFIG_H | 18 | #ifdef HAVE_CONFIG_H |
19 | # include <config.h> | 19 | # include <config.h> |
20 | #endif | 20 | #endif |
21 | 21 | ||
22 | #include <errno.h> | 22 | #include <errno.h> |
23 | #if !_LIBC | 23 | #if !_LIBC |
24 | # if !defined errno && !defined HAVE_ERRNO_DECL | ||
25 | extern int errno; | ||
26 | # endif | ||
27 | # define __set_errno(ev) ((errno) = (ev)) | 24 | # define __set_errno(ev) ((errno) = (ev)) |
28 | #endif | 25 | #endif |
29 | 26 | ||
30 | #include <stdlib.h> | 27 | #include <stdlib.h> |
31 | #include <string.h> | 28 | #include <string.h> |
32 | #if _LIBC || HAVE_UNISTD_H | 29 | #include <unistd.h> |
33 | # include <unistd.h> | ||
34 | #endif | ||
35 | 30 | ||
36 | #if !_LIBC | 31 | #if !_LIBC |
37 | # define __environ environ | 32 | # define __environ environ | ... | ... |
1 | /* Report a memory allocation failure and exit. | 1 | /* Report a memory allocation failure and exit. |
2 | 2 | ||
3 | Copyright (C) 1997, 1998, 1999, 2000, 2002, 2003, 2004 Free | 3 | Copyright (C) 1997, 1998, 1999, 2000, 2002, 2003, 2004, 2006 Free |
4 | Software Foundation, Inc. | 4 | 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 |
... | @@ -30,7 +30,6 @@ | ... | @@ -30,7 +30,6 @@ |
30 | 30 | ||
31 | #include "gettext.h" | 31 | #include "gettext.h" |
32 | #define _(msgid) gettext (msgid) | 32 | #define _(msgid) gettext (msgid) |
33 | #define N_(msgid) msgid | ||
34 | 33 | ||
35 | void | 34 | void |
36 | xalloc_die (void) | 35 | xalloc_die (void) | ... | ... |
1 | # argp.m4 serial 5 | 1 | # argp.m4 serial 6 |
2 | dnl Copyright (C) 2003-2005 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 2003-2006 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. |
... | @@ -43,11 +43,19 @@ AC_DEFUN([gl_ARGP], | ... | @@ -43,11 +43,19 @@ AC_DEFUN([gl_ARGP], |
43 | AC_MSG_RESULT(yes)], | 43 | AC_MSG_RESULT(yes)], |
44 | [ AC_MSG_RESULT(no)] ) | 44 | [ AC_MSG_RESULT(no)] ) |
45 | 45 | ||
46 | AC_CHECK_DECLS_ONCE( | 46 | AC_CHECK_DECLS_ONCE([clearerr_unlocked]) |
47 | [clearerr_unlocked feof_unlocked ferror_unlocked | 47 | AC_CHECK_DECLS_ONCE([feof_unlocked]) |
48 | fflush_unlocked fgets_unlocked fputc_unlocked fputs_unlocked | 48 | AC_CHECK_DECLS_ONCE([ferror_unlocked]) |
49 | fread_unlocked fwrite_unlocked getc_unlocked | 49 | AC_CHECK_DECLS_ONCE([fflush_unlocked]) |
50 | getchar_unlocked putc_unlocked putchar_unlocked]) | 50 | AC_CHECK_DECLS_ONCE([fgets_unlocked]) |
51 | AC_CHECK_DECLS_ONCE([fputc_unlocked]) | ||
52 | AC_CHECK_DECLS_ONCE([fputs_unlocked]) | ||
53 | AC_CHECK_DECLS_ONCE([fread_unlocked]) | ||
54 | AC_CHECK_DECLS_ONCE([fwrite_unlocked]) | ||
55 | AC_CHECK_DECLS_ONCE([getc_unlocked]) | ||
56 | AC_CHECK_DECLS_ONCE([getchar_unlocked]) | ||
57 | AC_CHECK_DECLS_ONCE([putc_unlocked]) | ||
58 | AC_CHECK_DECLS_ONCE([putchar_unlocked]) | ||
51 | AC_CHECK_FUNCS_ONCE([flockfile funlockfile]) | 59 | AC_CHECK_FUNCS_ONCE([flockfile funlockfile]) |
52 | AC_CHECK_HEADERS_ONCE([features.h linewrap.h]) | 60 | AC_CHECK_HEADERS_ONCE([features.h linewrap.h]) |
53 | ]) | 61 | ]) | ... | ... |
1 | # Enable extensions on systems that normally disable them. | 1 | # Enable extensions on systems that normally disable them. |
2 | 2 | ||
3 | # Copyright (C) 2003 Free Software Foundation, Inc. | 3 | # Copyright (C) 2003, 2006 Free Software Foundation, Inc. |
4 | # This file is free software; the Free Software Foundation | 4 | # This file is free software; the Free Software Foundation |
5 | # gives unlimited permission to copy and/or distribute it, | 5 | # gives unlimited permission to copy and/or distribute it, |
6 | # with or without modifications, as long as this notice is preserved. | 6 | # with or without modifications, as long as this notice is preserved. |
7 | 7 | ||
8 | # This file is only needed in autoconf <= 2.59. Newer versions of autoconf | ||
9 | # have a macro AC_USE_SYSTEM_EXTENSIONS with identical semantics. | ||
10 | |||
8 | # gl_USE_SYSTEM_EXTENSIONS | 11 | # gl_USE_SYSTEM_EXTENSIONS |
9 | # ------------------------ | 12 | # ------------------------ |
10 | # Enable extensions on systems that normally disable them, | 13 | # Enable extensions on systems that normally disable them, |
... | @@ -25,6 +28,15 @@ AC_DEFUN([gl_USE_SYSTEM_EXTENSIONS], [ | ... | @@ -25,6 +28,15 @@ AC_DEFUN([gl_USE_SYSTEM_EXTENSIONS], [ |
25 | #ifndef _POSIX_PTHREAD_SEMANTICS | 28 | #ifndef _POSIX_PTHREAD_SEMANTICS |
26 | # undef _POSIX_PTHREAD_SEMANTICS | 29 | # undef _POSIX_PTHREAD_SEMANTICS |
27 | #endif]) | 30 | #endif]) |
28 | AC_DEFINE([__EXTENSIONS__]) | 31 | AC_CACHE_CHECK([whether it is safe to define __EXTENSIONS__], |
32 | [ac_cv_safe_to_define___extensions__], | ||
33 | [AC_COMPILE_IFELSE( | ||
34 | [AC_LANG_PROGRAM([ | ||
35 | #define __EXTENSIONS__ 1 | ||
36 | AC_INCLUDES_DEFAULT])], | ||
37 | [ac_cv_safe_to_define___extensions__=yes], | ||
38 | [ac_cv_safe_to_define___extensions__=no])]) | ||
39 | test $ac_cv_safe_to_define___extensions__ = yes && | ||
40 | AC_DEFINE([__EXTENSIONS__]) | ||
29 | AC_DEFINE([_POSIX_PTHREAD_SEMANTICS]) | 41 | AC_DEFINE([_POSIX_PTHREAD_SEMANTICS]) |
30 | ]) | 42 | ]) | ... | ... |
1 | #serial 1 | 1 | #serial 2 |
2 | 2 | ||
3 | # Copyright (C) 2005 Free Software Foundation, Inc. | 3 | # Copyright (C) 2005, 2006 Free Software Foundation, Inc. |
4 | # | 4 | # |
5 | # This file is free software; the Free Software Foundation | 5 | # This file is free software; the Free Software Foundation |
6 | # gives unlimited permission to copy and/or distribute it, | 6 | # gives unlimited permission to copy and/or distribute it, |
... | @@ -29,5 +29,6 @@ AC_DEFUN([gl_GETLOGIN_R], | ... | @@ -29,5 +29,6 @@ AC_DEFUN([gl_GETLOGIN_R], |
29 | AC_DEFUN([gl_PREREQ_GETLOGIN_R], | 29 | AC_DEFUN([gl_PREREQ_GETLOGIN_R], |
30 | [ | 30 | [ |
31 | AC_CHECK_HEADERS_ONCE([unistd.h]) | 31 | AC_CHECK_HEADERS_ONCE([unistd.h]) |
32 | AC_CHECK_DECLS_ONCE([getlogin getlogin_r]) | 32 | AC_CHECK_DECLS_ONCE([getlogin]) |
33 | AC_CHECK_DECLS_ONCE([getlogin_r]) | ||
33 | ]) | 34 | ]) | ... | ... |
1 | # getopt.m4 serial 11 | 1 | # getopt.m4 serial 12 |
2 | dnl Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 2002, 2003, 2004, 2005, 2006 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. |
... | @@ -77,4 +77,7 @@ AC_DEFUN([gl_GETOPT_IFELSE], | ... | @@ -77,4 +77,7 @@ AC_DEFUN([gl_GETOPT_IFELSE], |
77 | AC_DEFUN([gl_GETOPT], [gl_GETOPT_IFELSE([gl_GETOPT_SUBSTITUTE])]) | 77 | AC_DEFUN([gl_GETOPT], [gl_GETOPT_IFELSE([gl_GETOPT_SUBSTITUTE])]) |
78 | 78 | ||
79 | # Prerequisites of lib/getopt*. | 79 | # Prerequisites of lib/getopt*. |
80 | AC_DEFUN([gl_PREREQ_GETOPT], [:]) | 80 | AC_DEFUN([gl_PREREQ_GETOPT], |
81 | [ | ||
82 | AC_CHECK_DECLS_ONCE([getenv]) | ||
83 | ]) | ... | ... |
1 | # getpass.m4 serial 6 | 1 | # getpass.m4 serial 7 |
2 | dnl Copyright (C) 2002-2003, 2005 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 2002-2003, 2005-2006 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. |
... | @@ -37,5 +37,9 @@ AC_DEFUN([gl_FUNC_GETPASS_GNU], | ... | @@ -37,5 +37,9 @@ AC_DEFUN([gl_FUNC_GETPASS_GNU], |
37 | AC_DEFUN([gl_PREREQ_GETPASS], [ | 37 | AC_DEFUN([gl_PREREQ_GETPASS], [ |
38 | AC_CHECK_HEADERS_ONCE(stdio_ext.h termios.h) | 38 | AC_CHECK_HEADERS_ONCE(stdio_ext.h termios.h) |
39 | AC_CHECK_FUNCS_ONCE(__fsetlocking tcgetattr tcsetattr) | 39 | AC_CHECK_FUNCS_ONCE(__fsetlocking tcgetattr tcsetattr) |
40 | AC_CHECK_DECLS_ONCE([fflush_unlocked flockfile fputs_unlocked funlockfile putc_unlocked]) | 40 | AC_CHECK_DECLS_ONCE([fflush_unlocked]) |
41 | AC_CHECK_DECLS_ONCE([flockfile]) | ||
42 | AC_CHECK_DECLS_ONCE([fputs_unlocked]) | ||
43 | AC_CHECK_DECLS_ONCE([funlockfile]) | ||
44 | AC_CHECK_DECLS_ONCE([putc_unlocked]) | ||
41 | ]) | 45 | ]) | ... | ... |
1 | # longdouble.m4 serial 1 (gettext-0.12) | 1 | # longdouble.m4 serial 2 (gettext-0.15) |
2 | dnl Copyright (C) 2002-2003 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 2002-2003, 2006 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. |
... | @@ -8,6 +8,9 @@ dnl From Bruno Haible. | ... | @@ -8,6 +8,9 @@ dnl From Bruno Haible. |
8 | dnl Test whether the compiler supports the 'long double' type. | 8 | dnl Test whether the compiler supports the 'long double' type. |
9 | dnl Prerequisite: AC_PROG_CC | 9 | dnl Prerequisite: AC_PROG_CC |
10 | 10 | ||
11 | dnl This file is only needed in autoconf <= 2.59. Newer versions of autoconf | ||
12 | dnl have a macro AC_TYPE_LONG_DOUBLE with identical semantics. | ||
13 | |||
11 | AC_DEFUN([gt_TYPE_LONGDOUBLE], | 14 | AC_DEFUN([gt_TYPE_LONGDOUBLE], |
12 | [ | 15 | [ |
13 | AC_CACHE_CHECK([for long double], gt_cv_c_long_double, | 16 | AC_CACHE_CHECK([for long double], gt_cv_c_long_double, | ... | ... |
1 | #serial 31 | 1 | #serial 36 |
2 | 2 | ||
3 | # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005 Free | 3 | # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, |
4 | # Software Foundation, Inc. | 4 | # 2006 Free 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 |
7 | # gives unlimited permission to copy and/or distribute it, | 7 | # gives unlimited permission to copy and/or distribute it, |
... | @@ -14,31 +14,6 @@ AC_PREREQ([2.50]) | ... | @@ -14,31 +14,6 @@ AC_PREREQ([2.50]) |
14 | 14 | ||
15 | AC_DEFUN([gl_REGEX], | 15 | AC_DEFUN([gl_REGEX], |
16 | [ | 16 | [ |
17 | AC_REQUIRE([AC_SYS_LARGEFILE]) dnl for a sufficently-wide off_t | ||
18 | |||
19 | AC_CACHE_CHECK([whether off_t can be used in a switch statement], | ||
20 | [gl_cv_type_off_t_switch], | ||
21 | [AC_COMPILE_IFELSE( | ||
22 | [AC_LANG_PROGRAM( | ||
23 | [AC_INCLUDES_DEFAULT], | ||
24 | [[off_t o = -1; | ||
25 | switch (o) | ||
26 | { | ||
27 | case -2: | ||
28 | return 1; | ||
29 | case -1: | ||
30 | return 2; | ||
31 | default: | ||
32 | return 0; | ||
33 | } | ||
34 | ]])], | ||
35 | [gl_cv_type_off_t_switch=yes], | ||
36 | [gl_cv_type_off_t_switch=no])]) | ||
37 | if test $gl_cv_type_off_t_switch = yes; then | ||
38 | AC_DEFINE([_REGEX_LARGE_OFFSETS], 1, | ||
39 | [Define if you want regoff_t to be at least as wide POSIX requires.]) | ||
40 | fi | ||
41 | |||
42 | MU_LIBSOURCES( | 17 | MU_LIBSOURCES( |
43 | [regcomp.c, regex.c, regex.h, | 18 | [regcomp.c, regex.c, regex.h, |
44 | regex_internal.c, regex_internal.h, regexec.c]) | 19 | regex_internal.c, regex_internal.h, regexec.c]) |
... | @@ -49,7 +24,7 @@ AC_DEFUN([gl_REGEX], | ... | @@ -49,7 +24,7 @@ AC_DEFUN([gl_REGEX], |
49 | systems with recent-enough versions of the GNU C | 24 | systems with recent-enough versions of the GNU C |
50 | Library (use with caution on other systems)])]) | 25 | Library (use with caution on other systems)])]) |
51 | 26 | ||
52 | case $with_included_regex in | 27 | case $with_included_regex in #( |
53 | yes|no) ac_use_included_regex=$with_included_regex | 28 | yes|no) ac_use_included_regex=$with_included_regex |
54 | ;; | 29 | ;; |
55 | '') | 30 | '') |
... | @@ -59,20 +34,24 @@ AC_DEFUN([gl_REGEX], | ... | @@ -59,20 +34,24 @@ AC_DEFUN([gl_REGEX], |
59 | # regex.c. The first failing regular expression is from `Spencer ere | 34 | # regex.c. The first failing regular expression is from `Spencer ere |
60 | # test #75' in grep-2.3. | 35 | # test #75' in grep-2.3. |
61 | AC_CACHE_CHECK([for working re_compile_pattern], | 36 | AC_CACHE_CHECK([for working re_compile_pattern], |
62 | [gl_cv_func_re_compile_pattern_broken], | 37 | [gl_cv_func_re_compile_pattern_working], |
63 | [AC_RUN_IFELSE( | 38 | [AC_RUN_IFELSE( |
64 | [AC_LANG_PROGRAM( | 39 | [AC_LANG_PROGRAM( |
65 | [AC_INCLUDES_DEFAULT | 40 | [AC_INCLUDES_DEFAULT |
66 | #include <regex.h>], | 41 | #include <limits.h> |
42 | #include <regex.h> | ||
43 | ], | ||
67 | [[static struct re_pattern_buffer regex; | 44 | [[static struct re_pattern_buffer regex; |
45 | unsigned char folded_chars[UCHAR_MAX + 1]; | ||
46 | int i; | ||
68 | const char *s; | 47 | const char *s; |
69 | struct re_registers regs; | 48 | struct re_registers regs; |
70 | /* Use the POSIX-compliant spelling with leading REG_, | 49 | re_set_syntax (RE_SYNTAX_POSIX_EGREP); |
71 | rather than the traditional GNU spelling with leading RE_, | ||
72 | so that we reject older libc implementations. */ | ||
73 | re_set_syntax (REG_SYNTAX_POSIX_EGREP); | ||
74 | memset (®ex, 0, sizeof (regex)); | 50 | memset (®ex, 0, sizeof (regex)); |
75 | s = re_compile_pattern ("a[:@:>@:]b\n", 9, ®ex); | 51 | for (i = 0; i <= UCHAR_MAX; i++) |
52 | folded_chars[i] = i; | ||
53 | regex.translate = folded_chars; | ||
54 | s = re_compile_pattern ("a[[:@:>@:]]b\n", 11, ®ex); | ||
76 | /* This should fail with _Invalid character class name_ error. */ | 55 | /* This should fail with _Invalid character class name_ error. */ |
77 | if (!s) | 56 | if (!s) |
78 | exit (1); | 57 | exit (1); |
... | @@ -106,10 +85,9 @@ AC_DEFUN([gl_REGEX], | ... | @@ -106,10 +85,9 @@ AC_DEFUN([gl_REGEX], |
106 | exit (1); | 85 | exit (1); |
107 | 86 | ||
108 | /* The version of regex.c in older versions of gnulib | 87 | /* The version of regex.c in older versions of gnulib |
109 | ignored REG_IGNORE_CASE (which was then called RE_ICASE). | 88 | ignored RE_ICASE. Detect that problem too. */ |
110 | Detect that problem too. */ | ||
111 | memset (®ex, 0, sizeof (regex)); | 89 | memset (®ex, 0, sizeof (regex)); |
112 | re_set_syntax (REG_SYNTAX_EMACS | REG_IGNORE_CASE); | 90 | re_set_syntax (RE_SYNTAX_EMACS | RE_ICASE); |
113 | s = re_compile_pattern ("x", 1, ®ex); | 91 | s = re_compile_pattern ("x", 1, ®ex); |
114 | if (s) | 92 | if (s) |
115 | exit (1); | 93 | exit (1); |
... | @@ -123,24 +101,29 @@ AC_DEFUN([gl_REGEX], | ... | @@ -123,24 +101,29 @@ AC_DEFUN([gl_REGEX], |
123 | exit (1); | 101 | exit (1); |
124 | 102 | ||
125 | /* Reject hosts whose regoff_t values are too narrow. | 103 | /* Reject hosts whose regoff_t values are too narrow. |
126 | These include glibc 2.3.5 on hosts with 64-bit off_t | 104 | These include glibc 2.3.5 on hosts with 64-bit ptrdiff_t |
127 | and 32-bit int, and Solaris 10 on hosts with 32-bit int | 105 | and 32-bit int. */ |
128 | and _FILE_OFFSET_BITS=64. */ | 106 | if (sizeof (regoff_t) < sizeof (ptrdiff_t) |
129 | if (sizeof (regoff_t) < sizeof (off_t)) | 107 | || sizeof (regoff_t) < sizeof (ssize_t)) |
130 | exit (1); | 108 | exit (1); |
131 | 109 | ||
132 | exit (0);]])], | 110 | exit (0);]])], |
133 | [gl_cv_func_re_compile_pattern_broken=no], | 111 | [gl_cv_func_re_compile_pattern_working=yes], |
134 | [gl_cv_func_re_compile_pattern_broken=yes], | 112 | [gl_cv_func_re_compile_pattern_working=no], |
135 | dnl When crosscompiling, assume it is broken. | 113 | dnl When crosscompiling, assume it is not working. |
136 | [gl_cv_func_re_compile_pattern_broken=yes])]) | 114 | [gl_cv_func_re_compile_pattern_working=no])]) |
137 | ac_use_included_regex=$gl_cv_func_re_compile_pattern_broken | 115 | case $gl_cv_func_re_compile_pattern_working in #( |
116 | yes) ac_use_included_regex=no;; #( | ||
117 | no) ac_use_included_regex=yes;; | ||
118 | esac | ||
138 | ;; | 119 | ;; |
139 | *) AC_MSG_ERROR([Invalid value for --with-included-regex: $with_included_regex]) | 120 | *) AC_MSG_ERROR([Invalid value for --with-included-regex: $with_included_regex]) |
140 | ;; | 121 | ;; |
141 | esac | 122 | esac |
142 | 123 | ||
143 | if test $ac_use_included_regex = yes; then | 124 | if test $ac_use_included_regex = yes; then |
125 | AC_DEFINE([_REGEX_LARGE_OFFSETS], 1, | ||
126 | [Define if you want regoff_t to be at least as wide POSIX requires.]) | ||
144 | AC_DEFINE([re_syntax_options], [rpl_re_syntax_options], | 127 | AC_DEFINE([re_syntax_options], [rpl_re_syntax_options], |
145 | [Define to rpl_re_syntax_options if the replacement should be used.]) | 128 | [Define to rpl_re_syntax_options if the replacement should be used.]) |
146 | AC_DEFINE([re_set_syntax], [rpl_re_set_syntax], | 129 | AC_DEFINE([re_set_syntax], [rpl_re_set_syntax], | ... | ... |
1 | # setenv.m4 serial 5 | 1 | # setenv.m4 serial 6 |
2 | dnl Copyright (C) 2001-2004 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 2001-2004, 2006 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. |
... | @@ -57,7 +57,6 @@ AC_DEFUN([gl_PREREQ_SETENV], | ... | @@ -57,7 +57,6 @@ AC_DEFUN([gl_PREREQ_SETENV], |
57 | AC_CHECK_HEADERS_ONCE(unistd.h) | 57 | AC_CHECK_HEADERS_ONCE(unistd.h) |
58 | AC_CHECK_HEADERS(search.h) | 58 | AC_CHECK_HEADERS(search.h) |
59 | AC_CHECK_FUNCS(tsearch) | 59 | AC_CHECK_FUNCS(tsearch) |
60 | gt_CHECK_VAR_DECL([#include <errno.h>], errno) | ||
61 | gt_CHECK_VAR_DECL([#include <unistd.h>], environ) | 60 | gt_CHECK_VAR_DECL([#include <unistd.h>], environ) |
62 | ]) | 61 | ]) |
63 | 62 | ||
... | @@ -65,6 +64,5 @@ AC_DEFUN([gl_PREREQ_SETENV], | ... | @@ -65,6 +64,5 @@ AC_DEFUN([gl_PREREQ_SETENV], |
65 | AC_DEFUN([gl_PREREQ_UNSETENV], | 64 | AC_DEFUN([gl_PREREQ_UNSETENV], |
66 | [ | 65 | [ |
67 | AC_CHECK_HEADERS_ONCE(unistd.h) | 66 | AC_CHECK_HEADERS_ONCE(unistd.h) |
68 | gt_CHECK_VAR_DECL([#include <errno.h>], errno) | ||
69 | gt_CHECK_VAR_DECL([#include <unistd.h>], environ) | 67 | gt_CHECK_VAR_DECL([#include <unistd.h>], environ) |
70 | ]) | 68 | ]) | ... | ... |
1 | # size_max.m4 serial 3 | 1 | # size_max.m4 serial 4 |
2 | dnl Copyright (C) 2003, 2005 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 2003, 2005-2006 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. |
... | @@ -23,28 +23,29 @@ Found it | ... | @@ -23,28 +23,29 @@ Found it |
23 | ], result=yes) | 23 | ], result=yes) |
24 | if test -z "$result"; then | 24 | if test -z "$result"; then |
25 | dnl Define it ourselves. Here we assume that the type 'size_t' is not wider | 25 | dnl Define it ourselves. Here we assume that the type 'size_t' is not wider |
26 | dnl than the type 'unsigned long'. | 26 | dnl than the type 'unsigned long'. Try hard to find a definition that can |
27 | dnl The _AC_COMPUTE_INT macro works up to LONG_MAX, since it uses 'expr', | 27 | dnl be used in a preprocessor #if, i.e. doesn't contain a cast. |
28 | dnl which is guaranteed to work from LONG_MIN to LONG_MAX. | 28 | _AC_COMPUTE_INT([sizeof (size_t) * CHAR_BIT - 1], size_t_bits_minus_1, |
29 | _AC_COMPUTE_INT([(size_t)~(size_t)0 / 10], res_hi, | 29 | [#include <stddef.h> |
30 | [#include <stddef.h>], result=?) | 30 | #include <limits.h>], size_t_bits_minus_1=) |
31 | _AC_COMPUTE_INT([(size_t)~(size_t)0 % 10], res_lo, | ||
32 | [#include <stddef.h>], result=?) | ||
33 | _AC_COMPUTE_INT([sizeof (size_t) <= sizeof (unsigned int)], fits_in_uint, | 31 | _AC_COMPUTE_INT([sizeof (size_t) <= sizeof (unsigned int)], fits_in_uint, |
34 | [#include <stddef.h>], result=?) | 32 | [#include <stddef.h>], fits_in_uint=) |
35 | if test "$fits_in_uint" = 1; then | 33 | if test -n "$size_t_bits_minus_1" && test -n "$fits_in_uint"; then |
36 | dnl Even though SIZE_MAX fits in an unsigned int, it must be of type | 34 | if test $fits_in_uint = 1; then |
37 | dnl 'unsigned long' if the type 'size_t' is the same as 'unsigned long'. | 35 | dnl Even though SIZE_MAX fits in an unsigned int, it must be of type |
38 | AC_TRY_COMPILE([#include <stddef.h> | 36 | dnl 'unsigned long' if the type 'size_t' is the same as 'unsigned long'. |
39 | extern size_t foo; | 37 | AC_TRY_COMPILE([#include <stddef.h> |
40 | extern unsigned long foo; | 38 | extern size_t foo; |
41 | ], [], fits_in_uint=0) | 39 | extern unsigned long foo; |
42 | fi | 40 | ], [], fits_in_uint=0) |
43 | if test -z "$result"; then | 41 | fi |
44 | if test "$fits_in_uint" = 1; then | 42 | dnl We cannot use 'expr' to simplify this expression, because 'expr' |
45 | result="$res_hi$res_lo"U | 43 | dnl works only with 'long' integers in the host environment, while we |
44 | dnl might be cross-compiling from a 32-bit platform to a 64-bit platform. | ||
45 | if test $fits_in_uint = 1; then | ||
46 | result="(((1U << $size_t_bits_minus_1) - 1) * 2 + 1)" | ||
46 | else | 47 | else |
47 | result="$res_hi$res_lo"UL | 48 | result="(((1UL << $size_t_bits_minus_1) - 1) * 2 + 1)" |
48 | fi | 49 | fi |
49 | else | 50 | else |
50 | dnl Shouldn't happen, but who knows... | 51 | dnl Shouldn't happen, but who knows... | ... | ... |
1 | # ssize_t.m4 serial 3 (gettext-0.13) | 1 | # ssize_t.m4 serial 4 (gettext-0.15) |
2 | dnl Copyright (C) 2001-2003 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 2001-2003, 2006 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. |
... | @@ -9,12 +9,13 @@ dnl Test whether ssize_t is defined. | ... | @@ -9,12 +9,13 @@ dnl Test whether ssize_t is defined. |
9 | 9 | ||
10 | AC_DEFUN([gt_TYPE_SSIZE_T], | 10 | AC_DEFUN([gt_TYPE_SSIZE_T], |
11 | [ | 11 | [ |
12 | AC_CACHE_CHECK([for ssize_t], gt_cv_ssize_t, | 12 | AC_CACHE_CHECK([for ssize_t], [gt_cv_ssize_t], |
13 | [AC_TRY_COMPILE([#include <sys/types.h>], | 13 | [AC_TRY_COMPILE([#include <sys/types.h>], |
14 | [int x = sizeof (ssize_t *) + sizeof (ssize_t);], | 14 | [int x = sizeof (ssize_t *) + sizeof (ssize_t); |
15 | gt_cv_ssize_t=yes, gt_cv_ssize_t=no)]) | 15 | return !x;], |
16 | [gt_cv_ssize_t=yes], [gt_cv_ssize_t=no])]) | ||
16 | if test $gt_cv_ssize_t = no; then | 17 | if test $gt_cv_ssize_t = no; then |
17 | AC_DEFINE(ssize_t, int, | 18 | AC_DEFINE([ssize_t], [int], |
18 | [Define as a signed type of the same size as size_t.]) | 19 | [Define as a signed type of the same size as size_t.]) |
19 | fi | 20 | fi |
20 | ]) | 21 | ]) | ... | ... |
1 | # Check for stdbool.h that conforms to C99. | 1 | # Check for stdbool.h that conforms to C99. |
2 | 2 | ||
3 | dnl Copyright (C) 2002-2005 Free Software Foundation, Inc. | 3 | dnl Copyright (C) 2002-2006 Free Software Foundation, Inc. |
4 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
5 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
6 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
... | @@ -64,9 +64,9 @@ AC_DEFUN([AC_HEADER_STDBOOL], | ... | @@ -64,9 +64,9 @@ AC_DEFUN([AC_HEADER_STDBOOL], |
64 | char a[true == 1 ? 1 : -1]; | 64 | char a[true == 1 ? 1 : -1]; |
65 | char b[false == 0 ? 1 : -1]; | 65 | char b[false == 0 ? 1 : -1]; |
66 | char c[__bool_true_false_are_defined == 1 ? 1 : -1]; | 66 | char c[__bool_true_false_are_defined == 1 ? 1 : -1]; |
67 | char d[(bool) -0.5 == true ? 1 : -1]; | 67 | char d[(bool) 0.5 == true ? 1 : -1]; |
68 | bool e = &s; | 68 | bool e = &s; |
69 | char f[(_Bool) -0.0 == false ? 1 : -1]; | 69 | char f[(_Bool) 0.0 == false ? 1 : -1]; |
70 | char g[true]; | 70 | char g[true]; |
71 | char h[sizeof (_Bool)]; | 71 | char h[sizeof (_Bool)]; |
72 | char i[sizeof s.t]; | 72 | char i[sizeof s.t]; |
... | @@ -74,11 +74,38 @@ AC_DEFUN([AC_HEADER_STDBOOL], | ... | @@ -74,11 +74,38 @@ AC_DEFUN([AC_HEADER_STDBOOL], |
74 | _Bool n[m]; | 74 | _Bool n[m]; |
75 | char o[sizeof n == m * sizeof n[0] ? 1 : -1]; | 75 | char o[sizeof n == m * sizeof n[0] ? 1 : -1]; |
76 | char p[-1 - (_Bool) 0 < 0 && -1 - (bool) 0 < 0 ? 1 : -1]; | 76 | char p[-1 - (_Bool) 0 < 0 && -1 - (bool) 0 < 0 ? 1 : -1]; |
77 | #if defined __xlc__ || defined __GNUC__ | ||
78 | /* Catch a bug in IBM AIX xlc compiler version 6.0.0.0 | ||
79 | reported by James Lemley on 2005-10-05; see | ||
80 | http://lists.gnu.org/archive/html/bug-coreutils/2005-10/msg00086.html | ||
81 | This test is not quite right, since xlc is allowed to | ||
82 | reject this program, as the initializer for xlcbug is | ||
83 | not one of the forms that C requires support for. | ||
84 | However, doing the test right would require a run-time | ||
85 | test, and that would make cross-compilation harder. | ||
86 | Let us hope that IBM fixes the xlc bug, and also adds | ||
87 | support for this kind of constant expression. In the | ||
88 | meantime, this test will reject xlc, which is OK, since | ||
89 | our stdbool.h substitute should suffice. We also test | ||
90 | this with GCC, where it should work, to detect more | ||
91 | quickly whether someone messes up the test in the | ||
92 | future. */ | ||
93 | char digs[] = "0123456789"; | ||
94 | int xlcbug = 1 / (&(digs + 5)[-2 + (bool) 1] == &digs[4] ? 1 : -1); | ||
95 | #endif | ||
96 | /* Catch a bug in an HP-UX C compiler. See | ||
97 | http://gcc.gnu.org/ml/gcc-patches/2003-12/msg02303.html | ||
98 | http://lists.gnu.org/archive/html/bug-coreutils/2005-11/msg00161.html | ||
99 | */ | ||
100 | _Bool q = true; | ||
101 | _Bool *pq = &q; | ||
77 | ], | 102 | ], |
78 | [ | 103 | [ |
104 | *pq |= q; | ||
105 | *pq |= ! q; | ||
79 | /* Refer to every declared value, to avoid compiler optimizations. */ | 106 | /* Refer to every declared value, to avoid compiler optimizations. */ |
80 | return (!a + !b + !c + !d + !e + !f + !g + !h + !i + !!j + !k + !!l | 107 | return (!a + !b + !c + !d + !e + !f + !g + !h + !i + !!j + !k + !!l |
81 | + !m + !n + !o + !p); | 108 | + !m + !n + !o + !p + !q + !pq); |
82 | ], | 109 | ], |
83 | [ac_cv_header_stdbool_h=yes], | 110 | [ac_cv_header_stdbool_h=yes], |
84 | [ac_cv_header_stdbool_h=no])]) | 111 | [ac_cv_header_stdbool_h=no])]) | ... | ... |
This diff is collapsed.
Click to expand it.
... | @@ -25,6 +25,7 @@ AC_CACHE_CHECK([whether strerror_r returns char *], | ... | @@ -25,6 +25,7 @@ AC_CACHE_CHECK([whether strerror_r returns char *], |
25 | char buf[100]; | 25 | char buf[100]; |
26 | char x = *strerror_r (0, buf, sizeof buf); | 26 | char x = *strerror_r (0, buf, sizeof buf); |
27 | char *p = strerror_r (0, buf, sizeof buf); | 27 | char *p = strerror_r (0, buf, sizeof buf); |
28 | return !p || x; | ||
28 | ]])], | 29 | ]])], |
29 | ac_cv_func_strerror_r_char_p=yes) | 30 | ac_cv_func_strerror_r_char_p=yes) |
30 | else | 31 | else | ... | ... |
1 | # strndup.m4 serial 5 | 1 | # strndup.m4 serial 6 |
2 | dnl Copyright (C) 2002, 2003, 2005 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 2002-2003, 2005-2006 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. |
... | @@ -11,8 +11,36 @@ AC_DEFUN([gl_FUNC_STRNDUP], | ... | @@ -11,8 +11,36 @@ AC_DEFUN([gl_FUNC_STRNDUP], |
11 | dnl Persuade glibc <string.h> to declare strndup(). | 11 | dnl Persuade glibc <string.h> to declare strndup(). |
12 | AC_REQUIRE([AC_GNU_SOURCE]) | 12 | AC_REQUIRE([AC_GNU_SOURCE]) |
13 | 13 | ||
14 | MU_REPLACE_FUNCS(strndup) | 14 | AC_CHECK_DECLS_ONCE([strndup]) |
15 | if test $ac_cv_func_strndup = no; then | 15 | |
16 | # AIX 4.3.3, AIX 5.1 have a function that fails to add the terminating '\0'. | ||
17 | AC_CACHE_CHECK([for working strndup], gl_cv_func_strndup, | ||
18 | [AC_RUN_IFELSE([ | ||
19 | AC_LANG_PROGRAM([#include <string.h>], [[ | ||
20 | #ifndef HAVE_DECL_STRNDUP | ||
21 | extern char *strndup (const char *, size_t); | ||
22 | #endif | ||
23 | char *s; | ||
24 | s = strndup ("some longer string", 15); | ||
25 | free (s); | ||
26 | s = strndup ("shorter string", 13); | ||
27 | return s[13] != '\0';]])], | ||
28 | [gl_cv_func_strndup=yes], | ||
29 | [gl_cv_func_strndup=no], | ||
30 | [AC_EGREP_CPP([too risky], [ | ||
31 | #ifdef _AIX | ||
32 | too risky | ||
33 | #endif | ||
34 | ], | ||
35 | [gl_cv_func_strndup=no], | ||
36 | [gl_cv_func_strndup=yes])])]) | ||
37 | if test $gl_cv_func_strndup = yes; then | ||
38 | AC_DEFINE([HAVE_STRNDUP], 1, | ||
39 | [Define if you have the strndup() function and it works.]) | ||
40 | else | ||
41 | MU_LIBOBJ([strndup]) | ||
42 | AC_DEFINE(strndup, rpl_strndup, | ||
43 | [Define to rpl_strndup if the replacement function should be used,]) | ||
16 | gl_PREREQ_STRNDUP | 44 | gl_PREREQ_STRNDUP |
17 | fi | 45 | fi |
18 | ]) | 46 | ]) | ... | ... |
1 | /* Memory allocation on the stack. | 1 | /* Memory allocation on the stack. |
2 | 2 | ||
3 | Copyright (C) 1995, 1999, 2001, 2002, 2003, 2004 Free Software | 3 | Copyright (C) 1995, 1999, 2001, 2002, 2003, 2004, 2006 Free Software |
4 | Foundation, Inc. | 4 | Foundation, Inc. |
5 | 5 | ||
6 | This program is free software; you can redistribute it and/or modify it | 6 | This program is free software; you can redistribute it and/or modify it |
... | @@ -34,19 +34,21 @@ | ... | @@ -34,19 +34,21 @@ |
34 | request, the program just crashes. | 34 | request, the program just crashes. |
35 | */ | 35 | */ |
36 | 36 | ||
37 | #ifdef __GNUC__ | 37 | #ifndef alloca |
38 | # define alloca __builtin_alloca | 38 | # ifdef __GNUC__ |
39 | #elif defined _AIX | 39 | # define alloca __builtin_alloca |
40 | # define alloca __alloca | 40 | # elif defined _AIX |
41 | #elif defined _MSC_VER | 41 | # define alloca __alloca |
42 | # include <malloc.h> | 42 | # elif defined _MSC_VER |
43 | # define alloca _alloca | 43 | # include <malloc.h> |
44 | #else | 44 | # define alloca _alloca |
45 | # include <stddef.h> | 45 | # else |
46 | # ifdef __cplusplus | 46 | # include <stddef.h> |
47 | # ifdef __cplusplus | ||
47 | extern "C" | 48 | extern "C" |
48 | # endif | 49 | # endif |
49 | void *alloca (size_t); | 50 | void *alloca (size_t); |
51 | # endif | ||
50 | #endif | 52 | #endif |
51 | 53 | ||
52 | #endif /* _GNULIB_ALLOCA_H */ | 54 | #endif /* _GNULIB_ALLOCA_H */ | ... | ... |
... | @@ -246,9 +246,10 @@ __argp_fmtstream_update (argp_fmtstream_t fs) | ... | @@ -246,9 +246,10 @@ __argp_fmtstream_update (argp_fmtstream_t fs) |
246 | Oh well. Put it on an overlong line by itself. */ | 246 | Oh well. Put it on an overlong line by itself. */ |
247 | p = buf + (r + 1 - fs->point_col); | 247 | p = buf + (r + 1 - fs->point_col); |
248 | /* Find the end of the long word. */ | 248 | /* Find the end of the long word. */ |
249 | do | 249 | if (p < nl) |
250 | ++p; | 250 | do |
251 | while (p < nl && !isblank (*p)); | 251 | ++p; |
252 | while (p < nl && !isblank (*p)); | ||
252 | if (p == nl) | 253 | if (p == nl) |
253 | { | 254 | { |
254 | /* It already ends a line. No fussing required. */ | 255 | /* It already ends a line. No fussing required. */ | ... | ... |
... | @@ -146,7 +146,7 @@ validate_uparams (const struct argp_state *state, struct uparams *upptr) | ... | @@ -146,7 +146,7 @@ validate_uparams (const struct argp_state *state, struct uparams *upptr) |
146 | __argp_failure (state, 0, 0, | 146 | __argp_failure (state, 0, 0, |
147 | dgettext (state->root_argp->argp_domain, | 147 | dgettext (state->root_argp->argp_domain, |
148 | "\ | 148 | "\ |
149 | ARGP_HELP_FMT: %s value is less then or equal to %s"), | 149 | ARGP_HELP_FMT: %s value is less than or equal to %s"), |
150 | "rmargin", up->name); | 150 | "rmargin", up->name); |
151 | return; | 151 | return; |
152 | } | 152 | } |
... | @@ -1304,7 +1304,7 @@ usage_long_opt (const struct argp_option *opt, | ... | @@ -1304,7 +1304,7 @@ usage_long_opt (const struct argp_option *opt, |
1304 | if (! arg) | 1304 | if (! arg) |
1305 | arg = real->arg; | 1305 | arg = real->arg; |
1306 | 1306 | ||
1307 | if (! (flags & OPTION_NO_USAGE)) | 1307 | if (! (flags & OPTION_NO_USAGE) && !odoc (opt)) |
1308 | { | 1308 | { |
1309 | if (arg) | 1309 | if (arg) |
1310 | { | 1310 | { | ... | ... |
... | @@ -79,11 +79,11 @@ static volatile int _argp_hang; | ... | @@ -79,11 +79,11 @@ static volatile int _argp_hang; |
79 | 79 | ||
80 | static const struct argp_option argp_default_options[] = | 80 | static const struct argp_option argp_default_options[] = |
81 | { | 81 | { |
82 | {"help", '?', 0, 0, N_("Give this help list"), -1}, | 82 | {"help", '?', 0, 0, N_("give this help list"), -1}, |
83 | {"usage", OPT_USAGE, 0, 0, N_("Give a short usage message"), 0}, | 83 | {"usage", OPT_USAGE, 0, 0, N_("give a short usage message"), 0}, |
84 | {"program-name",OPT_PROGNAME,N_("NAME"), OPTION_HIDDEN, N_("Set the program name"), 0}, | 84 | {"program-name",OPT_PROGNAME,N_("NAME"), OPTION_HIDDEN, N_("set the program name"), 0}, |
85 | {"HANG", OPT_HANG, N_("SECS"), OPTION_ARG_OPTIONAL | OPTION_HIDDEN, | 85 | {"HANG", OPT_HANG, N_("SECS"), OPTION_ARG_OPTIONAL | OPTION_HIDDEN, |
86 | N_("Hang for SECS seconds (default 3600)"), 0}, | 86 | N_("hang for SECS seconds (default 3600)"), 0}, |
87 | {NULL, 0, 0, 0, NULL, 0} | 87 | {NULL, 0, 0, 0, NULL, 0} |
88 | }; | 88 | }; |
89 | 89 | ||
... | @@ -140,7 +140,7 @@ static const struct argp argp_default_argp = | ... | @@ -140,7 +140,7 @@ static const struct argp argp_default_argp = |
140 | 140 | ||
141 | static const struct argp_option argp_version_options[] = | 141 | static const struct argp_option argp_version_options[] = |
142 | { | 142 | { |
143 | {"version", 'V', 0, 0, N_("Print program version"), -1}, | 143 | {"version", 'V', 0, 0, N_("print program version"), -1}, |
144 | {NULL, 0, 0, 0, NULL, 0} | 144 | {NULL, 0, 0, 0, NULL, 0} |
145 | }; | 145 | }; |
146 | 146 | ... | ... |
1 | /* Copyright (C) 1991,1992,1993,1996,1997,1998,1999,2000,2001,2002,2003,2004,2005 | 1 | /* Copyright (C) 1991,1992,1993,1996,1997,1998,1999,2000,2001,2002,2003,2004,2005,2006 |
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 |
... | @@ -180,7 +180,7 @@ static int posixly_correct; | ... | @@ -180,7 +180,7 @@ static int posixly_correct; |
180 | # define FCT internal_fnmatch | 180 | # define FCT internal_fnmatch |
181 | # define EXT ext_match | 181 | # define EXT ext_match |
182 | # define END end_pattern | 182 | # define END end_pattern |
183 | # define L(CS) CS | 183 | # define L_(CS) CS |
184 | # ifdef _LIBC | 184 | # ifdef _LIBC |
185 | # define BTOWC(C) __btowc (C) | 185 | # define BTOWC(C) __btowc (C) |
186 | # else | 186 | # else |
... | @@ -210,7 +210,7 @@ static int posixly_correct; | ... | @@ -210,7 +210,7 @@ static int posixly_correct; |
210 | # define FCT internal_fnwmatch | 210 | # define FCT internal_fnwmatch |
211 | # define EXT ext_wmatch | 211 | # define EXT ext_wmatch |
212 | # define END end_wpattern | 212 | # define END end_wpattern |
213 | # define L(CS) L##CS | 213 | # define L_(CS) L##CS |
214 | # define BTOWC(C) (C) | 214 | # define BTOWC(C) (C) |
215 | # ifdef _LIBC | 215 | # ifdef _LIBC |
216 | # define STRLEN(S) __wcslen (S) | 216 | # define STRLEN(S) __wcslen (S) | ... | ... |
This diff is collapsed.
Click to expand it.
... | @@ -26,10 +26,7 @@ | ... | @@ -26,10 +26,7 @@ |
26 | 26 | ||
27 | #include <errno.h> | 27 | #include <errno.h> |
28 | #include <string.h> | 28 | #include <string.h> |
29 | 29 | #include <unistd.h> | |
30 | #if HAVE_UNISTD_H | ||
31 | # include <unistd.h> | ||
32 | #endif | ||
33 | 30 | ||
34 | #if !HAVE_DECL_GETLOGIN | 31 | #if !HAVE_DECL_GETLOGIN |
35 | char *getlogin (void); | 32 | char *getlogin (void); | ... | ... |
... | @@ -19,10 +19,7 @@ | ... | @@ -19,10 +19,7 @@ |
19 | /* Written by Paul Eggert and Derek Price. */ | 19 | /* Written by Paul Eggert and Derek Price. */ |
20 | 20 | ||
21 | #include <stddef.h> | 21 | #include <stddef.h> |
22 | 22 | #include <unistd.h> | |
23 | #if HAVE_UNISTD_H | ||
24 | # include <unistd.h> | ||
25 | #endif | ||
26 | 23 | ||
27 | /* Copies the user's login name to NAME. | 24 | /* Copies the user's login name to NAME. |
28 | The array pointed to by NAME has room for SIZE bytes. | 25 | The array pointed to by NAME has room for SIZE bytes. | ... | ... |
... | @@ -2,7 +2,7 @@ | ... | @@ -2,7 +2,7 @@ |
2 | NOTE: getopt is now part of the C library, so if you don't know what | 2 | NOTE: getopt is now part of the C library, so if you don't know what |
3 | "Keep this file name-space clean" means, talk to drepper@gnu.org | 3 | "Keep this file name-space clean" means, talk to drepper@gnu.org |
4 | before changing it! | 4 | before changing it! |
5 | Copyright (C) 1987,88,89,90,91,92,93,94,95,96,98,99,2000,2001,2002,2003,2004 | 5 | Copyright (C) 1987,88,89,90,91,92,93,94,95,96,98,99,2000,2001,2002,2003,2004,2006 |
6 | Free Software Foundation, Inc. | 6 | Free Software Foundation, Inc. |
7 | This file is part of the GNU C Library. | 7 | This file is part of the GNU C Library. |
8 | 8 | ||
... | @@ -20,28 +20,16 @@ | ... | @@ -20,28 +20,16 @@ |
20 | with this program; if not, write to the Free Software Foundation, | 20 | with this program; if not, write to the Free Software Foundation, |
21 | Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ | 21 | Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ |
22 | 22 | ||
23 | /* This tells Alpha OSF/1 not to define a getopt prototype in <stdio.h>. | ||
24 | Ditto for AIX 3.2 and <stdlib.h>. */ | ||
25 | #ifndef _NO_PROTO | ||
26 | # define _NO_PROTO | ||
27 | #endif | ||
28 | |||
29 | #ifdef HAVE_CONFIG_H | 23 | #ifdef HAVE_CONFIG_H |
30 | # include <config.h> | 24 | # include <config.h> |
31 | #endif | 25 | #endif |
32 | 26 | ||
33 | #include <stdio.h> | 27 | #include "getopt.h" |
34 | |||
35 | /* This needs to come after some library #include | ||
36 | to get __GNU_LIBRARY__ defined. */ | ||
37 | #ifdef __GNU_LIBRARY__ | ||
38 | /* Don't include stdlib.h for non-GNU C libraries because some of them | ||
39 | contain conflicting prototypes for getopt. */ | ||
40 | # include <stdlib.h> | ||
41 | # include <unistd.h> | ||
42 | #endif /* GNU C library. */ | ||
43 | 28 | ||
29 | #include <stdio.h> | ||
30 | #include <stdlib.h> | ||
44 | #include <string.h> | 31 | #include <string.h> |
32 | #include <unistd.h> | ||
45 | 33 | ||
46 | #ifdef VMS | 34 | #ifdef VMS |
47 | # include <unixlib.h> | 35 | # include <unixlib.h> |
... | @@ -76,7 +64,6 @@ | ... | @@ -76,7 +64,6 @@ |
76 | GNU application programs can use a third alternative mode in which | 64 | GNU application programs can use a third alternative mode in which |
77 | they can distinguish the relative order of options and other arguments. */ | 65 | they can distinguish the relative order of options and other arguments. */ |
78 | 66 | ||
79 | #include "getopt.h" | ||
80 | #include "getopt_int.h" | 67 | #include "getopt_int.h" |
81 | 68 | ||
82 | /* For communication from `getopt' to the caller. | 69 | /* For communication from `getopt' to the caller. |
... | @@ -118,16 +105,9 @@ int optopt = '?'; | ... | @@ -118,16 +105,9 @@ int optopt = '?'; |
118 | static struct _getopt_data getopt_data; | 105 | static struct _getopt_data getopt_data; |
119 | 106 | ||
120 | 107 | ||
121 | #ifndef __GNU_LIBRARY__ | 108 | #if defined HAVE_DECL_GETENV && !HAVE_DECL_GETENV |
122 | |||
123 | /* Avoid depending on library functions or files | ||
124 | whose names are inconsistent. */ | ||
125 | |||
126 | #ifndef getenv | ||
127 | extern char *getenv (); | 109 | extern char *getenv (); |
128 | #endif | 110 | #endif |
129 | |||
130 | #endif /* not __GNU_LIBRARY__ */ | ||
131 | 111 | ||
132 | #ifdef _LIBC | 112 | #ifdef _LIBC |
133 | /* Stored original parameters. | 113 | /* Stored original parameters. |
... | @@ -556,10 +536,7 @@ _getopt_internal_r (int argc, char **argv, const char *optstring, | ... | @@ -556,10 +536,7 @@ _getopt_internal_r (int argc, char **argv, const char *optstring, |
556 | int old_flags2 = ((_IO_FILE *) stderr)->_flags2; | 536 | int old_flags2 = ((_IO_FILE *) stderr)->_flags2; |
557 | ((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL; | 537 | ((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL; |
558 | 538 | ||
559 | if (_IO_fwide (stderr, 0) > 0) | 539 | __fxprintf (NULL, "%s", buf); |
560 | __fwprintf (stderr, L"%s", buf); | ||
561 | else | ||
562 | fputs (buf, stderr); | ||
563 | 540 | ||
564 | ((_IO_FILE *) stderr)->_flags2 = old_flags2; | 541 | ((_IO_FILE *) stderr)->_flags2 = old_flags2; |
565 | _IO_funlockfile (stderr); | 542 | _IO_funlockfile (stderr); |
... | @@ -634,10 +611,7 @@ _getopt_internal_r (int argc, char **argv, const char *optstring, | ... | @@ -634,10 +611,7 @@ _getopt_internal_r (int argc, char **argv, const char *optstring, |
634 | ((_IO_FILE *) stderr)->_flags2 | 611 | ((_IO_FILE *) stderr)->_flags2 |
635 | |= _IO_FLAGS2_NOTCANCEL; | 612 | |= _IO_FLAGS2_NOTCANCEL; |
636 | 613 | ||
637 | if (_IO_fwide (stderr, 0) > 0) | 614 | __fxprintf (NULL, "%s", buf); |
638 | __fwprintf (stderr, L"%s", buf); | ||
639 | else | ||
640 | fputs (buf, stderr); | ||
641 | 615 | ||
642 | ((_IO_FILE *) stderr)->_flags2 = old_flags2; | 616 | ((_IO_FILE *) stderr)->_flags2 = old_flags2; |
643 | _IO_funlockfile (stderr); | 617 | _IO_funlockfile (stderr); |
... | @@ -674,10 +648,7 @@ _getopt_internal_r (int argc, char **argv, const char *optstring, | ... | @@ -674,10 +648,7 @@ _getopt_internal_r (int argc, char **argv, const char *optstring, |
674 | ((_IO_FILE *) stderr)->_flags2 | 648 | ((_IO_FILE *) stderr)->_flags2 |
675 | |= _IO_FLAGS2_NOTCANCEL; | 649 | |= _IO_FLAGS2_NOTCANCEL; |
676 | 650 | ||
677 | if (_IO_fwide (stderr, 0) > 0) | 651 | __fxprintf (NULL, "%s", buf); |
678 | __fwprintf (stderr, L"%s", buf); | ||
679 | else | ||
680 | fputs (buf, stderr); | ||
681 | 652 | ||
682 | ((_IO_FILE *) stderr)->_flags2 = old_flags2; | 653 | ((_IO_FILE *) stderr)->_flags2 = old_flags2; |
683 | _IO_funlockfile (stderr); | 654 | _IO_funlockfile (stderr); |
... | @@ -751,10 +722,7 @@ _getopt_internal_r (int argc, char **argv, const char *optstring, | ... | @@ -751,10 +722,7 @@ _getopt_internal_r (int argc, char **argv, const char *optstring, |
751 | int old_flags2 = ((_IO_FILE *) stderr)->_flags2; | 722 | int old_flags2 = ((_IO_FILE *) stderr)->_flags2; |
752 | ((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL; | 723 | ((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL; |
753 | 724 | ||
754 | if (_IO_fwide (stderr, 0) > 0) | 725 | __fxprintf (NULL, "%s", buf); |
755 | __fwprintf (stderr, L"%s", buf); | ||
756 | else | ||
757 | fputs (buf, stderr); | ||
758 | 726 | ||
759 | ((_IO_FILE *) stderr)->_flags2 = old_flags2; | 727 | ((_IO_FILE *) stderr)->_flags2 = old_flags2; |
760 | _IO_funlockfile (stderr); | 728 | _IO_funlockfile (stderr); |
... | @@ -817,10 +785,7 @@ _getopt_internal_r (int argc, char **argv, const char *optstring, | ... | @@ -817,10 +785,7 @@ _getopt_internal_r (int argc, char **argv, const char *optstring, |
817 | int old_flags2 = ((_IO_FILE *) stderr)->_flags2; | 785 | int old_flags2 = ((_IO_FILE *) stderr)->_flags2; |
818 | ((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL; | 786 | ((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL; |
819 | 787 | ||
820 | if (_IO_fwide (stderr, 0) > 0) | 788 | __fxprintf (NULL, "%s", buf); |
821 | __fwprintf (stderr, L"%s", buf); | ||
822 | else | ||
823 | fputs (buf, stderr); | ||
824 | 789 | ||
825 | ((_IO_FILE *) stderr)->_flags2 = old_flags2; | 790 | ((_IO_FILE *) stderr)->_flags2 = old_flags2; |
826 | _IO_funlockfile (stderr); | 791 | _IO_funlockfile (stderr); |
... | @@ -868,10 +833,7 @@ _getopt_internal_r (int argc, char **argv, const char *optstring, | ... | @@ -868,10 +833,7 @@ _getopt_internal_r (int argc, char **argv, const char *optstring, |
868 | int old_flags2 = ((_IO_FILE *) stderr)->_flags2; | 833 | int old_flags2 = ((_IO_FILE *) stderr)->_flags2; |
869 | ((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL; | 834 | ((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL; |
870 | 835 | ||
871 | if (_IO_fwide (stderr, 0) > 0) | 836 | __fxprintf (NULL, "%s", buf); |
872 | __fwprintf (stderr, L"%s", buf); | ||
873 | else | ||
874 | fputs (buf, stderr); | ||
875 | 837 | ||
876 | ((_IO_FILE *) stderr)->_flags2 = old_flags2; | 838 | ((_IO_FILE *) stderr)->_flags2 = old_flags2; |
877 | _IO_funlockfile (stderr); | 839 | _IO_funlockfile (stderr); |
... | @@ -940,10 +902,7 @@ _getopt_internal_r (int argc, char **argv, const char *optstring, | ... | @@ -940,10 +902,7 @@ _getopt_internal_r (int argc, char **argv, const char *optstring, |
940 | int old_flags2 = ((_IO_FILE *) stderr)->_flags2; | 902 | int old_flags2 = ((_IO_FILE *) stderr)->_flags2; |
941 | ((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL; | 903 | ((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL; |
942 | 904 | ||
943 | if (_IO_fwide (stderr, 0) > 0) | 905 | __fxprintf (NULL, "%s", buf); |
944 | __fwprintf (stderr, L"%s", buf); | ||
945 | else | ||
946 | fputs (buf, stderr); | ||
947 | 906 | ||
948 | ((_IO_FILE *) stderr)->_flags2 = old_flags2; | 907 | ((_IO_FILE *) stderr)->_flags2 = old_flags2; |
949 | _IO_funlockfile (stderr); | 908 | _IO_funlockfile (stderr); |
... | @@ -985,10 +944,7 @@ _getopt_internal_r (int argc, char **argv, const char *optstring, | ... | @@ -985,10 +944,7 @@ _getopt_internal_r (int argc, char **argv, const char *optstring, |
985 | ((_IO_FILE *) stderr)->_flags2 | 944 | ((_IO_FILE *) stderr)->_flags2 |
986 | |= _IO_FLAGS2_NOTCANCEL; | 945 | |= _IO_FLAGS2_NOTCANCEL; |
987 | 946 | ||
988 | if (_IO_fwide (stderr, 0) > 0) | 947 | __fxprintf (NULL, "%s", buf); |
989 | __fwprintf (stderr, L"%s", buf); | ||
990 | else | ||
991 | fputs (buf, stderr); | ||
992 | 948 | ||
993 | ((_IO_FILE *) stderr)->_flags2 = old_flags2; | 949 | ((_IO_FILE *) stderr)->_flags2 = old_flags2; |
994 | _IO_funlockfile (stderr); | 950 | _IO_funlockfile (stderr); |
... | @@ -1027,10 +983,7 @@ _getopt_internal_r (int argc, char **argv, const char *optstring, | ... | @@ -1027,10 +983,7 @@ _getopt_internal_r (int argc, char **argv, const char *optstring, |
1027 | ((_IO_FILE *) stderr)->_flags2 | 983 | ((_IO_FILE *) stderr)->_flags2 |
1028 | |= _IO_FLAGS2_NOTCANCEL; | 984 | |= _IO_FLAGS2_NOTCANCEL; |
1029 | 985 | ||
1030 | if (_IO_fwide (stderr, 0) > 0) | 986 | __fxprintf (NULL, "%s", buf); |
1031 | __fwprintf (stderr, L"%s", buf); | ||
1032 | else | ||
1033 | fputs (buf, stderr); | ||
1034 | 987 | ||
1035 | ((_IO_FILE *) stderr)->_flags2 = old_flags2; | 988 | ((_IO_FILE *) stderr)->_flags2 = old_flags2; |
1036 | _IO_funlockfile (stderr); | 989 | _IO_funlockfile (stderr); |
... | @@ -1101,10 +1054,7 @@ _getopt_internal_r (int argc, char **argv, const char *optstring, | ... | @@ -1101,10 +1054,7 @@ _getopt_internal_r (int argc, char **argv, const char *optstring, |
1101 | int old_flags2 = ((_IO_FILE *) stderr)->_flags2; | 1054 | int old_flags2 = ((_IO_FILE *) stderr)->_flags2; |
1102 | ((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL; | 1055 | ((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL; |
1103 | 1056 | ||
1104 | if (_IO_fwide (stderr, 0) > 0) | 1057 | __fxprintf (NULL, "%s", buf); |
1105 | __fwprintf (stderr, L"%s", buf); | ||
1106 | else | ||
1107 | fputs (buf, stderr); | ||
1108 | 1058 | ||
1109 | ((_IO_FILE *) stderr)->_flags2 = old_flags2; | 1059 | ((_IO_FILE *) stderr)->_flags2 = old_flags2; |
1110 | _IO_funlockfile (stderr); | 1060 | _IO_funlockfile (stderr); | ... | ... |
1 | /* Copyright (C) 1991-2002,2003,2004,2005 Free Software Foundation, Inc. | 1 | /* Copyright (C) 1991-2002,2003,2004,2005,2006 Free Software Foundation, Inc. |
2 | This file is part of the GNU C Library. | 2 | This file is part of the GNU C Library. |
3 | 3 | ||
4 | The GNU C Library is free software; you can redistribute it and/or | 4 | The GNU C Library is free software; you can redistribute it and/or |
... | @@ -34,13 +34,10 @@ | ... | @@ -34,13 +34,10 @@ |
34 | #include <stdio.h> /* Needed on stupid SunOS for assert. */ | 34 | #include <stdio.h> /* Needed on stupid SunOS for assert. */ |
35 | 35 | ||
36 | #if !defined _LIBC || !defined GLOB_ONLY_P | 36 | #if !defined _LIBC || !defined GLOB_ONLY_P |
37 | #if defined HAVE_UNISTD_H || defined _LIBC | 37 | |
38 | # include <unistd.h> | 38 | #include <unistd.h> |
39 | # ifndef POSIX | 39 | #if !defined POSIX && defined _POSIX_VERSION |
40 | # ifdef _POSIX_VERSION | 40 | # define POSIX |
41 | # define POSIX | ||
42 | # endif | ||
43 | # endif | ||
44 | #endif | 41 | #endif |
45 | 42 | ||
46 | #include <pwd.h> | 43 | #include <pwd.h> |
... | @@ -322,7 +319,7 @@ glob (pattern, flags, errfunc, pglob) | ... | @@ -322,7 +319,7 @@ glob (pattern, flags, errfunc, pglob) |
322 | next = next_brace_sub (begin + 1, flags); | 319 | next = next_brace_sub (begin + 1, flags); |
323 | if (next == NULL) | 320 | if (next == NULL) |
324 | { | 321 | { |
325 | /* It is an illegal expression. */ | 322 | /* It is an invalid expression. */ |
326 | #ifndef __GNUC__ | 323 | #ifndef __GNUC__ |
327 | free (onealt); | 324 | free (onealt); |
328 | #endif | 325 | #endif |
... | @@ -336,7 +333,7 @@ glob (pattern, flags, errfunc, pglob) | ... | @@ -336,7 +333,7 @@ glob (pattern, flags, errfunc, pglob) |
336 | rest = next_brace_sub (rest + 1, flags); | 333 | rest = next_brace_sub (rest + 1, flags); |
337 | if (rest == NULL) | 334 | if (rest == NULL) |
338 | { | 335 | { |
339 | /* It is an illegal expression. */ | 336 | /* It is an invalid expression. */ |
340 | #ifndef __GNUC__ | 337 | #ifndef __GNUC__ |
341 | free (onealt); | 338 | free (onealt); |
342 | #endif | 339 | #endif |
... | @@ -912,8 +909,8 @@ libc_hidden_def (globfree) | ... | @@ -912,8 +909,8 @@ libc_hidden_def (globfree) |
912 | static int | 909 | static int |
913 | collated_compare (const void *a, const void *b) | 910 | collated_compare (const void *a, const void *b) |
914 | { | 911 | { |
915 | const char *const s1 = *(const char *const * const) a; | 912 | char *const *ps1 = a; char *s1 = *ps1; |
916 | const char *const s2 = *(const char *const * const) b; | 913 | char *const *ps2 = b; char *s2 = *ps2; |
917 | 914 | ||
918 | if (s1 == s2) | 915 | if (s1 == s2) |
919 | return 0; | 916 | return 0; | ... | ... |
1 | /* Decomposed printf argument list. | 1 | /* Decomposed printf argument list. |
2 | Copyright (C) 1999, 2002-2003 Free Software Foundation, Inc. | 2 | Copyright (C) 1999, 2002-2003, 2006 Free Software Foundation, Inc. |
3 | 3 | ||
4 | This program is free software; you can redistribute it and/or modify | 4 | This program is free software; you can redistribute it and/or modify |
5 | it under the terms of the GNU General Public License as published by | 5 | it under the terms of the GNU General Public License as published by |
... | @@ -84,10 +84,29 @@ printf_fetchargs (va_list args, arguments *a) | ... | @@ -84,10 +84,29 @@ printf_fetchargs (va_list args, arguments *a) |
84 | #endif | 84 | #endif |
85 | case TYPE_STRING: | 85 | case TYPE_STRING: |
86 | ap->a.a_string = va_arg (args, const char *); | 86 | ap->a.a_string = va_arg (args, const char *); |
87 | /* A null pointer is an invalid argument for "%s", but in practice | ||
88 | it occurs quite frequently in printf statements that produce | ||
89 | debug output. Use a fallback in this case. */ | ||
90 | if (ap->a.a_string == NULL) | ||
91 | ap->a.a_string = "(NULL)"; | ||
87 | break; | 92 | break; |
88 | #ifdef HAVE_WCHAR_T | 93 | #ifdef HAVE_WCHAR_T |
89 | case TYPE_WIDE_STRING: | 94 | case TYPE_WIDE_STRING: |
90 | ap->a.a_wide_string = va_arg (args, const wchar_t *); | 95 | ap->a.a_wide_string = va_arg (args, const wchar_t *); |
96 | /* A null pointer is an invalid argument for "%ls", but in practice | ||
97 | it occurs quite frequently in printf statements that produce | ||
98 | debug output. Use a fallback in this case. */ | ||
99 | if (ap->a.a_wide_string == NULL) | ||
100 | { | ||
101 | static const wchar_t wide_null_string[] = | ||
102 | { | ||
103 | (wchar_t)'(', | ||
104 | (wchar_t)'N', (wchar_t)'U', (wchar_t)'L', (wchar_t)'L', | ||
105 | (wchar_t)')', | ||
106 | (wchar_t)0 | ||
107 | }; | ||
108 | ap->a.a_wide_string = wide_null_string; | ||
109 | } | ||
91 | break; | 110 | break; |
92 | #endif | 111 | #endif |
93 | case TYPE_POINTER: | 112 | case TYPE_POINTER: | ... | ... |
This diff is collapsed.
Click to expand it.
1 | /* Extended regular expression matching and search library. | 1 | /* Extended regular expression matching and search library. |
2 | Copyright (C) 2002, 2003 Free Software Foundation, Inc. | 2 | Copyright (C) 2002, 2003, 2005, 2006 Free Software Foundation, Inc. |
3 | This file is part of the GNU C Library. | 3 | This file is part of the GNU C Library. |
4 | Contributed by Isamu Hasegawa <isamu@yamato.ibm.com>. | 4 | Contributed by Isamu Hasegawa <isamu@yamato.ibm.com>. |
5 | 5 | ||
... | @@ -21,6 +21,11 @@ | ... | @@ -21,6 +21,11 @@ |
21 | # include <config.h> | 21 | # include <config.h> |
22 | #endif | 22 | #endif |
23 | 23 | ||
24 | /* Make sure noone compiles this code with a C++ compiler. */ | ||
25 | #if defined __cplusplus && defined _LIBC | ||
26 | # error "This is C code, use a C compiler" | ||
27 | #endif | ||
28 | |||
24 | #ifdef _LIBC | 29 | #ifdef _LIBC |
25 | /* We have to keep the namespace clean. */ | 30 | /* We have to keep the namespace clean. */ |
26 | # define regfree(preg) __regfree (preg) | 31 | # define regfree(preg) __regfree (preg) | ... | ... |
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.
1 | /* size_max.h -- declare SIZE_MAX through system headers | 1 | /* size_max.h -- declare SIZE_MAX through system headers |
2 | Copyright (C) 2005 Free Software Foundation, Inc. | 2 | Copyright (C) 2005-2006 Free Software Foundation, Inc. |
3 | Written by Simon Josefsson. | 3 | Written by Simon Josefsson. |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify | 5 | This program is free software; you can redistribute it and/or modify |
... | @@ -19,9 +19,13 @@ | ... | @@ -19,9 +19,13 @@ |
19 | #ifndef GNULIB_SIZE_MAX_H | 19 | #ifndef GNULIB_SIZE_MAX_H |
20 | #define GNULIB_SIZE_MAX_H | 20 | #define GNULIB_SIZE_MAX_H |
21 | 21 | ||
22 | /* Get SIZE_MAX declaration on systems like Solaris 7/8/9. */ | ||
22 | # include <limits.h> | 23 | # include <limits.h> |
24 | /* Get SIZE_MAX declaration on systems like glibc 2. */ | ||
23 | # if HAVE_STDINT_H | 25 | # if HAVE_STDINT_H |
24 | # include <stdint.h> | 26 | # include <stdint.h> |
25 | # endif | 27 | # endif |
28 | /* On systems where these include files don't define it, SIZE_MAX is defined | ||
29 | in config.h. */ | ||
26 | 30 | ||
27 | #endif /* GNULIB_SIZE_MAX_H */ | 31 | #endif /* GNULIB_SIZE_MAX_H */ | ... | ... |
1 | /* Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc. | 1 | /* Copyright (C) 2001, 2002, 2003, 2006 Free Software Foundation, Inc. |
2 | Written by Bruno Haible <haible@clisp.cons.org>, 2001. | 2 | Written by Bruno Haible <haible@clisp.cons.org>, 2001. |
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 |
... | @@ -70,18 +70,40 @@ | ... | @@ -70,18 +70,40 @@ |
70 | (see ISO C 99 6.7.2.2.(4)); however, '_Bool' must promote to 'int' | 70 | (see ISO C 99 6.7.2.2.(4)); however, '_Bool' must promote to 'int' |
71 | (see ISO C 99 6.3.1.1.(2)). So we add a negative value to the | 71 | (see ISO C 99 6.3.1.1.(2)). So we add a negative value to the |
72 | enum; this ensures that '_Bool' promotes to 'int'. */ | 72 | enum; this ensures that '_Bool' promotes to 'int'. */ |
73 | #if !(defined __cplusplus || defined __BEOS__) | 73 | #if defined __cplusplus || defined __BEOS__ |
74 | /* A compiler known to have 'bool'. */ | ||
75 | /* If the compiler already has both 'bool' and '_Bool', we can assume they | ||
76 | are the same types. */ | ||
74 | # if !@HAVE__BOOL@ | 77 | # if !@HAVE__BOOL@ |
75 | # if defined __SUNPRO_C && (__SUNPRO_C < 0x550 || __STDC__ == 1) | 78 | typedef bool _Bool; |
76 | /* Avoid stupid "warning: _Bool is a keyword in ISO C99". */ | 79 | # endif |
77 | # define _Bool signed char | 80 | #else |
81 | # if !defined __GNUC__ | ||
82 | /* If @HAVE__BOOL@: | ||
83 | Some HP-UX cc and AIX IBM C compiler versions have compiler bugs when | ||
84 | the built-in _Bool type is used. See | ||
85 | http://gcc.gnu.org/ml/gcc-patches/2003-12/msg02303.html | ||
86 | http://lists.gnu.org/archive/html/bug-coreutils/2005-11/msg00161.html | ||
87 | http://lists.gnu.org/archive/html/bug-coreutils/2005-10/msg00086.html | ||
88 | Similar bugs are likely with other compilers as well; this file | ||
89 | wouldn't be used if <stdbool.h> was working. | ||
90 | So we override the _Bool type. | ||
91 | If !@HAVE__BOOL@: | ||
92 | Need to define _Bool ourselves. As 'signed char' or as an enum type? | ||
93 | Use of a typedef, with SunPRO C, leads to a stupid | ||
94 | "warning: _Bool is a keyword in ISO C99". | ||
95 | Use of an enum type, with IRIX cc, leads to a stupid | ||
96 | "warning(1185): enumerated type mixed with another type". | ||
97 | The only benefit of the enum type, debuggability, is not important | ||
98 | with these compilers. So use 'signed char' and no typedef. */ | ||
99 | # define _Bool signed char | ||
78 | enum { false = 0, true = 1 }; | 100 | enum { false = 0, true = 1 }; |
79 | # else | 101 | # else |
102 | /* With this compiler, trust the _Bool type if the compiler has it. */ | ||
103 | # if !@HAVE__BOOL@ | ||
80 | typedef enum { _Bool_must_promote_to_int = -1, false = 0, true = 1 } _Bool; | 104 | typedef enum { _Bool_must_promote_to_int = -1, false = 0, true = 1 } _Bool; |
81 | # endif | 105 | # endif |
82 | # endif | 106 | # endif |
83 | #else | ||
84 | typedef bool _Bool; | ||
85 | #endif | 107 | #endif |
86 | #define bool _Bool | 108 | #define bool _Bool |
87 | 109 | ... | ... |
This diff is collapsed.
Click to expand it.
1 | /* Copyright (C) 1996, 1997, 1998, 2000, 2003, 2005 Free Software Foundation, Inc. | 1 | /* Copyright (C) 1996, 1997, 1998, 2001, 2002, 2003, 2005, 2006 Free |
2 | Software Foundation, Inc. | ||
2 | 3 | ||
3 | NOTE: The canonical source of this file is maintained with the GNU C Library. | 4 | 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. | 5 | Bugs can be reported to bug-glibc@prep.ai.mit.edu. |
... | @@ -20,24 +21,35 @@ | ... | @@ -20,24 +21,35 @@ |
20 | #ifdef HAVE_CONFIG_H | 21 | #ifdef HAVE_CONFIG_H |
21 | # include <config.h> | 22 | # include <config.h> |
22 | #endif | 23 | #endif |
24 | #if !_LIBC | ||
25 | # include "strndup.h" | ||
26 | #endif | ||
23 | 27 | ||
24 | #include <stdlib.h> | 28 | #include <stdlib.h> |
25 | #include <string.h> | 29 | #include <string.h> |
26 | 30 | ||
27 | /* Get strnlen. */ | 31 | #if !_LIBC |
28 | #include "strnlen.h" | 32 | # include "strnlen.h" |
33 | # ifndef __strnlen | ||
34 | # define __strnlen strnlen | ||
35 | # endif | ||
36 | #endif | ||
29 | 37 | ||
30 | #undef __strndup | 38 | #undef __strndup |
31 | #undef strndup | 39 | #if _LIBC |
40 | # undef strndup | ||
41 | #endif | ||
32 | 42 | ||
33 | #ifndef weak_alias | 43 | #ifndef weak_alias |
34 | # define __strndup strndup | 44 | # define __strndup strndup |
35 | #endif | 45 | #endif |
36 | 46 | ||
37 | char * | 47 | char * |
38 | __strndup (const char *s, size_t n) | 48 | __strndup (s, n) |
49 | const char *s; | ||
50 | size_t n; | ||
39 | { | 51 | { |
40 | size_t len = strnlen (s, n); | 52 | size_t len = __strnlen (s, n); |
41 | char *new = malloc (len + 1); | 53 | char *new = malloc (len + 1); |
42 | 54 | ||
43 | if (new == NULL) | 55 | if (new == NULL) |
... | @@ -46,6 +58,9 @@ __strndup (const char *s, size_t n) | ... | @@ -46,6 +58,9 @@ __strndup (const char *s, size_t n) |
46 | new[len] = '\0'; | 58 | new[len] = '\0'; |
47 | return memcpy (new, s, len); | 59 | return memcpy (new, s, len); |
48 | } | 60 | } |
61 | #ifdef libc_hidden_def | ||
62 | libc_hidden_def (__strndup) | ||
63 | #endif | ||
49 | #ifdef weak_alias | 64 | #ifdef weak_alias |
50 | weak_alias (__strndup, strndup) | 65 | weak_alias (__strndup, strndup) |
51 | #endif | 66 | #endif | ... | ... |
1 | /* Find the length of STRING, but scan at most MAXLEN characters. | 1 | /* Find the length of STRING, but scan at most MAXLEN characters. |
2 | Copyright (C) 1996, 1997, 1998, 2000-2003 Free Software Foundation, Inc. | 2 | Copyright (C) 2005, 2006 Free Software Foundation, Inc. |
3 | This file is part of the GNU C Library. | 3 | Written by Simon Josefsson. |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify | 5 | This program is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published by | 6 | it under the terms of the GNU General Public License as published by |
... | @@ -12,37 +12,22 @@ | ... | @@ -12,37 +12,22 @@ |
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 License along | 15 | You should have received a copy of the GNU General Public License |
16 | with this program; if not, write to the Free Software Foundation, | 16 | along with this program; if not, write to the Free Software Foundation, |
17 | Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ | 17 | Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ |
18 | 18 | ||
19 | #ifdef HAVE_CONFIG_H | 19 | #ifdef HAVE_CONFIG_H |
20 | # include <config.h> | 20 | # include <config.h> |
21 | #endif | 21 | #endif |
22 | #undef strnlen | ||
23 | 22 | ||
24 | #include <string.h> | 23 | #include "strnlen.h" |
25 | |||
26 | #undef __strnlen | ||
27 | #undef strnlen | ||
28 | |||
29 | #ifndef _LIBC | ||
30 | # define strnlen rpl_strnlen | ||
31 | #endif | ||
32 | |||
33 | #ifndef weak_alias | ||
34 | # define __strnlen strnlen | ||
35 | #endif | ||
36 | 24 | ||
37 | /* Find the length of STRING, but scan at most MAXLEN characters. | 25 | /* Find the length of STRING, but scan at most MAXLEN characters. |
38 | If no '\0' terminator is found in that many characters, return MAXLEN. */ | 26 | If no '\0' terminator is found in that many characters, return MAXLEN. */ |
39 | 27 | ||
40 | size_t | 28 | size_t |
41 | __strnlen (const char *string, size_t maxlen) | 29 | strnlen (const char *string, size_t maxlen) |
42 | { | 30 | { |
43 | const char *end = memchr (string, '\0', maxlen); | 31 | const char *end = memchr (string, '\0', maxlen); |
44 | return end ? (size_t) (end - string) : maxlen; | 32 | return end ? (size_t) (end - string) : maxlen; |
45 | } | 33 | } |
46 | #ifdef weak_alias | ||
47 | weak_alias (__strnlen, strnlen) | ||
48 | #endif | ... | ... |
1 | /* vsprintf with automatic memory allocation. | 1 | /* vsprintf with automatic memory allocation. |
2 | Copyright (C) 1999, 2002-2005 Free Software Foundation, Inc. | 2 | Copyright (C) 1999, 2002-2006 Free Software Foundation, Inc. |
3 | 3 | ||
4 | This program is free software; you can redistribute it and/or modify | 4 | This program is free software; you can redistribute it and/or modify |
5 | it under the terms of the GNU General Public License as published by | 5 | it under the terms of the GNU General Public License as published by |
... | @@ -334,28 +334,28 @@ VASNPRINTF (CHAR_T *resultbuf, size_t *lengthp, const CHAR_T *format, va_list ar | ... | @@ -334,28 +334,28 @@ VASNPRINTF (CHAR_T *resultbuf, size_t *lengthp, const CHAR_T *format, va_list ar |
334 | tmp_length = | 334 | tmp_length = |
335 | (unsigned int) (sizeof (unsigned long long) * CHAR_BIT | 335 | (unsigned int) (sizeof (unsigned long long) * CHAR_BIT |
336 | * 0.30103 /* binary -> decimal */ | 336 | * 0.30103 /* binary -> decimal */ |
337 | * 2 /* estimate for FLAG_GROUP */ | ||
338 | ) | 337 | ) |
339 | + 1 /* turn floor into ceil */ | 338 | + 1; /* turn floor into ceil */ |
340 | + 1; /* account for leading sign */ | ||
341 | else | 339 | else |
342 | # endif | 340 | # endif |
343 | if (type == TYPE_LONGINT || type == TYPE_ULONGINT) | 341 | if (type == TYPE_LONGINT || type == TYPE_ULONGINT) |
344 | tmp_length = | 342 | tmp_length = |
345 | (unsigned int) (sizeof (unsigned long) * CHAR_BIT | 343 | (unsigned int) (sizeof (unsigned long) * CHAR_BIT |
346 | * 0.30103 /* binary -> decimal */ | 344 | * 0.30103 /* binary -> decimal */ |
347 | * 2 /* estimate for FLAG_GROUP */ | ||
348 | ) | 345 | ) |
349 | + 1 /* turn floor into ceil */ | 346 | + 1; /* turn floor into ceil */ |
350 | + 1; /* account for leading sign */ | ||
351 | else | 347 | else |
352 | tmp_length = | 348 | tmp_length = |
353 | (unsigned int) (sizeof (unsigned int) * CHAR_BIT | 349 | (unsigned int) (sizeof (unsigned int) * CHAR_BIT |
354 | * 0.30103 /* binary -> decimal */ | 350 | * 0.30103 /* binary -> decimal */ |
355 | * 2 /* estimate for FLAG_GROUP */ | ||
356 | ) | 351 | ) |
357 | + 1 /* turn floor into ceil */ | 352 | + 1; /* turn floor into ceil */ |
358 | + 1; /* account for leading sign */ | 353 | if (tmp_length < precision) |
354 | tmp_length = precision; | ||
355 | /* Multiply by 2, as an estimate for FLAG_GROUP. */ | ||
356 | tmp_length = xsum (tmp_length, tmp_length); | ||
357 | /* Add 1, to account for a leading sign. */ | ||
358 | tmp_length = xsum (tmp_length, 1); | ||
359 | break; | 359 | break; |
360 | 360 | ||
361 | case 'o': | 361 | case 'o': |
... | @@ -365,8 +365,7 @@ VASNPRINTF (CHAR_T *resultbuf, size_t *lengthp, const CHAR_T *format, va_list ar | ... | @@ -365,8 +365,7 @@ VASNPRINTF (CHAR_T *resultbuf, size_t *lengthp, const CHAR_T *format, va_list ar |
365 | (unsigned int) (sizeof (unsigned long long) * CHAR_BIT | 365 | (unsigned int) (sizeof (unsigned long long) * CHAR_BIT |
366 | * 0.333334 /* binary -> octal */ | 366 | * 0.333334 /* binary -> octal */ |
367 | ) | 367 | ) |
368 | + 1 /* turn floor into ceil */ | 368 | + 1; /* turn floor into ceil */ |
369 | + 1; /* account for leading sign */ | ||
370 | else | 369 | else |
371 | # endif | 370 | # endif |
372 | if (type == TYPE_LONGINT || type == TYPE_ULONGINT) | 371 | if (type == TYPE_LONGINT || type == TYPE_ULONGINT) |
... | @@ -374,15 +373,17 @@ VASNPRINTF (CHAR_T *resultbuf, size_t *lengthp, const CHAR_T *format, va_list ar | ... | @@ -374,15 +373,17 @@ VASNPRINTF (CHAR_T *resultbuf, size_t *lengthp, const CHAR_T *format, va_list ar |
374 | (unsigned int) (sizeof (unsigned long) * CHAR_BIT | 373 | (unsigned int) (sizeof (unsigned long) * CHAR_BIT |
375 | * 0.333334 /* binary -> octal */ | 374 | * 0.333334 /* binary -> octal */ |
376 | ) | 375 | ) |
377 | + 1 /* turn floor into ceil */ | 376 | + 1; /* turn floor into ceil */ |
378 | + 1; /* account for leading sign */ | ||
379 | else | 377 | else |
380 | tmp_length = | 378 | tmp_length = |
381 | (unsigned int) (sizeof (unsigned int) * CHAR_BIT | 379 | (unsigned int) (sizeof (unsigned int) * CHAR_BIT |
382 | * 0.333334 /* binary -> octal */ | 380 | * 0.333334 /* binary -> octal */ |
383 | ) | 381 | ) |
384 | + 1 /* turn floor into ceil */ | 382 | + 1; /* turn floor into ceil */ |
385 | + 1; /* account for leading sign */ | 383 | if (tmp_length < precision) |
384 | tmp_length = precision; | ||
385 | /* Add 1, to account for a leading sign. */ | ||
386 | tmp_length = xsum (tmp_length, 1); | ||
386 | break; | 387 | break; |
387 | 388 | ||
388 | case 'x': case 'X': | 389 | case 'x': case 'X': |
... | @@ -392,8 +393,7 @@ VASNPRINTF (CHAR_T *resultbuf, size_t *lengthp, const CHAR_T *format, va_list ar | ... | @@ -392,8 +393,7 @@ VASNPRINTF (CHAR_T *resultbuf, size_t *lengthp, const CHAR_T *format, va_list ar |
392 | (unsigned int) (sizeof (unsigned long long) * CHAR_BIT | 393 | (unsigned int) (sizeof (unsigned long long) * CHAR_BIT |
393 | * 0.25 /* binary -> hexadecimal */ | 394 | * 0.25 /* binary -> hexadecimal */ |
394 | ) | 395 | ) |
395 | + 1 /* turn floor into ceil */ | 396 | + 1; /* turn floor into ceil */ |
396 | + 2; /* account for leading sign or alternate form */ | ||
397 | else | 397 | else |
398 | # endif | 398 | # endif |
399 | if (type == TYPE_LONGINT || type == TYPE_ULONGINT) | 399 | if (type == TYPE_LONGINT || type == TYPE_ULONGINT) |
... | @@ -401,15 +401,17 @@ VASNPRINTF (CHAR_T *resultbuf, size_t *lengthp, const CHAR_T *format, va_list ar | ... | @@ -401,15 +401,17 @@ VASNPRINTF (CHAR_T *resultbuf, size_t *lengthp, const CHAR_T *format, va_list ar |
401 | (unsigned int) (sizeof (unsigned long) * CHAR_BIT | 401 | (unsigned int) (sizeof (unsigned long) * CHAR_BIT |
402 | * 0.25 /* binary -> hexadecimal */ | 402 | * 0.25 /* binary -> hexadecimal */ |
403 | ) | 403 | ) |
404 | + 1 /* turn floor into ceil */ | 404 | + 1; /* turn floor into ceil */ |
405 | + 2; /* account for leading sign or alternate form */ | ||
406 | else | 405 | else |
407 | tmp_length = | 406 | tmp_length = |
408 | (unsigned int) (sizeof (unsigned int) * CHAR_BIT | 407 | (unsigned int) (sizeof (unsigned int) * CHAR_BIT |
409 | * 0.25 /* binary -> hexadecimal */ | 408 | * 0.25 /* binary -> hexadecimal */ |
410 | ) | 409 | ) |
411 | + 1 /* turn floor into ceil */ | 410 | + 1; /* turn floor into ceil */ |
412 | + 2; /* account for leading sign or alternate form */ | 411 | if (tmp_length < precision) |
412 | tmp_length = precision; | ||
413 | /* Add 2, to account for a leading sign or alternate form. */ | ||
414 | tmp_length = xsum (tmp_length, 2); | ||
413 | break; | 415 | break; |
414 | 416 | ||
415 | case 'f': case 'F': | 417 | case 'f': case 'F': | ... | ... |
-
Please register or sign in to post a comment