Commit de67b700 de67b70034470e528365853873851bad6a985197 by Sergey Poznyakoff

Updated by gnulib-sync

1 parent 2ee90b9b
Showing 109 changed files with 1434 additions and 936 deletions
......@@ -23,8 +23,7 @@ INCLUDES = -I${top_srcdir}/include -I${top_srcdir}/mailbox -I${top_builddir}/inc
libmuaux_la_SOURCES = \
daemon.c\
mailcap.c\
mu_dbm.c\
xalloc_die.c
mu_dbm.c
EXTRA_DIST = utmp.c
......@@ -45,33 +44,19 @@ EXTRA_DIST += allocsa.valgrind
libmuaux_la_SOURCES += exit.h
libmuaux_la_SOURCES += exitfail.h exitfail.c
BUILT_SOURCES += $(STDBOOL_H)
EXTRA_DIST += stdbool_.h
# We need the following in order to create an <stdbool.h> when the system
# doesn't have one that works.
all-local $(libmuaux_la_OBJECTS): $(STDBOOL_H)
stdbool.h: stdbool_.h
sed -e 's/@''HAVE__BOOL''@/$(HAVE__BOOL)/g' < $(srcdir)/stdbool_.h > $@-t
mv $@-t $@
MOSTLYCLEANFILES += stdbool.h stdbool.h-t
libmuaux_la_SOURCES += xalloc.h xmalloc.c
BUILT_SOURCES += $(FNMATCH_H)
EXTRA_DIST += fnmatch_.h fnmatch_loop.c
# We need the following in order to create an <fnmatch.h> when the system
# We need the following in order to create <fnmatch.h> when the system
# doesn't have one that supports the required API.
all-local $(libmuaux_la_OBJECTS): $(FNMATCH_H)
fnmatch.h: fnmatch_.h
cp $(srcdir)/fnmatch_.h $@-t
mv $@-t $@
MOSTLYCLEANFILES += fnmatch.h fnmatch.h-t
libmuaux_la_SOURCES += getpass.h
libmuaux_la_SOURCES += mbswidth.h mbswidth.c
......@@ -82,9 +67,10 @@ libmuaux_la_SOURCES += setenv.h
libmuaux_la_SOURCES += snprintf.h
libmuaux_la_SOURCES += xstrtol.h xstrtol.c xstrtoul.c
libmuaux_la_SOURCES += vasprintf.h
libmuaux_la_SOURCES += xalloc-die.c
libmuaux_la_SOURCES += xsize.h
......
......@@ -25,8 +25,20 @@
# include <config.h>
#endif
#include <alloca.h>
#include <string.h>
#include <stdlib.h>
#ifdef emacs
# include "lisp.h"
# include "blockinput.h"
# ifdef EMACS_FREE
# undef free
# define free EMACS_FREE
# endif
#else
# define memory_full() abort ()
#endif
/* If compiling with GCC 2, this file's not needed. */
......@@ -46,6 +58,8 @@
you
lose
-- must know STACK_DIRECTION at compile-time
/* Using #error here is not wise since this file should work for
old and obscure compilers. */
# endif /* STACK_DIRECTION undefined */
# endif /* static */
# endif /* emacs */
......@@ -60,31 +74,6 @@ long i00afunc ();
# define ADDRESS_FUNCTION(arg) &(arg)
# endif
# if __STDC__
typedef void *pointer;
# else
typedef char *pointer;
# endif
# ifndef NULL
# define NULL 0
# endif
/* Different portions of Emacs need to call different versions of
malloc. The Emacs executable needs alloca to call xmalloc, because
ordinary malloc isn't protected from input signals. On the other
hand, the utilities in lib-src need alloca to call malloc; some of
them are very simple, and don't have an xmalloc routine.
Non-Emacs programs expect this to call xmalloc.
Callers below should use malloc. */
# ifndef emacs
# define malloc xmalloc
# endif
extern pointer malloc ();
/* Define STACK_DIRECTION if you know the direction of stack
growth for your system; otherwise it will be automatically
deduced at run-time.
......@@ -107,7 +96,7 @@ static int stack_dir; /* 1 or -1 once known. */
# define STACK_DIR stack_dir
static void
find_stack_direction ()
find_stack_direction (void)
{
static char *addr = NULL; /* Address of first `dummy', once known. */
auto char dummy; /* To get stack address. */
......@@ -160,9 +149,8 @@ static header *last_alloca_header = NULL; /* -> last alloca header. */
caller, but that method cannot be made to work for some
implementations of C, for example under Gould's UTX/32. */
pointer
alloca (size)
unsigned size;
void *
alloca (size_t size)
{
auto char probe; /* Probes stack depth: */
register char *depth = ADDRESS_FUNCTION (probe);
......@@ -188,7 +176,7 @@ alloca (size)
{
register header *np = hp->h.next;
free ((pointer) hp); /* Collect garbage. */
free (hp); /* Collect garbage. */
hp = np; /* -> next header. */
}
......@@ -208,17 +196,26 @@ alloca (size)
/* Allocate combined header + user data storage. */
{
register pointer new = malloc (sizeof (header) + size);
/* Address of header. */
register header *new;
size_t combined_size = sizeof (header) + size;
if (combined_size < sizeof (header))
memory_full ();
new = malloc (combined_size);
if (! new)
memory_full ();
((header *) new)->h.next = last_alloca_header;
((header *) new)->h.deep = depth;
new->h.next = last_alloca_header;
new->h.deep = depth;
last_alloca_header = (header *) new;
last_alloca_header = new;
/* User storage begins just after header. */
return (pointer) ((char *) new + sizeof (header));
return (void *) (new + 1);
}
}
......
......@@ -12,10 +12,9 @@
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, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301 USA. */
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
#ifdef HAVE_CONFIG_H
# include <config.h>
......
......@@ -12,10 +12,9 @@
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, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301 USA. */
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
#ifndef _ALLOCSA_H
#define _ALLOCSA_H
......
......@@ -11,10 +11,9 @@
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, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301 USA. */
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
#ifdef HAVE_CONFIG_H
# include <config.h>
......
......@@ -12,10 +12,9 @@
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, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301 USA. */
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
/* Written by David MacKenzie <djm@gnu.ai.mit.edu>. */
......
......@@ -12,10 +12,9 @@
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, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301 USA. */
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
#ifndef _ERROR_H
#define _ERROR_H 1
......
......@@ -11,10 +11,9 @@
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, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301 USA. */
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
#ifndef _EXIT_H
#define _EXIT_H
......
......@@ -13,9 +13,9 @@
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; see the file COPYING. If not, write to
the Free Software Foundation, 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301 USA. */
along with this program; see the file COPYING.
If not, write to the Free Software Foundation,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
#if HAVE_CONFIG_H
# include <config.h>
......
......@@ -13,8 +13,8 @@
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; see the file COPYING. If not, write to
the Free Software Foundation, 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301 USA. */
along with this program; see the file COPYING.
If not, write to the Free Software Foundation,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
extern int volatile exit_failure;
......
/* Copyright (C) 1991,1992,1993,1996,1997,1998,1999,2000,2001,2002,2003,2004
/* Copyright (C) 1991,1992,1993,1996,1997,1998,1999,2000,2001,2002,2003,2004,2005
Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
......@@ -13,7 +13,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
#if HAVE_CONFIG_H
# include <config.h>
......@@ -319,54 +319,51 @@ fnmatch (const char *pattern, const char *string, int flags)
wide characters. */
memset (&ps, '\0', sizeof (ps));
patsize = mbsrtowcs (NULL, &pattern, 0, &ps) + 1;
if (__builtin_expect (patsize == 0, 0))
/* Something wrong.
XXX Do we have to set `errno' to something which mbsrtows hasn't
already done? */
return -1;
assert (mbsinit (&ps));
strsize = mbsrtowcs (NULL, &string, 0, &ps) + 1;
if (__builtin_expect (strsize == 0, 0))
/* Something wrong.
XXX Do we have to set `errno' to something which mbsrtows hasn't
already done? */
return -1;
assert (mbsinit (&ps));
totsize = patsize + strsize;
if (__builtin_expect (! (patsize <= totsize
&& totsize <= SIZE_MAX / sizeof (wchar_t)),
0))
if (__builtin_expect (patsize != 0, 1))
{
errno = ENOMEM;
return -1;
}
/* Allocate room for the wide characters. */
if (__builtin_expect (totsize < ALLOCA_LIMIT, 1))
wpattern = (wchar_t *) alloca (totsize * sizeof (wchar_t));
else
{
wpattern = malloc (totsize * sizeof (wchar_t));
if (__builtin_expect (! wpattern, 0))
assert (mbsinit (&ps));
strsize = mbsrtowcs (NULL, &string, 0, &ps) + 1;
if (__builtin_expect (strsize != 0, 1))
{
errno = ENOMEM;
return -1;
assert (mbsinit (&ps));
totsize = patsize + strsize;
if (__builtin_expect (! (patsize <= totsize
&& totsize <= SIZE_MAX / sizeof (wchar_t)),
0))
{
errno = ENOMEM;
return -1;
}
/* Allocate room for the wide characters. */
if (__builtin_expect (totsize < ALLOCA_LIMIT, 1))
wpattern = (wchar_t *) alloca (totsize * sizeof (wchar_t));
else
{
wpattern = malloc (totsize * sizeof (wchar_t));
if (__builtin_expect (! wpattern, 0))
{
errno = ENOMEM;
return -1;
}
}
wstring = wpattern + patsize;
/* Convert the strings into wide characters. */
mbsrtowcs (wpattern, &pattern, patsize, &ps);
assert (mbsinit (&ps));
mbsrtowcs (wstring, &string, strsize, &ps);
res = internal_fnwmatch (wpattern, wstring, wstring + strsize - 1,
flags & FNM_PERIOD, flags);
if (__builtin_expect (! (totsize < ALLOCA_LIMIT), 0))
free (wpattern);
return res;
}
}
wstring = wpattern + patsize;
/* Convert the strings into wide characters. */
mbsrtowcs (wpattern, &pattern, patsize, &ps);
assert (mbsinit (&ps));
mbsrtowcs (wstring, &string, strsize, &ps);
res = internal_fnwmatch (wpattern, wstring, wstring + strsize - 1,
flags & FNM_PERIOD, flags);
if (__builtin_expect (! (totsize < ALLOCA_LIMIT), 0))
free (wpattern);
return res;
}
# endif /* HANDLE_MULTIBYTE */
return internal_fnmatch (pattern, string, string + strlen (string),
......
/* Copyright (C) 1991, 1992, 1993, 1996, 1997, 1998, 1999, 2001, 2002, 2003
Free Software Foundation, Inc.
/* Copyright (C) 1991, 1992, 1993, 1996, 1997, 1998, 1999, 2001, 2002, 2003,
2005 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
......@@ -11,10 +11,9 @@
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, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301 USA. */
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
#ifndef _FNMATCH_H
# define _FNMATCH_H 1
......@@ -52,7 +51,7 @@ extern "C" {
# define FNM_NOSYS (-1)
# endif
/* Match NAME against the filename pattern PATTERN,
/* Match NAME against the file name pattern PATTERN,
returning zero if it matches, FNM_NOMATCH if not. */
extern int fnmatch (const char *__pattern, const char *__name,
int __flags);
......
/* Copyright (C) 1991,1992,1993,1996,1997,1998,1999,2000,2001,2002,2003,2004
/* Copyright (C) 1991,1992,1993,1996,1997,1998,1999,2000,2001,2002,2003,2004,2005
Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
......@@ -11,12 +11,11 @@
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, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301 USA. */
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
/* Match STRING against the filename pattern PATTERN, returning zero if
/* Match STRING against the file name pattern PATTERN, returning zero if
it matches, nonzero if not. */
static int EXT (INT opt, const CHAR *pattern, const CHAR *string,
const CHAR *string_end, bool no_leading_period, int flags)
......
......@@ -11,10 +11,9 @@
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, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301 USA. */
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
#if HAVE_CONFIG_H
# include <config.h>
......
......@@ -12,21 +12,20 @@
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, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301 USA. */
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
#ifndef GETPASS_H
#define GETPASS_H
# define GETPASS_H
/* Get getpass declaration, if available. */
#include <unistd.h>
# include <unistd.h>
#if defined HAVE_DECL_GETPASS && !HAVE_DECL_GETPASS
# if defined HAVE_DECL_GETPASS && !HAVE_DECL_GETPASS
/* Read a password of arbitrary length from /dev/tty or stdin. */
char *getpass (const char *prompt);
#endif
# endif
#endif /* GETPASS_H */
......
......@@ -11,10 +11,9 @@
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, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301 USA. */
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
/* written by Jim Meyering */
......
/* Determine the number of screen columns needed for a string.
Copyright (C) 2000-2004 Free Software Foundation, Inc.
Copyright (C) 2000-2005 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
......@@ -11,10 +11,9 @@
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, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301 USA. */
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
/* Written by Bruno Haible <haible@clisp.cons.org>. */
......@@ -92,7 +91,8 @@ int wcwidth ();
character string pointed to by STRING. If a non-printable character
occurs, and MBSW_REJECT_UNPRINTABLE is specified, -1 is returned.
With flags = MBSW_REJECT_INVALID | MBSW_REJECT_UNPRINTABLE, this is
the multibyte analogue of the wcswidth function. */
the multibyte analogue of the wcswidth function.
If STRING is not of length < INT_MAX / 2, integer overflow can occur. */
int
mbswidth (const char *string, int flags)
{
......@@ -102,7 +102,8 @@ mbswidth (const char *string, int flags)
/* Returns the number of columns needed to represent the multibyte
character string pointed to by STRING of length NBYTES. If a
non-printable character occurs, and MBSW_REJECT_UNPRINTABLE is
specified, -1 is returned. */
specified, -1 is returned.
If NBYTES is not < INT_MAX / 2, integer overflow can occur. */
int
mbsnwidth (const char *string, size_t nbytes, int flags)
{
......
......@@ -11,10 +11,9 @@
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, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301 USA. */
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
#include <stddef.h>
......
......@@ -14,10 +14,9 @@
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, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301 USA. */
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
#ifdef HAVE_CONFIG_H
# include <config.h>
......
......@@ -17,10 +17,9 @@
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, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301 USA. */
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
/* Summary:
......
......@@ -11,10 +11,9 @@
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, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301 USA. */
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
/* written by Jim Meyering */
......
/* Copyright (C) 1992,1995-1999,2000-2004 Free Software Foundation, Inc.
/* Copyright (C) 1992,1995-1999,2000-2003 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
......@@ -11,10 +11,9 @@
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, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301 USA. */
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
#if HAVE_CONFIG_H
# include <config.h>
......
......@@ -11,10 +11,9 @@
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, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301 USA. */
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
#if HAVE_SETENV || HAVE_UNSETENV
......
......@@ -12,10 +12,9 @@
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, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301 USA. */
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
#ifdef HAVE_CONFIG_H
# include <config.h>
......
......@@ -12,10 +12,9 @@
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, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301 USA. */
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
#ifndef SNPRINTF_H
#define SNPRINTF_H
......
/* strcasecmp.c -- case insensitive string comparator
Copyright (C) 1998, 1999 Free Software Foundation, Inc.
/* Case-insensitive string comparison function.
Copyright (C) 1998, 1999, 2005 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2005,
based on earlier glibc code.
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
......@@ -13,54 +15,227 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
#if HAVE_CONFIG_H
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#ifdef LENGTH_LIMIT
# define STRXCASECMP_FUNCTION strncasecmp
# define STRXCASECMP_DECLARE_N , size_t n
# define LENGTH_LIMIT_EXPR(Expr) Expr
#else
# define STRXCASECMP_FUNCTION strcasecmp
# define STRXCASECMP_DECLARE_N /* empty */
# define LENGTH_LIMIT_EXPR(Expr) 0
#endif
/* Specification. */
#include "strcase.h"
#include <sys/types.h>
#include <ctype.h>
#define TOLOWER(Ch) (isupper (Ch) ? tolower (Ch) : (Ch))
#if HAVE_MBRTOWC
/* Compare {{no more than N characters of }}strings S1 and S2,
ignoring case, returning less than, equal to or
greater than zero if S1 is lexicographically less
than, equal to or greater than S2. */
#include "strnlen1.h"
int
STRXCASECMP_FUNCTION (const char *s1, const char *s2 STRXCASECMP_DECLARE_N)
/* Like mbiter.h, except it doesn't look at the entire string. */
#include "mbchar.h"
#include <assert.h>
#include <stdbool.h>
#include <stdlib.h>
#include <wchar.h>
#include <wctype.h>
struct mbiter_multi
{
bool at_end; /* true if the end of the string has been reached */
bool in_shift; /* true if next byte may not be interpreted as ASCII */
mbstate_t state; /* if in_shift: current shift state */
bool next_done; /* true if mbi_avail has already filled the following */
struct mbchar cur; /* the current character:
const char *cur.ptr pointer to current character
The following are only valid after mbi_avail.
size_t cur.bytes number of bytes of current character
bool cur.wc_valid true if wc is a valid wide character
wchar_t cur.wc if wc_valid: the current character
*/
};
static inline void
mbiter_multi_next (struct mbiter_multi *iter)
{
register const unsigned char *p1 = (const unsigned char *) s1;
register const unsigned char *p2 = (const unsigned char *) s2;
unsigned char c1, c2;
if (iter->next_done)
return;
if (iter->in_shift)
goto with_shift;
/* Handle most ASCII characters quickly, without calling mbrtowc(). */
if (is_basic (*iter->cur.ptr))
{
/* These characters are part of the basic character set. ISO C 99
guarantees that their wide character code is identical to their
char code. */
iter->cur.bytes = 1;
iter->cur.wc = *iter->cur.ptr;
iter->cur.wc_valid = true;
}
else
{
assert (mbsinit (&iter->state));
iter->in_shift = true;
with_shift:
iter->cur.bytes = mbrtowc (&iter->cur.wc, iter->cur.ptr,
strnlen1 (iter->cur.ptr, MB_CUR_MAX),
&iter->state);
if (iter->cur.bytes == (size_t) -1)
{
/* An invalid multibyte sequence was encountered. */
iter->cur.bytes = 1;
iter->cur.wc_valid = false;
/* Whether to set iter->in_shift = false and reset iter->state
or not is not very important; the string is bogus anyway. */
}
else if (iter->cur.bytes == (size_t) -2)
{
/* An incomplete multibyte character at the end. */
iter->cur.bytes = strlen (iter->cur.ptr) + 1;
iter->cur.wc_valid = false;
/* Whether to set iter->in_shift = false and reset iter->state
or not is not important; the string end is reached anyway. */
}
else
{
if (iter->cur.bytes == 0)
{
/* A null wide character was encountered. */
iter->cur.bytes = 1;
assert (*iter->cur.ptr == '\0');
assert (iter->cur.wc == 0);
}
iter->cur.wc_valid = true;
/* When in the initial state, we can go back treating ASCII
characters more quickly. */
if (mbsinit (&iter->state))
iter->in_shift = false;
}
}
iter->next_done = true;
}
static inline void
mbiter_multi_reloc (struct mbiter_multi *iter, ptrdiff_t ptrdiff)
{
iter->cur.ptr += ptrdiff;
}
if (p1 == p2 || LENGTH_LIMIT_EXPR (n == 0))
/* Iteration macros. */
typedef struct mbiter_multi mbi_iterator_t;
#define mbi_init(iter, startptr) \
((iter).cur.ptr = (startptr), (iter).at_end = false, \
(iter).in_shift = false, memset (&(iter).state, '\0', sizeof (mbstate_t)), \
(iter).next_done = false)
#define mbi_avail(iter) \
(!(iter).at_end && (mbiter_multi_next (&(iter)), true))
#define mbi_advance(iter) \
((mb_isnul ((iter).cur) ? ((iter).at_end = true) : 0), \
(iter).cur.ptr += (iter).cur.bytes, (iter).next_done = false)
/* Access to the current character. */
#define mbi_cur(iter) (iter).cur
#define mbi_cur_ptr(iter) (iter).cur.ptr
#endif
#define TOLOWER(Ch) (isupper (Ch) ? tolower (Ch) : (Ch))
/* Compare strings S1 and S2, ignoring case, returning less than, equal to or
greater than zero if S1 is lexicographically less than, equal to or greater
than S2.
Note: This function may, in multibyte locales, return 0 for strings of
different lengths! */
int
strcasecmp (const char *s1, const char *s2)
{
if (s1 == s2)
return 0;
do
/* Be careful not to look at the entire extent of s1 or s2 until needed.
This is useful because when two strings differ, the difference is
most often already in the very few first characters. */
#if HAVE_MBRTOWC
if (MB_CUR_MAX > 1)
{
c1 = TOLOWER (*p1);
c2 = TOLOWER (*p2);
mbi_iterator_t iter1;
mbi_iterator_t iter2;
if (LENGTH_LIMIT_EXPR (--n == 0) || c1 == '\0')
break;
mbi_init (iter1, s1);
mbi_init (iter2, s2);
++p1;
++p2;
while (mbi_avail (iter1) && mbi_avail (iter2))
{
/* Sort invalid characters after all valid ones. */
if (!mbi_cur (iter1).wc_valid)
{
if (!mbi_cur (iter2).wc_valid)
{
/* Compare two invalid characters. */
int cmp;
if (mbi_cur (iter1).bytes > mbi_cur (iter2).bytes)
return 1;
if (mbi_cur (iter1).bytes < mbi_cur (iter2).bytes)
return -1;
cmp = memcmp (mbi_cur_ptr (iter1), mbi_cur_ptr (iter2),
mbi_cur (iter1).bytes);
if (cmp != 0)
return cmp;
}
else
/* mbi_cur (iter1) invalid, mbi_cur (iter2) valid. */
return 1;
}
else
{
if (!mbi_cur (iter2).wc_valid)
/* mbi_cur (iter1) valid, mbi_cur (iter2) invalid. */
return -1;
else
{
/* Compare two valid characters. */
wchar_t c1 = towlower (mbi_cur (iter1).wc);
wchar_t c2 = towlower (mbi_cur (iter2).wc);
if (c1 > c2)
return 1;
if (c1 < c2)
return -1;
}
}
mbi_advance (iter1);
mbi_advance (iter2);
}
if (mbi_avail (iter1))
/* s2 terminated before s1. */
return 1;
if (mbi_avail (iter2))
/* s1 terminated before s2. */
return -1;
return 0;
}
while (c1 == c2);
else
#endif
{
const unsigned char *p1 = (const unsigned char *) s1;
const unsigned char *p2 = (const unsigned char *) s2;
unsigned char c1, c2;
return c1 - c2;
do
{
c1 = TOLOWER (*p1);
c2 = TOLOWER (*p2);
if (c1 == '\0')
break;
++p1;
++p2;
}
while (c1 == c2);
return c1 - c2;
}
}
......
#define LENGTH_LIMIT
#include "strcasecmp.c"
/* strncasecmp.c -- case insensitive string comparator
Copyright (C) 1998, 1999 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 2, 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, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
#if HAVE_CONFIG_H
# include <config.h>
#endif
/* Specification. */
#include "strcase.h"
#include <ctype.h>
#define TOLOWER(Ch) (isupper (Ch) ? tolower (Ch) : (Ch))
/* Compare no more than N bytes of strings S1 and S2,
ignoring case, returning less than, equal to or
greater than zero if S1 is lexicographically less
than, equal to or greater than S2. */
int
strncasecmp (const char *s1, const char *s2, size_t n)
{
register const unsigned char *p1 = (const unsigned char *) s1;
register const unsigned char *p2 = (const unsigned char *) s2;
unsigned char c1, c2;
if (p1 == p2 || n == 0)
return 0;
do
{
c1 = TOLOWER (*p1);
c2 = TOLOWER (*p2);
if (--n == 0 || c1 == '\0')
break;
++p1;
++p2;
}
while (c1 == c2);
return c1 - c2;
}
......
......@@ -11,10 +11,9 @@
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, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301 USA. */
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
#if HAVE_CONFIG_H
# include <config.h>
......
/* Formatted output to strings.
Copyright (C) 1999, 2002-2004 Free Software Foundation, Inc.
Copyright (C) 1999, 2002 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
......@@ -11,10 +11,9 @@
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, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301 USA. */
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
#ifdef HAVE_CONFIG_H
# include <config.h>
......
......@@ -11,10 +11,9 @@
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, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301 USA. */
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
#ifndef _VASPRINTF_H
#define _VASPRINTF_H
......
......@@ -13,10 +13,9 @@
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, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301 USA. */
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
#ifndef XALLOC_H_
# define XALLOC_H_
......
/* xmalloc.c -- malloc with out of memory checking
Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
1999, 2000, 2002, 2003, 2004 Free Software Foundation, Inc.
1999, 2000, 2002, 2003, 2004, 2005 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
......@@ -13,10 +13,9 @@
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, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301 USA. */
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
#if HAVE_CONFIG_H
# include <config.h>
......@@ -31,6 +30,15 @@
# define SIZE_MAX ((size_t) -1)
#endif
/* 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 and supports the GNU API even on non-GNU platforms. */
#if defined HAVE_CALLOC || defined __GLIBC__
enum { HAVE_GNU_CALLOC = 1 };
#else
enum { HAVE_GNU_CALLOC = 0 };
#endif
/* Allocate an array of N objects, each with S bytes of memory,
dynamically, with error checking. S must be nonzero. */
......@@ -205,8 +213,11 @@ xcalloc (size_t n, size_t s)
{
void *p;
/* Test for overflow, since some calloc implementations don't have
proper overflow checks. */
if (xalloc_oversized (n, s) || (! (p = calloc (n, s)) && n != 0))
proper overflow checks. But omit overflow and size-zero tests if
HAVE_GNU_CALLOC, since GNU calloc catches overflow and never
returns NULL if successful. */
if ((! HAVE_GNU_CALLOC && xalloc_oversized (n, s))
|| (! (p = calloc (n, s)) && (HAVE_GNU_CALLOC || n != 0)))
xalloc_die ();
return p;
}
......
......@@ -12,10 +12,9 @@
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, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301 USA. */
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
#ifndef _XSIZE_H
#define _XSIZE_H
......
/* A more useful interface to strtol.
Copyright (C) 1995, 1996, 1998, 1999, 2000, 2001, 2003, 2004 Free
Software Foundation, Inc.
Copyright (C) 1995, 1996, 1998, 1999, 2000, 2001, 2003, 2004, 2005
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
......@@ -13,10 +13,9 @@
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, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301 USA. */
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
/* Written by Jim Meyering. */
......@@ -24,6 +23,8 @@
# include <config.h>
#endif
#include "xstrtol.h"
#ifndef __strtol
# define __strtol strtol
# define __strtol_t long int
......@@ -43,12 +44,7 @@
#include <stdlib.h>
#include <string.h>
/* The extra casts work around common compiler bugs. */
#define TYPE_SIGNED(t) (! ((t) 0 < (t) -1))
#define TYPE_MINIMUM(t) ((t) (TYPE_SIGNED (t) \
? ~ (t) 0 << (sizeof (t) * CHAR_BIT - 1) \
: (t) 0))
#define TYPE_MAXIMUM(t) ((t) (~ (t) 0 - TYPE_MINIMUM (t)))
#include "intprops.h"
#ifndef STRTOL_T_MINIMUM
# define STRTOL_T_MINIMUM TYPE_MINIMUM (__strtol_t)
......@@ -63,8 +59,6 @@
#define ISSPACE(c) (IN_CTYPE_DOMAIN (c) && isspace (c))
#include "xstrtol.h"
#if !HAVE_DECL_STRTOIMAX && !defined strtoimax
intmax_t strtoimax ();
#endif
......
......@@ -13,10 +13,9 @@
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, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301 USA. */
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
#ifndef XSTRTOL_H_
# define XSTRTOL_H_ 1
......
# argp.m4 serial 4
dnl Copyright (C) 2003, 2004 Free Software Foundation, Inc.
# argp.m4 serial 5
dnl Copyright (C) 2003-2005 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
......@@ -7,11 +7,15 @@ dnl with or without modifications, as long as this notice is preserved.
AC_DEFUN([gl_ARGP],
[
AC_REQUIRE([AC_C_INLINE])
AC_REQUIRE([gl_FUNC_GLIBC_UNLOCKED_IO])
AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
AC_REQUIRE([gl_GETOPT_SUBSTITUTE])
AC_CHECK_DECLS([program_invocation_name, program_invocation_short_name],,,
[#include <errno.h>])
AC_CHECK_DECLS_ONCE(
[clearerr_unlocked feof_unlocked ferror_unlocked
fflush_unlocked fgets_unlocked fputc_unlocked fputs_unlocked
fread_unlocked fwrite_unlocked getc_unlocked
getchar_unlocked putc_unlocked putchar_unlocked])
AC_CHECK_FUNCS_ONCE([flockfile funlockfile])
AC_CHECK_HEADERS_ONCE([features.h linewrap.h])
])
......
# exitfail.m4 serial 4
dnl Copyright (C) 2002, 2003 Free Software Foundation, Inc.
# exitfail.m4 serial 5
dnl Copyright (C) 2002, 2003, 2005 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
AC_DEFUN([gl_EXITFAIL],
[
AC_LIBSOURCES([exitfail.c, exitfail.h])
AC_LIBOBJ([exitfail])
dnl No prerequisites of lib/exitfail.c.
:
])
......
......@@ -21,6 +21,10 @@ AC_DEFUN([gl_USE_SYSTEM_EXTENSIONS], [
[/* Enable extensions on Solaris. */
#ifndef __EXTENSIONS__
# undef __EXTENSIONS__
#endif
#ifndef _POSIX_PTHREAD_SEMANTICS
# undef _POSIX_PTHREAD_SEMANTICS
#endif])
AC_DEFINE([__EXTENSIONS__])
AC_DEFINE([_POSIX_PTHREAD_SEMANTICS])
])
......
# getline.m4 serial 11
# getline.m4 serial 13
dnl Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Free Software
dnl Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2005 Free Software
dnl Foundation, Inc.
dnl
dnl This file is free software; the Free Software Foundation
......@@ -13,17 +13,21 @@ dnl See if there's a working, system-supplied version of the getline function.
dnl We can't just do MU_REPLACE_FUNCS(getline) because some systems
dnl have a function by that name in -linet that doesn't have anything
dnl to do with the function we need.
AC_DEFUN([AM_FUNC_GETLINE],
AC_DEFUN([gl_FUNC_GETLINE],
[
dnl Persuade glibc <stdio.h> to declare getline() and getdelim().
MU_LIBSOURCES([getline.c, getline.h])
dnl Persuade glibc <stdio.h> to declare getline().
AC_REQUIRE([AC_GNU_SOURCE])
am_getline_needs_run_time_check=no
AC_CHECK_DECLS([getline])
gl_getline_needs_run_time_check=no
AC_CHECK_FUNC(getline,
dnl Found it in some library. Verify that it works.
am_getline_needs_run_time_check=yes,
gl_getline_needs_run_time_check=yes,
am_cv_func_working_getline=no)
if test $am_getline_needs_run_time_check = yes; then
if test $gl_getline_needs_run_time_check = yes; then
AC_CACHE_CHECK([for working getline function], am_cv_func_working_getline,
[echo fooN |tr -d '\012'|tr N '\012' > conftest.data
AC_TRY_RUN([
......@@ -55,20 +59,12 @@ AC_DEFUN([AM_FUNC_GETLINE],
[Define to a replacement function name for getline().])
MU_LIBOBJ(getline)
# Avoid multiple inclusions of getndelim2.o into LIBOBJS.
# This hack won't be needed after gnulib requires Autoconf 2.58 or later.
case " $LIB@&t@OBJS " in
*" getndelim2.$ac_objext "* ) ;;
*) MU_LIBOBJ(getndelim2);;
esac
gl_PREREQ_GETLINE
gl_PREREQ_GETNDELIM2
fi
])
# Prerequisites of lib/getline.c.
AC_DEFUN([gl_PREREQ_GETLINE],
[
AC_CHECK_FUNCS(getdelim)
gl_FUNC_GETDELIM
])
......
# getopt.m4 serial 7
dnl Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
# getopt.m4 serial 10
dnl Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
......@@ -10,33 +10,69 @@ dnl with or without modifications, as long as this notice is preserved.
AC_DEFUN([gl_GETOPT_SUBSTITUTE],
[
GETOPT_H=getopt.h
MU_LIBOBJ([getopt])
MU_LIBOBJ([getopt1])
gl_GETOPT_SUBSTITUTE_HEADER
gl_PREREQ_GETOPT
])
AC_DEFUN([gl_GETOPT_SUBSTITUTE_HEADER],
[
GETOPT_H=getopt.h
AC_DEFINE([__GETOPT_PREFIX], [[rpl_]],
[Define to rpl_ if the getopt replacement functions and variables
should be used.])
AC_SUBST([GETOPT_H])
])
AC_DEFUN([gl_GETOPT],
AC_DEFUN([gl_GETOPT_CHECK_HEADERS],
[
gl_PREREQ_GETOPT
GETOPT_H=
AC_CHECK_HEADERS([getopt.h], [], [GETOPT_H=getopt.h])
if test -z "$GETOPT_H"; then
GETOPT_H=
AC_CHECK_HEADERS([getopt.h], [], [GETOPT_H=getopt.h])
AC_CHECK_FUNCS([getopt_long_only], [], [GETOPT_H=getopt.h])
fi
dnl BSD getopt_long uses an incompatible method to reset option processing,
dnl and (as of 2004-10-15) mishandles optional option-arguments.
dnl BSD getopt_long uses an incompatible method to reset option processing,
dnl and (as of 2004-10-15) mishandles optional option-arguments.
if test -z "$GETOPT_H"; then
AC_CHECK_DECL([optreset], [GETOPT_H=getopt.h], [], [#include <getopt.h>])
fi
if test -n "$GETOPT_H"; then
gl_GETOPT_SUBSTITUTE
dnl Solaris 10 getopt doesn't handle `+' as a leading character in an
dnl option string (as of 2005-05-05).
if test -z "$GETOPT_H"; then
AC_CACHE_CHECK([for working GNU getopt function], [gl_cv_func_gnu_getopt],
[AC_RUN_IFELSE(
[AC_LANG_PROGRAM([#include <getopt.h>],
[[
char *myargv[3];
myargv[0] = "conftest";
myargv[1] = "-+";
myargv[2] = 0;
return getopt (2, myargv, "+a") != '?';
]])],
[gl_cv_func_gnu_getopt=yes],
[gl_cv_func_gnu_getopt=no],
[dnl cross compiling - pessimistically guess based on decls
dnl Solaris 10 getopt doesn't handle `+' as a leading character in an
dnl option string (as of 2005-05-05).
AC_CHECK_DECL([getopt_clip],
[gl_cv_func_gnu_getopt=no], [gl_cv_func_gnu_getopt=yes],
[#include <getopt.h>])])])
if test "$gl_cv_func_gnu_getopt" = "no"; then
GETOPT_H=getopt.h
fi
fi
])
AC_DEFUN([gl_GETOPT_IFELSE],
[
AC_REQUIRE([gl_GETOPT_CHECK_HEADERS])
AS_IF([test -n "$GETOPT_H"], [$1], [$2])
])
AC_DEFUN([gl_GETOPT], [gl_GETOPT_IFELSE([gl_GETOPT_SUBSTITUTE])])
# Prerequisites of lib/getopt*.
AC_DEFUN([gl_PREREQ_GETOPT], [:])
......
# getpass.m4 serial 5
dnl Copyright (C) 2002-2003 Free Software Foundation, Inc.
# getpass.m4 serial 6
dnl Copyright (C) 2002-2003, 2005 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
......@@ -7,6 +7,8 @@ dnl with or without modifications, as long as this notice is preserved.
# Provide a getpass() function if the system doesn't have it.
AC_DEFUN([gl_FUNC_GETPASS],
[
AC_LIBSOURCES([getpass.c, getpass.h])
AC_REPLACE_FUNCS(getpass)
AC_CHECK_DECLS_ONCE(getpass)
if test $ac_cv_func_getpass = no; then
......@@ -18,6 +20,8 @@ AC_DEFUN([gl_FUNC_GETPASS],
# arbitrary length (not just 8 bytes as on HP-UX).
AC_DEFUN([gl_FUNC_GETPASS_GNU],
[
AC_LIBSOURCES([getpass.c, getpass.h])
AC_CHECK_DECLS_ONCE(getpass)
dnl TODO: Detect when GNU getpass() is already found in glibc.
AC_LIBOBJ(getpass)
......
# This file is generated automatically. Please, do not edit.
#
AC_DEFUN([libmailutils_GNULIB],[
AC_DEFUN([libmuaux_GNULIB],[
# allocsa
gl_ALLOCSA
......@@ -12,8 +12,8 @@ gl_ERROR
# exitfail
gl_EXITFAIL
# stdbool
AM_STDBOOL_H
# xalloc
gl_XALLOC
# xalloc
gl_XALLOC
......@@ -48,11 +48,13 @@ gl_XSTRTOL
# vasprintf
gl_FUNC_VASPRINTF
# xalloc-die
# xsize
gl_XSIZE
])
AC_DEFUN([libmailbox_GNULIB],[
AC_DEFUN([libmailutils_GNULIB],[
# alloca
# alloca-opt
......@@ -62,7 +64,7 @@ gl_FUNC_ALLOCA
gl_ARGP
# getline
AM_FUNC_GETLINE
gl_FUNC_GETLINE
# regex
gl_REGEX
......@@ -76,19 +78,35 @@ gl_MD5
# extensions
dnl gl_USE_SYSTEM_EXTENSIONS must be added quite early to configure.ac.
# getdelim
gl_FUNC_GETDELIM
# getopt
gl_GETOPT
# gettext
# gettext-h
# mbchar
gl_MBCHAR
# memchr
gl_FUNC_MEMCHR
# mempcpy
gl_FUNC_MEMPCPY
# minmax
gl_MINMAX
# restrict
gl_C_RESTRICT
# size_max
gl_SIZE_MAX
# stdbool
AM_STDBOOL_H
# strcase
gl_STRCASE
......@@ -101,6 +119,8 @@ gl_FUNC_STRNDUP
# strnlen
gl_FUNC_STRNLEN
# strnlen1
# sysexits
gl_SYSEXITS
......
# longdouble.m4 serial 1 (gettext-0.12)
dnl Copyright (C) 2002-2003 Free Software Foundation, Inc.
dnl This file is free software, distributed under the terms of the GNU
dnl General Public License. As a special exception to the GNU General
dnl Public License, this file may be distributed as part of a program
dnl that contains a configuration script generated by Autoconf, under
dnl the same distribution terms as the rest of that program.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
dnl From Bruno Haible.
dnl Test whether the compiler supports the 'long double' type.
......
# mbrtowc.m4 serial 7
dnl Copyright (C) 2001-2002, 2004 Free Software Foundation, Inc.
# mbrtowc.m4 serial 8
dnl Copyright (C) 2001-2002, 2004-2005 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
......@@ -7,19 +7,25 @@ dnl with or without modifications, as long as this notice is preserved.
dnl From Paul Eggert
dnl This file can be removed, and gl_FUNC_MBRTOWC replaced with
dnl AC_FUNC_MBRTOWC, when autoconf 2.57 can be assumed everywhere.
dnl AC_FUNC_MBRTOWC, when autoconf 2.60 can be assumed everywhere.
AC_DEFUN([gl_FUNC_MBRTOWC],
[
dnl Same as AC_FUNC_MBRTOWC in autoconf-2.60.
AC_CACHE_CHECK([whether mbrtowc and mbstate_t are properly declared],
gl_cv_func_mbrtowc,
[AC_TRY_LINK(
[#include <wchar.h>],
[mbstate_t state; return ! (sizeof state && mbrtowc);],
[AC_LINK_IFELSE(
[AC_LANG_PROGRAM(
[[#include <wchar.h>]],
[[wchar_t wc;
char const s[] = "";
size_t n = 1;
mbstate_t state;
return ! (sizeof state && (mbrtowc) (&wc, s, n, &state));]])],
gl_cv_func_mbrtowc=yes,
gl_cv_func_mbrtowc=no)])
if test $gl_cv_func_mbrtowc = yes; then
AC_DEFINE(HAVE_MBRTOWC, 1,
AC_DEFINE([HAVE_MBRTOWC], 1,
[Define to 1 if mbrtowc and mbstate_t are properly declared.])
fi
])
......
# md5.m4 serial 6
dnl Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
# md5.m4 serial 7
dnl Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
AC_DEFUN([gl_MD5],
[
MU_LIBSOURCES([md5.c, md5.h])
MU_LIBOBJ([md5])
dnl Prerequisites of lib/md5.h.
AC_REQUIRE([gl_AC_TYPE_UINT32_T])
......
# onceonly_2_57.m4 serial 3
dnl Copyright (C) 2002-2003 Free Software Foundation, Inc.
dnl Copyright (C) 2002-2003, 2005 Free Software Foundation, Inc.
dnl This file is free software, distributed under the terms of the GNU
dnl General Public License. As a special exception to the GNU General
dnl Public License, this file may be distributed as part of a program
......@@ -27,7 +27,7 @@ dnl thus reducing the size of 'configure'. Works with autoconf-2.57. The
dnl size reduction is ca. 9%.
dnl Autoconf version 2.57 or newer is recommended.
AC_PREREQ(2.54)
AC_PREREQ(2.57)
# AC_CHECK_HEADERS_ONCE(HEADER1 HEADER2 ...) is a once-only variant of
# AC_CHECK_HEADERS(HEADER1 HEADER2 ...).
......
#serial 22
#serial 24
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004 Free
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005 Free
# Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
......@@ -19,6 +19,10 @@ dnl Usage: gl_INCLUDED_REGEX([lib/regex.c])
dnl
AC_DEFUN([gl_INCLUDED_REGEX],
[
MU_LIBSOURCES(
[regcomp.c, regex.c, regex.h,
regex_internal.c, regex_internal.h, regexec.c])
dnl Even packages that don't use regex.c can use this macro.
dnl Of course, for them it doesn't do anything.
......@@ -31,75 +35,86 @@ AC_DEFUN([gl_INCLUDED_REGEX],
# regex.c. The first failing regular expression is from `Spencer ere
# test #75' in grep-2.3.
AC_CACHE_CHECK([for working re_compile_pattern],
jm_cv_func_working_re_compile_pattern,
AC_TRY_RUN(
[#include <stdio.h>
#include <string.h>
#include <regex.h>
int
main ()
{
static struct re_pattern_buffer regex;
const char *s;
struct re_registers regs;
re_set_syntax (RE_SYNTAX_POSIX_EGREP);
memset (&regex, 0, sizeof (regex));
[s = re_compile_pattern ("a[[:@:>@:]]b\n", 9, &regex);]
/* This should fail with _Invalid character class name_ error. */
if (!s)
exit (1);
/* This should succeed, but doesn't for e.g. glibc-2.1.3. */
memset (&regex, 0, sizeof (regex));
s = re_compile_pattern ("{1", 2, &regex);
if (s)
exit (1);
/* The following example is derived from a problem report
against gawk from Jorge Stolfi <stolfi@ic.unicamp.br>. */
memset (&regex, 0, sizeof (regex));
s = re_compile_pattern ("[[an\371]]*n", 7, &regex);
if (s)
exit (1);
/* This should match, but doesn't for e.g. glibc-2.2.1. */
if (re_match (&regex, "an", 2, 0, &regs) != 2)
exit (1);
memset (&regex, 0, sizeof (regex));
s = re_compile_pattern ("x", 1, &regex);
if (s)
exit (1);
/* The version of regex.c in e.g. GNU libc-2.2.93 didn't
work with a negative RANGE argument. */
if (re_search (&regex, "wxy", 3, 2, -2, &regs) != 1)
exit (1);
exit (0);
}
],
jm_cv_func_working_re_compile_pattern=yes,
jm_cv_func_working_re_compile_pattern=no,
dnl When crosscompiling, assume it's broken.
jm_cv_func_working_re_compile_pattern=no))
if test $jm_cv_func_working_re_compile_pattern = yes; then
[gl_cv_func_working_re_compile_pattern],
[AC_RUN_IFELSE(
[AC_LANG_PROGRAM(
[AC_INCLUDES_DEFAULT
#include <regex.h>],
[[static struct re_pattern_buffer regex;
const char *s;
struct re_registers regs;
re_set_syntax (RE_SYNTAX_POSIX_EGREP);
memset (&regex, 0, sizeof (regex));
s = re_compile_pattern ("a[:@:>@:]b\n", 9, &regex);
/* This should fail with _Invalid character class name_ error. */
if (!s)
exit (1);
/* This should succeed, but does not for e.g. glibc-2.1.3. */
memset (&regex, 0, sizeof (regex));
s = re_compile_pattern ("{1", 2, &regex);
if (s)
exit (1);
/* The following example is derived from a problem report
against gawk from Jorge Stolfi <stolfi@ic.unicamp.br>. */
memset (&regex, 0, sizeof (regex));
s = re_compile_pattern ("[an\371]*n", 7, &regex);
if (s)
exit (1);
/* This should match, but does not for e.g. glibc-2.2.1. */
if (re_match (&regex, "an", 2, 0, &regs) != 2)
exit (1);
memset (&regex, 0, sizeof (regex));
s = re_compile_pattern ("x", 1, &regex);
if (s)
exit (1);
/* The version of regex.c in e.g. GNU libc-2.2.93 did not
work with a negative RANGE argument. */
if (re_search (&regex, "wxy", 3, 2, -2, &regs) != 1)
exit (1);
/* The version of regex.c in older versions of gnulib
* ignored RE_ICASE. Detect that problem too. */
memset (&regex, 0, sizeof (regex));
re_set_syntax(RE_SYNTAX_EMACS|RE_ICASE);
s = re_compile_pattern ("x", 1, &regex);
if (s)
exit (1);
if (re_search (&regex, "WXY", 3, 0, 3, &regs) < 0)
exit (1);
/* REG_STARTEND was added to glibc on 2004-01-15.
Reject older versions. */
if (! REG_STARTEND)
exit (1);
exit (0);]])],
[gl_cv_func_working_re_compile_pattern=yes],
[gl_cv_func_working_re_compile_pattern=no],
dnl When crosscompiling, assume it is broken.
[gl_cv_func_working_re_compile_pattern=no])])
if test $gl_cv_func_working_re_compile_pattern = yes; then
ac_use_included_regex=no
fi
test -n "$1" || AC_MSG_ERROR([missing argument])
m4_syscmd([test -f $1])
m4_syscmd([test -f '$1'])
ifelse(m4_sysval, 0,
[
AC_ARG_WITH(included-regex,
[ --without-included-regex don't compile regex; this is the default on
systems with version 2 of the GNU C library
(use with caution on other system)],
jm_with_regex=$withval,
jm_with_regex=$ac_use_included_regex)
if test "$jm_with_regex" = yes; then
MU_LIBOBJ(regex)
AC_ARG_WITH([included-regex],
[ --without-included-regex don't compile regex; this is the default on
systems with recent-enough versions of the GNU C
Library (use with caution on other systems)],
[gl_with_regex=$withval],
[gl_with_regex=$ac_use_included_regex])
if test "X$gl_with_regex" = Xyes; then
MU_LIBOBJ([regex])
gl_PREREQ_REGEX
fi
],
......@@ -107,20 +122,11 @@ AC_DEFUN([gl_INCLUDED_REGEX],
]
)
# Prerequisites of lib/regex.c.
# Prerequisites of lib/regex.c and lib/regex_internal.c.
AC_DEFUN([gl_PREREQ_REGEX],
[
dnl FIXME: Maybe provide a btowc replacement someday: Solaris 2.5.1 lacks it.
dnl FIXME: Check for wctype and iswctype, and and add -lw if necessary
dnl to get them.
dnl Persuade glibc <string.h> to declare mempcpy().
AC_REQUIRE([AC_GNU_SOURCE])
AC_REQUIRE([gl_C_RESTRICT])
AC_REQUIRE([AC_FUNC_ALLOCA])
AC_REQUIRE([AC_HEADER_STDC])
AC_CHECK_HEADERS_ONCE(wchar.h wctype.h)
AC_CHECK_FUNCS_ONCE(isascii mempcpy)
AC_CHECK_FUNCS(btowc)
AC_REQUIRE([AM_LANGINFO_CODESET])
AC_CHECK_HEADERS_ONCE([locale.h wchar.h wctype.h])
AC_CHECK_FUNCS_ONCE([isblank mbrtowc mempcpy wcrtomb wcscoll])
])
......
# signed.m4 serial 1 (gettext-0.10.40)
dnl Copyright (C) 2001-2002 Free Software Foundation, Inc.
dnl This file is free software, distributed under the terms of the GNU
dnl General Public License. As a special exception to the GNU General
dnl Public License, this file may be distributed as part of a program
dnl that contains a configuration script generated by Autoconf, under
dnl the same distribution terms as the rest of that program.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
dnl From Bruno Haible.
......
# size_max.m4 serial 2
dnl Copyright (C) 2003 Free Software Foundation, Inc.
dnl This file is free software, distributed under the terms of the GNU
dnl General Public License. As a special exception to the GNU General
dnl Public License, this file may be distributed as part of a program
dnl that contains a configuration script generated by Autoconf, under
dnl the same distribution terms as the rest of that program.
# size_max.m4 serial 3
dnl Copyright (C) 2003, 2005 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
dnl From Bruno Haible.
......@@ -28,9 +26,9 @@ Found it
dnl than the type 'unsigned long'.
dnl The _AC_COMPUTE_INT macro works up to LONG_MAX, since it uses 'expr',
dnl which is guaranteed to work from LONG_MIN to LONG_MAX.
_AC_COMPUTE_INT([~(size_t)0 / 10], res_hi,
_AC_COMPUTE_INT([(size_t)~(size_t)0 / 10], res_hi,
[#include <stddef.h>], result=?)
_AC_COMPUTE_INT([~(size_t)0 % 10], res_lo,
_AC_COMPUTE_INT([(size_t)~(size_t)0 % 10], res_lo,
[#include <stddef.h>], result=?)
_AC_COMPUTE_INT([sizeof (size_t) <= sizeof (unsigned int)], fits_in_uint,
[#include <stddef.h>], result=?)
......@@ -50,7 +48,7 @@ Found it
fi
else
dnl Shouldn't happen, but who knows...
result='~(size_t)0'
result='((size_t)~(size_t)0)'
fi
fi
AC_MSG_RESULT([$result])
......
# strcase.m4 serial 1
dnl Copyright (C) 2002 Free Software Foundation, Inc.
# strcase.m4 serial 2
dnl Copyright (C) 2002, 2005 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
......@@ -12,10 +12,11 @@ AC_DEFUN([gl_STRCASE],
AC_DEFUN([gl_FUNC_STRCASECMP],
[
MU_REPLACE_FUNCS(strcasecmp)
if test $ac_cv_func_strcasecmp = no; then
gl_PREREQ_STRCASECMP
fi
dnl No known system has a strcasecmp() function that works correctly in
dnl multibyte locales. Therefore we use our version always.
MU_LIBOBJ(strcasecmp)
AC_DEFINE(strcasecmp, rpl_strcasecmp, [Define to rpl_strcasecmp always.])
gl_PREREQ_STRCASECMP
])
AC_DEFUN([gl_FUNC_STRNCASECMP],
......@@ -28,7 +29,7 @@ AC_DEFUN([gl_FUNC_STRNCASECMP],
# Prerequisites of lib/strcasecmp.c.
AC_DEFUN([gl_PREREQ_STRCASECMP], [
:
gl_FUNC_MBRTOWC
])
# Prerequisites of lib/strncasecmp.c.
......
# strndup.m4 serial 3
dnl Copyright (C) 2002, 2003 Free Software Foundation, Inc.
# strndup.m4 serial 5
dnl Copyright (C) 2002, 2003, 2005 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
AC_DEFUN([gl_FUNC_STRNDUP],
[
MU_LIBSOURCES([strndup.c, strndup.h])
dnl Persuade glibc <string.h> to declare strndup().
AC_REQUIRE([AC_GNU_SOURCE])
......@@ -16,6 +18,4 @@ AC_DEFUN([gl_FUNC_STRNDUP],
])
# Prerequisites of lib/strndup.c.
AC_DEFUN([gl_PREREQ_STRNDUP], [
AC_CHECK_DECLS(strnlen)
])
AC_DEFUN([gl_PREREQ_STRNDUP], [:])
......
# strnlen.m4 serial 4
dnl Copyright (C) 2002-2003 Free Software Foundation, Inc.
# strnlen.m4 serial 5
dnl Copyright (C) 2002-2003, 2005 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
AC_DEFUN([gl_FUNC_STRNLEN],
[
MU_LIBSOURCES([strnlen.c, strnlen.h])
dnl Persuade glibc <string.h> to declare strnlen().
AC_REQUIRE([AC_GNU_SOURCE])
......@@ -22,4 +24,6 @@ AC_DEFUN([gl_FUNC_STRNLEN],
])
# Prerequisites of lib/strnlen.c.
AC_DEFUN([gl_PREREQ_STRNLEN], [:])
AC_DEFUN([gl_PREREQ_STRNLEN], [
AC_CHECK_DECLS_ONCE(strnlen)
])
......
# unlocked-io.m4 serial 11
# unlocked-io.m4 serial 12
# Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free Software
# Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software
# Foundation, Inc.
#
# This file is free software; the Free Software Foundation
......@@ -17,6 +17,8 @@ dnl on Solaris 2.6).
AC_DEFUN([gl_FUNC_GLIBC_UNLOCKED_IO],
[
MU_LIBSOURCES([unlocked-io.h])
AC_DEFINE([USE_UNLOCKED_IO], 1,
[Define to 1 if you want getc etc. to use unlocked I/O if available.
Unlocked I/O can improve performance in unithreaded apps,
......
# wchar_t.m4 serial 1 (gettext-0.12)
dnl Copyright (C) 2002-2003 Free Software Foundation, Inc.
dnl This file is free software, distributed under the terms of the GNU
dnl General Public License. As a special exception to the GNU General
dnl Public License, this file may be distributed as part of a program
dnl that contains a configuration script generated by Autoconf, under
dnl the same distribution terms as the rest of that program.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
dnl From Bruno Haible.
dnl Test whether <stddef.h> has the 'wchar_t' type.
......
# wint_t.m4 serial 1 (gettext-0.12)
dnl Copyright (C) 2003 Free Software Foundation, Inc.
dnl This file is free software, distributed under the terms of the GNU
dnl General Public License. As a special exception to the GNU General
dnl Public License, this file may be distributed as part of a program
dnl that contains a configuration script generated by Autoconf, under
dnl the same distribution terms as the rest of that program.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
dnl From Bruno Haible.
dnl Test whether <wchar.h> has the 'wint_t' type.
......
# xalloc.m4 serial 11
dnl Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
# xalloc.m4 serial 12
dnl Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
AC_DEFUN([gl_XALLOC],
[
AC_LIBSOURCES([xmalloc.c, xalloc.h])
AC_LIBOBJ([xmalloc])
gl_PREREQ_XALLOC
gl_PREREQ_XMALLOC
])
......
# xsize.m4 serial 2
dnl Copyright (C) 2003 Free Software Foundation, Inc.
dnl This file is free software, distributed under the terms of the GNU
dnl General Public License. As a special exception to the GNU General
dnl Public License, this file may be distributed as part of a program
dnl that contains a configuration script generated by Autoconf, under
dnl the same distribution terms as the rest of that program.
# xsize.m4 serial 3
dnl Copyright (C) 2003-2004 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
AC_DEFUN([gl_XSIZE],
[
dnl Prerequisites of lib/xsize.h.
AC_REQUIRE([gl_SIZE_MAX])
AC_REQUIRE([AC_C_INLINE])
AC_CHECK_HEADERS(stdint.h)
])
......
# xstrtol.m4 serial 5
dnl Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
#serial 7
dnl Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
AC_DEFUN([gl_XSTRTOL],
[
AC_LIBSOURCES([xstrtol.c, xstrtol.h, xstrtoul.c, intprops.h])
AC_LIBOBJ([xstrtol])
AC_LIBOBJ([xstrtoul])
AC_REQUIRE([gl_PREREQ_XSTRTOL])
AC_REQUIRE([gl_PREREQ_XSTRTOUL])
])
......
......@@ -111,9 +111,8 @@ libmailutils_la_LDFLAGS = -version-info 0:0:0
BUILT_SOURCES += $(ALLOCA_H)
EXTRA_DIST += alloca_.h
# We need the following in order to create an <alloca.h> when the system
# We need the following in order to create <alloca.h> when the system
# doesn't have one that works with the given compiler.
all-local $(libmailutils_la_OBJECTS): $(ALLOCA_H)
alloca.h: alloca_.h
cp $(srcdir)/alloca_.h $@-t
mv $@-t $@
......@@ -123,22 +122,18 @@ libmailutils_la_SOURCES += argp.h argp-ba.c argp-eexst.c \
argp-fmtstream.c argp-fmtstream.h argp-fs-xinl.c argp-help.c \
argp-namefrob.h argp-parse.c argp-pv.c argp-pvh.c argp-xinl.c
libmailutils_la_SOURCES += getline.h
EXTRA_DIST += getndelim2.h getndelim2.c
libmailutils_la_SOURCES += regex.h
libmailutils_la_SOURCES += strtok_r.h
libmailutils_la_SOURCES += md5.h md5.c
BUILT_SOURCES += $(GETOPT_H)
EXTRA_DIST += getopt_.h getopt_int.h
# We need the following in order to create an <getopt.h> when the system
# We need the following in order to create <getopt.h> when the system
# doesn't have one that works with the given compiler.
all-local $(libmailutils_la_OBJECTS): $(GETOPT_H)
getopt.h: getopt_.h
cp $(srcdir)/getopt_.h $@-t
mv $@-t $@
......@@ -146,28 +141,42 @@ MOSTLYCLEANFILES += getopt.h getopt.h-t
libmailutils_la_SOURCES += gettext.h
libmailutils_la_SOURCES += mbchar.h mbchar.c
libmailutils_la_SOURCES += minmax.h
BUILT_SOURCES += $(STDBOOL_H)
EXTRA_DIST += stdbool_.h
# We need the following in order to create <stdbool.h> when the system
# doesn't have one that works.
stdbool.h: stdbool_.h
sed -e 's/@''HAVE__BOOL''@/$(HAVE__BOOL)/g' < $(srcdir)/stdbool_.h > $@-t
mv $@-t $@
MOSTLYCLEANFILES += stdbool.h stdbool.h-t
libmailutils_la_SOURCES += strcase.h
libmailutils_la_SOURCES += strchrnul.h
libmailutils_la_SOURCES += strndup.h
libmailutils_la_SOURCES += strnlen1.h strnlen1.c
BUILT_SOURCES += $(SYSEXITS_H)
EXTRA_DIST += sysexit_.h
# We need the following in order to create a <sysexits.h> when the system
# We need the following in order to create <sysexits.h> when the system
# doesn't have one that works with the given compiler.
all-local $(libmailutils_la_OBJECTS): $(SYSEXITS_H)
sysexits.h: sysexit_.h
cp $(srcdir)/sysexit_.h sysexits.h-t
mv sysexits.h-t sysexits.h
MOSTLYCLEANFILES += sysexits.h sysexits.h-t
libmailutils_la_SOURCES += unlocked-io.h
libmailutils_la_SOURCES += printf-args.h printf-parse.h vasnprintf.h
......@@ -175,4 +184,4 @@ libmailutils_la_SOURCES += vsnprintf.h
libmailutils_la_SOURCES += xsize.h
EXTRA_DIST += regex.c getline.c getline.c getndelim2.c getndelim2.c getopt.c getopt1.c mempcpy.c mempcpy.h mempcpy.c strcasecmp.c strncasecmp.c strchrnul.c strndup.c strnlen.c strtok_r.c vasnprintf.c printf-args.c printf-parse.c asnprintf.c vsnprintf.c
EXTRA_DIST += getdelim.c getdelim.h getdelim.c getopt.c getopt1.c md5.c md5.h md5.c memchr.c mempcpy.c mempcpy.h mempcpy.c vasnprintf.c printf-args.c printf-parse.c asnprintf.c getline.c getline.c getline.h getline.c getndelim2.c vsnprintf.c unlocked-io.h strchrnul.c regex.c strcasecmp.c strncasecmp.c strndup.c strndup.h strndup.c strnlen.c strnlen.h strnlen.c strtok_r.c
......
......@@ -14,9 +14,9 @@
General Public License for more details.
You should have received a copy of the GNU General Public
License along with this program; if not, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301 USA. */
License along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
USA. */
/* Avoid using the symbol _ALLOCA_H here, as Bison assumes _ALLOCA_H
means there is a real alloca function. */
......
......@@ -14,9 +14,9 @@
General Public License for more details.
You should have received a copy of the GNU General Public
License along with this program; if not, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301 USA. */
License along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
USA. */
/* Avoid using the symbol _ALLOCA_H here, as Bison assumes _ALLOCA_H
means there is a real alloca function. */
......
......@@ -13,10 +13,9 @@
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, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301 USA. */
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
/* If set by the user program, it should point to string that is the
bug-reporting address for the program. It will be printed by argp_help if
......
......@@ -13,10 +13,9 @@
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, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301 USA. */
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
#ifdef HAVE_CONFIG_H
#include <config.h>
......
/* Word-wrapping and line-truncating streams
Copyright (C) 1997,1998,1999,2001,2002,2003 Free Software Foundation, Inc.
Copyright (C) 1997-1999,2001,2002,2003,2005 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Written by Miles Bader <miles@gnu.ai.mit.edu>.
......@@ -13,10 +13,9 @@
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, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301 USA. */
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
/* This package emulates glibc `line_wrap_stream' semantics for systems that
don't have that. */
......@@ -102,11 +101,10 @@ __argp_fmtstream_free (argp_fmtstream_t fs)
if (fs->p > fs->buf)
{
#ifdef USE_IN_LIBIO
if (_IO_fwide (fs->stream, 0) > 0)
__fwprintf (fs->stream, L"%.*s", (int) (fs->p - fs->buf), fs->buf);
else
__fxprintf (fs->stream, "%.*s", (int) (fs->p - fs->buf), fs->buf);
#else
fwrite_unlocked (fs->buf, 1, fs->p - fs->buf, fs->stream);
#endif
fwrite_unlocked (fs->buf, 1, fs->p - fs->buf, fs->stream);
}
free (fs->buf);
free (fs);
......@@ -291,17 +289,15 @@ __argp_fmtstream_update (argp_fmtstream_t fs)
else
/* Output the first line so we can use the space. */
{
#ifdef USE_IN_LIBIO
if (_IO_fwide (fs->stream, 0) > 0)
__fwprintf (fs->stream, L"%.*s\n",
(int) (nl - fs->buf), fs->buf);
else
#ifdef _LIBC
__fxprintf (fs->stream, "%.*s\n",
(int) (nl - fs->buf), fs->buf);
#else
if (nl > fs->buf)
fwrite_unlocked (fs->buf, 1, nl - fs->buf, fs->stream);
putc_unlocked ('\n', fs->stream);
#endif
{
if (nl > fs->buf)
fwrite_unlocked (fs->buf, 1, nl - fs->buf, fs->stream);
putc_unlocked ('\n', fs->stream);
}
len += buf - fs->buf;
nl = buf = fs->buf;
}
......@@ -360,15 +356,12 @@ __argp_fmtstream_ensure (struct argp_fmtstream *fs, size_t amount)
/* Flush FS's buffer. */
__argp_fmtstream_update (fs);
#ifdef USE_IN_LIBIO
if (_IO_fwide (fs->stream, 0) > 0)
{
__fwprintf (fs->stream, L"%.*s", (int) (fs->p - fs->buf), fs->buf);
wrote = fs->p - fs->buf;
}
else
#ifdef _LIBC
__fxprintf (fs->stream, "%.*s", (int) (fs->p - fs->buf), fs->buf);
wrote = fs->p - fs->buf;
#else
wrote = fwrite_unlocked (fs->buf, 1, fs->p - fs->buf, fs->stream);
#endif
wrote = fwrite_unlocked (fs->buf, 1, fs->p - fs->buf, fs->stream);
if (wrote == fs->p - fs->buf)
{
fs->p = fs->buf;
......
......@@ -13,10 +13,9 @@
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, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301 USA. */
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
/* This package emulates glibc `line_wrap_stream' semantics for systems that
don't have that. If the system does have it, it is just a wrapper for
......
......@@ -13,10 +13,9 @@
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, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301 USA. */
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
#ifdef HAVE_CONFIG_H
#include <config.h>
......
......@@ -13,10 +13,9 @@
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, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301 USA. */
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
#ifndef _GNU_SOURCE
# define _GNU_SOURCE 1
......
......@@ -13,10 +13,9 @@
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, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301 USA. */
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
#if !_LIBC
/* This code is written for inclusion in gnu-libc, and uses names in the
......
......@@ -13,10 +13,9 @@
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, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301 USA. */
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
#ifdef HAVE_CONFIG_H
#include <config.h>
......
......@@ -13,10 +13,9 @@
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, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301 USA. */
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
/* If set by the user program to a non-zero value, then a default option
--version is added (unless the ARGP_NO_HELP flag is used), which will
......
......@@ -13,10 +13,9 @@
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, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301 USA. */
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
#ifdef HAVE_CONFIG_H
#include <config.h>
......
......@@ -13,10 +13,9 @@
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, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301 USA. */
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
#ifdef HAVE_CONFIG_H
#include <config.h>
......
......@@ -13,10 +13,9 @@
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, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301 USA. */
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
#ifndef _ARGP_H
#define _ARGP_H
......@@ -24,6 +23,7 @@
#include <stdio.h>
#include <ctype.h>
#include <getopt.h>
#include <limits.h>
#define __need_error_t
#include <errno.h>
......@@ -580,7 +580,7 @@ __NTH (__option_is_short (__const struct argp_option *__opt))
else
{
int __key = __opt->key;
return __key > 0 && isprint (__key);
return __key > 0 && __key <= UCHAR_MAX && isprint (__key);
}
}
......
......@@ -11,10 +11,9 @@
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, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301 USA. */
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
#ifdef HAVE_CONFIG_H
# include <config.h>
......
/* getline.c -- Replacement for GNU C library function getline
/* getline.c --- Implementation of replacement getline function.
Copyright (C) 2005 Free Software Foundation, Inc.
Copyright (C) 1993, 1996, 1997, 1998, 2000, 2003, 2004 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 2, or (at
your option) any later version.
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 2, 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.
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, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA. */
You should have received a copy of the GNU General Public
License along with this program; if not, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301 USA. */
/* Written by Jan Brittenson, bson@gnu.ai.mit.edu. */
/* Written by Simon Josefsson. */
#if HAVE_CONFIG_H
# include <config.h>
#endif
#include "getdelim.h"
#include "getline.h"
#if ! (defined __GNU_LIBRARY__ && HAVE_GETDELIM)
# include "getndelim2.h"
ssize_t
getdelim (char **lineptr, size_t *linesize, int delimiter, FILE *stream)
{
return getndelim2 (lineptr, linesize, 0, GETNLINE_NO_LIMIT, delimiter, EOF,
stream);
}
#endif
ssize_t
getline (char **lineptr, size_t *linesize, FILE *stream)
getline (char **lineptr, size_t *n, FILE *stream)
{
return getdelim (lineptr, linesize, '\n', stream);
return getdelim (lineptr, n, '\n', stream);
}
......
/* Replacement for GNU C library function getline
/* getline.h --- Prototype for replacement getline function.
Copyright (C) 2005 Free Software Foundation, Inc.
Copyright (C) 1995, 1997, 1999, 2000, 2001, 2002, 2003 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 2, or (at
your option) any later version.
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 2, 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.
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, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA. */
You should have received a copy of the GNU General Public
Licensealong with this program; if not, write to the Free
SoftwareFoundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
MA 02110-1301 USA. */
#ifndef GETLINE_H_
# define GETLINE_H_ 1
/* Written by Simon Josefsson. */
/* Get size_t, FILE, ssize_t. And getline, if available. */
# include <stddef.h>
# include <stdio.h>
/* Get ssize_t. */
# include <sys/types.h>
/* glibc2 has these functions declared in <stdio.h>. Avoid redeclarations. */
# if __GLIBC__ < 2
extern ssize_t getline (char **_lineptr, size_t *_linesize, FILE *_stream);
extern ssize_t getdelim (char **_lineptr, size_t *_linesize, int _delimiter,
FILE *_stream);
# endif
#endif /* not GETLINE_H_ */
#if !HAVE_DECL_GETLINE
ssize_t getline (char **lineptr, size_t *n, FILE *stream);
#endif /* !HAVE_GETLINE */
......
......@@ -16,10 +16,9 @@
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, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301 USA. */
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
/* This tells Alpha OSF/1 not to define a getopt prototype in <stdio.h>.
Ditto for AIX 3.2 and <stdlib.h>. */
......
......@@ -13,10 +13,9 @@
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, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301 USA. */
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
#ifdef HAVE_CONFIG_H
#include <config.h>
......
......@@ -13,10 +13,9 @@
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, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301 USA. */
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
#ifndef _GETOPT_H
......
......@@ -13,10 +13,9 @@
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, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301 USA. */
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
#ifndef _GETOPT_INT_H
#define _GETOPT_INT_H 1
......
/* Convenience header for conditional use of GNU <libintl.h>.
Copyright (C) 1995-1998, 2000-2002 Free Software Foundation, Inc.
Copyright (C) 1995-1998, 2000-2002, 2004 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
......@@ -11,10 +11,9 @@
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, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301 USA. */
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
#ifndef _LIBGETTEXT_H
#define _LIBGETTEXT_H 1
......@@ -37,6 +36,16 @@
# include <locale.h>
#endif
/* Many header files from the libstdc++ coming with g++ 3.3 or newer include
<libintl.h>, which chokes if dcgettext is defined as a macro. So include
it now, to make later inclusions of <libintl.h> a NOP. */
#if defined(__cplusplus) && defined(__GNUG__) && (__GNUC__ >= 3)
# include <cstdlib>
# if (__GLIBC__ >= 2) || _GLIBCXX_HAVE_LIBINTL_H
# include <libintl.h>
# endif
#endif
/* Disabled NLS.
The casts to 'const char *' serve the purpose of producing warnings
for invalid uses of the value returned from these functions.
......
......@@ -14,10 +14,9 @@
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, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301 USA. */
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
/* Written by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995. */
......
......@@ -17,10 +17,9 @@
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, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301 USA. */
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
#ifndef _MD5_H
#define _MD5_H 1
......
......@@ -11,10 +11,9 @@
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, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301 USA. */
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
/* Specification. */
#include "mempcpy.h"
......
......@@ -11,10 +11,9 @@
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, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301 USA. */
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
#ifndef mempcpy
......
/* MIN, MAX macros.
Copyright (C) 1995, 1998, 2001, 2003 Free Software Foundation, Inc.
Copyright (C) 1995, 1998, 2001, 2003, 2005 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
......@@ -11,10 +11,9 @@
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, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301 USA. */
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
#ifndef _MINMAX_H
#define _MINMAX_H
......@@ -25,8 +24,15 @@
#include this file as the last one among the #include list. */
/* Before we define the following symbols we get the <limits.h> file
since otherwise we get redefinitions on some systems. */
#include <limits.h>
since otherwise we get redefinitions on some systems if <limits.h> is
included after this file. Likewise for <sys/param.h>.
If more than one of these system headers define MIN and MAX, pick just
one of the headers (because the definitions most likely are the same). */
#if HAVE_MINMAX_IN_LIMITS_H
# include <limits.h>
#elif HAVE_MINMAX_IN_SYS_PARAM_H
# include <sys/param.h>
#endif
/* Note: MIN and MAX should be used with two arguments of the
same type. They might not return the minimum and maximum of their two
......
......@@ -11,10 +11,9 @@
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, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301 USA. */
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
#ifdef HAVE_CONFIG_H
# include <config.h>
......
......@@ -11,10 +11,9 @@
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, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301 USA. */
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
#ifndef _PRINTF_ARGS_H
#define _PRINTF_ARGS_H
......
......@@ -11,10 +11,9 @@
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, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301 USA. */
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
#ifdef HAVE_CONFIG_H
# include <config.h>
......
......@@ -11,10 +11,9 @@
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, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301 USA. */
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
#ifndef _PRINTF_PARSE_H
#define _PRINTF_PARSE_H
......
This diff could not be displayed because it is too large.
......@@ -14,10 +14,9 @@
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, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301 USA. */
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
#ifndef _REGEX_H
#define _REGEX_H 1
......@@ -170,6 +169,19 @@ typedef unsigned long int reg_syntax_t;
If not set, then case is significant. */
#define RE_ICASE (RE_INVALID_INTERVAL_ORD << 1)
/* This bit is used internally like RE_CONTEXT_INDEP_ANCHORS but only
for ^, because it is difficult to scan the regex backwards to find
whether ^ should be special. */
#define RE_CARET_ANCHORS_HERE (RE_ICASE << 1)
/* If this bit is set, then \{ cannot be first in an bre or
immediately after an alternation or begin-group operator. */
#define RE_CONTEXT_INVALID_DUP (RE_CARET_ANCHORS_HERE << 1)
/* If this bit is set, then no_sub will be set to 1 during
re_compile_pattern. */
#define RE_NO_SUB (RE_CONTEXT_INVALID_DUP << 1)
/* This global variable defines the particular regexp syntax to use (for
some interfaces). When a regexp is compiled, the syntax used is
stored in the pattern buffer, so changing this does not affect
......@@ -224,7 +236,7 @@ extern reg_syntax_t re_syntax_options;
| RE_INTERVALS | RE_NO_EMPTY_RANGES)
#define RE_SYNTAX_POSIX_BASIC \
(_RE_SYNTAX_POSIX_COMMON | RE_BK_PLUS_QM)
(_RE_SYNTAX_POSIX_COMMON | RE_BK_PLUS_QM | RE_CONTEXT_INVALID_DUP)
/* Differs from ..._POSIX_BASIC only in that RE_BK_PLUS_QM becomes
RE_LIMITED_OPS, i.e., \? \+ \| are not recognized. Actually, this
......@@ -289,6 +301,10 @@ extern reg_syntax_t re_syntax_options;
/* Like REG_NOTBOL, except for the end-of-line. */
#define REG_NOTEOL (1 << 1)
/* Use PMATCH[0] to delimit the start and end of the search in the
buffer. */
#define REG_STARTEND (1 << 2)
/* If any error codes are removed, changed, or added, update the
`re_error_msg' table in regex.c. */
......@@ -304,7 +320,7 @@ typedef enum
/* POSIX regcomp return error codes. (In the order listed in the
standard.) */
REG_BADPAT, /* Invalid pattern. */
REG_ECOLLATE, /* Not implemented. */
REG_ECOLLATE, /* Inalid collating element. */
REG_ECTYPE, /* Invalid character class name. */
REG_EESCAPE, /* Trailing backslash. */
REG_ESUBREG, /* Invalid back reference. */
......@@ -435,21 +451,38 @@ typedef struct
/* Declarations for routines. */
/* To avoid duplicating every routine declaration -- once with a
prototype (if we are ANSI), and once without (if we aren't) -- we
use the following macro to declare argument types. This
unfortunately clutters up the declarations a bit, but I think it's
worth it. */
#if __STDC__
# define _RE_ARGS(args) args
#else /* not __STDC__ */
# define _RE_ARGS(args) ()
#endif /* not __STDC__ */
/* Sets the current default syntax to SYNTAX, and return the old syntax.
You can also simply assign to the `re_syntax_options' variable. */
extern reg_syntax_t re_set_syntax (reg_syntax_t syntax);
extern reg_syntax_t re_set_syntax _RE_ARGS ((reg_syntax_t syntax));
/* Compile the regular expression PATTERN, with length LENGTH
and syntax given by the global `re_syntax_options', into the buffer
BUFFER. Return NULL if successful, and an error string if not. */
extern const char *re_compile_pattern (const char *pattern, size_t length,
struct re_pattern_buffer *buffer);
extern const char *re_compile_pattern
_RE_ARGS ((const char *pattern, size_t length,
struct re_pattern_buffer *buffer));
/* Compile a fastmap for the compiled pattern in BUFFER; used to
accelerate searches. Return 0 if successful and -2 if was an
internal error. */
extern int re_compile_fastmap (struct re_pattern_buffer *buffer);
extern int re_compile_fastmap _RE_ARGS ((struct re_pattern_buffer *buffer));
/* Search in the string STRING (with length LENGTH) for the pattern
......@@ -457,29 +490,31 @@ extern int re_compile_fastmap (struct re_pattern_buffer *buffer);
characters. Return the starting position of the match, -1 for no
match, or -2 for an internal error. Also return register
information in REGS (if REGS and BUFFER->no_sub are nonzero). */
extern int re_search (struct re_pattern_buffer *buffer, const char *string,
int length, int start, int range,
struct re_registers *regs);
extern int re_search
_RE_ARGS ((struct re_pattern_buffer *buffer, const char *string,
int length, int start, int range, struct re_registers *regs));
/* Like `re_search', but search in the concatenation of STRING1 and
STRING2. Also, stop searching at index START + STOP. */
extern int re_search_2 (struct re_pattern_buffer *buffer, const char *string1,
int length1, const char *string2, int length2,
int start, int range, struct re_registers *regs,
int stop);
extern int re_search_2
_RE_ARGS ((struct re_pattern_buffer *buffer, const char *string1,
int length1, const char *string2, int length2,
int start, int range, struct re_registers *regs, int stop));
/* Like `re_search', but return how many characters in STRING the regexp
in BUFFER matched, starting at position START. */
extern int re_match (struct re_pattern_buffer *buffer, const char *string,
int length, int start, struct re_registers *regs);
extern int re_match
_RE_ARGS ((struct re_pattern_buffer *buffer, const char *string,
int length, int start, struct re_registers *regs));
/* Relates to `re_match' as `re_search_2' relates to `re_search'. */
extern int re_match_2 (struct re_pattern_buffer *buffer, const char *string1,
int length1, const char *string2, int length2,
int start, struct re_registers *regs, int stop);
extern int re_match_2
_RE_ARGS ((struct re_pattern_buffer *buffer, const char *string1,
int length1, const char *string2, int length2,
int start, struct re_registers *regs, int stop));
/* Set REGS to hold NUM_REGS registers, storing them in STARTS and
......@@ -494,15 +529,15 @@ extern int re_match_2 (struct re_pattern_buffer *buffer, const char *string1,
Unless this function is called, the first search or match using
PATTERN_BUFFER will allocate its own register data, without
freeing the old data. */
extern void re_set_registers (struct re_pattern_buffer *buffer,
struct re_registers *regs, unsigned num_regs,
regoff_t *starts, regoff_t *ends);
extern void re_set_registers
_RE_ARGS ((struct re_pattern_buffer *buffer, struct re_registers *regs,
unsigned num_regs, regoff_t *starts, regoff_t *ends));
#if defined _REGEX_RE_COMP || defined _LIBC
# ifndef _CRAY
/* 4.2 bsd compatibility. */
extern char *re_comp (const char *);
extern int re_exec (const char *);
extern char *re_comp _RE_ARGS ((const char *));
extern int re_exec _RE_ARGS ((const char *));
# endif
#endif
......@@ -517,9 +552,9 @@ extern int re_exec (const char *);
# endif
# endif
#endif
/* gcc 3.1 and up support the [restrict] syntax. */
/* gcc 3.1 and up support the [restrict] syntax, but g++ doesn't. */
#ifndef __restrict_arr
# if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1)
# if (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1)) && !defined __cplusplus
# define __restrict_arr __restrict
# else
# define __restrict_arr
......@@ -527,19 +562,19 @@ extern int re_exec (const char *);
#endif
/* POSIX compatibility. */
extern int regcomp (regex_t *__restrict __preg,
const char *__restrict __pattern,
int __cflags);
extern int regcomp _RE_ARGS ((regex_t *__restrict __preg,
const char *__restrict __pattern,
int __cflags));
extern int regexec (const regex_t *__restrict __preg,
const char *__restrict __string, size_t __nmatch,
regmatch_t __pmatch[__restrict_arr],
int __eflags);
extern int regexec _RE_ARGS ((const regex_t *__restrict __preg,
const char *__restrict __string, size_t __nmatch,
regmatch_t __pmatch[__restrict_arr],
int __eflags));
extern size_t regerror (int __errcode, const regex_t *__preg,
char *__errbuf, size_t __errbuf_size);
extern size_t regerror _RE_ARGS ((int __errcode, const regex_t *__preg,
char *__errbuf, size_t __errbuf_size));
extern void regfree (regex_t *__preg);
extern void regfree _RE_ARGS ((regex_t *__preg));
#ifdef __cplusplus
......
/* Case-insensitive string comparison functions.
Copyright (C) 1995-1996, 2001, 2003 Free Software Foundation, Inc.
Copyright (C) 1995-1996, 2001, 2003, 2005 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
......@@ -11,10 +11,9 @@
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, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301 USA. */
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
#ifndef _STRCASE_H
#define _STRCASE_H
......@@ -30,7 +29,8 @@ extern "C" {
/* Compare strings S1 and S2, ignoring case, returning less than, equal to or
greater than zero if S1 is lexicographically less than, equal to or greater
than S2.
Note: This function does not work correctly in multibyte locales. */
Note: This function may, in multibyte locales, return 0 for strings of
different lengths! */
extern int strcasecmp (const char *s1, const char *s2);
/* Compare no more than N characters of strings S1 and S2, ignoring case,
......
/* strcasecmp.c -- case insensitive string comparator
Copyright (C) 1998, 1999 Free Software Foundation, Inc.
/* Case-insensitive string comparison function.
Copyright (C) 1998, 1999, 2005 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2005,
based on earlier glibc code.
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
......@@ -11,57 +13,229 @@
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, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301 USA. */
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
#if HAVE_CONFIG_H
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#ifdef LENGTH_LIMIT
# define STRXCASECMP_FUNCTION strncasecmp
# define STRXCASECMP_DECLARE_N , size_t n
# define LENGTH_LIMIT_EXPR(Expr) Expr
#else
# define STRXCASECMP_FUNCTION strcasecmp
# define STRXCASECMP_DECLARE_N /* empty */
# define LENGTH_LIMIT_EXPR(Expr) 0
#endif
/* Specification. */
#include "strcase.h"
#include <stddef.h>
#include <ctype.h>
#define TOLOWER(Ch) (isupper (Ch) ? tolower (Ch) : (Ch))
#if HAVE_MBRTOWC
/* Compare {{no more than N characters of }}strings S1 and S2,
ignoring case, returning less than, equal to or
greater than zero if S1 is lexicographically less
than, equal to or greater than S2. */
#include "strnlen1.h"
int
STRXCASECMP_FUNCTION (const char *s1, const char *s2 STRXCASECMP_DECLARE_N)
/* Like mbiter.h, except it doesn't look at the entire string. */
#include "mbchar.h"
#include <assert.h>
#include <stdbool.h>
#include <stdlib.h>
#include <wchar.h>
#include <wctype.h>
struct mbiter_multi
{
bool at_end; /* true if the end of the string has been reached */
bool in_shift; /* true if next byte may not be interpreted as ASCII */
mbstate_t state; /* if in_shift: current shift state */
bool next_done; /* true if mbi_avail has already filled the following */
struct mbchar cur; /* the current character:
const char *cur.ptr pointer to current character
The following are only valid after mbi_avail.
size_t cur.bytes number of bytes of current character
bool cur.wc_valid true if wc is a valid wide character
wchar_t cur.wc if wc_valid: the current character
*/
};
static inline void
mbiter_multi_next (struct mbiter_multi *iter)
{
register const unsigned char *p1 = (const unsigned char *) s1;
register const unsigned char *p2 = (const unsigned char *) s2;
unsigned char c1, c2;
if (iter->next_done)
return;
if (iter->in_shift)
goto with_shift;
/* Handle most ASCII characters quickly, without calling mbrtowc(). */
if (is_basic (*iter->cur.ptr))
{
/* These characters are part of the basic character set. ISO C 99
guarantees that their wide character code is identical to their
char code. */
iter->cur.bytes = 1;
iter->cur.wc = *iter->cur.ptr;
iter->cur.wc_valid = true;
}
else
{
assert (mbsinit (&iter->state));
iter->in_shift = true;
with_shift:
iter->cur.bytes = mbrtowc (&iter->cur.wc, iter->cur.ptr,
strnlen1 (iter->cur.ptr, MB_CUR_MAX),
&iter->state);
if (iter->cur.bytes == (size_t) -1)
{
/* An invalid multibyte sequence was encountered. */
iter->cur.bytes = 1;
iter->cur.wc_valid = false;
/* Whether to set iter->in_shift = false and reset iter->state
or not is not very important; the string is bogus anyway. */
}
else if (iter->cur.bytes == (size_t) -2)
{
/* An incomplete multibyte character at the end. */
iter->cur.bytes = strlen (iter->cur.ptr) + 1;
iter->cur.wc_valid = false;
/* Whether to set iter->in_shift = false and reset iter->state
or not is not important; the string end is reached anyway. */
}
else
{
if (iter->cur.bytes == 0)
{
/* A null wide character was encountered. */
iter->cur.bytes = 1;
assert (*iter->cur.ptr == '\0');
assert (iter->cur.wc == 0);
}
iter->cur.wc_valid = true;
/* When in the initial state, we can go back treating ASCII
characters more quickly. */
if (mbsinit (&iter->state))
iter->in_shift = false;
}
}
iter->next_done = true;
}
static inline void
mbiter_multi_reloc (struct mbiter_multi *iter, ptrdiff_t ptrdiff)
{
iter->cur.ptr += ptrdiff;
}
if (p1 == p2 || LENGTH_LIMIT_EXPR (n == 0))
/* Iteration macros. */
typedef struct mbiter_multi mbi_iterator_t;
#define mbi_init(iter, startptr) \
((iter).cur.ptr = (startptr), (iter).at_end = false, \
(iter).in_shift = false, memset (&(iter).state, '\0', sizeof (mbstate_t)), \
(iter).next_done = false)
#define mbi_avail(iter) \
(!(iter).at_end && (mbiter_multi_next (&(iter)), true))
#define mbi_advance(iter) \
((mb_isnul ((iter).cur) ? ((iter).at_end = true) : 0), \
(iter).cur.ptr += (iter).cur.bytes, (iter).next_done = false)
/* Access to the current character. */
#define mbi_cur(iter) (iter).cur
#define mbi_cur_ptr(iter) (iter).cur.ptr
#endif
#define TOLOWER(Ch) (isupper (Ch) ? tolower (Ch) : (Ch))
/* Compare strings S1 and S2, ignoring case, returning less than, equal to or
greater than zero if S1 is lexicographically less than, equal to or greater
than S2.
Note: This function may, in multibyte locales, return 0 for strings of
different lengths! */
int
strcasecmp (const char *s1, const char *s2)
{
if (s1 == s2)
return 0;
do
/* Be careful not to look at the entire extent of s1 or s2 until needed.
This is useful because when two strings differ, the difference is
most often already in the very few first characters. */
#if HAVE_MBRTOWC
if (MB_CUR_MAX > 1)
{
c1 = TOLOWER (*p1);
c2 = TOLOWER (*p2);
mbi_iterator_t iter1;
mbi_iterator_t iter2;
if (LENGTH_LIMIT_EXPR (--n == 0) || c1 == '\0')
break;
mbi_init (iter1, s1);
mbi_init (iter2, s2);
++p1;
++p2;
while (mbi_avail (iter1) && mbi_avail (iter2))
{
/* Sort invalid characters after all valid ones. */
if (!mbi_cur (iter1).wc_valid)
{
if (!mbi_cur (iter2).wc_valid)
{
/* Compare two invalid characters. */
int cmp;
if (mbi_cur (iter1).bytes > mbi_cur (iter2).bytes)
return 1;
if (mbi_cur (iter1).bytes < mbi_cur (iter2).bytes)
return -1;
cmp = memcmp (mbi_cur_ptr (iter1), mbi_cur_ptr (iter2),
mbi_cur (iter1).bytes);
if (cmp != 0)
return cmp;
}
else
/* mbi_cur (iter1) invalid, mbi_cur (iter2) valid. */
return 1;
}
else
{
if (!mbi_cur (iter2).wc_valid)
/* mbi_cur (iter1) valid, mbi_cur (iter2) invalid. */
return -1;
else
{
/* Compare two valid characters. */
wchar_t c1 = towlower (mbi_cur (iter1).wc);
wchar_t c2 = towlower (mbi_cur (iter2).wc);
if (c1 > c2)
return 1;
if (c1 < c2)
return -1;
}
}
mbi_advance (iter1);
mbi_advance (iter2);
}
if (mbi_avail (iter1))
/* s2 terminated before s1. */
return 1;
if (mbi_avail (iter2))
/* s1 terminated before s2. */
return -1;
return 0;
}
while (c1 == c2);
else
#endif
{
const unsigned char *p1 = (const unsigned char *) s1;
const unsigned char *p2 = (const unsigned char *) s2;
unsigned char c1, c2;
return c1 - c2;
do
{
c1 = TOLOWER (*p1);
c2 = TOLOWER (*p2);
if (c1 == '\0')
break;
++p1;
++p2;
}
while (c1 == c2);
return c1 - c2;
}
}
......
......@@ -11,10 +11,9 @@
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, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301 USA. */
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
/* Specification. */
#include "strchrnul.h"
......
......@@ -11,10 +11,9 @@
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, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301 USA. */
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
#if HAVE_STRCHRNUL
......
#define LENGTH_LIMIT
#include "strcasecmp.c"
/* strncasecmp.c -- case insensitive string comparator
Copyright (C) 1998, 1999 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 2, 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, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
#if HAVE_CONFIG_H
# include <config.h>
#endif
/* Specification. */
#include "strcase.h"
#include <ctype.h>
#define TOLOWER(Ch) (isupper (Ch) ? tolower (Ch) : (Ch))
/* Compare no more than N bytes of strings S1 and S2,
ignoring case, returning less than, equal to or
greater than zero if S1 is lexicographically less
than, equal to or greater than S2. */
int
strncasecmp (const char *s1, const char *s2, size_t n)
{
register const unsigned char *p1 = (const unsigned char *) s1;
register const unsigned char *p2 = (const unsigned char *) s2;
unsigned char c1, c2;
if (p1 == p2 || n == 0)
return 0;
do
{
c1 = TOLOWER (*p1);
c2 = TOLOWER (*p2);
if (--n == 0 || c1 == '\0')
break;
++p1;
++p2;
}
while (c1 == c2);
return c1 - c2;
}
......
/* Copyright (C) 1996, 1997, 1998, 2000, 2003 Free Software Foundation, Inc.
/* Copyright (C) 1996, 1997, 1998, 2000, 2003, 2005 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@prep.ai.mit.edu.
......@@ -13,10 +13,9 @@
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, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301 USA. */
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
#ifdef HAVE_CONFIG_H
# include "config.h"
......@@ -25,12 +24,8 @@
#include <stdlib.h>
#include <string.h>
#ifndef HAVE_DECL_STRNLEN
"this configure-time declaration test was not run"
#endif
#if !HAVE_DECL_STRNLEN
size_t strnlen ();
#endif
/* Get strnlen. */
#include "strnlen.h"
#undef __strndup
#undef strndup
......
......@@ -11,10 +11,9 @@
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, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301 USA. */
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
#if HAVE_STRNDUP
......
......@@ -12,10 +12,9 @@
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, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301 USA. */
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
#if HAVE_CONFIG_H
# include <config.h>
......
......@@ -12,10 +12,9 @@
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, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301 USA. */
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
#ifdef HAVE_CONFIG_H
# include <config.h>
......
/* Split string into tokens
Copyright (C) 2004 Free Software Foundation, Inc.
Copyright (C) 2004-2005 Free Software Foundation, Inc.
Written by Simon Josefsson.
This program is free software; you can redistribute it and/or modify
......@@ -12,10 +12,9 @@
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, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301 USA. */
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
#ifndef STRTOK_R_H
#define STRTOK_R_H
......@@ -36,7 +35,7 @@
This is a variant of strtok() that is multithread-safe.
For the POSIX documentation for this function, see:
http://www.opengroup.org/onlinepubs/009695399/functions/strtok.html
http://www.opengroup.org/susv3xsh/strtok.html
Caveat: It modifies the original string.
Caveat: These functions cannot be used on constant strings.
......
......@@ -11,10 +11,9 @@
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, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301 USA. */
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
/* Written by Simon Josefsson based on sysexits(3) man page */
......
......@@ -12,15 +12,14 @@
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, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301 USA. */
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
/* Written by Jim Meyering. */
#ifndef UNLOCKED_IO_H
#define UNLOCKED_IO_H 1
# define UNLOCKED_IO_H 1
/* These are wrappers for functions/macros from the GNU C library, and
from other C libraries supporting POSIX's optional thread-safe functions.
......@@ -33,106 +32,106 @@
the *_unlocked functions directly. On hosts that lack those
functions, invoke the non-thread-safe versions instead. */
#include <stdio.h>
#if HAVE_DECL_CLEARERR_UNLOCKED
# undef clearerr
# define clearerr(x) clearerr_unlocked (x)
#else
# define clearerr_unlocked(x) clearerr (x)
#endif
#if HAVE_DECL_FEOF_UNLOCKED
# undef feof
# define feof(x) feof_unlocked (x)
#else
# define feof_unlocked(x) feof (x)
#endif
#if HAVE_DECL_FERROR_UNLOCKED
# undef ferror
# define ferror(x) ferror_unlocked (x)
#else
# define ferror_unlocked(x) ferror (x)
#endif
#if HAVE_DECL_FFLUSH_UNLOCKED
# undef fflush
# define fflush(x) fflush_unlocked (x)
#else
# define fflush_unlocked(x) fflush (x)
#endif
#if HAVE_DECL_FGETS_UNLOCKED
# undef fgets
# define fgets(x,y,z) fgets_unlocked (x,y,z)
#else
# define fgets_unlocked(x,y,z) fgets (x,y,z)
#endif
#if HAVE_DECL_FPUTC_UNLOCKED
# undef fputc
# define fputc(x,y) fputc_unlocked (x,y)
#else
# define fputc_unlocked(x,y) fputc (x,y)
#endif
#if HAVE_DECL_FPUTS_UNLOCKED
# undef fputs
# define fputs(x,y) fputs_unlocked (x,y)
#else
# define fputs_unlocked(x,y) fputs (x,y)
#endif
#if HAVE_DECL_FREAD_UNLOCKED
# undef fread
# define fread(w,x,y,z) fread_unlocked (w,x,y,z)
#else
# define fread_unlocked(w,x,y,z) fread (w,x,y,z)
#endif
#if HAVE_DECL_FWRITE_UNLOCKED
# undef fwrite
# define fwrite(w,x,y,z) fwrite_unlocked (w,x,y,z)
#else
# define fwrite_unlocked(w,x,y,z) fwrite (w,x,y,z)
#endif
#if HAVE_DECL_GETC_UNLOCKED
# undef getc
# define getc(x) getc_unlocked (x)
#else
# define getc_unlocked(x) getc (x)
#endif
#if HAVE_DECL_GETCHAR_UNLOCKED
# undef getchar
# define getchar() getchar_unlocked ()
#else
# define getchar_unlocked() getchar ()
#endif
#if HAVE_DECL_PUTC_UNLOCKED
# undef putc
# define putc(x,y) putc_unlocked (x,y)
#else
# define putc_unlocked(x,y) putc (x,y)
#endif
#if HAVE_DECL_PUTCHAR_UNLOCKED
# undef putchar
# define putchar(x) putchar_unlocked (x)
#else
# define putchar_unlocked(x) putchar (x)
#endif
#undef flockfile
#define flockfile(x) ((void) 0)
#undef ftrylockfile
#define ftrylockfile(x) 0
#undef funlockfile
#define funlockfile(x) ((void) 0)
# include <stdio.h>
# if HAVE_DECL_CLEARERR_UNLOCKED
# undef clearerr
# define clearerr(x) clearerr_unlocked (x)
# else
# define clearerr_unlocked(x) clearerr (x)
# endif
# if HAVE_DECL_FEOF_UNLOCKED
# undef feof
# define feof(x) feof_unlocked (x)
# else
# define feof_unlocked(x) feof (x)
# endif
# if HAVE_DECL_FERROR_UNLOCKED
# undef ferror
# define ferror(x) ferror_unlocked (x)
# else
# define ferror_unlocked(x) ferror (x)
# endif
# if HAVE_DECL_FFLUSH_UNLOCKED
# undef fflush
# define fflush(x) fflush_unlocked (x)
# else
# define fflush_unlocked(x) fflush (x)
# endif
# if HAVE_DECL_FGETS_UNLOCKED
# undef fgets
# define fgets(x,y,z) fgets_unlocked (x,y,z)
# else
# define fgets_unlocked(x,y,z) fgets (x,y,z)
# endif
# if HAVE_DECL_FPUTC_UNLOCKED
# undef fputc
# define fputc(x,y) fputc_unlocked (x,y)
# else
# define fputc_unlocked(x,y) fputc (x,y)
# endif
# if HAVE_DECL_FPUTS_UNLOCKED
# undef fputs
# define fputs(x,y) fputs_unlocked (x,y)
# else
# define fputs_unlocked(x,y) fputs (x,y)
# endif
# if HAVE_DECL_FREAD_UNLOCKED
# undef fread
# define fread(w,x,y,z) fread_unlocked (w,x,y,z)
# else
# define fread_unlocked(w,x,y,z) fread (w,x,y,z)
# endif
# if HAVE_DECL_FWRITE_UNLOCKED
# undef fwrite
# define fwrite(w,x,y,z) fwrite_unlocked (w,x,y,z)
# else
# define fwrite_unlocked(w,x,y,z) fwrite (w,x,y,z)
# endif
# if HAVE_DECL_GETC_UNLOCKED
# undef getc
# define getc(x) getc_unlocked (x)
# else
# define getc_unlocked(x) getc (x)
# endif
# if HAVE_DECL_GETCHAR_UNLOCKED
# undef getchar
# define getchar() getchar_unlocked ()
# else
# define getchar_unlocked() getchar ()
# endif
# if HAVE_DECL_PUTC_UNLOCKED
# undef putc
# define putc(x,y) putc_unlocked (x,y)
# else
# define putc_unlocked(x,y) putc (x,y)
# endif
# if HAVE_DECL_PUTCHAR_UNLOCKED
# undef putchar
# define putchar(x) putchar_unlocked (x)
# else
# define putchar_unlocked(x) putchar (x)
# endif
# undef flockfile
# define flockfile(x) ((void) 0)
# undef ftrylockfile
# define ftrylockfile(x) 0
# undef funlockfile
# define funlockfile(x) ((void) 0)
#endif /* UNLOCKED_IO_H */
......
/* vsprintf with automatic memory allocation.
Copyright (C) 1999, 2002-2004 Free Software Foundation, Inc.
Copyright (C) 1999, 2002-2005 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
......@@ -11,10 +11,9 @@
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, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301 USA. */
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
/* Tell glibc's <stdio.h> to provide a prototype for snprintf().
This must come before <config.h> because <config.h> may include
......@@ -52,6 +51,11 @@
/* Checked size_t computations. */
#include "xsize.h"
/* Some systems, like OSF/1 4.0 and Woe32, don't have EOVERFLOW. */
#ifndef EOVERFLOW
# define EOVERFLOW E2BIG
#endif
#ifdef HAVE_WCHAR_T
# ifdef HAVE_WCSLEN
# define local_wcslen wcslen
......
......@@ -11,10 +11,9 @@
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, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301 USA. */
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
#ifndef _VASNPRINTF_H
#define _VASNPRINTF_H
......
......@@ -12,10 +12,9 @@
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, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301 USA. */
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
#ifdef HAVE_CONFIG_H
# include <config.h>
......
......@@ -12,10 +12,9 @@
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, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301 USA. */
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
#ifndef VSNPRINTF_H
#define VSNPRINTF_H
......
......@@ -12,10 +12,9 @@
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, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301 USA. */
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
#ifndef _XSIZE_H
#define _XSIZE_H
......