Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
John McEleney
/
mailutils
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
Commit
94fdc609
...
94fdc6094f6b02c854432e8c8f658afa6dd654c7
authored
2006-09-10 12:38:11 +0000
by
Sergey Poznyakoff
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Updated by gnulib-sync
1 parent
3f7b793b
Hide whitespace changes
Inline
Side-by-side
Showing
63 changed files
with
1330 additions
and
1916 deletions
lib/allocsa.h
lib/error.c
lib/error.h
lib/exit.h
lib/exitfail.c
lib/mbswidth.c
lib/obstack.c
lib/setenv.c
lib/snprintf.c
lib/vasprintf.c
lib/vasprintf.h
m4/argp.m4
m4/d-type.m4
m4/exitfail.m4
m4/fnmatch.m4
m4/getdelim.m4
m4/getline.m4
m4/getlogin_r.m4
m4/getopt.m4
m4/getpass.m4
m4/glob.m4
m4/intmax_t.m4
m4/inttostr.m4
m4/inttypes_h_gl.m4
m4/longlong_gl.m4
m4/mbchar.m4
m4/mbswidth.m4
m4/md5.m4
m4/mempcpy.m4
m4/onceonly.m4
m4/regex.m4
m4/sha1.m4
m4/stat-macros.m4
m4/stdint.m4
m4/stdint_h_gl.m4
m4/strdup.m4
m4/strndup.m4
m4/strnlen.m4
m4/strtok_r.m4
m4/xalloc.m4
mailbox/argp-help.c
mailbox/argp-namefrob.h
mailbox/argp-parse.c
mailbox/argp-pv.c
mailbox/argp.h
mailbox/fnmatch.c
mailbox/fnmatch_loop.c
mailbox/getopt.c
mailbox/gettext.h
mailbox/glob.c
mailbox/glob_.h
mailbox/inttostr.h
mailbox/mbchar.h
mailbox/printf-args.c
mailbox/regex.h
mailbox/regex_internal.c
mailbox/regex_internal.h
mailbox/stat-macros.h
mailbox/stdint_.h
mailbox/strnlen1.c
mailbox/strnlen1.h
mailbox/vasnprintf.c
mailbox/vsnprintf.c
lib/allocsa.h
View file @
94fdc60
/* Safe automatic memory allocation.
Copyright (C) 2003-200
4
Free Software Foundation, Inc.
Copyright (C) 2003-200
6
Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2003.
This program is free software; you can redistribute it and/or modify
...
...
@@ -23,6 +23,12 @@
#include <stddef.h>
#include <stdlib.h>
#ifdef __cplusplus
extern
"C"
{
#endif
/* safe_alloca(N) is equivalent to alloca(N) when it is safe to call
alloca(N); otherwise it returns NULL. It either returns N bytes of
memory allocated on the stack, that lasts until the function returns,
...
...
@@ -69,6 +75,11 @@ extern void freesa (void *p);
If this would be useful in your application. please speak up. */
#ifdef __cplusplus
}
#endif
/* ------------------- Auxiliary, non-public definitions ------------------- */
/* Determine the alignment of a type at compile time. */
...
...
@@ -81,6 +92,10 @@ extern void freesa (void *p);
/* Work around a HP-UX 10.20 cc bug with enums constants defined as offsetof
values. */
# define sa_alignof(type) (sizeof (type) <= 4 ? 4 : 8)
#elif defined _AIX
/* Work around an AIX 3.2.5 xlc bug with enums constants defined as offsetof
values. */
# define sa_alignof(type) (sizeof (type) <= 4 ? 4 : 8)
#else
# define sa_alignof(type) offsetof (struct { char __slot1; type __slot2; }, __slot2)
#endif
...
...
lib/error.c
View file @
94fdc60
/* Error handler for noninteractive utilities
Copyright (C) 1990-1998, 2000-200
3, 2004
Free Software Foundation, Inc.
Copyright (C) 1990-1998, 2000-200
5, 2006
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
...
...
@@ -34,6 +34,9 @@
#endif
#ifdef _LIBC
# include <libintl.h>
# include <stdbool.h>
# include <stdint.h>
# include <wchar.h>
# define mbsrtowcs __mbsrtowcs
#endif
...
...
@@ -59,6 +62,7 @@ unsigned int error_message_count;
# define program_name program_invocation_name
# include <errno.h>
# include <limits.h>
# include <libio/libioP.h>
/* In GNU libc we want do not want to use the common name `error' directly.
...
...
@@ -88,23 +92,19 @@ extern void __error_at_line (int status, int errnum, const char *file_name,
char
*
strerror_r
();
# endif
# ifndef SIZE_MAX
# define SIZE_MAX ((size_t) -1)
# endif
/* The calling program should define program_name and set it to the
name of the executing program. */
extern
char
*
program_name
;
# if HAVE_STRERROR_R || defined strerror_r
# define __strerror_r strerror_r
# endif
# endif
/* HAVE_STRERROR_R || defined strerror_r */
#endif
/* not _LIBC */
static
void
print_errno_message
(
int
errnum
)
{
char
const
*
s
=
NULL
;
char
const
*
s
;
#if defined HAVE_STRERROR_R || _LIBC
char
errbuf
[
1024
];
...
...
@@ -113,23 +113,23 @@ print_errno_message (int errnum)
# else
if
(
__strerror_r
(
errnum
,
errbuf
,
sizeof
errbuf
)
==
0
)
s
=
errbuf
;
else
s
=
0
;
# endif
#else
s
=
strerror
(
errnum
);
#endif
#if !_LIBC
if
(
!
s
&&
!
(
s
=
strerror
(
errnum
))
)
if
(
!
s
)
s
=
_
(
"Unknown system error"
);
#endif
#if _LIBC
if
(
_IO_fwide
(
stderr
,
0
)
>
0
)
{
__fwprintf
(
stderr
,
L": %s"
,
s
);
return
;
}
#endif
__fxprintf
(
NULL
,
": %s"
,
s
);
#else
fprintf
(
stderr
,
": %s"
,
s
);
#endif
}
static
void
...
...
@@ -140,26 +140,65 @@ error_tail (int status, int errnum, const char *message, va_list args)
{
# define ALLOCA_LIMIT 2000
size_t
len
=
strlen
(
message
)
+
1
;
const
wchar_t
*
wmessage
=
L"out of memory"
;
wchar_t
*
wbuf
=
(
len
<
ALLOCA_LIMIT
?
alloca
(
len
*
sizeof
*
wbuf
)
:
len
<=
SIZE_MAX
/
sizeof
*
wbuf
?
malloc
(
len
*
sizeof
*
wbuf
)
:
NULL
);
if
(
wbuf
)
wchar_t
*
wmessage
=
NULL
;
mbstate_t
st
;
size_t
res
;
const
char
*
tmp
;
bool
use_malloc
=
false
;
while
(
1
)
{
size_t
res
;
mbstate_t
st
;
const
char
*
tmp
=
message
;
if
(
__libc_use_alloca
(
len
*
sizeof
(
wchar_t
)))
wmessage
=
(
wchar_t
*
)
alloca
(
len
*
sizeof
(
wchar_t
));
else
{
if
(
!
use_malloc
)
wmessage
=
NULL
;
wchar_t
*
p
=
(
wchar_t
*
)
realloc
(
wmessage
,
len
*
sizeof
(
wchar_t
));
if
(
p
==
NULL
)
{
free
(
wmessage
);
fputws_unlocked
(
L"out of memory
\n
"
,
stderr
);
return
;
}
wmessage
=
p
;
use_malloc
=
true
;
}
memset
(
&
st
,
'\0'
,
sizeof
(
st
));
res
=
mbsrtowcs
(
wbuf
,
&
tmp
,
len
,
&
st
);
wmessage
=
res
==
(
size_t
)
-
1
?
L"???"
:
wbuf
;
tmp
=
message
;
res
=
mbsrtowcs
(
wmessage
,
&
tmp
,
len
,
&
st
);
if
(
res
!=
len
)
break
;
if
(
__builtin_expect
(
len
>=
SIZE_MAX
/
2
,
0
))
{
/* This really should not happen if everything is fine. */
res
=
(
size_t
)
-
1
;
break
;
}
len
*=
2
;
}
if
(
res
==
(
size_t
)
-
1
)
{
/* The string cannot be converted. */
if
(
use_malloc
)
{
free
(
wmessage
);
use_malloc
=
false
;
}
wmessage
=
(
wchar_t
*
)
L"???"
;
}
__vfwprintf
(
stderr
,
wmessage
,
args
);
if
(
!
(
len
<
ALLOCA_LIMIT
))
free
(
wbuf
);
if
(
use_malloc
)
free
(
wmessage
);
}
else
#endif
...
...
@@ -170,11 +209,10 @@ error_tail (int status, int errnum, const char *message, va_list args)
if
(
errnum
)
print_errno_message
(
errnum
);
#if _LIBC
if
(
_IO_fwide
(
stderr
,
0
)
>
0
)
putwc
(
L'\n'
,
stderr
);
else
__fxprintf
(
NULL
,
"
\n
"
);
#else
putc
(
'\n'
,
stderr
);
#endif
putc
(
'\n'
,
stderr
);
fflush
(
stderr
);
if
(
status
)
exit
(
status
);
...
...
@@ -207,11 +245,10 @@ error (int status, int errnum, const char *message, ...)
else
{
#if _LIBC
if
(
_IO_fwide
(
stderr
,
0
)
>
0
)
__fwprintf
(
stderr
,
L"%s: "
,
program_name
);
else
__fxprintf
(
NULL
,
"%s: "
,
program_name
);
#else
fprintf
(
stderr
,
"%s: "
,
program_name
);
#endif
fprintf
(
stderr
,
"%s: "
,
program_name
);
}
va_start
(
args
,
message
);
...
...
@@ -267,22 +304,19 @@ error_at_line (int status, int errnum, const char *file_name,
else
{
#if _LIBC
if
(
_IO_fwide
(
stderr
,
0
)
>
0
)
__fwprintf
(
stderr
,
L"%s: "
,
program_name
);
else
__fxprintf
(
NULL
,
"%s:"
,
program_name
);
#else
fprintf
(
stderr
,
"%s:"
,
program_name
);
#endif
fprintf
(
stderr
,
"%s:"
,
program_name
);
}
if
(
file_name
!=
NULL
)
{
#if _LIBC
if
(
_IO_fwide
(
stderr
,
0
)
>
0
)
__fwprintf
(
stderr
,
L"%s:%d: "
,
file_name
,
line_number
);
else
__fxprintf
(
NULL
,
file_name
!=
NULL
?
"%s:%d: "
:
" "
,
file_name
,
line_number
);
#else
fprintf
(
stderr
,
file_name
!=
NULL
?
"%s:%d: "
:
" "
,
file_name
,
line_number
);
#endif
fprintf
(
stderr
,
"%s:%d: "
,
file_name
,
line_number
);
}
va_start
(
args
,
message
);
error_tail
(
status
,
errnum
,
message
,
args
);
...
...
lib/error.h
View file @
94fdc60
/* Declaration for error-reporting function
Copyright (C) 1995, 1996, 1997, 2003 Free Software Foundation, Inc.
Copyright (C) 1995, 1996, 1997, 2003
, 2006
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
...
...
@@ -21,7 +21,7 @@
#ifndef __attribute__
/* This feature is available in gcc versions 2.5 and later. */
# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5)
# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5)
|| __STRICT_ANSI__
# define __attribute__(Spec)
/* empty */
# endif
/* The __-protected variants of `format' and `printf' attributes
...
...
lib/exit.h
View file @
94fdc60
...
...
@@ -21,7 +21,7 @@
/* Get exit() declaration. */
#include <stdlib.h>
/* Some systems do not define EXIT_*,
even with STDC_HEADERS
. */
/* Some systems do not define EXIT_*,
despite otherwise supporting C89
. */
#ifndef EXIT_SUCCESS
# define EXIT_SUCCESS 0
#endif
...
...
lib/exitfail.c
View file @
94fdc60
/* Failure exit status
Copyright (C) 2002, 2003 Free Software Foundation, Inc.
Copyright (C) 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
...
...
lib/mbswidth.c
View file @
94fdc60
/* Determine the number of screen columns needed for a string.
Copyright (C) 2000-200
5
Free Software Foundation, Inc.
Copyright (C) 2000-200
6
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
...
...
@@ -32,7 +32,7 @@
/* Get isprint(). */
#include <ctype.h>
/* Get mbstate_t, mbrtowc(), mbsinit()
, wcwidth()
. */
/* Get mbstate_t, mbrtowc(), mbsinit(). */
#if HAVE_WCHAR_H
/* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before
<wchar.h>.
...
...
@@ -43,15 +43,15 @@
# include <wchar.h>
#endif
/* Get iswprint(), iswcntrl(). */
/* Get wcwidth(). */
#include "wcwidth.h"
/* Get iswcntrl(). */
#if HAVE_WCTYPE_H
# include <wctype.h>
#endif
#if !defined iswprint && !HAVE_ISWPRINT
# define iswprint(wc) 1
#endif
#if !defined iswcntrl && !HAVE_ISWCNTRL
# define iswcntrl(wc)
0
# define iswcntrl(wc)
(((wc) & ~0x1f) == 0 || (wc) == 0x7f)
#endif
#ifndef mbsinit
...
...
@@ -60,33 +60,6 @@
# endif
#endif
#ifndef HAVE_DECL_WCWIDTH
"this configure-time declaration test was not run"
#endif
#if !HAVE_DECL_WCWIDTH
int
wcwidth
();
#endif
#ifndef wcwidth
# if !HAVE_WCWIDTH
/* wcwidth doesn't exist, so assume all printable characters have
width 1. */
# define wcwidth(wc) ((wc) == 0 ? 0 : iswprint (wc) ? 1 : -1)
# endif
#endif
/* Get ISPRINT. */
#if defined (STDC_HEADERS) || (!defined (isascii) && !defined (HAVE_ISASCII))
# define IN_CTYPE_DOMAIN(c) 1
#else
# define IN_CTYPE_DOMAIN(c) isascii(c)
#endif
/* Undefine to protect against the definition in wctype.h of Solaris 2.6. */
#undef ISPRINT
#define ISPRINT(c) (IN_CTYPE_DOMAIN (c) && isprint (c))
#undef ISCNTRL
#define ISCNTRL(c) (IN_CTYPE_DOMAIN (c) && iscntrl (c))
/* Returns the number of columns needed to represent the multibyte
character string pointed to by STRING. If a non-printable character
occurs, and MBSW_REJECT_UNPRINTABLE is specified, -1 is returned.
...
...
@@ -210,10 +183,10 @@ mbsnwidth (const char *string, size_t nbytes, int flags)
{
unsigned
char
c
=
(
unsigned
char
)
*
p
++
;
if
(
ISPRINT
(
c
))
if
(
isprint
(
c
))
width
++
;
else
if
(
!
(
flags
&
MBSW_REJECT_UNPRINTABLE
))
width
+=
(
ISCNTRL
(
c
)
?
0
:
1
);
width
+=
(
iscntrl
(
c
)
?
0
:
1
);
else
return
-
1
;
}
...
...
lib/obstack.c
View file @
94fdc60
/* obstack.c - subroutines used implicitly by object stack macros
Copyright (C) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1996, 1997,
1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
Free Software Foundation,
Inc.
1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
, 2006 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
...
...
@@ -55,13 +55,7 @@
#ifndef ELIDE_CODE
# if HAVE_INTTYPES_H
# include <inttypes.h>
# endif
# if HAVE_STDINT_H || defined _LIBC
# include <stdint.h>
# endif
# include <stdint.h>
/* Determine default alignment. */
union
fooround
...
...
lib/setenv.c
View file @
94fdc60
...
...
@@ -27,7 +27,9 @@
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#if _LIBC || HAVE_UNISTD_H
# include <unistd.h>
#endif
#if !_LIBC
# include "allocsa.h"
...
...
lib/snprintf.c
View file @
94fdc60
/* Formatted output to strings.
Copyright (C) 2004 Free Software Foundation, Inc.
Written by Simon Josefsson.
Copyright (C) 2004
, 2006
Free Software Foundation, Inc.
Written by Simon Josefsson
and Paul Eggert
.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
...
...
@@ -22,13 +22,19 @@
#include "snprintf.h"
#include <errno.h>
#include <limits.h>
#include <stdarg.h>
#include <stdlib.h>
#include <string.h>
#include "minmax.h"
#include "vasnprintf.h"
/* Some systems, like OSF/1 4.0 and Woe32, don't have EOVERFLOW. */
#ifndef EOVERFLOW
# define EOVERFLOW E2BIG
#endif
/* Print formatted output to string STR. Similar to sprintf, but
additional length SIZE limit how much is written into STR. Returns
string length of formatted string (which may be larger than SIZE).
...
...
@@ -39,22 +45,34 @@ snprintf (char *str, size_t size, const char *format, ...)
{
char
*
output
;
size_t
len
;
size_t
lenbuf
=
size
;
va_list
args
;
va_start
(
args
,
format
);
len
=
size
;
output
=
vasnprintf
(
str
,
&
len
,
format
,
args
)
;
output
=
vasnprintf
(
str
,
&
lenbuf
,
format
,
args
)
;
len
=
lenbuf
;
va_end
(
args
);
if
(
!
output
)
return
-
1
;
if
(
str
!=
NULL
)
if
(
len
>
size
-
1
)
/* equivalent to: (size > 0 && len >= size) */
str
[
size
-
1
]
=
'\0'
;
if
(
output
!=
str
)
free
(
output
);
{
if
(
size
)
{
size_t
pruned_len
=
(
len
<
size
?
len
:
size
-
1
);
memcpy
(
str
,
output
,
pruned_len
);
str
[
pruned_len
]
=
'\0'
;
}
free
(
output
);
}
if
(
INT_MAX
<
len
)
{
errno
=
EOVERFLOW
;
return
-
1
;
}
return
len
;
}
...
...
lib/vasprintf.c
View file @
94fdc60
/* Formatted output to strings.
Copyright (C) 1999, 2002 Free Software Foundation, Inc.
Copyright (C) 1999, 2002
, 2006
Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
...
...
@@ -22,10 +22,17 @@
/* Specification. */
#include "vasprintf.h"
#include <errno.h>
#include <limits.h>
#include <stdlib.h>
#include "vasnprintf.h"
/* Some systems, like OSF/1 4.0 and Woe32, don't have EOVERFLOW. */
#ifndef EOVERFLOW
# define EOVERFLOW E2BIG
#endif
int
vasprintf
(
char
**
resultp
,
const
char
*
format
,
va_list
args
)
{
...
...
@@ -34,9 +41,14 @@ vasprintf (char **resultp, const char *format, va_list args)
if
(
result
==
NULL
)
return
-
1
;
if
(
length
>
INT_MAX
)
{
free
(
result
);
errno
=
EOVERFLOW
;
return
-
1
;
}
*
resultp
=
result
;
/* Return the number of resulting bytes, excluding the trailing NUL.
If it wouldn't fit in an 'int', vasnprintf() would have returned NULL
and set errno to EOVERFLOW. */
/* Return the number of resulting bytes, excluding the trailing NUL. */
return
length
;
}
...
...
lib/vasprintf.h
View file @
94fdc60
...
...
@@ -11,8 +11,8 @@
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,
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
...
...
m4/argp.m4
View file @
94fdc60
# argp.m4 serial
6
# argp.m4 serial
7
dnl Copyright (C) 2003-2006 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
...
...
@@ -7,6 +7,7 @@ dnl with or without modifications, as long as this notice is preserved.
AC_DEFUN([gl_ARGP],
[
AC_REQUIRE([AC_C_INLINE])
AC_REQUIRE([AC_C_RESTRICT])
AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
AC_REQUIRE([gl_GETOPT_SUBSTITUTE])
...
...
@@ -14,13 +15,13 @@ AC_DEFUN([gl_ARGP],
[AC_DEFINE(HAVE_DECL_PROGRAM_INVOCATION_NAME, 1,
[Define if program_invocation_name is declared])],
[AC_DEFINE(GNULIB_PROGRAM_INVOCATION_NAME, 1,
[Define to 1 to add extern declaration of program_invocation_name to argp
-namefrob
.h])],
[Define to 1 to add extern declaration of program_invocation_name to argp.h])],
[#include <errno.h>])
AC_CHECK_DECL([program_invocation_short_name],
[AC_DEFINE(HAVE_DECL_PROGRAM_INVOCATION_SHORT_NAME, 1,
[Define if program_invocation_short_name is declared])],
[AC_DEFINE(GNULIB_PROGRAM_INVOCATION_SHORT_NAME, 1,
[Define to 1 to add extern declaration of program_invocation_short_name to argp
-namefrob
.h])],
[Define to 1 to add extern declaration of program_invocation_short_name to argp.h])],
[#include <errno.h>])
# Check if program_invocation_name and program_invocation_short_name
...
...
m4/d-type.m4
View file @
94fdc60
#serial
8
#serial
9
dnl From Jim Meyering.
dnl
dnl Check whether struct dirent has a member named d_type.
dnl
# Copyright (C) 1997, 1999, 2000, 2001, 2002, 2003, 2004 Free Software
# Copyright (C) 1997, 1999, 2000, 2001, 2002, 2003, 2004
, 2006
Free Software
# Foundation, Inc.
#
# This file is free software; the Free Software Foundation
...
...
@@ -13,26 +13,12 @@ dnl
# with or without modifications, as long as this notice is preserved.
AC_DEFUN([gl_CHECK_TYPE_STRUCT_DIRENT_D_TYPE],
[AC_REQUIRE([AC_HEADER_DIRENT])dnl
AC_CACHE_CHECK([for d_type member in directory struct],
[AC_CACHE_CHECK([for d_type member in directory struct],
jm_cv_struct_dirent_d_type,
[AC_TRY_LINK(dnl
[
#include <sys/types.h>
#ifdef HAVE_DIRENT_H
# include <dirent.h>
#else /* not HAVE_DIRENT_H */
# define dirent direct
# ifdef HAVE_SYS_NDIR_H
# include <sys/ndir.h>
# endif /* HAVE_SYS_NDIR_H */
# ifdef HAVE_SYS_DIR_H
# include <sys/dir.h>
# endif /* HAVE_SYS_DIR_H */
# ifdef HAVE_NDIR_H
# include <ndir.h>
# endif /* HAVE_NDIR_H */
#endif /* HAVE_DIRENT_H */
#include <dirent.h>
],
[struct dirent dp; dp.d_type = 0;],
...
...
m4/exitfail.m4
View file @
94fdc60
# exitfail.m4 serial
5
dnl Copyright (C) 2002, 2003, 2005 Free Software Foundation, Inc.
# exitfail.m4 serial
6
dnl Copyright (C) 2002, 2003, 2005
, 2006
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.
...
...
m4/fnmatch.m4
View file @
94fdc60
# Check for fnmatch.
# This is a modified version of autoconf's AC_FUNC_FNMATCH.
# This file should be simplified after Autoconf 2.57 is required.
# Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005 Free Software
# Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software
# Foundation, Inc.
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# Autoconf defines AC_FUNC_FNMATCH, but that is obsolescent.
# New applications should use the macros below instead.
# _AC_FUNC_FNMATCH_IF(STANDARD = GNU | POSIX, CACHE_VAR, IF-TRUE, IF-FALSE)
# -------------------------------------------------------------------------
# If a STANDARD compliant fnmatch is found, run IF-TRUE, otherwise
...
...
@@ -61,10 +61,9 @@ AS_IF([test $$2 = yes], [$3], [$4])
# ------------------
# Prepare the replacement of fnmatch.
AC_DEFUN([_MU_LIBOBJ_FNMATCH],
[AC_REQUIRE([AC_C_CONST])dnl
AC_REQUIRE([AC_FUNC_ALLOCA])dnl
[AC_REQUIRE([AC_FUNC_ALLOCA])dnl
AC_REQUIRE([AC_TYPE_MBSTATE_T])dnl
AC_CHECK_DECLS([
getenv
])
AC_CHECK_DECLS([
isblank], [], [], [#include <ctype.h>
])
AC_CHECK_FUNCS([btowc mbsrtowcs mempcpy wmemchr wmemcpy wmempcpy])
AC_CHECK_HEADERS([wchar.h wctype.h])
MU_LIBOBJ([fnmatch])
...
...
m4/getdelim.m4
View file @
94fdc60
# getdelim.m4 serial
1
# getdelim.m4 serial
2
dnl Copyright (C) 2005 Free Software dnl Foundation, Inc.
dnl Copyright (C) 2005
, 2006
Free Software dnl Foundation, Inc.
dnl
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
...
...
@@ -10,7 +10,6 @@ AC_PREREQ(2.52)
AC_DEFUN([gl_FUNC_GETDELIM],
[
MU_LIBSOURCES([getdelim.c, getdelim.h])
dnl Persuade glibc <stdio.h> to declare getdelim().
AC_REQUIRE([AC_GNU_SOURCE])
...
...
m4/getline.m4
View file @
94fdc60
# getline.m4 serial 1
3
# getline.m4 serial 1
5
dnl Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2005 Free Software
dnl Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2005
, 2006
Free Software
dnl Foundation, Inc.
dnl
dnl This file is free software; the Free Software Foundation
...
...
@@ -15,8 +15,6 @@ dnl have a function by that name in -linet that doesn't have anything
dnl to do with the function we need.
AC_DEFUN([gl_FUNC_GETLINE],
[
MU_LIBSOURCES([getline.c, getline.h])
dnl Persuade glibc <stdio.h> to declare getline().
AC_REQUIRE([AC_GNU_SOURCE])
...
...
@@ -47,7 +45,18 @@ AC_DEFUN([gl_FUNC_GETLINE],
}
], am_cv_func_working_getline=yes dnl The library version works.
, am_cv_func_working_getline=no dnl The library version does NOT work.
, am_cv_func_working_getline=no dnl We're cross compiling.
, dnl We're cross compiling. Assume it works on glibc2 systems.
[AC_EGREP_CPP([Lucky GNU user],
[
#include <features.h>
#ifdef __GNU_LIBRARY__
#if (__GLIBC__ >= 2)
Lucky GNU user
#endif
#endif
],
[am_cv_func_working_getline=yes],
[am_cv_func_working_getline=no])]
)])
fi
...
...
m4/getlogin_r.m4
View file @
94fdc60
#serial
2
#serial
3
# Copyright (C) 2005, 2006 Free Software Foundation, Inc.
#
...
...
@@ -14,7 +14,6 @@ dnl
AC_DEFUN([gl_GETLOGIN_R_SUBSTITUTE],
[
gl_PREREQ_GETLOGIN_R
MU_LIBSOURCE([getlogin_r.h])
MU_LIBOBJ([getlogin_r])
])
...
...
m4/getopt.m4
View file @
94fdc60
# getopt.m4 serial 1
2
# getopt.m4 serial 1
3
dnl Copyright (C) 2002, 2003, 2004, 2005, 2006 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.
# The getopt module assume you want GNU getopt, with getopt_long etc,
# rather than vanilla POSIX getopt. This means your
your
code should
# rather than vanilla POSIX getopt. This means your code should
# always include <getopt.h> for the getopt prototypes.
AC_DEFUN([gl_GETOPT_SUBSTITUTE],
...
...
m4/getpass.m4
View file @
94fdc60
# getpass.m4 serial
7
# getpass.m4 serial
9
dnl Copyright (C) 2002-2003, 2005-2006 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
...
...
@@ -7,8 +7,6 @@ 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
...
...
@@ -20,8 +18,6 @@ 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)
...
...
@@ -42,4 +38,5 @@ AC_DEFUN([gl_PREREQ_GETPASS], [
AC_CHECK_DECLS_ONCE([fputs_unlocked])
AC_CHECK_DECLS_ONCE([funlockfile])
AC_CHECK_DECLS_ONCE([putc_unlocked])
:
])
...
...
m4/glob.m4
View file @
94fdc60
# glob.m4 serial
3
dnl Copyright (C) 2005 Free Software Foundation, Inc.
# glob.m4 serial
7
dnl Copyright (C) 2005
, 2006
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.
# The glob module assumes you want GNU glob, with glob_pattern_p etc,
# rather than vanilla POSIX glob. This means your
your
code should
# rather than vanilla POSIX glob. This means your code should
# always include <glob.h> for the glob prototypes.
AC_DEFUN([gl_GLOB_SUBSTITUTE],
...
...
@@ -13,7 +13,6 @@ AC_DEFUN([gl_GLOB_SUBSTITUTE],
gl_PREREQ_GLOB
GLOB_H=glob.h
MU_LIBSOURCES([glob.c, glob_.h, glob-libc.h])
MU_LIBOBJ([glob])
AC_SUBST([GLOB_H])
])
...
...
@@ -73,8 +72,8 @@ if (glob ("conf*-globtest", 0, NULL, &found) == GLOB_NOMATCH) return 1;]]),
# Prerequisites of lib/glob.*.
AC_DEFUN([gl_PREREQ_GLOB],
[ AC_REQUIRE([gl_CHECK_TYPE_STRUCT_DIRENT_D_TYPE])dnl
AC_REQUIRE([AC_C_RESTRICT])dnl
AC_REQUIRE([AC_GNU_SOURCE])dnl
AC_REQUIRE([AC_HEADER_DIRENT])dnl
AC_CHECK_HEADERS_ONCE([sys/cdefs.h unistd.h])dnl
AC_CHECK_FUNCS_ONCE([getlogin_r getpwnam_r])dnl
:])
...
...
m4/intmax_t.m4
View file @
94fdc60
# intmax_t.m4 serial
4
dnl Copyright (C) 1997-2004 Free Software Foundation, Inc.
# intmax_t.m4 serial
5
dnl Copyright (C) 1997-2004
, 2006
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.
...
...
@@ -46,7 +46,7 @@ AC_DEFUN([gt_AC_TYPE_INTMAX_T],
#if HAVE_INTTYPES_H_WITH_UINTMAX
#include <inttypes.h>
#endif
], [intmax_t x = -1;], gt_cv_c_intmax_t=yes, gt_cv_c_intmax_t=no)])
], [intmax_t x = -1;
return !x;
], gt_cv_c_intmax_t=yes, gt_cv_c_intmax_t=no)])
if test $gt_cv_c_intmax_t = yes; then
AC_DEFINE(HAVE_INTMAX_T, 1,
[Define if you have the 'intmax_t' type in <stdint.h> or <inttypes.h>.])
...
...
m4/inttostr.m4
View file @
94fdc60
#serial
5
dnl Copyright (C) 2004, 2005 Free Software Foundation, Inc.
#serial
6
dnl Copyright (C) 2004, 2005
, 2006
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_INTTOSTR],
[
MU_LIBSOURCES([inttostr.c, inttostr.h, intprops.h])
dnl We don't technically need to list the following .c files, since their
dnl functions are named in the MU_LIBOBJ calls, but this is an unusual
dnl module and it seems a little clearer to do so.
MU_LIBSOURCES([imaxtostr.c, offtostr.c, umaxtostr.c])
MU_LIBOBJ([imaxtostr])
MU_LIBOBJ([offtostr])
MU_LIBOBJ([umaxtostr])
...
...
@@ -25,8 +18,6 @@ AC_DEFUN([gl_INTTOSTR],
# Prerequisites of lib/inttostr.h.
AC_DEFUN([gl_PREREQ_INTTOSTR], [
AC_REQUIRE([gl_AC_TYPE_INTMAX_T])
AC_REQUIRE([gl_AC_TYPE_UINTMAX_T])
AC_REQUIRE([AC_TYPE_OFF_T])
:
])
...
...
m4/inttypes_h_gl.m4
View file @
94fdc60
# inttypes_h.m4 serial
6
dnl Copyright (C) 1997-2004 Free Software Foundation, Inc.
# inttypes_h.m4 serial
7
dnl Copyright (C) 1997-2004
, 2006
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.
...
...
@@ -15,7 +15,7 @@ AC_DEFUN([gl_AC_HEADER_INTTYPES_H],
[AC_TRY_COMPILE(
[#include <sys/types.h>
#include <inttypes.h>],
[uintmax_t i = (uintmax_t) -1;],
[uintmax_t i = (uintmax_t) -1;
return !i;
],
gl_cv_header_inttypes_h=yes,
gl_cv_header_inttypes_h=no)])
if test $gl_cv_header_inttypes_h = yes; then
...
...
m4/longlong_gl.m4
View file @
94fdc60
# longlong.m4 serial
5
dnl Copyright (C) 1999-200
4
Free Software Foundation, Inc.
# longlong.m4 serial
7
dnl Copyright (C) 1999-200
6
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 Paul Eggert.
# Define HAVE_LONG_LONG if 'long long' works.
# Define HAVE_LONG_LONG_INT if 'long long int' works.
# This fixes a bug in Autoconf 2.60, but can be removed once we
# assume 2.61 everywhere.
AC_DEFUN([AC_TYPE_LONG_LONG_INT],
[
AC_CACHE_CHECK([for long long int], [ac_cv_type_long_long_int],
[AC_LINK_IFELSE(
[AC_LANG_PROGRAM(
[[long long int ll = 9223372036854775807ll;
long long int nll = -9223372036854775807LL;
typedef int a[((-9223372036854775807LL < 0
&& 0 < 9223372036854775807ll)
? 1 : -1)];
int i = 63;]],
[[long long int llmax = 9223372036854775807ll;
return ((ll << 63) | (ll >> 63) | (ll < i) | (ll > i)
| (llmax / ll) | (llmax % ll));]])],
[ac_cv_type_long_long_int=yes],
[ac_cv_type_long_long_int=no])])
if test $ac_cv_type_long_long_int = yes; then
AC_DEFINE([HAVE_LONG_LONG_INT], 1,
[Define to 1 if the system has the type `long long int'.])
fi
])
# This macro is obsolescent and should go away soon.
AC_DEFUN([gl_AC_TYPE_LONG_LONG],
[
AC_CACHE_CHECK([for long long], ac_cv_type_long_long,
[AC_TRY_LINK([long long ll = 1LL; int i = 63;],
[long long llmax = (long long) -1;
return ll << i | ll >> i | llmax / ll | llmax % ll;],
ac_cv_type_long_long=yes,
ac_cv_type_long_long=no)])
AC_REQUIRE([AC_TYPE_LONG_LONG_INT])
ac_cv_type_long_long=$ac_cv_type_long_long_int
if test $ac_cv_type_long_long = yes; then
AC_DEFINE(HAVE_LONG_LONG, 1,
[Define if you have the 'long long' type.])
...
...
m4/mbchar.m4
View file @
94fdc60
# mbchar.m4 serial
2
dnl Copyright (C) 2005 Free Software Foundation, Inc.
# mbchar.m4 serial
4
dnl Copyright (C) 2005
-2006
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,11 +10,14 @@ dnl From Bruno Haible.
AC_DEFUN([gl_MBCHAR],
[
AC_REQUIRE([AC_GNU_SOURCE])
dnl The following line is that so the user can test
dnl
HAVE_WCHAR_H && HAVE_WCTYPE_H
before #include "mbchar.h".
AC_CHECK_HEADERS_ONCE(
wchar.h wctype.h
)
dnl Compile mbchar.c only if HAVE_WCHAR_H
&& HAVE_WCTYPE_H
.
if test $ac_cv_header_wchar_h = yes
&& test $ac_cv_header_wctype_h = yes
; then
dnl The following line is that so the user can test
HAVE_WCHAR_H
dnl before #include "mbchar.h".
AC_CHECK_HEADERS_ONCE(
[wchar.h]
)
dnl Compile mbchar.c only if HAVE_WCHAR_H.
if test $ac_cv_header_wchar_h = yes; then
MU_LIBOBJ([mbchar])
dnl Prerequisites of mbchar.h and mbchar.c.
AC_CHECK_HEADERS_ONCE([wctype.h])
AC_CHECK_FUNCS([iswcntrl])
fi
])
...
...
m4/mbswidth.m4
View file @
94fdc60
# mbswidth.m4 serial 1
1
dnl Copyright (C) 2000-2002, 2004 Free Software Foundation, Inc.
# mbswidth.m4 serial 1
2
dnl Copyright (C) 2000-2002, 2004
, 2006
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.
...
...
@@ -9,33 +9,11 @@ dnl From Bruno Haible.
AC_DEFUN([gl_MBSWIDTH],
[
AC_CHECK_HEADERS_ONCE(
wchar.h wctype.h
)
AC_CHECK_FUNCS_ONCE(
isascii iswprint mbsinit
)
AC_CHECK_FUNCS(
iswcntrl wcwidth
)
AC_CHECK_HEADERS_ONCE(
[wchar.h wctype.h]
)
AC_CHECK_FUNCS_ONCE(
[isascii mbsinit]
)
AC_CHECK_FUNCS(
[iswcntrl]
)
gl_FUNC_MBRTOWC
AC_CACHE_CHECK([whether wcwidth is declared], ac_cv_have_decl_wcwidth,
[AC_TRY_COMPILE([
/* AIX 3.2.5 declares wcwidth in <string.h>. */
#if HAVE_STRING_H
# include <string.h>
#endif
#if HAVE_WCHAR_H
# include <wchar.h>
#endif
], [
#ifndef wcwidth
char *p = (char *) wcwidth;
#endif
], ac_cv_have_decl_wcwidth=yes, ac_cv_have_decl_wcwidth=no)])
if test $ac_cv_have_decl_wcwidth = yes; then
ac_val=1
else
ac_val=0
fi
AC_DEFINE_UNQUOTED(HAVE_DECL_WCWIDTH, $ac_val,
[Define to 1 if you have the declaration of wcwidth(), and to 0 otherwise.])
dnl UnixWare 7.1.1 <wchar.h> has a declaration of a function mbswidth()
dnl that clashes with ours.
AC_CACHE_CHECK([whether mbswidth is declared in <wchar.h>],
...
...
m4/md5.m4
View file @
94fdc60
# md5.m4 serial
8
dnl Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
# md5.m4 serial
9
dnl Copyright (C) 2002, 2003, 2004, 2005
, 2006
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.c.
...
...
m4/mempcpy.m4
View file @
94fdc60
# mempcpy.m4 serial
3
dnl Copyright (C) 2003, 2004 Free Software Foundation, Inc.
# mempcpy.m4 serial
4
dnl Copyright (C) 2003, 2004
, 2006
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_MEMPCPY],
[
MU_LIBSOURCES([mempcpy.c, mempcpy.h])
dnl Persuade glibc <string.h> to declare mempcpy().
AC_REQUIRE([AC_GNU_SOURCE])
...
...
m4/onceonly.m4
View file @
94fdc60
# onceonly_2_57.m4 serial
3
dnl Copyright (C) 2002-2003, 2005 Free Software Foundation, Inc.
# onceonly_2_57.m4 serial
4
dnl Copyright (C) 2002-2003, 2005
-2006
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
...
...
@@ -7,10 +7,10 @@ dnl that contains a configuration script generated by Autoconf, under
dnl the same distribution terms as the rest of that program.
dnl This file defines some "once only" variants of standard autoconf macros.
dnl AC_CHECK_HEADERS_ONCE like AC_CHECK_HEADERS
dnl AC_CHECK_FUNCS_ONCE like AC_CHECK_FUNCS
dnl AC_CHECK_DECLS_ONCE like AC_CHECK_DECLS
dnl AC_REQUIRE([AC_
HEADER_STDC]) like AC_HEADER_STDC
dnl AC_CHECK_HEADERS_ONCE
like AC_CHECK_HEADERS
dnl AC_CHECK_FUNCS_ONCE
like AC_CHECK_FUNCS
dnl AC_CHECK_DECLS_ONCE
like AC_CHECK_DECLS
dnl AC_REQUIRE([AC_
FUNC_STRCOLL]) like AC_FUNC_STRCOLL
dnl The advantage is that the check for each of the headers/functions/decls
dnl will be put only once into the 'configure' file. It keeps the size of
dnl the 'configure' file down, and avoids redundant output when 'configure'
...
...
m4/regex.m4
View file @
94fdc60
#serial 3
6
#serial 3
9
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005,
# 2006 Free Software Foundation, Inc.
...
...
@@ -14,10 +14,6 @@ AC_PREREQ([2.50])
AC_DEFUN([gl_REGEX],
[
MU_LIBSOURCES(
[regcomp.c, regex.c, regex.h,
regex_internal.c, regex_internal.h, regexec.c])
AC_ARG_WITH([included-regex],
[AC_HELP_STRING([--without-included-regex],
[don't compile regex; this is the default on
...
...
@@ -28,7 +24,7 @@ AC_DEFUN([gl_REGEX],
yes|no) ac_use_included_regex=$with_included_regex
;;
'')
# If the system regex support is good enough that it passes the
the
# If the system regex support is good enough that it passes the
# following run test, then default to *not* using the included regex.c.
# If cross compiling, assume the test would fail and use the included
# regex.c. The first failing regular expression is from `Spencer ere
...
...
@@ -163,8 +159,9 @@ AC_DEFUN([gl_REGEX],
AC_DEFUN([gl_PREREQ_REGEX],
[
AC_REQUIRE([AC_GNU_SOURCE])
AC_REQUIRE([
gl
_C_RESTRICT])
AC_REQUIRE([
AC
_C_RESTRICT])
AC_REQUIRE([AM_LANGINFO_CODESET])
AC_CHECK_HEADERS_ONCE([locale.h wchar.h wctype.h])
AC_CHECK_FUNCS_ONCE([isblank mbrtowc mempcpy wcrtomb wcscoll])
AC_CHECK_FUNCS_ONCE([mbrtowc mempcpy wcrtomb wcscoll])
AC_CHECK_DECLS([isblank], [], [], [#include <ctype.h>])
])
...
...
m4/sha1.m4
View file @
94fdc60
# sha1.m4 serial
6
dnl Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
# sha1.m4 serial
7
dnl Copyright (C) 2002, 2003, 2004, 2005
, 2006
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_SHA1],
[
MU_LIBSOURCES([sha1.c, sha1.h])
MU_LIBOBJ([sha1])
dnl Prerequisites of lib/sha1.c.
...
...
m4/stat-macros.m4
View file @
94fdc60
#serial
2
#serial
3
# Copyright (C) 2005 Free Software Foundation, Inc.
# Copyright (C) 2005
, 2006
Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
...
...
@@ -8,7 +8,5 @@
AC_DEFUN([gl_STAT_MACROS],
[
MU_LIBSOURCES([stat-macros.h])
AC_REQUIRE([AC_HEADER_STAT])
])
...
...
m4/stdint.m4
View file @
94fdc60
# stdint.m4 serial 1
0
# stdint.m4 serial 1
8
dnl Copyright (C) 2001-2002, 2004-2006 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.
dnl From
Paul Eggert and
Bruno Haible.
dnl Test whether <stdint.h> is supported or must be substituted.
AC_DEFUN([gl_STDINT_H],
[
AC_PREREQ(2.59)dnl
dnl Check for long long int.
AC_REQUIRE([AC_TYPE_LONG_LONG_INT])
if test $ac_cv_type_long_long_int = yes; then
HAVE_LONG_LONG_INT=1
else
HAVE_LONG_LONG_INT=0
fi
AC_SUBST([HAVE_LONG_LONG_INT])
dnl Check for <wchar.h>.
AC_CHECK_HEADERS_ONCE([wchar.h])
if test $ac_cv_header_wchar_h = yes; then
...
...
@@ -18,582 +29,186 @@ AC_DEFUN([gl_STDINT_H],
fi
AC_SUBST([HAVE_WCHAR_H])
dnl Check for <stdint.h> that doesn't clash with <sys/types.h>.
gl_HEADER_STDINT_H
if test $gl_cv_header_stdint_h = yes; then
ac_cv_header_stdint_h=yes; dnl Hack for gl_FULL_HEADER_PATH.
gl_FULL_HEADER_PATH([stdint.h])
FULL_PATH_STDINT_H='<'$gl_cv_full_path_stdint_h'>'
AC_SUBST([FULL_PATH_STDINT_H])
HAVE_STDINT_H=1
else
HAVE_STDINT_H=0
fi
AC_SUBST([HAVE_STDINT_H])
dnl Check for <inttypes.h> that doesn't clash with <sys/types.h>.
gl_HEADER_INTTYPES_H
if test $gl_cv_header_inttypes_h = yes; then
ac_cv_header_inttypes_h=yes; dnl Hack for gl_FULL_HEADER_PATH.
gl_FULL_HEADER_PATH([inttypes.h])
FULL_PATH_INTTYPES_H='<'$gl_cv_full_path_inttypes_h'>'
AC_SUBST([FULL_PATH_INTTYPES_H])
dnl Check for <inttypes.h>.
dnl AC_INCLUDES_DEFAULT defines $ac_cv_header_inttypes_h.
if test $ac_cv_header_inttypes_h = yes; then
HAVE_INTTYPES_H=1
else
HAVE_INTTYPES_H=0
fi
AC_SUBST([HAVE_INTTYPES_H])
dnl Check for <sys/
int
types.h>.
AC_CHECK_HEADERS([sys/inttypes.h])
if test $ac_cv_header_sys_
int
types_h = yes; then
HAVE_SYS_
INT
TYPES_H=1
dnl Check for <sys/types.h>.
dnl AC_INCLUDES_DEFAULT defines $ac_cv_header_sys_types_h.
if test $ac_cv_header_sys_types_h = yes; then
HAVE_SYS_TYPES_H=1
else
HAVE_SYS_
INT
TYPES_H=0
HAVE_SYS_TYPES_H=0
fi
AC_SUBST([HAVE_SYS_
INT
TYPES_H])
AC_SUBST([HAVE_SYS_TYPES_H])
dnl Check for <sys/bitypes.h> (used in Linux libc4 >= 4.6.7 and libc5).
AC_CHECK_HEADERS([sys/bitypes.h])
if test $ac_cv_header_sys_bitypes_h = yes; then
HAVE_SYS_BITYPES_H=1
else
HAVE_SYS_BITYPES_H=0
fi
AC_SUBST([HAVE_SYS_BITYPES_H])
dnl Is long == int64_t ?
AC_CACHE_CHECK([whether 'long' is 64 bit wide], gl_cv_long_bitsize_64, [
AC_TRY_COMPILE([
#define POW63 ((((((long) 1 << 15) << 15) << 15) << 15) << 3)
#define POW64 ((((((long) 1 << 15) << 15) << 15) << 15) << 4)
typedef int array [2 * (POW63 != 0 && POW64 == 0) - 1];
], , gl_cv_long_bitsize_64=yes, gl_cv_long_bitsize_64=no)])
if test $gl_cv_long_bitsize_64 = yes; then
HAVE_LONG_64BIT=1
else
HAVE_LONG_64BIT=0
fi
AC_SUBST(HAVE_LONG_64BIT)
dnl Is long long == int64_t ?
AC_CACHE_CHECK([whether 'long long' is 64 bit wide], gl_cv_longlong_bitsize_64, [
AC_TRY_COMPILE([
#define POW63 ((((((long long) 1 << 15) << 15) << 15) << 15) << 3)
#define POW64 ((((((long long) 1 << 15) << 15) << 15) << 15) << 4)
typedef int array [2 * (POW63 != 0 && POW64 == 0) - 1];
], , gl_cv_longlong_bitsize_64=yes, gl_cv_longlong_bitsize_64=no)])
if test $gl_cv_longlong_bitsize_64 = yes; then
HAVE_LONG_LONG_64BIT=1
dnl AC_INCLUDES_DEFAULT defines $ac_cv_header_stdint_h.
if test $ac_cv_header_stdint_h = yes; then
gl_ABSOLUTE_HEADER([stdint.h])
ABSOLUTE_STDINT_H=\"$gl_cv_absolute_stdint_h\"
HAVE_STDINT_H=1
else
HAVE_LONG_LONG_64BIT=0
ABSOLUTE_STDINT_H=\"no/such/file/stdint.h\"
HAVE_STDINT_H=0
fi
AC_SUBST(HAVE_LONG_LONG_64BIT)
AC_SUBST([ABSOLUTE_STDINT_H])
AC_SUBST([HAVE_STDINT_H])
dnl
Here we use FULL_PATH_INTTYPES_H and FULL_PATH_STDINT_H, not just
dnl
<inttypes.h> and <stdint.h>, so that it also works during a
dnl
"config.status --recheck" if an inttypes.h or stdint.h have
been
dnl
Now see whether we need a substitute <stdint.h>. Use
dnl
ABSOLUTE_STDINT_H, not <stdint.h>, so that it also works during
dnl
a "config.status --recheck" if a stdint.h has
been
dnl created in the build directory.
other_includes='
/* Get those types that are already defined in other system include files. */
#if defined(__FreeBSD__) && (__FreeBSD__ >= 3) && (__FreeBSD__ <= 4)
# include <sys/inttypes.h>
if test $ac_cv_header_stdint_h = yes; then
AC_CACHE_CHECK([whether stdint.h conforms to C99],
[gl_cv_header_working_stdint_h],
[gl_cv_header_working_stdint_h=no
AC_COMPILE_IFELSE([
AC_LANG_PROGRAM([[
#include <stddef.h>
#define __STDC_LIMIT_MACROS 1 /* to make it work also in C++ mode */
#define __STDC_CONSTANT_MACROS 1 /* to make it work also in C++ mode */
#include ABSOLUTE_STDINT_H
#ifdef INT8_MAX
int8_t a1 = INT8_MAX;
int8_t a1min = INT8_MIN;
#endif
#if defined(__OpenBSD__) || defined(__bsdi__) || defined(__sgi)
# include <sys/types.h>
# if HAVE_INTTYPES_H
# include FULL_PATH_INTTYPES_H
# endif
#ifdef INT16_MAX
int16_t a2 = INT16_MAX;
int16_t a2min = INT16_MIN;
#endif
#if defined(__linux__) && HAVE_SYS_BITYPES_H
# include <sys/bitypes.h>
#ifdef INT32_MAX
int32_t a3 = INT32_MAX;
int32_t a3min = INT32_MIN;
#endif
#if defined(__sun) && HAVE_SYS_INTTYPES_H
# include <sys/inttypes.h>
#ifdef INT64_MAX
int64_t a4 = INT64_MAX;
int64_t a4min = INT64_MIN;
#endif
#if (defined(__hpux) || defined(_AIX)) && HAVE_INTTYPES_H
# include FULL_PATH_INTTYPES_H
#ifdef UINT8_MAX
uint8_t b1 = UINT8_MAX;
#else
typedef int b1[(unsigned char) -1 != 255 ? 1 : -1];
#endif
#if
HAVE_STDINT_H && !(defined(__sgi) && HAVE_INTTYPES_H && !defined(__c99))
# include FULL_PATH_STDINT_H
#if
def UINT16_MAX
uint16_t b2 = UINT16_MAX;
#endif
'
gl_STDINT_CHECK_TYPES(
[int8_t int16_t int32_t int64_t \
uint8_t uint16_t uint32_t uint64_t \
int_least8_t int_least16_t int_least32_t int_least64_t \
uint_least8_t uint_least16_t uint_least32_t uint_least64_t \
int_fast8_t int_fast16_t int_fast32_t int_fast64_t \
uint_fast8_t uint_fast16_t uint_fast32_t uint_fast64_t \
intptr_t uintptr_t \
intmax_t uintmax_t],
[$other_includes],
[gl_cv_type_], [], [])
dnl Now see if we need a substitute <stdint.h>.
gl_cv_header_working_stdint_h=no
if test $gl_cv_header_stdint_h = yes; then
gl_STDINT_CHECK_TYPES(
[int64_t uint64_t \
int_least64_t uint_least64_t \
int_fast64_t uint_fast64_t],
[#include <stdint.h>],
[gl_cv_stdint_], [_IN_STDINT_H], [in <stdint.h>])
AC_COMPILE_IFELSE([
AC_LANG_PROGRAM([
#define __STDC_LIMIT_MACROS 1 /* to make it work also in C++ mode */
#include <stdint.h>
int8_t a1 = INT8_C (17);
int16_t a2 = INT16_C (17);
int32_t a3 = INT32_C (17);
#if HAVE_INT64_T_IN_STDINT_H
int64_t a4 = INT64_C (17);
#ifdef UINT32_MAX
uint32_t b3 = UINT32_MAX;
#endif
uint8_t b1 = UINT8_C (17);
uint16_t b2 = UINT16_C (17);
uint32_t b3 = UINT32_C (17);
#if HAVE_UINT64_T_IN_STDINT_H
uint64_t b4 = UINT64_C (17);
#ifdef UINT64_MAX
uint64_t b4 = UINT64_MAX;
#endif
int_least8_t c1 = 17;
int_least16_t c2 = 17;
int_least32_t c3 = 17;
#if HAVE_INT_LEAST64_T_IN_STDINT_H
int_least64_t c4 = 17;
int_least8_t c1 = INT8_C (0x7f);
int_least8_t c1max = INT_LEAST8_MAX;
int_least8_t c1min = INT_LEAST8_MIN;
int_least16_t c2 = INT16_C (0x7fff);
int_least16_t c2max = INT_LEAST16_MAX;
int_least16_t c2min = INT_LEAST16_MIN;
int_least32_t c3 = INT32_C (0x7fffffff);
int_least32_t c3max = INT_LEAST32_MAX;
int_least32_t c3min = INT_LEAST32_MIN;
int_least64_t c4 = INT64_C (0x7fffffffffffffff);
int_least64_t c4max = INT_LEAST64_MAX;
int_least64_t c4min = INT_LEAST64_MIN;
uint_least8_t d1 = UINT8_C (0xff);
uint_least8_t d1max = UINT_LEAST8_MAX;
uint_least16_t d2 = UINT16_C (0xffff);
uint_least16_t d2max = UINT_LEAST16_MAX;
uint_least32_t d3 = UINT32_C (0xffffffff);
uint_least32_t d3max = UINT_LEAST32_MAX;
uint_least64_t d4 = UINT64_C (0xffffffffffffffff);
uint_least64_t d4max = UINT_LEAST64_MAX;
int_fast8_t e1 = INT_FAST8_MAX;
int_fast8_t e1min = INT_FAST8_MIN;
int_fast16_t e2 = INT_FAST16_MAX;
int_fast16_t e2min = INT_FAST16_MIN;
int_fast32_t e3 = INT_FAST32_MAX;
int_fast32_t e3min = INT_FAST32_MIN;
int_fast64_t e4 = INT_FAST64_MAX;
int_fast64_t e4min = INT_FAST64_MIN;
uint_fast8_t f1 = UINT_FAST8_MAX;
uint_fast16_t f2 = UINT_FAST16_MAX;
uint_fast32_t f3 = UINT_FAST32_MAX;
uint_fast64_t f4 = UINT_FAST64_MAX;
#ifdef INTPTR_MAX
intptr_t g = INTPTR_MAX;
intptr_t gmin = INTPTR_MIN;
#endif
uint_least8_t d1 = 17;
uint_least16_t d2 = 17;
uint_least32_t d3 = 17;
#if HAVE_UINT_LEAST64_T_IN_STDINT_H
uint_least64_t d4 = 17;
#ifdef UINTPTR_MAX
uintptr_t h = UINTPTR_MAX;
#endif
int_fast8_t e1 = 17;
int_fast16_t e2 = 17;
int_fast32_t e3 = 17;
#if HAVE_INT_FAST64_T_IN_STDINT_H
int_fast64_t e4 = 17;
intmax_t i = INTMAX_MAX;
uintmax_t j = UINTMAX_MAX;
struct s {
int check_PTRDIFF: PTRDIFF_MIN < 0 && 0 < PTRDIFF_MAX ? 1 : -1;
int check_SIG_ATOMIC: SIG_ATOMIC_MIN <= 0 && 0 < SIG_ATOMIC_MAX ? 1 : -1;
int check_SIZE: 0 < SIZE_MAX ? 1 : -1;
int check_WCHAR: WCHAR_MIN <= 0 && 0 < WCHAR_MAX ? 1 : -1;
int check_WINT: WINT_MIN <= 0 && 0 < WINT_MAX ? 1 : -1;
/* Detect bugs in glibc 2.4 and Solaris 10 stdint.h, among others. */
int check_UINT8_C:
(-1 < UINT8_C (0)) == (-1 < (uint_least8_t) 0) ? 1 : -1;
int check_UINT16_C:
(-1 < UINT16_C (0)) == (-1 < (uint_least16_t) 0) ? 1 : -1;
/* Detect bugs in OpenBSD 3.9 stdint.h. */
#ifdef UINT8_MAX
int check_uint8: (uint8_t) -1 == UINT8_MAX ? 1 : -1;
#endif
uint_fast8_t f1 = 17;
uint_fast16_t f2 = 17;
uint_fast32_t f3 = 17;
#if HAVE_UINT_FAST64_T_IN_STDINT_H
uint_fast64_t f4 = 17;
#ifdef UINT16_MAX
int check_uint16: (uint16_t) -1 == UINT16_MAX ? 1 : -1;
#endif
intptr_t g = 17;
uintptr_t h = 17;
intmax_t i = INTMAX_C (17);
uintmax_t j = UINTMAX_C (17);
])],
[gl_cv_header_working_stdint_h=yes])
fi
if test $gl_cv_header_working_stdint_h = yes; then
dnl Use the existing <stdint.h>, adding missing macro definitions.
suff64=
suffu64=
if test $HAVE_LONG_64BIT = 1; then
suff64=L
suffu64=UL
else
if test $HAVE_LONG_LONG_64BIT = 1; then
suff64=LL
suffu64=ULL
else
AC_EGREP_CPP([msvc compiler], [
#ifdef _MSC_VER
msvc compiler
#ifdef UINT32_MAX
int check_uint32: (uint32_t) -1 == UINT32_MAX ? 1 : -1;
#endif
], [
suff64=i64
suffu64=ui64
])
fi
fi
dnl Here we assume a standard architecture where the hardware integer
dnl types have 8, 16, 32, optionally 64 bits.
gl_STDINT_MISSING_BOUND([INT8_MIN], [-128],
[Define if <stdint.h> doesn't define it.])
gl_STDINT_MISSING_BOUND([INT8_MAX], [127],
[Define if <stdint.h> doesn't define it.])
gl_STDINT_MISSING_BOUND([UINT8_MAX], [255],
[Define if <stdint.h> doesn't define it.])
gl_STDINT_MISSING_BOUND([INT16_MIN], [-32768],
[Define if <stdint.h> doesn't define it.])
gl_STDINT_MISSING_BOUND([INT16_MAX], [32767],
[Define if <stdint.h> doesn't define it.])
gl_STDINT_MISSING_BOUND([UINT16_MAX], [65535],
[Define if <stdint.h> doesn't define it.])
gl_STDINT_MISSING_BOUND([INT32_MIN], [(~INT32_MAX)],
[Define if <stdint.h> doesn't define it.])
gl_STDINT_MISSING_BOUND([INT32_MAX], [2147483647],
[Define if <stdint.h> doesn't define it.])
gl_STDINT_MISSING_BOUND([UINT32_MAX], [4294967295U],
[Define if <stdint.h> doesn't define it.])
if test $gl_cv_stdint_int64_t = yes; then
gl_STDINT_MISSING_BOUND([INT64_MIN], [(~INT64_MAX)],
[Define if <stdint.h> doesn't define it but has the int64_t type.])
gl_STDINT_MISSING_BOUND([INT64_MAX], [9223372036854775807${suff64}],
[Define if <stdint.h> doesn't define it but has the int64_t type.])
fi
if test $gl_cv_stdint_uint64_t = yes; then
gl_STDINT_MISSING_BOUND([UINT64_MAX], [18446744073709551615${suffu64}],
[Define if <stdint.h> doesn't define it but has the uint64_t type.])
fi
dnl Here we assume a standard architecture where the hardware integer
dnl types have 8, 16, 32, optionally 64 bits. Therefore the leastN_t types
dnl are the same as the corresponding N_t types.
gl_STDINT_MISSING_BOUND([INT_LEAST8_MIN], [INT8_MIN],
[Define if <stdint.h> doesn't define it.])
gl_STDINT_MISSING_BOUND([INT_LEAST8_MAX], [INT8_MAX],
[Define if <stdint.h> doesn't define it.])
gl_STDINT_MISSING_BOUND([UINT_LEAST8_MAX], [UINT8_MAX],
[Define if <stdint.h> doesn't define it.])
gl_STDINT_MISSING_BOUND([INT_LEAST16_MIN], [INT16_MIN],
[Define if <stdint.h> doesn't define it.])
gl_STDINT_MISSING_BOUND([INT_LEAST16_MAX], [INT16_MAX],
[Define if <stdint.h> doesn't define it.])
gl_STDINT_MISSING_BOUND([UINT_LEAST16_MAX], [UINT16_MAX],
[Define if <stdint.h> doesn't define it.])
gl_STDINT_MISSING_BOUND([INT_LEAST32_MIN], [INT32_MIN],
[Define if <stdint.h> doesn't define it.])
gl_STDINT_MISSING_BOUND([INT_LEAST32_MAX], [INT32_MAX],
[Define if <stdint.h> doesn't define it.])
gl_STDINT_MISSING_BOUND([UINT_LEAST32_MAX], [UINT32_MAX],
[Define if <stdint.h> doesn't define it.])
if test $gl_cv_stdint_int_least64_t = yes; then
gl_STDINT_MISSING_BOUND([INT_LEAST64_MIN], [INT64_MIN],
[Define if <stdint.h> doesn't define it but has the int_least64_t type.])
gl_STDINT_MISSING_BOUND([INT_LEAST64_MAX], [INT64_MAX],
[Define if <stdint.h> doesn't define it but has the int_least64_t type.])
fi
if test $gl_cv_stdint_uint_least64_t = yes; then
gl_STDINT_MISSING_BOUND([UINT_LEAST64_MAX], [UINT64_MAX],
[Define if <stdint.h> doesn't define it but has the uint_least64_t type.])
fi
dnl Here we assume a standard architecture where the hardware integer
dnl types have 8, 16, 32, optionally 64 bits. Therefore the fastN_t types
dnl are taken from the same list of types.
gl_STDINT_MISSING_BOUNDS([INT_FAST8_MIN INT_FAST8_MAX UINT_FAST8_MAX \
INT_FAST16_MIN INT_FAST16_MAX UINT_FAST16_MAX \
INT_FAST32_MIN INT_FAST32_MAX UINT_FAST32_MAX])
if test $gl_cv_stdint_uint_fast64_t = yes; then
gl_STDINT_MISSING_BOUNDS([INT_FAST64_MIN INT_FAST64_MAX])
fi
if test $gl_cv_stdint_uint_fast64_t = yes; then
gl_STDINT_MISSING_BOUNDS([UINT_FAST64_MAX])
fi
gl_STDINT_MISSING_BOUNDS([INTPTR_MIN INTPTR_MAX UINTPTR_MAX \
INTMAX_MIN INTMAX_MAX UINTMAX_MAX])
gl_STDINT_MISSING_BOUNDS([PTRDIFF_MIN PTRDIFF_MAX], [#include <stddef.h>])
gl_SIZE_MAX
gl_STDINT_MISSING_BOUNDS2([SIG_ATOMIC_MIN SIG_ATOMIC_MAX],
[#include <signal.h>])
dnl Don't bother defining WCHAR_MIN and WCHAR_MAX, since they should
dnl already be defined in <stddef.h> or <wchar.h>.
dnl For wint_t we need <wchar.h>.
dnl Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included
dnl before <wchar.h>.
dnl BSD/OS 4.1 has a bug: <stdio.h> and <time.h> must be included before
dnl <wchar.h>.
gl_STDINT_MISSING_BOUNDS2([WINT_MIN WINT_MAX], [
#include <stdio.h>
#include <time.h>
#include <wchar.h>
])
STDINT_H=''
else
gl_STDINT_BITSIZEOF(
[int8_t int16_t int32_t int64_t \
uint8_t uint16_t uint32_t uint64_t \
int_least8_t int_least16_t int_least32_t int_least64_t \
uint_least8_t uint_least16_t uint_least32_t uint_least64_t \
int_fast8_t int_fast16_t int_fast32_t int_fast64_t \
uint_fast8_t uint_fast16_t uint_fast32_t uint_fast64_t \
intptr_t uintptr_t \
intmax_t uintmax_t],
[$other_includes])
gl_cv_type_unsigned_int=yes
gl_cv_type_long=yes
gl_cv_type_unsigned_long=yes
gl_STDINT_BITSIZEOF([unsigned_int long unsigned_long],
[typedef unsigned int unsigned_int;
typedef unsigned long unsigned_long;])
AC_CHECK_TYPES([ptrdiff_t])
gl_cv_type_ptrdiff_t=$ac_cv_type_ptrdiff_t
AC_REQUIRE([AC_TYPE_SIZE_T])
gl_cv_type_size_t=yes
gl_STDINT_BITSIZEOF([ptrdiff_t size_t], [#include <stddef.h>])
gl_CHECK_TYPE_SAME([ptrdiff_t], [long], [#include <stddef.h>])
gl_CHECK_TYPE_SAME([size_t], [unsigned long], [#include <stddef.h>])
AC_CHECK_TYPES([sig_atomic_t], , , [#include <signal.h>])
gl_cv_type_sig_atomic_t=$ac_cv_type_sig_atomic_t
gl_STDINT_BITSIZEOF([sig_atomic_t], [#include <signal.h>])
gl_CHECK_TYPES_SIGNED([sig_atomic_t], [#include <signal.h>])
if test $HAVE_SIGNED_SIG_ATOMIC_T = 1; then
gl_CHECK_TYPE_SAME([sig_atomic_t], [long], [#include <signal.h>])
else
gl_CHECK_TYPE_SAME([sig_atomic_t], [unsigned long], [#include <signal.h>])
fi
#ifdef UINT64_MAX
int check_uint64: (uint64_t) -1 == UINT64_MAX ? 1 : -1;
#endif
int check_uint_least8: (uint_least8_t) -1 == UINT_LEAST8_MAX ? 1 : -1;
int check_uint_least16: (uint_least16_t) -1 == UINT_LEAST16_MAX ? 1 : -1;
int check_uint_least32: (uint_least32_t) -1 == UINT_LEAST32_MAX ? 1 : -1;
int check_uint_least64: (uint_least64_t) -1 == UINT_LEAST64_MAX ? 1 : -1;
int check_uint_fast8: (uint_fast8_t) -1 == UINT_FAST8_MAX ? 1 : -1;
int check_uint_fast16: (uint_fast16_t) -1 == UINT_FAST16_MAX ? 1 : -1;
int check_uint_fast32: (uint_fast32_t) -1 == UINT_FAST32_MAX ? 1 : -1;
int check_uint_fast64: (uint_fast64_t) -1 == UINT_FAST64_MAX ? 1 : -1;
int check_uintptr: (uintptr_t) -1 == UINTPTR_MAX ? 1 : -1;
int check_uintmax: (uintmax_t) -1 == UINTMAX_MAX ? 1 : -1;
int check_size: (size_t) -1 == SIZE_MAX ? 1 : -1;
};
]])],
[gl_cv_header_working_stdint_h=yes])])
fi
if test "$gl_cv_header_working_stdint_h" != yes; then
AC_REQUIRE([gt_TYPE_WCHAR_T])
gl_cv_type_wchar_t=$gt_cv_c_wchar_t
gl_STDINT_BITSIZEOF([wchar_t], [#include <stddef.h>])
gl_CHECK_TYPES_SIGNED([wchar_t], [#include <stddef.h>])
if test $HAVE_SIGNED_WCHAR_T = 1; then
gl_CHECK_TYPE_SAME([wchar_t], [long], [#include <stddef.h>])
dnl Check for <sys/inttypes.h>, and for
dnl <sys/bitypes.h> (used in Linux libc4 >= 4.6.7 and libc5).
AC_CHECK_HEADERS([sys/inttypes.h sys/bitypes.h])
if test $ac_cv_header_sys_inttypes_h = yes; then
HAVE_SYS_INTTYPES_H=1
else
gl_CHECK_TYPE_SAME([wchar_t], [unsigned long], [#include <stddef.h>])
HAVE_SYS_INTTYPES_H=0
fi
dnl For wint_t we need <wchar.h>.
dnl Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included
dnl before <wchar.h>.
dnl BSD/OS 4.1 has a bug: <stdio.h> and <time.h> must be included before
dnl <wchar.h>.
AC_CHECK_TYPES([wint_t], , , [#include <stdio.h>
#include <time.h>
#include <wchar.h>
])
gl_cv_type_wint_t=$ac_cv_type_wint_t
gl_STDINT_BITSIZEOF([wint_t], [#include <stdio.h>
#include <time.h>
#include <wchar.h>
])
gl_CHECK_TYPES_SIGNED([wint_t], [#include <stdio.h>
#include <time.h>
#include <wchar.h>
])
if test $HAVE_SIGNED_WINT_T = 1; then
gl_CHECK_TYPE_SAME([wint_t], [long], [#include <stdio.h>
#include <time.h>
#include <wchar.h>
])
AC_SUBST([HAVE_SYS_INTTYPES_H])
if test $ac_cv_header_sys_bitypes_h = yes; then
HAVE_SYS_BITYPES_H=1
else
gl_CHECK_TYPE_SAME([wint_t], [unsigned long], [#include <stdio.h>
#include <time.h>
#include <wchar.h>
])
HAVE_SYS_BITYPES_H=0
fi
AC_SUBST([HAVE_SYS_BITYPES_H])
STDINT_H='stdint.h'
gl_STDINT_TYPE_PROPERTIES
STDINT_H=stdint.h
fi
AC_SUBST(STDINT_H)
])
dnl Set gl_cv_header_stdint_h to yes and define HAVE_STDINT_H if
dnl <stdint.h> exists and doesn't clash with <sys/types.h>.
AC_DEFUN([gl_HEADER_STDINT_H],
[
dnl Check for <stdint.h> that doesn't clash with <sys/types.h>.
AC_CACHE_CHECK([for stdint.h], gl_cv_header_stdint_h, [
AC_TRY_COMPILE([
#include <sys/types.h>
#include <stdint.h>],
[], gl_cv_header_stdint_h=yes, gl_cv_header_stdint_h=no)
])
if test $gl_cv_header_stdint_h = yes; then
AC_DEFINE_UNQUOTED(HAVE_STDINT_H, 1,
[Define if <stdint.h> exists and doesn't clash with <sys/types.h>.])
fi
])
dnl Set gl_cv_header_inttypes_h to yes and define HAVE_INTTYPES_H if
dnl <inttypes.h> exists and doesn't clash with <sys/types.h>.
AC_DEFUN([gl_HEADER_INTTYPES_H],
[
dnl Check for <inttypes.h> that doesn't clash with <sys/types.h>.
dnl On IRIX 5.3, <inttypes.h> conflicts with <sys/types.h>.
AC_CACHE_CHECK([for inttypes.h], gl_cv_header_inttypes_h, [
AC_TRY_COMPILE([
#include <sys/types.h>
#include <inttypes.h>],
[], gl_cv_header_inttypes_h=yes, gl_cv_header_inttypes_h=no)
])
if test $gl_cv_header_inttypes_h = yes; then
AC_DEFINE_UNQUOTED(HAVE_INTTYPES_H, 1,
[Define if <inttypes.h> exists and doesn't clash with <sys/types.h>.])
fi
])
dnl gl_STDINT_CHECK_TYPES(TYPES, INCLUDES, CACHE_VAR_PREFIX, MACRO_SUFFIX, DESCRIPTION_SUFFIX)
dnl Check each of the given types, whether they are defined in the given
dnl include files.
AC_DEFUN([gl_STDINT_CHECK_TYPES],
[
dnl Use a shell loop, to avoid bloating configure, and
dnl - extra AH_TEMPLATE calls, so that autoheader knows what to put into
dnl config.h.in,
dnl - extra AC_SUBST calls, so that the right substitutions are made.
AC_FOREACH([gltype], [$1],
[AH_TEMPLATE([HAVE_]translit(gltype,[abcdefghijklmnopqrstuvwxyz],[ABCDEFGHIJKLMNOPQRSTUVWXYZ])[$4],
[Define to 1 if the type ']gltype[' is already defined$5.])])
for gltype in $1 ; do
AC_MSG_CHECKING([for $gltype])
AC_COMPILE_IFELSE([
AC_LANG_PROGRAM([$2
/* Test if the type exists. */
$gltype x = 17;
])],
result=yes, result=no)
eval $3${gltype}=\$result
AC_MSG_RESULT($result)
GLTYPE=`echo "$gltype" | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ`
if test $result = yes; then
AC_DEFINE_UNQUOTED([HAVE_${GLTYPE}$4], 1)
eval HAVE_${GLTYPE}$4=1
else
eval HAVE_${GLTYPE}$4=0
fi
done
AC_FOREACH([gltype], [$1],
[AC_SUBST([HAVE_]translit(gltype,[abcdefghijklmnopqrstuvwxyz],[ABCDEFGHIJKLMNOPQRSTUVWXYZ])[$4])])
])
dnl gl_STDINT_MISSING_BOUND(TYPE_BOUND, DEFAULT, DESCRIPTION)
dnl assumes an otherwise complete <stdint.h> and defines TYPE_BOUND if
dnl <stdint.h> doesn't define it.
AC_DEFUN([gl_STDINT_MISSING_BOUND],
[
AC_CACHE_CHECK([for $1], [gl_cv_stdint_$1],
[AC_EGREP_CPP([found it], [#include <stdint.h>
#ifdef $1
found it
#endif
], [gl_cv_stdint_$1=yes], [gl_cv_stdint_$1="$2"])])
if test "$gl_cv_stdint_$1" != yes; then
AC_DEFINE_UNQUOTED([$1], [$2], [$3])
fi
])
dnl gl_STDINT_MISSING_BOUNDS(BOUNDS, INCLUDES)
dnl assumes an otherwise complete <stdint.h> and defines each element of BOUNDS
dnl if <stdint.h> doesn't define it.
dnl Use this for types whose signedness is determined by the first letter
dnl ('u' or not).
AC_DEFUN([gl_STDINT_MISSING_BOUNDS],
[
dnl Use a shell loop, to avoid bloating configure, and
dnl - extra AH_TEMPLATE calls, so that autoheader knows what to put into
dnl config.h.in.
AC_FOREACH([bound], [$1],
[AH_TEMPLATE(bound, [Define if <stdint.h> doesn't define it.])])
changequote(,)dnl
sed_unsigned='s,^\(U*\).*,\1,'
sed_limitkind='s,^.*\(_[^_]*\)$,\1,'
changequote([,])dnl
for bound in $1; do
type=`echo $bound | sed -e 's,_MAX,_t,' -e 's,_MIN,_t,' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`
unsigned=`echo $bound | sed -e "$sed_unsigned" | tr U u`
width=`echo $bound | sed -e 's,^U*INT,,' -e 's,_MIN,,' -e 's,_MAX,,'`
limitkind=`echo $bound | sed -e "$sed_limitkind"`
AC_CACHE_CHECK([for $bound], [gl_cv_stdint_$bound],
[AC_EGREP_CPP([found it], [#include <stdint.h>
#ifdef $bound
found it
#endif
], [eval gl_cv_stdint_$bound=yes],
[result=
case $width in
*8) widthlist="8 16 32 64" ;;
*16) widthlist="16 32 64" ;;
*32 | PTR | MAX | PTRDIFF) widthlist="32 64" ;;
*64) widthlist="64" ;;
esac
for w in $widthlist; do
if test -z "$result"; then
AC_COMPILE_IFELSE([[$2
#include <stdint.h>
int verify[2 * (sizeof ($type) == sizeof (${unsigned}int${w}_t)) - 1];
]], [result=`echo "$unsigned" | tr u U`INT${w}${limitkind}])
else
break
fi
done
if test -z "$result"; then
result=no
fi
eval gl_cv_stdint_$bound=\$result
])])
eval result=\$gl_cv_stdint_$bound
if test "$result" != yes && test "$result" != no; then
AC_DEFINE_UNQUOTED([$bound], [$result],
[Define if <stdint.h> doesn't define it.])
fi
done
])
dnl gl_STDINT_MISSING_BOUNDS2(BOUNDS, INCLUDES)
dnl assumes an otherwise complete <stdint.h> and defines each element of BOUNDS
dnl if <stdint.h> doesn't define it.
dnl Use this for types whose signedness is a priori unknown.
AC_DEFUN([gl_STDINT_MISSING_BOUNDS2],
[
dnl Use a shell loop, to avoid bloating configure, and
dnl - extra AH_TEMPLATE calls, so that autoheader knows what to put into
dnl config.h.in.
AC_FOREACH([bound], [$1],
[AH_TEMPLATE(bound, [Define if <stdint.h> doesn't define it.])])
changequote(,)dnl
sed_limitkind='s,^.*\(_[^_]*\)$,\1,'
changequote([,])dnl
for bound in $1; do
type=`echo $bound | sed -e 's,_MAX,_t,' -e 's,_MIN,_t,' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`
limitkind=`echo $bound | sed -e "$sed_limitkind"`
AC_CACHE_CHECK([for $bound], [gl_cv_stdint_$bound],
[AC_EGREP_CPP([found it], [#include <stdint.h>
#ifdef $bound
found it
#endif
], [eval gl_cv_stdint_$bound=yes],
[result=
AC_COMPILE_IFELSE([[$2
int verify[2 * (($type) -1 >= ($type) 0) - 1];
]],
[eval gl_cv_${type}_signed=no],
[eval gl_cv_${type}_signed=yes])
if eval test \$gl_cv_${type}_signed = yes; then
for w in 8 16 32 64; do
if test -z "$result"; then
AC_COMPILE_IFELSE([[$2
#include <stdint.h>
int verify[2 * (sizeof ($type) == sizeof (int${w}_t)) - 1];
]], [result=INT${w}${limitkind}])
else
break
fi
done
else
if test ${limitkind} = _MIN; then
result=0
else
for w in 8 16 32 64; do
if test -z "$result"; then
AC_COMPILE_IFELSE([[$2
#include <stdint.h>
int verify[2 * (sizeof ($type) == sizeof (uint${w}_t)) - 1];
]], [result=UINT${w}${limitkind}])
else
break
fi
done
fi
fi
if test -z "$result"; then
result=no
fi
eval gl_cv_stdint_$bound=\$result
])])
eval result=\$gl_cv_stdint_$bound
if test "$result" != yes && test "$result" != no; then
AC_DEFINE_UNQUOTED([$bound], [$result],
[Define if <stdint.h> doesn't define it.])
fi
done
])
dnl gl_STDINT_BITSIZEOF(TYPES, INCLUDES)
dnl Determine the size of each of the given types in bits.
AC_DEFUN([gl_STDINT_BITSIZEOF],
...
...
@@ -606,18 +221,26 @@ AC_DEFUN([gl_STDINT_BITSIZEOF],
[AH_TEMPLATE([BITSIZEOF_]translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[ABCDEFGHIJKLMNOPQRSTUVWXYZ_]),
[Define to the number of bits in type ']gltype['.])])
for gltype in $1 ; do
if eval test \$gl_cv_type_${gltype} = yes; then
AC_CACHE_CHECK([for bit size of $gltype], [gl_cv_bitsizeof_${gltype}],
[_AC_COMPUTE_INT([sizeof ($gltype) * CHAR_BIT], result,
[$2
#include <limits.h>], result=unknown)
eval gl_cv_bitsizeof_${gltype}=\$result
])
eval result=\$gl_cv_bitsizeof_${gltype}
GLTYPE=`echo "$gltype" | tr 'abcdefghijklmnopqrstuvwxyz ' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ_'`
AC_DEFINE_UNQUOTED([BITSIZEOF_${GLTYPE}], [$result])
eval BITSIZEOF_${GLTYPE}=\$result
AC_CACHE_CHECK([for bit size of $gltype], [gl_cv_bitsizeof_${gltype}],
[_AC_COMPUTE_INT([sizeof ($gltype) * CHAR_BIT], result,
[$2
#include <limits.h>], [result=unknown])
eval gl_cv_bitsizeof_${gltype}=\$result
])
eval result=\$gl_cv_bitsizeof_${gltype}
if test $result = unknown; then
dnl Use a nonempty default, because some compilers, such as IRIX 5 cc,
dnl do a syntax check even on unused #if conditions and give an error
dnl on valid C code like this:
dnl #if 0
dnl # if > 32
dnl # endif
dnl #endif
result=0
fi
GLTYPE=`echo "$gltype" | tr 'abcdefghijklmnopqrstuvwxyz ' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ_'`
AC_DEFINE_UNQUOTED([BITSIZEOF_${GLTYPE}], [$result])
eval BITSIZEOF_${GLTYPE}=\$result
done
AC_FOREACH([gltype], [$1],
[AC_SUBST([BITSIZEOF_]translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[ABCDEFGHIJKLMNOPQRSTUVWXYZ_]))])
...
...
@@ -638,9 +261,8 @@ AC_DEFUN([gl_CHECK_TYPES_SIGNED],
for gltype in $1 ; do
AC_CACHE_CHECK([whether $gltype is signed], [gl_cv_type_${gltype}_signed],
[AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([[$2
int verify[2 * (($1) -1 < ($1) 0) - 1];
]])],
[AC_LANG_PROGRAM([$2[
int verify[2 * (($gltype) -1 < ($gltype) 0) - 1];]])],
result=yes, result=no)
eval gl_cv_type_${gltype}_signed=\$result
])
...
...
@@ -657,14 +279,83 @@ AC_DEFUN([gl_CHECK_TYPES_SIGNED],
[AC_SUBST([HAVE_SIGNED_]translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[ABCDEFGHIJKLMNOPQRSTUVWXYZ_]))])
])
dnl gl_CHECK_TYPE_SAME(TYPE, KNOWNTYPE, INCLUDES)
dnl Determines whether two types are the same.
AC_DEFUN([gl_CHECK_TYPE_SAME],
dnl gl_INTEGER_TYPE_SUFFIX(TYPES, INCLUDES)
dnl Determine the suffix to use for integer constants of the given types.
dnl Define t_SUFFIX for each such type.
AC_DEFUN([gl_INTEGER_TYPE_SUFFIX],
[
dnl Use a shell loop, to avoid bloating configure, and
dnl - extra AH_TEMPLATE calls, so that autoheader knows what to put into
dnl config.h.in,
dnl - extra AC_SUBST calls, so that the right substitutions are made.
AC_FOREACH([gltype], [$1],
[AH_TEMPLATE(translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[ABCDEFGHIJKLMNOPQRSTUVWXYZ_])[_SUFFIX],
[Define to l, ll, u, ul, ull, etc., as suitable for
constants of type ']gltype['.])])
for gltype in $1 ; do
AC_CACHE_CHECK([for $gltype integer literal suffix],
[gl_cv_type_${gltype}_suffix],
[eval gl_cv_type_${gltype}_suffix=no
eval result=\$gl_cv_type_${gltype}_signed
if test "$result" = yes; then
glsufu=
else
glsufu=u
fi
for glsuf in "$glsufu" ${glsufu}l ${glsufu}ll ${glsufu}i64; do
case $glsuf in
'') gltype1='int';;
l) gltype1='long int';;
ll) gltype1='long long int';;
i64) gltype1='__int64';;
u) gltype1='unsigned int';;
ul) gltype1='unsigned long int';;
ull) gltype1='unsigned long long int';;
ui64)gltype1='unsigned __int64';;
esac
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([$2
extern $gltype foo;
extern $gltype1 foo;])],
[eval gl_cv_type_${gltype}_suffix=\$glsuf])
eval result=\$gl_cv_type_${gltype}_suffix
test "$result" != no && break
done])
GLTYPE=`echo $gltype | tr 'abcdefghijklmnopqrstuvwxyz ' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ_'`
eval result=\$gl_cv_type_${gltype}_suffix
test "$result" = no && result=
eval ${GLTYPE}_SUFFIX=\$result
AC_DEFINE_UNQUOTED([${GLTYPE}_SUFFIX], $result)
done
AC_FOREACH([gltype], [$1],
[AC_SUBST(translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[ABCDEFGHIJKLMNOPQRSTUVWXYZ_])[_SUFFIX])])
])
dnl gl_STDINT_INCLUDES
AC_DEFUN([gl_STDINT_INCLUDES],
[[
#include <stddef.h>
#include <signal.h>
#if HAVE_WCHAR_H
/* BSD/OS 4.1 has a bug: <stdio.h> and <time.h> must be included before
<wchar.h>. */
# include <stdio.h>
# include <time.h>
# include <wchar.h>
#endif
]])
dnl gl_STDINT_TYPE_PROPERTIES
dnl Compute HAVE_SIGNED_t, BITSIZEOF_t and t_SUFFIX, for all the types t
dnl of interest to stdint_.h.
AC_DEFUN([gl_STDINT_TYPE_PROPERTIES],
[
AC_TRY_COMPILE([$3
extern $1 foo;
extern $2 foo;], [],
[SAME_TYPE_]AS_TR_CPP([$1])[_]AS_TR_CPP([$2])[=1],
[SAME_TYPE_]AS_TR_CPP([$1])[_]AS_TR_CPP([$2])[=0])
AC_SUBST([SAME_TYPE_]AS_TR_CPP([$1])[_]AS_TR_CPP([$2]))
gl_STDINT_BITSIZEOF([ptrdiff_t sig_atomic_t size_t wchar_t wint_t],
[gl_STDINT_INCLUDES])
gl_CHECK_TYPES_SIGNED([sig_atomic_t wchar_t wint_t],
[gl_STDINT_INCLUDES])
gl_cv_type_ptrdiff_t_signed=yes
gl_cv_type_size_t_signed=no
gl_INTEGER_TYPE_SUFFIX([ptrdiff_t sig_atomic_t size_t wchar_t wint_t],
[gl_STDINT_INCLUDES])
])
...
...
m4/stdint_h_gl.m4
View file @
94fdc60
# stdint_h.m4 serial
5
dnl Copyright (C) 1997-2004 Free Software Foundation, Inc.
# stdint_h.m4 serial
6
dnl Copyright (C) 1997-2004
, 2006
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.
...
...
@@ -15,7 +15,7 @@ AC_DEFUN([gl_AC_HEADER_STDINT_H],
[AC_TRY_COMPILE(
[#include <sys/types.h>
#include <stdint.h>],
[uintmax_t i = (uintmax_t) -1;],
[uintmax_t i = (uintmax_t) -1;
return !i;
],
gl_cv_header_stdint_h=yes,
gl_cv_header_stdint_h=no)])
if test $gl_cv_header_stdint_h = yes; then
...
...
m4/strdup.m4
View file @
94fdc60
# strdup.m4 serial
6
dnl Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
# strdup.m4 serial
7
dnl Copyright (C) 2002, 2003, 2004, 2005
, 2006
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_STRDUP],
[
MU_LIBSOURCES([strdup.c, strdup.h])
MU_REPLACE_FUNCS(strdup)
AC_CHECK_DECLS_ONCE(strdup)
gl_PREREQ_STRDUP
...
...
m4/strndup.m4
View file @
94fdc60
# strndup.m4 serial
6
# strndup.m4 serial
8
dnl Copyright (C) 2002-2003, 2005-2006 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
...
...
@@ -6,8 +6,6 @@ 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])
...
...
@@ -27,13 +25,15 @@ AC_DEFUN([gl_FUNC_STRNDUP],
return s[13] != '\0';]])],
[gl_cv_func_strndup=yes],
[gl_cv_func_strndup=no],
[AC_EGREP_CPP([too risky], [
[AC_CHECK_FUNC([strndup],
[AC_EGREP_CPP([too risky], [
#ifdef _AIX
too risky
too risky
#endif
],
[gl_cv_func_strndup=no],
[gl_cv_func_strndup=yes])])])
],
[gl_cv_func_strndup=no],
[gl_cv_func_strndup=yes])],
[gl_cv_func_strndup=no])])])
if test $gl_cv_func_strndup = yes; then
AC_DEFINE([HAVE_STRNDUP], 1,
[Define if you have the strndup() function and it works.])
...
...
m4/strnlen.m4
View file @
94fdc60
# strnlen.m4 serial
5
dnl Copyright (C) 2002-2003, 2005 Free Software Foundation, Inc.
# strnlen.m4 serial
6
dnl Copyright (C) 2002-2003, 2005
, 2006
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])
...
...
m4/strtok_r.m4
View file @
94fdc60
# strtok_r.m4 serial
2
# strtok_r.m4 serial
3
dnl Copyright (C) 2002, 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,
...
...
@@ -13,5 +13,5 @@ AC_DEFUN([gl_FUNC_STRTOK_R],
# Prerequisites of lib/strtok_r.h and lib/strtok_r.c.
AC_DEFUN([gl_PREREQ_STRTOK_R], [
AC_REQUIRE([
gl
_C_RESTRICT])
AC_REQUIRE([
AC
_C_RESTRICT])
])
...
...
m4/xalloc.m4
View file @
94fdc60
# xalloc.m4 serial 1
2
dnl Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
# xalloc.m4 serial 1
3
dnl Copyright (C) 2002, 2003, 2004, 2005
, 2006
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
...
...
mailbox/argp-help.c
View file @
94fdc60
...
...
@@ -1475,46 +1475,51 @@ argp_doc (const struct argp *argp, const struct argp_state *state,
{
const
char
*
text
;
const
char
*
inp_text
;
size_t
inp_text_len
=
0
;
const
char
*
trans_text
;
void
*
input
=
0
;
int
anything
=
0
;
size_t
inp_text_limit
=
0
;
const
char
*
doc
=
dgettext
(
argp
->
argp_domain
,
argp
->
doc
);
const
struct
argp_child
*
child
=
argp
->
children
;
if
(
doc
)
if
(
argp
->
doc
)
{
char
*
vt
=
strchr
(
doc
,
'\v'
);
inp_text
=
post
?
(
vt
?
vt
+
1
:
0
)
:
doc
;
inp_text_limit
=
(
!
post
&&
vt
)
?
(
vt
-
doc
)
:
0
;
char
*
vt
=
strchr
(
argp
->
doc
,
'\v'
);
if
(
vt
)
{
if
(
post
)
inp_text
=
vt
+
1
;
else
{
inp_text_len
=
vt
-
argp
->
doc
;
inp_text
=
__strndup
(
argp
->
doc
,
inp_text_len
);
}
}
else
inp_text
=
post
?
0
:
argp
->
doc
;
trans_text
=
dgettext
(
argp
->
argp_domain
,
inp_text
);
}
else
inp_text
=
0
;
trans_text
=
inp_text
=
0
;
if
(
argp
->
help_filter
)
/* We have to filter the doc strings. */
{
if
(
inp_text_limit
)
/* Copy INP_TEXT so that it's nul-terminated. */
inp_text
=
__strndup
(
inp_text
,
inp_text_limit
);
input
=
__argp_input
(
argp
,
state
);
text
=
(
*
argp
->
help_filter
)
(
post
?
ARGP_KEY_HELP_POST_DOC
:
ARGP_KEY_HELP_PRE_DOC
,
inp
_text
,
input
);
trans
_text
,
input
);
}
else
text
=
(
const
char
*
)
inp
_text
;
text
=
(
const
char
*
)
trans
_text
;
if
(
text
)
{
if
(
pre_blank
)
__argp_fmtstream_putc
(
stream
,
'\n'
);
if
(
text
==
inp_text
&&
inp_text_limit
)
__argp_fmtstream_write
(
stream
,
inp_text
,
inp_text_limit
);
else
__argp_fmtstream_puts
(
stream
,
text
);
__argp_fmtstream_puts
(
stream
,
text
);
if
(
__argp_fmtstream_point
(
stream
)
>
__argp_fmtstream_lmargin
(
stream
))
__argp_fmtstream_putc
(
stream
,
'\n'
);
...
...
@@ -1522,9 +1527,10 @@ argp_doc (const struct argp *argp, const struct argp_state *state,
anything
=
1
;
}
if
(
text
&&
text
!=
inp
_text
)
if
(
text
&&
text
!=
trans
_text
)
free
((
char
*
)
text
);
/* Free TEXT returned from the help filter. */
if
(
inp_text
&&
inp_text_limit
&&
argp
->
help_filter
)
if
(
inp_text
&&
inp_text_len
)
free
((
char
*
)
inp_text
);
/* We copied INP_TEXT, so free it now. */
if
(
post
&&
argp
->
help_filter
)
...
...
mailbox/argp-namefrob.h
View file @
94fdc60
...
...
@@ -141,20 +141,6 @@
# define putchar_unlocked(x) putchar (x)
# endif
/* GNULIB makes sure both program_invocation_name and
program_invocation_short_name are available */
#ifdef GNULIB_PROGRAM_INVOCATION_NAME
extern
char
*
program_invocation_name
;
# undef HAVE_DECL_PROGRAM_INVOCATION_NAME
# define HAVE_DECL_PROGRAM_INVOCATION_NAME 1
#endif
#ifdef GNULIB_PROGRAM_INVOCATION_SHORT_NAME
extern
char
*
program_invocation_short_name
;
# undef HAVE_DECL_PROGRAM_INVOCATION_SHORT_NAME
# define HAVE_DECL_PROGRAM_INVOCATION_SHORT_NAME 1
#endif
#endif
/* !_LIBC */
#ifndef __set_errno
...
...
mailbox/argp-parse.c
View file @
94fdc60
...
...
@@ -877,6 +877,20 @@ __argp_parse (const struct argp *argp, int argc, char **argv, unsigned flags,
to be parsed (which in some cases isn't actually an error). */
int
arg_ebadkey
=
0
;
#ifndef _LIBC
if
(
!
(
flags
&
ARGP_PARSE_ARGV0
))
{
#ifdef HAVE_DECL_PROGRAM_INVOCATION_NAME
if
(
!
program_invocation_name
)
program_invocation_name
=
argv
[
0
];
#endif
#ifdef HAVE_DECL_PROGRAM_INVOCATION_SHORT_NAME
if
(
!
program_invocation_short_name
)
program_invocation_short_name
=
__argp_base_name
(
argv
[
0
]);
#endif
}
#endif
if
(
!
(
flags
&
ARGP_NO_HELP
))
/* Add our own options. */
{
...
...
mailbox/argp-pv.c
View file @
94fdc60
/* Default definition for ARGP_PROGRAM_VERSION.
Copyright (C) 1996, 1997, 1999 Free Software Foundation, Inc.
Copyright (C) 1996, 1997, 1999
, 2006
Free Software Foundation, Inc.
This file is part of the GNU C Library.
Written by Miles Bader <miles@gnu.ai.mit.edu>.
...
...
@@ -19,6 +19,6 @@
/* 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
print this
this
string followed by a newline and exit (unless the
print this string followed by a newline and exit (unless the
ARGP_NO_EXIT flag is used). Overridden by ARGP_PROGRAM_VERSION_HOOK. */
const
char
*
argp_program_version
;
...
...
mailbox/argp.h
View file @
94fdc60
...
...
@@ -94,7 +94,10 @@ struct argp_option
/* The doc string for this option. If both NAME and KEY are 0, This string
will be printed outdented from the normal option column, making it
useful as a group header (it will be the first thing printed in its
group); in this usage, it's conventional to end the string with a `:'. */
group); in this usage, it's conventional to end the string with a `:'.
Write the initial value as N_("TEXT") if you want xgettext to collect
it into a POT file. */
const
char
*
doc
;
/* The group this option is in. In a long help message, options are sorted
...
...
@@ -243,7 +246,9 @@ struct argp
/* If non-NULL, a string containing extra text to be printed before and
after the options in a long help message (separated by a vertical tab
`\v' character). */
`\v' character).
Write the initial value as N_("BEFORE-TEXT") "\v" N_("AFTER-TEXT") if
you want xgettext to collect the two pieces of text into a POT file. */
const
char
*
doc
;
/* A vector of argp_children structures, terminated by a member with a 0
...
...
@@ -418,6 +423,20 @@ extern error_t __argp_parse (const struct argp *__restrict __argp,
/* Global variables. */
/* GNULIB makes sure both program_invocation_name and
program_invocation_short_name are available */
#ifdef GNULIB_PROGRAM_INVOCATION_NAME
extern
char
*
program_invocation_name
;
# undef HAVE_DECL_PROGRAM_INVOCATION_NAME
# define HAVE_DECL_PROGRAM_INVOCATION_NAME 1
#endif
#ifdef GNULIB_PROGRAM_INVOCATION_SHORT_NAME
extern
char
*
program_invocation_short_name
;
# undef HAVE_DECL_PROGRAM_INVOCATION_SHORT_NAME
# define HAVE_DECL_PROGRAM_INVOCATION_SHORT_NAME 1
#endif
/* If defined or 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 print this string followed by a newline and exit (unless the
...
...
mailbox/fnmatch.c
View file @
94fdc60
...
...
@@ -86,34 +86,10 @@ extern int fnmatch (const char *pattern, const char *string, int flags);
#if defined _LIBC || !defined __GNU_LIBRARY__ || !HAVE_FNMATCH_GNU
# if defined STDC_HEADERS || !defined isascii
# define ISASCII(c) 1
# else
# define ISASCII(c) isascii(c)
# endif
# ifdef isblank
# define ISBLANK(c) (ISASCII (c) && isblank (c))
# else
# define ISBLANK(c) ((c) == ' ' || (c) == '\t')
# endif
# ifdef isgraph
# define ISGRAPH(c) (ISASCII (c) && isgraph (c))
# else
# define ISGRAPH(c) (ISASCII (c) && isprint (c) && !isspace (c))
# if ! (defined isblank || HAVE_DECL_ISBLANK)
# define isblank(c) ((c) == ' ' || (c) == '\t')
# endif
# define ISPRINT(c) (ISASCII (c) && isprint (c))
# define ISDIGIT(c) (ISASCII (c) && isdigit (c))
# define ISALNUM(c) (ISASCII (c) && isalnum (c))
# define ISALPHA(c) (ISASCII (c) && isalpha (c))
# define ISCNTRL(c) (ISASCII (c) && iscntrl (c))
# define ISLOWER(c) (ISASCII (c) && islower (c))
# define ISPUNCT(c) (ISASCII (c) && ispunct (c))
# define ISSPACE(c) (ISASCII (c) && isspace (c))
# define ISUPPER(c) (ISASCII (c) && isupper (c))
# define ISXDIGIT(c) (ISASCII (c) && isxdigit (c))
# define STREQ(s1, s2) ((strcmp (s1, s2) == 0))
# if defined _LIBC || WIDE_CHAR_SUPPORT
...
...
@@ -169,11 +145,7 @@ static int posixly_correct;
# endif
/* Note that this evaluates C many times. */
# ifdef _LIBC
# define FOLD(c) ((flags & FNM_CASEFOLD) ? tolower (c) : (c))
# else
# define FOLD(c) ((flags & FNM_CASEFOLD) && ISUPPER (c) ? tolower (c) : (c))
# endif
# define FOLD(c) ((flags & FNM_CASEFOLD) ? tolower (c) : (c))
# define CHAR char
# define UCHAR unsigned char
# define INT int
...
...
mailbox/fnmatch_loop.c
View file @
94fdc60
...
...
@@ -288,18 +288,18 @@ FCT (const CHAR *pattern, const CHAR *string, const CHAR *string_end,
goto
matched
;
# endif
#else
if
((
STREQ
(
str
,
L_
(
"alnum"
))
&&
ISALNUM
((
UCHAR
)
*
n
))
||
(
STREQ
(
str
,
L_
(
"alpha"
))
&&
ISALPHA
((
UCHAR
)
*
n
))
||
(
STREQ
(
str
,
L_
(
"blank"
))
&&
ISBLANK
((
UCHAR
)
*
n
))
||
(
STREQ
(
str
,
L_
(
"cntrl"
))
&&
ISCNTRL
((
UCHAR
)
*
n
))
||
(
STREQ
(
str
,
L_
(
"digit"
))
&&
ISDIGIT
((
UCHAR
)
*
n
))
||
(
STREQ
(
str
,
L_
(
"graph"
))
&&
ISGRAPH
((
UCHAR
)
*
n
))
||
(
STREQ
(
str
,
L_
(
"lower"
))
&&
ISLOWER
((
UCHAR
)
*
n
))
||
(
STREQ
(
str
,
L_
(
"print"
))
&&
ISPRINT
((
UCHAR
)
*
n
))
||
(
STREQ
(
str
,
L_
(
"punct"
))
&&
ISPUNCT
((
UCHAR
)
*
n
))
||
(
STREQ
(
str
,
L_
(
"space"
))
&&
ISSPACE
((
UCHAR
)
*
n
))
||
(
STREQ
(
str
,
L_
(
"upper"
))
&&
ISUPPER
((
UCHAR
)
*
n
))
||
(
STREQ
(
str
,
L_
(
"xdigit"
))
&&
ISXDIGIT
((
UCHAR
)
*
n
)))
if
((
STREQ
(
str
,
L_
(
"alnum"
))
&&
isalnum
((
UCHAR
)
*
n
))
||
(
STREQ
(
str
,
L_
(
"alpha"
))
&&
isalpha
((
UCHAR
)
*
n
))
||
(
STREQ
(
str
,
L_
(
"blank"
))
&&
isblank
((
UCHAR
)
*
n
))
||
(
STREQ
(
str
,
L_
(
"cntrl"
))
&&
iscntrl
((
UCHAR
)
*
n
))
||
(
STREQ
(
str
,
L_
(
"digit"
))
&&
isdigit
((
UCHAR
)
*
n
))
||
(
STREQ
(
str
,
L_
(
"graph"
))
&&
isgraph
((
UCHAR
)
*
n
))
||
(
STREQ
(
str
,
L_
(
"lower"
))
&&
islower
((
UCHAR
)
*
n
))
||
(
STREQ
(
str
,
L_
(
"print"
))
&&
isprint
((
UCHAR
)
*
n
))
||
(
STREQ
(
str
,
L_
(
"punct"
))
&&
ispunct
((
UCHAR
)
*
n
))
||
(
STREQ
(
str
,
L_
(
"space"
))
&&
isspace
((
UCHAR
)
*
n
))
||
(
STREQ
(
str
,
L_
(
"upper"
))
&&
isupper
((
UCHAR
)
*
n
))
||
(
STREQ
(
str
,
L_
(
"xdigit"
))
&&
isxdigit
((
UCHAR
)
*
n
)))
goto
matched
;
#endif
c
=
*
p
++
;
...
...
mailbox/getopt.c
View file @
94fdc60
...
...
@@ -31,7 +31,7 @@
#include <string.h>
#include <unistd.h>
#ifdef VMS
#ifdef
__
VMS
# include <unixlib.h>
#endif
...
...
mailbox/gettext.h
View file @
94fdc60
/* Convenience header for conditional use of GNU <libintl.h>.
Copyright (C) 1995-1998, 2000-2002, 2004 Free Software Foundation, Inc.
Copyright (C) 1995-1998, 2000-2002, 2004
-2006
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
...
...
@@ -75,4 +75,168 @@
initializer for static 'char[]' or 'const char[]' variables. */
#define gettext_noop(String) String
/* The separator between msgctxt and msgid in a .mo file. */
#define GETTEXT_CONTEXT_GLUE "\004"
/* Pseudo function calls, taking a MSGCTXT and a MSGID instead of just a
MSGID. MSGCTXT and MSGID must be string literals. MSGCTXT should be
short and rarely need to change.
The letter 'p' stands for 'particular' or 'special'. */
#define pgettext(Msgctxt, Msgid) \
pgettext_aux (NULL, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, LC_MESSAGES)
#define dpgettext(Domainname, Msgctxt, Msgid) \
pgettext_aux (Domainname, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, LC_MESSAGES)
#define dcpgettext(Domainname, Msgctxt, Msgid, Category) \
pgettext_aux (Domainname, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, Category)
#define npgettext(Msgctxt, Msgid, MsgidPlural, N) \
npgettext_aux (NULL, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, MsgidPlural, N, LC_MESSAGES)
#define dnpgettext(Domainname, Msgctxt, Msgid, MsgidPlural, N) \
npgettext_aux (Domainname, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, MsgidPlural, N, LC_MESSAGES)
#define dcnpgettext(Domainname, Msgctxt, Msgid, MsgidPlural, N, Category) \
npgettext_aux (Domainname, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, MsgidPlural, N, Category)
#ifdef __GNUC__
__inline
#else
#ifdef __cplusplus
inline
#endif
#endif
static
const
char
*
pgettext_aux
(
const
char
*
domain
,
const
char
*
msg_ctxt_id
,
const
char
*
msgid
,
int
category
)
{
const
char
*
translation
=
dcgettext
(
domain
,
msg_ctxt_id
,
category
);
if
(
translation
==
msg_ctxt_id
)
return
msgid
;
else
return
translation
;
}
#ifdef __GNUC__
__inline
#else
#ifdef __cplusplus
inline
#endif
#endif
static
const
char
*
npgettext_aux
(
const
char
*
domain
,
const
char
*
msg_ctxt_id
,
const
char
*
msgid
,
const
char
*
msgid_plural
,
unsigned
long
int
n
,
int
category
)
{
const
char
*
translation
=
dcngettext
(
domain
,
msg_ctxt_id
,
msgid_plural
,
n
,
category
);
if
(
translation
==
msg_ctxt_id
||
translation
==
msgid_plural
)
return
(
n
==
1
?
msgid
:
msgid_plural
);
else
return
translation
;
}
/* The same thing extended for non-constant arguments. Here MSGCTXT and MSGID
can be arbitrary expressions. But for string literals these macros are
less efficient than those above. */
#include <string.h>
#define _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS \
(__GNUC__ >= 3 || defined __cplusplus)
#if !_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS
#include <stdlib.h>
#endif
#define pgettext_expr(Msgctxt, Msgid) \
dcpgettext_expr (NULL, Msgctxt, Msgid, LC_MESSAGES)
#define dpgettext_expr(Domainname, Msgctxt, Msgid) \
dcpgettext_expr (Domainname, Msgctxt, Msgid, LC_MESSAGES)
#ifdef __GNUC__
__inline
#else
#ifdef __cplusplus
inline
#endif
#endif
static
const
char
*
dcpgettext_expr
(
const
char
*
domain
,
const
char
*
msgctxt
,
const
char
*
msgid
,
int
category
)
{
size_t
msgctxt_len
=
strlen
(
msgctxt
)
+
1
;
size_t
msgid_len
=
strlen
(
msgid
)
+
1
;
const
char
*
translation
;
#if _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS
char
msg_ctxt_id
[
msgctxt_len
+
msgid_len
];
#else
char
buf
[
1024
];
char
*
msg_ctxt_id
=
(
msgctxt_len
+
msgid_len
<=
sizeof
(
buf
)
?
buf
:
(
char
*
)
malloc
(
msgctxt_len
+
msgid_len
));
if
(
msg_ctxt_id
!=
NULL
)
#endif
{
memcpy
(
msg_ctxt_id
,
msgctxt
,
msgctxt_len
-
1
);
msg_ctxt_id
[
msgctxt_len
-
1
]
=
'\004'
;
memcpy
(
msg_ctxt_id
+
msgctxt_len
,
msgid
,
msgid_len
);
translation
=
dcgettext
(
domain
,
msg_ctxt_id
,
category
);
#if !_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS
if
(
msg_ctxt_id
!=
buf
)
free
(
msg_ctxt_id
);
#endif
if
(
translation
!=
msg_ctxt_id
)
return
translation
;
}
return
msgid
;
}
#define npgettext_expr(Msgctxt, Msgid, MsgidPlural, N) \
dcnpgettext_expr (NULL, Msgctxt, Msgid, MsgidPlural, N, LC_MESSAGES)
#define dnpgettext_expr(Domainname, Msgctxt, Msgid, MsgidPlural, N) \
dcnpgettext_expr (Domainname, Msgctxt, Msgid, MsgidPlural, N, LC_MESSAGES)
#ifdef __GNUC__
__inline
#else
#ifdef __cplusplus
inline
#endif
#endif
static
const
char
*
dcnpgettext_expr
(
const
char
*
domain
,
const
char
*
msgctxt
,
const
char
*
msgid
,
const
char
*
msgid_plural
,
unsigned
long
int
n
,
int
category
)
{
size_t
msgctxt_len
=
strlen
(
msgctxt
)
+
1
;
size_t
msgid_len
=
strlen
(
msgid
)
+
1
;
const
char
*
translation
;
#if _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS
char
msg_ctxt_id
[
msgctxt_len
+
msgid_len
];
#else
char
buf
[
1024
];
char
*
msg_ctxt_id
=
(
msgctxt_len
+
msgid_len
<=
sizeof
(
buf
)
?
buf
:
(
char
*
)
malloc
(
msgctxt_len
+
msgid_len
));
if
(
msg_ctxt_id
!=
NULL
)
#endif
{
memcpy
(
msg_ctxt_id
,
msgctxt
,
msgctxt_len
-
1
);
msg_ctxt_id
[
msgctxt_len
-
1
]
=
'\004'
;
memcpy
(
msg_ctxt_id
+
msgctxt_len
,
msgid
,
msgid_len
);
translation
=
dcngettext
(
domain
,
msg_ctxt_id
,
msgid_plural
,
n
,
category
);
#if !_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS
if
(
msg_ctxt_id
!=
buf
)
free
(
msg_ctxt_id
);
#endif
if
(
!
(
translation
==
msg_ctxt_id
||
translation
==
msgid_plural
))
return
translation
;
}
return
(
n
==
1
?
msgid
:
msgid_plural
);
}
#endif
/* _LIBGETTEXT_H */
...
...
mailbox/glob.c
View file @
94fdc60
...
...
@@ -47,31 +47,12 @@
# define __set_errno(val) errno = (val)
#endif
#if defined HAVE_DIRENT_H || defined __GNU_LIBRARY__
# include <dirent.h>
# define NAMLEN(dirent) strlen((dirent)->d_name)
#else
# define dirent direct
# define NAMLEN(dirent) (dirent)->d_namlen
# ifdef HAVE_SYS_NDIR_H
# include <sys/ndir.h>
# endif
# ifdef HAVE_SYS_DIR_H
# include <sys/dir.h>
# endif
# ifdef HAVE_NDIR_H
# include <ndir.h>
# endif
# ifdef HAVE_VMSDIR_H
# include "vmsdir.h"
# endif
/* HAVE_VMSDIR_H */
#endif
#include <dirent.h>
/* In GNU systems, <dirent.h> defines this macro for us. */
#ifdef _D_NAMLEN
# undef NAMLEN
# define NAMLEN(d) _D_NAMLEN(d)
#ifndef _D_EXACT_NAMLEN
# define _D_EXACT_NAMLEN(dirent) strlen ((dirent)->d_name)
#endif
/* When used in the GNU libc the symbol _DIRENT_HAVE_D_TYPE is available
...
...
@@ -97,13 +78,6 @@
/* If the system has the `struct dirent64' type we use it internally. */
#if defined _LIBC && !defined COMPILE_GLOB64
# if defined HAVE_DIRENT_H || defined __GNU_LIBRARY__
# define CONVERT_D_NAMLEN(d64, d32)
# else
# define CONVERT_D_NAMLEN(d64, d32) \
(d64)->d_namlen = (d32)->d_namlen;
# endif
# if (defined POSIX || defined WINDOWS32) && !defined __GNU_LIBRARY__
# define CONVERT_D_INO(d64, d32)
# else
...
...
@@ -119,8 +93,7 @@
# endif
# define CONVERT_DIRENT_DIRENT64(d64, d32) \
memcpy ((d64)->d_name, (d32)->d_name, NAMLEN (d32) + 1); \
CONVERT_D_NAMLEN (d64, d32) \
memcpy ((d64)->d_name, (d32)->d_name, _D_EXACT_NAMLEN (d32) + 1); \
CONVERT_D_INO (d64, d32) \
CONVERT_D_TYPE (d64, d32)
#endif
...
...
@@ -511,7 +484,6 @@ glob (pattern, flags, errfunc, pglob)
oldcount
=
pglob
->
gl_pathc
+
pglob
->
gl_offs
;
#ifndef VMS
if
((
flags
&
(
GLOB_TILDE
|
GLOB_TILDE_CHECK
))
&&
dirname
[
0
]
==
'~'
)
{
if
(
dirname
[
1
]
==
'\0'
||
dirname
[
1
]
==
'/'
)
...
...
@@ -679,7 +651,6 @@ glob (pattern, flags, errfunc, pglob)
}
# endif
/* Not Amiga && not WINDOWS32. */
}
#endif
/* Not VMS. */
/* Now test whether we looked for "~" or "~NAME". In this case we
can give the answer now. */
...
...
@@ -1132,7 +1103,7 @@ glob_in_dir (const char *pattern, const char *directory, int flags,
{
int
fnm_flags
=
((
!
(
flags
&
GLOB_PERIOD
)
?
FNM_PERIOD
:
0
)
|
((
flags
&
GLOB_NOESCAPE
)
?
FNM_NOESCAPE
:
0
)
#if defined _AMIGA || defined VMS
#if defined _AMIGA || defined
__
VMS
|
FNM_CASEFOLD
#endif
);
...
...
@@ -1205,7 +1176,7 @@ glob_in_dir (const char *pattern, const char *directory, int flags,
struct
globlink
*
new
=
__alloca
(
sizeof
(
struct
globlink
));
char
*
p
;
len
=
NAMLEN
(
d
);
len
=
_D_EXACT_
NAMLEN
(
d
);
new
->
name
=
malloc
(
len
+
1
+
((
flags
&
GLOB_MARK
)
&&
isdir
));
if
(
new
->
name
==
NULL
)
...
...
mailbox/glob_.h
View file @
94fdc60
...
...
@@ -46,10 +46,6 @@
#endif
#ifndef HAVE_DIRENT_H
# define dirent direct
#endif
#define glob rpl_glob
#define globfree rpl_globfree
#define glob_pattern_p rpl_glob_pattern_p
...
...
mailbox/inttostr.h
View file @
94fdc60
/* inttostr.h -- convert integers to printable strings
Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006 Free Software
Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
...
...
@@ -18,13 +19,7 @@
/* Written by Paul Eggert */
#if HAVE_INTTYPES_H
# include <inttypes.h>
#endif
#if HAVE_STDINT_H
# include <stdint.h>
#endif
#include <stdint.h>
#include <sys/types.h>
#include "intprops.h"
...
...
mailbox/mbchar.h
View file @
94fdc60
/* Multibyte character data type.
Copyright (C) 2001, 2005 Free Software Foundation, Inc.
Copyright (C) 2001, 2005
-2006
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
...
...
@@ -156,7 +156,133 @@
#include <time.h>
#include <wchar.h>
#include <wctype.h>
/* BeOS 5 has the functions but no <wctype.h>. */
#if HAVE_WCTYPE_H
# include <wctype.h>
#endif
/* FreeBSD 4.4 to 4.11 has <wctype.h> but lacks the functions.
Assume all 12 functions are implemented the same way, or not at all. */
#if !defined iswalnum && !HAVE_ISWCNTRL
static
inline
int
iswalnum
(
wint_t
wc
)
{
return
(
wc
>=
0
&&
wc
<
128
?
(
wc
>=
'0'
&&
wc
<=
'9'
)
||
((
wc
&
~
0x20
)
>=
'A'
&&
(
wc
&
~
0x20
)
<=
'Z'
)
:
0
);
}
# define iswalnum iswalnum
#endif
#if !defined iswalpha && !HAVE_ISWCNTRL
static
inline
int
iswalpha
(
wint_t
wc
)
{
return
(
wc
>=
0
&&
wc
<
128
?
(
wc
&
~
0x20
)
>=
'A'
&&
(
wc
&
~
0x20
)
<=
'Z'
:
0
);
}
# define iswalpha iswalpha
#endif
#if !defined iswblank && !HAVE_ISWCNTRL
static
inline
int
iswblank
(
wint_t
wc
)
{
return
(
wc
>=
0
&&
wc
<
128
?
wc
==
' '
||
wc
==
'\t'
:
0
);
}
# define iswblank iswblank
#endif
#if !defined iswcntrl && !HAVE_ISWCNTRL
static
inline
int
iswcntrl
(
wint_t
wc
)
{
return
(
wc
>=
0
&&
wc
<
128
?
(
wc
&
~
0x1f
)
==
0
||
wc
==
0x7f
:
0
);
}
# define iswcntrl iswcntrl
#endif
#if !defined iswdigit && !HAVE_ISWCNTRL
static
inline
int
iswdigit
(
wint_t
wc
)
{
return
(
wc
>=
'0'
&&
wc
<=
'9'
);
}
# define iswdigit iswdigit
#endif
#if !defined iswgraph && !HAVE_ISWCNTRL
static
inline
int
iswgraph
(
wint_t
wc
)
{
return
(
wc
>=
0
&&
wc
<
128
?
wc
>=
'!'
&&
wc
<=
'~'
:
1
);
}
# define iswgraph iswgraph
#endif
#if !defined iswlower && !HAVE_ISWCNTRL
static
inline
int
iswlower
(
wint_t
wc
)
{
return
(
wc
>=
0
&&
wc
<
128
?
wc
>=
'a'
&&
wc
<=
'z'
:
0
);
}
# define iswlower iswlower
#endif
#if !defined iswprint && !HAVE_ISWCNTRL
static
inline
int
iswprint
(
wint_t
wc
)
{
return
(
wc
>=
0
&&
wc
<
128
?
wc
>=
' '
&&
wc
<=
'~'
:
1
);
}
# define iswprint iswprint
#endif
#if !defined iswpunct && !HAVE_ISWCNTRL
static
inline
int
iswpunct
(
wint_t
wc
)
{
return
(
wc
>=
0
&&
wc
<
128
?
wc
>=
'!'
&&
wc
<=
'~'
&&
!
((
wc
>=
'0'
&&
wc
<=
'9'
)
||
((
wc
&
~
0x20
)
>=
'A'
&&
(
wc
&
~
0x20
)
<=
'Z'
))
:
1
);
}
# define iswpunct iswpunct
#endif
#if !defined iswspace && !HAVE_ISWCNTRL
static
inline
int
iswspace
(
wint_t
wc
)
{
return
(
wc
>=
0
&&
wc
<
128
?
wc
==
' '
||
wc
==
'\t'
||
wc
==
'\n'
||
wc
==
'\v'
||
wc
==
'\f'
||
wc
==
'\r'
:
0
);
}
# define iswspace iswspace
#endif
#if !defined iswupper && !HAVE_ISWCNTRL
static
inline
int
iswupper
(
wint_t
wc
)
{
return
(
wc
>=
0
&&
wc
<
128
?
wc
>=
'A'
&&
wc
<=
'Z'
:
0
);
}
# define iswupper iswupper
#endif
#if !defined iswxdigit && !HAVE_ISWCNTRL
static
inline
int
iswxdigit
(
wint_t
wc
)
{
return
(
wc
>=
'0'
&&
wc
<=
'9'
)
||
((
wc
&
~
0x20
)
>=
'A'
&&
(
wc
&
~
0x20
)
<=
'F'
);
}
# define iswxdigit iswxdigit
#endif
#include "wcwidth.h"
#define MBCHAR_BUF_SIZE 24
...
...
mailbox/printf-args.c
View file @
94fdc60
/* Decomposed printf argument list.
Copyright (C) 1999, 2002-2003, 2006 Free Software Foundation, Inc.
Copyright (C) 1999, 2002-2003, 200
5-200
6 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
...
...
@@ -79,7 +79,13 @@ printf_fetchargs (va_list args, arguments *a)
break
;
#ifdef HAVE_WINT_T
case
TYPE_WIDE_CHAR
:
ap
->
a
.
a_wide_char
=
va_arg
(
args
,
wint_t
);
/* Although ISO C 99 7.24.1.(2) says that wint_t is "unchanged by
default argument promotions", this is not the case in mingw32,
where wint_t is 'unsigned short'. */
ap
->
a
.
a_wide_char
=
(
sizeof
(
wint_t
)
<
sizeof
(
int
)
?
va_arg
(
args
,
int
)
:
va_arg
(
args
,
wint_t
));
break
;
#endif
case
TYPE_STRING
:
...
...
mailbox/regex.h
View file @
94fdc60
...
...
@@ -37,12 +37,6 @@ extern "C" {
# define __USE_GNU_REGEX 1
#endif
#ifdef __VMS
/* VMS doesn't have `size_t' in <sys/types.h>, even though POSIX says it
should be there. */
# include <stddef.h>
#endif
#ifdef _REGEX_LARGE_OFFSETS
/* Use types and values that are wide enough to represent signed and
...
...
@@ -641,9 +635,10 @@ extern int re_exec (const char *);
# endif
# endif
#endif
/* gcc 3.1 and up support the [restrict] syntax
, but g++ doesn't
. */
/* gcc 3.1 and up support the [restrict] syntax. */
#ifndef __restrict_arr
# if (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1)) && !defined __cplusplus
# if (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1)) \
&& !defined __GNUG__
# define __restrict_arr __restrict
# else
# define __restrict_arr
...
...
mailbox/regex_internal.c
View file @
94fdc60
...
...
@@ -488,27 +488,34 @@ re_string_skip_chars (re_string_t *pstr, Idx new_raw_idx, wint_t *last_wc)
mbstate_t
prev_st
;
Idx
rawbuf_idx
;
size_t
mbclen
;
w
char_t
wc
=
0
;
w
int_t
wc
=
WEOF
;
/* Skip the characters which are not necessary to check. */
for
(
rawbuf_idx
=
pstr
->
raw_mbs_idx
+
pstr
->
valid_raw_len
;
rawbuf_idx
<
new_raw_idx
;)
{
wchar_t
wc2
;
Idx
remain_len
;
remain_len
=
pstr
->
len
-
rawbuf_idx
;
prev_st
=
pstr
->
cur_state
;
mbclen
=
mbrtowc
(
&
wc
,
(
const
char
*
)
pstr
->
raw_mbs
+
rawbuf_idx
,
mbclen
=
mbrtowc
(
&
wc
2
,
(
const
char
*
)
pstr
->
raw_mbs
+
rawbuf_idx
,
remain_len
,
&
pstr
->
cur_state
);
if
(
BE
(
mbclen
==
(
size_t
)
-
2
||
mbclen
==
(
size_t
)
-
1
||
mbclen
==
0
,
0
))
{
/* We treat these cases as a singlebyte character. */
/* We treat these cases as a single byte character. */
if
(
mbclen
==
0
||
remain_len
==
0
)
wc
=
L'\0'
;
else
wc
=
*
(
unsigned
char
*
)
(
pstr
->
raw_mbs
+
rawbuf_idx
);
mbclen
=
1
;
pstr
->
cur_state
=
prev_st
;
}
else
wc
=
wc2
;
/* Then proceed the next character. */
rawbuf_idx
+=
mbclen
;
}
*
last_wc
=
(
wint_t
)
wc
;
*
last_wc
=
wc
;
return
rawbuf_idx
;
}
#endif
/* RE_ENABLE_I18N */
...
...
@@ -627,7 +634,6 @@ re_string_reconstruct (re_string_t *pstr, Idx idx, int eflags)
}
#endif
pstr
->
valid_len
=
0
;
pstr
->
valid_raw_len
=
0
;
#ifdef RE_ENABLE_I18N
if
(
pstr
->
mb_cur_max
>
1
)
{
...
...
@@ -690,6 +696,16 @@ re_string_reconstruct (re_string_t *pstr, Idx idx, int eflags)
if
(
wc
==
WEOF
)
pstr
->
valid_len
=
re_string_skip_chars
(
pstr
,
idx
,
&
wc
)
-
idx
;
if
(
wc
==
WEOF
)
pstr
->
tip_context
=
re_string_context_at
(
pstr
,
pstr
->
valid_raw_len
-
1
,
eflags
);
else
pstr
->
tip_context
=
((
BE
(
pstr
->
word_ops_used
!=
0
,
0
)
&&
IS_WIDE_WORD_CHAR
(
wc
))
?
CONTEXT_WORD
:
((
IS_WIDE_NEWLINE
(
wc
)
&&
pstr
->
newline_anchor
)
?
CONTEXT_NEWLINE
:
0
));
if
(
BE
(
pstr
->
valid_len
,
0
))
{
for
(
wcs_idx
=
0
;
wcs_idx
<
pstr
->
valid_len
;
++
wcs_idx
)
...
...
@@ -698,17 +714,12 @@ re_string_reconstruct (re_string_t *pstr, Idx idx, int eflags)
memset
(
pstr
->
mbs
,
-
1
,
pstr
->
valid_len
);
}
pstr
->
valid_raw_len
=
pstr
->
valid_len
;
pstr
->
tip_context
=
((
BE
(
pstr
->
word_ops_used
!=
0
,
0
)
&&
IS_WIDE_WORD_CHAR
(
wc
))
?
CONTEXT_WORD
:
((
IS_WIDE_NEWLINE
(
wc
)
&&
pstr
->
newline_anchor
)
?
CONTEXT_NEWLINE
:
0
));
}
else
#endif
/* RE_ENABLE_I18N */
{
int
c
=
pstr
->
raw_mbs
[
pstr
->
raw_mbs_idx
+
offset
-
1
];
pstr
->
valid_raw_len
=
0
;
if
(
pstr
->
trans
)
c
=
pstr
->
trans
[
c
];
pstr
->
tip_context
=
(
bitset_contain
(
pstr
->
word_char
,
c
)
...
...
mailbox/regex_internal.h
View file @
94fdc60
...
...
@@ -43,20 +43,17 @@
#if defined HAVE_WCTYPE_H || defined _LIBC
# include <wctype.h>
#endif
/* HAVE_WCTYPE_H || _LIBC */
#if defined HAVE_STDINT_H || defined _LIBC
# include <stdint.h>
#endif
/* HAVE_STDINT_H || _LIBC */
#include <stdint.h>
#if defined _LIBC
# include <bits/libc-lock.h>
#else
# define __libc_lock_define(CLASS,NAME)
# define __libc_lock_init(NAME) do { } while (0)
# define __libc_lock_lock(NAME) do { } while (0)
# define __libc_lock_unlock(NAME) do { } while (0)
#endif
/* In case that the system doesn't have isblank(). */
#if !defined _LIBC && !
defined HAVE
_ISBLANK && !defined isblank
#if !defined _LIBC && !
HAVE_DECL
_ISBLANK && !defined isblank
# define isblank(ch) ((ch) == ' ' || (ch) == '\t')
#endif
...
...
@@ -711,7 +708,9 @@ struct re_dfa_t
#ifdef DEBUG
char
*
re_str
;
#endif
#ifdef _LIBC
__libc_lock_define
(,
lock
)
#endif
};
#define re_node_set_init_empty(set) memset (set, '\0', sizeof (re_node_set))
...
...
mailbox/stat-macros.h
View file @
94fdc60
/* stat-related macros
Copyright (C) 1993, 1994, 2001, 2002, 2004 Free Software Foundation, Inc.
Copyright (C) 1993, 1994, 2001, 2002, 2004, 2006 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
...
...
@@ -33,7 +34,6 @@
# undef S_ISBLK
# undef S_ISCHR
# undef S_ISDIR
# undef S_ISDOOR
# undef S_ISFIFO
# undef S_ISLNK
# undef S_ISNAM
...
...
@@ -70,11 +70,7 @@
# endif
# ifndef S_ISDOOR
/* Solaris 2.5 and up */
# ifdef S_IFDOOR
# define S_ISDOOR(m) (((m) & S_IFMT) == S_IFDOOR)
# else
# define S_ISDOOR(m) 0
# endif
# define S_ISDOOR(m) 0
# endif
# ifndef S_ISFIFO
...
...
@@ -119,6 +115,10 @@
# endif
# endif
# ifndef S_ISPORT
/* Solaris 10 and up */
# define S_ISPORT(m) 0
# endif
# ifndef S_ISREG
# ifdef S_IFREG
# define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
...
...
@@ -161,7 +161,7 @@
# endif
# endif
/*
contiguous
*/
/*
high performance ("contiguous data")
*/
# ifndef S_ISCTG
# define S_ISCTG(p) 0
# endif
...
...
@@ -176,6 +176,11 @@
# define S_ISOFL(p) 0
# endif
/* 4.4BSD whiteout */
# ifndef S_ISWHT
# define S_ISWHT(m) 0
# endif
/* If any of the following are undefined,
define them to their de facto standard values. */
# if !S_ISUID
...
...
mailbox/stdint_.h
View file @
94fdc60
/* Copyright (C) 2001-2002, 2004-2006 Free Software Foundation, Inc.
Written by Bruno Haible, Sam Steingold, Peter Burwood.
Written by
Paul Eggert,
Bruno Haible, Sam Steingold, Peter Burwood.
This file is part of gnulib.
This program is free software; you can redistribute it and/or modify
...
...
@@ -16,165 +16,155 @@
along with this program; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
#ifndef _STDINT_H
#define _STDINT_H
#ifndef _
GL_
STDINT_H
#define _
GL_
STDINT_H
/*
* ISO C 99 <stdint.h> for platforms that lack it.
* <http://www.opengroup.org/susv3xbd/stdint.h.html>
*/
/* Get wchar_t, WCHAR_MIN, WCHAR_MAX. */
#include <stddef.h>
/* BSD/OS 4.2 defines WCHAR_MIN, WCHAR_MAX in <wchar.h>, not <stddef.h>. */
#if !(defined(WCHAR_MIN) && defined(WCHAR_MAX)) && @HAVE_WCHAR_H@
# include <wchar.h>
/* Get those types that are already defined in other system include
files, so that we can "#define int8_t signed char" below without
worrying about a later system include file containing a "typedef
signed char int8_t;" that will get messed up by our macro. Our
macros should all be consistent with the system versions, except
for the "fast" types and macros, which we recommend against using
in public interfaces due to compiler differences. */
#if @HAVE_STDINT_H@
# if defined __sgi && ! defined __c99
/* Bypass IRIX's <stdint.h> if in C89 mode, since it merely annoys users
with "This header file is to be used only for c99 mode compilations"
diagnostics. */
# define __STDINT_H__
# endif
/* Other systems may have an incomplete or buggy <stdint.h>.
Include it before <inttypes.h>, since any "#include <stdint.h>"
in <inttypes.h> would reinclude us, skipping our contents because
_GL_STDINT_H is defined. */
# include @ABSOLUTE_STDINT_H@
#endif
/* <sys/types.h> defines some of the stdint.h types as well, on glibc,
IRIX 6.5, and OpenBSD 3.8 (via <machine/types.h>).
MacOS X 10.4.6 <sys/types.h> includes <stdint.h> (which is us), but
relies on the system <stdint.h> definitions, so include
<sys/types.h> after @ABSOLUTE_STDINT_H@. */
#if @HAVE_SYS_TYPES_H@
# include <sys/types.h>
#endif
/* Get LONG_MIN, LONG_MAX, ULONG_MAX. */
#include <limits.h>
/* Get those types that are already defined in other system include files. */
#if defined(__FreeBSD__) && (__FreeBSD__ >= 3) && (__FreeBSD__ <= 4)
# include <sys/inttypes.h>
#endif
#if defined(__OpenBSD__) || defined(__bsdi__) || defined(__sgi)
/* In OpenBSD 3.8, <sys/types.h> includes <machine/types.h>, which defines
#if @HAVE_INTTYPES_H@
/* In OpenBSD 3.8, <inttypes.h> includes <machine/types.h>, which defines
int{8,16,32,64}_t, uint{8,16,32,64}_t and __BIT_TYPES_DEFINED__.
<inttypes.h> includes <machine/types.h> and also defines intptr_t and
uintptr_t. */
/* BSD/OS 4.2 is similar, but doesn't have <inttypes.h> */
/* IRIX 6.5 has <inttypes.h>, and <sys/types.h> defines some of these
types as well. */
# include <sys/types.h>
# if @HAVE_INTTYPES_H@
# include @FULL_PATH_INTTYPES_H@
# endif
<inttypes.h> also defines intptr_t and uintptr_t. */
# define _GL_JUST_INCLUDE_ABSOLUTE_INTTYPES_H
# include <inttypes.h>
# undef _GL_JUST_INCLUDE_ABSOLUTE_INTTYPES_H
#elif @HAVE_SYS_INTTYPES_H@
/* Solaris 7 <sys/inttypes.h> has the types except the *_fast*_t types, and
the macros except for *_FAST*_*, INTPTR_MIN, PTRDIFF_MIN, PTRDIFF_MAX. */
# include <sys/inttypes.h>
#endif
#if defined(__linux__) && @HAVE_SYS_BITYPES_H@
#if @HAVE_SYS_BITYPES_H@ && ! defined __BIT_TYPES_DEFINED__
/* Linux libc4 >= 4.6.7 and libc5 have a <sys/bitypes.h> that defines
int{8,16,32,64}_t and __BIT_TYPES_DEFINED__. In libc5 >= 5.2.2 it is
included by <sys/types.h>. */
# include <sys/bitypes.h>
#endif
#if defined(__sun) && @HAVE_SYS_INTTYPES_H@
/* Solaris 7 <sys/inttypes.h> has the types except the *_fast*_t types, and
the macros except for *_FAST*_*, INTPTR_MIN, PTRDIFF_MIN, PTRDIFF_MAX.
But note that <sys/int_types.h> contains only the type definitions! */
# include <sys/inttypes.h>
#endif
#if (defined(__hpux) || defined(_AIX)) && @HAVE_INTTYPES_H@
/* HP-UX 10 <inttypes.h> has nearly everything, except UINT_LEAST8_MAX,
UINT_FAST8_MAX, PTRDIFF_MIN, PTRDIFF_MAX. */
/* AIX 4 <inttypes.h> has nearly everything, except INTPTR_MIN, INTPTR_MAX,
UINTPTR_MAX, PTRDIFF_MIN, PTRDIFF_MAX. */
# include @FULL_PATH_INTTYPES_H@
#endif
#if @HAVE_STDINT_H@
/* Other systems may have an incomplete <stdint.h>. */
/* On some versions of IRIX, the SGI C compiler comes with an <stdint.h>,
but
- in c99 mode, <inttypes.h> includes <stdint.h>,
- in c89 mode, <stdint.h> spews warnings and defines nothing.
<inttypes.h> defines only a subset of the types and macros that
<stdint.h> would define in c99 mode.
So we rely only on <inttypes.h> (included above). It means that in
c89 mode, we shadow the contents of warning-spewing <stdint.h>. */
# if !(defined(__sgi) && @HAVE_INTTYPES_H@ && !defined(__c99))
# include @FULL_PATH_STDINT_H@
#if ! defined __cplusplus || defined __STDC_CONSTANT_MACROS
/* Get WCHAR_MIN, WCHAR_MAX. */
# if @HAVE_WCHAR_H@ && ! (defined WCHAR_MIN && defined WCHAR_MAX)
/* BSD/OS 4.1 has a bug: <stdio.h> and <time.h> must be included before
<wchar.h>. */
# include <stdio.h>
# include <time.h>
# include <wchar.h>
# endif
#endif
/* Minimum and maximum values for a integer type under the usual assumption.
Return an unspecified value if BITS == 0, adding a check to pacify
picky compilers. */
#define _STDINT_MIN(signed, bits, zero) \
((signed) ? (- ((zero) + 1) << ((bits) ? (bits) - 1 : 0)) : (zero))
#define _STDINT_MAX(signed, bits, zero) \
((signed) \
? ~ _STDINT_MIN (signed, bits, zero) \
: ((((zero) + 1) << ((bits) ? (bits) - 1 : 0)) - 1) * 2 + 1)
/* 7.18.1.1. Exact-width integer types */
/* Here we assume a standard architecture where the hardware integer
types have 8, 16, 32, optionally 64 bits. */
#if !@HAVE_INT8_T@
typedef
signed
char
int8_t
;
#endif
#if !@HAVE_UINT8_T@
typedef
unsigned
char
uint8_t
;
# define _UINT8_T
/* avoid collision with Solaris 2.5.1 <pthread.h> */
#endif
#undef int8_t
#undef uint8_t
#define int8_t signed char
#define uint8_t unsigned char
#if !@HAVE_INT16_T@
typedef
short
int16_t
;
#endif
#if !@HAVE_UINT16_T@
typedef
unsigned
short
uint16_t
;
#endif
#undef int16_t
#undef uint16_t
#define int16_t short int
#define uint16_t unsigned short int
#if !@HAVE_INT32_T@
typedef
int
int32_t
;
#endif
#if !@HAVE_UINT32_T@
typedef
unsigned
int
uint32_t
;
# define _UINT32_T
/* avoid collision with Solaris 2.5.1 <pthread.h> */
#endif
#undef int32_t
#undef uint32_t
#define int32_t int
#define uint32_t unsigned int
#if @HAVE_INT64_T@
# define _STDINT_H_HAVE_INT64 1
#else
# if @HAVE_LONG_64BIT@
typedef
long
int64_t
;
# define _STDINT_H_HAVE_INT64 1
# elif @HAVE_LONG_LONG_64BIT@
typedef
long
long
int64_t
;
# define _STDINT_H_HAVE_INT64 1
# elif defined _MSC_VER
typedef
__int64
int64_t
;
# define _STDINT_H_HAVE_INT64 1
# endif
#endif
#if @HAVE_UINT64_T@
# define _STDINT_H_HAVE_UINT64 1
#else
# if @HAVE_LONG_64BIT@
typedef
unsigned
long
uint64_t
;
# define _STDINT_H_HAVE_UINT64 1
# elif @HAVE_LONG_LONG_64BIT@
typedef
unsigned
long
long
uint64_t
;
# define _UINT64_T
/* avoid collision with Solaris 2.5.1 <pthread.h> */
# define _STDINT_H_HAVE_UINT64 1
# elif defined _MSC_VER
typedef
unsigned
__int64
uint64_t
;
# define _STDINT_H_HAVE_UINT64 1
# endif
#undef int64_t
#undef uint64_t
#if LONG_MAX >> 31 >> 31 == 1
# define int64_t long int
# define uint64_t unsigned long int
#elif defined _MSC_VER
# define int64_t __int64
# define uint64_t unsigned __int64
#elif @HAVE_LONG_LONG_INT@
# define int64_t long long int
# define uint64_t unsigned long long int
#endif
/* Avoid collision with Solaris 2.5.1 <pthread.h> etc. */
#define _UINT8_T
#define _UINT32_T
#define _UINT64_T
/* 7.18.1.2. Minimum-width integer types */
/* Here we assume a standard architecture where the hardware integer
types have 8, 16, 32, optionally 64 bits. Therefore the leastN_t types
are the same as the corresponding N_t types. */
#if !@HAVE_INT_LEAST8_T@
typedef
int8_t
int_least8_t
;
#endif
#if !@HAVE_UINT_LEAST8_T@
typedef
uint8_t
uint_least8_t
;
#endif
#if !@HAVE_INT_LEAST16_T@
typedef
int16_t
int_least16_t
;
#endif
#if !@HAVE_UINT_LEAST16_T@
typedef
uint16_t
uint_least16_t
;
#endif
#if !@HAVE_INT_LEAST32_T@
typedef
int32_t
int_least32_t
;
#endif
#if !@HAVE_UINT_LEAST32_T@
typedef
uint32_t
uint_least32_t
;
#endif
#if !@HAVE_INT_LEAST64_T@ && _STDINT_H_HAVE_INT64
typedef
int64_t
int_least64_t
;
#endif
#if !@HAVE_UINT_LEAST64_T@ && _STDINT_H_HAVE_UINT64
typedef
uint64_t
uint_least64_t
;
#undef int_least8_t
#undef uint_least8_t
#undef int_least16_t
#undef uint_least16_t
#undef int_least32_t
#undef uint_least32_t
#undef int_least64_t
#undef uint_least64_t
#define int_least8_t int8_t
#define uint_least8_t uint8_t
#define int_least16_t int16_t
#define uint_least16_t uint16_t
#define int_least32_t int32_t
#define uint_least32_t uint32_t
#ifdef int64_t
# define int_least64_t int64_t
# define uint_least64_t uint64_t
#endif
/* 7.18.1.3. Fastest minimum-width integer types */
...
...
@@ -184,240 +174,90 @@ typedef uint64_t uint_least64_t;
/* Here we assume a standard architecture where the hardware integer
types have 8, 16, 32, optionally 64 bits. Therefore the fastN_t types
are taken from the same list of types. */
/* On alpha processors, int32_t variables are slower than int64_t variables,
due to the necessary zap instructions. */
#if defined __alpha
# define _STDINT_H_INT64_FASTER_THAN_INT32 1
#endif
#if !@HAVE_INT_FAST8_T@
# if _STDINT_H_INT64_FASTER_THAN_INT32
typedef
int64_t
int_fast8_t
;
# else
typedef
int32_t
int_fast8_t
;
# endif
#endif
#if !@HAVE_UINT_FAST8_T@
# if _STDINT_H_INT64_FASTER_THAN_INT32
typedef
uint64_t
uint_fast8_t
;
# else
typedef
uint32_t
uint_fast8_t
;
# endif
#endif
#if !@HAVE_INT_FAST16_T@
# if _STDINT_H_INT64_FASTER_THAN_INT32
typedef
int64_t
int_fast16_t
;
# else
typedef
int32_t
int_fast16_t
;
# endif
#endif
#if !@HAVE_UINT_FAST16_T@
# if _STDINT_H_INT64_FASTER_THAN_INT32
typedef
uint64_t
uint_fast16_t
;
# else
typedef
uint32_t
uint_fast16_t
;
# endif
#endif
#if !@HAVE_INT_FAST32_T@
# if _STDINT_H_INT64_FASTER_THAN_INT32
typedef
int64_t
int_fast32_t
;
# else
typedef
int32_t
int_fast32_t
;
# endif
#endif
#if !@HAVE_UINT_FAST32_T@
# if _STDINT_H_INT64_FASTER_THAN_INT32
typedef
uint64_t
uint_fast32_t
;
# else
typedef
uint32_t
uint_fast32_t
;
# endif
#endif
#if !@HAVE_INT_FAST64_T@ && _STDINT_H_HAVE_INT64
typedef
int64_t
int_fast64_t
;
#endif
#if !@HAVE_UINT_FAST64_T@ && _STDINT_H_HAVE_UINT64
typedef
uint64_t
uint_fast64_t
;
are taken from the same list of types. Assume that 'long int'
is fast enough for all narrower integers. */
#undef int_fast8_t
#undef uint_fast8_t
#undef int_fast16_t
#undef uint_fast16_t
#undef int_fast32_t
#undef uint_fast32_t
#undef int_fast64_t
#undef uint_fast64_t
#define int_fast8_t long int
#define uint_fast8_t unsigned int_fast8_t
#define int_fast16_t long int
#define uint_fast16_t unsigned int_fast16_t
#define int_fast32_t long int
#define uint_fast32_t unsigned int_fast32_t
#ifdef int64_t
# define int_fast64_t int64_t
# define uint_fast64_t uint64_t
#endif
/* 7.18.1.4. Integer types capable of holding object pointers */
/* On some platforms (like IRIX6 MIPS with -n32) sizeof(void*) < sizeof(long),
but this doesn't matter here. */
#if !@HAVE_INTPTR_T@
typedef
long
intptr_t
;
#endif
#if !@HAVE_UINTPTR_T@
typedef
unsigned
long
uintptr_t
;
#endif
#undef intptr_t
#undef uintptr_t
#define intptr_t long int
#define uintptr_t unsigned long int
/* 7.18.1.5. Greatest-width integer types */
/* Note: These types are compiler dependent. It may be unwise to use them in
public header files. */
#if !@HAVE_INTMAX_T@
# ifdef _STDINT_H_HAVE_INT64
typedef
int64_t
intmax_t
;
# else
typedef
int32_t
intmax_t
;
# endif
#endif
#if !@HAVE_UINTMAX_T@
# ifdef _STDINT_H_HAVE_UINT64
typedef
uint64_t
uintmax_t
;
# else
typedef
uint32_t
uintmax_t
;
# endif
#undef intmax_t
#undef uintmax_t
#if @HAVE_LONG_LONG_INT@ && LONG_MAX >> 30 == 1
# define intmax_t long long int
# define uintmax_t unsigned long long int
#elif defined int64_t
# define intmax_t int64_t
# define uintmax_t uint64_t
#else
# define intmax_t long int
# define uintmax_t unsigned long int
#endif
/* 7.18.2. Limits of specified-width integer types */
#if !
defined(__cplusplus) || defined(__STDC_LIMIT_MACROS)
#if !
defined __cplusplus || defined __STDC_LIMIT_MACROS
/* 7.18.2.1. Limits of exact-width integer types */
/* Here we assume a standard architecture where the hardware integer
types have 8, 16, 32, optionally 64 bits. */
#if @HAVE_INT8_T@
# ifndef INT8_MIN
# define INT8_MIN (-1 << (@BITSIZEOF_INT8_T@ - 1))
# endif
#else
# define INT8_MIN -128
#endif
#if @HAVE_INT8_T@
# ifndef INT8_MAX
# define INT8_MAX (~ (-1 << (@BITSIZEOF_INT8_T@ - 1)))
# endif
#else
# define INT8_MAX 127
#endif
#if @HAVE_UINT8_T@
# ifndef UINT8_MAX
# if @BITSIZEOF_UINT8_T@ < @BITSIZEOF_UNSIGNED_INT@
# define UINT8_MAX (((1 << (@BITSIZEOF_UINT8_T@ - 1)) - 1) * 2 + 1)
# else
# define UINT8_MAX (((1U << (@BITSIZEOF_UINT8_T@ - 1)) - 1) * 2 + 1)
# endif
# endif
#else
# define UINT8_MAX 255
#endif
#if @HAVE_INT16_T@
# ifndef INT16_MIN
# define INT16_MIN (-1 << (@BITSIZEOF_INT16_T@ - 1))
# endif
#else
# define INT16_MIN -32768
#endif
#if @HAVE_INT16_T@
# ifndef INT16_MAX
# define INT16_MAX (~ (-1 << (@BITSIZEOF_INT16_T@ - 1)))
# endif
#else
# define INT16_MAX 32767
#endif
#if @HAVE_UINT16_T@
# ifndef UINT16_MAX
# if @BITSIZEOF_UINT16_T@ < @BITSIZEOF_UNSIGNED_INT@
# define UINT16_MAX (((1 << (@BITSIZEOF_UINT16_T@ - 1)) - 1) * 2 + 1)
# else
# define UINT16_MAX (((1U << (@BITSIZEOF_UINT16_T@ - 1)) - 1) * 2 + 1)
# endif
# endif
#else
# define UINT16_MAX 65535
#endif
#if @HAVE_INT32_T@
# ifndef INT32_MIN
# define INT32_MIN (-1 << (@BITSIZEOF_INT32_T@ - 1))
# endif
#else
# define INT32_MIN (~INT32_MAX)
#endif
#if @HAVE_INT32_T@
# ifndef INT32_MAX
# define INT32_MAX (~ (-1 << (@BITSIZEOF_INT32_T@ - 1)))
# endif
#else
# define INT32_MAX 2147483647
#endif
#if @HAVE_UINT32_T@
# ifndef UINT32_MAX
# if @BITSIZEOF_UINT32_T@ < @BITSIZEOF_UNSIGNED_INT@
# define UINT32_MAX (((1 << (@BITSIZEOF_UINT32_T@ - 1)) - 1) * 2 + 1)
# else
# define UINT32_MAX (((1U << (@BITSIZEOF_UINT32_T@ - 1)) - 1) * 2 + 1)
# endif
# endif
#else
# define UINT32_MAX 4294967295U
#endif
#if @HAVE_INT64_T@
# ifndef INT64_MIN
# if @HAVE_LONG_64BIT@
# define INT64_MIN (-1L << (@BITSIZEOF_INT64_T@ - 1))
# elif @HAVE_LONG_LONG_64BIT@
# define INT64_MIN (-1LL << (@BITSIZEOF_INT64_T@ - 1))
# elif defined _MSC_VER
# define INT64_MIN (-1i64 << (@BITSIZEOF_INT64_T@ - 1))
# endif
# endif
#else
# ifdef _STDINT_H_HAVE_INT64
# define INT64_MIN (~INT64_MAX)
# endif
#endif
#if @HAVE_INT64_T@
# ifndef INT64_MAX
# if @HAVE_LONG_64BIT@
# define INT64_MAX (~ (-1L << (@BITSIZEOF_INT64_T@ - 1)))
# elif @HAVE_LONG_LONG_64BIT@
# define INT64_MAX (~ (-1LL << (@BITSIZEOF_INT64_T@ - 1)))
# elif defined _MSC_VER
# define INT64_MAX (~ (-1i64 << (@BITSIZEOF_INT64_T@ - 1)))
# endif
# endif
#else
# ifdef _STDINT_H_HAVE_INT64
# if @HAVE_LONG_64BIT@
# define INT64_MAX 9223372036854775807L
# elif @HAVE_LONG_LONG_64BIT@
# define INT64_MAX 9223372036854775807LL
# elif defined _MSC_VER
# define INT64_MAX 9223372036854775807i64
# endif
# endif
#endif
#if @HAVE_UINT64_T@
# ifndef UINT64_MAX
# if @HAVE_LONG_64BIT@
# define UINT64_MAX (((1UL << (@BITSIZEOF_UINT64_T@ - 1)) - 1) * 2 + 1)
# elif @HAVE_LONG_LONG_64BIT@
# define UINT64_MAX (((1ULL << (@BITSIZEOF_UINT64_T@ - 1)) - 1) * 2 + 1)
# elif defined _MSC_VER
# define UINT64_MAX (((1ui64 << (@BITSIZEOF_UINT64_T@ - 1)) - 1) * 2 + 1)
# endif
# endif
#else
# ifdef _STDINT_H_HAVE_UINT64
# if @HAVE_LONG_64BIT@
# define UINT64_MAX 18446744073709551615UL
# elif @HAVE_LONG_LONG_64BIT@
# define UINT64_MAX 18446744073709551615ULL
# elif defined _MSC_VER
# define UINT64_MAX 18446744073709551615ui64
# endif
# endif
#undef INT8_MIN
#undef INT8_MAX
#undef UINT8_MAX
#define INT8_MIN (~ INT8_MAX)
#define INT8_MAX 127
#define UINT8_MAX 255
#undef INT16_MIN
#undef INT16_MAX
#undef UINT16_MAX
#define INT16_MIN (~ INT16_MAX)
#define INT16_MAX 32767
#define UINT16_MAX 65535
#undef INT32_MIN
#undef INT32_MAX
#undef UINT32_MAX
#define INT32_MIN (~ INT32_MAX)
#define INT32_MAX 2147483647
#define UINT32_MAX 4294967295U
#undef INT64_MIN
#undef INT64_MAX
#undef UINT64_MAX
#ifdef int64_t
# define INT64_MIN (~ INT64_MAX)
# define INT64_MAX INTMAX_C (9223372036854775807)
# define UINT64_MAX UINTMAX_C (18446744073709551615)
#endif
/* 7.18.2.2. Limits of minimum-width integer types */
...
...
@@ -426,128 +266,34 @@ typedef uint32_t uintmax_t;
types have 8, 16, 32, optionally 64 bits. Therefore the leastN_t types
are the same as the corresponding N_t types. */
#if @HAVE_INT_LEAST8_T@
# ifndef INT_LEAST8_MIN
# define INT_LEAST8_MIN (-1 << (@BITSIZEOF_INT_LEAST8_T@ - 1))
# endif
#else
# define INT_LEAST8_MIN INT8_MIN
#endif
#if @HAVE_INT_LEAST8_T@
# ifndef INT_LEAST8_MAX
# define INT_LEAST8_MAX (~ (-1 << (@BITSIZEOF_INT_LEAST8_T@ - 1)))
# endif
#else
# define INT_LEAST8_MAX INT8_MAX
#endif
#if @HAVE_UINT_LEAST8_T@
# ifndef UINT_LEAST8_MAX
# if @BITSIZEOF_UINT_LEAST8_T@ < @BITSIZEOF_UNSIGNED_INT@
# define UINT_LEAST8_MAX (((1 << (@BITSIZEOF_UINT_LEAST8_T@ - 1)) - 1) * 2 + 1)
# else
# define UINT_LEAST8_MAX (((1U << (@BITSIZEOF_UINT_LEAST8_T@ - 1)) - 1) * 2 + 1)
# endif
# endif
#else
# define UINT_LEAST8_MAX UINT8_MAX
#endif
#if @HAVE_INT_LEAST16_T@
# ifndef INT_LEAST16_MIN
# define INT_LEAST16_MIN (-1 << (@BITSIZEOF_INT_LEAST16_T@ - 1))
# endif
#else
# define INT_LEAST16_MIN INT16_MIN
#endif
#if @HAVE_INT_LEAST16_T@
# ifndef INT_LEAST16_MAX
# define INT_LEAST16_MAX (~ (-1 << (@BITSIZEOF_INT_LEAST16_T@ - 1)))
# endif
#else
# define INT_LEAST16_MAX INT16_MAX
#endif
#if @HAVE_UINT_LEAST16_T@
# ifndef UINT_LEAST16_MAX
# if @BITSIZEOF_UINT_LEAST16_T@ < @BITSIZEOF_UNSIGNED_INT@
# define UINT_LEAST16_MAX (((1 << (@BITSIZEOF_UINT_LEAST16_T@ - 1)) - 1) * 2 + 1)
# else
# define UINT_LEAST16_MAX (((1U << (@BITSIZEOF_UINT_LEAST16_T@ - 1)) - 1) * 2 + 1)
# endif
# endif
#else
# define UINT_LEAST16_MAX UINT16_MAX
#endif
#if @HAVE_INT_LEAST32_T@
# ifndef INT_LEAST32_MIN
# define INT_LEAST32_MIN (-1 << (@BITSIZEOF_INT_LEAST32_T@ - 1))
# endif
#else
# define INT_LEAST32_MIN INT32_MIN
#endif
#if @HAVE_INT_LEAST32_T@
# ifndef INT_LEAST32_MAX
# define INT_LEAST32_MAX (~ (-1 << (@BITSIZEOF_INT_LEAST32_T@ - 1)))
# endif
#else
# define INT_LEAST32_MAX INT32_MAX
#endif
#if @HAVE_UINT_LEAST32_T@
# ifndef UINT_LEAST32_MAX
# if @BITSIZEOF_UINT_LEAST32_T@ < @BITSIZEOF_UNSIGNED_INT@
# define UINT_LEAST32_MAX (((1 << (@BITSIZEOF_UINT_LEAST32_T@ - 1)) - 1) * 2 + 1)
# else
# define UINT_LEAST32_MAX (((1U << (@BITSIZEOF_UINT_LEAST32_T@ - 1)) - 1) * 2 + 1)
# endif
# endif
#else
# define UINT_LEAST32_MAX UINT32_MAX
#endif
#if @HAVE_INT_LEAST64_T@
# ifndef INT_LEAST64_MIN
# if @HAVE_LONG_64BIT@
# define INT_LEAST64_MIN (-1L << (@BITSIZEOF_INT_LEAST64_T@ - 1))
# elif @HAVE_LONG_LONG_64BIT@
# define INT_LEAST64_MIN (-1LL << (@BITSIZEOF_INT_LEAST64_T@ - 1))
# elif defined _MSC_VER
# define INT_LEAST64_MIN (-1i64 << (@BITSIZEOF_INT_LEAST64_T@ - 1))
# endif
# endif
#else
# ifdef _STDINT_H_HAVE_INT64
# define INT_LEAST64_MIN INT64_MIN
# endif
#endif
#if @HAVE_INT_LEAST64_T@
# ifndef INT_LEAST64_MAX
# if @HAVE_LONG_64BIT@
# define INT_LEAST64_MAX (~ (-1L << (@BITSIZEOF_INT_LEAST64_T@ - 1)))
# elif @HAVE_LONG_LONG_64BIT@
# define INT_LEAST64_MAX (~ (-1LL << (@BITSIZEOF_INT_LEAST64_T@ - 1)))
# elif defined _MSC_VER
# define INT_LEAST64_MAX (~ (-1i64 << (@BITSIZEOF_INT_LEAST64_T@ - 1)))
# endif
# endif
#else
# ifdef _STDINT_H_HAVE_INT64
# define INT_LEAST64_MAX INT64_MAX
# endif
#endif
#if @HAVE_UINT_LEAST64_T@
# ifndef UINT_LEAST64_MAX
# if @HAVE_LONG_64BIT@
# define UINT_LEAST64_MAX (((1UL << (@BITSIZEOF_UINT_LEAST64_T@ - 1)) - 1) * 2 + 1)
# elif @HAVE_LONG_LONG_64BIT@
# define UINT_LEAST64_MAX (((1ULL << (@BITSIZEOF_UINT_LEAST64_T@ - 1)) - 1) * 2 + 1)
# elif defined _MSC_VER
# define UINT_LEAST64_MAX (((1ui64 << (@BITSIZEOF_UINT_LEAST64_T@ - 1)) - 1) * 2 + 1)
# endif
# endif
#else
# ifdef _STDINT_H_HAVE_UINT64
# define UINT_LEAST64_MAX UINT64_MAX
# endif
#undef INT_LEAST8_MIN
#undef INT_LEAST8_MAX
#undef UINT_LEAST8_MAX
#define INT_LEAST8_MIN INT8_MIN
#define INT_LEAST8_MAX INT8_MAX
#define UINT_LEAST8_MAX UINT8_MAX
#undef INT_LEAST16_MIN
#undef INT_LEAST16_MAX
#undef UINT_LEAST16_MAX
#define INT_LEAST16_MIN INT16_MIN
#define INT_LEAST16_MAX INT16_MAX
#define UINT_LEAST16_MAX UINT16_MAX
#undef INT_LEAST32_MIN
#undef INT_LEAST32_MAX
#undef UINT_LEAST32_MAX
#define INT_LEAST32_MIN INT32_MIN
#define INT_LEAST32_MAX INT32_MAX
#define UINT_LEAST32_MAX UINT32_MAX
#undef INT_LEAST64_MIN
#undef INT_LEAST64_MAX
#undef UINT_LEAST64_MAX
#ifdef int64_t
# define INT_LEAST64_MIN INT64_MIN
# define INT_LEAST64_MAX INT64_MAX
# define UINT_LEAST64_MAX UINT64_MAX
#endif
/* 7.18.2.3. Limits of fastest minimum-width integer types */
...
...
@@ -556,464 +302,155 @@ typedef uint32_t uintmax_t;
types have 8, 16, 32, optionally 64 bits. Therefore the fastN_t types
are taken from the same list of types. */
#if @HAVE_INT_FAST8_T@
# ifndef INT_FAST8_MIN
# define INT_FAST8_MIN (-1L << (@BITSIZEOF_INT_FAST8_T@ - 1))
# endif
#else
# if _STDINT_H_INT64_FASTER_THAN_INT32
# define INT_FAST8_MIN INT64_MIN
# else
# define INT_FAST8_MIN INT32_MIN
# endif
#endif
#if @HAVE_INT_FAST8_T@
# ifndef INT_FAST8_MAX
# define INT_FAST8_MAX (~ (-1L << (@BITSIZEOF_INT_FAST8_T@ - 1)))
# endif
#else
# if _STDINT_H_INT64_FASTER_THAN_INT32
# define INT_FAST8_MAX INT64_MAX
# else
# define INT_FAST8_MAX INT32_MAX
# endif
#endif
#if @HAVE_UINT_FAST8_T@
# ifndef UINT_FAST8_MAX
# if @BITSIZEOF_UINT_FAST8_T@ < @BITSIZEOF_UNSIGNED_INT@
# define UINT_FAST8_MAX (((1 << (@BITSIZEOF_UINT_FAST8_T@ - 1)) - 1) * 2 + 1)
# else
# define UINT_FAST8_MAX (((1UL << (@BITSIZEOF_UINT_FAST8_T@ - 1)) - 1) * 2 + 1)
# endif
# endif
#else
# if _STDINT_H_INT64_FASTER_THAN_INT32
# define UINT_FAST8_MAX UINT64_MAX
# else
# define UINT_FAST8_MAX UINT32_MAX
# endif
#endif
#if @HAVE_INT_FAST16_T@
# ifndef INT_FAST16_MIN
# define INT_FAST16_MIN (-1L << (@BITSIZEOF_INT_FAST16_T@ - 1))
# endif
#else
# if _STDINT_H_INT64_FASTER_THAN_INT32
# define INT_FAST16_MIN INT64_MIN
# else
# define INT_FAST16_MIN INT32_MIN
# endif
#endif
#if @HAVE_INT_FAST16_T@
# ifndef INT_FAST16_MAX
# define INT_FAST16_MAX (~ (-1L << (@BITSIZEOF_INT_FAST16_T@ - 1)))
# endif
#else
# if _STDINT_H_INT64_FASTER_THAN_INT32
# define INT_FAST16_MAX INT64_MAX
# else
# define INT_FAST16_MAX INT32_MAX
# endif
#endif
#if @HAVE_UINT_FAST16_T@
# ifndef UINT_FAST16_MAX
# if @BITSIZEOF_UINT_FAST16_T@ < @BITSIZEOF_UNSIGNED_INT@
# define UINT_FAST16_MAX (((1 << (@BITSIZEOF_UINT_FAST16_T@ - 1)) - 1) * 2 + 1)
# else
# define UINT_FAST16_MAX (((1UL << (@BITSIZEOF_UINT_FAST16_T@ - 1)) - 1) * 2 + 1)
# endif
# endif
#else
# if _STDINT_H_INT64_FASTER_THAN_INT32
# define UINT_FAST16_MAX UINT64_MAX
# else
# define UINT_FAST16_MAX UINT32_MAX
# endif
#endif
#if @HAVE_INT_FAST32_T@
# ifndef INT_FAST32_MIN
# define INT_FAST32_MIN (-1L << (@BITSIZEOF_INT_FAST32_T@ - 1))
# endif
#else
# if _STDINT_H_INT64_FASTER_THAN_INT32
# define INT_FAST32_MIN INT64_MIN
# else
# define INT_FAST32_MIN INT32_MIN
# endif
#endif
#if @HAVE_INT_FAST32_T@
# ifndef INT_FAST32_MAX
# define INT_FAST32_MAX (~ (-1L << (@BITSIZEOF_INT_FAST32_T@ - 1)))
# endif
#else
# if _STDINT_H_INT64_FASTER_THAN_INT32
# define INT_FAST32_MAX INT64_MAX
# else
# define INT_FAST32_MAX INT32_MAX
# endif
#endif
#if @HAVE_UINT_FAST32_T@
# ifndef UINT_FAST32_MAX
# if @BITSIZEOF_UINT_FAST32_T@ < @BITSIZEOF_UNSIGNED_INT@
# define UINT_FAST32_MAX (((1 << (@BITSIZEOF_UINT_FAST32_T@ - 1)) - 1) * 2 + 1)
# else
# define UINT_FAST32_MAX (((1UL << (@BITSIZEOF_UINT_FAST32_T@ - 1)) - 1) * 2 + 1)
# endif
# endif
#else
# if _STDINT_H_INT64_FASTER_THAN_INT32
# define UINT_FAST32_MAX UINT64_MAX
# else
# define UINT_FAST32_MAX UINT32_MAX
# endif
#endif
#if @HAVE_INT_FAST64_T@
# ifndef INT_FAST64_MIN
# if @HAVE_LONG_64BIT@
# define INT_FAST64_MIN (-1L << (@BITSIZEOF_INT_FAST64_T@ - 1))
# elif @HAVE_LONG_LONG_64BIT@
# define INT_FAST64_MIN (-1LL << (@BITSIZEOF_INT_FAST64_T@ - 1))
# elif defined _MSC_VER
# define INT_FAST64_MIN (-1i64 << (@BITSIZEOF_INT_FAST64_T@ - 1))
# endif
# endif
#else
# ifdef _STDINT_H_HAVE_INT64
# define INT_FAST64_MIN INT64_MIN
# endif
#endif
#if @HAVE_INT_FAST64_T@
# ifndef INT_FAST64_MAX
# if @HAVE_LONG_64BIT@
# define INT_FAST64_MAX (~ (-1L << (@BITSIZEOF_INT_FAST64_T@ - 1)))
# elif @HAVE_LONG_LONG_64BIT@
# define INT_FAST64_MAX (~ (-1LL << (@BITSIZEOF_INT_FAST64_T@ - 1)))
# elif defined _MSC_VER
# define INT_FAST64_MAX (~ (-1i64 << (@BITSIZEOF_INT_FAST64_T@ - 1)))
# endif
# endif
#else
# ifdef _STDINT_H_HAVE_INT64
# define INT_FAST64_MAX INT64_MAX
# endif
#endif
#if @HAVE_UINT_FAST64_T@
# ifndef UINT_FAST64_MAX
# if @HAVE_LONG_64BIT@
# define UINT_FAST64_MAX (((1UL << (@BITSIZEOF_UINT_FAST64_T@ - 1)) - 1) * 2 + 1)
# elif @HAVE_LONG_LONG_64BIT@
# define UINT_FAST64_MAX (((1ULL << (@BITSIZEOF_UINT_FAST64_T@ - 1)) - 1) * 2 + 1)
# elif defined _MSC_VER
# define UINT_FAST64_MAX (((1ui64 << (@BITSIZEOF_UINT_FAST64_T@ - 1)) - 1) * 2 + 1)
# endif
# endif
#else
# ifdef _STDINT_H_HAVE_UINT64
# define UINT_FAST64_MAX UINT64_MAX
# endif
#undef INT_FAST8_MIN
#undef INT_FAST8_MAX
#undef UINT_FAST8_MAX
#define INT_FAST8_MIN LONG_MIN
#define INT_FAST8_MAX LONG_MAX
#define UINT_FAST8_MAX ULONG_MAX
#undef INT_FAST16_MIN
#undef INT_FAST16_MAX
#undef UINT_FAST16_MAX
#define INT_FAST16_MIN LONG_MIN
#define INT_FAST16_MAX LONG_MAX
#define UINT_FAST16_MAX ULONG_MAX
#undef INT_FAST32_MIN
#undef INT_FAST32_MAX
#undef UINT_FAST32_MAX
#define INT_FAST32_MIN LONG_MIN
#define INT_FAST32_MAX LONG_MAX
#define UINT_FAST32_MAX ULONG_MAX
#undef INT_FAST64_MIN
#undef INT_FAST64_MAX
#undef UINT_FAST64_MAX
#ifdef int64_t
# define INT_FAST64_MIN INT64_MIN
# define INT_FAST64_MAX INT64_MAX
# define UINT_FAST64_MAX UINT64_MAX
#endif
/* 7.18.2.4. Limits of integer types capable of holding object pointers */
#if @HAVE_INTPTR_T@
# ifndef INTPTR_MIN
# if @BITSIZEOF_INTPTR_T@ > @BITSIZEOF_LONG@
# define INTPTR_MIN (-1LL << (@BITSIZEOF_INTPTR_T@ - 1))
# else
# define INTPTR_MIN (-1L << (@BITSIZEOF_INTPTR_T@ - 1))
# endif
# endif
#else
# define INTPTR_MIN LONG_MIN
#endif
#if @HAVE_INTPTR_T@
# ifndef INTPTR_MAX
# if @BITSIZEOF_INTPTR_T@ > @BITSIZEOF_LONG@
# define INTPTR_MAX (~ (-1LL << (@BITSIZEOF_INTPTR_T@ - 1)))
# else
# define INTPTR_MAX (~ (-1L << (@BITSIZEOF_INTPTR_T@ - 1)))
# endif
# endif
#else
# define INTPTR_MAX LONG_MAX
#endif
#if @HAVE_UINTPTR_T@
# ifndef UINTPTR_MAX
# if @BITSIZEOF_UINTPTR_T@ > @BITSIZEOF_UNSIGNED_LONG@
# define UINTPTR_MAX (((1ULL << (@BITSIZEOF_UINTPTR_T@ - 1)) - 1) * 2 + 1)
# else
# define UINTPTR_MAX (((1UL << (@BITSIZEOF_UINTPTR_T@ - 1)) - 1) * 2 + 1)
# endif
# endif
#else
# define UINTPTR_MAX ULONG_MAX
#endif
#undef INTPTR_MIN
#undef INTPTR_MAX
#undef UINTPTR_MAX
#define INTPTR_MIN LONG_MIN
#define INTPTR_MAX LONG_MAX
#define UINTPTR_MAX ULONG_MAX
/* 7.18.2.5. Limits of greatest-width integer types */
#if @HAVE_INTMAX_T@
# ifndef INTMAX_MIN
# if @BITSIZEOF_INTMAX_T@ > @BITSIZEOF_LONG@
# define INTMAX_MIN (-1LL << (@BITSIZEOF_INTMAX_T@ - 1))
# else
# define INTMAX_MIN (-1L << (@BITSIZEOF_INTMAX_T@ - 1))
# endif
# endif
#else
# ifdef _STDINT_H_HAVE_INT64
# define INTMAX_MIN INT64_MIN
# else
# define INTMAX_MIN INT32_MIN
# endif
#endif
#if @HAVE_INTMAX_T@
# ifndef INTMAX_MAX
# if @BITSIZEOF_INTMAX_T@ > @BITSIZEOF_LONG@
# define INTMAX_MAX (~ (-1LL << (@BITSIZEOF_INTMAX_T@ - 1)))
# else
# define INTMAX_MAX (~ (-1L << (@BITSIZEOF_INTMAX_T@ - 1)))
# endif
# endif
#else
# ifdef _STDINT_H_HAVE_INT64
# define INTMAX_MAX INT64_MAX
# else
# define INTMAX_MAX INT32_MAX
# endif
#endif
#if @HAVE_UINTMAX_T@
# ifndef UINTMAX_MAX
# if @BITSIZEOF_UINTMAX_T@ > @BITSIZEOF_UNSIGNED_LONG@
# define UINTMAX_MAX (((1ULL << (@BITSIZEOF_UINTMAX_T@ - 1)) - 1) * 2 + 1)
# else
# define UINTMAX_MAX (((1UL << (@BITSIZEOF_UINTMAX_T@ - 1)) - 1) * 2 + 1)
# endif
# endif
#undef INTMAX_MIN
#undef INTMAX_MAX
#undef UINTMAX_MAX
#define INTMAX_MIN (~ INTMAX_MAX)
#ifdef INT64_MAX
# define INTMAX_MAX INT64_MAX
# define UINTMAX_MAX UINT64_MAX
#else
# ifdef _STDINT_H_HAVE_INT64
# define UINTMAX_MAX UINT64_MAX
# else
# define UINTMAX_MAX UINT32_MAX
# endif
# define INTMAX_MAX INT32_MAX
# define UINTMAX_MAX UINT32_MAX
#endif
/* 7.18.3. Limits of other integer types */
/* ptrdiff_t limits */
#ifndef PTRDIFF_MIN
# if @BITSIZEOF_PTRDIFF_T@ > @BITSIZEOF_LONG@ || @SAME_TYPE_PTRDIFF_T_LONG@
# define PTRDIFF_MIN (-1L << (@BITSIZEOF_PTRDIFF_T@ - 1))
# else
# define PTRDIFF_MIN (-1 << (@BITSIZEOF_PTRDIFF_T@ - 1))
# endif
#endif
#ifndef PTRDIFF_MAX
# if @BITSIZEOF_PTRDIFF_T@ > @BITSIZEOF_LONG@ || @SAME_TYPE_PTRDIFF_T_LONG@
# define PTRDIFF_MAX (~ (-1L << (@BITSIZEOF_PTRDIFF_T@ - 1)))
# else
# define PTRDIFF_MAX (~ (-1 << (@BITSIZEOF_PTRDIFF_T@ - 1)))
# endif
#endif
#undef PTRDIFF_MIN
#undef PTRDIFF_MAX
#define PTRDIFF_MIN \
_STDINT_MIN (1, @BITSIZEOF_PTRDIFF_T@, 0@PTRDIFF_T_SUFFIX@)
#define PTRDIFF_MAX \
_STDINT_MAX (1, @BITSIZEOF_PTRDIFF_T@, 0@PTRDIFF_T_SUFFIX@)
/* sig_atomic_t limits */
#ifndef SIG_ATOMIC_MIN
# if @HAVE_SIGNED_SIG_ATOMIC_T@
# if @BITSIZEOF_SIG_ATOMIC_T@ > @BITSIZEOF_LONG@ || @SAME_TYPE_SIG_ATOMIC_T_LONG@
# define SIG_ATOMIC_MIN (-1L << (@BITSIZEOF_SIG_ATOMIC_T@ - 1))
# else
# define SIG_ATOMIC_MIN (-1 << (@BITSIZEOF_SIG_ATOMIC_T@ - 1))
# endif
# else
# if @BITSIZEOF_SIG_ATOMIC_T@ > @BITSIZEOF_UNSIGNED_LONG@ || @SAME_TYPE_SIG_ATOMIC_T_UNSIGNED_LONG@
# define SIG_ATOMIC_MIN 0UL
# elif @BITSIZEOF_SIG_ATOMIC_T@ >= @BITSIZEOF_UNSIGNED_INT@
# define SIG_ATOMIC_MIN 0U
# else
# define SIG_ATOMIC_MIN 0
# endif
# endif
#endif
#ifndef SIG_ATOMIC_MAX
# if @HAVE_SIGNED_SIG_ATOMIC_T@
# if @BITSIZEOF_SIG_ATOMIC_T@ > @BITSIZEOF_LONG@ || @SAME_TYPE_SIG_ATOMIC_T_LONG@
# define SIG_ATOMIC_MAX (~ (-1L << (@BITSIZEOF_SIG_ATOMIC_T@ - 1)))
# else
# define SIG_ATOMIC_MAX (~ (-1 << (@BITSIZEOF_SIG_ATOMIC_T@ - 1)))
# endif
# else
# if @BITSIZEOF_SIG_ATOMIC_T@ > @BITSIZEOF_UNSIGNED_LONG@ || @SAME_TYPE_SIG_ATOMIC_T_UNSIGNED_LONG@
# define SIG_ATOMIC_MAX (((1UL << (@BITSIZEOF_SIG_ATOMIC_T@ - 1)) - 1) * 2 + 1)
# elif @BITSIZEOF_SIG_ATOMIC_T@ >= @BITSIZEOF_UNSIGNED_INT@
# define SIG_ATOMIC_MAX (((1U << (@BITSIZEOF_SIG_ATOMIC_T@ - 1)) - 1) * 2 + 1)
# else
# define SIG_ATOMIC_MAX (((1 << (@BITSIZEOF_SIG_ATOMIC_T@ - 1)) - 1) * 2 + 1)
# endif
# endif
#endif
#undef SIG_ATOMIC_MIN
#undef SIG_ATOMIC_MAX
#define SIG_ATOMIC_MIN \
_STDINT_MIN (@HAVE_SIGNED_SIG_ATOMIC_T@, @BITSIZEOF_SIG_ATOMIC_T@, \
0@SIG_ATOMIC_T_SUFFIX@)
#define SIG_ATOMIC_MAX \
_STDINT_MAX (@HAVE_SIGNED_SIG_ATOMIC_T@, @BITSIZEOF_SIG_ATOMIC_T@, \
0@SIG_ATOMIC_T_SUFFIX@)
/* size_t limit */
#ifndef SIZE_MAX
/* SIZE_MAX may also be defined in config.h. */
# if @BITSIZEOF_SIZE_T@ > @BITSIZEOF_UNSIGNED_LONG@ || @SAME_TYPE_SIZE_T_UNSIGNED_LONG@
# define SIZE_MAX (((1UL << (@BITSIZEOF_SIZE_T@ - 1)) - 1) * 2 + 1)
# else
# define SIZE_MAX (((1U << (@BITSIZEOF_SIZE_T@ - 1)) - 1) * 2 + 1)
# endif
#endif
#undef SIZE_MAX
#define SIZE_MAX _STDINT_MAX (0, @BITSIZEOF_SIZE_T@, 0@SIZE_T_SUFFIX@)
/* wchar_t limits may already be defined in <stddef.h>. */
#ifndef WCHAR_MIN
# if @HAVE_SIGNED_WCHAR_T@
# if @BITSIZEOF_WCHAR_T@ > @BITSIZEOF_LONG@ || @SAME_TYPE_WCHAR_T_LONG@
# define WCHAR_MIN (-1L << (@BITSIZEOF_WCHAR_T@ - 1))
# else
# define WCHAR_MIN (-1 << (@BITSIZEOF_WCHAR_T@ - 1))
# endif
# else
# if @BITSIZEOF_WCHAR_T@ > @BITSIZEOF_UNSIGNED_LONG@ || @SAME_TYPE_WCHAR_T_UNSIGNED_LONG@
# define WCHAR_MIN 0UL
# elif @BITSIZEOF_WCHAR_T@ >= @BITSIZEOF_UNSIGNED_INT@
# define WCHAR_MIN 0U
# else
# define WCHAR_MIN 0
# endif
# endif
#endif
#ifndef WCHAR_MAX
# if @HAVE_SIGNED_WCHAR_T@
# if @BITSIZEOF_WCHAR_T@ > @BITSIZEOF_LONG@ || @SAME_TYPE_WCHAR_T_LONG@
# define WCHAR_MAX (~ (-1L << (@BITSIZEOF_WCHAR_T@ - 1)))
# else
# define WCHAR_MAX (~ (-1 << (@BITSIZEOF_WCHAR_T@ - 1)))
# endif
# else
# if @BITSIZEOF_WCHAR_T@ > @BITSIZEOF_UNSIGNED_LONG@ || @SAME_TYPE_WCHAR_T_UNSIGNED_LONG@
# define WCHAR_MAX (((1UL << (@BITSIZEOF_WCHAR_T@ - 1)) - 1) * 2 + 1)
# elif @BITSIZEOF_WCHAR_T@ >= @BITSIZEOF_UNSIGNED_INT@
# define WCHAR_MAX (((1U << (@BITSIZEOF_WCHAR_T@ - 1)) - 1) * 2 + 1)
# else
# define WCHAR_MAX (((1 << (@BITSIZEOF_WCHAR_T@ - 1)) - 1) * 2 + 1)
# endif
# endif
#endif
/* wchar_t limits */
#undef WCHAR_MIN
#undef WCHAR_MAX
#define WCHAR_MIN \
_STDINT_MIN (@HAVE_SIGNED_WCHAR_T@, @BITSIZEOF_WCHAR_T@, 0@WCHAR_T_SUFFIX@)
#define WCHAR_MAX \
_STDINT_MAX (@HAVE_SIGNED_WCHAR_T@, @BITSIZEOF_WCHAR_T@, 0@WCHAR_T_SUFFIX@)
/* wint_t limits */
#ifndef WINT_MIN
# if @HAVE_SIGNED_WINT_T@
# if @BITSIZEOF_WINT_T@ > @BITSIZEOF_LONG@ || @SAME_TYPE_WINT_T_LONG@
# define WINT_MIN (-1L << (@BITSIZEOF_WINT_T@ - 1))
# else
# define WINT_MIN (-1 << (@BITSIZEOF_WINT_T@ - 1))
# endif
# else
# if @BITSIZEOF_WINT_T@ > @BITSIZEOF_UNSIGNED_LONG@ || @SAME_TYPE_WINT_T_UNSIGNED_LONG@
# define WINT_MIN 0UL
# elif @BITSIZEOF_WINT_T@ >= @BITSIZEOF_UNSIGNED_INT@
# define WINT_MIN 0U
# else
# define WINT_MIN 0
# endif
# endif
#endif
#ifndef WINT_MAX
# if @HAVE_SIGNED_WINT_T@
# if @BITSIZEOF_WINT_T@ > @BITSIZEOF_LONG@ || @SAME_TYPE_WINT_T_LONG@
# define WINT_MAX (~ (-1L << (@BITSIZEOF_WINT_T@ - 1)))
# else
# define WINT_MAX (~ (-1 << (@BITSIZEOF_WINT_T@ - 1)))
# endif
# else
# if @BITSIZEOF_WINT_T@ > @BITSIZEOF_UNSIGNED_LONG@ || @SAME_TYPE_WINT_T_UNSIGNED_LONG@
# define WINT_MAX (((1UL << (@BITSIZEOF_WINT_T@ - 1)) - 1) * 2 + 1)
# elif @BITSIZEOF_WINT_T@ >= @BITSIZEOF_UNSIGNED_INT@
# define WINT_MAX (((1U << (@BITSIZEOF_WINT_T@ - 1)) - 1) * 2 + 1)
# else
# define WINT_MAX (((1 << (@BITSIZEOF_WINT_T@ - 1)) - 1) * 2 + 1)
# endif
# endif
#endif
#undef WINT_MIN
#undef WINT_MAX
#define WINT_MIN \
_STDINT_MIN (@HAVE_SIGNED_WINT_T@, @BITSIZEOF_WINT_T@, 0@WINT_T_SUFFIX@)
#define WINT_MAX \
_STDINT_MAX (@HAVE_SIGNED_WINT_T@, @BITSIZEOF_WINT_T@, 0@WINT_T_SUFFIX@)
#endif
#endif
/* !defined __cplusplus || defined __STDC_LIMIT_MACROS */
/* 7.18.4. Macros for integer constants */
#if !
defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS)
#if !
defined __cplusplus || defined __STDC_CONSTANT_MACROS
/* 7.18.4.1. Macros for minimum-width integer constants */
/* According to ISO C 99 Technical Corrigendum 1 */
/* Here we assume a standard architecture where the hardware integer
types have 8, 16, 32, optionally 64 bits, and int is 32 bits. */
#undef INT8_C
#undef UINT8_C
#define INT8_C(x) x
#if @HAVE_UINT8_T@
# if @BITSIZEOF_UINT8_T@ < @BITSIZEOF_UNSIGNED_INT@
# define UINT8_C(x) x
# else
# define UINT8_C(x) x##U
# endif
#else
# define UINT8_C(x) x
#endif
#define UINT8_C(x) x
#undef INT16_C
#undef UINT16_C
#define INT16_C(x) x
#if @HAVE_UINT16_T@
# if @BITSIZEOF_UINT16_T@ < @BITSIZEOF_UNSIGNED_INT@
# define UINT16_C(x) x
# else
# define UINT16_C(x) x##U
# endif
#else
# define UINT16_C(x) x
#endif
#define UINT16_C(x) x
#undef INT32_C
#undef UINT32_C
#define INT32_C(x) x
#if @HAVE_UINT32_T@
# if @BITSIZEOF_UINT32_T@ < @BITSIZEOF_UNSIGNED_INT@
# define UINT32_C(x) x
# else
# define UINT32_C(x) x##U
# endif
#else
# define UINT32_C(x) x
#endif
#define UINT32_C(x) x ## U
#undef INT64_C
#undef UINT64_C
#if
@HAVE_LONG_64BIT@
#if
LONG_MAX >> 31 >> 31 == 1
# define INT64_C(x) x##L
# define UINT64_C(x) x##UL
#elif @HAVE_LONG_LONG_64BIT@
# define INT64_C(x) x##LL
# define UINT64_C(x) x##ULL
#elif defined(_MSC_VER)
#elif defined _MSC_VER
# define INT64_C(x) x##i64
# define UINT64_C(x) x##ui64
#elif @HAVE_LONG_LONG_INT@
# define INT64_C(x) x##LL
# define UINT64_C(x) x##ULL
#endif
/* 7.18.4.2. Macros for greatest-width integer constants */
#undef INTMAX_C
#undef UINTMAX_C
#if @HAVE_LONG_64BIT@
# define INTMAX_C(x) x##L
# define UINTMAX_C(x) x##UL
#elif @HAVE_LONG_LONG_64BIT@
# define INTMAX_C(x) x##LL
# define UINTMAX_C(x) x##ULL
#elif defined(_MSC_VER)
# define INTMAX_C(x) x##i64
# define UINTMAX_C(x) x##ui64
#if @HAVE_LONG_LONG_INT@ && LONG_MAX >> 30 == 1
# define INTMAX_C(x) x##LL
# define UINTMAX_C(x) x##ULL
#elif defined int64_t
# define INTMAX_C(x) INT64_C(x)
# define UINTMAX_C(x) UINT64_C(x)
#else
# define INTMAX_C(x)
x
# define UINTMAX_C(x)
x##U
# define INTMAX_C(x)
x##L
# define UINTMAX_C(x)
x##UL
#endif
#endif
#endif
/* !defined __cplusplus || defined __STDC_CONSTANT_MACROS */
#endif
/* _STDINT_H */
#endif
/* _
GL_
STDINT_H */
...
...
mailbox/strnlen1.c
View file @
94fdc60
/* Find the length of STRING + 1, but scan at most MAXLEN bytes.
Copyright (C) 2005 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it
under the terms of the GNU Library General Public License as published
by
the Free Software Foundation; either version 2, or (at your option)
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
Library
General Public License for more details.
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 Library 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>
...
...
mailbox/strnlen1.h
View file @
94fdc60
/* Find the length of STRING + 1, but scan at most MAXLEN bytes.
Copyright (C) 2005 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it
under the terms of the GNU Library General Public License as published
by
the Free Software Foundation; either version 2, or (at your option)
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
Library
General Public License for more details.
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 Library 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 _STRNLEN1_H
#define _STRNLEN1_H
...
...
mailbox/vasnprintf.c
View file @
94fdc60
...
...
@@ -40,7 +40,7 @@
#include <stdlib.h>
/* abort(), malloc(), realloc(), free() */
#include <string.h>
/* memcpy(), strlen() */
#include <errno.h>
/* errno */
#include <limits.h>
/* CHAR_BIT
, INT_MAX
*/
#include <limits.h>
/* CHAR_BIT */
#include <float.h>
/* DBL_MAX_EXP, LDBL_MAX_EXP */
#if WIDE_CHAR_VERSION
# include "wprintf-parse.h"
...
...
@@ -51,11 +51,6 @@
/* 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
...
...
@@ -869,19 +864,12 @@ VASNPRINTF (CHAR_T *resultbuf, size_t *lengthp, const CHAR_T *format, va_list ar
free
(
buf_malloced
);
CLEANUP
();
*
lengthp
=
length
;
if
(
length
>
INT_MAX
)
goto
length_overflow
;
/* Note that we can produce a big string of a length > INT_MAX. POSIX
says that snprintf() fails with errno = EOVERFLOW in this case, but
that's only because snprintf() returns an 'int'. This function does
not have this limitation. */
return
result
;
length_overflow:
/* We could produce such a big string, but its length doesn't fit into
an 'int'. POSIX says that snprintf() fails with errno = EOVERFLOW in
this case. */
if
(
result
!=
resultbuf
)
free
(
result
);
errno
=
EOVERFLOW
;
return
NULL
;
out_of_memory:
if
(
!
(
result
==
resultbuf
||
result
==
NULL
))
free
(
result
);
...
...
mailbox/vsnprintf.c
View file @
94fdc60
/* Formatted output to strings.
Copyright (C) 2004 Free Software Foundation, Inc.
Copyright (C) 2004
, 2006
Free Software Foundation, Inc.
Written by Simon Josefsson and Yoann Vandoorselaere <yoann@prelude-ids.org>.
This program is free software; you can redistribute it and/or modify
...
...
@@ -23,6 +23,8 @@
/* Specification. */
#include "vsnprintf.h"
#include <errno.h>
#include <limits.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
...
...
@@ -30,6 +32,11 @@
#include "vasnprintf.h"
/* Some systems, like OSF/1 4.0 and Woe32, don't have EOVERFLOW. */
#ifndef EOVERFLOW
# define EOVERFLOW E2BIG
#endif
/* Print formatted output to string STR. Similar to vsprintf, but
additional length SIZE limit how much is written into STR. Returns
string length of formatted string (which may be larger than SIZE).
...
...
@@ -40,19 +47,31 @@ vsnprintf (char *str, size_t size, const char *format, va_list args)
{
char
*
output
;
size_t
len
;
size_t
lenbuf
=
size
;
len
=
size
;
output
=
vasnprintf
(
str
,
&
len
,
format
,
args
)
;
output
=
vasnprintf
(
str
,
&
lenbuf
,
format
,
args
)
;
len
=
lenbuf
;
if
(
!
output
)
return
-
1
;
if
(
str
!=
NULL
)
if
(
len
>
size
-
1
)
/* equivalent to: (size > 0 && len >= size) */
str
[
size
-
1
]
=
'\0'
;
if
(
output
!=
str
)
free
(
output
);
{
if
(
size
)
{
size_t
pruned_len
=
(
len
<
size
?
len
:
size
-
1
);
memcpy
(
str
,
output
,
pruned_len
);
str
[
pruned_len
]
=
'\0'
;
}
free
(
output
);
}
if
(
len
>
INT_MAX
)
{
errno
=
EOVERFLOW
;
return
-
1
;
}
return
len
;
}
...
...
Please
register
or
sign in
to post a comment