From: John Marino Date: Sat, 29 Oct 2011 22:00:25 +0000 (+0200) Subject: Upgrade grep version 2.7 to 2.9 on the vendor branch X-Git-Tag: v3.0.0~777^2 X-Git-Url: https://gitweb.dragonflybsd.org/~nant/dragonfly.git/commitdiff_plain/200fbe8d4864acebd870d2b49e6432d73728581d?hp=-c Upgrade grep version 2.7 to 2.9 on the vendor branch --- 200fbe8d4864acebd870d2b49e6432d73728581d diff --git a/contrib/grep/README b/contrib/grep/README index 61ca8bb705..9c550ee362 100644 --- a/contrib/grep/README +++ b/contrib/grep/README @@ -1,4 +1,4 @@ - Copyright (C) 1992, 1997-2002, 2004-2010 Free Software Foundation, Inc. + Copyright (C) 1992, 1997-2002, 2004-2011 Free Software Foundation, Inc. Copying and distribution of this file, with or without modification, are permitted in any medium without royalty provided the copyright @@ -52,3 +52,6 @@ Additional bug reports can be found at: You can also browse the bug-grep mailing list archive at: http://lists.gnu.org/archive/html/bug-grep/ + +For any copyright year range specified as YYYY-ZZZZ in this package +note that the range specifies every single year in that closed interval. diff --git a/contrib/grep/doc/fdl.texi b/contrib/grep/doc/fdl.texi index cacf38265e..2caf58dc25 100644 --- a/contrib/grep/doc/fdl.texi +++ b/contrib/grep/doc/fdl.texi @@ -5,8 +5,8 @@ @c hence no sectioning command or @node. @display -Copyright @copyright{} 2000-2002, 2007-2008, 2010 Free Software Foundation, -Inc. +Copyright @copyright{} 2000-2002, 2007-2008, 2010-2011 Free Software +Foundation, Inc. @uref{http://fsf.org/} Everyone is permitted to copy and distribute verbatim copies diff --git a/contrib/grep/doc/grep.texi b/contrib/grep/doc/grep.texi index da103c49d8..7c80f8c21e 100644 --- a/contrib/grep/doc/grep.texi +++ b/contrib/grep/doc/grep.texi @@ -16,8 +16,7 @@ @copying This manual is for @command{grep}, a pattern matching engine. -Copyright @copyright{} 1999-2002, 2005, 2008-2010 Free Software Foundation, -Inc. +Copyright @copyright{} 1999-2002, 2005, 2008-2011 Free Software Foundation, Inc. @quotation Permission is granted to copy, distribute and/or modify this document @@ -669,7 +668,7 @@ This can cause a performance penalty. @cindex memory mapped input This option is ignored for backwards compatibility. It used to read input with the @code{mmap} system call, instead of the default @code{read} -system call. On modern systems, @samp{--mmap} rarely if ever yields +system call. On modern systems, @code{mmap} would rarely if ever yield better performance. @item -U diff --git a/contrib/grep/doc/version.texi b/contrib/grep/doc/version.texi index 5a5c38c817..9d76d0585c 100644 --- a/contrib/grep/doc/version.texi +++ b/contrib/grep/doc/version.texi @@ -1,4 +1,4 @@ -@set UPDATED 16 September 2010 -@set UPDATED-MONTH September 2010 -@set EDITION 2.7 -@set VERSION 2.7 +@set UPDATED 7 May 2011 +@set UPDATED-MONTH May 2011 +@set EDITION 2.9 +@set VERSION 2.9 diff --git a/contrib/grep/lib/alloca.c b/contrib/grep/lib/alloca.c index 8d98020ea5..9c87b925fb 100644 --- a/contrib/grep/lib/alloca.c +++ b/contrib/grep/lib/alloca.c @@ -95,26 +95,15 @@ long i00afunc (); static int stack_dir; /* 1 or -1 once known. */ # define STACK_DIR stack_dir -static void -find_stack_direction (void) +static int +find_stack_direction (int *addr, int depth) { - static char *addr = NULL; /* Address of first `dummy', once known. */ - auto char dummy; /* To get stack address. */ - - if (addr == NULL) - { /* Initial entry. */ - addr = ADDRESS_FUNCTION (dummy); - - find_stack_direction (); /* Recurse once. */ - } - else - { - /* Second entry. */ - if (ADDRESS_FUNCTION (dummy) > addr) - stack_dir = 1; /* Stack grew upward. */ - else - stack_dir = -1; /* Stack grew downward. */ - } + int dir, dummy = 0; + if (! addr) + addr = &dummy; + *addr = addr < &dummy ? 1 : addr == &dummy ? 0 : -1; + dir = depth ? find_stack_direction (addr, depth - 1) : 0; + return dir + dummy; } # endif /* STACK_DIRECTION == 0 */ @@ -157,7 +146,7 @@ alloca (size_t size) # if STACK_DIRECTION == 0 if (STACK_DIR == 0) /* Unknown growth direction. */ - find_stack_direction (); + STACK_DIR = find_stack_direction (NULL, (size & 1) + 20); # endif /* Reclaim garbage, defined as all alloca'd storage that diff --git a/contrib/grep/lib/argmatch.c b/contrib/grep/lib/argmatch.c index d1bffe0dad..9a3eca4d4c 100644 --- a/contrib/grep/lib/argmatch.c +++ b/contrib/grep/lib/argmatch.c @@ -1,7 +1,7 @@ /* argmatch.c -- find a match for a string in an array - Copyright (C) 1990, 1998, 1999, 2001, 2002, 2003, 2004, 2005, 2006, 2007, - 2009, 2010 Free Software Foundation, Inc. + Copyright (C) 1990, 1998-1999, 2001-2007, 2009-2011 Free Software + Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/contrib/grep/lib/argmatch.h b/contrib/grep/lib/argmatch.h index 08d555bfa9..f87729dd64 100644 --- a/contrib/grep/lib/argmatch.h +++ b/contrib/grep/lib/argmatch.h @@ -1,7 +1,7 @@ /* argmatch.h -- definitions and prototypes for argmatch.c - Copyright (C) 1990, 1998, 1999, 2001, 2002, 2004, 2005, 2009, 2010 Free - Software Foundation, Inc. + Copyright (C) 1990, 1998-1999, 2001-2002, 2004-2005, 2009-2011 Free Software + Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -73,8 +73,8 @@ void argmatch_valid (char const *const *arglist, -/* Same as argmatch, but upon failure, reports a explanation on the - failure, and exits using the function EXIT_FN. */ +/* Same as argmatch, but upon failure, report an explanation of the + failure, and exit using the function EXIT_FN. */ ptrdiff_t __xargmatch_internal (char const *context, char const *arg, char const *const *arglist, diff --git a/contrib/grep/lib/atexit.c b/contrib/grep/lib/atexit.c deleted file mode 100644 index 5ef33e57ee..0000000000 --- a/contrib/grep/lib/atexit.c +++ /dev/null @@ -1,13 +0,0 @@ -/* Wrapper to implement ANSI C's atexit using SunOS's on_exit. */ -/* This function is in the public domain. --Mike Stump. */ - -#include - -int -atexit (void (*f) (void)) -{ - /* If the system doesn't provide a definition for atexit, use on_exit - if the system provides that. */ - on_exit (f, 0); - return 0; -} diff --git a/contrib/grep/lib/basename-lgpl.c b/contrib/grep/lib/basename-lgpl.c index a35ff01c2c..529bc35d72 100644 --- a/contrib/grep/lib/basename-lgpl.c +++ b/contrib/grep/lib/basename-lgpl.c @@ -1,6 +1,6 @@ /* basename.c -- return the last element in a file name - Copyright (C) 1990, 1998-2001, 2003-2006, 2009-2010 Free Software + Copyright (C) 1990, 1998-2001, 2003-2006, 2009-2011 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify diff --git a/contrib/grep/lib/basename.c b/contrib/grep/lib/basename.c index 24da93ac47..90ac5012a4 100644 --- a/contrib/grep/lib/basename.c +++ b/contrib/grep/lib/basename.c @@ -1,6 +1,6 @@ /* basename.c -- return the last element in a file name - Copyright (C) 1990, 1998-2001, 2003-2006, 2009-2010 Free Software + Copyright (C) 1990, 1998-2001, 2003-2006, 2009-2011 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify diff --git a/contrib/grep/lib/binary-io.h b/contrib/grep/lib/binary-io.h index 5451fd48f4..c09dbf5799 100644 --- a/contrib/grep/lib/binary-io.h +++ b/contrib/grep/lib/binary-io.h @@ -1,6 +1,5 @@ /* Binary mode I/O. - Copyright (C) 2001, 2003, 2005, 2008, 2009, 2010 Free Software Foundation, - Inc. + Copyright (C) 2001, 2003, 2005, 2008-2011 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -19,24 +18,13 @@ #define _BINARY_H /* For systems that distinguish between text and binary I/O. - O_BINARY is usually declared in . */ + O_BINARY is guaranteed by the gnulib . */ #include /* The MSVC7 doesn't like to be included after '#define fileno ...', so we include it here first. */ #include -#if !defined O_BINARY && defined _O_BINARY - /* For MSC-compatible compilers. */ -# define O_BINARY _O_BINARY -# define O_TEXT _O_TEXT -#endif -#if defined __BEOS__ || defined __HAIKU__ - /* BeOS 5 and Haiku have O_BINARY and O_TEXT, but they have no effect. */ -# undef O_BINARY -# undef O_TEXT -#endif - /* SET_BINARY (fd); changes the file descriptor fd to perform binary I/O. */ #if O_BINARY @@ -58,8 +46,6 @@ # endif #else /* On reasonable systems, binary I/O is the default. */ -# undef O_BINARY -# define O_BINARY 0 # define SET_BINARY(fd) /* do nothing */ ((void) 0) #endif diff --git a/contrib/grep/lib/bitrotate.h b/contrib/grep/lib/bitrotate.h index 80e6ef5000..c3a5e1a5d2 100644 --- a/contrib/grep/lib/bitrotate.h +++ b/contrib/grep/lib/bitrotate.h @@ -1,5 +1,5 @@ /* bitrotate.h - Rotate bits in integers - Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc. + Copyright (C) 2008-2011 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/contrib/grep/lib/btowc.c b/contrib/grep/lib/btowc.c index 8744602aaf..9b3908d2b2 100644 --- a/contrib/grep/lib/btowc.c +++ b/contrib/grep/lib/btowc.c @@ -1,5 +1,5 @@ /* Convert unibyte character to wide character. - Copyright (C) 2008, 2010 Free Software Foundation, Inc. + Copyright (C) 2008, 2010-2011 Free Software Foundation, Inc. Written by Bruno Haible , 2008. This program is free software: you can redistribute it and/or modify diff --git a/contrib/grep/lib/c-ctype.c b/contrib/grep/lib/c-ctype.c index 48baa72e19..835f4e1adc 100644 --- a/contrib/grep/lib/c-ctype.c +++ b/contrib/grep/lib/c-ctype.c @@ -2,7 +2,7 @@ /* DO NOT EDIT! GENERATED AUTOMATICALLY! */ /* Character handling in C locale. - Copyright 2000-2003, 2006, 2009-2010 Free Software Foundation, Inc. + Copyright 2000-2003, 2006, 2009-2011 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/contrib/grep/lib/c-ctype.h b/contrib/grep/lib/c-ctype.h index 26c89b8153..a58913eabc 100644 --- a/contrib/grep/lib/c-ctype.h +++ b/contrib/grep/lib/c-ctype.h @@ -7,7 +7,7 @@ functions' behaviour depends on the current locale set via setlocale. - Copyright (C) 2000-2003, 2006, 2008-2010 Free Software Foundation, Inc. + Copyright (C) 2000-2003, 2006, 2008-2011 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/contrib/grep/lib/c-strcase.h b/contrib/grep/lib/c-strcase.h index 2f129e6e48..09e9e9cb1a 100644 --- a/contrib/grep/lib/c-strcase.h +++ b/contrib/grep/lib/c-strcase.h @@ -1,7 +1,7 @@ /* -*- buffer-read-only: t -*- vi: set ro: */ /* DO NOT EDIT! GENERATED AUTOMATICALLY! */ /* Case-insensitive string comparison functions in C locale. - Copyright (C) 1995-1996, 2001, 2003, 2005, 2009-2010 Free Software + Copyright (C) 1995-1996, 2001, 2003, 2005, 2009-2011 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify diff --git a/contrib/grep/lib/c-strcasecmp.c b/contrib/grep/lib/c-strcasecmp.c index b4113a91c4..928c5e6b80 100644 --- a/contrib/grep/lib/c-strcasecmp.c +++ b/contrib/grep/lib/c-strcasecmp.c @@ -1,7 +1,7 @@ /* -*- buffer-read-only: t -*- vi: set ro: */ /* DO NOT EDIT! GENERATED AUTOMATICALLY! */ /* c-strcasecmp.c -- case insensitive string comparator in C locale - Copyright (C) 1998-1999, 2005-2006, 2009-2010 Free Software Foundation, Inc. + Copyright (C) 1998-1999, 2005-2006, 2009-2011 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/contrib/grep/lib/c-strncasecmp.c b/contrib/grep/lib/c-strncasecmp.c index 7c2e5191b1..810bf56a94 100644 --- a/contrib/grep/lib/c-strncasecmp.c +++ b/contrib/grep/lib/c-strncasecmp.c @@ -1,7 +1,7 @@ /* -*- buffer-read-only: t -*- vi: set ro: */ /* DO NOT EDIT! GENERATED AUTOMATICALLY! */ /* c-strncasecmp.c -- case insensitive string comparator in C locale - Copyright (C) 1998-1999, 2005-2006, 2009-2010 Free Software Foundation, Inc. + Copyright (C) 1998-1999, 2005-2006, 2009-2011 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/contrib/grep/lib/close-stream.c b/contrib/grep/lib/close-stream.c index 87a59e4eea..8819b58095 100644 --- a/contrib/grep/lib/close-stream.c +++ b/contrib/grep/lib/close-stream.c @@ -1,6 +1,6 @@ /* Close a stream, with nicer error checking than fclose's. - Copyright (C) 1998-2002, 2004, 2006-2010 Free Software Foundation, Inc. + Copyright (C) 1998-2002, 2004, 2006-2011 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/contrib/grep/lib/closeout.c b/contrib/grep/lib/closeout.c index 18a8912dfd..f6cdd3f699 100644 --- a/contrib/grep/lib/closeout.c +++ b/contrib/grep/lib/closeout.c @@ -1,6 +1,6 @@ /* Close standard output and standard error, exiting with a diagnostic on error. - Copyright (C) 1998-2002, 2004, 2006, 2008-2010 Free Software Foundation, + Copyright (C) 1998-2002, 2004, 2006, 2008-2011 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify diff --git a/contrib/grep/lib/closeout.h b/contrib/grep/lib/closeout.h index 475f95e652..ec8d7a6d2c 100644 --- a/contrib/grep/lib/closeout.h +++ b/contrib/grep/lib/closeout.h @@ -1,6 +1,6 @@ /* Close standard output and standard error. - Copyright (C) 1998, 2000, 2003-2004, 2006, 2008-2010 Free Software + Copyright (C) 1998, 2000, 2003-2004, 2006, 2008-2011 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify diff --git a/contrib/grep/lib/config.charset b/contrib/grep/lib/config.charset index aa7d00dba1..93b5a5d6da 100644 --- a/contrib/grep/lib/config.charset +++ b/contrib/grep/lib/config.charset @@ -1,7 +1,7 @@ #! /bin/sh # Output a system dependent table of character encoding aliases. # -# Copyright (C) 2000-2004, 2006-2010 Free Software Foundation, Inc. +# Copyright (C) 2000-2004, 2006-2011 Free Software Foundation, Inc. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/contrib/grep/lib/dirname-lgpl.c b/contrib/grep/lib/dirname-lgpl.c index d4506e060d..f5b0c0ff01 100644 --- a/contrib/grep/lib/dirname-lgpl.c +++ b/contrib/grep/lib/dirname-lgpl.c @@ -1,6 +1,6 @@ /* dirname.c -- return all but the last element in a file name - Copyright (C) 1990, 1998, 2000-2001, 2003-2006, 2009-2010 Free Software + Copyright (C) 1990, 1998, 2000-2001, 2003-2006, 2009-2011 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify diff --git a/contrib/grep/lib/dirname.c b/contrib/grep/lib/dirname.c index 953a9acc3d..411ded31b8 100644 --- a/contrib/grep/lib/dirname.c +++ b/contrib/grep/lib/dirname.c @@ -1,6 +1,6 @@ /* dirname.c -- return all but the last element in a file name - Copyright (C) 1990, 1998, 2000-2001, 2003-2006, 2009-2010 Free Software + Copyright (C) 1990, 1998, 2000-2001, 2003-2006, 2009-2011 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify diff --git a/contrib/grep/lib/dirname.h b/contrib/grep/lib/dirname.h index fb19508f75..2ef9882445 100644 --- a/contrib/grep/lib/dirname.h +++ b/contrib/grep/lib/dirname.h @@ -1,6 +1,6 @@ /* Take file names apart into directory and base names. - Copyright (C) 1998, 2001, 2003-2006, 2009-2010 Free Software Foundation, + Copyright (C) 1998, 2001, 2003-2006, 2009-2011 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify @@ -21,44 +21,16 @@ # include # include +# include "dosname.h" # ifndef DIRECTORY_SEPARATOR # define DIRECTORY_SEPARATOR '/' # endif -# ifndef ISSLASH -# define ISSLASH(C) ((C) == DIRECTORY_SEPARATOR) -# endif - -# ifndef FILE_SYSTEM_PREFIX_LEN -# if FILE_SYSTEM_ACCEPTS_DRIVE_LETTER_PREFIX - /* This internal macro assumes ASCII, but all hosts that support drive - letters use ASCII. */ -# define _IS_DRIVE_LETTER(c) (((unsigned int) (c) | ('a' - 'A')) - 'a' \ - <= 'z' - 'a') -# define FILE_SYSTEM_PREFIX_LEN(Filename) \ - (_IS_DRIVE_LETTER ((Filename)[0]) && (Filename)[1] == ':' ? 2 : 0) -# else -# define FILE_SYSTEM_PREFIX_LEN(Filename) 0 -# endif -# endif - -# ifndef FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE -# define FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE 0 -# endif - # ifndef DOUBLE_SLASH_IS_DISTINCT_ROOT # define DOUBLE_SLASH_IS_DISTINCT_ROOT 0 # endif -# if FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE -# define IS_ABSOLUTE_FILE_NAME(F) ISSLASH ((F)[FILE_SYSTEM_PREFIX_LEN (F)]) -# else -# define IS_ABSOLUTE_FILE_NAME(F) \ - (ISSLASH ((F)[0]) || 0 < FILE_SYSTEM_PREFIX_LEN (F)) -# endif -# define IS_RELATIVE_FILE_NAME(F) (! IS_ABSOLUTE_FILE_NAME (F)) - # if GNULIB_DIRNAME char *base_name (char const *file); char *dir_name (char const *file); diff --git a/contrib/grep/lib/dosname.h b/contrib/grep/lib/dosname.h new file mode 100644 index 0000000000..acdd03b156 --- /dev/null +++ b/contrib/grep/lib/dosname.h @@ -0,0 +1,53 @@ +/* File names on MS-DOS/Windows systems. + + Copyright (C) 2000-2001, 2004-2006, 2009-2011 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + + From Paul Eggert and Jim Meyering. */ + +#ifndef _DOSNAME_H +#define _DOSNAME_H + +#if (defined _WIN32 || defined __WIN32__ || \ + defined __MSDOS__ || defined __CYGWIN__ || \ + defined __EMX__ || defined __DJGPP__) + /* This internal macro assumes ASCII, but all hosts that support drive + letters use ASCII. */ +# define _IS_DRIVE_LETTER(C) (((unsigned int) (C) | ('a' - 'A')) - 'a' \ + <= 'z' - 'a') +# define FILE_SYSTEM_PREFIX_LEN(Filename) \ + (_IS_DRIVE_LETTER ((Filename)[0]) && (Filename)[1] == ':' ? 2 : 0) +# ifndef __CYGWIN__ +# define FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE 1 +# endif +# define ISSLASH(C) ((C) == '/' || (C) == '\\') +#else +# define FILE_SYSTEM_PREFIX_LEN(Filename) 0 +# define ISSLASH(C) ((C) == '/') +#endif + +#ifndef FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE +# define FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE 0 +#endif + +#if FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE +# define IS_ABSOLUTE_FILE_NAME(F) ISSLASH ((F)[FILE_SYSTEM_PREFIX_LEN (F)]) +# else +# define IS_ABSOLUTE_FILE_NAME(F) \ + (ISSLASH ((F)[0]) || FILE_SYSTEM_PREFIX_LEN (F) != 0) +#endif +#define IS_RELATIVE_FILE_NAME(F) (! IS_ABSOLUTE_FILE_NAME (F)) + +#endif /* DOSNAME_H_ */ diff --git a/contrib/grep/lib/error.c b/contrib/grep/lib/error.c index ed9dba0d27..7482baacfb 100644 --- a/contrib/grep/lib/error.c +++ b/contrib/grep/lib/error.c @@ -1,5 +1,5 @@ /* Error handler for noninteractive utilities - Copyright (C) 1990-1998, 2000-2007, 2009-2010 Free Software Foundation, Inc. + Copyright (C) 1990-1998, 2000-2007, 2009-2011 Free Software Foundation, Inc. This file is part of the GNU C Library. This program is free software: you can redistribute it and/or modify @@ -97,11 +97,15 @@ extern void __error_at_line (int status, int errnum, const char *file_name, /* The gnulib override of fcntl is not needed in this file. */ # undef fcntl -# if !HAVE_DECL_STRERROR_R && STRERROR_R_CHAR_P +# if !HAVE_DECL_STRERROR_R # ifndef HAVE_DECL_STRERROR_R "this configure-time declaration test was not run" # endif +# if STRERROR_R_CHAR_P char *strerror_r (); +# else +int strerror_r (); +# endif # endif /* The calling program should define program_name and set it to the diff --git a/contrib/grep/lib/error.h b/contrib/grep/lib/error.h index 9deef02d2f..80f81bcef2 100644 --- a/contrib/grep/lib/error.h +++ b/contrib/grep/lib/error.h @@ -1,6 +1,6 @@ /* Declaration for error-reporting function - Copyright (C) 1995, 1996, 1997, 2003, 2006, 2008, 2009, 2010 Free Software - Foundation, Inc. + Copyright (C) 1995-1997, 2003, 2006, 2008-2011 Free Software Foundation, + Inc. This file is part of the GNU C Library. This program is free software: you can redistribute it and/or modify @@ -19,16 +19,16 @@ #ifndef _ERROR_H #define _ERROR_H 1 -#ifndef __attribute__ /* The __attribute__ feature is available in gcc versions 2.5 and later. The __-protected variants of the attributes 'format' and 'printf' are accepted by gcc versions 2.6.4 (effectively 2.7) and later. - We enable __attribute__ only if these are supported too, because + We enable _GL_ATTRIBUTE_FORMAT only if these are supported too, because gnulib and libintl do '#define printf __printf__' when they override the 'printf' function. */ -# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7) -# define __attribute__(Spec) /* empty */ -# endif +#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7) +# define _GL_ATTRIBUTE_FORMAT(spec) __attribute__ ((__format__ spec)) +#else +# define _GL_ATTRIBUTE_FORMAT(spec) /* empty */ #endif #ifdef __cplusplus @@ -40,11 +40,11 @@ extern "C" { If STATUS is nonzero, terminate the program with `exit (STATUS)'. */ extern void error (int __status, int __errnum, const char *__format, ...) - __attribute__ ((__format__ (__printf__, 3, 4))); + _GL_ATTRIBUTE_FORMAT ((__printf__, 3, 4)); extern void error_at_line (int __status, int __errnum, const char *__fname, unsigned int __lineno, const char *__format, ...) - __attribute__ ((__format__ (__printf__, 5, 6))); + _GL_ATTRIBUTE_FORMAT ((__printf__, 5, 6)); /* If NULL, error will flush stdout, then print on stderr the program name, a colon and a space. Otherwise, error will call this diff --git a/contrib/grep/lib/exclude.c b/contrib/grep/lib/exclude.c index 7b71c12421..df49714a6b 100644 --- a/contrib/grep/lib/exclude.c +++ b/contrib/grep/lib/exclude.c @@ -1,7 +1,7 @@ /* exclude.c -- exclude file names - Copyright (C) 1992, 1993, 1994, 1997, 1999, 2000, 2001, 2002, 2003, 2004, - 2005, 2006, 2007, 2009, 2010 Free Software Foundation, Inc. + Copyright (C) 1992-1994, 1997, 1999-2007, 2009-2011 Free Software + Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/contrib/grep/lib/exclude.h b/contrib/grep/lib/exclude.h index 65d3128763..0a314a99fc 100644 --- a/contrib/grep/lib/exclude.h +++ b/contrib/grep/lib/exclude.h @@ -1,7 +1,7 @@ /* exclude.h -- declarations for excluding file names - Copyright (C) 1992, 1993, 1994, 1997, 1999, 2001, 2002, 2003, 2005, 2006, - 2009, 2010 Free Software Foundation, Inc. + Copyright (C) 1992-1994, 1997, 1999, 2001-2003, 2005-2006, 2009-2011 Free + Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/contrib/grep/lib/exitfail.c b/contrib/grep/lib/exitfail.c index 3b63f8a123..953aa02fe8 100644 --- a/contrib/grep/lib/exitfail.c +++ b/contrib/grep/lib/exitfail.c @@ -1,7 +1,6 @@ /* Failure exit status - Copyright (C) 2002, 2003, 2005, 2006, 2007, 2009, 2010 Free Software - Foundation, Inc. + Copyright (C) 2002-2003, 2005-2007, 2009-2011 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/contrib/grep/lib/exitfail.h b/contrib/grep/lib/exitfail.h index 7ffffe5c99..6d01d4f91e 100644 --- a/contrib/grep/lib/exitfail.h +++ b/contrib/grep/lib/exitfail.h @@ -1,6 +1,6 @@ /* Failure exit status - Copyright (C) 2002, 2009, 2010 Free Software Foundation, Inc. + Copyright (C) 2002, 2009-2011 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/contrib/grep/lib/fnmatch.c b/contrib/grep/lib/fnmatch.c index 178fdaff45..ecfc8fb0cb 100644 --- a/contrib/grep/lib/fnmatch.c +++ b/contrib/grep/lib/fnmatch.c @@ -1,7 +1,6 @@ /* -*- buffer-read-only: t -*- vi: set ro: */ /* DO NOT EDIT! GENERATED AUTOMATICALLY! */ -/* Copyright (C) 1991, 1992, 1993, 1996, 1997, 1998, 1999, 2000, 2001, 2002, - 2003, 2004, 2005, 2006, 2007, 2009, 2010 Free Software Foundation, Inc. +/* Copyright (C) 1991-1993, 1996-2007, 2009-2011 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/contrib/grep/lib/fnmatch_loop.c b/contrib/grep/lib/fnmatch_loop.c index c46099a8d0..06e7d8b6ea 100644 --- a/contrib/grep/lib/fnmatch_loop.c +++ b/contrib/grep/lib/fnmatch_loop.c @@ -1,7 +1,6 @@ /* -*- buffer-read-only: t -*- vi: set ro: */ /* DO NOT EDIT! GENERATED AUTOMATICALLY! */ -/* Copyright (C) 1991, 1992, 1993, 1996, 1997, 1998, 1999, 2000, 2001, 2002, - 2003, 2004, 2005, 2006, 2009, 2010 Free Software Foundation, Inc. +/* Copyright (C) 1991-1993, 1996-2006, 2009-2011 Free Software Foundation, Inc. This file is part of the GNU C Library. This program is free software; you can redistribute it and/or modify @@ -203,6 +202,8 @@ FCT (const CHAR *pattern, const CHAR *string, const CHAR *string_end, case L_('['): { /* Nonzero if the sense of the character class is inverted. */ + const CHAR *p_init = p; + const CHAR *n_init = n; register bool not; CHAR cold; UCHAR fn; @@ -413,8 +414,13 @@ FCT (const CHAR *pattern, const CHAR *string, const CHAR *string_end, } #endif else if (c == L_('\0')) - /* [ (unterminated) loses. */ - return FNM_NOMATCH; + { + /* [ unterminated, treat as normal character. */ + p = p_init; + n = n_init; + c = L_('['); + goto normal_match; + } else { bool is_range = false; diff --git a/contrib/grep/lib/fpending.c b/contrib/grep/lib/fpending.c index 774b396e65..5ec38cb27e 100644 --- a/contrib/grep/lib/fpending.c +++ b/contrib/grep/lib/fpending.c @@ -1,5 +1,5 @@ /* fpending.c -- return the number of pending output bytes on a stream - Copyright (C) 2000, 2004, 2006-2007, 2009-2010 Free Software Foundation, + Copyright (C) 2000, 2004, 2006-2007, 2009-2011 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify diff --git a/contrib/grep/lib/fpending.h b/contrib/grep/lib/fpending.h index fff34f1ed4..d7994f7f4e 100644 --- a/contrib/grep/lib/fpending.h +++ b/contrib/grep/lib/fpending.h @@ -1,6 +1,6 @@ /* Declare __fpending. - Copyright (C) 2000, 2003, 2005-2006, 2009-2010 Free Software Foundation, + Copyright (C) 2000, 2003, 2005-2006, 2009-2011 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify diff --git a/contrib/grep/lib/getopt.c b/contrib/grep/lib/getopt.c index 3791f12937..23510d8afe 100644 --- a/contrib/grep/lib/getopt.c +++ b/contrib/grep/lib/getopt.c @@ -2,7 +2,7 @@ NOTE: getopt is part of the C library, so if you don't know what "Keep this file name-space clean" means, talk to drepper@gnu.org before changing it! - Copyright (C) 1987-1996, 1998-2004, 2006, 2008-2010 Free Software + Copyright (C) 1987-1996, 1998-2004, 2006, 2008-2011 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -479,23 +479,28 @@ _getopt_internal_r (int argc, char **argv, const char *optstring, || !strchr (optstring, argv[d->optind][1]))))) { char *nameend; + unsigned int namelen; const struct option *p; const struct option *pfound = NULL; + struct option_list + { + const struct option *p; + struct option_list *next; + } *ambig_list = NULL; int exact = 0; - int ambig = 0; int indfound = -1; int option_index; for (nameend = d->__nextchar; *nameend && *nameend != '='; nameend++) /* Do nothing. */ ; + namelen = nameend - d->__nextchar; /* Test all long options for either exact match or abbreviated matches. */ for (p = longopts, option_index = 0; p->name; p++, option_index++) - if (!strncmp (p->name, d->__nextchar, nameend - d->__nextchar)) + if (!strncmp (p->name, d->__nextchar, namelen)) { - if ((unsigned int) (nameend - d->__nextchar) - == (unsigned int) strlen (p->name)) + if (namelen == (unsigned int) strlen (p->name)) { /* Exact match found. */ pfound = p; @@ -513,35 +518,71 @@ _getopt_internal_r (int argc, char **argv, const char *optstring, || pfound->has_arg != p->has_arg || pfound->flag != p->flag || pfound->val != p->val) - /* Second or later nonexact match found. */ - ambig = 1; + { + /* Second or later nonexact match found. */ + struct option_list *newp = malloc (sizeof (*newp)); + newp->p = p; + newp->next = ambig_list; + ambig_list = newp; + } } - if (ambig && !exact) + if (ambig_list != NULL && !exact) { if (print_errors) { + struct option_list first; + first.p = pfound; + first.next = ambig_list; + ambig_list = &first; + #if defined _LIBC && defined USE_IN_LIBIO - char *buf; + char *buf = NULL; + size_t buflen = 0; - if (__asprintf (&buf, _("%s: option '%s' is ambiguous\n"), - argv[0], argv[d->optind]) >= 0) + FILE *fp = open_memstream (&buf, &buflen); + if (fp != NULL) { - _IO_flockfile (stderr); + fprintf (fp, + _("%s: option '%s' is ambiguous; possibilities:"), + argv[0], argv[d->optind]); - int old_flags2 = ((_IO_FILE *) stderr)->_flags2; - ((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL; + do + { + fprintf (fp, " '--%s'", ambig_list->p->name); + ambig_list = ambig_list->next; + } + while (ambig_list != NULL); - __fxprintf (NULL, "%s", buf); + fputc_unlocked ('\n', fp); - ((_IO_FILE *) stderr)->_flags2 = old_flags2; - _IO_funlockfile (stderr); + if (__builtin_expect (fclose (fp) != EOF, 1)) + { + _IO_flockfile (stderr); - free (buf); + int old_flags2 = ((_IO_FILE *) stderr)->_flags2; + ((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL; + + __fxprintf (NULL, "%s", buf); + + ((_IO_FILE *) stderr)->_flags2 = old_flags2; + _IO_funlockfile (stderr); + + free (buf); + } } #else - fprintf (stderr, _("%s: option '%s' is ambiguous\n"), + fprintf (stderr, + _("%s: option '%s' is ambiguous; possibilities:"), argv[0], argv[d->optind]); + do + { + fprintf (stderr, " '--%s'", ambig_list->p->name); + ambig_list = ambig_list->next; + } + while (ambig_list != NULL); + + fputc ('\n', stderr); #endif } d->__nextchar += strlen (d->__nextchar); @@ -550,6 +591,13 @@ _getopt_internal_r (int argc, char **argv, const char *optstring, return '?'; } + while (ambig_list != NULL) + { + struct option_list *pn = ambig_list->next; + free (ambig_list); + ambig_list = pn; + } + if (pfound != NULL) { option_index = indfound; diff --git a/contrib/grep/lib/getopt1.c b/contrib/grep/lib/getopt1.c index 046d69f940..36568024cc 100644 --- a/contrib/grep/lib/getopt1.c +++ b/contrib/grep/lib/getopt1.c @@ -1,6 +1,6 @@ /* getopt_long and getopt_long_only entry points for GNU getopt. - Copyright (C) 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1996, 1997, - 1998, 2004, 2006, 2009, 2010 Free Software Foundation, Inc. + Copyright (C) 1987-1994, 1996-1998, 2004, 2006, 2009-2011 Free Software + Foundation, Inc. This file is part of the GNU C Library. This program is free software: you can redistribute it and/or modify diff --git a/contrib/grep/lib/getopt_int.h b/contrib/grep/lib/getopt_int.h index 980b7507f1..9f0c7131a1 100644 --- a/contrib/grep/lib/getopt_int.h +++ b/contrib/grep/lib/getopt_int.h @@ -1,5 +1,5 @@ /* Internal declarations for getopt. - Copyright (C) 1989-1994, 1996-1999, 2001, 2003-2004, 2009-2010 Free Software + Copyright (C) 1989-1994, 1996-1999, 2001, 2003-2004, 2009-2011 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -108,7 +108,7 @@ struct _getopt_data #if defined _LIBC && defined USE_NONOPTION_FLAGS int __nonoption_flags_max_len; int __nonoption_flags_len; -# endif +#endif }; /* The initializer is necessary to set OPTIND and OPTERR to their diff --git a/contrib/grep/lib/getpagesize.c b/contrib/grep/lib/getpagesize.c index cc2526870f..d7c1ba807a 100644 --- a/contrib/grep/lib/getpagesize.c +++ b/contrib/grep/lib/getpagesize.c @@ -1,6 +1,6 @@ /* getpagesize emulation for systems where it cannot be done in a C macro. - Copyright (C) 2007, 2009-2010 Free Software Foundation, Inc. + Copyright (C) 2007, 2009-2011 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/contrib/grep/lib/gettext.h b/contrib/grep/lib/gettext.h index 0b054db7d2..ef0444317d 100644 --- a/contrib/grep/lib/gettext.h +++ b/contrib/grep/lib/gettext.h @@ -1,7 +1,7 @@ /* -*- buffer-read-only: t -*- vi: set ro: */ /* DO NOT EDIT! GENERATED AUTOMATICALLY! */ /* Convenience header for conditional use of GNU . - Copyright (C) 1995-1998, 2000-2002, 2004-2006, 2009-2010 Free Software + Copyright (C) 1995-1998, 2000-2002, 2004-2006, 2009-2011 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify @@ -56,7 +56,7 @@ it now, to make later inclusions of a NOP. */ #if defined(__cplusplus) && defined(__GNUG__) && (__GNUC__ >= 3) # include -# if (__GLIBC__ >= 2) || _GLIBCXX_HAVE_LIBINTL_H +# if (__GLIBC__ >= 2 && !defined __UCLIBC__) || _GLIBCXX_HAVE_LIBINTL_H # include # endif #endif @@ -95,6 +95,12 @@ #endif +/* Prefer gnulib's setlocale override over libintl's setlocale override. */ +#ifdef GNULIB_defined_setlocale +# undef setlocale +# define setlocale rpl_setlocale +#endif + /* A pseudo function call that serves as a marker for the automated extraction of messages, but does not call gettext(). The run-time translation is done at a different place in the code. diff --git a/contrib/grep/lib/gnulib.mk b/contrib/grep/lib/gnulib.mk index e195364551..a61eaaa89e 100644 --- a/contrib/grep/lib/gnulib.mk +++ b/contrib/grep/lib/gnulib.mk @@ -1,6 +1,6 @@ ## DO NOT EDIT! GENERATED AUTOMATICALLY! ## Process this file with automake to produce Makefile.in. -# Copyright (C) 2002-2010 Free Software Foundation, Inc. +# Copyright (C) 2002-2011 Free Software Foundation, Inc. # # This file is free software, distributed under the terms of the GNU # General Public License. As a special exception to the GNU General @@ -9,7 +9,7 @@ # the same distribution terms as the rest of that program. # # Generated by gnulib-tool. -# Reproduce by: gnulib-tool --import --dir=. --local-dir=gl --lib=libgreputils --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=gnulib-tests --aux-dir=build-aux --with-tests --no-libtool --macro-prefix=gl alloca announce-gen argmatch atexit binary-io btowc c-ctype closeout dirent dirname do-release-commit-and-tag error exclude fcntl-h fnmatch getopt-gnu getpagesize gettext-h git-version-gen gitlog-to-changelog gnu-web-doc-update gnupload hard-locale ignore-value intprops isblank isdir locale lseek maintainer-makefile malloc manywarnings mbrlen mbrtowc memchr mempcpy minmax obstack open progname propername quotearg realloc regex ssize_t stddef stdlib stpcpy strerror string strtol strtoul strtoull strtoumax sys_stat unistd unlocked-io update-copyright useless-if-before-free version-etc-fsf wchar wcrtomb wctob wctype xalloc xstrtoumax +# Reproduce by: gnulib-tool --import --dir=. --local-dir=gl --lib=libgreputils --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=gnulib-tests --aux-dir=build-aux --with-tests --no-conditional-dependencies --no-libtool --macro-prefix=gl alloca announce-gen argmatch binary-io btowc c-ctype closeout dirent dirname do-release-commit-and-tag error exclude fcntl-h fnmatch getopt-gnu getpagesize gettext-h git-version-gen gitlog-to-changelog gnu-web-doc-update gnupload hard-locale ignore-value intprops isblank isdir locale lseek maintainer-makefile malloc-gnu manywarnings mbrlen mbrtowc memchr mempcpy minmax obstack open progname propername quotearg readme-release realloc-gnu regex ssize_t stddef stdlib stpcpy strerror string strtoull strtoumax sys_stat unistd unlocked-io update-copyright useless-if-before-free version-etc-fsf wchar wcrtomb wctob wctype-h xalloc xstrtoumax AUTOMAKE_OPTIONS = 1.5 gnits subdir-objects @@ -39,12 +39,12 @@ EXTRA_libgreputils_a_SOURCES = ## begin gnulib module alloca +libgreputils_a_LIBADD += @ALLOCA@ +libgreputils_a_DEPENDENCIES += @ALLOCA@ EXTRA_DIST += alloca.c EXTRA_libgreputils_a_SOURCES += alloca.c -libgreputils_a_LIBADD += @ALLOCA@ -libgreputils_a_DEPENDENCIES += @ALLOCA@ ## end gnulib module alloca ## begin gnulib module alloca-opt @@ -53,12 +53,17 @@ BUILT_SOURCES += $(ALLOCA_H) # We need the following in order to create when the system # doesn't have one that works with the given compiler. -alloca.h: alloca.in.h +if GL_GENERATE_ALLOCA_H +alloca.h: alloca.in.h $(top_builddir)/config.status $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ cat $(srcdir)/alloca.in.h; \ } > $@-t && \ mv -f $@-t $@ +else +alloca.h: $(top_builddir)/config.status + rm -f $@ +endif MOSTLYCLEANFILES += alloca.h alloca.h-t EXTRA_DIST += alloca.in.h @@ -98,22 +103,12 @@ EXTRA_DIST += $(top_srcdir)/build-aux/arg-nonnull.h ## begin gnulib module argmatch +libgreputils_a_SOURCES += argmatch.c -EXTRA_DIST += argmatch.c argmatch.h - -EXTRA_libgreputils_a_SOURCES += argmatch.c +EXTRA_DIST += argmatch.h ## end gnulib module argmatch -## begin gnulib module atexit - - -EXTRA_DIST += atexit.c - -EXTRA_libgreputils_a_SOURCES += atexit.c - -## end gnulib module atexit - ## begin gnulib module binary-io libgreputils_a_SOURCES += binary-io.h @@ -173,39 +168,24 @@ libgreputils_a_SOURCES += c-strcase.h c-strcasecmp.c c-strncasecmp.c ## begin gnulib module close-stream +libgreputils_a_SOURCES += close-stream.c -EXTRA_DIST += close-stream.c close-stream.h - -EXTRA_libgreputils_a_SOURCES += close-stream.c +EXTRA_DIST += close-stream.h ## end gnulib module close-stream ## begin gnulib module closeout +libgreputils_a_SOURCES += closeout.c -EXTRA_DIST += closeout.c closeout.h - -EXTRA_libgreputils_a_SOURCES += closeout.c +EXTRA_DIST += closeout.h ## end gnulib module closeout ## begin gnulib module configmake -# Retrieve values of the variables through 'configure' followed by -# 'make', not directly through 'configure', so that a user who -# sets some of these variables consistently on the 'make' command -# line gets correct results. -# -# One advantage of this approach, compared to the classical -# approach of adding -DLIBDIR=\"$(libdir)\" etc. to AM_CPPFLAGS, -# is that it protects against the use of undefined variables. -# If, say, $(libdir) is not set in the Makefile, LIBDIR is not -# defined by this module, and code using LIBDIR gives a -# compilation error. -# -# Another advantage is that 'make' output is shorter. -# -# Listed in the same order as the GNU makefile conventions. +# Listed in the same order as the GNU makefile conventions, and +# provided by autoconf 2.59c+. # The Automake-defined pkg* macros are appended, in the order # listed in the Automake 1.10a+ documentation. configmake.h: Makefile @@ -256,11 +236,13 @@ BUILT_SOURCES += ctype.h # We need the following in order to create when the system # doesn't have one that works with the given compiler. -ctype.h: ctype.in.h $(CXXDEFS_H) $(WARN_ON_USE_H) +ctype.h: ctype.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(WARN_ON_USE_H) $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ - sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ + sed -e 's|@''GUARD_PREFIX''@|GL|g' \ + -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ + -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ -e 's|@''NEXT_CTYPE_H''@|$(NEXT_CTYPE_H)|g' \ -e 's/@''GNULIB_ISBLANK''@/$(GNULIB_ISBLANK)/g' \ -e 's/@''HAVE_ISBLANK''@/$(HAVE_ISBLANK)/g' \ @@ -281,16 +263,18 @@ BUILT_SOURCES += dirent.h # We need the following in order to create when the system # doesn't have one that works with the given compiler. -dirent.h: dirent.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) +dirent.h: dirent.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ - sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ + sed -e 's|@''GUARD_PREFIX''@|GL|g' \ + -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ + -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ -e 's|@''NEXT_DIRENT_H''@|$(NEXT_DIRENT_H)|g' \ - -e 's|@''GNULIB_DIRFD''@|$(GNULIB_DIRFD)|g' \ - -e 's|@''GNULIB_FDOPENDIR''@|$(GNULIB_FDOPENDIR)|g' \ - -e 's|@''GNULIB_SCANDIR''@|$(GNULIB_SCANDIR)|g' \ - -e 's|@''GNULIB_ALPHASORT''@|$(GNULIB_ALPHASORT)|g' \ + -e 's/@''GNULIB_DIRFD''@/$(GNULIB_DIRFD)/g' \ + -e 's/@''GNULIB_FDOPENDIR''@/$(GNULIB_FDOPENDIR)/g' \ + -e 's/@''GNULIB_SCANDIR''@/$(GNULIB_SCANDIR)/g' \ + -e 's/@''GNULIB_ALPHASORT''@/$(GNULIB_ALPHASORT)/g' \ -e 's|@''HAVE_DECL_DIRFD''@|$(HAVE_DECL_DIRFD)|g' \ -e 's|@''HAVE_DECL_FDOPENDIR''@|$(HAVE_DECL_FDOPENDIR)|g' \ -e 's|@''HAVE_FDOPENDIR''@|$(HAVE_FDOPENDIR)|g' \ @@ -314,19 +298,19 @@ EXTRA_DIST += dirent.in.h ## begin gnulib module dirname +libgreputils_a_SOURCES += dirname.c basename.c -EXTRA_DIST += basename.c dirname.c stripslash.c +EXTRA_DIST += stripslash.c -EXTRA_libgreputils_a_SOURCES += basename.c dirname.c stripslash.c +EXTRA_libgreputils_a_SOURCES += stripslash.c ## end gnulib module dirname ## begin gnulib module dirname-lgpl +libgreputils_a_SOURCES += dirname-lgpl.c basename-lgpl.c stripslash.c -EXTRA_DIST += basename-lgpl.c dirname-lgpl.c dirname.h stripslash.c - -EXTRA_libgreputils_a_SOURCES += basename-lgpl.c dirname-lgpl.c stripslash.c +EXTRA_DIST += dirname.h ## end gnulib module dirname-lgpl @@ -337,17 +321,27 @@ EXTRA_DIST += $(top_srcdir)/build-aux/do-release-commit-and-tag ## end gnulib module do-release-commit-and-tag +## begin gnulib module dosname + + +EXTRA_DIST += dosname.h + +## end gnulib module dosname + ## begin gnulib module errno BUILT_SOURCES += $(ERRNO_H) # We need the following in order to create when the system # doesn't have one that is POSIX compliant. -errno.h: errno.in.h +if GL_GENERATE_ERRNO_H +errno.h: errno.in.h $(top_builddir)/config.status $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ - sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ + sed -e 's|@''GUARD_PREFIX''@|GL|g' \ + -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ + -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ -e 's|@''NEXT_ERRNO_H''@|$(NEXT_ERRNO_H)|g' \ -e 's|@''EMULTIHOP_HIDDEN''@|$(EMULTIHOP_HIDDEN)|g' \ -e 's|@''EMULTIHOP_VALUE''@|$(EMULTIHOP_VALUE)|g' \ @@ -358,6 +352,10 @@ errno.h: errno.in.h < $(srcdir)/errno.in.h; \ } > $@-t && \ mv $@-t $@ +else +errno.h: $(top_builddir)/config.status + rm -f $@ +endif MOSTLYCLEANFILES += errno.h errno.h-t EXTRA_DIST += errno.in.h @@ -375,10 +373,9 @@ EXTRA_libgreputils_a_SOURCES += error.c ## begin gnulib module exclude +libgreputils_a_SOURCES += exclude.c -EXTRA_DIST += exclude.c exclude.h - -EXTRA_libgreputils_a_SOURCES += exclude.c +EXTRA_DIST += exclude.h ## end gnulib module exclude @@ -396,15 +393,18 @@ BUILT_SOURCES += fcntl.h # We need the following in order to create when the system # doesn't have one that works with the given compiler. -fcntl.h: fcntl.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) +fcntl.h: fcntl.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ - sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ + sed -e 's|@''GUARD_PREFIX''@|GL|g' \ + -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ + -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ -e 's|@''NEXT_FCNTL_H''@|$(NEXT_FCNTL_H)|g' \ - -e 's|@''GNULIB_FCNTL''@|$(GNULIB_FCNTL)|g' \ - -e 's|@''GNULIB_OPEN''@|$(GNULIB_OPEN)|g' \ - -e 's|@''GNULIB_OPENAT''@|$(GNULIB_OPENAT)|g' \ + -e 's/@''GNULIB_FCNTL''@/$(GNULIB_FCNTL)/g' \ + -e 's/@''GNULIB_NONBLOCKING''@/$(GNULIB_NONBLOCKING)/g' \ + -e 's/@''GNULIB_OPEN''@/$(GNULIB_OPEN)/g' \ + -e 's/@''GNULIB_OPENAT''@/$(GNULIB_OPENAT)/g' \ -e 's|@''HAVE_FCNTL''@|$(HAVE_FCNTL)|g' \ -e 's|@''HAVE_OPENAT''@|$(HAVE_OPENAT)|g' \ -e 's|@''REPLACE_FCNTL''@|$(REPLACE_FCNTL)|g' \ @@ -428,13 +428,18 @@ BUILT_SOURCES += $(FNMATCH_H) # We need the following in order to create when the system # doesn't have one that supports the required API. -fnmatch.h: fnmatch.in.h $(ARG_NONNULL_H) +if GL_GENERATE_FNMATCH_H +fnmatch.h: fnmatch.in.h $(top_builddir)/config.status $(ARG_NONNULL_H) $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ sed -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ < $(srcdir)/fnmatch.in.h; \ } > $@-t && \ mv -f $@-t $@ +else +fnmatch.h: $(top_builddir)/config.status + rm -f $@ +endif MOSTLYCLEANFILES += fnmatch.h fnmatch.h-t EXTRA_DIST += fnmatch.c fnmatch.in.h fnmatch_loop.c @@ -465,12 +470,14 @@ BUILT_SOURCES += $(GETOPT_H) # We need the following in order to create when the system # doesn't have one that works with the given compiler. -getopt.h: getopt.in.h $(ARG_NONNULL_H) +getopt.h: getopt.in.h $(top_builddir)/config.status $(ARG_NONNULL_H) $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ - sed -e 's|@''HAVE_GETOPT_H''@|$(HAVE_GETOPT_H)|g' \ + sed -e 's|@''GUARD_PREFIX''@|GL|g' \ + -e 's|@''HAVE_GETOPT_H''@|$(HAVE_GETOPT_H)|g' \ -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ + -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ -e 's|@''NEXT_GETOPT_H''@|$(NEXT_GETOPT_H)|g' \ -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ < $(srcdir)/getopt.in.h; \ @@ -545,19 +552,17 @@ GPERF = gperf ## begin gnulib module hard-locale +libgreputils_a_SOURCES += hard-locale.c -EXTRA_DIST += hard-locale.c hard-locale.h - -EXTRA_libgreputils_a_SOURCES += hard-locale.c +EXTRA_DIST += hard-locale.h ## end gnulib module hard-locale ## begin gnulib module hash +libgreputils_a_SOURCES += hash.c -EXTRA_DIST += hash.c hash.h - -EXTRA_libgreputils_a_SOURCES += hash.c +EXTRA_DIST += hash.h ## end gnulib module hash @@ -574,12 +579,16 @@ BUILT_SOURCES += $(ICONV_H) # We need the following in order to create when the system # doesn't have one that works with the given compiler. -iconv.h: iconv.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) +if GL_GENERATE_ICONV_H +iconv.h: iconv.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ - sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ + sed -e 's|@''GUARD_PREFIX''@|GL|g' \ + -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ + -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ -e 's|@''NEXT_ICONV_H''@|$(NEXT_ICONV_H)|g' \ + -e 's/@''GNULIB_ICONV''@/$(GNULIB_ICONV)/g' \ -e 's|@''ICONV_CONST''@|$(ICONV_CONST)|g' \ -e 's|@''REPLACE_ICONV''@|$(REPLACE_ICONV)|g' \ -e 's|@''REPLACE_ICONV_OPEN''@|$(REPLACE_ICONV_OPEN)|g' \ @@ -590,6 +599,10 @@ iconv.h: iconv.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) < $(srcdir)/iconv.in.h; \ } > $@-t && \ mv $@-t $@ +else +iconv.h: $(top_builddir)/config.status + rm -f $@ +endif MOSTLYCLEANFILES += iconv.h iconv.h-t EXTRA_DIST += iconv.in.h @@ -618,15 +631,16 @@ MOSTLYCLEANFILES += iconv_open-aix.h-t iconv_open-hpux.h-t iconv_open-irix.h MAINTAINERCLEANFILES += iconv_open-aix.h iconv_open-hpux.h iconv_open-irix.h iconv_open-osf.h iconv_open-solaris.h EXTRA_DIST += iconv_open-aix.h iconv_open-hpux.h iconv_open-irix.h iconv_open-osf.h iconv_open-solaris.h -EXTRA_DIST += iconv_open-aix.gperf iconv_open-hpux.gperf iconv_open-irix.gperf iconv_open-osf.gperf iconv_open-solaris.gperf iconv_open.c +EXTRA_DIST += iconv.c iconv_close.c iconv_open-aix.gperf iconv_open-hpux.gperf iconv_open-irix.gperf iconv_open-osf.gperf iconv_open-solaris.gperf iconv_open.c -EXTRA_libgreputils_a_SOURCES += iconv_open.c +EXTRA_libgreputils_a_SOURCES += iconv.c iconv_close.c iconv_open.c ## end gnulib module iconv_open ## begin gnulib module ignore-value -libgreputils_a_SOURCES += ignore-value.h + +EXTRA_DIST += ignore-value.h ## end gnulib module ignore-value @@ -637,18 +651,19 @@ EXTRA_DIST += intprops.h ## end gnulib module intprops -## begin gnulib module inttypes +## begin gnulib module inttypes-incomplete BUILT_SOURCES += inttypes.h # We need the following in order to create when the system # doesn't have one that works with the given compiler. -inttypes.h: inttypes.in.h $(WARN_ON_USE_H) $(ARG_NONNULL_H) +inttypes.h: inttypes.in.h $(top_builddir)/config.status $(WARN_ON_USE_H) $(ARG_NONNULL_H) $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ sed -e 's/@''HAVE_INTTYPES_H''@/$(HAVE_INTTYPES_H)/g' \ -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ + -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ -e 's|@''NEXT_INTTYPES_H''@|$(NEXT_INTTYPES_H)|g' \ -e 's/@''PRI_MACROS_BROKEN''@/$(PRI_MACROS_BROKEN)/g' \ -e 's/@''APPLE_UNIVERSAL_BUILD''@/$(APPLE_UNIVERSAL_BUILD)/g' \ @@ -676,7 +691,7 @@ MOSTLYCLEANFILES += inttypes.h inttypes.h-t EXTRA_DIST += inttypes.in.h -## end gnulib module inttypes +## end gnulib module inttypes-incomplete ## begin gnulib module isblank @@ -695,20 +710,31 @@ EXTRA_DIST += isdir.h ## end gnulib module isdir +## begin gnulib module iswblank + + +EXTRA_DIST += iswblank.c + +EXTRA_libgreputils_a_SOURCES += iswblank.c + +## end gnulib module iswblank + ## begin gnulib module langinfo BUILT_SOURCES += langinfo.h # We need the following in order to create an empty placeholder for # when the system doesn't have one. -langinfo.h: langinfo.in.h $(CXXDEFS_H) $(WARN_ON_USE_H) +langinfo.h: langinfo.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(WARN_ON_USE_H) $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ - sed -e 's|@''HAVE_LANGINFO_H''@|$(HAVE_LANGINFO_H)|g' \ + sed -e 's|@''GUARD_PREFIX''@|GL|g' \ + -e 's|@''HAVE_LANGINFO_H''@|$(HAVE_LANGINFO_H)|g' \ -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ + -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ -e 's|@''NEXT_LANGINFO_H''@|$(NEXT_LANGINFO_H)|g' \ - -e 's|@''GNULIB_NL_LANGINFO''@|$(GNULIB_NL_LANGINFO)|g' \ + -e 's/@''GNULIB_NL_LANGINFO''@/$(GNULIB_NL_LANGINFO)/g' \ -e 's|@''HAVE_LANGINFO_CODESET''@|$(HAVE_LANGINFO_CODESET)|g' \ -e 's|@''HAVE_LANGINFO_T_FMT_AMPM''@|$(HAVE_LANGINFO_T_FMT_AMPM)|g' \ -e 's|@''HAVE_LANGINFO_ERA''@|$(HAVE_LANGINFO_ERA)|g' \ @@ -806,15 +832,19 @@ BUILT_SOURCES += locale.h # We need the following in order to create when the system # doesn't have one that provides all definitions. -locale.h: locale.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) +locale.h: locale.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ - sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ + sed -e 's|@''GUARD_PREFIX''@|GL|g' \ + -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ + -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ -e 's|@''NEXT_LOCALE_H''@|$(NEXT_LOCALE_H)|g' \ - -e 's|@''GNULIB_DUPLOCALE''@|$(GNULIB_DUPLOCALE)|g' \ + -e 's/@''GNULIB_SETLOCALE''@/$(GNULIB_SETLOCALE)/g' \ + -e 's/@''GNULIB_DUPLOCALE''@/$(GNULIB_DUPLOCALE)/g' \ -e 's|@''HAVE_DUPLOCALE''@|$(HAVE_DUPLOCALE)|g' \ -e 's|@''HAVE_XLOCALE_H''@|$(HAVE_XLOCALE_H)|g' \ + -e 's|@''REPLACE_SETLOCALE''@|$(REPLACE_SETLOCALE)|g' \ -e 's|@''REPLACE_DUPLOCALE''@|$(REPLACE_DUPLOCALE)|g' \ -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ @@ -925,7 +955,7 @@ libgreputils_a_SOURCES += mbslen.c ## begin gnulib module mbsrtowcs -EXTRA_DIST += mbsrtowcs-state.c mbsrtowcs.c +EXTRA_DIST += mbsrtowcs-impl.h mbsrtowcs-state.c mbsrtowcs.c EXTRA_libgreputils_a_SOURCES += mbsrtowcs-state.c mbsrtowcs.c @@ -939,6 +969,15 @@ EXTRA_DIST += str-kmp.h ## end gnulib module mbsstr +## begin gnulib module mbtowc + + +EXTRA_DIST += mbtowc-impl.h mbtowc.c + +EXTRA_libgreputils_a_SOURCES += mbtowc.c + +## end gnulib module mbtowc + ## begin gnulib module mbuiter libgreputils_a_SOURCES += mbuiter.h @@ -1010,22 +1049,27 @@ libgreputils_a_SOURCES += propername.h propername.c ## begin gnulib module quote +libgreputils_a_SOURCES += quote.c -EXTRA_DIST += quote.c quote.h - -EXTRA_libgreputils_a_SOURCES += quote.c +EXTRA_DIST += quote.h ## end gnulib module quote ## begin gnulib module quotearg +libgreputils_a_SOURCES += quotearg.c -EXTRA_DIST += quotearg.c quotearg.h - -EXTRA_libgreputils_a_SOURCES += quotearg.c +EXTRA_DIST += quotearg.h ## end gnulib module quotearg +## begin gnulib module readme-release + + +EXTRA_DIST += $(top_srcdir)/README-release + +## end gnulib module readme-release + ## begin gnulib module realloc-gnu @@ -1068,15 +1112,22 @@ BUILT_SOURCES += $(STDARG_H) # We need the following in order to create when the system # doesn't have one that works with the given compiler. -stdarg.h: stdarg.in.h +if GL_GENERATE_STDARG_H +stdarg.h: stdarg.in.h $(top_builddir)/config.status $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ - sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ + sed -e 's|@''GUARD_PREFIX''@|GL|g' \ + -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ + -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ -e 's|@''NEXT_STDARG_H''@|$(NEXT_STDARG_H)|g' \ < $(srcdir)/stdarg.in.h; \ } > $@-t && \ mv $@-t $@ +else +stdarg.h: $(top_builddir)/config.status + rm -f $@ +endif MOSTLYCLEANFILES += stdarg.h stdarg.h-t EXTRA_DIST += stdarg.in.h @@ -1089,12 +1140,17 @@ BUILT_SOURCES += $(STDBOOL_H) # We need the following in order to create when the system # doesn't have one that works. -stdbool.h: stdbool.in.h +if GL_GENERATE_STDBOOL_H +stdbool.h: stdbool.in.h $(top_builddir)/config.status $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ sed -e 's/@''HAVE__BOOL''@/$(HAVE__BOOL)/g' < $(srcdir)/stdbool.in.h; \ } > $@-t && \ mv $@-t $@ +else +stdbool.h: $(top_builddir)/config.status + rm -f $@ +endif MOSTLYCLEANFILES += stdbool.h stdbool.h-t EXTRA_DIST += stdbool.in.h @@ -1107,17 +1163,24 @@ BUILT_SOURCES += $(STDDEF_H) # We need the following in order to create when the system # doesn't have one that works with the given compiler. -stddef.h: stddef.in.h +if GL_GENERATE_STDDEF_H +stddef.h: stddef.in.h $(top_builddir)/config.status $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ - sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ + sed -e 's|@''GUARD_PREFIX''@|GL|g' \ + -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ + -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ -e 's|@''NEXT_STDDEF_H''@|$(NEXT_STDDEF_H)|g' \ -e 's|@''HAVE_WCHAR_T''@|$(HAVE_WCHAR_T)|g' \ -e 's|@''REPLACE_NULL''@|$(REPLACE_NULL)|g' \ < $(srcdir)/stddef.in.h; \ } > $@-t && \ mv $@-t $@ +else +stddef.h: $(top_builddir)/config.status + rm -f $@ +endif MOSTLYCLEANFILES += stddef.h stddef.h-t EXTRA_DIST += stddef.in.h @@ -1130,17 +1193,21 @@ BUILT_SOURCES += $(STDINT_H) # We need the following in order to create when the system # doesn't have one that works with the given compiler. -stdint.h: stdint.in.h +if GL_GENERATE_STDINT_H +stdint.h: stdint.in.h $(top_builddir)/config.status $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ - sed -e 's/@''HAVE_STDINT_H''@/$(HAVE_STDINT_H)/g' \ + sed -e 's|@''GUARD_PREFIX''@|GL|g' \ + -e 's/@''HAVE_STDINT_H''@/$(HAVE_STDINT_H)/g' \ -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ + -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ -e 's|@''NEXT_STDINT_H''@|$(NEXT_STDINT_H)|g' \ -e 's/@''HAVE_SYS_TYPES_H''@/$(HAVE_SYS_TYPES_H)/g' \ -e 's/@''HAVE_INTTYPES_H''@/$(HAVE_INTTYPES_H)/g' \ -e 's/@''HAVE_SYS_INTTYPES_H''@/$(HAVE_SYS_INTTYPES_H)/g' \ -e 's/@''HAVE_SYS_BITYPES_H''@/$(HAVE_SYS_BITYPES_H)/g' \ + -e 's/@''HAVE_WCHAR_H''@/$(HAVE_WCHAR_H)/g' \ -e 's/@''HAVE_LONG_LONG_INT''@/$(HAVE_LONG_LONG_INT)/g' \ -e 's/@''HAVE_UNSIGNED_LONG_LONG_INT''@/$(HAVE_UNSIGNED_LONG_LONG_INT)/g' \ -e 's/@''APPLE_UNIVERSAL_BUILD''@/$(APPLE_UNIVERSAL_BUILD)/g' \ @@ -1160,6 +1227,10 @@ stdint.h: stdint.in.h < $(srcdir)/stdint.in.h; \ } > $@-t && \ mv $@-t $@ +else +stdint.h: $(top_builddir)/config.status + rm -f $@ +endif MOSTLYCLEANFILES += stdint.h stdint.h-t EXTRA_DIST += stdint.in.h @@ -1172,38 +1243,44 @@ BUILT_SOURCES += stdlib.h # We need the following in order to create when the system # doesn't have one that works with the given compiler. -stdlib.h: stdlib.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) +stdlib.h: stdlib.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ - sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ + sed -e 's|@''GUARD_PREFIX''@|GL|g' \ + -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ + -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ -e 's|@''NEXT_STDLIB_H''@|$(NEXT_STDLIB_H)|g' \ - -e 's|@''GNULIB__EXIT''@|$(GNULIB__EXIT)|g' \ - -e 's|@''GNULIB_ATOLL''@|$(GNULIB_ATOLL)|g' \ - -e 's|@''GNULIB_CALLOC_POSIX''@|$(GNULIB_CALLOC_POSIX)|g' \ - -e 's|@''GNULIB_CANONICALIZE_FILE_NAME''@|$(GNULIB_CANONICALIZE_FILE_NAME)|g' \ - -e 's|@''GNULIB_GETLOADAVG''@|$(GNULIB_GETLOADAVG)|g' \ - -e 's|@''GNULIB_GETSUBOPT''@|$(GNULIB_GETSUBOPT)|g' \ - -e 's|@''GNULIB_GRANTPT''@|$(GNULIB_GRANTPT)|g' \ - -e 's|@''GNULIB_MALLOC_POSIX''@|$(GNULIB_MALLOC_POSIX)|g' \ - -e 's|@''GNULIB_MKDTEMP''@|$(GNULIB_MKDTEMP)|g' \ - -e 's|@''GNULIB_MKOSTEMP''@|$(GNULIB_MKOSTEMP)|g' \ - -e 's|@''GNULIB_MKOSTEMPS''@|$(GNULIB_MKOSTEMPS)|g' \ - -e 's|@''GNULIB_MKSTEMP''@|$(GNULIB_MKSTEMP)|g' \ - -e 's|@''GNULIB_MKSTEMPS''@|$(GNULIB_MKSTEMPS)|g' \ - -e 's|@''GNULIB_PTSNAME''@|$(GNULIB_PTSNAME)|g' \ - -e 's|@''GNULIB_PUTENV''@|$(GNULIB_PUTENV)|g' \ - -e 's|@''GNULIB_RANDOM_R''@|$(GNULIB_RANDOM_R)|g' \ - -e 's|@''GNULIB_REALLOC_POSIX''@|$(GNULIB_REALLOC_POSIX)|g' \ - -e 's|@''GNULIB_REALPATH''@|$(GNULIB_REALPATH)|g' \ - -e 's|@''GNULIB_RPMATCH''@|$(GNULIB_RPMATCH)|g' \ - -e 's|@''GNULIB_SETENV''@|$(GNULIB_SETENV)|g' \ - -e 's|@''GNULIB_STRTOD''@|$(GNULIB_STRTOD)|g' \ - -e 's|@''GNULIB_STRTOLL''@|$(GNULIB_STRTOLL)|g' \ - -e 's|@''GNULIB_STRTOULL''@|$(GNULIB_STRTOULL)|g' \ - -e 's|@''GNULIB_UNLOCKPT''@|$(GNULIB_UNLOCKPT)|g' \ - -e 's|@''GNULIB_UNSETENV''@|$(GNULIB_UNSETENV)|g' \ - -e 's|@''HAVE__EXIT''@|$(HAVE__EXIT)|g' \ + -e 's/@''GNULIB__EXIT''@/$(GNULIB__EXIT)/g' \ + -e 's/@''GNULIB_ATOLL''@/$(GNULIB_ATOLL)/g' \ + -e 's/@''GNULIB_CALLOC_POSIX''@/$(GNULIB_CALLOC_POSIX)/g' \ + -e 's/@''GNULIB_CANONICALIZE_FILE_NAME''@/$(GNULIB_CANONICALIZE_FILE_NAME)/g' \ + -e 's/@''GNULIB_GETLOADAVG''@/$(GNULIB_GETLOADAVG)/g' \ + -e 's/@''GNULIB_GETSUBOPT''@/$(GNULIB_GETSUBOPT)/g' \ + -e 's/@''GNULIB_GRANTPT''@/$(GNULIB_GRANTPT)/g' \ + -e 's/@''GNULIB_MALLOC_POSIX''@/$(GNULIB_MALLOC_POSIX)/g' \ + -e 's/@''GNULIB_MBTOWC''@/$(GNULIB_MBTOWC)/g' \ + -e 's/@''GNULIB_MKDTEMP''@/$(GNULIB_MKDTEMP)/g' \ + -e 's/@''GNULIB_MKOSTEMP''@/$(GNULIB_MKOSTEMP)/g' \ + -e 's/@''GNULIB_MKOSTEMPS''@/$(GNULIB_MKOSTEMPS)/g' \ + -e 's/@''GNULIB_MKSTEMP''@/$(GNULIB_MKSTEMP)/g' \ + -e 's/@''GNULIB_MKSTEMPS''@/$(GNULIB_MKSTEMPS)/g' \ + -e 's/@''GNULIB_PTSNAME''@/$(GNULIB_PTSNAME)/g' \ + -e 's/@''GNULIB_PUTENV''@/$(GNULIB_PUTENV)/g' \ + -e 's/@''GNULIB_RANDOM_R''@/$(GNULIB_RANDOM_R)/g' \ + -e 's/@''GNULIB_REALLOC_POSIX''@/$(GNULIB_REALLOC_POSIX)/g' \ + -e 's/@''GNULIB_REALPATH''@/$(GNULIB_REALPATH)/g' \ + -e 's/@''GNULIB_RPMATCH''@/$(GNULIB_RPMATCH)/g' \ + -e 's/@''GNULIB_SETENV''@/$(GNULIB_SETENV)/g' \ + -e 's/@''GNULIB_STRTOD''@/$(GNULIB_STRTOD)/g' \ + -e 's/@''GNULIB_STRTOLL''@/$(GNULIB_STRTOLL)/g' \ + -e 's/@''GNULIB_STRTOULL''@/$(GNULIB_STRTOULL)/g' \ + -e 's/@''GNULIB_SYSTEM_POSIX''@/$(GNULIB_SYSTEM_POSIX)/g' \ + -e 's/@''GNULIB_UNLOCKPT''@/$(GNULIB_UNLOCKPT)/g' \ + -e 's/@''GNULIB_UNSETENV''@/$(GNULIB_UNSETENV)/g' \ + -e 's/@''GNULIB_WCTOMB''@/$(GNULIB_WCTOMB)/g' \ + < $(srcdir)/stdlib.in.h | \ + sed -e 's|@''HAVE__EXIT''@|$(HAVE__EXIT)|g' \ -e 's|@''HAVE_ATOLL''@|$(HAVE_ATOLL)|g' \ -e 's|@''HAVE_CANONICALIZE_FILE_NAME''@|$(HAVE_CANONICALIZE_FILE_NAME)|g' \ -e 's|@''HAVE_DECL_GETLOADAVG''@|$(HAVE_DECL_GETLOADAVG)|g' \ @@ -1219,17 +1296,18 @@ stdlib.h: stdlib.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) -e 's|@''HAVE_RANDOM_R''@|$(HAVE_RANDOM_R)|g' \ -e 's|@''HAVE_REALPATH''@|$(HAVE_REALPATH)|g' \ -e 's|@''HAVE_RPMATCH''@|$(HAVE_RPMATCH)|g' \ - -e 's|@''HAVE_SETENV''@|$(HAVE_SETENV)|g' \ + -e 's|@''HAVE_DECL_SETENV''@|$(HAVE_DECL_SETENV)|g' \ -e 's|@''HAVE_STRTOD''@|$(HAVE_STRTOD)|g' \ -e 's|@''HAVE_STRTOLL''@|$(HAVE_STRTOLL)|g' \ -e 's|@''HAVE_STRTOULL''@|$(HAVE_STRTOULL)|g' \ -e 's|@''HAVE_STRUCT_RANDOM_DATA''@|$(HAVE_STRUCT_RANDOM_DATA)|g' \ -e 's|@''HAVE_SYS_LOADAVG_H''@|$(HAVE_SYS_LOADAVG_H)|g' \ -e 's|@''HAVE_UNLOCKPT''@|$(HAVE_UNLOCKPT)|g' \ - -e 's|@''HAVE_UNSETENV''@|$(HAVE_UNSETENV)|g' \ + -e 's|@''HAVE_DECL_UNSETENV''@|$(HAVE_DECL_UNSETENV)|g' \ -e 's|@''REPLACE_CALLOC''@|$(REPLACE_CALLOC)|g' \ -e 's|@''REPLACE_CANONICALIZE_FILE_NAME''@|$(REPLACE_CANONICALIZE_FILE_NAME)|g' \ -e 's|@''REPLACE_MALLOC''@|$(REPLACE_MALLOC)|g' \ + -e 's|@''REPLACE_MBTOWC''@|$(REPLACE_MBTOWC)|g' \ -e 's|@''REPLACE_MKSTEMP''@|$(REPLACE_MKSTEMP)|g' \ -e 's|@''REPLACE_PUTENV''@|$(REPLACE_PUTENV)|g' \ -e 's|@''REPLACE_REALLOC''@|$(REPLACE_REALLOC)|g' \ @@ -1237,10 +1315,10 @@ stdlib.h: stdlib.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) -e 's|@''REPLACE_SETENV''@|$(REPLACE_SETENV)|g' \ -e 's|@''REPLACE_STRTOD''@|$(REPLACE_STRTOD)|g' \ -e 's|@''REPLACE_UNSETENV''@|$(REPLACE_UNSETENV)|g' \ + -e 's|@''REPLACE_WCTOMB''@|$(REPLACE_WCTOMB)|g' \ -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ - -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \ - < $(srcdir)/stdlib.in.h; \ + -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)'; \ } > $@-t && \ mv $@-t $@ MOSTLYCLEANFILES += stdlib.h stdlib.h-t @@ -1274,6 +1352,15 @@ EXTRA_libgreputils_a_SOURCES += strerror.c ## end gnulib module strerror +## begin gnulib module strerror-override + + +EXTRA_DIST += strerror-override.c strerror-override.h + +EXTRA_libgreputils_a_SOURCES += strerror-override.c + +## end gnulib module strerror-override + ## begin gnulib module striconv libgreputils_a_SOURCES += striconv.h striconv.c @@ -1288,46 +1375,49 @@ BUILT_SOURCES += string.h # We need the following in order to create when the system # doesn't have one that works with the given compiler. -string.h: string.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) +string.h: string.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ - sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ + sed -e 's|@''GUARD_PREFIX''@|GL|g' \ + -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ + -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ -e 's|@''NEXT_STRING_H''@|$(NEXT_STRING_H)|g' \ - -e 's|@''GNULIB_MBSLEN''@|$(GNULIB_MBSLEN)|g' \ - -e 's|@''GNULIB_MBSNLEN''@|$(GNULIB_MBSNLEN)|g' \ - -e 's|@''GNULIB_MBSCHR''@|$(GNULIB_MBSCHR)|g' \ - -e 's|@''GNULIB_MBSRCHR''@|$(GNULIB_MBSRCHR)|g' \ - -e 's|@''GNULIB_MBSSTR''@|$(GNULIB_MBSSTR)|g' \ - -e 's|@''GNULIB_MBSCASECMP''@|$(GNULIB_MBSCASECMP)|g' \ - -e 's|@''GNULIB_MBSNCASECMP''@|$(GNULIB_MBSNCASECMP)|g' \ - -e 's|@''GNULIB_MBSPCASECMP''@|$(GNULIB_MBSPCASECMP)|g' \ - -e 's|@''GNULIB_MBSCASESTR''@|$(GNULIB_MBSCASESTR)|g' \ - -e 's|@''GNULIB_MBSCSPN''@|$(GNULIB_MBSCSPN)|g' \ - -e 's|@''GNULIB_MBSPBRK''@|$(GNULIB_MBSPBRK)|g' \ - -e 's|@''GNULIB_MBSSPN''@|$(GNULIB_MBSSPN)|g' \ - -e 's|@''GNULIB_MBSSEP''@|$(GNULIB_MBSSEP)|g' \ - -e 's|@''GNULIB_MBSTOK_R''@|$(GNULIB_MBSTOK_R)|g' \ - -e 's|@''GNULIB_MEMCHR''@|$(GNULIB_MEMCHR)|g' \ - -e 's|@''GNULIB_MEMMEM''@|$(GNULIB_MEMMEM)|g' \ - -e 's|@''GNULIB_MEMPCPY''@|$(GNULIB_MEMPCPY)|g' \ - -e 's|@''GNULIB_MEMRCHR''@|$(GNULIB_MEMRCHR)|g' \ - -e 's|@''GNULIB_RAWMEMCHR''@|$(GNULIB_RAWMEMCHR)|g' \ - -e 's|@''GNULIB_STPCPY''@|$(GNULIB_STPCPY)|g' \ - -e 's|@''GNULIB_STPNCPY''@|$(GNULIB_STPNCPY)|g' \ - -e 's|@''GNULIB_STRCHRNUL''@|$(GNULIB_STRCHRNUL)|g' \ - -e 's|@''GNULIB_STRDUP''@|$(GNULIB_STRDUP)|g' \ - -e 's|@''GNULIB_STRNCAT''@|$(GNULIB_STRNCAT)|g' \ - -e 's|@''GNULIB_STRNDUP''@|$(GNULIB_STRNDUP)|g' \ - -e 's|@''GNULIB_STRNLEN''@|$(GNULIB_STRNLEN)|g' \ - -e 's|@''GNULIB_STRPBRK''@|$(GNULIB_STRPBRK)|g' \ - -e 's|@''GNULIB_STRSEP''@|$(GNULIB_STRSEP)|g' \ - -e 's|@''GNULIB_STRSTR''@|$(GNULIB_STRSTR)|g' \ - -e 's|@''GNULIB_STRCASESTR''@|$(GNULIB_STRCASESTR)|g' \ - -e 's|@''GNULIB_STRTOK_R''@|$(GNULIB_STRTOK_R)|g' \ - -e 's|@''GNULIB_STRERROR''@|$(GNULIB_STRERROR)|g' \ - -e 's|@''GNULIB_STRSIGNAL''@|$(GNULIB_STRSIGNAL)|g' \ - -e 's|@''GNULIB_STRVERSCMP''@|$(GNULIB_STRVERSCMP)|g' \ + -e 's/@''GNULIB_MBSLEN''@/$(GNULIB_MBSLEN)/g' \ + -e 's/@''GNULIB_MBSNLEN''@/$(GNULIB_MBSNLEN)/g' \ + -e 's/@''GNULIB_MBSCHR''@/$(GNULIB_MBSCHR)/g' \ + -e 's/@''GNULIB_MBSRCHR''@/$(GNULIB_MBSRCHR)/g' \ + -e 's/@''GNULIB_MBSSTR''@/$(GNULIB_MBSSTR)/g' \ + -e 's/@''GNULIB_MBSCASECMP''@/$(GNULIB_MBSCASECMP)/g' \ + -e 's/@''GNULIB_MBSNCASECMP''@/$(GNULIB_MBSNCASECMP)/g' \ + -e 's/@''GNULIB_MBSPCASECMP''@/$(GNULIB_MBSPCASECMP)/g' \ + -e 's/@''GNULIB_MBSCASESTR''@/$(GNULIB_MBSCASESTR)/g' \ + -e 's/@''GNULIB_MBSCSPN''@/$(GNULIB_MBSCSPN)/g' \ + -e 's/@''GNULIB_MBSPBRK''@/$(GNULIB_MBSPBRK)/g' \ + -e 's/@''GNULIB_MBSSPN''@/$(GNULIB_MBSSPN)/g' \ + -e 's/@''GNULIB_MBSSEP''@/$(GNULIB_MBSSEP)/g' \ + -e 's/@''GNULIB_MBSTOK_R''@/$(GNULIB_MBSTOK_R)/g' \ + -e 's/@''GNULIB_MEMCHR''@/$(GNULIB_MEMCHR)/g' \ + -e 's/@''GNULIB_MEMMEM''@/$(GNULIB_MEMMEM)/g' \ + -e 's/@''GNULIB_MEMPCPY''@/$(GNULIB_MEMPCPY)/g' \ + -e 's/@''GNULIB_MEMRCHR''@/$(GNULIB_MEMRCHR)/g' \ + -e 's/@''GNULIB_RAWMEMCHR''@/$(GNULIB_RAWMEMCHR)/g' \ + -e 's/@''GNULIB_STPCPY''@/$(GNULIB_STPCPY)/g' \ + -e 's/@''GNULIB_STPNCPY''@/$(GNULIB_STPNCPY)/g' \ + -e 's/@''GNULIB_STRCHRNUL''@/$(GNULIB_STRCHRNUL)/g' \ + -e 's/@''GNULIB_STRDUP''@/$(GNULIB_STRDUP)/g' \ + -e 's/@''GNULIB_STRNCAT''@/$(GNULIB_STRNCAT)/g' \ + -e 's/@''GNULIB_STRNDUP''@/$(GNULIB_STRNDUP)/g' \ + -e 's/@''GNULIB_STRNLEN''@/$(GNULIB_STRNLEN)/g' \ + -e 's/@''GNULIB_STRPBRK''@/$(GNULIB_STRPBRK)/g' \ + -e 's/@''GNULIB_STRSEP''@/$(GNULIB_STRSEP)/g' \ + -e 's/@''GNULIB_STRSTR''@/$(GNULIB_STRSTR)/g' \ + -e 's/@''GNULIB_STRCASESTR''@/$(GNULIB_STRCASESTR)/g' \ + -e 's/@''GNULIB_STRTOK_R''@/$(GNULIB_STRTOK_R)/g' \ + -e 's/@''GNULIB_STRERROR''@/$(GNULIB_STRERROR)/g' \ + -e 's/@''GNULIB_STRERROR_R''@/$(GNULIB_STRERROR_R)/g' \ + -e 's/@''GNULIB_STRSIGNAL''@/$(GNULIB_STRSIGNAL)/g' \ + -e 's/@''GNULIB_STRVERSCMP''@/$(GNULIB_STRVERSCMP)/g' \ < $(srcdir)/string.in.h | \ sed -e 's|@''HAVE_MBSLEN''@|$(HAVE_MBSLEN)|g' \ -e 's|@''HAVE_MEMCHR''@|$(HAVE_MEMCHR)|g' \ @@ -1345,15 +1435,18 @@ string.h: string.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) -e 's|@''HAVE_STRSEP''@|$(HAVE_STRSEP)|g' \ -e 's|@''HAVE_STRCASESTR''@|$(HAVE_STRCASESTR)|g' \ -e 's|@''HAVE_DECL_STRTOK_R''@|$(HAVE_DECL_STRTOK_R)|g' \ + -e 's|@''HAVE_DECL_STRERROR_R''@|$(HAVE_DECL_STRERROR_R)|g' \ -e 's|@''HAVE_DECL_STRSIGNAL''@|$(HAVE_DECL_STRSIGNAL)|g' \ -e 's|@''HAVE_STRVERSCMP''@|$(HAVE_STRVERSCMP)|g' \ -e 's|@''REPLACE_STPNCPY''@|$(REPLACE_STPNCPY)|g' \ -e 's|@''REPLACE_MEMCHR''@|$(REPLACE_MEMCHR)|g' \ -e 's|@''REPLACE_MEMMEM''@|$(REPLACE_MEMMEM)|g' \ -e 's|@''REPLACE_STRCASESTR''@|$(REPLACE_STRCASESTR)|g' \ + -e 's|@''REPLACE_STRCHRNUL''@|$(REPLACE_STRCHRNUL)|g' \ -e 's|@''REPLACE_STRDUP''@|$(REPLACE_STRDUP)|g' \ -e 's|@''REPLACE_STRSTR''@|$(REPLACE_STRSTR)|g' \ -e 's|@''REPLACE_STRERROR''@|$(REPLACE_STRERROR)|g' \ + -e 's|@''REPLACE_STRERROR_R''@|$(REPLACE_STRERROR_R)|g' \ -e 's|@''REPLACE_STRNCAT''@|$(REPLACE_STRNCAT)|g' \ -e 's|@''REPLACE_STRNDUP''@|$(REPLACE_STRNDUP)|g' \ -e 's|@''REPLACE_STRNLEN''@|$(REPLACE_STRNLEN)|g' \ @@ -1396,57 +1489,21 @@ libgreputils_a_SOURCES += strnlen1.h strnlen1.c ## end gnulib module strnlen1 -## begin gnulib module strtoimax - - -EXTRA_DIST += strtoimax.c - -EXTRA_libgreputils_a_SOURCES += strtoimax.c - -## end gnulib module strtoimax - -## begin gnulib module strtol - - -EXTRA_DIST += strtol.c - -EXTRA_libgreputils_a_SOURCES += strtol.c - -## end gnulib module strtol - -## begin gnulib module strtoll - - -EXTRA_DIST += strtoll.c - -EXTRA_libgreputils_a_SOURCES += strtoll.c - -## end gnulib module strtoll - -## begin gnulib module strtoul - - -EXTRA_DIST += strtoul.c - -EXTRA_libgreputils_a_SOURCES += strtoul.c - -## end gnulib module strtoul - ## begin gnulib module strtoull -EXTRA_DIST += strtoull.c +EXTRA_DIST += strtol.c strtoul.c strtoull.c -EXTRA_libgreputils_a_SOURCES += strtoull.c +EXTRA_libgreputils_a_SOURCES += strtol.c strtoul.c strtoull.c ## end gnulib module strtoull ## begin gnulib module strtoumax -EXTRA_DIST += strtoumax.c +EXTRA_DIST += strtoimax.c strtoumax.c -EXTRA_libgreputils_a_SOURCES += strtoumax.c +EXTRA_libgreputils_a_SOURCES += strtoimax.c strtoumax.c ## end gnulib module strtoumax @@ -1456,25 +1513,27 @@ BUILT_SOURCES += sys/stat.h # We need the following in order to create when the system # has one that is incomplete. -sys/stat.h: sys_stat.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) +sys/stat.h: sys_stat.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) $(AM_V_at)$(MKDIR_P) sys $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ - sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ + sed -e 's|@''GUARD_PREFIX''@|GL|g' \ + -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ + -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ -e 's|@''NEXT_SYS_STAT_H''@|$(NEXT_SYS_STAT_H)|g' \ - -e 's|@''GNULIB_FCHMODAT''@|$(GNULIB_FCHMODAT)|g' \ - -e 's|@''GNULIB_FSTATAT''@|$(GNULIB_FSTATAT)|g' \ - -e 's|@''GNULIB_FUTIMENS''@|$(GNULIB_FUTIMENS)|g' \ - -e 's|@''GNULIB_LCHMOD''@|$(GNULIB_LCHMOD)|g' \ - -e 's|@''GNULIB_LSTAT''@|$(GNULIB_LSTAT)|g' \ - -e 's|@''GNULIB_MKDIRAT''@|$(GNULIB_MKDIRAT)|g' \ - -e 's|@''GNULIB_MKFIFO''@|$(GNULIB_MKFIFO)|g' \ - -e 's|@''GNULIB_MKFIFOAT''@|$(GNULIB_MKFIFOAT)|g' \ - -e 's|@''GNULIB_MKNOD''@|$(GNULIB_MKNOD)|g' \ - -e 's|@''GNULIB_MKNODAT''@|$(GNULIB_MKNODAT)|g' \ - -e 's|@''GNULIB_STAT''@|$(GNULIB_STAT)|g' \ - -e 's|@''GNULIB_UTIMENSAT''@|$(GNULIB_UTIMENSAT)|g' \ + -e 's/@''GNULIB_FCHMODAT''@/$(GNULIB_FCHMODAT)/g' \ + -e 's/@''GNULIB_FSTATAT''@/$(GNULIB_FSTATAT)/g' \ + -e 's/@''GNULIB_FUTIMENS''@/$(GNULIB_FUTIMENS)/g' \ + -e 's/@''GNULIB_LCHMOD''@/$(GNULIB_LCHMOD)/g' \ + -e 's/@''GNULIB_LSTAT''@/$(GNULIB_LSTAT)/g' \ + -e 's/@''GNULIB_MKDIRAT''@/$(GNULIB_MKDIRAT)/g' \ + -e 's/@''GNULIB_MKFIFO''@/$(GNULIB_MKFIFO)/g' \ + -e 's/@''GNULIB_MKFIFOAT''@/$(GNULIB_MKFIFOAT)/g' \ + -e 's/@''GNULIB_MKNOD''@/$(GNULIB_MKNOD)/g' \ + -e 's/@''GNULIB_MKNODAT''@/$(GNULIB_MKNODAT)/g' \ + -e 's/@''GNULIB_STAT''@/$(GNULIB_STAT)/g' \ + -e 's/@''GNULIB_UTIMENSAT''@/$(GNULIB_UTIMENSAT)/g' \ -e 's|@''HAVE_FCHMODAT''@|$(HAVE_FCHMODAT)|g' \ -e 's|@''HAVE_FSTATAT''@|$(HAVE_FSTATAT)|g' \ -e 's|@''HAVE_FUTIMENS''@|$(HAVE_FUTIMENS)|g' \ @@ -1514,18 +1573,20 @@ BUILT_SOURCES += time.h # We need the following in order to create when the system # doesn't have one that works with the given compiler. -time.h: time.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) +time.h: time.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ - sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ + sed -e 's|@''GUARD_PREFIX''@|GL|g' \ + -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ + -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ -e 's|@''NEXT_TIME_H''@|$(NEXT_TIME_H)|g' \ - -e 's|@''GNULIB_MKTIME''@|$(GNULIB_MKTIME)|g' \ - -e 's|@''GNULIB_NANOSLEEP''@|$(GNULIB_NANOSLEEP)|g' \ - -e 's|@''GNULIB_STRPTIME''@|$(GNULIB_STRPTIME)|g' \ - -e 's|@''GNULIB_TIMEGM''@|$(GNULIB_TIMEGM)|g' \ - -e 's|@''GNULIB_TIME_R''@|$(GNULIB_TIME_R)|g' \ - -e 's|@''HAVE_LOCALTIME_R''@|$(HAVE_LOCALTIME_R)|g' \ + -e 's/@''GNULIB_MKTIME''@/$(GNULIB_MKTIME)/g' \ + -e 's/@''GNULIB_NANOSLEEP''@/$(GNULIB_NANOSLEEP)/g' \ + -e 's/@''GNULIB_STRPTIME''@/$(GNULIB_STRPTIME)/g' \ + -e 's/@''GNULIB_TIMEGM''@/$(GNULIB_TIMEGM)/g' \ + -e 's/@''GNULIB_TIME_R''@/$(GNULIB_TIME_R)/g' \ + -e 's|@''HAVE_DECL_LOCALTIME_R''@|$(HAVE_DECL_LOCALTIME_R)|g' \ -e 's|@''HAVE_NANOSLEEP''@|$(HAVE_NANOSLEEP)|g' \ -e 's|@''HAVE_STRPTIME''@|$(HAVE_STRPTIME)|g' \ -e 's|@''HAVE_TIMEGM''@|$(HAVE_TIMEGM)|g' \ @@ -1562,53 +1623,59 @@ BUILT_SOURCES += unistd.h # We need the following in order to create an empty placeholder for # when the system doesn't have one. -unistd.h: unistd.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) +unistd.h: unistd.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ - sed -e 's|@''HAVE_UNISTD_H''@|$(HAVE_UNISTD_H)|g' \ + sed -e 's|@''GUARD_PREFIX''@|GL|g' \ + -e 's|@''HAVE_UNISTD_H''@|$(HAVE_UNISTD_H)|g' \ -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ + -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ -e 's|@''NEXT_UNISTD_H''@|$(NEXT_UNISTD_H)|g' \ - -e 's|@''GNULIB_CHOWN''@|$(GNULIB_CHOWN)|g' \ - -e 's|@''GNULIB_CLOSE''@|$(GNULIB_CLOSE)|g' \ - -e 's|@''GNULIB_DUP2''@|$(GNULIB_DUP2)|g' \ - -e 's|@''GNULIB_DUP3''@|$(GNULIB_DUP3)|g' \ - -e 's|@''GNULIB_ENVIRON''@|$(GNULIB_ENVIRON)|g' \ - -e 's|@''GNULIB_EUIDACCESS''@|$(GNULIB_EUIDACCESS)|g' \ - -e 's|@''GNULIB_FACCESSAT''@|$(GNULIB_FACCESSAT)|g' \ - -e 's|@''GNULIB_FCHDIR''@|$(GNULIB_FCHDIR)|g' \ - -e 's|@''GNULIB_FCHOWNAT''@|$(GNULIB_FCHOWNAT)|g' \ - -e 's|@''GNULIB_FSYNC''@|$(GNULIB_FSYNC)|g' \ - -e 's|@''GNULIB_FTRUNCATE''@|$(GNULIB_FTRUNCATE)|g' \ - -e 's|@''GNULIB_GETCWD''@|$(GNULIB_GETCWD)|g' \ - -e 's|@''GNULIB_GETDOMAINNAME''@|$(GNULIB_GETDOMAINNAME)|g' \ - -e 's|@''GNULIB_GETDTABLESIZE''@|$(GNULIB_GETDTABLESIZE)|g' \ - -e 's|@''GNULIB_GETGROUPS''@|$(GNULIB_GETGROUPS)|g' \ - -e 's|@''GNULIB_GETHOSTNAME''@|$(GNULIB_GETHOSTNAME)|g' \ - -e 's|@''GNULIB_GETLOGIN''@|$(GNULIB_GETLOGIN)|g' \ - -e 's|@''GNULIB_GETLOGIN_R''@|$(GNULIB_GETLOGIN_R)|g' \ - -e 's|@''GNULIB_GETPAGESIZE''@|$(GNULIB_GETPAGESIZE)|g' \ - -e 's|@''GNULIB_GETUSERSHELL''@|$(GNULIB_GETUSERSHELL)|g' \ - -e 's|@''GNULIB_LCHOWN''@|$(GNULIB_LCHOWN)|g' \ - -e 's|@''GNULIB_LINK''@|$(GNULIB_LINK)|g' \ - -e 's|@''GNULIB_LINKAT''@|$(GNULIB_LINKAT)|g' \ - -e 's|@''GNULIB_LSEEK''@|$(GNULIB_LSEEK)|g' \ - -e 's|@''GNULIB_PIPE2''@|$(GNULIB_PIPE2)|g' \ - -e 's|@''GNULIB_PREAD''@|$(GNULIB_PREAD)|g' \ - -e 's|@''GNULIB_PWRITE''@|$(GNULIB_PWRITE)|g' \ - -e 's|@''GNULIB_READLINK''@|$(GNULIB_READLINK)|g' \ - -e 's|@''GNULIB_READLINKAT''@|$(GNULIB_READLINKAT)|g' \ - -e 's|@''GNULIB_RMDIR''@|$(GNULIB_RMDIR)|g' \ - -e 's|@''GNULIB_SLEEP''@|$(GNULIB_SLEEP)|g' \ - -e 's|@''GNULIB_SYMLINK''@|$(GNULIB_SYMLINK)|g' \ - -e 's|@''GNULIB_SYMLINKAT''@|$(GNULIB_SYMLINKAT)|g' \ - -e 's|@''GNULIB_TTYNAME_R''@|$(GNULIB_TTYNAME_R)|g' \ - -e 's|@''GNULIB_UNISTD_H_GETOPT''@|$(GNULIB_UNISTD_H_GETOPT)|g' \ - -e 's|@''GNULIB_UNISTD_H_SIGPIPE''@|$(GNULIB_UNISTD_H_SIGPIPE)|g' \ - -e 's|@''GNULIB_UNLINK''@|$(GNULIB_UNLINK)|g' \ - -e 's|@''GNULIB_UNLINKAT''@|$(GNULIB_UNLINKAT)|g' \ - -e 's|@''GNULIB_USLEEP''@|$(GNULIB_USLEEP)|g' \ - -e 's|@''GNULIB_WRITE''@|$(GNULIB_WRITE)|g' \ + -e 's/@''GNULIB_CHOWN''@/$(GNULIB_CHOWN)/g' \ + -e 's/@''GNULIB_CLOSE''@/$(GNULIB_CLOSE)/g' \ + -e 's/@''GNULIB_DUP2''@/$(GNULIB_DUP2)/g' \ + -e 's/@''GNULIB_DUP3''@/$(GNULIB_DUP3)/g' \ + -e 's/@''GNULIB_ENVIRON''@/$(GNULIB_ENVIRON)/g' \ + -e 's/@''GNULIB_EUIDACCESS''@/$(GNULIB_EUIDACCESS)/g' \ + -e 's/@''GNULIB_FACCESSAT''@/$(GNULIB_FACCESSAT)/g' \ + -e 's/@''GNULIB_FCHDIR''@/$(GNULIB_FCHDIR)/g' \ + -e 's/@''GNULIB_FCHOWNAT''@/$(GNULIB_FCHOWNAT)/g' \ + -e 's/@''GNULIB_FSYNC''@/$(GNULIB_FSYNC)/g' \ + -e 's/@''GNULIB_FTRUNCATE''@/$(GNULIB_FTRUNCATE)/g' \ + -e 's/@''GNULIB_GETCWD''@/$(GNULIB_GETCWD)/g' \ + -e 's/@''GNULIB_GETDOMAINNAME''@/$(GNULIB_GETDOMAINNAME)/g' \ + -e 's/@''GNULIB_GETDTABLESIZE''@/$(GNULIB_GETDTABLESIZE)/g' \ + -e 's/@''GNULIB_GETGROUPS''@/$(GNULIB_GETGROUPS)/g' \ + -e 's/@''GNULIB_GETHOSTNAME''@/$(GNULIB_GETHOSTNAME)/g' \ + -e 's/@''GNULIB_GETLOGIN''@/$(GNULIB_GETLOGIN)/g' \ + -e 's/@''GNULIB_GETLOGIN_R''@/$(GNULIB_GETLOGIN_R)/g' \ + -e 's/@''GNULIB_GETPAGESIZE''@/$(GNULIB_GETPAGESIZE)/g' \ + -e 's/@''GNULIB_GETUSERSHELL''@/$(GNULIB_GETUSERSHELL)/g' \ + -e 's/@''GNULIB_GROUP_MEMBER''@/$(GNULIB_GROUP_MEMBER)/g' \ + -e 's/@''GNULIB_LCHOWN''@/$(GNULIB_LCHOWN)/g' \ + -e 's/@''GNULIB_LINK''@/$(GNULIB_LINK)/g' \ + -e 's/@''GNULIB_LINKAT''@/$(GNULIB_LINKAT)/g' \ + -e 's/@''GNULIB_LSEEK''@/$(GNULIB_LSEEK)/g' \ + -e 's/@''GNULIB_PIPE''@/$(GNULIB_PIPE)/g' \ + -e 's/@''GNULIB_PIPE2''@/$(GNULIB_PIPE2)/g' \ + -e 's/@''GNULIB_PREAD''@/$(GNULIB_PREAD)/g' \ + -e 's/@''GNULIB_PWRITE''@/$(GNULIB_PWRITE)/g' \ + -e 's/@''GNULIB_READ''@/$(GNULIB_READ)/g' \ + -e 's/@''GNULIB_READLINK''@/$(GNULIB_READLINK)/g' \ + -e 's/@''GNULIB_READLINKAT''@/$(GNULIB_READLINKAT)/g' \ + -e 's/@''GNULIB_RMDIR''@/$(GNULIB_RMDIR)/g' \ + -e 's/@''GNULIB_SLEEP''@/$(GNULIB_SLEEP)/g' \ + -e 's/@''GNULIB_SYMLINK''@/$(GNULIB_SYMLINK)/g' \ + -e 's/@''GNULIB_SYMLINKAT''@/$(GNULIB_SYMLINKAT)/g' \ + -e 's/@''GNULIB_TTYNAME_R''@/$(GNULIB_TTYNAME_R)/g' \ + -e 's/@''GNULIB_UNISTD_H_GETOPT''@/$(GNULIB_UNISTD_H_GETOPT)/g' \ + -e 's/@''GNULIB_UNISTD_H_NONBLOCKING''@/$(GNULIB_UNISTD_H_NONBLOCKING)/g' \ + -e 's/@''GNULIB_UNISTD_H_SIGPIPE''@/$(GNULIB_UNISTD_H_SIGPIPE)/g' \ + -e 's/@''GNULIB_UNLINK''@/$(GNULIB_UNLINK)/g' \ + -e 's/@''GNULIB_UNLINKAT''@/$(GNULIB_UNLINKAT)/g' \ + -e 's/@''GNULIB_USLEEP''@/$(GNULIB_USLEEP)/g' \ + -e 's/@''GNULIB_WRITE''@/$(GNULIB_WRITE)/g' \ < $(srcdir)/unistd.in.h | \ sed -e 's|@''HAVE_CHOWN''@|$(HAVE_CHOWN)|g' \ -e 's|@''HAVE_DUP2''@|$(HAVE_DUP2)|g' \ @@ -1619,15 +1686,16 @@ unistd.h: unistd.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) -e 's|@''HAVE_FCHOWNAT''@|$(HAVE_FCHOWNAT)|g' \ -e 's|@''HAVE_FSYNC''@|$(HAVE_FSYNC)|g' \ -e 's|@''HAVE_FTRUNCATE''@|$(HAVE_FTRUNCATE)|g' \ - -e 's|@''HAVE_GETDOMAINNAME''@|$(HAVE_GETDOMAINNAME)|g' \ -e 's|@''HAVE_GETDTABLESIZE''@|$(HAVE_GETDTABLESIZE)|g' \ -e 's|@''HAVE_GETGROUPS''@|$(HAVE_GETGROUPS)|g' \ -e 's|@''HAVE_GETHOSTNAME''@|$(HAVE_GETHOSTNAME)|g' \ -e 's|@''HAVE_GETLOGIN''@|$(HAVE_GETLOGIN)|g' \ -e 's|@''HAVE_GETPAGESIZE''@|$(HAVE_GETPAGESIZE)|g' \ + -e 's|@''HAVE_GROUP_MEMBER''@|$(HAVE_GROUP_MEMBER)|g' \ -e 's|@''HAVE_LCHOWN''@|$(HAVE_LCHOWN)|g' \ -e 's|@''HAVE_LINK''@|$(HAVE_LINK)|g' \ -e 's|@''HAVE_LINKAT''@|$(HAVE_LINKAT)|g' \ + -e 's|@''HAVE_PIPE''@|$(HAVE_PIPE)|g' \ -e 's|@''HAVE_PIPE2''@|$(HAVE_PIPE2)|g' \ -e 's|@''HAVE_PREAD''@|$(HAVE_PREAD)|g' \ -e 's|@''HAVE_PWRITE''@|$(HAVE_PWRITE)|g' \ @@ -1636,21 +1704,26 @@ unistd.h: unistd.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) -e 's|@''HAVE_SLEEP''@|$(HAVE_SLEEP)|g' \ -e 's|@''HAVE_SYMLINK''@|$(HAVE_SYMLINK)|g' \ -e 's|@''HAVE_SYMLINKAT''@|$(HAVE_SYMLINKAT)|g' \ - -e 's|@''HAVE_TTYNAME_R''@|$(HAVE_TTYNAME_R)|g' \ -e 's|@''HAVE_UNLINKAT''@|$(HAVE_UNLINKAT)|g' \ -e 's|@''HAVE_USLEEP''@|$(HAVE_USLEEP)|g' \ -e 's|@''HAVE_DECL_ENVIRON''@|$(HAVE_DECL_ENVIRON)|g' \ + -e 's|@''HAVE_DECL_FCHDIR''@|$(HAVE_DECL_FCHDIR)|g' \ + -e 's|@''HAVE_DECL_GETDOMAINNAME''@|$(HAVE_DECL_GETDOMAINNAME)|g' \ -e 's|@''HAVE_DECL_GETLOGIN_R''@|$(HAVE_DECL_GETLOGIN_R)|g' \ -e 's|@''HAVE_DECL_GETPAGESIZE''@|$(HAVE_DECL_GETPAGESIZE)|g' \ -e 's|@''HAVE_DECL_GETUSERSHELL''@|$(HAVE_DECL_GETUSERSHELL)|g' \ + -e 's|@''HAVE_DECL_TTYNAME_R''@|$(HAVE_DECL_TTYNAME_R)|g' \ -e 's|@''HAVE_OS_H''@|$(HAVE_OS_H)|g' \ -e 's|@''HAVE_SYS_PARAM_H''@|$(HAVE_SYS_PARAM_H)|g' \ - -e 's|@''REPLACE_CHOWN''@|$(REPLACE_CHOWN)|g' \ + | \ + sed -e 's|@''REPLACE_CHOWN''@|$(REPLACE_CHOWN)|g' \ -e 's|@''REPLACE_CLOSE''@|$(REPLACE_CLOSE)|g' \ -e 's|@''REPLACE_DUP''@|$(REPLACE_DUP)|g' \ -e 's|@''REPLACE_DUP2''@|$(REPLACE_DUP2)|g' \ -e 's|@''REPLACE_FCHOWNAT''@|$(REPLACE_FCHOWNAT)|g' \ -e 's|@''REPLACE_GETCWD''@|$(REPLACE_GETCWD)|g' \ + -e 's|@''REPLACE_GETDOMAINNAME''@|$(REPLACE_GETDOMAINNAME)|g' \ + -e 's|@''REPLACE_GETLOGIN_R''@|$(REPLACE_GETLOGIN_R)|g' \ -e 's|@''REPLACE_GETGROUPS''@|$(REPLACE_GETGROUPS)|g' \ -e 's|@''REPLACE_GETPAGESIZE''@|$(REPLACE_GETPAGESIZE)|g' \ -e 's|@''REPLACE_LCHOWN''@|$(REPLACE_LCHOWN)|g' \ @@ -1659,6 +1732,7 @@ unistd.h: unistd.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) -e 's|@''REPLACE_LSEEK''@|$(REPLACE_LSEEK)|g' \ -e 's|@''REPLACE_PREAD''@|$(REPLACE_PREAD)|g' \ -e 's|@''REPLACE_PWRITE''@|$(REPLACE_PWRITE)|g' \ + -e 's|@''REPLACE_READ''@|$(REPLACE_READ)|g' \ -e 's|@''REPLACE_READLINK''@|$(REPLACE_READLINK)|g' \ -e 's|@''REPLACE_RMDIR''@|$(REPLACE_RMDIR)|g' \ -e 's|@''REPLACE_SLEEP''@|$(REPLACE_SLEEP)|g' \ @@ -1681,6 +1755,38 @@ EXTRA_DIST += unistd.in.h ## end gnulib module unistd +## begin gnulib module unistr/base + +BUILT_SOURCES += $(LIBUNISTRING_UNISTR_H) + +unistr.h: unistr.in.h + $(AM_V_GEN)rm -f $@-t $@ && \ + { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ + cat $(srcdir)/unistr.in.h; \ + } > $@-t && \ + mv -f $@-t $@ +MOSTLYCLEANFILES += unistr.h unistr.h-t + +EXTRA_DIST += unistr.in.h + +## end gnulib module unistr/base + +## begin gnulib module unistr/u8-mbtoucr + +if LIBUNISTRING_COMPILE_UNISTR_U8_MBTOUCR +libgreputils_a_SOURCES += unistr/u8-mbtoucr.c +endif + +## end gnulib module unistr/u8-mbtoucr + +## begin gnulib module unistr/u8-uctomb + +if LIBUNISTRING_COMPILE_UNISTR_U8_UCTOMB +libgreputils_a_SOURCES += unistr/u8-uctomb.c unistr/u8-uctomb-aux.c +endif + +## end gnulib module unistr/u8-uctomb + ## begin gnulib module unitypes BUILT_SOURCES += $(LIBUNISTRING_UNITYPES_H) @@ -1730,6 +1836,31 @@ EXTRA_DIST += unlocked-io.h ## end gnulib module unlocked-io +## begin gnulib module unused-parameter + +# The BUILT_SOURCES created by this Makefile snippet are not used via #include +# statements but through direct file reference. Therefore this snippet must be +# present in all Makefile.am that need it. This is ensured by the applicability +# 'all' defined above. + +BUILT_SOURCES += unused-parameter.h +# The unused-parameter.h that gets inserted into generated .h files is the same +# as build-aux/unused-parameter.h, except that it has the copyright header cut +# off. +unused-parameter.h: $(top_srcdir)/build-aux/unused-parameter.h + $(AM_V_GEN)rm -f $@-t $@ && \ + sed -n -e '/GL_UNUSED_PARAMETER/,$$p' \ + < $(top_srcdir)/build-aux/unused-parameter.h \ + > $@-t && \ + mv $@-t $@ +MOSTLYCLEANFILES += unused-parameter.h unused-parameter.h-t + +UNUSED_PARAMETER_H=unused-parameter.h + +EXTRA_DIST += $(top_srcdir)/build-aux/unused-parameter.h + +## end gnulib module unused-parameter + ## begin gnulib module update-copyright @@ -1753,7 +1884,8 @@ EXTRA_DIST += $(top_srcdir)/build-aux/vc-list-files ## begin gnulib module verify -libgreputils_a_SOURCES += verify.h + +EXTRA_DIST += verify.h ## end gnulib module verify @@ -1794,25 +1926,57 @@ BUILT_SOURCES += wchar.h # We need the following in order to create when the system # version does not work standalone. -wchar.h: wchar.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) +wchar.h: wchar.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ - sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ + sed -e 's|@''GUARD_PREFIX''@|GL|g' \ + -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ + -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ + -e 's|@''HAVE_FEATURES_H''@|$(HAVE_FEATURES_H)|g' \ -e 's|@''NEXT_WCHAR_H''@|$(NEXT_WCHAR_H)|g' \ -e 's|@''HAVE_WCHAR_H''@|$(HAVE_WCHAR_H)|g' \ - -e 's|@''GNULIB_BTOWC''@|$(GNULIB_BTOWC)|g' \ - -e 's|@''GNULIB_WCTOB''@|$(GNULIB_WCTOB)|g' \ - -e 's|@''GNULIB_MBSINIT''@|$(GNULIB_MBSINIT)|g' \ - -e 's|@''GNULIB_MBRTOWC''@|$(GNULIB_MBRTOWC)|g' \ - -e 's|@''GNULIB_MBRLEN''@|$(GNULIB_MBRLEN)|g' \ - -e 's|@''GNULIB_MBSRTOWCS''@|$(GNULIB_MBSRTOWCS)|g' \ - -e 's|@''GNULIB_MBSNRTOWCS''@|$(GNULIB_MBSNRTOWCS)|g' \ - -e 's|@''GNULIB_WCRTOMB''@|$(GNULIB_WCRTOMB)|g' \ - -e 's|@''GNULIB_WCSRTOMBS''@|$(GNULIB_WCSRTOMBS)|g' \ - -e 's|@''GNULIB_WCSNRTOMBS''@|$(GNULIB_WCSNRTOMBS)|g' \ - -e 's|@''GNULIB_WCWIDTH''@|$(GNULIB_WCWIDTH)|g' \ - -e 's|@''HAVE_WINT_T''@|$(HAVE_WINT_T)|g' \ + -e 's/@''GNULIB_BTOWC''@/$(GNULIB_BTOWC)/g' \ + -e 's/@''GNULIB_WCTOB''@/$(GNULIB_WCTOB)/g' \ + -e 's/@''GNULIB_MBSINIT''@/$(GNULIB_MBSINIT)/g' \ + -e 's/@''GNULIB_MBRTOWC''@/$(GNULIB_MBRTOWC)/g' \ + -e 's/@''GNULIB_MBRLEN''@/$(GNULIB_MBRLEN)/g' \ + -e 's/@''GNULIB_MBSRTOWCS''@/$(GNULIB_MBSRTOWCS)/g' \ + -e 's/@''GNULIB_MBSNRTOWCS''@/$(GNULIB_MBSNRTOWCS)/g' \ + -e 's/@''GNULIB_WCRTOMB''@/$(GNULIB_WCRTOMB)/g' \ + -e 's/@''GNULIB_WCSRTOMBS''@/$(GNULIB_WCSRTOMBS)/g' \ + -e 's/@''GNULIB_WCSNRTOMBS''@/$(GNULIB_WCSNRTOMBS)/g' \ + -e 's/@''GNULIB_WCWIDTH''@/$(GNULIB_WCWIDTH)/g' \ + -e 's/@''GNULIB_WMEMCHR''@/$(GNULIB_WMEMCHR)/g' \ + -e 's/@''GNULIB_WMEMCMP''@/$(GNULIB_WMEMCMP)/g' \ + -e 's/@''GNULIB_WMEMCPY''@/$(GNULIB_WMEMCPY)/g' \ + -e 's/@''GNULIB_WMEMMOVE''@/$(GNULIB_WMEMMOVE)/g' \ + -e 's/@''GNULIB_WMEMSET''@/$(GNULIB_WMEMSET)/g' \ + -e 's/@''GNULIB_WCSLEN''@/$(GNULIB_WCSLEN)/g' \ + -e 's/@''GNULIB_WCSNLEN''@/$(GNULIB_WCSNLEN)/g' \ + -e 's/@''GNULIB_WCSCPY''@/$(GNULIB_WCSCPY)/g' \ + -e 's/@''GNULIB_WCPCPY''@/$(GNULIB_WCPCPY)/g' \ + -e 's/@''GNULIB_WCSNCPY''@/$(GNULIB_WCSNCPY)/g' \ + -e 's/@''GNULIB_WCPNCPY''@/$(GNULIB_WCPNCPY)/g' \ + -e 's/@''GNULIB_WCSCAT''@/$(GNULIB_WCSCAT)/g' \ + -e 's/@''GNULIB_WCSNCAT''@/$(GNULIB_WCSNCAT)/g' \ + -e 's/@''GNULIB_WCSCMP''@/$(GNULIB_WCSCMP)/g' \ + -e 's/@''GNULIB_WCSNCMP''@/$(GNULIB_WCSNCMP)/g' \ + -e 's/@''GNULIB_WCSCASECMP''@/$(GNULIB_WCSCASECMP)/g' \ + -e 's/@''GNULIB_WCSNCASECMP''@/$(GNULIB_WCSNCASECMP)/g' \ + -e 's/@''GNULIB_WCSCOLL''@/$(GNULIB_WCSCOLL)/g' \ + -e 's/@''GNULIB_WCSXFRM''@/$(GNULIB_WCSXFRM)/g' \ + -e 's/@''GNULIB_WCSDUP''@/$(GNULIB_WCSDUP)/g' \ + -e 's/@''GNULIB_WCSCHR''@/$(GNULIB_WCSCHR)/g' \ + -e 's/@''GNULIB_WCSRCHR''@/$(GNULIB_WCSRCHR)/g' \ + -e 's/@''GNULIB_WCSCSPN''@/$(GNULIB_WCSCSPN)/g' \ + -e 's/@''GNULIB_WCSSPN''@/$(GNULIB_WCSSPN)/g' \ + -e 's/@''GNULIB_WCSPBRK''@/$(GNULIB_WCSPBRK)/g' \ + -e 's/@''GNULIB_WCSSTR''@/$(GNULIB_WCSSTR)/g' \ + -e 's/@''GNULIB_WCSTOK''@/$(GNULIB_WCSTOK)/g' \ + -e 's/@''GNULIB_WCSWIDTH''@/$(GNULIB_WCSWIDTH)/g' \ + < $(srcdir)/wchar.in.h | \ + sed -e 's|@''HAVE_WINT_T''@|$(HAVE_WINT_T)|g' \ -e 's|@''HAVE_BTOWC''@|$(HAVE_BTOWC)|g' \ -e 's|@''HAVE_MBSINIT''@|$(HAVE_MBSINIT)|g' \ -e 's|@''HAVE_MBRTOWC''@|$(HAVE_MBRTOWC)|g' \ @@ -1822,9 +1986,38 @@ wchar.h: wchar.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) -e 's|@''HAVE_WCRTOMB''@|$(HAVE_WCRTOMB)|g' \ -e 's|@''HAVE_WCSRTOMBS''@|$(HAVE_WCSRTOMBS)|g' \ -e 's|@''HAVE_WCSNRTOMBS''@|$(HAVE_WCSNRTOMBS)|g' \ + -e 's|@''HAVE_WMEMCHR''@|$(HAVE_WMEMCHR)|g' \ + -e 's|@''HAVE_WMEMCMP''@|$(HAVE_WMEMCMP)|g' \ + -e 's|@''HAVE_WMEMCPY''@|$(HAVE_WMEMCPY)|g' \ + -e 's|@''HAVE_WMEMMOVE''@|$(HAVE_WMEMMOVE)|g' \ + -e 's|@''HAVE_WMEMSET''@|$(HAVE_WMEMSET)|g' \ + -e 's|@''HAVE_WCSLEN''@|$(HAVE_WCSLEN)|g' \ + -e 's|@''HAVE_WCSNLEN''@|$(HAVE_WCSNLEN)|g' \ + -e 's|@''HAVE_WCSCPY''@|$(HAVE_WCSCPY)|g' \ + -e 's|@''HAVE_WCPCPY''@|$(HAVE_WCPCPY)|g' \ + -e 's|@''HAVE_WCSNCPY''@|$(HAVE_WCSNCPY)|g' \ + -e 's|@''HAVE_WCPNCPY''@|$(HAVE_WCPNCPY)|g' \ + -e 's|@''HAVE_WCSCAT''@|$(HAVE_WCSCAT)|g' \ + -e 's|@''HAVE_WCSNCAT''@|$(HAVE_WCSNCAT)|g' \ + -e 's|@''HAVE_WCSCMP''@|$(HAVE_WCSCMP)|g' \ + -e 's|@''HAVE_WCSNCMP''@|$(HAVE_WCSNCMP)|g' \ + -e 's|@''HAVE_WCSCASECMP''@|$(HAVE_WCSCASECMP)|g' \ + -e 's|@''HAVE_WCSNCASECMP''@|$(HAVE_WCSNCASECMP)|g' \ + -e 's|@''HAVE_WCSCOLL''@|$(HAVE_WCSCOLL)|g' \ + -e 's|@''HAVE_WCSXFRM''@|$(HAVE_WCSXFRM)|g' \ + -e 's|@''HAVE_WCSDUP''@|$(HAVE_WCSDUP)|g' \ + -e 's|@''HAVE_WCSCHR''@|$(HAVE_WCSCHR)|g' \ + -e 's|@''HAVE_WCSRCHR''@|$(HAVE_WCSRCHR)|g' \ + -e 's|@''HAVE_WCSCSPN''@|$(HAVE_WCSCSPN)|g' \ + -e 's|@''HAVE_WCSSPN''@|$(HAVE_WCSSPN)|g' \ + -e 's|@''HAVE_WCSPBRK''@|$(HAVE_WCSPBRK)|g' \ + -e 's|@''HAVE_WCSSTR''@|$(HAVE_WCSSTR)|g' \ + -e 's|@''HAVE_WCSTOK''@|$(HAVE_WCSTOK)|g' \ + -e 's|@''HAVE_WCSWIDTH''@|$(HAVE_WCSWIDTH)|g' \ -e 's|@''HAVE_DECL_WCTOB''@|$(HAVE_DECL_WCTOB)|g' \ -e 's|@''HAVE_DECL_WCWIDTH''@|$(HAVE_DECL_WCWIDTH)|g' \ - -e 's|@''REPLACE_MBSTATE_T''@|$(REPLACE_MBSTATE_T)|g' \ + | \ + sed -e 's|@''REPLACE_MBSTATE_T''@|$(REPLACE_MBSTATE_T)|g' \ -e 's|@''REPLACE_BTOWC''@|$(REPLACE_BTOWC)|g' \ -e 's|@''REPLACE_WCTOB''@|$(REPLACE_WCTOB)|g' \ -e 's|@''REPLACE_MBSINIT''@|$(REPLACE_MBSINIT)|g' \ @@ -1836,10 +2029,10 @@ wchar.h: wchar.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) -e 's|@''REPLACE_WCSRTOMBS''@|$(REPLACE_WCSRTOMBS)|g' \ -e 's|@''REPLACE_WCSNRTOMBS''@|$(REPLACE_WCSNRTOMBS)|g' \ -e 's|@''REPLACE_WCWIDTH''@|$(REPLACE_WCWIDTH)|g' \ + -e 's|@''REPLACE_WCSWIDTH''@|$(REPLACE_WCSWIDTH)|g' \ -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ - -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \ - < $(srcdir)/wchar.in.h; \ + -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)'; \ } > $@-t && \ mv $@-t $@ MOSTLYCLEANFILES += wchar.h wchar.h-t @@ -1866,21 +2059,39 @@ EXTRA_libgreputils_a_SOURCES += wctob.c ## end gnulib module wctob -## begin gnulib module wctype +## begin gnulib module wctomb + + +EXTRA_DIST += wctomb-impl.h wctomb.c + +EXTRA_libgreputils_a_SOURCES += wctomb.c + +## end gnulib module wctomb + +## begin gnulib module wctype-h BUILT_SOURCES += wctype.h # We need the following in order to create when the system # doesn't have one that works with the given compiler. -wctype.h: wctype.in.h $(CXXDEFS_H) $(WARN_ON_USE_H) +wctype.h: wctype.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(WARN_ON_USE_H) $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ - sed -e 's/@''HAVE_WCTYPE_H''@/$(HAVE_WCTYPE_H)/g' \ + sed -e 's|@''GUARD_PREFIX''@|GL|g' \ + -e 's/@''HAVE_WCTYPE_H''@/$(HAVE_WCTYPE_H)/g' \ -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ + -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ -e 's|@''NEXT_WCTYPE_H''@|$(NEXT_WCTYPE_H)|g' \ + -e 's/@''GNULIB_ISWBLANK''@/$(GNULIB_ISWBLANK)/g' \ + -e 's/@''GNULIB_WCTYPE''@/$(GNULIB_WCTYPE)/g' \ + -e 's/@''GNULIB_ISWCTYPE''@/$(GNULIB_ISWCTYPE)/g' \ + -e 's/@''GNULIB_WCTRANS''@/$(GNULIB_WCTRANS)/g' \ + -e 's/@''GNULIB_TOWCTRANS''@/$(GNULIB_TOWCTRANS)/g' \ -e 's/@''HAVE_ISWBLANK''@/$(HAVE_ISWBLANK)/g' \ -e 's/@''HAVE_ISWCNTRL''@/$(HAVE_ISWCNTRL)/g' \ + -e 's/@''HAVE_WCTYPE_T''@/$(HAVE_WCTYPE_T)/g' \ + -e 's/@''HAVE_WCTRANS_T''@/$(HAVE_WCTRANS_T)/g' \ -e 's/@''HAVE_WINT_T''@/$(HAVE_WINT_T)/g' \ -e 's/@''REPLACE_ISWBLANK''@/$(REPLACE_ISWBLANK)/g' \ -e 's/@''REPLACE_ISWCNTRL''@/$(REPLACE_ISWCNTRL)/g' \ @@ -1893,7 +2104,7 @@ MOSTLYCLEANFILES += wctype.h wctype.h-t EXTRA_DIST += wctype.in.h -## end gnulib module wctype +## end gnulib module wctype-h ## begin gnulib module wcwidth @@ -1906,10 +2117,9 @@ EXTRA_libgreputils_a_SOURCES += wcwidth.c ## begin gnulib module xalloc +libgreputils_a_SOURCES += xmalloc.c -EXTRA_DIST += xalloc.h xmalloc.c - -EXTRA_libgreputils_a_SOURCES += xmalloc.c +EXTRA_DIST += xalloc.h ## end gnulib module xalloc @@ -1919,6 +2129,13 @@ libgreputils_a_SOURCES += xalloc-die.c ## end gnulib module xalloc-die +## begin gnulib module xalloc-oversized + + +EXTRA_DIST += xalloc-oversized.h + +## end gnulib module xalloc-oversized + ## begin gnulib module xstriconv libgreputils_a_SOURCES += xstriconv.h xstriconv.c @@ -1933,10 +2150,9 @@ libgreputils_a_SOURCES += xstrndup.h xstrndup.c ## begin gnulib module xstrtol +libgreputils_a_SOURCES += xstrtol.c xstrtoul.c xstrtol-error.c -EXTRA_DIST += xstrtol-error.c xstrtol.c xstrtol.h xstrtoul.c - -EXTRA_libgreputils_a_SOURCES += xstrtol-error.c xstrtol.c xstrtoul.c +EXTRA_DIST += xstrtol.h ## end gnulib module xstrtol diff --git a/contrib/grep/lib/hard-locale.c b/contrib/grep/lib/hard-locale.c index c868ac0f13..26e614b74b 100644 --- a/contrib/grep/lib/hard-locale.c +++ b/contrib/grep/lib/hard-locale.c @@ -1,7 +1,7 @@ /* hard-locale.c -- Determine whether a locale is hard. - Copyright (C) 1997, 1998, 1999, 2002, 2003, 2004, 2006, 2007, 2009, 2010 - Free Software Foundation, Inc. + Copyright (C) 1997-1999, 2002-2004, 2006-2007, 2009-2011 Free Software + Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -26,6 +26,8 @@ #ifdef __GLIBC__ # define GLIBC_VERSION __GLIBC__ +#elif defined __UCLIBC__ +# define GLIBC_VERSION 2 #else # define GLIBC_VERSION 0 #endif diff --git a/contrib/grep/lib/hard-locale.h b/contrib/grep/lib/hard-locale.h index a1ce5bfb8b..7540628ea3 100644 --- a/contrib/grep/lib/hard-locale.h +++ b/contrib/grep/lib/hard-locale.h @@ -1,6 +1,6 @@ /* Determine whether a locale is hard. - Copyright (C) 1999, 2003, 2004, 2009, 2010 Free Software Foundation, Inc. + Copyright (C) 1999, 2003-2004, 2009-2011 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/contrib/grep/lib/hash.c b/contrib/grep/lib/hash.c index 732586e86d..4d76f765e9 100644 --- a/contrib/grep/lib/hash.c +++ b/contrib/grep/lib/hash.c @@ -1,6 +1,6 @@ /* hash - hashing table processing. - Copyright (C) 1998-2004, 2006-2007, 2009-2010 Free Software Foundation, Inc. + Copyright (C) 1998-2004, 2006-2007, 2009-2011 Free Software Foundation, Inc. Written by Jim Meyering, 1992. @@ -27,7 +27,7 @@ #include "hash.h" #include "bitrotate.h" -#include "xalloc.h" +#include "xalloc-oversized.h" #include #include diff --git a/contrib/grep/lib/hash.h b/contrib/grep/lib/hash.h index 5f91e999bd..9f694be555 100644 --- a/contrib/grep/lib/hash.h +++ b/contrib/grep/lib/hash.h @@ -1,5 +1,5 @@ /* hash - hashing table processing. - Copyright (C) 1998-1999, 2001, 2003, 2009-2010 Free Software Foundation, + Copyright (C) 1998-1999, 2001, 2003, 2009-2011 Free Software Foundation, Inc. Written by Jim Meyering , 1998. @@ -27,15 +27,12 @@ # include # include -/* The warn_unused_result attribute appeared first in gcc-3.4.0 */ -# ifndef __attribute__ -# if __GNUC__ < 3 || (__GNUC__ == 3 && __GNUC_MINOR__ < 4) -# define __attribute__(x) -# endif -# endif - -# ifndef ATTRIBUTE_WUR -# define ATTRIBUTE_WUR __attribute__ ((__warn_unused_result__)) +/* The __attribute__ feature is available in gcc versions 2.5 and later. + The warn_unused_result attribute appeared first in gcc-3.4.0. */ +# if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) +# define _GL_ATTRIBUTE_WUR __attribute__ ((__warn_unused_result__)) +# else +# define _GL_ATTRIBUTE_WUR /* empty */ # endif typedef size_t (*Hash_hasher) (const void *, size_t); @@ -81,13 +78,13 @@ size_t hash_string (const char *, size_t); void hash_reset_tuning (Hash_tuning *); Hash_table *hash_initialize (size_t, const Hash_tuning *, Hash_hasher, Hash_comparator, - Hash_data_freer) ATTRIBUTE_WUR; + Hash_data_freer) _GL_ATTRIBUTE_WUR; void hash_clear (Hash_table *); void hash_free (Hash_table *); /* Insertion and deletion. */ -bool hash_rehash (Hash_table *, size_t) ATTRIBUTE_WUR; -void *hash_insert (Hash_table *, const void *) ATTRIBUTE_WUR; +bool hash_rehash (Hash_table *, size_t) _GL_ATTRIBUTE_WUR; +void *hash_insert (Hash_table *, const void *) _GL_ATTRIBUTE_WUR; int hash_insert0 (Hash_table *table, const void *entry, const void **matched_ent); void *hash_delete (Hash_table *, const void *); diff --git a/contrib/grep/lib/iconv_open.c b/contrib/grep/lib/iconv_open.c index 91ede00e4b..eafcebc332 100644 --- a/contrib/grep/lib/iconv_open.c +++ b/contrib/grep/lib/iconv_open.c @@ -1,7 +1,7 @@ /* -*- buffer-read-only: t -*- vi: set ro: */ /* DO NOT EDIT! GENERATED AUTOMATICALLY! */ /* Character set conversion. - Copyright (C) 2007, 2009, 2010 Free Software Foundation, Inc. + Copyright (C) 2007, 2009-2011 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/contrib/grep/lib/ignore-value.h b/contrib/grep/lib/ignore-value.h index 2eb6918db5..f021a1ac8e 100644 --- a/contrib/grep/lib/ignore-value.h +++ b/contrib/grep/lib/ignore-value.h @@ -1,6 +1,6 @@ /* ignore a function return without a compiler warning - Copyright (C) 2008-2010 Free Software Foundation, Inc. + Copyright (C) 2008-2011 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -15,9 +15,9 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ -/* Written by Jim Meyering. */ +/* Written by Jim Meyering, Eric Blake and Pádraig Brady. */ -/* Use these functions to avoid a warning when using a function declared with +/* Use "ignore_value" to avoid a warning when using a function declared with gcc's warn_unused_result attribute, but for which you really do want to ignore the result. Traditionally, people have used a "(void)" cast to indicate that a function's return value is deliberately unused. However, @@ -32,6 +32,31 @@ "copy.c:233: warning: ignoring return value of 'fchown', declared with attribute warn_unused_result". */ -static inline void ignore_value (int i) { (void) i; } -static inline void ignore_ptr (void* p) { (void) p; } -/* FIXME: what about aggregate types? */ +#ifndef _GL_IGNORE_VALUE_H +# define _GL_IGNORE_VALUE_H + +# ifndef _GL_ATTRIBUTE_DEPRECATED +/* The __attribute__((__deprecated__)) feature + is available in gcc versions 3.1 and newer. */ +# if __GNUC__ < 3 || (__GNUC__ == 3 && __GNUC_MINOR__ < 1) +# define _GL_ATTRIBUTE_DEPRECATED /* empty */ +# else +# define _GL_ATTRIBUTE_DEPRECATED __attribute__ ((__deprecated__)) +# endif +# endif + +/* The __attribute__((__warn_unused_result__)) feature + is available in gcc versions 3.4 and newer, + while the typeof feature has been available since 2.7 at least. */ +# if __GNUC__ < 3 || (__GNUC__ == 3 && __GNUC_MINOR__ < 4) +# define ignore_value(x) ((void) (x)) +# else +# define ignore_value(x) (({ __typeof__ (x) __x = (x); (void) __x; })) +# endif + +/* ignore_value works for scalars, pointers and aggregates; + deprecate ignore_ptr. */ +static inline void _GL_ATTRIBUTE_DEPRECATED +ignore_ptr (void *p) { (void) p; } /* deprecated: use ignore_value */ + +#endif diff --git a/contrib/grep/lib/intprops.h b/contrib/grep/lib/intprops.h index 46f4d47d70..1f6a539c18 100644 --- a/contrib/grep/lib/intprops.h +++ b/contrib/grep/lib/intprops.h @@ -1,7 +1,6 @@ /* intprops.h -- properties of integer types - Copyright (C) 2001, 2002, 2003, 2004, 2005, 2009, 2010 Free Software - Foundation, Inc. + Copyright (C) 2001-2005, 2009-2011 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -18,66 +17,303 @@ /* Written by Paul Eggert. */ -#ifndef GL_INTPROPS_H -# define GL_INTPROPS_H +#ifndef _GL_INTPROPS_H +#define _GL_INTPROPS_H -# include +#include + +/* Return an integer value, converted to the same type as the integer + expression E after integer type promotion. V is the unconverted value. */ +#define _GL_INT_CONVERT(e, v) (0 * (e) + (v)) + +/* Act like _GL_INT_CONVERT (E, -V) but work around a bug in IRIX 6.5 cc; see + . */ +#define _GL_INT_NEGATE_CONVERT(e, v) (0 * (e) - (v)) /* The extra casts in the following macros work around compiler bugs, e.g., in Cray C 5.0.3.0. */ /* True if the arithmetic type T is an integer type. bool counts as an integer. */ -# define TYPE_IS_INTEGER(t) ((t) 1.5 == 1) +#define TYPE_IS_INTEGER(t) ((t) 1.5 == 1) /* True if negative values of the signed integer type T use two's complement, ones' complement, or signed magnitude representation, respectively. Much GNU code assumes two's complement, but some people like to be portable to all possible C hosts. */ -# define TYPE_TWOS_COMPLEMENT(t) ((t) ~ (t) 0 == (t) -1) -# define TYPE_ONES_COMPLEMENT(t) ((t) ~ (t) 0 == 0) -# define TYPE_SIGNED_MAGNITUDE(t) ((t) ~ (t) 0 < (t) -1) +#define TYPE_TWOS_COMPLEMENT(t) ((t) ~ (t) 0 == (t) -1) +#define TYPE_ONES_COMPLEMENT(t) ((t) ~ (t) 0 == 0) +#define TYPE_SIGNED_MAGNITUDE(t) ((t) ~ (t) 0 < (t) -1) + +/* True if the signed integer expression E uses two's complement. */ +#define _GL_INT_TWOS_COMPLEMENT(e) (~ _GL_INT_CONVERT (e, 0) == -1) /* True if the arithmetic type T is signed. */ -# define TYPE_SIGNED(t) (! ((t) 0 < (t) -1)) +#define TYPE_SIGNED(t) (! ((t) 0 < (t) -1)) -/* The maximum and minimum values for the integer type T. These +/* Return 1 if the integer expression E, after integer promotion, has + a signed type. */ +#define _GL_INT_SIGNED(e) (_GL_INT_NEGATE_CONVERT (e, 1) < 0) + + +/* Minimum and maximum values for integer types and expressions. These macros have undefined behavior if T is signed and has padding bits. If this is a problem for you, please let us know how to fix it for your host. */ -# define TYPE_MINIMUM(t) \ - ((t) (! TYPE_SIGNED (t) \ - ? (t) 0 \ - : TYPE_SIGNED_MAGNITUDE (t) \ - ? ~ (t) 0 \ - : ~ (t) 0 << (sizeof (t) * CHAR_BIT - 1))) -# define TYPE_MAXIMUM(t) \ - ((t) (! TYPE_SIGNED (t) \ - ? (t) -1 \ - : ~ (~ (t) 0 << (sizeof (t) * CHAR_BIT - 1)))) - -/* Return zero if T can be determined to be an unsigned type. - Otherwise, return 1. - When compiling with GCC, INT_STRLEN_BOUND uses this macro to obtain a - tighter bound. Otherwise, it overestimates the true bound by one byte - when applied to unsigned types of size 2, 4, 16, ... bytes. - The symbol signed_type_or_expr__ is private to this header file. */ -# if __GNUC__ >= 2 -# define signed_type_or_expr__(t) TYPE_SIGNED (__typeof__ (t)) -# else -# define signed_type_or_expr__(t) 1 -# endif + +/* The maximum and minimum values for the integer type T. */ +#define TYPE_MINIMUM(t) \ + ((t) (! TYPE_SIGNED (t) \ + ? (t) 0 \ + : TYPE_SIGNED_MAGNITUDE (t) \ + ? ~ (t) 0 \ + : ~ TYPE_MAXIMUM (t))) +#define TYPE_MAXIMUM(t) \ + ((t) (! TYPE_SIGNED (t) \ + ? (t) -1 \ + : ((((t) 1 << (sizeof (t) * CHAR_BIT - 2)) - 1) * 2 + 1))) + +/* The maximum and minimum values for the type of the expression E, + after integer promotion. E should not have side effects. */ +#define _GL_INT_MINIMUM(e) \ + (_GL_INT_SIGNED (e) \ + ? - _GL_INT_TWOS_COMPLEMENT (e) - _GL_SIGNED_INT_MAXIMUM (e) \ + : _GL_INT_CONVERT (e, 0)) +#define _GL_INT_MAXIMUM(e) \ + (_GL_INT_SIGNED (e) \ + ? _GL_SIGNED_INT_MAXIMUM (e) \ + : _GL_INT_NEGATE_CONVERT (e, 1)) +#define _GL_SIGNED_INT_MAXIMUM(e) \ + (((_GL_INT_CONVERT (e, 1) << (sizeof ((e) + 0) * CHAR_BIT - 2)) - 1) * 2 + 1) + + +/* Return 1 if the __typeof__ keyword works. This could be done by + 'configure', but for now it's easier to do it by hand. */ +#if 2 <= __GNUC__ || 0x5110 <= __SUNPRO_C +# define _GL_HAVE___TYPEOF__ 1 +#else +# define _GL_HAVE___TYPEOF__ 0 +#endif + +/* Return 1 if the integer type or expression T might be signed. Return 0 + if it is definitely unsigned. This macro does not evaluate its argument, + and expands to an integer constant expression. */ +#if _GL_HAVE___TYPEOF__ +# define _GL_SIGNED_TYPE_OR_EXPR(t) TYPE_SIGNED (__typeof__ (t)) +#else +# define _GL_SIGNED_TYPE_OR_EXPR(t) 1 +#endif + +/* Bound on length of the string representing an unsigned integer + value representable in B bits. log10 (2.0) < 146/485. The + smallest value of B where this bound is not tight is 2621. */ +#define INT_BITS_STRLEN_BOUND(b) (((b) * 146 + 484) / 485) /* Bound on length of the string representing an integer type or expression T. - Subtract 1 for the sign bit if T is signed; log10 (2.0) < 146/485; - add 1 for integer division truncation; add 1 more for a minus sign - if needed. */ -# define INT_STRLEN_BOUND(t) \ - ((sizeof (t) * CHAR_BIT - signed_type_or_expr__ (t)) * 146 / 485 \ - + signed_type_or_expr__ (t) + 1) + Subtract 1 for the sign bit if T is signed, and then add 1 more for + a minus sign if needed. + + Because _GL_SIGNED_TYPE_OR_EXPR sometimes returns 0 when its argument is + signed, this macro may overestimate the true bound by one byte when + applied to unsigned types of size 2, 4, 16, ... bytes. */ +#define INT_STRLEN_BOUND(t) \ + (INT_BITS_STRLEN_BOUND (sizeof (t) * CHAR_BIT \ + - _GL_SIGNED_TYPE_OR_EXPR (t)) \ + + _GL_SIGNED_TYPE_OR_EXPR (t)) /* Bound on buffer size needed to represent an integer type or expression T, including the terminating null. */ -# define INT_BUFSIZE_BOUND(t) (INT_STRLEN_BOUND (t) + 1) +#define INT_BUFSIZE_BOUND(t) (INT_STRLEN_BOUND (t) + 1) + + +/* Range overflow checks. + + The INT__RANGE_OVERFLOW macros return 1 if the corresponding C + operators might not yield numerically correct answers due to + arithmetic overflow. They do not rely on undefined or + implementation-defined behavior. Their implementations are simple + and straightforward, but they are a bit harder to use than the + INT__OVERFLOW macros described below. + + Example usage: + + long int i = ...; + long int j = ...; + if (INT_MULTIPLY_RANGE_OVERFLOW (i, j, LONG_MIN, LONG_MAX)) + printf ("multiply would overflow"); + else + printf ("product is %ld", i * j); + + Restrictions on *_RANGE_OVERFLOW macros: + + These macros do not check for all possible numerical problems or + undefined or unspecified behavior: they do not check for division + by zero, for bad shift counts, or for shifting negative numbers. + + These macros may evaluate their arguments zero or multiple times, + so the arguments should not have side effects. The arithmetic + arguments (including the MIN and MAX arguments) must be of the same + integer type after the usual arithmetic conversions, and the type + must have minimum value MIN and maximum MAX. Unsigned types should + use a zero MIN of the proper type. + + These macros are tuned for constant MIN and MAX. For commutative + operations such as A + B, they are also tuned for constant B. */ + +/* Return 1 if A + B would overflow in [MIN,MAX] arithmetic. + See above for restrictions. */ +#define INT_ADD_RANGE_OVERFLOW(a, b, min, max) \ + ((b) < 0 \ + ? (a) < (min) - (b) \ + : (max) - (b) < (a)) + +/* Return 1 if A - B would overflow in [MIN,MAX] arithmetic. + See above for restrictions. */ +#define INT_SUBTRACT_RANGE_OVERFLOW(a, b, min, max) \ + ((b) < 0 \ + ? (max) + (b) < (a) \ + : (a) < (min) + (b)) + +/* Return 1 if - A would overflow in [MIN,MAX] arithmetic. + See above for restrictions. */ +#define INT_NEGATE_RANGE_OVERFLOW(a, min, max) \ + ((min) < 0 \ + ? (a) < - (max) \ + : 0 < (a)) + +/* Return 1 if A * B would overflow in [MIN,MAX] arithmetic. + See above for restrictions. Avoid && and || as they tickle + bugs in Sun C 5.11 2010/08/13 and other compilers; see + . */ +#define INT_MULTIPLY_RANGE_OVERFLOW(a, b, min, max) \ + ((b) < 0 \ + ? ((a) < 0 \ + ? (a) < (max) / (b) \ + : (b) == -1 \ + ? 0 \ + : (min) / (b) < (a)) \ + : (b) == 0 \ + ? 0 \ + : ((a) < 0 \ + ? (a) < (min) / (b) \ + : (max) / (b) < (a))) + +/* Return 1 if A / B would overflow in [MIN,MAX] arithmetic. + See above for restrictions. Do not check for division by zero. */ +#define INT_DIVIDE_RANGE_OVERFLOW(a, b, min, max) \ + ((min) < 0 && (b) == -1 && (a) < - (max)) + +/* Return 1 if A % B would overflow in [MIN,MAX] arithmetic. + See above for restrictions. Do not check for division by zero. + Mathematically, % should never overflow, but on x86-like hosts + INT_MIN % -1 traps, and the C standard permits this, so treat this + as an overflow too. */ +#define INT_REMAINDER_RANGE_OVERFLOW(a, b, min, max) \ + INT_DIVIDE_RANGE_OVERFLOW (a, b, min, max) + +/* Return 1 if A << B would overflow in [MIN,MAX] arithmetic. + See above for restrictions. Here, MIN and MAX are for A only, and B need + not be of the same type as the other arguments. The C standard says that + behavior is undefined for shifts unless 0 <= B < wordwidth, and that when + A is negative then A << B has undefined behavior and A >> B has + implementation-defined behavior, but do not check these other + restrictions. */ +#define INT_LEFT_SHIFT_RANGE_OVERFLOW(a, b, min, max) \ + ((a) < 0 \ + ? (a) < (min) >> (b) \ + : (max) >> (b) < (a)) + + +/* The _GL*_OVERFLOW macros have the same restrictions as the + *_RANGE_OVERFLOW macros, except that they do not assume that operands + (e.g., A and B) have the same type as MIN and MAX. Instead, they assume + that the result (e.g., A + B) has that type. */ +#define _GL_ADD_OVERFLOW(a, b, min, max) \ + ((min) < 0 ? INT_ADD_RANGE_OVERFLOW (a, b, min, max) \ + : (a) < 0 ? (b) <= (a) + (b) \ + : (b) < 0 ? (a) <= (a) + (b) \ + : (a) + (b) < (b)) +#define _GL_SUBTRACT_OVERFLOW(a, b, min, max) \ + ((min) < 0 ? INT_SUBTRACT_RANGE_OVERFLOW (a, b, min, max) \ + : (a) < 0 ? 1 \ + : (b) < 0 ? (a) - (b) <= (a) \ + : (a) < (b)) +#define _GL_MULTIPLY_OVERFLOW(a, b, min, max) \ + (((min) == 0 && (((a) < 0 && 0 < (b)) || ((b) < 0 && 0 < (a)))) \ + || INT_MULTIPLY_RANGE_OVERFLOW (a, b, min, max)) +#define _GL_DIVIDE_OVERFLOW(a, b, min, max) \ + ((min) < 0 ? (b) == _GL_INT_NEGATE_CONVERT (min, 1) && (a) < - (max) \ + : (a) < 0 ? (b) <= (a) + (b) - 1 \ + : (b) < 0 && (a) + (b) <= (a)) +#define _GL_REMAINDER_OVERFLOW(a, b, min, max) \ + ((min) < 0 ? (b) == _GL_INT_NEGATE_CONVERT (min, 1) && (a) < - (max) \ + : (a) < 0 ? (a) % (b) != ((max) - (b) + 1) % (b) \ + : (b) < 0 && ! _GL_UNSIGNED_NEG_MULTIPLE (a, b, max)) + +/* Return a nonzero value if A is a mathematical multiple of B, where + A is unsigned, B is negative, and MAX is the maximum value of A's + type. A's type must be the same as (A % B)'s type. Normally (A % + -B == 0) suffices, but things get tricky if -B would overflow. */ +#define _GL_UNSIGNED_NEG_MULTIPLE(a, b, max) \ + (((b) < -_GL_SIGNED_INT_MAXIMUM (b) \ + ? (_GL_SIGNED_INT_MAXIMUM (b) == (max) \ + ? (a) \ + : (a) % (_GL_INT_CONVERT (a, _GL_SIGNED_INT_MAXIMUM (b)) + 1)) \ + : (a) % - (b)) \ + == 0) + + +/* Integer overflow checks. + + The INT__OVERFLOW macros return 1 if the corresponding C operators + might not yield numerically correct answers due to arithmetic overflow. + They work correctly on all known practical hosts, and do not rely + on undefined behavior due to signed arithmetic overflow. + + Example usage: + + long int i = ...; + long int j = ...; + if (INT_MULTIPLY_OVERFLOW (i, j)) + printf ("multiply would overflow"); + else + printf ("product is %ld", i * j); + + These macros do not check for all possible numerical problems or + undefined or unspecified behavior: they do not check for division + by zero, for bad shift counts, or for shifting negative numbers. + + These macros may evaluate their arguments zero or multiple times, so the + arguments should not have side effects. + + These macros are tuned for their last argument being a constant. + + Return 1 if the integer expressions A * B, A - B, -A, A * B, A / B, + A % B, and A << B would overflow, respectively. */ + +#define INT_ADD_OVERFLOW(a, b) \ + _GL_BINARY_OP_OVERFLOW (a, b, _GL_ADD_OVERFLOW) +#define INT_SUBTRACT_OVERFLOW(a, b) \ + _GL_BINARY_OP_OVERFLOW (a, b, _GL_SUBTRACT_OVERFLOW) +#define INT_NEGATE_OVERFLOW(a) \ + INT_NEGATE_RANGE_OVERFLOW (a, _GL_INT_MINIMUM (a), _GL_INT_MAXIMUM (a)) +#define INT_MULTIPLY_OVERFLOW(a, b) \ + _GL_BINARY_OP_OVERFLOW (a, b, _GL_MULTIPLY_OVERFLOW) +#define INT_DIVIDE_OVERFLOW(a, b) \ + _GL_BINARY_OP_OVERFLOW (a, b, _GL_DIVIDE_OVERFLOW) +#define INT_REMAINDER_OVERFLOW(a, b) \ + _GL_BINARY_OP_OVERFLOW (a, b, _GL_REMAINDER_OVERFLOW) +#define INT_LEFT_SHIFT_OVERFLOW(a, b) \ + INT_LEFT_SHIFT_RANGE_OVERFLOW (a, b, \ + _GL_INT_MINIMUM (a), _GL_INT_MAXIMUM (a)) + +/* Return 1 if the expression A B would overflow, + where OP_RESULT_OVERFLOW (A, B, MIN, MAX) does the actual test, + assuming MIN and MAX are the minimum and maximum for the result type. + Arguments should be free of side effects. */ +#define _GL_BINARY_OP_OVERFLOW(a, b, op_result_overflow) \ + op_result_overflow (a, b, \ + _GL_INT_MINIMUM (0 * (b) + (a)), \ + _GL_INT_MAXIMUM (0 * (b) + (a))) -#endif /* GL_INTPROPS_H */ +#endif /* _GL_INTPROPS_H */ diff --git a/contrib/grep/lib/isblank.c b/contrib/grep/lib/isblank.c index e4cddac2a5..65cc54f854 100644 --- a/contrib/grep/lib/isblank.c +++ b/contrib/grep/lib/isblank.c @@ -1,6 +1,6 @@ /* Test whether a character is a blank. - Copyright (C) 2009, 2010 Free Software Foundation, Inc. + Copyright (C) 2009-2011 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/contrib/grep/lib/isdir.c b/contrib/grep/lib/isdir.c index c1430cc605..77cd7a2699 100644 --- a/contrib/grep/lib/isdir.c +++ b/contrib/grep/lib/isdir.c @@ -1,6 +1,6 @@ /* isdir.c -- determine whether a directory exists - Copyright (C) 1990, 1998, 2006, 2009-2010 Free Software Foundation, Inc. + Copyright (C) 1990, 1998, 2006, 2009-2011 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/contrib/grep/lib/localcharset.c b/contrib/grep/lib/localcharset.c index 794fec6bef..d8b5953c23 100644 --- a/contrib/grep/lib/localcharset.c +++ b/contrib/grep/lib/localcharset.c @@ -2,7 +2,7 @@ /* DO NOT EDIT! GENERATED AUTOMATICALLY! */ /* Determine a canonical name for the current locale's character encoding. - Copyright (C) 2000-2006, 2008-2010 Free Software Foundation, Inc. + Copyright (C) 2000-2006, 2008-2011 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -230,8 +230,7 @@ get_charset_aliases (void) { /* Out of memory. */ res_size = 0; - if (old_res_ptr != NULL) - free (old_res_ptr); + free (old_res_ptr); break; } strcpy (res_ptr + res_size - (l2 + 1) - (l1 + 1), buf1); diff --git a/contrib/grep/lib/localcharset.h b/contrib/grep/lib/localcharset.h index 9a67c0deb0..53c8a948b9 100644 --- a/contrib/grep/lib/localcharset.h +++ b/contrib/grep/lib/localcharset.h @@ -1,7 +1,7 @@ /* -*- buffer-read-only: t -*- vi: set ro: */ /* DO NOT EDIT! GENERATED AUTOMATICALLY! */ /* Determine a canonical name for the current locale's character encoding. - Copyright (C) 2000-2003, 2009-2010 Free Software Foundation, Inc. + Copyright (C) 2000-2003, 2009-2011 Free Software Foundation, Inc. This file is part of the GNU CHARSET Library. This program is free software; you can redistribute it and/or modify diff --git a/contrib/grep/lib/lseek.c b/contrib/grep/lib/lseek.c index 831e538343..b33a75686b 100644 --- a/contrib/grep/lib/lseek.c +++ b/contrib/grep/lib/lseek.c @@ -1,7 +1,7 @@ /* -*- buffer-read-only: t -*- vi: set ro: */ /* DO NOT EDIT! GENERATED AUTOMATICALLY! */ /* An lseek() function that detects pipes. - Copyright (C) 2007, 2009, 2010 Free Software Foundation, Inc. + Copyright (C) 2007, 2009-2011 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/contrib/grep/lib/malloc.c b/contrib/grep/lib/malloc.c index 3daa8582df..7d2c09092a 100644 --- a/contrib/grep/lib/malloc.c +++ b/contrib/grep/lib/malloc.c @@ -2,7 +2,7 @@ /* DO NOT EDIT! GENERATED AUTOMATICALLY! */ /* malloc() function that is glibc compatible. - Copyright (C) 1997-1998, 2006-2007, 2009-2010 Free Software Foundation, Inc. + Copyright (C) 1997-1998, 2006-2007, 2009-2011 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -20,6 +20,7 @@ /* written by Jim Meyering and Bruno Haible */ +#define _GL_USE_STDLIB_ALLOC 1 #include /* Only the AC_FUNC_MALLOC macro defines 'malloc' already in config.h. */ #ifdef malloc @@ -30,14 +31,10 @@ # define NEED_MALLOC_GNU 1 #endif -/* Specification. */ #include #include -/* Call the system's malloc below. */ -#undef malloc - /* Allocate an N-byte block of memory from the heap. If N is zero, allocate a 1-byte block. */ diff --git a/contrib/grep/lib/malloca.c b/contrib/grep/lib/malloca.c index 3d01c0e354..11482c5078 100644 --- a/contrib/grep/lib/malloca.c +++ b/contrib/grep/lib/malloca.c @@ -1,7 +1,7 @@ /* -*- buffer-read-only: t -*- vi: set ro: */ /* DO NOT EDIT! GENERATED AUTOMATICALLY! */ /* Safe automatic memory allocation. - Copyright (C) 2003, 2006-2007, 2009-2010 Free Software Foundation, Inc. + Copyright (C) 2003, 2006-2007, 2009-2011 Free Software Foundation, Inc. Written by Bruno Haible , 2003. This program is free software; you can redistribute it and/or modify @@ -18,13 +18,13 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ +#define _GL_USE_STDLIB_ALLOC 1 #include /* Specification. */ #include "malloca.h" -/* Use the system functions, not the gnulib overrides in this file. */ -#undef malloc +#include "verify.h" /* The speed critical point in this file is freea() applied to an alloca() result: it must be fast, to match the speed of alloca(). The speed of @@ -55,8 +55,7 @@ struct preliminary_header { void *next; char room[MAGIC_SIZE]; }; #define HEADER_SIZE \ (((sizeof (struct preliminary_header) + sa_alignment_max - 1) / sa_alignment_max) * sa_alignment_max) struct header { void *next; char room[HEADER_SIZE - sizeof (struct preliminary_header) + MAGIC_SIZE]; }; -/* Verify that HEADER_SIZE == sizeof (struct header). */ -typedef int verify1[2 * (HEADER_SIZE == sizeof (struct header)) - 1]; +verify (HEADER_SIZE == sizeof (struct header)); /* We make the hash table quite big, so that during lookups the probability of empty hash buckets is quite high. There is no need to make the hash table resizable, because when the hash table gets filled so much that the diff --git a/contrib/grep/lib/malloca.h b/contrib/grep/lib/malloca.h index b0c78a3fff..933fa7ec70 100644 --- a/contrib/grep/lib/malloca.h +++ b/contrib/grep/lib/malloca.h @@ -1,7 +1,7 @@ /* -*- buffer-read-only: t -*- vi: set ro: */ /* DO NOT EDIT! GENERATED AUTOMATICALLY! */ /* Safe automatic memory allocation. - Copyright (C) 2003-2007, 2009-2010 Free Software Foundation, Inc. + Copyright (C) 2003-2007, 2009-2011 Free Software Foundation, Inc. Written by Bruno Haible , 2003. This program is free software; you can redistribute it and/or modify diff --git a/contrib/grep/lib/mbchar.c b/contrib/grep/lib/mbchar.c index 6ec01950de..c9b0dcdce8 100644 --- a/contrib/grep/lib/mbchar.c +++ b/contrib/grep/lib/mbchar.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2001, 2006, 2009, 2010 Free Software Foundation, Inc. +/* Copyright (C) 2001, 2006, 2009-2011 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/contrib/grep/lib/mbchar.h b/contrib/grep/lib/mbchar.h index 012bfcb118..6dcb6cfa60 100644 --- a/contrib/grep/lib/mbchar.h +++ b/contrib/grep/lib/mbchar.h @@ -1,5 +1,5 @@ /* Multibyte character data type. - Copyright (C) 2001, 2005-2007, 2009-2010 Free Software Foundation, Inc. + Copyright (C) 2001, 2005-2007, 2009-2011 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/contrib/grep/lib/mbiter.h b/contrib/grep/lib/mbiter.h index 6b738268f6..38cf6b1afe 100644 --- a/contrib/grep/lib/mbiter.h +++ b/contrib/grep/lib/mbiter.h @@ -1,5 +1,5 @@ /* Iterating through multibyte strings: macros for multi-byte encodings. - Copyright (C) 2001, 2005, 2007, 2009, 2010 Free Software Foundation, Inc. + Copyright (C) 2001, 2005, 2007, 2009-2011 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/contrib/grep/lib/mbrlen.c b/contrib/grep/lib/mbrlen.c index 01ee094454..54d2c88f7b 100644 --- a/contrib/grep/lib/mbrlen.c +++ b/contrib/grep/lib/mbrlen.c @@ -1,5 +1,5 @@ /* Recognize multibyte character. - Copyright (C) 1999-2000, 2008-2010 Free Software Foundation, Inc. + Copyright (C) 1999-2000, 2008-2011 Free Software Foundation, Inc. Written by Bruno Haible , 2008. This program is free software: you can redistribute it and/or modify diff --git a/contrib/grep/lib/mbrtowc.c b/contrib/grep/lib/mbrtowc.c index 5c2650e952..7a8e5996d0 100644 --- a/contrib/grep/lib/mbrtowc.c +++ b/contrib/grep/lib/mbrtowc.c @@ -1,5 +1,5 @@ /* Convert multibyte character to wide character. - Copyright (C) 1999-2002, 2005-2010 Free Software Foundation, Inc. + Copyright (C) 1999-2002, 2005-2011 Free Software Foundation, Inc. Written by Bruno Haible , 2008. This program is free software: you can redistribute it and/or modify @@ -40,9 +40,6 @@ mbrtowc (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps) { char *pstate = (char *)ps; - if (pstate == NULL) - pstate = internal_state; - if (s == NULL) { pwc = NULL; @@ -54,6 +51,10 @@ mbrtowc (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps) return (size_t)(-2); /* Here n > 0. */ + + if (pstate == NULL) + pstate = internal_state; + { size_t nstate = pstate[0]; char buf[4]; @@ -91,7 +92,7 @@ mbrtowc (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps) /* Here m > 0. */ -# if __GLIBC__ +# if __GLIBC__ || defined __UCLIBC__ /* Work around bug */ mbtowc (NULL, NULL, 0); # endif @@ -321,7 +322,7 @@ mbrtowc (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps) size_t rpl_mbrtowc (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps) { -# if MBRTOWC_NULL_ARG_BUG || MBRTOWC_RETVAL_BUG +# if MBRTOWC_NULL_ARG2_BUG || MBRTOWC_RETVAL_BUG if (s == NULL) { pwc = NULL; @@ -334,7 +335,7 @@ rpl_mbrtowc (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps) { static mbstate_t internal_state; - /* Override mbrtowc's internal state. We can not call mbsinit() on the + /* Override mbrtowc's internal state. We cannot call mbsinit() on the hidden internal state, but we can call it on our variable. */ if (ps == NULL) ps = &internal_state; @@ -379,7 +380,16 @@ rpl_mbrtowc (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps) return ret; } # else - return mbrtowc (pwc, s, n, ps); + { +# if MBRTOWC_NULL_ARG1_BUG + wchar_t dummy; + + if (pwc == NULL) + pwc = &dummy; +# endif + + return mbrtowc (pwc, s, n, ps); + } # endif } diff --git a/contrib/grep/lib/mbscasecmp.c b/contrib/grep/lib/mbscasecmp.c index ba9feef487..dfff49c379 100644 --- a/contrib/grep/lib/mbscasecmp.c +++ b/contrib/grep/lib/mbscasecmp.c @@ -1,5 +1,5 @@ /* Case-insensitive string comparison function. - Copyright (C) 1998-1999, 2005-2010 Free Software Foundation, Inc. + Copyright (C) 1998-1999, 2005-2011 Free Software Foundation, Inc. Written by Bruno Haible , 2005, based on earlier glibc code. diff --git a/contrib/grep/lib/mbsinit.c b/contrib/grep/lib/mbsinit.c index 066ddfe5bf..8ac213703a 100644 --- a/contrib/grep/lib/mbsinit.c +++ b/contrib/grep/lib/mbsinit.c @@ -1,5 +1,5 @@ /* Test for initial conversion state. - Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc. + Copyright (C) 2008-2011 Free Software Foundation, Inc. Written by Bruno Haible , 2008. This program is free software: you can redistribute it and/or modify @@ -22,6 +22,18 @@ #include "verify.h" +#if (defined _WIN32 || defined __WIN32__) && !defined __CYGWIN__ + +/* On native Windows, 'mbstate_t' is defined as 'int'. */ + +int +mbsinit (const mbstate_t *ps) +{ + return ps == NULL || *ps == 0; +} + +#else + /* Platforms that lack mbsinit() also lack mbrlen(), mbrtowc(), mbsrtowcs() and wcrtomb(), wcsrtombs(). We assume that @@ -43,5 +55,7 @@ mbsinit (const mbstate_t *ps) { const char *pstate = (const char *)ps; - return pstate[0] == 0; + return pstate == NULL || pstate[0] == 0; } + +#endif diff --git a/contrib/grep/lib/mbslen.c b/contrib/grep/lib/mbslen.c index 5ccede643a..efddd52454 100644 --- a/contrib/grep/lib/mbslen.c +++ b/contrib/grep/lib/mbslen.c @@ -1,5 +1,5 @@ /* Counting the multibyte characters in a string. - Copyright (C) 2007-2010 Free Software Foundation, Inc. + Copyright (C) 2007-2011 Free Software Foundation, Inc. Written by Bruno Haible , 2007. This program is free software: you can redistribute it and/or modify diff --git a/contrib/grep/lib/mbsrtowcs-state.c b/contrib/grep/lib/mbsrtowcs-state.c index 35045f6574..91073b5eb0 100644 --- a/contrib/grep/lib/mbsrtowcs-state.c +++ b/contrib/grep/lib/mbsrtowcs-state.c @@ -1,5 +1,5 @@ /* Convert string to wide string. - Copyright (C) 2008-2010 Free Software Foundation, Inc. + Copyright (C) 2008-2011 Free Software Foundation, Inc. Written by Bruno Haible , 2008. This program is free software: you can redistribute it and/or modify diff --git a/contrib/grep/lib/mbsrtowcs.c b/contrib/grep/lib/mbsrtowcs.c index c577f36f2a..69e6dfffb8 100644 --- a/contrib/grep/lib/mbsrtowcs.c +++ b/contrib/grep/lib/mbsrtowcs.c @@ -1,5 +1,5 @@ /* Convert string to wide string. - Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc. + Copyright (C) 2008-2011 Free Software Foundation, Inc. Written by Bruno Haible , 2008. This program is free software: you can redistribute it and/or modify @@ -29,108 +29,4 @@ extern mbstate_t _gl_mbsrtowcs_state; -size_t -mbsrtowcs (wchar_t *dest, const char **srcp, size_t len, mbstate_t *ps) -{ - if (ps == NULL) - ps = &_gl_mbsrtowcs_state; - { - const char *src = *srcp; - - if (dest != NULL) - { - wchar_t *destptr = dest; - - for (; len > 0; destptr++, len--) - { - size_t src_avail; - size_t ret; - - /* An optimized variant of - src_avail = strnlen1 (src, MB_LEN_MAX); */ - if (src[0] == '\0') - src_avail = 1; - else if (src[1] == '\0') - src_avail = 2; - else if (src[2] == '\0') - src_avail = 3; - else if (MB_LEN_MAX <= 4 || src[3] == '\0') - src_avail = 4; - else - src_avail = 4 + strnlen1 (src + 4, MB_LEN_MAX - 4); - - /* Parse the next multibyte character. */ - ret = mbrtowc (destptr, src, src_avail, ps); - - if (ret == (size_t)(-2)) - /* Encountered a multibyte character that extends past a '\0' byte - or that is longer than MB_LEN_MAX bytes. Cannot happen. */ - abort (); - - if (ret == (size_t)(-1)) - goto bad_input; - if (ret == 0) - { - src = NULL; - /* Here mbsinit (ps). */ - break; - } - src += ret; - } - - *srcp = src; - return destptr - dest; - } - else - { - /* Ignore dest and len, don't store *srcp at the end, and - don't clobber *ps. */ - mbstate_t state = *ps; - size_t totalcount = 0; - - for (;; totalcount++) - { - size_t src_avail; - size_t ret; - - /* An optimized variant of - src_avail = strnlen1 (src, MB_LEN_MAX); */ - if (src[0] == '\0') - src_avail = 1; - else if (src[1] == '\0') - src_avail = 2; - else if (src[2] == '\0') - src_avail = 3; - else if (MB_LEN_MAX <= 4 || src[3] == '\0') - src_avail = 4; - else - src_avail = 4 + strnlen1 (src + 4, MB_LEN_MAX - 4); - - /* Parse the next multibyte character. */ - ret = mbrtowc (NULL, src, src_avail, &state); - - if (ret == (size_t)(-2)) - /* Encountered a multibyte character that extends past a '\0' byte - or that is longer than MB_LEN_MAX bytes. Cannot happen. */ - abort (); - - if (ret == (size_t)(-1)) - goto bad_input2; - if (ret == 0) - { - /* Here mbsinit (&state). */ - break; - } - src += ret; - } - - return totalcount; - } - - bad_input: - *srcp = src; - bad_input2: - errno = EILSEQ; - return (size_t)(-1); - } -} +#include "mbsrtowcs-impl.h" diff --git a/contrib/grep/lib/mbsstr.c b/contrib/grep/lib/mbsstr.c index d44b4c3d4a..611000e6dd 100644 --- a/contrib/grep/lib/mbsstr.c +++ b/contrib/grep/lib/mbsstr.c @@ -1,5 +1,5 @@ /* Searching in a string. - Copyright (C) 2005-2010 Free Software Foundation, Inc. + Copyright (C) 2005-2011 Free Software Foundation, Inc. Written by Bruno Haible , 2005. This program is free software: you can redistribute it and/or modify @@ -27,6 +27,7 @@ #include "mbuiter.h" /* Knuth-Morris-Pratt algorithm. */ +#define UNIT unsigned char #define CANON_ELEMENT(c) c #include "str-kmp.h" @@ -339,10 +340,12 @@ mbsstr (const char *haystack, const char *needle) if (needle_last_ccount == NULL) { /* Try the Knuth-Morris-Pratt algorithm. */ - const char *result; + const unsigned char *result; bool success = - knuth_morris_pratt_unibyte (haystack, needle - 1, - &result); + knuth_morris_pratt ((const unsigned char *) haystack, + (const unsigned char *) (needle - 1), + strlen (needle - 1), + &result); if (success) return (char *) result; try_kmp = false; diff --git a/contrib/grep/lib/mbuiter.h b/contrib/grep/lib/mbuiter.h index 3015c4efe9..178f36eeaa 100644 --- a/contrib/grep/lib/mbuiter.h +++ b/contrib/grep/lib/mbuiter.h @@ -1,5 +1,5 @@ /* Iterating through multibyte strings: macros for multi-byte encodings. - Copyright (C) 2001, 2005, 2007, 2009, 2010 Free Software Foundation, Inc. + Copyright (C) 2001, 2005, 2007, 2009-2011 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/contrib/grep/lib/memchr.c b/contrib/grep/lib/memchr.c index 6c2b2d6c7d..6d903b1014 100644 --- a/contrib/grep/lib/memchr.c +++ b/contrib/grep/lib/memchr.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991, 1993, 1996-1997, 1999-2000, 2003-2004, 2006, 2008-2010 +/* Copyright (C) 1991, 1993, 1996-1997, 1999-2000, 2003-2004, 2006, 2008-2011 Free Software Foundation, Inc. Based on strlen implementation by Torbjorn Granlund (tege@sics.se), diff --git a/contrib/grep/lib/mempcpy.c b/contrib/grep/lib/mempcpy.c index c6031406a8..02ed566276 100644 --- a/contrib/grep/lib/mempcpy.c +++ b/contrib/grep/lib/mempcpy.c @@ -1,7 +1,7 @@ /* -*- buffer-read-only: t -*- vi: set ro: */ /* DO NOT EDIT! GENERATED AUTOMATICALLY! */ /* Copy memory area and return pointer after last written byte. - Copyright (C) 2003, 2007, 2009, 2010 Free Software Foundation, Inc. + Copyright (C) 2003, 2007, 2009-2011 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/contrib/grep/lib/minmax.h b/contrib/grep/lib/minmax.h index fb2722142a..cb2f327cc0 100644 --- a/contrib/grep/lib/minmax.h +++ b/contrib/grep/lib/minmax.h @@ -1,7 +1,7 @@ /* -*- buffer-read-only: t -*- vi: set ro: */ /* DO NOT EDIT! GENERATED AUTOMATICALLY! */ /* MIN, MAX macros. - Copyright (C) 1995, 1998, 2001, 2003, 2005, 2009, 2010 Free Software + Copyright (C) 1995, 1998, 2001, 2003, 2005, 2009-2011 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify diff --git a/contrib/grep/lib/nl_langinfo.c b/contrib/grep/lib/nl_langinfo.c index a3d0d11eb3..8406ff1912 100644 --- a/contrib/grep/lib/nl_langinfo.c +++ b/contrib/grep/lib/nl_langinfo.c @@ -1,6 +1,6 @@ /* nl_langinfo() replacement: query locale dependent information. - Copyright (C) 2007-2010 Free Software Foundation, Inc. + Copyright (C) 2007-2011 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -97,7 +97,7 @@ rpl_nl_langinfo (nl_item item) strings, appended in memory. */ return "\0\0\0\0\0\0\0\0\0\0"; # endif -# if GNULIB_defined_YESEXPR +# if GNULIB_defined_YESEXPR || !FUNC_NL_LANGINFO_YESEXPR_WORKS case YESEXPR: return "^[yY]"; case NOEXPR: diff --git a/contrib/grep/lib/obstack.c b/contrib/grep/lib/obstack.c index 7c71acdeaf..f31a2e999c 100644 --- a/contrib/grep/lib/obstack.c +++ b/contrib/grep/lib/obstack.c @@ -1,8 +1,6 @@ /* obstack.c - subroutines used implicitly by object stack macros - Copyright (C) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1996, 1997, 1998, - 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009, 2010 Free Software - Foundation, Inc. + Copyright (C) 1988-1994, 1996-2006, 2009-2011 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/contrib/grep/lib/obstack.h b/contrib/grep/lib/obstack.h index 2e4ad3c0af..8a8d44bc8e 100644 --- a/contrib/grep/lib/obstack.h +++ b/contrib/grep/lib/obstack.h @@ -1,5 +1,5 @@ /* obstack.h - object stack macros - Copyright (C) 1988-1994, 1996-1999, 2003-2006, 2009-2010 Free Software + Copyright (C) 1988-1994, 1996-1999, 2003-2006, 2009-2011 Free Software Foundation, Inc. This file is part of the GNU C Library. diff --git a/contrib/grep/lib/open.c b/contrib/grep/lib/open.c index 4e44936584..e60b619949 100644 --- a/contrib/grep/lib/open.c +++ b/contrib/grep/lib/open.c @@ -1,5 +1,5 @@ /* Open a descriptor to a file. - Copyright (C) 2007-2010 Free Software Foundation, Inc. + Copyright (C) 2007-2011 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -63,6 +63,15 @@ open (const char *filename, int flags, ...) va_end (arg); } +#if GNULIB_defined_O_NONBLOCK + /* The only known platform that lacks O_NONBLOCK is mingw, but it + also lacks named pipes and Unix sockets, which are the only two + file types that require non-blocking handling in open(). + Therefore, it is safe to ignore O_NONBLOCK here. It is handy + that mingw also lacks openat(), so that is also covered here. */ + flags &= ~O_NONBLOCK; +#endif + #if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ if (strcmp (filename, "/dev/null") == 0) filename = "NUL"; diff --git a/contrib/grep/lib/progname.c b/contrib/grep/lib/progname.c index 1415e6a55f..2465748175 100644 --- a/contrib/grep/lib/progname.c +++ b/contrib/grep/lib/progname.c @@ -1,5 +1,5 @@ /* Program name management. - Copyright (C) 2001-2003, 2005-2010 Free Software Foundation, Inc. + Copyright (C) 2001-2003, 2005-2011 Free Software Foundation, Inc. Written by Bruno Haible , 2001. This program is free software: you can redistribute it and/or modify diff --git a/contrib/grep/lib/progname.h b/contrib/grep/lib/progname.h index 5ba303bd07..084406607d 100644 --- a/contrib/grep/lib/progname.h +++ b/contrib/grep/lib/progname.h @@ -1,5 +1,5 @@ /* Program name management. - Copyright (C) 2001-2004, 2006, 2009-2010 Free Software Foundation, Inc. + Copyright (C) 2001-2004, 2006, 2009-2011 Free Software Foundation, Inc. Written by Bruno Haible , 2001. This program is free software: you can redistribute it and/or modify diff --git a/contrib/grep/lib/propername.c b/contrib/grep/lib/propername.c index 3971f3f7a5..b74923de95 100644 --- a/contrib/grep/lib/propername.c +++ b/contrib/grep/lib/propername.c @@ -1,5 +1,5 @@ /* Localization of proper names. - Copyright (C) 2006-2010 Free Software Foundation, Inc. + Copyright (C) 2006-2011 Free Software Foundation, Inc. Written by Bruno Haible , 2006. This program is free software: you can redistribute it and/or modify @@ -198,7 +198,8 @@ proper_name_utf8 (const char *name_ascii, const char *name_utf8) name_converted = alloc_name_converted = xstr_iconv (name_utf8, "UTF-8", locale_code); -# if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2) || __GLIBC__ > 2 \ +# if (((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2) || __GLIBC__ > 2) \ + && !defined __UCLIBC__) \ || _LIBICONV_VERSION >= 0x0105 { char *converted_translit; diff --git a/contrib/grep/lib/propername.h b/contrib/grep/lib/propername.h index eba56f696a..d2a1e3bf0d 100644 --- a/contrib/grep/lib/propername.h +++ b/contrib/grep/lib/propername.h @@ -1,5 +1,5 @@ /* Localization of proper names. - Copyright (C) 2006, 2008, 2009, 2010 Free Software Foundation, Inc. + Copyright (C) 2006, 2008-2011 Free Software Foundation, Inc. Written by Bruno Haible , 2006. This program is free software: you can redistribute it and/or modify diff --git a/contrib/grep/lib/quote.c b/contrib/grep/lib/quote.c index 1f64f44c38..1989c8c350 100644 --- a/contrib/grep/lib/quote.c +++ b/contrib/grep/lib/quote.c @@ -1,7 +1,7 @@ /* quote.c - quote arguments for output - Copyright (C) 1998, 1999, 2000, 2001, 2003, 2005, 2006, 2009, 2010 Free - Software Foundation, Inc. + Copyright (C) 1998-2001, 2003, 2005-2006, 2009-2011 Free Software + Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/contrib/grep/lib/quote.h b/contrib/grep/lib/quote.h index a986956ab1..d0acb51f02 100644 --- a/contrib/grep/lib/quote.h +++ b/contrib/grep/lib/quote.h @@ -1,7 +1,6 @@ /* quote.h - prototypes for quote.c - Copyright (C) 1998, 1999, 2000, 2001, 2003, 2009, 2010 Free Software - Foundation, Inc. + Copyright (C) 1998-2001, 2003, 2009-2011 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/contrib/grep/lib/quotearg.c b/contrib/grep/lib/quotearg.c index 5418f512bc..da8ba1eac6 100644 --- a/contrib/grep/lib/quotearg.c +++ b/contrib/grep/lib/quotearg.c @@ -1,7 +1,6 @@ /* quotearg.c - quote arguments for output - Copyright (C) 1998, 1999, 2000, 2001, 2002, 2004, 2005, 2006, 2007, 2008, - 2009, 2010 Free Software Foundation, Inc. + Copyright (C) 1998-2002, 2004-2011 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -169,10 +168,10 @@ set_custom_quoting (struct quoting_options *o, static struct quoting_options quoting_options_from_style (enum quoting_style style) { - struct quoting_options o; + struct quoting_options o = { 0 }; + if (style == custom_quoting_style) + abort (); o.style = style; - o.flags = 0; - memset (o.quote_these_too, 0, sizeof o.quote_these_too); return o; } diff --git a/contrib/grep/lib/quotearg.h b/contrib/grep/lib/quotearg.h index 084cd1b2de..2756d760aa 100644 --- a/contrib/grep/lib/quotearg.h +++ b/contrib/grep/lib/quotearg.h @@ -1,7 +1,7 @@ /* quotearg.h - quote arguments for output - Copyright (C) 1998, 1999, 2000, 2001, 2002, 2004, 2006, 2008, 2009, 2010 - Free Software Foundation, Inc. + Copyright (C) 1998-2002, 2004, 2006, 2008-2011 Free Software Foundation, + Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/contrib/grep/lib/realloc.c b/contrib/grep/lib/realloc.c index 053208f375..0c96ffacba 100644 --- a/contrib/grep/lib/realloc.c +++ b/contrib/grep/lib/realloc.c @@ -1,6 +1,6 @@ /* realloc() function that is glibc compatible. - Copyright (C) 1997, 2003-2004, 2006-2007, 2009-2010 Free Software + Copyright (C) 1997, 2003-2004, 2006-2007, 2009-2011 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify @@ -18,6 +18,7 @@ /* written by Jim Meyering and Bruno Haible */ +#define _GL_USE_STDLIB_ALLOC 1 #include /* Only the AC_FUNC_REALLOC macro defines 'realloc' already in config.h. */ @@ -34,23 +35,10 @@ # define SYSTEM_MALLOC_GLIBC_COMPATIBLE 1 #endif -/* Below we want to call the system's malloc and realloc. - Undefine the symbols here so that including provides a - declaration of malloc(), not of rpl_malloc(), and likewise for realloc. */ -#undef malloc -#undef realloc - -/* Specification. */ #include #include -/* Below we want to call the system's malloc and realloc. - Undefine the symbols, if they were defined by gnulib's - replacement. */ -#undef malloc -#undef realloc - /* Change the size of an allocated block of memory P to N bytes, with error checking. If N is zero, change it to 1. If P is NULL, use malloc. */ diff --git a/contrib/grep/lib/ref-add.sin b/contrib/grep/lib/ref-add.sin index dbb61df3dc..a57eaef607 100644 --- a/contrib/grep/lib/ref-add.sin +++ b/contrib/grep/lib/ref-add.sin @@ -1,6 +1,6 @@ # Add this package to a list of references stored in a text file. # -# Copyright (C) 2000, 2009, 2010 Free Software Foundation, Inc. +# Copyright (C) 2000, 2009-2011 Free Software Foundation, Inc. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/contrib/grep/lib/ref-del.sin b/contrib/grep/lib/ref-del.sin index 4c31a6eafd..e23097db33 100644 --- a/contrib/grep/lib/ref-del.sin +++ b/contrib/grep/lib/ref-del.sin @@ -1,6 +1,6 @@ # Remove this package from a list of references stored in a text file. # -# Copyright (C) 2000, 2009, 2010 Free Software Foundation, Inc. +# Copyright (C) 2000, 2009-2011 Free Software Foundation, Inc. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/contrib/grep/lib/regcomp.c b/contrib/grep/lib/regcomp.c index 5b19124b55..e734f47f6a 100644 --- a/contrib/grep/lib/regcomp.c +++ b/contrib/grep/lib/regcomp.c @@ -1,8 +1,7 @@ /* -*- buffer-read-only: t -*- vi: set ro: */ /* DO NOT EDIT! GENERATED AUTOMATICALLY! */ /* Extended regular expression matching and search library. - Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free - Software Foundation, Inc. + Copyright (C) 2002-2011 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Isamu Hasegawa . diff --git a/contrib/grep/lib/regex.c b/contrib/grep/lib/regex.c index 5415c8f1c5..fc46c0ba2d 100644 --- a/contrib/grep/lib/regex.c +++ b/contrib/grep/lib/regex.c @@ -1,8 +1,7 @@ /* -*- buffer-read-only: t -*- vi: set ro: */ /* DO NOT EDIT! GENERATED AUTOMATICALLY! */ /* Extended regular expression matching and search library. - Copyright (C) 2002, 2003, 2005, 2006, 2009, 2010 Free Software Foundation, - Inc. + Copyright (C) 2002-2003, 2005-2006, 2009-2011 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Isamu Hasegawa . diff --git a/contrib/grep/lib/regex.h b/contrib/grep/lib/regex.h index 14ba6d27e3..52b8598c5c 100644 --- a/contrib/grep/lib/regex.h +++ b/contrib/grep/lib/regex.h @@ -2,9 +2,8 @@ /* DO NOT EDIT! GENERATED AUTOMATICALLY! */ /* Definitions for data structures and routines for the regular expression library. - Copyright (C) 1985, 1989, 1990, 1991, 1992, 1993, 1995, 1996, 1997, 1998, - 2000, 2001, 2002, 2003, 2005, 2006, 2009, 2010 Free Software Foundation, - Inc. + Copyright (C) 1985, 1989-1993, 1995-1998, 2000-2003, 2005-2006, 2009-2011 + Free Software Foundation, Inc. This file is part of the GNU C Library. This program is free software; you can redistribute it and/or modify diff --git a/contrib/grep/lib/regex_internal.c b/contrib/grep/lib/regex_internal.c index dc7d4774c6..dcfb0df67d 100644 --- a/contrib/grep/lib/regex_internal.c +++ b/contrib/grep/lib/regex_internal.c @@ -1,8 +1,7 @@ /* -*- buffer-read-only: t -*- vi: set ro: */ /* DO NOT EDIT! GENERATED AUTOMATICALLY! */ /* Extended regular expression matching and search library. - Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free - Software Foundation, Inc. + Copyright (C) 2002-2011 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Isamu Hasegawa . diff --git a/contrib/grep/lib/regex_internal.h b/contrib/grep/lib/regex_internal.h index 4470a3cb98..7ad6ee5da2 100644 --- a/contrib/grep/lib/regex_internal.h +++ b/contrib/grep/lib/regex_internal.h @@ -1,8 +1,7 @@ /* -*- buffer-read-only: t -*- vi: set ro: */ /* DO NOT EDIT! GENERATED AUTOMATICALLY! */ /* Extended regular expression matching and search library. - Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free - Software Foundation, Inc. + Copyright (C) 2002-2011 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Isamu Hasegawa . @@ -34,9 +33,7 @@ #ifndef _LIBC # include "localcharset.h" #endif -#if defined HAVE_LOCALE_H || defined _LIBC -# include -#endif +#include #include #include @@ -86,7 +83,7 @@ # define SIZE_MAX ((size_t) -1) #endif -#if (defined MB_CUR_MAX && HAVE_LOCALE_H && HAVE_WCTYPE_H && HAVE_ISWCTYPE && HAVE_WCSCOLL) || _LIBC +#if (defined MB_CUR_MAX && HAVE_WCTYPE_H && HAVE_ISWCTYPE && HAVE_WCSCOLL) || _LIBC # define RE_ENABLE_I18N #endif diff --git a/contrib/grep/lib/regexec.c b/contrib/grep/lib/regexec.c index 4e488cd4a3..ac67aebe98 100644 --- a/contrib/grep/lib/regexec.c +++ b/contrib/grep/lib/regexec.c @@ -1,8 +1,7 @@ /* -*- buffer-read-only: t -*- vi: set ro: */ /* DO NOT EDIT! GENERATED AUTOMATICALLY! */ /* Extended regular expression matching and search library. - Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free - Software Foundation, Inc. + Copyright (C) 2002-2011 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Isamu Hasegawa . @@ -3412,6 +3411,8 @@ build_trtable (const re_dfa_t *dfa, re_dfastate_t *state) { state->trtable = (re_dfastate_t **) calloc (sizeof (re_dfastate_t *), SBC_MAX); + if (BE (state->trtable == NULL, 0)) + return false; return true; } return false; diff --git a/contrib/grep/lib/savedir.c b/contrib/grep/lib/savedir.c index 2d17f3f2c2..0299a9164e 100644 --- a/contrib/grep/lib/savedir.c +++ b/contrib/grep/lib/savedir.c @@ -1,5 +1,5 @@ /* savedir.c -- save the list of files in a directory in a string - Copyright (C) 1990, 1997-2001, 2009-2010 Free Software Foundation, Inc. + Copyright (C) 1990, 1997-2001, 2009-2011 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -22,7 +22,6 @@ #include #include #include -#include #ifdef CLOSEDIR_VOID /* Fake a return value. */ diff --git a/contrib/grep/lib/stat.c b/contrib/grep/lib/stat.c index 875317bf52..cbc9100fd4 100644 --- a/contrib/grep/lib/stat.c +++ b/contrib/grep/lib/stat.c @@ -1,5 +1,5 @@ /* Work around platform bugs in stat. - Copyright (C) 2009, 2010 Free Software Foundation, Inc. + Copyright (C) 2009-2011 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -37,6 +37,7 @@ orig_stat (const char *filename, struct stat *buf) #include #include #include +#include "dosname.h" /* Store information about NAME into ST. Work around bugs with trailing slashes. Mingw has other bugs (such as st_ino always diff --git a/contrib/grep/lib/stpcpy.c b/contrib/grep/lib/stpcpy.c index 196461f989..fa42af4a4d 100644 --- a/contrib/grep/lib/stpcpy.c +++ b/contrib/grep/lib/stpcpy.c @@ -1,5 +1,5 @@ /* stpcpy.c -- copy a string and return pointer to end of new string - Copyright (C) 1992, 1995, 1997-1998, 2006, 2009-2010 Free Software + Copyright (C) 1992, 1995, 1997-1998, 2006, 2009-2011 Free Software Foundation, Inc. NOTE: The canonical source of this file is maintained with the GNU C Library. diff --git a/contrib/grep/lib/str-kmp.h b/contrib/grep/lib/str-kmp.h index 4988171c5d..df48a2ccc0 100644 --- a/contrib/grep/lib/str-kmp.h +++ b/contrib/grep/lib/str-kmp.h @@ -1,8 +1,8 @@ /* -*- buffer-read-only: t -*- vi: set ro: */ /* DO NOT EDIT! GENERATED AUTOMATICALLY! */ -/* Substring search in a NUL terminated string of 'char' elements, +/* Substring search in a NUL terminated string of UNIT elements, using the Knuth-Morris-Pratt algorithm. - Copyright (C) 2005-2010 Free Software Foundation, Inc. + Copyright (C) 2005-2011 Free Software Foundation, Inc. Written by Bruno Haible , 2005. This program is free software; you can redistribute it and/or modify @@ -20,21 +20,26 @@ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ /* Before including this file, you need to define: + UNIT The element type of the needle and haystack. CANON_ELEMENT(c) A macro that canonicalizes an element right after - it has been fetched from one of the two strings. - The argument is an 'unsigned char'; the result - must be an 'unsigned char' as well. */ + it has been fetched from needle or haystack. + The argument is of type UNIT; the result must be + of type UNIT as well. */ /* Knuth-Morris-Pratt algorithm. See http://en.wikipedia.org/wiki/Knuth-Morris-Pratt_algorithm + HAYSTACK is the NUL terminated string in which to search for. + NEEDLE is the string to search for in HAYSTACK, consisting of NEEDLE_LEN + units. Return a boolean indicating success: Return true and set *RESULTP if the search was completed. Return false if it was aborted because not enough memory was available. */ static bool -knuth_morris_pratt_unibyte (const char *haystack, const char *needle, - const char **resultp) +knuth_morris_pratt (const UNIT *haystack, + const UNIT *needle, size_t needle_len, + const UNIT **resultp) { - size_t m = strlen (needle); + size_t m = needle_len; /* Allocate the table. */ size_t *table = (size_t *) nmalloca (m, sizeof (size_t)); @@ -68,14 +73,14 @@ knuth_morris_pratt_unibyte (const char *haystack, const char *needle, The inequality needle[x..i-1] != needle[0..i-1-x] is known to hold for x < table[i-1], by induction. Furthermore, if j>0: needle[i-1-j..i-2] = needle[0..j-1]. */ - unsigned char b = CANON_ELEMENT ((unsigned char) needle[i - 1]); + UNIT b = CANON_ELEMENT (needle[i - 1]); for (;;) { /* Invariants: The inequality needle[x..i-1] != needle[0..i-1-x] is known to hold for x < i-1-j. Furthermore, if j>0: needle[i-1-j..i-2] = needle[0..j-1]. */ - if (b == CANON_ELEMENT ((unsigned char) needle[j])) + if (b == CANON_ELEMENT (needle[j])) { /* Set table[i] := i-1-j. */ table[i] = i - ++j; @@ -110,17 +115,16 @@ knuth_morris_pratt_unibyte (const char *haystack, const char *needle, /* Search, using the table to accelerate the processing. */ { size_t j; - const char *rhaystack; - const char *phaystack; + const UNIT *rhaystack; + const UNIT *phaystack; *resultp = NULL; j = 0; rhaystack = haystack; phaystack = haystack; /* Invariant: phaystack = rhaystack + j. */ - while (*phaystack != '\0') - if (CANON_ELEMENT ((unsigned char) needle[j]) - == CANON_ELEMENT ((unsigned char) *phaystack)) + while (*phaystack != 0) + if (CANON_ELEMENT (needle[j]) == CANON_ELEMENT (*phaystack)) { j++; phaystack++; diff --git a/contrib/grep/lib/streq.h b/contrib/grep/lib/streq.h index 97ebcbe0e9..067732dd69 100644 --- a/contrib/grep/lib/streq.h +++ b/contrib/grep/lib/streq.h @@ -1,7 +1,7 @@ /* -*- buffer-read-only: t -*- vi: set ro: */ /* DO NOT EDIT! GENERATED AUTOMATICALLY! */ /* Optimized string comparison. - Copyright (C) 2001-2002, 2007, 2009-2010 Free Software Foundation, Inc. + Copyright (C) 2001-2002, 2007, 2009-2011 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published @@ -11,7 +11,7 @@ This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. + General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ diff --git a/contrib/grep/lib/strerror.c b/contrib/grep/lib/strerror-override.c similarity index 67% copy from contrib/grep/lib/strerror.c copy to contrib/grep/lib/strerror-override.c index 46153abf5f..c2ca764eb4 100644 --- a/contrib/grep/lib/strerror.c +++ b/contrib/grep/lib/strerror-override.c @@ -1,6 +1,6 @@ -/* strerror.c --- POSIX compatible system error routine +/* strerror-override.c --- POSIX compatible system error routine - Copyright (C) 2007-2010 Free Software Foundation, Inc. + Copyright (C) 2010-2011 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -15,37 +15,42 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ -#include - -#include - -#if REPLACE_STRERROR +/* Written by Bruno Haible , 2010. */ -# include -# include - -# if GNULIB_defined_ESOCK /* native Windows platforms */ -# if HAVE_WINSOCK2_H -# include -# endif -# endif +#include -# include "intprops.h" +#include "strerror-override.h" -/* Use the system functions, not the gnulib overrides in this file. */ -# undef sprintf +#include -# undef strerror -# if ! HAVE_DECL_STRERROR -# define strerror(n) NULL +#if GNULIB_defined_ESOCK /* native Windows platforms */ +# if HAVE_WINSOCK2_H +# include # endif +#endif -char * -rpl_strerror (int n) +/* If ERRNUM maps to an errno value defined by gnulib, return a string + describing the error. Otherwise return NULL. */ +const char * +strerror_override (int errnum) { - char const *msg = NULL; + const char *msg = NULL; + +#if GNULIB_defined_ETXTBSY \ + || GNULIB_defined_ESOCK \ + || GNULIB_defined_ENOMSG \ + || GNULIB_defined_EIDRM \ + || GNULIB_defined_ENOLINK \ + || GNULIB_defined_EPROTO \ + || GNULIB_defined_EMULTIHOP \ + || GNULIB_defined_EBADMSG \ + || GNULIB_defined_EOVERFLOW \ + || GNULIB_defined_ENOTSUP \ + || GNULIB_defined_ESTALE \ + || GNULIB_defined_EDQUOT \ + || GNULIB_defined_ECANCELED /* These error messages are taken from glibc/sysdeps/gnu/errlist.c. */ - switch (n) + switch (errnum) { # if GNULIB_defined_ETXTBSY case ETXTBSY: @@ -54,7 +59,7 @@ rpl_strerror (int n) # endif # if GNULIB_defined_ESOCK /* native Windows platforms */ - /* EWOULDBLOCK is the same as EAGAIN. */ + /* EWOULDBLOCK is the same as EAGAIN. */ case EINPROGRESS: msg = "Operation now in progress"; break; @@ -158,9 +163,9 @@ rpl_strerror (int n) msg = "Object is remote"; break; # if HAVE_WINSOCK2_H - /* WSA_INVALID_HANDLE maps to EBADF */ - /* WSA_NOT_ENOUGH_MEMORY maps to ENOMEM */ - /* WSA_INVALID_PARAMETER maps to EINVAL */ + /* WSA_INVALID_HANDLE maps to EBADF */ + /* WSA_NOT_ENOUGH_MEMORY maps to ENOMEM */ + /* WSA_INVALID_PARAMETER maps to EINVAL */ case WSA_OPERATION_ABORTED: msg = "Overlapped operation aborted"; break; @@ -170,49 +175,49 @@ rpl_strerror (int n) case WSA_IO_PENDING: msg = "Overlapped operations will complete later"; break; - /* WSAEINTR maps to EINTR */ - /* WSAEBADF maps to EBADF */ - /* WSAEACCES maps to EACCES */ - /* WSAEFAULT maps to EFAULT */ - /* WSAEINVAL maps to EINVAL */ - /* WSAEMFILE maps to EMFILE */ - /* WSAEWOULDBLOCK maps to EWOULDBLOCK */ - /* WSAEINPROGRESS is EINPROGRESS */ - /* WSAEALREADY is EALREADY */ - /* WSAENOTSOCK is ENOTSOCK */ - /* WSAEDESTADDRREQ is EDESTADDRREQ */ - /* WSAEMSGSIZE is EMSGSIZE */ - /* WSAEPROTOTYPE is EPROTOTYPE */ - /* WSAENOPROTOOPT is ENOPROTOOPT */ - /* WSAEPROTONOSUPPORT is EPROTONOSUPPORT */ - /* WSAESOCKTNOSUPPORT is ESOCKTNOSUPPORT */ - /* WSAEOPNOTSUPP is EOPNOTSUPP */ - /* WSAEPFNOSUPPORT is EPFNOSUPPORT */ - /* WSAEAFNOSUPPORT is EAFNOSUPPORT */ - /* WSAEADDRINUSE is EADDRINUSE */ - /* WSAEADDRNOTAVAIL is EADDRNOTAVAIL */ - /* WSAENETDOWN is ENETDOWN */ - /* WSAENETUNREACH is ENETUNREACH */ - /* WSAENETRESET is ENETRESET */ - /* WSAECONNABORTED is ECONNABORTED */ - /* WSAECONNRESET is ECONNRESET */ - /* WSAENOBUFS is ENOBUFS */ - /* WSAEISCONN is EISCONN */ - /* WSAENOTCONN is ENOTCONN */ - /* WSAESHUTDOWN is ESHUTDOWN */ - /* WSAETOOMANYREFS is ETOOMANYREFS */ - /* WSAETIMEDOUT is ETIMEDOUT */ - /* WSAECONNREFUSED is ECONNREFUSED */ - /* WSAELOOP is ELOOP */ - /* WSAENAMETOOLONG maps to ENAMETOOLONG */ - /* WSAEHOSTDOWN is EHOSTDOWN */ - /* WSAEHOSTUNREACH is EHOSTUNREACH */ - /* WSAENOTEMPTY maps to ENOTEMPTY */ - /* WSAEPROCLIM is EPROCLIM */ - /* WSAEUSERS is EUSERS */ - /* WSAEDQUOT is EDQUOT */ - /* WSAESTALE is ESTALE */ - /* WSAEREMOTE is EREMOTE */ + /* WSAEINTR maps to EINTR */ + /* WSAEBADF maps to EBADF */ + /* WSAEACCES maps to EACCES */ + /* WSAEFAULT maps to EFAULT */ + /* WSAEINVAL maps to EINVAL */ + /* WSAEMFILE maps to EMFILE */ + /* WSAEWOULDBLOCK maps to EWOULDBLOCK */ + /* WSAEINPROGRESS is EINPROGRESS */ + /* WSAEALREADY is EALREADY */ + /* WSAENOTSOCK is ENOTSOCK */ + /* WSAEDESTADDRREQ is EDESTADDRREQ */ + /* WSAEMSGSIZE is EMSGSIZE */ + /* WSAEPROTOTYPE is EPROTOTYPE */ + /* WSAENOPROTOOPT is ENOPROTOOPT */ + /* WSAEPROTONOSUPPORT is EPROTONOSUPPORT */ + /* WSAESOCKTNOSUPPORT is ESOCKTNOSUPPORT */ + /* WSAEOPNOTSUPP is EOPNOTSUPP */ + /* WSAEPFNOSUPPORT is EPFNOSUPPORT */ + /* WSAEAFNOSUPPORT is EAFNOSUPPORT */ + /* WSAEADDRINUSE is EADDRINUSE */ + /* WSAEADDRNOTAVAIL is EADDRNOTAVAIL */ + /* WSAENETDOWN is ENETDOWN */ + /* WSAENETUNREACH is ENETUNREACH */ + /* WSAENETRESET is ENETRESET */ + /* WSAECONNABORTED is ECONNABORTED */ + /* WSAECONNRESET is ECONNRESET */ + /* WSAENOBUFS is ENOBUFS */ + /* WSAEISCONN is EISCONN */ + /* WSAENOTCONN is ENOTCONN */ + /* WSAESHUTDOWN is ESHUTDOWN */ + /* WSAETOOMANYREFS is ETOOMANYREFS */ + /* WSAETIMEDOUT is ETIMEDOUT */ + /* WSAECONNREFUSED is ECONNREFUSED */ + /* WSAELOOP is ELOOP */ + /* WSAENAMETOOLONG maps to ENAMETOOLONG */ + /* WSAEHOSTDOWN is EHOSTDOWN */ + /* WSAEHOSTUNREACH is EHOSTUNREACH */ + /* WSAENOTEMPTY maps to ENOTEMPTY */ + /* WSAEPROCLIM is EPROCLIM */ + /* WSAEUSERS is EUSERS */ + /* WSAEDQUOT is EDQUOT */ + /* WSAESTALE is ESTALE */ + /* WSAEREMOTE is EREMOTE */ case WSASYSNOTREADY: msg = "Network subsystem is unavailable"; break; @@ -264,7 +269,7 @@ rpl_strerror (int n) case WSANO_DATA: msg = "Valid name, no data record of requested type"; break; - /* WSA_QOS_* omitted */ + /* WSA_QOS_* omitted */ # endif # endif @@ -322,29 +327,19 @@ rpl_strerror (int n) break; # endif +# if GNULIB_defined_EDQUOT + case EDQUOT: + msg = "Disk quota exceeded"; + break; +# endif + # if GNULIB_defined_ECANCELED case ECANCELED: msg = "Operation canceled"; break; # endif } +#endif - if (msg) - return (char *) msg; - - { - char *result = strerror (n); - - if (result == NULL || result[0] == '\0') - { - static char const fmt[] = "Unknown error (%d)"; - static char msg_buf[sizeof fmt + INT_STRLEN_BOUND (n)]; - sprintf (msg_buf, fmt, n); - return msg_buf; - } - - return result; - } + return msg; } - -#endif diff --git a/contrib/grep/lib/strerror-override.h b/contrib/grep/lib/strerror-override.h new file mode 100644 index 0000000000..b8ef854847 --- /dev/null +++ b/contrib/grep/lib/strerror-override.h @@ -0,0 +1,49 @@ +/* strerror-override.h --- POSIX compatible system error routine + + Copyright (C) 2010-2011 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +#ifndef _GL_STRERROR_OVERRIDE_H +# define _GL_STRERROR_OVERRIDE_H + +# include +# include + +/* Reasonable buffer size that should never trigger ERANGE; if this + proves too small, we intentionally abort(), to remind us to fix + this value. */ +# define STACKBUF_LEN 256 + +/* If ERRNUM maps to an errno value defined by gnulib, return a string + describing the error. Otherwise return NULL. */ +# if GNULIB_defined_ETXTBSY \ + || GNULIB_defined_ESOCK \ + || GNULIB_defined_ENOMSG \ + || GNULIB_defined_EIDRM \ + || GNULIB_defined_ENOLINK \ + || GNULIB_defined_EPROTO \ + || GNULIB_defined_EMULTIHOP \ + || GNULIB_defined_EBADMSG \ + || GNULIB_defined_EOVERFLOW \ + || GNULIB_defined_ENOTSUP \ + || GNULIB_defined_ESTALE \ + || GNULIB_defined_EDQUOT \ + || GNULIB_defined_ECANCELED +extern const char *strerror_override (int errnum); +# else +# define strerror_override(ignored) NULL +# endif + +#endif /* _GL_STRERROR_OVERRIDE_H */ diff --git a/contrib/grep/lib/strerror.c b/contrib/grep/lib/strerror.c index 46153abf5f..d0dd1af984 100644 --- a/contrib/grep/lib/strerror.c +++ b/contrib/grep/lib/strerror.c @@ -1,6 +1,6 @@ /* strerror.c --- POSIX compatible system error routine - Copyright (C) 2007-2010 Free Software Foundation, Inc. + Copyright (C) 2007-2011 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -17,334 +17,67 @@ #include +/* Specification. */ #include -#if REPLACE_STRERROR - -# include -# include - -# if GNULIB_defined_ESOCK /* native Windows platforms */ -# if HAVE_WINSOCK2_H -# include -# endif -# endif +#include +#include +#include +#include -# include "intprops.h" +#include "intprops.h" +#include "strerror-override.h" +#include "verify.h" /* Use the system functions, not the gnulib overrides in this file. */ -# undef sprintf - -# undef strerror -# if ! HAVE_DECL_STRERROR -# define strerror(n) NULL -# endif +#undef sprintf char * -rpl_strerror (int n) +strerror (int n) +#undef strerror { - char const *msg = NULL; - /* These error messages are taken from glibc/sysdeps/gnu/errlist.c. */ - switch (n) - { -# if GNULIB_defined_ETXTBSY - case ETXTBSY: - msg = "Text file busy"; - break; -# endif - -# if GNULIB_defined_ESOCK /* native Windows platforms */ - /* EWOULDBLOCK is the same as EAGAIN. */ - case EINPROGRESS: - msg = "Operation now in progress"; - break; - case EALREADY: - msg = "Operation already in progress"; - break; - case ENOTSOCK: - msg = "Socket operation on non-socket"; - break; - case EDESTADDRREQ: - msg = "Destination address required"; - break; - case EMSGSIZE: - msg = "Message too long"; - break; - case EPROTOTYPE: - msg = "Protocol wrong type for socket"; - break; - case ENOPROTOOPT: - msg = "Protocol not available"; - break; - case EPROTONOSUPPORT: - msg = "Protocol not supported"; - break; - case ESOCKTNOSUPPORT: - msg = "Socket type not supported"; - break; - case EOPNOTSUPP: - msg = "Operation not supported"; - break; - case EPFNOSUPPORT: - msg = "Protocol family not supported"; - break; - case EAFNOSUPPORT: - msg = "Address family not supported by protocol"; - break; - case EADDRINUSE: - msg = "Address already in use"; - break; - case EADDRNOTAVAIL: - msg = "Cannot assign requested address"; - break; - case ENETDOWN: - msg = "Network is down"; - break; - case ENETUNREACH: - msg = "Network is unreachable"; - break; - case ENETRESET: - msg = "Network dropped connection on reset"; - break; - case ECONNABORTED: - msg = "Software caused connection abort"; - break; - case ECONNRESET: - msg = "Connection reset by peer"; - break; - case ENOBUFS: - msg = "No buffer space available"; - break; - case EISCONN: - msg = "Transport endpoint is already connected"; - break; - case ENOTCONN: - msg = "Transport endpoint is not connected"; - break; - case ESHUTDOWN: - msg = "Cannot send after transport endpoint shutdown"; - break; - case ETOOMANYREFS: - msg = "Too many references: cannot splice"; - break; - case ETIMEDOUT: - msg = "Connection timed out"; - break; - case ECONNREFUSED: - msg = "Connection refused"; - break; - case ELOOP: - msg = "Too many levels of symbolic links"; - break; - case EHOSTDOWN: - msg = "Host is down"; - break; - case EHOSTUNREACH: - msg = "No route to host"; - break; - case EPROCLIM: - msg = "Too many processes"; - break; - case EUSERS: - msg = "Too many users"; - break; - case EDQUOT: - msg = "Disk quota exceeded"; - break; - case ESTALE: - msg = "Stale NFS file handle"; - break; - case EREMOTE: - msg = "Object is remote"; - break; -# if HAVE_WINSOCK2_H - /* WSA_INVALID_HANDLE maps to EBADF */ - /* WSA_NOT_ENOUGH_MEMORY maps to ENOMEM */ - /* WSA_INVALID_PARAMETER maps to EINVAL */ - case WSA_OPERATION_ABORTED: - msg = "Overlapped operation aborted"; - break; - case WSA_IO_INCOMPLETE: - msg = "Overlapped I/O event object not in signaled state"; - break; - case WSA_IO_PENDING: - msg = "Overlapped operations will complete later"; - break; - /* WSAEINTR maps to EINTR */ - /* WSAEBADF maps to EBADF */ - /* WSAEACCES maps to EACCES */ - /* WSAEFAULT maps to EFAULT */ - /* WSAEINVAL maps to EINVAL */ - /* WSAEMFILE maps to EMFILE */ - /* WSAEWOULDBLOCK maps to EWOULDBLOCK */ - /* WSAEINPROGRESS is EINPROGRESS */ - /* WSAEALREADY is EALREADY */ - /* WSAENOTSOCK is ENOTSOCK */ - /* WSAEDESTADDRREQ is EDESTADDRREQ */ - /* WSAEMSGSIZE is EMSGSIZE */ - /* WSAEPROTOTYPE is EPROTOTYPE */ - /* WSAENOPROTOOPT is ENOPROTOOPT */ - /* WSAEPROTONOSUPPORT is EPROTONOSUPPORT */ - /* WSAESOCKTNOSUPPORT is ESOCKTNOSUPPORT */ - /* WSAEOPNOTSUPP is EOPNOTSUPP */ - /* WSAEPFNOSUPPORT is EPFNOSUPPORT */ - /* WSAEAFNOSUPPORT is EAFNOSUPPORT */ - /* WSAEADDRINUSE is EADDRINUSE */ - /* WSAEADDRNOTAVAIL is EADDRNOTAVAIL */ - /* WSAENETDOWN is ENETDOWN */ - /* WSAENETUNREACH is ENETUNREACH */ - /* WSAENETRESET is ENETRESET */ - /* WSAECONNABORTED is ECONNABORTED */ - /* WSAECONNRESET is ECONNRESET */ - /* WSAENOBUFS is ENOBUFS */ - /* WSAEISCONN is EISCONN */ - /* WSAENOTCONN is ENOTCONN */ - /* WSAESHUTDOWN is ESHUTDOWN */ - /* WSAETOOMANYREFS is ETOOMANYREFS */ - /* WSAETIMEDOUT is ETIMEDOUT */ - /* WSAECONNREFUSED is ECONNREFUSED */ - /* WSAELOOP is ELOOP */ - /* WSAENAMETOOLONG maps to ENAMETOOLONG */ - /* WSAEHOSTDOWN is EHOSTDOWN */ - /* WSAEHOSTUNREACH is EHOSTUNREACH */ - /* WSAENOTEMPTY maps to ENOTEMPTY */ - /* WSAEPROCLIM is EPROCLIM */ - /* WSAEUSERS is EUSERS */ - /* WSAEDQUOT is EDQUOT */ - /* WSAESTALE is ESTALE */ - /* WSAEREMOTE is EREMOTE */ - case WSASYSNOTREADY: - msg = "Network subsystem is unavailable"; - break; - case WSAVERNOTSUPPORTED: - msg = "Winsock.dll version out of range"; - break; - case WSANOTINITIALISED: - msg = "Successful WSAStartup not yet performed"; - break; - case WSAEDISCON: - msg = "Graceful shutdown in progress"; - break; - case WSAENOMORE: case WSA_E_NO_MORE: - msg = "No more results"; - break; - case WSAECANCELLED: case WSA_E_CANCELLED: - msg = "Call was canceled"; - break; - case WSAEINVALIDPROCTABLE: - msg = "Procedure call table is invalid"; - break; - case WSAEINVALIDPROVIDER: - msg = "Service provider is invalid"; - break; - case WSAEPROVIDERFAILEDINIT: - msg = "Service provider failed to initialize"; - break; - case WSASYSCALLFAILURE: - msg = "System call failure"; - break; - case WSASERVICE_NOT_FOUND: - msg = "Service not found"; - break; - case WSATYPE_NOT_FOUND: - msg = "Class type not found"; - break; - case WSAEREFUSED: - msg = "Database query was refused"; - break; - case WSAHOST_NOT_FOUND: - msg = "Host not found"; - break; - case WSATRY_AGAIN: - msg = "Nonauthoritative host not found"; - break; - case WSANO_RECOVERY: - msg = "Nonrecoverable error"; - break; - case WSANO_DATA: - msg = "Valid name, no data record of requested type"; - break; - /* WSA_QOS_* omitted */ -# endif -# endif - -# if GNULIB_defined_ENOMSG - case ENOMSG: - msg = "No message of desired type"; - break; -# endif - -# if GNULIB_defined_EIDRM - case EIDRM: - msg = "Identifier removed"; - break; -# endif - -# if GNULIB_defined_ENOLINK - case ENOLINK: - msg = "Link has been severed"; - break; -# endif - -# if GNULIB_defined_EPROTO - case EPROTO: - msg = "Protocol error"; - break; -# endif - -# if GNULIB_defined_EMULTIHOP - case EMULTIHOP: - msg = "Multihop attempted"; - break; -# endif - -# if GNULIB_defined_EBADMSG - case EBADMSG: - msg = "Bad message"; - break; -# endif - -# if GNULIB_defined_EOVERFLOW - case EOVERFLOW: - msg = "Value too large for defined data type"; - break; -# endif - -# if GNULIB_defined_ENOTSUP - case ENOTSUP: - msg = "Not supported"; - break; -# endif - -# if GNULIB_defined_ESTALE - case ESTALE: - msg = "Stale NFS file handle"; - break; -# endif - -# if GNULIB_defined_ECANCELED - case ECANCELED: - msg = "Operation canceled"; - break; -# endif - } + static char buf[STACKBUF_LEN]; + size_t len; + /* Cast away const, due to the historical signature of strerror; + callers should not be modifying the string. */ + const char *msg = strerror_override (n); if (msg) return (char *) msg; - { - char *result = strerror (n); + /* FreeBSD rejects 0; see http://austingroupbugs.net/view.php?id=382. + MacOS X 10.5 does not distinguish 0 from -1. */ + if (n) + msg = strerror (n); + else + { + int saved_errno = errno; + errno = 0; + msg = strerror (n); + if (errno || (msg && + (strstr (msg, "nknown") || strstr (msg, "ndefined")))) + msg = "Success"; + errno = saved_errno; + } - if (result == NULL || result[0] == '\0') - { - static char const fmt[] = "Unknown error (%d)"; - static char msg_buf[sizeof fmt + INT_STRLEN_BOUND (n)]; - sprintf (msg_buf, fmt, n); - return msg_buf; - } + /* Our strerror_r implementation might use the system's strerror + buffer, so all other clients of strerror have to see the error + copied into a buffer that we manage. This is not thread-safe, + even if the system strerror is, but portable programs shouldn't + be using strerror if they care about thread-safety. */ + if (!msg || !*msg) + { + static char const fmt[] = "Unknown error %d"; + verify (sizeof buf >= sizeof (fmt) + INT_STRLEN_BOUND (n)); + sprintf (buf, fmt, n); + errno = EINVAL; + return buf; + } - return result; - } -} + /* Fix STACKBUF_LEN if this ever aborts. */ + len = strlen (msg); + if (sizeof buf <= len) + abort (); -#endif + return memcpy (buf, msg, len + 1); +} diff --git a/contrib/grep/lib/striconv.c b/contrib/grep/lib/striconv.c index 096a01b0c1..4fdeb74386 100644 --- a/contrib/grep/lib/striconv.c +++ b/contrib/grep/lib/striconv.c @@ -1,7 +1,7 @@ /* -*- buffer-read-only: t -*- vi: set ro: */ /* DO NOT EDIT! GENERATED AUTOMATICALLY! */ /* Charset conversion. - Copyright (C) 2001-2007, 2009-2010 Free Software Foundation, Inc. + Copyright (C) 2001-2007, 2010-2011 Free Software Foundation, Inc. Written by Bruno Haible and Simon Josefsson. This program is free software; you can redistribute it and/or modify @@ -52,7 +52,8 @@ mem_cd_iconv (const char *src, size_t srclen, iconv_t cd, /* Avoid glibc-2.1 bug and Solaris 2.7-2.9 bug. */ # if defined _LIBICONV_VERSION \ - || !((__GLIBC__ - 0 == 2 && __GLIBC_MINOR__ - 0 <= 1) || defined __sun) + || !(((__GLIBC__ == 2 && __GLIBC_MINOR__ <= 1) && !defined __UCLIBC__) \ + || defined __sun) /* Set to the initial state. */ iconv (cd, NULL, NULL, NULL, NULL); # endif @@ -84,7 +85,7 @@ mem_cd_iconv (const char *src, size_t srclen, iconv_t cd, else return -1; } -# if !defined _LIBICONV_VERSION && !defined __GLIBC__ +# if !defined _LIBICONV_VERSION && !(defined __GLIBC__ && !defined __UCLIBC__) /* Irix iconv() inserts a NUL byte if it cannot convert. NetBSD iconv() inserts a question mark if it cannot convert. Only GNU libiconv and GNU libc are known to prefer to fail rather @@ -99,7 +100,8 @@ mem_cd_iconv (const char *src, size_t srclen, iconv_t cd, } /* Avoid glibc-2.1 bug and Solaris 2.7 bug. */ # if defined _LIBICONV_VERSION \ - || !((__GLIBC__ - 0 == 2 && __GLIBC_MINOR__ - 0 <= 1) || defined __sun) + || !(((__GLIBC__ == 2 && __GLIBC_MINOR__ <= 1) && !defined __UCLIBC__) \ + || defined __sun) { char *outptr = tmpbuf; size_t outsize = tmpbufsize; @@ -133,7 +135,8 @@ mem_cd_iconv (const char *src, size_t srclen, iconv_t cd, /* Avoid glibc-2.1 bug and Solaris 2.7-2.9 bug. */ # if defined _LIBICONV_VERSION \ - || !((__GLIBC__ - 0 == 2 && __GLIBC_MINOR__ - 0 <= 1) || defined __sun) + || !(((__GLIBC__ == 2 && __GLIBC_MINOR__ <= 1) && !defined __UCLIBC__) \ + || defined __sun) /* Return to the initial state. */ iconv (cd, NULL, NULL, NULL, NULL); # endif @@ -158,7 +161,7 @@ mem_cd_iconv (const char *src, size_t srclen, iconv_t cd, else goto fail; } -# if !defined _LIBICONV_VERSION && !defined __GLIBC__ +# if !defined _LIBICONV_VERSION && !(defined __GLIBC__ && !defined __UCLIBC__) /* Irix iconv() inserts a NUL byte if it cannot convert. NetBSD iconv() inserts a question mark if it cannot convert. Only GNU libiconv and GNU libc are known to prefer to fail rather @@ -172,7 +175,8 @@ mem_cd_iconv (const char *src, size_t srclen, iconv_t cd, } /* Avoid glibc-2.1 bug and Solaris 2.7 bug. */ # if defined _LIBICONV_VERSION \ - || !((__GLIBC__ - 0 == 2 && __GLIBC_MINOR__ - 0 <= 1) || defined __sun) + || !(((__GLIBC__ == 2 && __GLIBC_MINOR__ <= 1) && !defined __UCLIBC__) \ + || defined __sun) { size_t res = iconv (cd, NULL, NULL, &outptr, &outsize); @@ -209,7 +213,7 @@ str_cd_iconv (const char *src, iconv_t cd) to a trailing NUL byte in the output. But not for UTF-7. So that this function is usable for UTF-7, we have to exclude the NUL byte from the conversion and add it by hand afterwards. */ -# if !defined _LIBICONV_VERSION && !defined __GLIBC__ +# if !defined _LIBICONV_VERSION && !(defined __GLIBC__ && !defined __UCLIBC__) /* Irix iconv() inserts a NUL byte if it cannot convert. NetBSD iconv() inserts a question mark if it cannot convert. Only GNU libiconv and GNU libc are known to prefer to fail rather @@ -274,7 +278,8 @@ str_cd_iconv (const char *src, iconv_t cd) /* Avoid glibc-2.1 bug and Solaris 2.7-2.9 bug. */ # if defined _LIBICONV_VERSION \ - || !((__GLIBC__ - 0 == 2 && __GLIBC_MINOR__ - 0 <= 1) || defined __sun) + || !(((__GLIBC__ == 2 && __GLIBC_MINOR__ <= 1) && !defined __UCLIBC__) \ + || defined __sun) /* Set to the initial state. */ iconv (cd, NULL, NULL, NULL, NULL); # endif @@ -326,7 +331,8 @@ str_cd_iconv (const char *src, iconv_t cd) } /* Avoid glibc-2.1 bug and Solaris 2.7 bug. */ # if defined _LIBICONV_VERSION \ - || !((__GLIBC__ - 0 == 2 && __GLIBC_MINOR__ - 0 <= 1) || defined __sun) + || !(((__GLIBC__ == 2 && __GLIBC_MINOR__ <= 1) && !defined __UCLIBC__) \ + || defined __sun) for (;;) { /* Here outptr + outbytes_remaining = result + result_size - 1. */ @@ -412,7 +418,8 @@ str_iconv (const char *src, const char *from_codeset, const char *to_codeset) char *result; /* Avoid glibc-2.1 bug with EUC-KR. */ -# if (__GLIBC__ - 0 == 2 && __GLIBC_MINOR__ - 0 <= 1) && !defined _LIBICONV_VERSION +# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ <= 1) && !defined __UCLIBC__) \ + && !defined _LIBICONV_VERSION if (c_strcasecmp (from_codeset, "EUC-KR") == 0 || c_strcasecmp (to_codeset, "EUC-KR") == 0) { diff --git a/contrib/grep/lib/striconv.h b/contrib/grep/lib/striconv.h index bc864e0ab8..30bc1f8f9c 100644 --- a/contrib/grep/lib/striconv.h +++ b/contrib/grep/lib/striconv.h @@ -1,7 +1,7 @@ /* -*- buffer-read-only: t -*- vi: set ro: */ /* DO NOT EDIT! GENERATED AUTOMATICALLY! */ /* Charset conversion. - Copyright (C) 2001-2004, 2006-2007, 2009-2010 Free Software Foundation, Inc. + Copyright (C) 2001-2004, 2006-2007, 2009-2011 Free Software Foundation, Inc. Written by Bruno Haible and Simon Josefsson. This program is free software; you can redistribute it and/or modify diff --git a/contrib/grep/lib/stripslash.c b/contrib/grep/lib/stripslash.c index 3a5996fd90..1212440b5a 100644 --- a/contrib/grep/lib/stripslash.c +++ b/contrib/grep/lib/stripslash.c @@ -1,6 +1,6 @@ /* stripslash.c -- remove redundant trailing slashes from a file name - Copyright (C) 1990, 2001, 2003-2006, 2009-2010 Free Software Foundation, + Copyright (C) 1990, 2001, 2003-2006, 2009-2011 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify diff --git a/contrib/grep/lib/strndup.c b/contrib/grep/lib/strndup.c index a7e03efb19..c5aca3ea42 100644 --- a/contrib/grep/lib/strndup.c +++ b/contrib/grep/lib/strndup.c @@ -2,8 +2,8 @@ /* DO NOT EDIT! GENERATED AUTOMATICALLY! */ /* A replacement function, for systems that lack strndup. - Copyright (C) 1996, 1997, 1998, 2001, 2002, 2003, 2005, 2006, 2007, 2009, - 2010 Free Software Foundation, Inc. + Copyright (C) 1996-1998, 2001-2003, 2005-2007, 2009-2011 Free Software + Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the diff --git a/contrib/grep/lib/strnlen.c b/contrib/grep/lib/strnlen.c index 2455d5c1af..241bb592b4 100644 --- a/contrib/grep/lib/strnlen.c +++ b/contrib/grep/lib/strnlen.c @@ -1,7 +1,7 @@ /* -*- buffer-read-only: t -*- vi: set ro: */ /* DO NOT EDIT! GENERATED AUTOMATICALLY! */ /* Find the length of STRING, but scan at most MAXLEN characters. - Copyright (C) 2005, 2006, 2007, 2009, 2010 Free Software Foundation, Inc. + Copyright (C) 2005-2007, 2009-2011 Free Software Foundation, Inc. Written by Simon Josefsson. This program is free software; you can redistribute it and/or modify diff --git a/contrib/grep/lib/strnlen1.c b/contrib/grep/lib/strnlen1.c index b8cd2bff03..f64ce104a3 100644 --- a/contrib/grep/lib/strnlen1.c +++ b/contrib/grep/lib/strnlen1.c @@ -1,5 +1,5 @@ /* Find the length of STRING + 1, but scan at most MAXLEN bytes. - Copyright (C) 2005-2006, 2009-2010 Free Software Foundation, Inc. + Copyright (C) 2005-2006, 2009-2011 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/contrib/grep/lib/strnlen1.h b/contrib/grep/lib/strnlen1.h index dfaf62dcbd..1bb13de60d 100644 --- a/contrib/grep/lib/strnlen1.h +++ b/contrib/grep/lib/strnlen1.h @@ -1,5 +1,5 @@ /* Find the length of STRING + 1, but scan at most MAXLEN bytes. - Copyright (C) 2005, 2009, 2010 Free Software Foundation, Inc. + Copyright (C) 2005, 2009-2011 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/contrib/grep/lib/strtoimax.c b/contrib/grep/lib/strtoimax.c index ce873f79f7..497d15585c 100644 --- a/contrib/grep/lib/strtoimax.c +++ b/contrib/grep/lib/strtoimax.c @@ -1,7 +1,7 @@ /* Convert string representation of a number into an intmax_t value. - Copyright (C) 1999, 2001, 2002, 2003, 2004, 2006, 2009, 2010 Free Software - Foundation, Inc. + Copyright (C) 1999, 2001-2004, 2006, 2009-2011 Free Software Foundation, + Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/contrib/grep/lib/strtol.c b/contrib/grep/lib/strtol.c index e5b5a11b24..6c15d11e8f 100644 --- a/contrib/grep/lib/strtol.c +++ b/contrib/grep/lib/strtol.c @@ -1,7 +1,7 @@ /* Convert string representation of a number into an integer value. - Copyright (C) 1991, 1992, 1994, 1995, 1996, 1997, 1998, 1999, 2003, 2005, - 2006, 2007, 2009, 2010 Free Software Foundation, Inc. + Copyright (C) 1991-1992, 1994-1999, 2003, 2005-2007, 2009-2011 Free Software + Foundation, Inc. NOTE: The canonical source of this file is maintained with the GNU C Library. Bugs can be reported to bug-glibc@gnu.org. @@ -141,11 +141,11 @@ ? (t) 0 \ : TYPE_SIGNED_MAGNITUDE (t) \ ? ~ (t) 0 \ - : ~ (t) 0 << (sizeof (t) * CHAR_BIT - 1))) + : ~ TYPE_MAXIMUM (t))) # define TYPE_MAXIMUM(t) \ ((t) (! TYPE_SIGNED (t) \ ? (t) -1 \ - : ~ (~ (t) 0 << (sizeof (t) * CHAR_BIT - 1)))) + : ((((t) 1 << (sizeof (t) * CHAR_BIT - 2)) - 1) * 2 + 1))) # ifndef ULLONG_MAX # define ULLONG_MAX TYPE_MAXIMUM (unsigned long long) @@ -186,9 +186,8 @@ # define LOCALE_PARAM_PROTO #endif -#include - #ifdef USE_WIDE_CHAR +# include # include # define L_(Ch) L##Ch # define UCHAR_TYPE wint_t diff --git a/contrib/grep/lib/strtoll.c b/contrib/grep/lib/strtoll.c deleted file mode 100644 index 8d25b0c70c..0000000000 --- a/contrib/grep/lib/strtoll.c +++ /dev/null @@ -1,33 +0,0 @@ -/* Function to parse a `long long int' from text. - Copyright (C) 1995, 1996, 1997, 1999, 2001, 2009, 2010 Free Software - Foundation, Inc. - This file is part of the GNU C Library. - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . */ - -#define QUAD 1 - -#include - -#ifdef _LIBC -# ifdef SHARED -# include - -# if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_2) -compat_symbol (libc, __strtoll_internal, __strtoq_internal, GLIBC_2_0); -# endif - -# endif -weak_alias (strtoll, strtoq) -#endif diff --git a/contrib/grep/lib/strtoul.c b/contrib/grep/lib/strtoul.c index def103ff96..6fa6d0c2e0 100644 --- a/contrib/grep/lib/strtoul.c +++ b/contrib/grep/lib/strtoul.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991, 1997, 2009, 2010 Free Software Foundation, Inc. +/* Copyright (C) 1991, 1997, 2009-2011 Free Software Foundation, Inc. This file is part of the GNU C Library. This program is free software: you can redistribute it and/or modify diff --git a/contrib/grep/lib/strtoull.c b/contrib/grep/lib/strtoull.c index d4e65e352b..bf259958d6 100644 --- a/contrib/grep/lib/strtoull.c +++ b/contrib/grep/lib/strtoull.c @@ -1,6 +1,5 @@ /* Function to parse an `unsigned long long int' from text. - Copyright (C) 1995, 1996, 1997, 1999, 2009, 2010 Free Software Foundation, - Inc. + Copyright (C) 1995-1997, 1999, 2009-2011 Free Software Foundation, Inc. NOTE: The canonical source of this file is maintained with the GNU C Library. Bugs can be reported to bug-glibc@gnu.org. diff --git a/contrib/grep/lib/trim.c b/contrib/grep/lib/trim.c index c8b0c7fe49..155063eed3 100644 --- a/contrib/grep/lib/trim.c +++ b/contrib/grep/lib/trim.c @@ -1,5 +1,5 @@ /* Removes leading and/or trailing whitespaces - Copyright (C) 2006-2010 Free Software Foundation, Inc. + Copyright (C) 2006-2011 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -65,7 +65,7 @@ trim2 (const char *s, int how) /* Trim trailing whitespaces. */ if (how != TRIM_LEADING) { - int state = 0; + unsigned int state = 0; char *r IF_LINT (= NULL); /* used only while state = 2 */ mbi_init (i, d, strlen (d)); @@ -73,10 +73,7 @@ trim2 (const char *s, int how) for (; mbi_avail (i); mbi_advance (i)) { if (state == 0 && mb_isspace (mbi_cur (i))) - { - state = 0; - continue; - } + continue; if (state == 0 && !mb_isspace (mbi_cur (i))) { @@ -85,10 +82,7 @@ trim2 (const char *s, int how) } if (state == 1 && !mb_isspace (mbi_cur (i))) - { - state = 1; - continue; - } + continue; if (state == 1 && mb_isspace (mbi_cur (i))) { @@ -97,7 +91,7 @@ trim2 (const char *s, int how) } else if (state == 2 && mb_isspace (mbi_cur (i))) { - state = 2; + /* empty */ } else { @@ -114,20 +108,22 @@ trim2 (const char *s, int how) char *p; /* Trim leading whitespaces. */ - if (how != TRIM_TRAILING) { - for (p = d; *p && isspace ((unsigned char) *p); p++) - ; + if (how != TRIM_TRAILING) + { + for (p = d; *p && isspace ((unsigned char) *p); p++) + ; - memmove (d, p, strlen (p) + 1); - } + memmove (d, p, strlen (p) + 1); + } /* Trim trailing whitespaces. */ - if (how != TRIM_LEADING) { - for (p = d + strlen (d) - 1; p >= d && isspace ((unsigned char) *p); p--) - *p = '\0'; - } + if (how != TRIM_LEADING) + { + for (p = d + strlen (d) - 1; + p >= d && isspace ((unsigned char) *p); p--) + *p = '\0'; + } } return d; } - diff --git a/contrib/grep/lib/trim.h b/contrib/grep/lib/trim.h index aa777e499d..0bbb2ffa66 100644 --- a/contrib/grep/lib/trim.h +++ b/contrib/grep/lib/trim.h @@ -1,5 +1,5 @@ /* Removes leading and/or trailing whitespaces - Copyright (C) 2006, 2009, 2010 Free Software Foundation, Inc. + Copyright (C) 2006, 2009-2011 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/contrib/grep/lib/unistr/u8-mbtoucr.c b/contrib/grep/lib/unistr/u8-mbtoucr.c new file mode 100644 index 0000000000..794dfc3665 --- /dev/null +++ b/contrib/grep/lib/unistr/u8-mbtoucr.c @@ -0,0 +1,287 @@ +/* -*- buffer-read-only: t -*- vi: set ro: */ +/* DO NOT EDIT! GENERATED AUTOMATICALLY! */ +/* Look at first character in UTF-8 string, returning an error code. + Copyright (C) 1999-2002, 2006-2007, 2009-2011 Free Software Foundation, Inc. + Written by Bruno Haible , 2001. + + This program is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published + by the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +#include + +/* Specification. */ +#include "unistr.h" + +int +u8_mbtoucr (ucs4_t *puc, const uint8_t *s, size_t n) +{ + uint8_t c = *s; + + if (c < 0x80) + { + *puc = c; + return 1; + } + else if (c >= 0xc2) + { + if (c < 0xe0) + { + if (n >= 2) + { + if ((s[1] ^ 0x80) < 0x40) + { + *puc = ((unsigned int) (c & 0x1f) << 6) + | (unsigned int) (s[1] ^ 0x80); + return 2; + } + /* invalid multibyte character */ + } + else + { + /* incomplete multibyte character */ + *puc = 0xfffd; + return -2; + } + } + else if (c < 0xf0) + { + if (n >= 2) + { + if ((s[1] ^ 0x80) < 0x40 + && (c >= 0xe1 || s[1] >= 0xa0) + && (c != 0xed || s[1] < 0xa0)) + { + if (n >= 3) + { + if ((s[2] ^ 0x80) < 0x40) + { + *puc = ((unsigned int) (c & 0x0f) << 12) + | ((unsigned int) (s[1] ^ 0x80) << 6) + | (unsigned int) (s[2] ^ 0x80); + return 3; + } + /* invalid multibyte character */ + } + else + { + /* incomplete multibyte character */ + *puc = 0xfffd; + return -2; + } + } + /* invalid multibyte character */ + } + else + { + /* incomplete multibyte character */ + *puc = 0xfffd; + return -2; + } + } + else if (c < 0xf8) + { + if (n >= 2) + { + if ((s[1] ^ 0x80) < 0x40 + && (c >= 0xf1 || s[1] >= 0x90) +#if 1 + && (c < 0xf4 || (c == 0xf4 && s[1] < 0x90)) +#endif + ) + { + if (n >= 3) + { + if ((s[2] ^ 0x80) < 0x40) + { + if (n >= 4) + { + if ((s[3] ^ 0x80) < 0x40) + { + *puc = ((unsigned int) (c & 0x07) << 18) + | ((unsigned int) (s[1] ^ 0x80) << 12) + | ((unsigned int) (s[2] ^ 0x80) << 6) + | (unsigned int) (s[3] ^ 0x80); + return 4; + } + /* invalid multibyte character */ + } + else + { + /* incomplete multibyte character */ + *puc = 0xfffd; + return -2; + } + } + /* invalid multibyte character */ + } + else + { + /* incomplete multibyte character */ + *puc = 0xfffd; + return -2; + } + } + /* invalid multibyte character */ + } + else + { + /* incomplete multibyte character */ + *puc = 0xfffd; + return -2; + } + } +#if 0 + else if (c < 0xfc) + { + if (n >= 2) + { + if ((s[1] ^ 0x80) < 0x40 + && (c >= 0xf9 || s[1] >= 0x88)) + { + if (n >= 3) + { + if ((s[2] ^ 0x80) < 0x40) + { + if (n >= 4) + { + if ((s[3] ^ 0x80) < 0x40) + { + if (n >= 5) + { + if ((s[4] ^ 0x80) < 0x40) + { + *puc = ((unsigned int) (c & 0x03) << 24) + | ((unsigned int) (s[1] ^ 0x80) << 18) + | ((unsigned int) (s[2] ^ 0x80) << 12) + | ((unsigned int) (s[3] ^ 0x80) << 6) + | (unsigned int) (s[4] ^ 0x80); + return 5; + } + /* invalid multibyte character */ + } + else + { + /* incomplete multibyte character */ + *puc = 0xfffd; + return -2; + } + } + /* invalid multibyte character */ + } + else + { + /* incomplete multibyte character */ + *puc = 0xfffd; + return -2; + } + } + /* invalid multibyte character */ + } + else + { + /* incomplete multibyte character */ + *puc = 0xfffd; + return -2; + } + } + /* invalid multibyte character */ + } + else + { + /* incomplete multibyte character */ + *puc = 0xfffd; + return -2; + } + } + else if (c < 0xfe) + { + if (n >= 2) + { + if ((s[1] ^ 0x80) < 0x40 + && (c >= 0xfd || s[1] >= 0x84)) + { + if (n >= 3) + { + if ((s[2] ^ 0x80) < 0x40) + { + if (n >= 4) + { + if ((s[3] ^ 0x80) < 0x40) + { + if (n >= 5) + { + if ((s[4] ^ 0x80) < 0x40) + { + if (n >= 6) + { + if ((s[5] ^ 0x80) < 0x40) + { + *puc = ((unsigned int) (c & 0x01) << 30) + | ((unsigned int) (s[1] ^ 0x80) << 24) + | ((unsigned int) (s[2] ^ 0x80) << 18) + | ((unsigned int) (s[3] ^ 0x80) << 12) + | ((unsigned int) (s[4] ^ 0x80) << 6) + | (unsigned int) (s[5] ^ 0x80); + return 6; + } + /* invalid multibyte character */ + } + else + { + /* incomplete multibyte character */ + *puc = 0xfffd; + return -2; + } + } + /* invalid multibyte character */ + } + else + { + /* incomplete multibyte character */ + *puc = 0xfffd; + return -2; + } + } + /* invalid multibyte character */ + } + else + { + /* incomplete multibyte character */ + *puc = 0xfffd; + return -2; + } + } + /* invalid multibyte character */ + } + else + { + /* incomplete multibyte character */ + *puc = 0xfffd; + return -2; + } + } + /* invalid multibyte character */ + } + else + { + /* incomplete multibyte character */ + *puc = 0xfffd; + return -2; + } + } +#endif + } + /* invalid multibyte character */ + *puc = 0xfffd; + return -1; +} diff --git a/contrib/grep/lib/unistr/u8-uctomb-aux.c b/contrib/grep/lib/unistr/u8-uctomb-aux.c new file mode 100644 index 0000000000..206487c022 --- /dev/null +++ b/contrib/grep/lib/unistr/u8-uctomb-aux.c @@ -0,0 +1,71 @@ +/* -*- buffer-read-only: t -*- vi: set ro: */ +/* DO NOT EDIT! GENERATED AUTOMATICALLY! */ +/* Conversion UCS-4 to UTF-8. + Copyright (C) 2002, 2006-2007, 2009-2011 Free Software Foundation, Inc. + Written by Bruno Haible , 2002. + + This program is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published + by the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +#include + +/* Specification. */ +#include "unistr.h" + +int +u8_uctomb_aux (uint8_t *s, ucs4_t uc, int n) +{ + int count; + + if (uc < 0x80) + /* The case n >= 1 is already handled by the caller. */ + return -2; + else if (uc < 0x800) + count = 2; + else if (uc < 0x10000) + { + if (uc < 0xd800 || uc >= 0xe000) + count = 3; + else + return -1; + } +#if 0 + else if (uc < 0x200000) + count = 4; + else if (uc < 0x4000000) + count = 5; + else if (uc <= 0x7fffffff) + count = 6; +#else + else if (uc < 0x110000) + count = 4; +#endif + else + return -1; + + if (n < count) + return -2; + + switch (count) /* note: code falls through cases! */ + { +#if 0 + case 6: s[5] = 0x80 | (uc & 0x3f); uc = uc >> 6; uc |= 0x4000000; + case 5: s[4] = 0x80 | (uc & 0x3f); uc = uc >> 6; uc |= 0x200000; +#endif + case 4: s[3] = 0x80 | (uc & 0x3f); uc = uc >> 6; uc |= 0x10000; + case 3: s[2] = 0x80 | (uc & 0x3f); uc = uc >> 6; uc |= 0x800; + case 2: s[1] = 0x80 | (uc & 0x3f); uc = uc >> 6; uc |= 0xc0; + /*case 1:*/ s[0] = uc; + } + return count; +} diff --git a/contrib/grep/lib/unistr/u8-uctomb.c b/contrib/grep/lib/unistr/u8-uctomb.c new file mode 100644 index 0000000000..8aa1849d25 --- /dev/null +++ b/contrib/grep/lib/unistr/u8-uctomb.c @@ -0,0 +1,90 @@ +/* -*- buffer-read-only: t -*- vi: set ro: */ +/* DO NOT EDIT! GENERATED AUTOMATICALLY! */ +/* Store a character in UTF-8 string. + Copyright (C) 2002, 2005-2006, 2009-2011 Free Software Foundation, Inc. + Written by Bruno Haible , 2002. + + This program is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published + by the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +#include + +#if defined IN_LIBUNISTRING +/* Tell unistr.h to declare u8_uctomb as 'extern', not 'static inline'. */ +# include "unistring-notinline.h" +#endif + +/* Specification. */ +#include "unistr.h" + +#if !HAVE_INLINE + +int +u8_uctomb (uint8_t *s, ucs4_t uc, int n) +{ + if (uc < 0x80) + { + if (n > 0) + { + s[0] = uc; + return 1; + } + /* else return -2, below. */ + } + else + { + int count; + + if (uc < 0x800) + count = 2; + else if (uc < 0x10000) + { + if (uc < 0xd800 || uc >= 0xe000) + count = 3; + else + return -1; + } +#if 0 + else if (uc < 0x200000) + count = 4; + else if (uc < 0x4000000) + count = 5; + else if (uc <= 0x7fffffff) + count = 6; +#else + else if (uc < 0x110000) + count = 4; +#endif + else + return -1; + + if (n >= count) + { + switch (count) /* note: code falls through cases! */ + { +#if 0 + case 6: s[5] = 0x80 | (uc & 0x3f); uc = uc >> 6; uc |= 0x4000000; + case 5: s[4] = 0x80 | (uc & 0x3f); uc = uc >> 6; uc |= 0x200000; +#endif + case 4: s[3] = 0x80 | (uc & 0x3f); uc = uc >> 6; uc |= 0x10000; + case 3: s[2] = 0x80 | (uc & 0x3f); uc = uc >> 6; uc |= 0x800; + case 2: s[1] = 0x80 | (uc & 0x3f); uc = uc >> 6; uc |= 0xc0; + /*case 1:*/ s[0] = uc; + } + return count; + } + } + return -2; +} + +#endif diff --git a/contrib/grep/lib/uniwidth/cjk.h b/contrib/grep/lib/uniwidth/cjk.h index c2b69cc6c3..5f7b3b3125 100644 --- a/contrib/grep/lib/uniwidth/cjk.h +++ b/contrib/grep/lib/uniwidth/cjk.h @@ -1,7 +1,7 @@ /* -*- buffer-read-only: t -*- vi: set ro: */ /* DO NOT EDIT! GENERATED AUTOMATICALLY! */ /* Test for CJK encoding. - Copyright (C) 2001-2002, 2005-2007, 2009-2010 Free Software Foundation, Inc. + Copyright (C) 2001-2002, 2005-2007, 2009-2011 Free Software Foundation, Inc. Written by Bruno Haible , 2002. This program is free software: you can redistribute it and/or modify it @@ -12,7 +12,7 @@ This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. + General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ diff --git a/contrib/grep/lib/uniwidth/width.c b/contrib/grep/lib/uniwidth/width.c index a2fa2f75ca..3fab5eaa1b 100644 --- a/contrib/grep/lib/uniwidth/width.c +++ b/contrib/grep/lib/uniwidth/width.c @@ -1,7 +1,7 @@ /* -*- buffer-read-only: t -*- vi: set ro: */ /* DO NOT EDIT! GENERATED AUTOMATICALLY! */ /* Determine display width of Unicode character. - Copyright (C) 2001-2002, 2006-2010 Free Software Foundation, Inc. + Copyright (C) 2001-2002, 2006-2011 Free Software Foundation, Inc. Written by Bruno Haible , 2002. This program is free software: you can redistribute it and/or modify it @@ -12,7 +12,7 @@ This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. + General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ @@ -34,7 +34,7 @@ * - Zero width characters; generated from * "grep '^[^;]*;ZERO WIDTH ' UnicodeData.txt" */ -static const unsigned char nonspacing_table_data[26*64] = { +static const unsigned char nonspacing_table_data[27*64] = { /* 0x0000-0x01ff */ 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, /* 0x0000-0x003f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, /* 0x0040-0x007f */ @@ -64,20 +64,20 @@ static const unsigned char nonspacing_table_data[26*64] = { 0xb6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x05c0-0x05ff */ /* 0x0600-0x07ff */ 0x0f, 0x00, 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, /* 0x0600-0x063f */ - 0x00, 0xf8, 0xff, 0x7f, 0x00, 0x00, 0x01, 0x00, /* 0x0640-0x067f */ + 0x00, 0xf8, 0xff, 0xff, 0x00, 0x00, 0x01, 0x00, /* 0x0640-0x067f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0680-0x06bf */ - 0x00, 0x00, 0xc0, 0xff, 0x9f, 0x3d, 0x00, 0x00, /* 0x06c0-0x06ff */ + 0x00, 0x00, 0xc0, 0xbf, 0x9f, 0x3d, 0x00, 0x00, /* 0x06c0-0x06ff */ 0x00, 0x80, 0x02, 0x00, 0x00, 0x00, 0xff, 0xff, /* 0x0700-0x073f */ 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0740-0x077f */ 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0x01, 0x00, /* 0x0780-0x07bf */ 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x0f, 0x00, /* 0x07c0-0x07ff */ /* 0x0800-0x09ff */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0800-0x083f */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0840-0x087f */ + 0x00, 0x00, 0xc0, 0xfb, 0xef, 0x3e, 0x00, 0x00, /* 0x0800-0x083f */ + 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x00, /* 0x0840-0x087f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0880-0x08bf */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08c0-0x08ff */ - 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, /* 0x0900-0x093f */ - 0xfe, 0x21, 0x1e, 0x00, 0x0c, 0x00, 0x00, 0x00, /* 0x0940-0x097f */ + 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x14, /* 0x0900-0x093f */ + 0xfe, 0x21, 0xfe, 0x00, 0x0c, 0x00, 0x00, 0x00, /* 0x0940-0x097f */ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, /* 0x0980-0x09bf */ 0x1e, 0x20, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, /* 0x09c0-0x09ff */ /* 0x0a00-0x0bff */ @@ -105,12 +105,12 @@ static const unsigned char nonspacing_table_data[26*64] = { 0x00, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0ec0-0x0eff */ 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0xa0, 0x02, /* 0x0f00-0x0f3f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x7f, /* 0x0f40-0x0f7f */ - 0xdf, 0x00, 0xff, 0xfe, 0xff, 0xff, 0xff, 0x1f, /* 0x0f80-0x0fbf */ + 0xdf, 0xe0, 0xff, 0xfe, 0xff, 0xff, 0xff, 0x1f, /* 0x0f80-0x0fbf */ 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x0fc0-0x0fff */ /* 0x1000-0x11ff */ 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xfd, 0x66, /* 0x1000-0x103f */ 0x00, 0x00, 0x00, 0xc3, 0x01, 0x00, 0x1e, 0x00, /* 0x1040-0x107f */ - 0x64, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1080-0x10bf */ + 0x64, 0x20, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, /* 0x1080-0x10bf */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10c0-0x10ff */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1100-0x113f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1140-0x117f */ @@ -122,7 +122,7 @@ static const unsigned char nonspacing_table_data[26*64] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1280-0x12bf */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x12c0-0x12ff */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1300-0x133f */ - 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, /* 0x1340-0x137f */ + 0x00, 0x00, 0x00, 0xe0, 0x00, 0x00, 0x00, 0x00, /* 0x1340-0x137f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1380-0x13bf */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x13c0-0x13ff */ /* 0x1600-0x17ff */ @@ -145,22 +145,22 @@ static const unsigned char nonspacing_table_data[26*64] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x19c0-0x19ff */ /* 0x1a00-0x1bff */ 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x00, 0x00, /* 0x1a00-0x1a3f */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1a40-0x1a7f */ + 0x00, 0x00, 0x40, 0x7f, 0xe5, 0x1f, 0xf8, 0x9f, /* 0x1a40-0x1a7f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1a80-0x1abf */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1ac0-0x1aff */ 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0xd0, 0x17, /* 0x1b00-0x1b3f */ 0x04, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x0f, 0x00, /* 0x1b40-0x1b7f */ 0x03, 0x00, 0x00, 0x00, 0x3c, 0x03, 0x00, 0x00, /* 0x1b80-0x1bbf */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1bc0-0x1bff */ + 0x00, 0x00, 0x00, 0x00, 0x40, 0xa3, 0x03, 0x00, /* 0x1bc0-0x1bff */ /* 0x1c00-0x1dff */ 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xcf, 0x00, /* 0x1c00-0x1c3f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1c40-0x1c7f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1c80-0x1cbf */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1cc0-0x1cff */ + 0x00, 0x00, 0xf7, 0xff, 0xfd, 0x21, 0x00, 0x00, /* 0x1cc0-0x1cff */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1d00-0x1d3f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1d40-0x1d7f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1d80-0x1dbf */ - 0xff, 0xff, 0xff, 0xff, 0x7f, 0x00, 0x00, 0xc0, /* 0x1dc0-0x1dff */ + 0xff, 0xff, 0xff, 0xff, 0x7f, 0x00, 0x00, 0xf0, /* 0x1dc0-0x1dff */ /* 0x2000-0x21ff */ 0x00, 0xf8, 0x00, 0x00, 0x00, 0x7c, 0x00, 0x00, /* 0x2000-0x203f */ 0x00, 0x00, 0x00, 0x00, 0x1f, 0xfc, 0x00, 0x00, /* 0x2040-0x207f */ @@ -174,9 +174,9 @@ static const unsigned char nonspacing_table_data[26*64] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x2c00-0x2c3f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x2c40-0x2c7f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x2c80-0x2cbf */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x2cc0-0x2cff */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x03, 0x00, /* 0x2cc0-0x2cff */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x2d00-0x2d3f */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x2d40-0x2d7f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, /* 0x2d40-0x2d7f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x2d80-0x2dbf */ 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, /* 0x2dc0-0x2dff */ /* 0x3000-0x31ff */ @@ -192,7 +192,7 @@ static const unsigned char nonspacing_table_data[26*64] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa600-0xa63f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x07, 0x30, /* 0xa640-0xa67f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa680-0xa6bf */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa6c0-0xa6ff */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, /* 0xa6c0-0xa6ff */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa700-0xa73f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa740-0xa77f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa780-0xa7bf */ @@ -201,20 +201,20 @@ static const unsigned char nonspacing_table_data[26*64] = { 0x44, 0x08, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, /* 0xa800-0xa83f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa840-0xa87f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa880-0xa8bf */ - 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa8c0-0xa8ff */ + 0x10, 0x00, 0x00, 0x00, 0xff, 0xff, 0x03, 0x00, /* 0xa8c0-0xa8ff */ 0x00, 0x00, 0x00, 0x00, 0xc0, 0x3f, 0x00, 0x00, /* 0xa900-0xa93f */ 0x80, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa940-0xa97f */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa980-0xa9bf */ + 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc8, 0x13, /* 0xa980-0xa9bf */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa9c0-0xa9ff */ /* 0xaa00-0xabff */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x66, 0x00, /* 0xaa00-0xaa3f */ 0x08, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xaa40-0xaa7f */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xaa80-0xaabf */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xaac0-0xaaff */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x9d, 0xc1, /* 0xaa80-0xaabf */ + 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xaac0-0xaaff */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xab00-0xab3f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xab40-0xab7f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xab80-0xabbf */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xabc0-0xabff */ + 0x00, 0x00, 0x00, 0x00, 0x20, 0x21, 0x00, 0x00, /* 0xabc0-0xabff */ /* 0xfa00-0xfbff */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xfa00-0xfa3f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xfa40-0xfa7f */ @@ -251,13 +251,22 @@ static const unsigned char nonspacing_table_data[26*64] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10b40-0x10b7f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10b80-0x10bbf */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10bc0-0x10bff */ + /* 0x11000-0x111ff */ + 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, /* 0x11000-0x1103f */ + 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x11040-0x1107f */ + 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x26, /* 0x11080-0x110bf */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x110c0-0x110ff */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x11100-0x1113f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x11140-0x1117f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x11180-0x111bf */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x111c0-0x111ff */ /* 0x1d000-0x1d1ff */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1d000-0x1d03f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1d040-0x1d07f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1d080-0x1d0bf */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1d0c0-0x1d0ff */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1d100-0x1d13f */ - 0x00, 0x00, 0x00, 0x00, 0x80, 0x03, 0x00, 0xf8, /* 0x1d140-0x1d17f */ + 0x00, 0x00, 0x00, 0x00, 0x80, 0x03, 0xf8, 0xff, /* 0x1d140-0x1d17f */ 0xe7, 0x0f, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, /* 0x1d180-0x1d1bf */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x1d1c0-0x1d1ff */ /* 0x1d200-0x1d3ff */ @@ -288,7 +297,7 @@ static const signed char nonspacing_table_ind[240] = { -1, -1, -1, -1, -1, -1, -1, -1, /* 0xe000-0xefff */ -1, -1, -1, -1, -1, 20, -1, 21, /* 0xf000-0xffff */ 22, -1, -1, -1, -1, 23, -1, -1, /* 0x10000-0x10fff */ - -1, -1, -1, -1, -1, -1, -1, -1, /* 0x11000-0x11fff */ + 24, -1, -1, -1, -1, -1, -1, -1, /* 0x11000-0x11fff */ -1, -1, -1, -1, -1, -1, -1, -1, /* 0x12000-0x12fff */ -1, -1, -1, -1, -1, -1, -1, -1, /* 0x13000-0x13fff */ -1, -1, -1, -1, -1, -1, -1, -1, /* 0x14000-0x14fff */ @@ -300,7 +309,7 @@ static const signed char nonspacing_table_ind[240] = { -1, -1, -1, -1, -1, -1, -1, -1, /* 0x1a000-0x1afff */ -1, -1, -1, -1, -1, -1, -1, -1, /* 0x1b000-0x1bfff */ -1, -1, -1, -1, -1, -1, -1, -1, /* 0x1c000-0x1cfff */ - 24, 25, -1, -1, -1, -1, -1, -1 /* 0x1d000-0x1dfff */ + 25, 26, -1, -1, -1, -1, -1, -1 /* 0x1d000-0x1dfff */ }; /* Determine number of column positions required for UC. */ @@ -348,8 +357,8 @@ uc_width (ucs4_t uc, const char *encoding) || (uc >= 0xfe30 && uc < 0xfe70) /* CJK Compatibility Forms */ || (uc >= 0xff00 && uc < 0xff61) /* Fullwidth Forms */ || (uc >= 0xffe0 && uc < 0xffe7) /* Fullwidth Signs */ - || (uc >= 0x20000 && uc <= 0x2a6d6) /* CJK */ - || (uc >= 0x2f800 && uc <= 0x2fa1d) /* CJK Compatibility Ideographs */ + || (uc >= 0x20000 && uc <= 0x2ffff) /* Supplementary Ideographic Plane */ + || (uc >= 0x30000 && uc <= 0x3ffff) /* Tertiary Ideographic Plane */ ) ) return 2; /* In ancient CJK encodings, Cyrillic and most other characters are diff --git a/contrib/grep/lib/unlocked-io.h b/contrib/grep/lib/unlocked-io.h index 75bf89f6c9..901cbdd836 100644 --- a/contrib/grep/lib/unlocked-io.h +++ b/contrib/grep/lib/unlocked-io.h @@ -1,6 +1,6 @@ /* Prefer faster, non-thread-safe stdio functions if available. - Copyright (C) 2001-2004, 2009-2010 Free Software Foundation, Inc. + Copyright (C) 2001-2004, 2009-2011 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/contrib/grep/lib/verify.h b/contrib/grep/lib/verify.h index 4ad780c8fa..9a8caad001 100644 --- a/contrib/grep/lib/verify.h +++ b/contrib/grep/lib/verify.h @@ -1,6 +1,6 @@ /* Compile-time assert-like macros. - Copyright (C) 2005-2006, 2009-2010 Free Software Foundation, Inc. + Copyright (C) 2005-2006, 2009-2011 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -17,21 +17,41 @@ /* Written by Paul Eggert, Bruno Haible, and Jim Meyering. */ -#ifndef VERIFY_H -# define VERIFY_H 1 +#ifndef _GL_VERIFY_H +# define _GL_VERIFY_H + + +/* Define _GL_HAVE__STATIC_ASSERT to 1 if _Static_assert works as per the + C1X draft N1548 section 6.7.10. This is supported by GCC 4.6.0 and + later, in C mode, and its use here generates easier-to-read diagnostics + when verify (R) fails. + + Define _GL_HAVE_STATIC_ASSERT to 1 if static_assert works as per the + C++0X draft N3242 section 7.(4). + This will likely be supported by future GCC versions, in C++ mode. + + Use this only with GCC. If we were willing to slow 'configure' + down we could also use it with other compilers, but since this + affects only the quality of diagnostics, why bother? */ +# if (4 < __GNUC__ || (__GNUC__ == 4 && 6 <= __GNUC_MINOR__)) && !defined __cplusplus +# define _GL_HAVE__STATIC_ASSERT 1 +# endif +/* The condition (99 < __GNUC__) is temporary, until we know about the + first G++ release that supports static_assert. */ +# if (99 < __GNUC__) && defined __cplusplus +# define _GL_HAVE_STATIC_ASSERT 1 +# endif /* Each of these macros verifies that its argument R is nonzero. To be portable, R should be an integer constant expression. Unlike assert (R), there is no run-time overhead. - There are two macros, since no single macro can be used in all - contexts in C. verify_true (R) is for scalar contexts, including - integer constant expression contexts. verify (R) is for declaration - contexts, e.g., the top level. - - Symbols ending in "__" are private to this header. + If _Static_assert works, verify (R) uses it directly. Similarly, + _GL_VERIFY_TRUE works by packaging a _Static_assert inside a struct + that is an operand of sizeof. - The code below uses several ideas. + The code below uses several ideas for C++ compilers, and for C + compilers that do not support _Static_assert: * The first step is ((R) ? 1 : -1). Given an expression R, of integral or boolean or floating-point type, this yields an @@ -39,7 +59,9 @@ constant and nonnegative. * Next this expression W is wrapped in a type - struct verify_type__ { unsigned int verify_error_if_negative_size__: W; }. + struct _gl_verify_type { + unsigned int _gl_verify_error_if_negative: W; + }. If W is negative, this yields a compile-time error. No compiler can deal with a bit-field of negative size. @@ -53,7 +75,7 @@ void function (int n) { verify (n < 0); } - * For the verify macro, the struct verify_type__ will need to + * For the verify macro, the struct _gl_verify_type will need to somehow be embedded into a declaration. To be portable, this declaration must declare an object, a constant, a function, or a typedef name. If the declared entity uses the type directly, @@ -91,11 +113,11 @@ Which of the following alternatives can be used? extern int dummy [sizeof (struct {...})]; - extern int dummy [sizeof (struct verify_type__ {...})]; + extern int dummy [sizeof (struct _gl_verify_type {...})]; extern void dummy (int [sizeof (struct {...})]); - extern void dummy (int [sizeof (struct verify_type__ {...})]); + extern void dummy (int [sizeof (struct _gl_verify_type {...})]); extern int (*dummy (void)) [sizeof (struct {...})]; - extern int (*dummy (void)) [sizeof (struct verify_type__ {...})]; + extern int (*dummy (void)) [sizeof (struct _gl_verify_type {...})]; In the second and sixth case, the struct type is exported to the outer scope; two such declarations therefore collide. GCC warns @@ -109,15 +131,9 @@ __COUNTER__ macro that can let us generate unique identifiers for each dummy function, to suppress this warning. - * This implementation exploits the fact that GCC does not warn about - the last declaration mentioned above. If a future version of GCC - introduces a warning for this, the problem could be worked around - by using code specialized to GCC, just as __COUNTER__ is already - being used if available. - - #if 4 <= __GNUC__ - # define verify(R) [another version to keep GCC happy] - #endif + * This implementation exploits the fact that older versions of GCC, + which do not support _Static_assert, also do not warn about the + last declaration mentioned above. * In C++, any struct definition inside sizeof is invalid. Use a template type to work around the problem. */ @@ -140,24 +156,88 @@ possible. */ # define _GL_GENSYM(prefix) _GL_CONCAT (prefix, _GL_COUNTER) -/* Verify requirement R at compile-time, as an integer constant expression. - Return 1. */ +/* Verify requirement R at compile-time, as an integer constant expression + that returns 1. If R is false, fail at compile-time, preferably + with a diagnostic that includes the string-literal DIAGNOSTIC. */ + +# define _GL_VERIFY_TRUE(R, DIAGNOSTIC) \ + (!!sizeof (_GL_VERIFY_TYPE (R, DIAGNOSTIC))) # ifdef __cplusplus +# if !GNULIB_defined_struct__gl_verify_type template - struct verify_type__ { unsigned int verify_error_if_negative_size__: w; }; -# define verify_true(R) \ - (!!sizeof (verify_type__<(R) ? 1 : -1>)) + struct _gl_verify_type { + unsigned int _gl_verify_error_if_negative: w; + }; +# define GNULIB_defined_struct__gl_verify_type 1 +# endif +# define _GL_VERIFY_TYPE(R, DIAGNOSTIC) \ + _gl_verify_type<(R) ? 1 : -1> +# elif defined _GL_HAVE__STATIC_ASSERT +# define _GL_VERIFY_TYPE(R, DIAGNOSTIC) \ + struct { \ + _Static_assert (R, DIAGNOSTIC); \ + int _gl_dummy; \ + } # else -# define verify_true(R) \ - (!!sizeof \ - (struct { unsigned int verify_error_if_negative_size__: (R) ? 1 : -1; })) +# define _GL_VERIFY_TYPE(R, DIAGNOSTIC) \ + struct { unsigned int _gl_verify_error_if_negative: (R) ? 1 : -1; } # endif +/* Verify requirement R at compile-time, as a declaration without a + trailing ';'. If R is false, fail at compile-time, preferably + with a diagnostic that includes the string-literal DIAGNOSTIC. + + Unfortunately, unlike C1X, this implementation must appear as an + ordinary declaration, and cannot appear inside struct { ... }. */ + +# ifdef _GL_HAVE__STATIC_ASSERT +# define _GL_VERIFY _Static_assert +# else +# define _GL_VERIFY(R, DIAGNOSTIC) \ + extern int (*_GL_GENSYM (_gl_verify_function) (void)) \ + [_GL_VERIFY_TRUE (R, DIAGNOSTIC)] +# endif + +/* _GL_STATIC_ASSERT_H is defined if this code is copied into assert.h. */ +# ifdef _GL_STATIC_ASSERT_H +# if !defined _GL_HAVE__STATIC_ASSERT && !defined _Static_assert +# define _Static_assert(R, DIAGNOSTIC) _GL_VERIFY (R, DIAGNOSTIC) +# endif +# if !defined _GL_HAVE_STATIC_ASSERT && !defined static_assert +# define static_assert _Static_assert /* Draft C1X requires this #define. */ +# endif +# endif + +/* @assert.h omit start@ */ + +/* Each of these macros verifies that its argument R is nonzero. To + be portable, R should be an integer constant expression. Unlike + assert (R), there is no run-time overhead. + + There are two macros, since no single macro can be used in all + contexts in C. verify_true (R) is for scalar contexts, including + integer constant expression contexts. verify (R) is for declaration + contexts, e.g., the top level. */ + +/* Verify requirement R at compile-time, as an integer constant expression. + Return 1. This is equivalent to verify_expr (R, 1). + + verify_true is obsolescent; please use verify_expr instead. */ + +# define verify_true(R) _GL_VERIFY_TRUE (R, "verify_true (" #R ")") + +/* Verify requirement R at compile-time. Return the value of the + expression E. */ + +# define verify_expr(R, E) \ + (_GL_VERIFY_TRUE (R, "verify_expr (" #R ", " #E ")") ? (E) : (E)) + /* Verify requirement R at compile-time, as a declaration without a trailing ';'. */ -# define verify(R) \ - extern int (* _GL_GENSYM (verify_function) (void)) [verify_true (R)] +# define verify(R) _GL_VERIFY (R, "verify (" #R ")") + +/* @assert.h omit end@ */ #endif diff --git a/contrib/grep/lib/version-etc-fsf.c b/contrib/grep/lib/version-etc-fsf.c index fc837a895d..c82158302c 100644 --- a/contrib/grep/lib/version-etc-fsf.c +++ b/contrib/grep/lib/version-etc-fsf.c @@ -1,5 +1,5 @@ /* Variable with FSF copyright information, for version-etc. - Copyright (C) 1999-2006, 2009-2010 Free Software Foundation, Inc. + Copyright (C) 1999-2006, 2009-2011 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/contrib/grep/lib/version-etc.c b/contrib/grep/lib/version-etc.c index 19c873d016..b8d4724b56 100644 --- a/contrib/grep/lib/version-etc.c +++ b/contrib/grep/lib/version-etc.c @@ -1,5 +1,5 @@ /* Print --version and bug-reporting information in a consistent format. - Copyright (C) 1999-2010 Free Software Foundation, Inc. + Copyright (C) 1999-2011 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -38,7 +38,7 @@ # define PACKAGE PACKAGE_TARNAME #endif -enum { COPYRIGHT_YEAR = 2010 }; +enum { COPYRIGHT_YEAR = 2011 }; /* The three functions below display the --version information the standard way. diff --git a/contrib/grep/lib/version-etc.h b/contrib/grep/lib/version-etc.h index 629fe83013..a9b313d23a 100644 --- a/contrib/grep/lib/version-etc.h +++ b/contrib/grep/lib/version-etc.h @@ -1,5 +1,5 @@ /* Print --version and bug-reporting information in a consistent format. - Copyright (C) 1999, 2003, 2005, 2009-2010 Free Software Foundation, Inc. + Copyright (C) 1999, 2003, 2005, 2009-2011 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -23,11 +23,11 @@ # include /* The `sentinel' attribute was added in gcc 4.0. */ -#ifndef ATTRIBUTE_SENTINEL +#ifndef _GL_ATTRIBUTE_SENTINEL # if 4 <= __GNUC__ -# define ATTRIBUTE_SENTINEL __attribute__ ((__sentinel__)) +# define _GL_ATTRIBUTE_SENTINEL __attribute__ ((__sentinel__)) # else -# define ATTRIBUTE_SENTINEL /* empty */ +# define _GL_ATTRIBUTE_SENTINEL /* empty */ # endif #endif @@ -70,7 +70,7 @@ extern void version_etc (FILE *stream, const char *command_name, const char *package, const char *version, /* const char *author1, ..., NULL */ ...) - ATTRIBUTE_SENTINEL; + _GL_ATTRIBUTE_SENTINEL; /* Display the usual `Report bugs to' stanza */ extern void emit_bug_reporting_address (void); diff --git a/contrib/grep/lib/wcrtomb.c b/contrib/grep/lib/wcrtomb.c index e7345f698f..6632589365 100644 --- a/contrib/grep/lib/wcrtomb.c +++ b/contrib/grep/lib/wcrtomb.c @@ -1,5 +1,5 @@ /* Convert wide character to multibyte character. - Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc. + Copyright (C) 2008-2011 Free Software Foundation, Inc. Written by Bruno Haible , 2008. This program is free software: you can redistribute it and/or modify diff --git a/contrib/grep/lib/wctob.c b/contrib/grep/lib/wctob.c index 8a66ec9c1b..cc26afc512 100644 --- a/contrib/grep/lib/wctob.c +++ b/contrib/grep/lib/wctob.c @@ -1,5 +1,5 @@ /* Convert wide character to unibyte character. - Copyright (C) 2008, 2010 Free Software Foundation, Inc. + Copyright (C) 2008, 2010-2011 Free Software Foundation, Inc. Written by Bruno Haible , 2008. This program is free software: you can redistribute it and/or modify diff --git a/contrib/grep/lib/btowc.c b/contrib/grep/lib/wctomb-impl.h similarity index 60% copy from contrib/grep/lib/btowc.c copy to contrib/grep/lib/wctomb-impl.h index 8744602aaf..4e95de6383 100644 --- a/contrib/grep/lib/btowc.c +++ b/contrib/grep/lib/wctomb-impl.h @@ -1,6 +1,6 @@ -/* Convert unibyte character to wide character. - Copyright (C) 2008, 2010 Free Software Foundation, Inc. - Written by Bruno Haible , 2008. +/* Convert wide character to multibyte character. + Copyright (C) 2011 Free Software Foundation, Inc. + Written by Bruno Haible , 2011. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -15,25 +15,20 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ -#include - -/* Specification. */ -#include - -#include -#include - -wint_t -btowc (int c) +int +wctomb (char *s, wchar_t wc) { - if (c != EOF) + if (s == NULL) + return 0; + else { - char buf[1]; - wchar_t wc; - - buf[0] = c; - if (mbtowc (&wc, buf, 1) >= 0) - return wc; + mbstate_t state; + size_t result; + + memset (&state, 0, sizeof (mbstate_t)); + result = wcrtomb (s, wc, &state); + if (result == (size_t)-1) + return -1; + return result; } - return WEOF; } diff --git a/contrib/grep/lib/exitfail.c b/contrib/grep/lib/wctomb.c similarity index 75% copy from contrib/grep/lib/exitfail.c copy to contrib/grep/lib/wctomb.c index 3b63f8a123..889a3c6fff 100644 --- a/contrib/grep/lib/exitfail.c +++ b/contrib/grep/lib/wctomb.c @@ -1,7 +1,6 @@ -/* Failure exit status - - Copyright (C) 2002, 2003, 2005, 2006, 2007, 2009, 2010 Free Software - Foundation, Inc. +/* Convert wide character to multibyte character. + Copyright (C) 2011 Free Software Foundation, Inc. + Written by Bruno Haible , 2011. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -18,8 +17,9 @@ #include -#include "exitfail.h" - #include -int volatile exit_failure = EXIT_FAILURE; +#include +#include + +#include "wctomb-impl.h" diff --git a/contrib/grep/lib/wcwidth.c b/contrib/grep/lib/wcwidth.c index 66b5b15e0b..a006ca7a83 100644 --- a/contrib/grep/lib/wcwidth.c +++ b/contrib/grep/lib/wcwidth.c @@ -1,5 +1,5 @@ /* Determine the number of screen columns needed for a character. - Copyright (C) 2006-2007, 2010 Free Software Foundation, Inc. + Copyright (C) 2006-2007, 2010-2011 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/contrib/grep/lib/xalloc-die.c b/contrib/grep/lib/xalloc-die.c index 4b220403b0..aba4a068d0 100644 --- a/contrib/grep/lib/xalloc-die.c +++ b/contrib/grep/lib/xalloc-die.c @@ -1,7 +1,7 @@ /* Report a memory allocation failure and exit. - Copyright (C) 1997, 1998, 1999, 2000, 2002, 2003, 2004, 2006, 2009, 2010 - Free Software Foundation, Inc. + Copyright (C) 1997-2000, 2002-2004, 2006, 2009-2011 Free Software + Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/contrib/grep/lib/xalloc-oversized.h b/contrib/grep/lib/xalloc-oversized.h new file mode 100644 index 0000000000..ab19bcf2f9 --- /dev/null +++ b/contrib/grep/lib/xalloc-oversized.h @@ -0,0 +1,38 @@ +/* xalloc-oversized.h -- memory allocation size checking + + Copyright (C) 1990-2000, 2003-2004, 2006-2011 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +#ifndef XALLOC_OVERSIZED_H_ +# define XALLOC_OVERSIZED_H_ + +# include + +/* Return 1 if an array of N objects, each of size S, cannot exist due + to size arithmetic overflow. S must be positive and N must be + nonnegative. This is a macro, not an inline function, so that it + works correctly even when SIZE_MAX < N. + + By gnulib convention, SIZE_MAX represents overflow in size + calculations, so the conservative dividend to use here is + SIZE_MAX - 1, since SIZE_MAX might represent an overflowed value. + However, malloc (SIZE_MAX) fails on all known hosts where + sizeof (ptrdiff_t) <= sizeof (size_t), so do not bother to test for + exactly-SIZE_MAX allocations on such hosts; this avoids a test and + branch when S is known to be 1. */ +# define xalloc_oversized(n, s) \ + ((size_t) (sizeof (ptrdiff_t) <= sizeof (size_t) ? -1 : -2) / (s) < (n)) + +#endif /* !XALLOC_OVERSIZED_H_ */ diff --git a/contrib/grep/lib/xalloc.h b/contrib/grep/lib/xalloc.h index 6122cc58b0..c1bbe7e5b6 100644 --- a/contrib/grep/lib/xalloc.h +++ b/contrib/grep/lib/xalloc.h @@ -1,8 +1,6 @@ /* xalloc.h -- malloc with out-of-memory checking - Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, - 2000, 2003, 2004, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, - Inc. + Copyright (C) 1990-2000, 2003-2004, 2006-2011 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -22,28 +20,29 @@ # include +# include "xalloc-oversized.h" # ifdef __cplusplus extern "C" { # endif -# ifndef __attribute__ -# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 8) -# define __attribute__(x) -# endif +# if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 8) +# define _GL_ATTRIBUTE_NORETURN __attribute__ ((__noreturn__)) +# else +# define _GL_ATTRIBUTE_NORETURN /* empty */ # endif -# ifndef ATTRIBUTE_NORETURN -# define ATTRIBUTE_NORETURN __attribute__ ((__noreturn__)) +# if __GNUC__ >= 3 +# define _GL_ATTRIBUTE_MALLOC __attribute__ ((__malloc__)) +# else +# define _GL_ATTRIBUTE_MALLOC # endif -# ifndef ATTRIBUTE_MALLOC -# if __GNUC__ >= 3 -# define ATTRIBUTE_MALLOC __attribute__ ((__malloc__)) -# else -# define ATTRIBUTE_MALLOC -# endif +# if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) +# define _GL_ATTRIBUTE_ALLOC_SIZE(args) __attribute__ ((__alloc_size__ args)) +# else +# define _GL_ATTRIBUTE_ALLOC_SIZE(args) # endif /* This function is always triggered when memory is exhausted. @@ -51,31 +50,21 @@ extern "C" { or by using gnulib's xalloc-die module. This is the function to call when one wants the program to die because of a memory allocation failure. */ -extern void xalloc_die (void) ATTRIBUTE_NORETURN; - -void *xmalloc (size_t s) ATTRIBUTE_MALLOC; -void *xzalloc (size_t s) ATTRIBUTE_MALLOC; -void *xcalloc (size_t n, size_t s) ATTRIBUTE_MALLOC; -void *xrealloc (void *p, size_t s); +extern void xalloc_die (void) _GL_ATTRIBUTE_NORETURN; + +void *xmalloc (size_t s) + _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_ALLOC_SIZE ((1)); +void *xzalloc (size_t s) + _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_ALLOC_SIZE ((1)); +void *xcalloc (size_t n, size_t s) + _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_ALLOC_SIZE ((1, 2)); +void *xrealloc (void *p, size_t s) + _GL_ATTRIBUTE_ALLOC_SIZE ((2)); void *x2realloc (void *p, size_t *pn); -void *xmemdup (void const *p, size_t s) ATTRIBUTE_MALLOC; -char *xstrdup (char const *str) ATTRIBUTE_MALLOC; - -/* Return 1 if an array of N objects, each of size S, cannot exist due - to size arithmetic overflow. S must be positive and N must be - nonnegative. This is a macro, not an inline function, so that it - works correctly even when SIZE_MAX < N. - - By gnulib convention, SIZE_MAX represents overflow in size - calculations, so the conservative dividend to use here is - SIZE_MAX - 1, since SIZE_MAX might represent an overflowed value. - However, malloc (SIZE_MAX) fails on all known hosts where - sizeof (ptrdiff_t) <= sizeof (size_t), so do not bother to test for - exactly-SIZE_MAX allocations on such hosts; this avoids a test and - branch when S is known to be 1. */ -# define xalloc_oversized(n, s) \ - ((size_t) (sizeof (ptrdiff_t) <= sizeof (size_t) ? -1 : -2) / (s) < (n)) - +void *xmemdup (void const *p, size_t s) + _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_ALLOC_SIZE ((2)); +char *xstrdup (char const *str) + _GL_ATTRIBUTE_MALLOC; /* In the following macros, T must be an elementary or structure/union or typedef'ed type, or a pointer to such a type. To apply one of the @@ -106,10 +95,13 @@ char *xstrdup (char const *str) ATTRIBUTE_MALLOC; # if HAVE_INLINE # define static_inline static inline # else -void *xnmalloc (size_t n, size_t s) ATTRIBUTE_MALLOC; -void *xnrealloc (void *p, size_t n, size_t s); +void *xnmalloc (size_t n, size_t s) + _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_ALLOC_SIZE ((1, 2)); +void *xnrealloc (void *p, size_t n, size_t s) + _GL_ATTRIBUTE_ALLOC_SIZE ((2, 3)); void *x2nrealloc (void *p, size_t *pn, size_t s); -char *xcharalloc (size_t n) ATTRIBUTE_MALLOC; +char *xcharalloc (size_t n) + _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_ALLOC_SIZE ((1)); # endif # ifdef static_inline @@ -117,7 +109,8 @@ char *xcharalloc (size_t n) ATTRIBUTE_MALLOC; /* Allocate an array of N objects, each with S bytes of memory, dynamically, with error checking. S must be nonzero. */ -static_inline void *xnmalloc (size_t n, size_t s) ATTRIBUTE_MALLOC; +static_inline void *xnmalloc (size_t n, size_t s) + _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_ALLOC_SIZE ((1, 2)); static_inline void * xnmalloc (size_t n, size_t s) { @@ -129,6 +122,8 @@ xnmalloc (size_t n, size_t s) /* Change the size of an allocated block of memory P to an array of N objects each of S bytes, with error checking. S must be nonzero. */ +static_inline void *xnrealloc (void *p, size_t n, size_t s) + _GL_ATTRIBUTE_ALLOC_SIZE ((2, 3)); static_inline void * xnrealloc (void *p, size_t n, size_t s) { @@ -229,7 +224,8 @@ x2nrealloc (void *p, size_t *pn, size_t s) /* Return a pointer to a new buffer of N bytes. This is like xmalloc, except it returns char *. */ -static_inline char *xcharalloc (size_t n) ATTRIBUTE_MALLOC; +static_inline char *xcharalloc (size_t n) + _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_ALLOC_SIZE ((1)); static_inline char * xcharalloc (size_t n) { diff --git a/contrib/grep/lib/xmalloc.c b/contrib/grep/lib/xmalloc.c index f06d44fb5f..08c30fb8a3 100644 --- a/contrib/grep/lib/xmalloc.c +++ b/contrib/grep/lib/xmalloc.c @@ -1,8 +1,6 @@ /* xmalloc.c -- malloc with out of memory checking - Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, - 2000, 2002, 2003, 2004, 2005, 2006, 2008, 2009, 2010 Free Software - Foundation, Inc. + Copyright (C) 1990-2000, 2002-2006, 2008-2011 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -31,7 +29,7 @@ /* 1 if calloc is known to be compatible with GNU calloc. This matters if we are not also using the calloc module, which defines HAVE_CALLOC_GNU and supports the GNU API even on non-GNU platforms. */ -#if defined HAVE_CALLOC_GNU || defined __GLIBC__ +#if defined HAVE_CALLOC_GNU || (defined __GLIBC__ && !defined __UCLIBC__) enum { HAVE_GNU_CALLOC = 1 }; #else enum { HAVE_GNU_CALLOC = 0 }; @@ -54,8 +52,16 @@ xmalloc (size_t n) void * xrealloc (void *p, size_t n) { + if (!n && p) + { + /* The GNU and C99 realloc behaviors disagree here. Act like + GNU, even if the underlying realloc is C99. */ + free (p); + return NULL; + } + p = realloc (p, n); - if (!p && n != 0) + if (!p && n) xalloc_die (); return p; } diff --git a/contrib/grep/lib/xstriconv.c b/contrib/grep/lib/xstriconv.c index 7c8c142149..9e4498fa5c 100644 --- a/contrib/grep/lib/xstriconv.c +++ b/contrib/grep/lib/xstriconv.c @@ -1,5 +1,5 @@ /* Charset conversion with out-of-memory checking. - Copyright (C) 2001-2004, 2006, 2009-2010 Free Software Foundation, Inc. + Copyright (C) 2001-2004, 2006, 2009-2011 Free Software Foundation, Inc. Written by Bruno Haible. This program is free software: you can redistribute it and/or modify diff --git a/contrib/grep/lib/xstriconv.h b/contrib/grep/lib/xstriconv.h index 72b2aa370c..eba6b167ab 100644 --- a/contrib/grep/lib/xstriconv.h +++ b/contrib/grep/lib/xstriconv.h @@ -1,5 +1,5 @@ /* Charset conversion with out-of-memory checking. - Copyright (C) 2001-2004, 2006-2007, 2009-2010 Free Software Foundation, Inc. + Copyright (C) 2001-2004, 2006-2007, 2009-2011 Free Software Foundation, Inc. Written by Bruno Haible and Simon Josefsson. This program is free software: you can redistribute it and/or modify diff --git a/contrib/grep/lib/xstrndup.c b/contrib/grep/lib/xstrndup.c index 414f9f4f95..d58302a13d 100644 --- a/contrib/grep/lib/xstrndup.c +++ b/contrib/grep/lib/xstrndup.c @@ -1,6 +1,6 @@ /* Duplicate a bounded initial segment of a string, with out-of-memory checking. - Copyright (C) 2003, 2006, 2007, 2009, 2010 Free Software Foundation, Inc. + Copyright (C) 2003, 2006-2007, 2009-2011 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/contrib/grep/lib/xstrndup.h b/contrib/grep/lib/xstrndup.h index 009fdb0864..f96a538dfd 100644 --- a/contrib/grep/lib/xstrndup.h +++ b/contrib/grep/lib/xstrndup.h @@ -1,6 +1,6 @@ /* Duplicate a bounded initial segment of a string, with out-of-memory checking. - Copyright (C) 2003, 2009, 2010 Free Software Foundation, Inc. + Copyright (C) 2003, 2009-2011 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/contrib/grep/lib/xstrtol-error.c b/contrib/grep/lib/xstrtol-error.c index 014fc1c570..52e712c10b 100644 --- a/contrib/grep/lib/xstrtol-error.c +++ b/contrib/grep/lib/xstrtol-error.c @@ -1,6 +1,6 @@ /* A more useful interface to strtol. - Copyright (C) 1995-1996, 1998-1999, 2001-2004, 2006-2010 Free Software + Copyright (C) 1995-1996, 1998-1999, 2001-2004, 2006-2011 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify diff --git a/contrib/grep/lib/xstrtol.c b/contrib/grep/lib/xstrtol.c index 43f5ada719..97ebd9078b 100644 --- a/contrib/grep/lib/xstrtol.c +++ b/contrib/grep/lib/xstrtol.c @@ -1,6 +1,6 @@ /* A more useful interface to strtol. - Copyright (C) 1995-1996, 1998-2001, 2003-2007, 2009-2010 Free Software + Copyright (C) 1995-1996, 1998-2001, 2003-2007, 2009-2011 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify diff --git a/contrib/grep/lib/xstrtol.h b/contrib/grep/lib/xstrtol.h index 3a94a9c6da..716a94ff94 100644 --- a/contrib/grep/lib/xstrtol.h +++ b/contrib/grep/lib/xstrtol.h @@ -1,6 +1,6 @@ /* A more useful interface to strtol. - Copyright (C) 1995-1996, 1998-1999, 2001-2004, 2006-2010 Free Software + Copyright (C) 1995-1996, 1998-1999, 2001-2004, 2006-2011 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify @@ -51,14 +51,10 @@ _DECLARE_XSTRTOL (xstrtoll, long long int) _DECLARE_XSTRTOL (xstrtoull, unsigned long long int) #endif -#ifndef __attribute__ -# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 8) -# define __attribute__(x) -# endif -#endif - -#ifndef ATTRIBUTE_NORETURN -# define ATTRIBUTE_NORETURN __attribute__ ((__noreturn__)) +#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 8) +# define _GL_ATTRIBUTE_NORETURN __attribute__ ((__noreturn__)) +#else +# define _GL_ATTRIBUTE_NORETURN /* empty */ #endif /* Report an error for an invalid integer in an option argument. @@ -78,6 +74,6 @@ _DECLARE_XSTRTOL (xstrtoull, unsigned long long int) void xstrtol_fatal (enum strtol_error, int, char, struct option const *, - char const *) ATTRIBUTE_NORETURN; + char const *) _GL_ATTRIBUTE_NORETURN; #endif /* not XSTRTOL_H_ */ diff --git a/contrib/grep/src/dfa.c b/contrib/grep/src/dfa.c index 3bbe343d90..f2cd198962 100644 --- a/contrib/grep/src/dfa.c +++ b/contrib/grep/src/dfa.c @@ -1,5 +1,5 @@ /* dfa.c - deterministic extended regexp routines for GNU - Copyright (C) 1988, 1998, 2000, 2002, 2004, 2005, 2007-2010 Free Software + Copyright (C) 1988, 1998, 2000, 2002, 2004-2005, 2007-2011 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify @@ -25,7 +25,6 @@ #include #include #include -#include #include #include #include @@ -105,7 +104,7 @@ typedef int charclass[CHARCLASS_INTS]; Word-constituent characters are those that satisfy isalnum(). - The macro SUCCEEDS_IN_CONTEXT determines whether a a given constraint + The macro SUCCEEDS_IN_CONTEXT determines whether a given constraint succeeds in a particular context. Prevn is true if the previous character was a newline, currn is true if the lookahead character is a newline. Prevl and currl similarly depend upon whether the previous and current @@ -153,7 +152,7 @@ typedef enum the empty string. */ BACKREF, /* BACKREF is generated by \; it - it not completely handled. If the scanner + is not completely handled. If the scanner detects a transition on backref, it returns a kind of "semi-success" indicating that the match will have to be verified with @@ -397,19 +396,20 @@ struct dfa static void dfamust (struct dfa *dfa); static void regexp (void); -#define CALLOC(p, t, n) ((p) = xcalloc((size_t)(n), sizeof (t))) -#define MALLOC(p, t, n) ((p) = xmalloc((n) * sizeof (t))) -#define REALLOC(p, t, n) ((p) = xrealloc((p), (n) * sizeof (t))) +#define CALLOC(p, t, n) ((p) = XCALLOC (n, t)) +#define MALLOC(p, t, n) ((p) = XNMALLOC (n, t)) +#define REALLOC(p, t, n) ((p) = xnrealloc (p, n, sizeof (t))) /* Reallocate an array of type t if nalloc is too small for index. */ -#define REALLOC_IF_NECESSARY(p, t, nalloc, index) \ - if ((index) >= (nalloc)) \ - { \ - do \ - (nalloc) *= 2; \ - while ((index) >= (nalloc)); \ - REALLOC(p, t, nalloc); \ - } +#define REALLOC_IF_NECESSARY(p, t, nalloc, index) \ + do \ + if ((nalloc) <= (index)) \ + { \ + size_t new_nalloc = (index) + ! (p); \ + (p) = x2nrealloc (p, &new_nalloc, sizeof (t)); \ + (nalloc) = new_nalloc; \ + } \ + while (false) #ifdef DEBUG @@ -537,50 +537,65 @@ dfasyntax (reg_syntax_t bits, int fold, unsigned char eol) eolbyte = eol; } -/* Like setbit, but if case is folded, set both cases of a letter. - For MB_CUR_MAX > 1, one or both of the two cases may not be set, - so the resulting charset may only be used as an optimization. */ -static void -setbit_case_fold ( +/* Set a bit in the charclass for the given wchar_t. Do nothing if WC + is represented by a multi-byte sequence. Even for MB_CUR_MAX == 1, + this may happen when folding case in weird Turkish locales where + dotless i/dotted I are not included in the chosen character set. + Return whether a bit was set in the charclass. */ #if MBS_SUPPORT - wint_t b, +static bool +setbit_wc (wint_t wc, charclass c) +{ + int b = wctob (wc); + if (b == EOF) + return false; + + setbit (b, c); + return true; +} + +/* Set a bit in the charclass for the given single byte character, + if it is valid in the current character set. */ +static void +setbit_c (int b, charclass c) +{ + /* Do nothing if b is invalid in this character set. */ + if (MB_CUR_MAX > 1 && btowc (b) == WEOF) + return; + setbit (b, c); +} #else - unsigned int b, +#define setbit_c setbit #endif - charclass c) + +/* Like setbit_c, but if case is folded, set both cases of a letter. For + MB_CUR_MAX > 1, the resulting charset is only used as an optimization, + and the caller takes care of setting the appropriate field of struct + mb_char_classes. */ +static void +setbit_case_fold_c (int b, charclass c) { - if (case_fold) - { #if MBS_SUPPORT - if (MB_CUR_MAX > 1) - { - wint_t b1 = iswupper(b) ? towlower(b) : b; - wint_t b2 = iswlower(b) ? towupper(b) : b; - if (wctob ((unsigned char)b1) == b1) - setbit (b1, c); - if (b2 != b1 && wctob ((unsigned char)b2) == b2) - setbit (b2, c); - } - else -#endif - { - unsigned char b1 = isupper(b) ? tolower(b) : b; - unsigned char b2 = islower(b) ? toupper(b) : b; - setbit (b1, c); - if (b2 != b1) - setbit (b2, c); - } + if (MB_CUR_MAX > 1) + { + wint_t wc = btowc (b); + if (wc == WEOF) + return; + setbit (b, c); + if (case_fold && iswalpha (wc)) + setbit_wc (iswupper (wc) ? towlower (wc) : towupper (wc), c); } else - { -#if MBS_SUPPORT - if (wctob ((unsigned char)b) == b) #endif - setbit (b, c); + { + setbit (b, c); + if (case_fold && isalpha (b)) + setbit_c (isupper (b) ? tolower (b) : toupper (b), c); } } + /* UTF-8 encoding allows some optimizations that we can't otherwise assume in a multibyte encoding. */ static inline int @@ -697,13 +712,6 @@ static unsigned char const *buf_end; /* reference to end in dfaexec(). */ #endif /* MBS_SUPPORT */ -static int -in_coll_range (char ch, char from, char to) -{ - char c[6] = { from, 0, ch, 0, to, 0 }; - return strcoll (&c[0], &c[2]) <= 0 && strcoll (&c[2], &c[4]) <= 0; -} - typedef int predicate (int); /* The following list maps the names of the Posix named character classes @@ -866,7 +874,7 @@ parse_bracket_exp (void) for (c2 = 0; c2 < NOTCHAR; ++c2) if (pred->func(c2)) - setbit_case_fold (c2, ccl); + setbit_case_fold_c (c2, ccl); } #if MBS_SUPPORT @@ -977,12 +985,24 @@ parse_bracket_exp (void) } if (!hard_LC_COLLATE) for (c = c1; c <= c2; c++) - setbit_case_fold (c, ccl); + setbit_case_fold_c (c, ccl); else - for (c = 0; c < NOTCHAR; ++c) - if (!(case_fold && isupper (c)) - && in_coll_range (c, c1, c2)) - setbit_case_fold (c, ccl); + { + /* Defer to the system regex library about the meaning + of range expressions. */ + regex_t re; + char pattern[6] = { '[', c1, '-', c2, ']', 0 }; + char subject[2] = { 0, 0 }; + regcomp (&re, pattern, REG_NOSUB); + for (c = 0; c < NOTCHAR; ++c) + { + subject[0] = c; + if (!(case_fold && isupper (c)) + && regexec (&re, subject, 0, NULL, 0) != REG_NOMATCH) + setbit_case_fold_c (c, ccl); + } + regfree (&re); + } } colon_warning_state |= 8; @@ -993,15 +1013,12 @@ parse_bracket_exp (void) colon_warning_state |= (c == ':') ? 2 : 4; #if MBS_SUPPORT - /* Build normal characters. */ - setbit_case_fold (wc, ccl); if (MB_CUR_MAX > 1) { if (case_fold && iswalpha(wc)) { wc = towlower(wc); - c = wctob(wc); - if (c == EOF || (wint_t)c != (wint_t)wc) + if (!setbit_wc (wc, ccl)) { REALLOC_IF_NECESSARY(work_mbc->chars, wchar_t, chars_al, work_mbc->nchars + 1); @@ -1011,19 +1028,18 @@ parse_bracket_exp (void) continue; #else wc = towupper(wc); - c = wctob(wc); #endif } - if (c == EOF || (wint_t)c != (wint_t)wc) + if (!setbit_wc (wc, ccl)) { REALLOC_IF_NECESSARY(work_mbc->chars, wchar_t, chars_al, work_mbc->nchars + 1); work_mbc->chars[work_mbc->nchars++] = wc; } } -#else - setbit_case_fold (c, ccl); + else #endif + setbit_case_fold_c (c, ccl); } while (( #if MBS_SUPPORT @@ -1035,14 +1051,7 @@ parse_bracket_exp (void) dfawarn (_("character class syntax is [[:space:]], not [:space:]")); #if MBS_SUPPORT - if (MB_CUR_MAX > 1 - && (!using_utf8() - || invert - || work_mbc->nchars != 0 - || work_mbc->nch_classes != 0 - || work_mbc->nranges != 0 - || work_mbc->nequivs != 0 - || work_mbc->ncoll_elems != 0)) + if (MB_CUR_MAX > 1) { static charclass zeroclass; work_mbc->invert = invert; @@ -1332,7 +1341,6 @@ lex (void) laststart = 0; return lasttok = CSET + charclass_index(ccl); -#ifndef GAWK case 's': case 'S': if (!backslash || (syntax_bits & RE_NO_GNU_OPS)) @@ -1345,7 +1353,6 @@ lex (void) notset(ccl); laststart = 0; return lasttok = CSET + charclass_index(ccl); -#endif case 'w': case 'W': @@ -1379,7 +1386,7 @@ lex (void) if (case_fold && isalpha(c)) { zeroset(ccl); - setbit_case_fold (c, ccl); + setbit_case_fold_c (c, ccl); return lasttok = CSET + charclass_index(ccl); } @@ -1441,6 +1448,8 @@ addtok_mb (token t, int mbprop) dfa->depth = depth; } +static void addtok_wc (wint_t wc); + /* Add the given token to the parse tree, maintaining the depth count and updating the maximum depth if necessary. */ static void @@ -1448,7 +1457,51 @@ addtok (token t) { #if MBS_SUPPORT if (MB_CUR_MAX > 1 && t == MBCSET) - addtok_mb (MBCSET, ((dfa->nmbcsets - 1) << 2) + 3); + { + bool need_or = false; + struct mb_char_classes *work_mbc = &dfa->mbcsets[dfa->nmbcsets - 1]; + + /* Extract wide characters into alternations for better performance. + This does not require UTF-8. */ + if (!work_mbc->invert) + { + int i; + for (i = 0; i < work_mbc->nchars; i++) + { + addtok_wc (work_mbc->chars[i]); + if (need_or) + addtok (OR); + need_or = true; + } + work_mbc->nchars = 0; + } + + /* UTF-8 allows treating a simple, non-inverted MBCSET like a CSET. */ + if (work_mbc->invert + || (!using_utf8() && work_mbc->cset != -1) + || work_mbc->nchars != 0 + || work_mbc->nch_classes != 0 + || work_mbc->nranges != 0 + || work_mbc->nequivs != 0 + || work_mbc->ncoll_elems != 0) + { + addtok_mb (MBCSET, ((dfa->nmbcsets - 1) << 2) + 3); + if (need_or) + addtok (OR); + } + else + { + /* Characters have been handled above, so it is possible + that the mbcset is empty now. Do nothing in that case. */ + if (work_mbc->cset != -1) + { + assert (using_utf8 ()); + addtok (CSET + work_mbc->cset); + if (need_or) + addtok (OR); + } + } + } else #endif addtok_mb (t, 3); @@ -1483,7 +1536,6 @@ addtok_wc (wint_t wc) addtok(CAT); } } -#endif static void add_utf8_anychar (void) @@ -1533,6 +1585,7 @@ add_utf8_anychar (void) addtok (OR); } } +#endif /* The grammar understood by the parser is as follows. @@ -2082,7 +2135,7 @@ dfaanalyze (struct dfa *d, int searchflag) MALLOC(lastpos, position, d->nleaves); o_lastpos = lastpos, lastpos += d->nleaves; CALLOC(nalloc, int, d->tindex); - MALLOC(merged.elems, position, d->nleaves); + MALLOC(merged.elems, position, 2 * d->nleaves); CALLOC(d->follows, position_set, d->tindex); @@ -2525,7 +2578,7 @@ dfastate (int s, struct dfa *d, int trans[]) by accepting accepts 1st byte of , and state[i+1] accepts 2nd byte of , if state[i+1] encounter the codepoint of , it must not be but 2nd byte of - , so we can not add state[0]. */ + , so we cannot add state[0]. */ next_isnt_1st_byte = 0; for (j = 0; j < follows.nelem; ++j) @@ -2979,7 +3032,7 @@ check_matching_with_multibyte_ops (struct dfa *d, int s, int idx) rarray[i] = match_mb_charset(d, s, pos, idx); break; default: - break; /* can not happen. */ + break; /* cannot happen. */ } } return rarray; @@ -3122,8 +3175,6 @@ transit_state (struct dfa *d, int s, unsigned char const **pp) return s1; } -#endif /* MBS_SUPPORT */ - /* Initialize mblen_buf and inputwcs with data from the next line. */ static void @@ -3171,6 +3222,8 @@ prepare_wc_buf (const char *begin, const char *end) inputwcs[i] = 0; /* sentinel */ } +#endif /* MBS_SUPPORT */ + /* Search through a buffer looking for a match to the given struct dfa. Find the first occurrence of a string matching the regexp in the buffer, and the shortest possible version thereof. Return a pointer to @@ -3572,7 +3625,7 @@ dfafree (struct dfa *d) 'psi|epsilon' is likelier)? */ static char * -icatalloc (char const *old, char const *new) +icatalloc (char *old, char const *new) { char *result; size_t oldsize, newsize; @@ -3581,14 +3634,14 @@ icatalloc (char const *old, char const *new) if (old == NULL) oldsize = 0; else if (newsize == 0) - return (char *) old; + return old; else oldsize = strlen(old); if (old == NULL) result = malloc(newsize + 1); else - result = realloc((void *) old, oldsize + newsize + 1); + result = realloc(old, oldsize + newsize + 1); if (result != NULL && new != NULL) - (void) strcpy(result + oldsize, new); + strcpy(result + oldsize, new); return result; } @@ -3659,9 +3712,7 @@ enlist (char **cpp, char *new, size_t len) cpp[i] = NULL; } /* Add the new string. */ - cpp = realloc((char *) cpp, (i + 2) * sizeof *cpp); - if (cpp == NULL) - return NULL; + cpp = xnrealloc(cpp, i + 2, sizeof *cpp); cpp[i] = new; cpp[i + 1] = NULL; return cpp; @@ -3786,9 +3837,7 @@ dfamust (struct dfa *d) result = empty_string; exact = 0; - musts = malloc((d->tindex + 1) * sizeof *musts); - if (musts == NULL) - return; + musts = xnmalloc(d->tindex + 1, sizeof *musts); mp = musts; for (i = 0; i <= d->tindex; ++i) mp[i] = must0; diff --git a/contrib/grep/src/dfa.h b/contrib/grep/src/dfa.h index b8f3078b0d..30d1739e70 100644 --- a/contrib/grep/src/dfa.h +++ b/contrib/grep/src/dfa.h @@ -1,5 +1,5 @@ /* dfa.h - declarations for GNU deterministic regexp compiler - Copyright (C) 1988, 1998, 2007, 2009-2010 Free Software Foundation, Inc. + Copyright (C) 1988, 1998, 2007, 2009-2011 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/contrib/grep/src/dfasearch.c b/contrib/grep/src/dfasearch.c index 44eb08a6b9..3471308712 100644 --- a/contrib/grep/src/dfasearch.c +++ b/contrib/grep/src/dfasearch.c @@ -1,5 +1,5 @@ /* dfasearch.c - searching subroutines using dfa and regex for grep. - Copyright 1992, 1998, 2000, 2007, 2009-2010 Free Software Foundation, Inc. + Copyright 1992, 1998, 2000, 2007, 2009-2011 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -61,10 +61,10 @@ dfaerror (char const *mesg) void dfawarn (char const *mesg) { - static enum { NONE = 0, POSIX, GNU } mode; - if (mode == NONE) - mode = (getenv ("POSIXLY_CORRECT") ? POSIX : GNU); - if (mode == GNU) + static enum { DW_NONE = 0, DW_POSIX, DW_GNU } mode; + if (mode == DW_NONE) + mode = (getenv ("POSIXLY_CORRECT") ? DW_POSIX : DW_GNU); + if (mode == DW_GNU) dfaerror (mesg); } @@ -162,9 +162,7 @@ GEAcompile (char const *pattern, size_t size, reg_syntax_t syntax_bits) total = 0; } - patterns = realloc (patterns, (pcount + 1) * sizeof (*patterns)); - if (patterns == NULL) - error (EXIT_TROUBLE, errno, _("memory exhausted")); + patterns = xnrealloc (patterns, pcount + 1, sizeof *patterns); patterns[pcount] = patterns0; if ((err = re_compile_pattern (p, len, diff --git a/contrib/grep/src/grep.h b/contrib/grep/src/grep.h index 67ea793611..1fef4b6c26 100644 --- a/contrib/grep/src/grep.h +++ b/contrib/grep/src/grep.h @@ -1,5 +1,5 @@ /* grep.h - interface to grep driver for searching subroutines. - Copyright (C) 1992, 1998, 2001, 2007, 2009-2010 Free Software Foundation, + Copyright (C) 1992, 1998, 2001, 2007, 2009-2011 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify @@ -17,6 +17,9 @@ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ +#ifndef GREP_GREP_H +#define GREP_GREP_H 1 + #if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 6) || __STRICT_ANSI__ # define __attribute__(x) #endif @@ -27,12 +30,13 @@ typedef size_t (*execute_fp_t) (char const *, size_t, size_t *, char const *); /* grep.c expects the matchers vector to be terminated by an entry with a NULL name, and to contain at least one entry. */ -extern struct matcher +struct matcher { const char *name; compile_fp_t compile; execute_fp_t execute; -} const matchers[]; +}; +extern const struct matcher matchers[]; extern const char before_options[]; extern const char after_options[]; @@ -43,3 +47,5 @@ extern int match_icase; /* -i */ extern int match_words; /* -w */ extern int match_lines; /* -x */ extern unsigned char eolbyte; /* -z */ + +#endif diff --git a/contrib/grep/src/kwsearch.c b/contrib/grep/src/kwsearch.c index 9244a8a268..ead4a0e372 100644 --- a/contrib/grep/src/kwsearch.c +++ b/contrib/grep/src/kwsearch.c @@ -1,5 +1,5 @@ /* kwsearch.c - searching subroutines using kwset for grep. - Copyright 1992, 1998, 2000, 2007, 2009-2010 Free Software Foundation, Inc. + Copyright 1992, 1998, 2000, 2007, 2009-2011 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/contrib/grep/src/kwset.c b/contrib/grep/src/kwset.c index d85fa3099b..ba556bbcce 100644 --- a/contrib/grep/src/kwset.c +++ b/contrib/grep/src/kwset.c @@ -1,5 +1,5 @@ /* kwset.c - search for any of a set of keywords. - Copyright (C) 1989, 1998, 2000, 2005, 2007, 2009-2010 Free Software + Copyright (C) 1989, 1998, 2000, 2005, 2007, 2009-2011 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify diff --git a/contrib/grep/src/kwset.h b/contrib/grep/src/kwset.h index 35caa416cf..07cf4a42b4 100644 --- a/contrib/grep/src/kwset.h +++ b/contrib/grep/src/kwset.h @@ -1,5 +1,5 @@ /* kwset.h - header declaring the keyword set library. - Copyright (C) 1989, 1998, 2005, 2007, 2009-2010 Free Software Foundation, + Copyright (C) 1989, 1998, 2005, 2007, 2009-2011 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify diff --git a/contrib/grep/src/main.c b/contrib/grep/src/main.c index 0a91b7f482..4e01a17769 100644 --- a/contrib/grep/src/main.c +++ b/contrib/grep/src/main.c @@ -1,5 +1,5 @@ /* grep.c - main driver file for grep. - Copyright (C) 1992, 1997-2002, 2004-2010 Free Software Foundation, Inc. + Copyright (C) 1992, 1997-2002, 2004-2011 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -1682,10 +1682,7 @@ parse_grep_colors (void) return; /* Work off a writable copy. */ - q = xmalloc(strlen(p) + 1); - if (q == NULL) - return; - strcpy(q, p); + q = xstrdup(p); name = q; val = NULL; @@ -1760,6 +1757,7 @@ main (int argc, char **argv) int default_context; FILE *fp; + exit_failure = EXIT_TROUBLE; initialize_main (&argc, &argv); set_program_name (argv[0]); program_name = argv[0]; diff --git a/contrib/grep/src/mbsupport.h b/contrib/grep/src/mbsupport.h index 2750827dc3..007f412a46 100644 --- a/contrib/grep/src/mbsupport.h +++ b/contrib/grep/src/mbsupport.h @@ -1,6 +1,6 @@ /* mbsupport.h --- Localize determination of whether we have multibyte stuff. - Copyright (C) 2004-2005, 2007, 2009-2010 Free Software Foundation, Inc. + Copyright (C) 2004-2005, 2007, 2009-2011 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/contrib/grep/src/pcresearch.c b/contrib/grep/src/pcresearch.c index 7973dbbfee..f8581e083d 100644 --- a/contrib/grep/src/pcresearch.c +++ b/contrib/grep/src/pcresearch.c @@ -1,5 +1,5 @@ /* pcresearch.c - searching subroutines using PCRE for grep. - Copyright 2000, 2007, 2009-2010 Free Software Foundation, Inc. + Copyright 2000, 2007, 2009-2011 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -44,7 +44,7 @@ Pcompile (char const *pattern, size_t size) #else int e; char const *ep; - char *re = xmalloc (4 * size + 7); + char *re = xnmalloc (4, size + 7); int flags = PCRE_MULTILINE | (match_icase ? PCRE_CASELESS : 0); char const *patlim = pattern + size; char *n = re; @@ -101,13 +101,19 @@ Pcompile (char const *pattern, size_t size) #endif } -size_t +/* Pexecute is a no-return function when building --without-pcre. */ +#if !HAVE_LIBPCRE +# define WITHOUT_PCRE_NORETURN _GL_ATTRIBUTE_NORETURN +#else +# define WITHOUT_PCRE_NORETURN /* empty */ +#endif + +size_t WITHOUT_PCRE_NORETURN Pexecute (char const *buf, size_t size, size_t *match_size, char const *start_ptr) { #if !HAVE_LIBPCRE abort (); - return -1; #else /* This array must have at least two elements; everything after that is just for performance improvement in pcre_exec. */ @@ -148,6 +154,10 @@ Pexecute (char const *buf, size_t size, size_t *match_size, case PCRE_ERROR_NOMEMORY: error (EXIT_TROUBLE, 0, _("memory exhausted")); + case PCRE_ERROR_MATCHLIMIT: + error (EXIT_TROUBLE, 0, + _("exceeded PCRE's backtracking limit")); + default: abort (); } diff --git a/contrib/grep/src/search.h b/contrib/grep/src/search.h index 6df70199f9..c48bbab03c 100644 --- a/contrib/grep/src/search.h +++ b/contrib/grep/src/search.h @@ -1,5 +1,5 @@ /* search.c - searching subroutines using dfa, kwset and regex for grep. - Copyright 1992, 1998, 2000, 2007, 2009-2010 Free Software Foundation, Inc. + Copyright 1992, 1998, 2000, 2007, 2009-2011 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -36,24 +36,23 @@ #include "xalloc.h" /* searchutils.c */ -void kwsinit (kwset_t *); +extern void kwsinit (kwset_t *); #if MBS_SUPPORT -char * mbtolower (const char *, size_t *); -bool is_mb_middle(const char **, const char *, const char *, size_t); +extern char *mbtolower (const char *, size_t *); +extern bool is_mb_middle (const char **, const char *, const char *, size_t); #endif /* dfasearch.c */ -void GEAcompile (char const *, size_t, reg_syntax_t); -size_t EGexecute (char const *, size_t, size_t *, char const *); +extern void GEAcompile (char const *, size_t, reg_syntax_t); +extern size_t EGexecute (char const *, size_t, size_t *, char const *); /* kwsearch.c */ -void Fcompile (char const *, size_t); -size_t Fexecute (char const *, size_t, size_t *, char const *); +extern void Fcompile (char const *, size_t); +extern size_t Fexecute (char const *, size_t, size_t *, char const *); /* pcresearch.c */ -void Pcompile (char const *, size_t); -size_t Pexecute (char const *, size_t, size_t *, char const *); - +extern void Pcompile (char const *, size_t); +extern size_t Pexecute (char const *, size_t, size_t *, char const *); #endif /* GREP_SEARCH_H */ diff --git a/contrib/grep/src/searchutils.c b/contrib/grep/src/searchutils.c index 6f4a5d9c5b..9dac023e8c 100644 --- a/contrib/grep/src/searchutils.c +++ b/contrib/grep/src/searchutils.c @@ -1,5 +1,5 @@ /* searchutils.c - helper subroutines for grep's matchers. - Copyright 1992, 1998, 2000, 2007, 2009-2010 Free Software Foundation, Inc. + Copyright 1992, 1998, 2000, 2007, 2009-2011 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/contrib/grep/src/system.h b/contrib/grep/src/system.h index a0d3c4ae54..199b48536a 100644 --- a/contrib/grep/src/system.h +++ b/contrib/grep/src/system.h @@ -1,5 +1,5 @@ /* Portability cruft. Include after config.h and sys/types.h. - Copyright 1996, 1998-2000, 2007, 2009-2010 Free Software Foundation, Inc. + Copyright 1996, 1998-2000, 2007, 2009-2011 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -16,6 +16,9 @@ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ +#ifndef GREP_SYSTEM_H +#define GREP_SYSTEM_H 1 + #include #include #include @@ -54,3 +57,4 @@ enum { EXIT_TROUBLE = 2 }; #endif #include "unlocked-io.h" +#endif