mirror of
https://gitlab.com/openconnect/ocserv.git
synced 2026-02-10 00:37:00 +08:00
Added plain password format
This commit is contained in:
4
.gitignore
vendored
4
.gitignore
vendored
@@ -20,7 +20,7 @@ gl/libgnu.a
|
||||
gl/arg-nonnull.h
|
||||
gl/warn-on-use.h
|
||||
gl/c++defs.h
|
||||
doc/ocserv.1
|
||||
doc/ocserv.8
|
||||
libopts/libopts.a
|
||||
gl/time.h
|
||||
gl/sys/time.h
|
||||
@@ -29,3 +29,5 @@ gl/fcntl.h
|
||||
gl/stdint.h
|
||||
gl/sys/types.h
|
||||
src/version.def
|
||||
gl/stdio.h
|
||||
gl/stdlib.h
|
||||
|
||||
10
build-aux/snippet/_Noreturn.h
Normal file
10
build-aux/snippet/_Noreturn.h
Normal file
@@ -0,0 +1,10 @@
|
||||
#if !defined _Noreturn && __STDC_VERSION__ < 201112
|
||||
# if (3 <= __GNUC__ || (__GNUC__ == 2 && 8 <= __GNUC_MINOR__) \
|
||||
|| 0x5110 <= __SUNPRO_C)
|
||||
# define _Noreturn __attribute__ ((__noreturn__))
|
||||
# elif 1200 <= _MSC_VER
|
||||
# define _Noreturn __declspec (noreturn)
|
||||
# else
|
||||
# define _Noreturn
|
||||
# endif
|
||||
#endif
|
||||
246
config.h.in
246
config.h.in
@@ -37,6 +37,14 @@
|
||||
declaration of the second argument to gettimeofday. */
|
||||
#undef GETTIMEOFDAY_TIMEZONE
|
||||
|
||||
/* Define to a C preprocessor expression that evaluates to 1 or 0, depending
|
||||
whether the gnulib module fscanf shall be considered present. */
|
||||
#undef GNULIB_FSCANF
|
||||
|
||||
/* Define to a C preprocessor expression that evaluates to 1 or 0, depending
|
||||
whether the gnulib module scanf shall be considered present. */
|
||||
#undef GNULIB_SCANF
|
||||
|
||||
/* Define to 1 when the gnulib module cloexec should be tested. */
|
||||
#undef GNULIB_TEST_CLOEXEC
|
||||
|
||||
@@ -49,9 +57,15 @@
|
||||
/* Define to 1 when the gnulib module fcntl should be tested. */
|
||||
#undef GNULIB_TEST_FCNTL
|
||||
|
||||
/* Define to 1 when the gnulib module getdelim should be tested. */
|
||||
#undef GNULIB_TEST_GETDELIM
|
||||
|
||||
/* Define to 1 when the gnulib module getdtablesize should be tested. */
|
||||
#undef GNULIB_TEST_GETDTABLESIZE
|
||||
|
||||
/* Define to 1 when the gnulib module getline should be tested. */
|
||||
#undef GNULIB_TEST_GETLINE
|
||||
|
||||
/* Define to 1 when the gnulib module gettimeofday should be tested. */
|
||||
#undef GNULIB_TEST_GETTIMEOFDAY
|
||||
|
||||
@@ -61,6 +75,9 @@
|
||||
/* Define to 1 when the gnulib module memmem should be tested. */
|
||||
#undef GNULIB_TEST_MEMMEM
|
||||
|
||||
/* Define to 1 when the gnulib module realloc-posix should be tested. */
|
||||
#undef GNULIB_TEST_REALLOC_POSIX
|
||||
|
||||
/* Define to 1 if you have the <bp-sym.h> header file. */
|
||||
#undef HAVE_BP_SYM_H
|
||||
|
||||
@@ -76,6 +93,18 @@
|
||||
/* Define to 1 if you have the `clock_settime' function. */
|
||||
#undef HAVE_CLOCK_SETTIME
|
||||
|
||||
/* Define to 1 if you have the declaration of `getc_unlocked', and to 0 if you
|
||||
don't. */
|
||||
#undef HAVE_DECL_GETC_UNLOCKED
|
||||
|
||||
/* Define to 1 if you have the declaration of `getdelim', and to 0 if you
|
||||
don't. */
|
||||
#undef HAVE_DECL_GETDELIM
|
||||
|
||||
/* Define to 1 if you have the declaration of `getline', and to 0 if you
|
||||
don't. */
|
||||
#undef HAVE_DECL_GETLINE
|
||||
|
||||
/* Define to 1 if you have the declaration of `memmem', and to 0 if you don't.
|
||||
*/
|
||||
#undef HAVE_DECL_MEMMEM
|
||||
@@ -108,15 +137,24 @@
|
||||
/* Define to 1 if you have the <fcntl.h> header file. */
|
||||
#undef HAVE_FCNTL_H
|
||||
|
||||
/* Define to 1 if you have the `flockfile' function. */
|
||||
#undef HAVE_FLOCKFILE
|
||||
|
||||
/* Define to 1 if you have the `fork' function. */
|
||||
#undef HAVE_FORK
|
||||
|
||||
/* Define to 1 if you have the `fstat' function. */
|
||||
#undef HAVE_FSTAT
|
||||
|
||||
/* Define to 1 if you have the `funlockfile' function. */
|
||||
#undef HAVE_FUNLOCKFILE
|
||||
|
||||
/* Enable the GDBM library */
|
||||
#undef HAVE_GDBM
|
||||
|
||||
/* Define to 1 if you have the `getdelim' function. */
|
||||
#undef HAVE_GETDELIM
|
||||
|
||||
/* Define to 1 if you have the `getdtablesize' function. */
|
||||
#undef HAVE_GETDTABLESIZE
|
||||
|
||||
@@ -200,12 +238,22 @@
|
||||
/* PKCS11 detected in gnutls */
|
||||
#undef HAVE_PKCS11
|
||||
|
||||
/* Define to 1 if atoll is declared even after undefining macros. */
|
||||
#undef HAVE_RAW_DECL_ATOLL
|
||||
|
||||
/* Define to 1 if canonicalize_file_name is declared even after undefining
|
||||
macros. */
|
||||
#undef HAVE_RAW_DECL_CANONICALIZE_FILE_NAME
|
||||
|
||||
/* Define to 1 if chdir is declared even after undefining macros. */
|
||||
#undef HAVE_RAW_DECL_CHDIR
|
||||
|
||||
/* Define to 1 if chown is declared even after undefining macros. */
|
||||
#undef HAVE_RAW_DECL_CHOWN
|
||||
|
||||
/* Define to 1 if dprintf is declared even after undefining macros. */
|
||||
#undef HAVE_RAW_DECL_DPRINTF
|
||||
|
||||
/* Define to 1 if dup is declared even after undefining macros. */
|
||||
#undef HAVE_RAW_DECL_DUP
|
||||
|
||||
@@ -245,15 +293,27 @@
|
||||
/* Define to 1 if ffsll is declared even after undefining macros. */
|
||||
#undef HAVE_RAW_DECL_FFSLL
|
||||
|
||||
/* Define to 1 if fpurge is declared even after undefining macros. */
|
||||
#undef HAVE_RAW_DECL_FPURGE
|
||||
|
||||
/* Define to 1 if fseeko is declared even after undefining macros. */
|
||||
#undef HAVE_RAW_DECL_FSEEKO
|
||||
|
||||
/* Define to 1 if fsync is declared even after undefining macros. */
|
||||
#undef HAVE_RAW_DECL_FSYNC
|
||||
|
||||
/* Define to 1 if ftello is declared even after undefining macros. */
|
||||
#undef HAVE_RAW_DECL_FTELLO
|
||||
|
||||
/* Define to 1 if ftruncate is declared even after undefining macros. */
|
||||
#undef HAVE_RAW_DECL_FTRUNCATE
|
||||
|
||||
/* Define to 1 if getcwd is declared even after undefining macros. */
|
||||
#undef HAVE_RAW_DECL_GETCWD
|
||||
|
||||
/* Define to 1 if getdelim is declared even after undefining macros. */
|
||||
#undef HAVE_RAW_DECL_GETDELIM
|
||||
|
||||
/* Define to 1 if getdomainname is declared even after undefining macros. */
|
||||
#undef HAVE_RAW_DECL_GETDOMAINNAME
|
||||
|
||||
@@ -266,6 +326,12 @@
|
||||
/* Define to 1 if gethostname is declared even after undefining macros. */
|
||||
#undef HAVE_RAW_DECL_GETHOSTNAME
|
||||
|
||||
/* Define to 1 if getline is declared even after undefining macros. */
|
||||
#undef HAVE_RAW_DECL_GETLINE
|
||||
|
||||
/* Define to 1 if getloadavg is declared even after undefining macros. */
|
||||
#undef HAVE_RAW_DECL_GETLOADAVG
|
||||
|
||||
/* Define to 1 if getlogin is declared even after undefining macros. */
|
||||
#undef HAVE_RAW_DECL_GETLOGIN
|
||||
|
||||
@@ -275,15 +341,30 @@
|
||||
/* Define to 1 if getpagesize is declared even after undefining macros. */
|
||||
#undef HAVE_RAW_DECL_GETPAGESIZE
|
||||
|
||||
/* Define to 1 if gets is declared even after undefining macros. */
|
||||
#undef HAVE_RAW_DECL_GETS
|
||||
|
||||
/* Define to 1 if getsubopt is declared even after undefining macros. */
|
||||
#undef HAVE_RAW_DECL_GETSUBOPT
|
||||
|
||||
/* Define to 1 if gettimeofday is declared even after undefining macros. */
|
||||
#undef HAVE_RAW_DECL_GETTIMEOFDAY
|
||||
|
||||
/* Define to 1 if getusershell is declared even after undefining macros. */
|
||||
#undef HAVE_RAW_DECL_GETUSERSHELL
|
||||
|
||||
/* Define to 1 if grantpt is declared even after undefining macros. */
|
||||
#undef HAVE_RAW_DECL_GRANTPT
|
||||
|
||||
/* Define to 1 if group_member is declared even after undefining macros. */
|
||||
#undef HAVE_RAW_DECL_GROUP_MEMBER
|
||||
|
||||
/* Define to 1 if initstate is declared even after undefining macros. */
|
||||
#undef HAVE_RAW_DECL_INITSTATE
|
||||
|
||||
/* Define to 1 if initstate_r is declared even after undefining macros. */
|
||||
#undef HAVE_RAW_DECL_INITSTATE_R
|
||||
|
||||
/* Define to 1 if isatty is declared even after undefining macros. */
|
||||
#undef HAVE_RAW_DECL_ISATTY
|
||||
|
||||
@@ -308,21 +389,57 @@
|
||||
/* Define to 1 if memrchr is declared even after undefining macros. */
|
||||
#undef HAVE_RAW_DECL_MEMRCHR
|
||||
|
||||
/* Define to 1 if mkdtemp is declared even after undefining macros. */
|
||||
#undef HAVE_RAW_DECL_MKDTEMP
|
||||
|
||||
/* Define to 1 if mkostemp is declared even after undefining macros. */
|
||||
#undef HAVE_RAW_DECL_MKOSTEMP
|
||||
|
||||
/* Define to 1 if mkostemps is declared even after undefining macros. */
|
||||
#undef HAVE_RAW_DECL_MKOSTEMPS
|
||||
|
||||
/* Define to 1 if mkstemp is declared even after undefining macros. */
|
||||
#undef HAVE_RAW_DECL_MKSTEMP
|
||||
|
||||
/* Define to 1 if mkstemps is declared even after undefining macros. */
|
||||
#undef HAVE_RAW_DECL_MKSTEMPS
|
||||
|
||||
/* Define to 1 if openat is declared even after undefining macros. */
|
||||
#undef HAVE_RAW_DECL_OPENAT
|
||||
|
||||
/* Define to 1 if pclose is declared even after undefining macros. */
|
||||
#undef HAVE_RAW_DECL_PCLOSE
|
||||
|
||||
/* Define to 1 if pipe is declared even after undefining macros. */
|
||||
#undef HAVE_RAW_DECL_PIPE
|
||||
|
||||
/* Define to 1 if pipe2 is declared even after undefining macros. */
|
||||
#undef HAVE_RAW_DECL_PIPE2
|
||||
|
||||
/* Define to 1 if popen is declared even after undefining macros. */
|
||||
#undef HAVE_RAW_DECL_POPEN
|
||||
|
||||
/* Define to 1 if posix_openpt is declared even after undefining macros. */
|
||||
#undef HAVE_RAW_DECL_POSIX_OPENPT
|
||||
|
||||
/* Define to 1 if pread is declared even after undefining macros. */
|
||||
#undef HAVE_RAW_DECL_PREAD
|
||||
|
||||
/* Define to 1 if ptsname is declared even after undefining macros. */
|
||||
#undef HAVE_RAW_DECL_PTSNAME
|
||||
|
||||
/* Define to 1 if ptsname_r is declared even after undefining macros. */
|
||||
#undef HAVE_RAW_DECL_PTSNAME_R
|
||||
|
||||
/* Define to 1 if pwrite is declared even after undefining macros. */
|
||||
#undef HAVE_RAW_DECL_PWRITE
|
||||
|
||||
/* Define to 1 if random is declared even after undefining macros. */
|
||||
#undef HAVE_RAW_DECL_RANDOM
|
||||
|
||||
/* Define to 1 if random_r is declared even after undefining macros. */
|
||||
#undef HAVE_RAW_DECL_RANDOM_R
|
||||
|
||||
/* Define to 1 if rawmemchr is declared even after undefining macros. */
|
||||
#undef HAVE_RAW_DECL_RAWMEMCHR
|
||||
|
||||
@@ -332,18 +449,48 @@
|
||||
/* Define to 1 if readlinkat is declared even after undefining macros. */
|
||||
#undef HAVE_RAW_DECL_READLINKAT
|
||||
|
||||
/* Define to 1 if realpath is declared even after undefining macros. */
|
||||
#undef HAVE_RAW_DECL_REALPATH
|
||||
|
||||
/* Define to 1 if renameat is declared even after undefining macros. */
|
||||
#undef HAVE_RAW_DECL_RENAMEAT
|
||||
|
||||
/* Define to 1 if rmdir is declared even after undefining macros. */
|
||||
#undef HAVE_RAW_DECL_RMDIR
|
||||
|
||||
/* Define to 1 if rpmatch is declared even after undefining macros. */
|
||||
#undef HAVE_RAW_DECL_RPMATCH
|
||||
|
||||
/* Define to 1 if secure_getenv is declared even after undefining macros. */
|
||||
#undef HAVE_RAW_DECL_SECURE_GETENV
|
||||
|
||||
/* Define to 1 if setenv is declared even after undefining macros. */
|
||||
#undef HAVE_RAW_DECL_SETENV
|
||||
|
||||
/* Define to 1 if sethostname is declared even after undefining macros. */
|
||||
#undef HAVE_RAW_DECL_SETHOSTNAME
|
||||
|
||||
/* Define to 1 if setstate is declared even after undefining macros. */
|
||||
#undef HAVE_RAW_DECL_SETSTATE
|
||||
|
||||
/* Define to 1 if setstate_r is declared even after undefining macros. */
|
||||
#undef HAVE_RAW_DECL_SETSTATE_R
|
||||
|
||||
/* Define to 1 if setusershell is declared even after undefining macros. */
|
||||
#undef HAVE_RAW_DECL_SETUSERSHELL
|
||||
|
||||
/* Define to 1 if sleep is declared even after undefining macros. */
|
||||
#undef HAVE_RAW_DECL_SLEEP
|
||||
|
||||
/* Define to 1 if snprintf is declared even after undefining macros. */
|
||||
#undef HAVE_RAW_DECL_SNPRINTF
|
||||
|
||||
/* Define to 1 if srandom is declared even after undefining macros. */
|
||||
#undef HAVE_RAW_DECL_SRANDOM
|
||||
|
||||
/* Define to 1 if srandom_r is declared even after undefining macros. */
|
||||
#undef HAVE_RAW_DECL_SRANDOM_R
|
||||
|
||||
/* Define to 1 if stpcpy is declared even after undefining macros. */
|
||||
#undef HAVE_RAW_DECL_STPCPY
|
||||
|
||||
@@ -380,9 +527,18 @@
|
||||
/* Define to 1 if strsignal is declared even after undefining macros. */
|
||||
#undef HAVE_RAW_DECL_STRSIGNAL
|
||||
|
||||
/* Define to 1 if strtod is declared even after undefining macros. */
|
||||
#undef HAVE_RAW_DECL_STRTOD
|
||||
|
||||
/* Define to 1 if strtok_r is declared even after undefining macros. */
|
||||
#undef HAVE_RAW_DECL_STRTOK_R
|
||||
|
||||
/* Define to 1 if strtoll is declared even after undefining macros. */
|
||||
#undef HAVE_RAW_DECL_STRTOLL
|
||||
|
||||
/* Define to 1 if strtoull is declared even after undefining macros. */
|
||||
#undef HAVE_RAW_DECL_STRTOULL
|
||||
|
||||
/* Define to 1 if strverscmp is declared even after undefining macros. */
|
||||
#undef HAVE_RAW_DECL_STRVERSCMP
|
||||
|
||||
@@ -392,6 +548,9 @@
|
||||
/* Define to 1 if symlinkat is declared even after undefining macros. */
|
||||
#undef HAVE_RAW_DECL_SYMLINKAT
|
||||
|
||||
/* Define to 1 if tmpfile is declared even after undefining macros. */
|
||||
#undef HAVE_RAW_DECL_TMPFILE
|
||||
|
||||
/* Define to 1 if ttyname_r is declared even after undefining macros. */
|
||||
#undef HAVE_RAW_DECL_TTYNAME_R
|
||||
|
||||
@@ -401,9 +560,27 @@
|
||||
/* Define to 1 if unlinkat is declared even after undefining macros. */
|
||||
#undef HAVE_RAW_DECL_UNLINKAT
|
||||
|
||||
/* Define to 1 if unlockpt is declared even after undefining macros. */
|
||||
#undef HAVE_RAW_DECL_UNLOCKPT
|
||||
|
||||
/* Define to 1 if unsetenv is declared even after undefining macros. */
|
||||
#undef HAVE_RAW_DECL_UNSETENV
|
||||
|
||||
/* Define to 1 if usleep is declared even after undefining macros. */
|
||||
#undef HAVE_RAW_DECL_USLEEP
|
||||
|
||||
/* Define to 1 if vdprintf is declared even after undefining macros. */
|
||||
#undef HAVE_RAW_DECL_VDPRINTF
|
||||
|
||||
/* Define to 1 if vsnprintf is declared even after undefining macros. */
|
||||
#undef HAVE_RAW_DECL_VSNPRINTF
|
||||
|
||||
/* Define to 1 if _Exit is declared even after undefining macros. */
|
||||
#undef HAVE_RAW_DECL__EXIT
|
||||
|
||||
/* Define if the 'realloc' function is POSIX compliant. */
|
||||
#undef HAVE_REALLOC_POSIX
|
||||
|
||||
/* Define this if we have a functional realpath(3C) */
|
||||
#undef HAVE_REALPATH
|
||||
|
||||
@@ -661,6 +838,38 @@
|
||||
/* Define to 1 if you have the ANSI C header files. */
|
||||
#undef STDC_HEADERS
|
||||
|
||||
/* Enable extensions on AIX 3, Interix. */
|
||||
#ifndef _ALL_SOURCE
|
||||
# undef _ALL_SOURCE
|
||||
#endif
|
||||
/* Enable general extensions on OS X. */
|
||||
#ifndef _DARWIN_C_SOURCE
|
||||
# undef _DARWIN_C_SOURCE
|
||||
#endif
|
||||
/* Enable GNU extensions on systems that have them. */
|
||||
#ifndef _GNU_SOURCE
|
||||
# undef _GNU_SOURCE
|
||||
#endif
|
||||
/* Enable threading extensions on Solaris. */
|
||||
#ifndef _POSIX_PTHREAD_SEMANTICS
|
||||
# undef _POSIX_PTHREAD_SEMANTICS
|
||||
#endif
|
||||
/* Enable extensions on HP NonStop. */
|
||||
#ifndef _TANDEM_SOURCE
|
||||
# undef _TANDEM_SOURCE
|
||||
#endif
|
||||
/* Enable X/Open extensions if necessary. HP-UX 11.11 defines
|
||||
mbstate_t only if _XOPEN_SOURCE is defined to 500, regardless of
|
||||
whether compiling with -Ae or -D_HPUX_SOURCE=1. */
|
||||
#ifndef _XOPEN_SOURCE
|
||||
# undef _XOPEN_SOURCE
|
||||
#endif
|
||||
/* Enable general extensions on Solaris. */
|
||||
#ifndef __EXTENSIONS__
|
||||
# undef __EXTENSIONS__
|
||||
#endif
|
||||
|
||||
|
||||
/* Version number of package */
|
||||
#undef VERSION
|
||||
|
||||
@@ -690,6 +899,9 @@
|
||||
/* Define to 1 if on MINIX. */
|
||||
#undef _MINIX
|
||||
|
||||
/* Define to 1 to make NetBSD features available. MINIX 3 needs this. */
|
||||
#undef _NETBSD_SOURCE
|
||||
|
||||
/* The _Noreturn keyword of C11. */
|
||||
#if ! (defined _Noreturn \
|
||||
|| (defined __STDC_VERSION__ && 201112 <= __STDC_VERSION__))
|
||||
@@ -711,35 +923,6 @@
|
||||
/* Define to 1 if you need to in order for 'stat' and other things to work. */
|
||||
#undef _POSIX_SOURCE
|
||||
|
||||
/* Define to 500 only on HP-UX. */
|
||||
#undef _XOPEN_SOURCE
|
||||
|
||||
/* Enable extensions on AIX 3, Interix. */
|
||||
#ifndef _ALL_SOURCE
|
||||
# undef _ALL_SOURCE
|
||||
#endif
|
||||
/* Enable general extensions on Mac OS X. */
|
||||
#ifndef _DARWIN_C_SOURCE
|
||||
# undef _DARWIN_C_SOURCE
|
||||
#endif
|
||||
/* Enable GNU extensions on systems that have them. */
|
||||
#ifndef _GNU_SOURCE
|
||||
# undef _GNU_SOURCE
|
||||
#endif
|
||||
/* Enable threading extensions on Solaris. */
|
||||
#ifndef _POSIX_PTHREAD_SEMANTICS
|
||||
# undef _POSIX_PTHREAD_SEMANTICS
|
||||
#endif
|
||||
/* Enable extensions on HP NonStop. */
|
||||
#ifndef _TANDEM_SOURCE
|
||||
# undef _TANDEM_SOURCE
|
||||
#endif
|
||||
/* Enable general extensions on Solaris. */
|
||||
#ifndef __EXTENSIONS__
|
||||
# undef __EXTENSIONS__
|
||||
#endif
|
||||
|
||||
|
||||
/* _GL_INLINE is a portable alternative to ISO C99 plain 'inline'.
|
||||
_GL_EXTERN_INLINE is a portable alternative to 'extern inline'.
|
||||
_GL_INLINE_HEADER_BEGIN contains useful stuff to put
|
||||
@@ -750,13 +933,16 @@
|
||||
_GL_INLINE_HEADER_END contains useful stuff to put
|
||||
in the same include file, after uses of _GL_INLINE.
|
||||
|
||||
Suppress extern inline with HP-UX cc, as it appears to be broken; see
|
||||
<http://lists.gnu.org/archive/html/bug-texinfo/2013-02/msg00030.html>.
|
||||
|
||||
Suppress the use of extern inline on Apple's platforms,
|
||||
as Libc-825.25 (2012-09-19) is incompatible with it; see
|
||||
<http://lists.gnu.org/archive/html/bug-gnulib/2012-12/msg00023.html>.
|
||||
Perhaps Apple will fix this some day. */
|
||||
#if ((__GNUC__ \
|
||||
? defined __GNUC_STDC_INLINE__ && __GNUC_STDC_INLINE__ \
|
||||
: 199901L <= __STDC_VERSION__) \
|
||||
: 199901L <= __STDC_VERSION__ && !defined __HP_cc) \
|
||||
&& !defined __APPLE__)
|
||||
# define _GL_INLINE inline
|
||||
# define _GL_EXTERN_INLINE extern inline
|
||||
|
||||
@@ -2,7 +2,8 @@
|
||||
# all should succeed.
|
||||
# Options: certificate, pam.
|
||||
#auth = "certificate"
|
||||
auth = "pam"
|
||||
auth = "plain[/tmp/passwd]"
|
||||
#auth = "pam"
|
||||
|
||||
# A banner to be displayed on clients
|
||||
#banner = "Welcome"
|
||||
|
||||
306
gl/Makefile.am
306
gl/Makefile.am
@@ -21,7 +21,7 @@
|
||||
# the same distribution terms as the rest of that program.
|
||||
#
|
||||
# Generated by gnulib-tool.
|
||||
# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=gl --m4-base=gl/m4 --doc-base=doc --tests-base=gl/tests --aux-dir=build-aux --no-conditional-dependencies --no-libtool --macro-prefix=gl cloexec gettime memmem
|
||||
# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=gl --m4-base=gl/m4 --doc-base=doc --tests-base=gl/tests --aux-dir=build-aux --no-conditional-dependencies --no-libtool --macro-prefix=gl cloexec getline gettime memmem
|
||||
|
||||
AUTOMAKE_OPTIONS = 1.5 gnits
|
||||
|
||||
@@ -75,6 +75,40 @@ EXTRA_libgnu_a_SOURCES += dup2.c
|
||||
|
||||
## end gnulib module dup2
|
||||
|
||||
## begin gnulib module errno
|
||||
|
||||
BUILT_SOURCES += $(ERRNO_H)
|
||||
|
||||
# We need the following in order to create <errno.h> when the system
|
||||
# doesn't have one that is POSIX compliant.
|
||||
if GL_GENERATE_ERRNO_H
|
||||
errno.h: errno.in.h $(top_builddir)/config.status
|
||||
$(AM_V_GEN)rm -f $@-t $@ && \
|
||||
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
|
||||
sed -e 's|@''GUARD_PREFIX''@|GL|g' \
|
||||
-e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
|
||||
-e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
|
||||
-e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
|
||||
-e 's|@''NEXT_ERRNO_H''@|$(NEXT_ERRNO_H)|g' \
|
||||
-e 's|@''EMULTIHOP_HIDDEN''@|$(EMULTIHOP_HIDDEN)|g' \
|
||||
-e 's|@''EMULTIHOP_VALUE''@|$(EMULTIHOP_VALUE)|g' \
|
||||
-e 's|@''ENOLINK_HIDDEN''@|$(ENOLINK_HIDDEN)|g' \
|
||||
-e 's|@''ENOLINK_VALUE''@|$(ENOLINK_VALUE)|g' \
|
||||
-e 's|@''EOVERFLOW_HIDDEN''@|$(EOVERFLOW_HIDDEN)|g' \
|
||||
-e 's|@''EOVERFLOW_VALUE''@|$(EOVERFLOW_VALUE)|g' \
|
||||
< $(srcdir)/errno.in.h; \
|
||||
} > $@-t && \
|
||||
mv $@-t $@
|
||||
else
|
||||
errno.h: $(top_builddir)/config.status
|
||||
rm -f $@
|
||||
endif
|
||||
MOSTLYCLEANFILES += errno.h errno.h-t
|
||||
|
||||
EXTRA_DIST += errno.in.h
|
||||
|
||||
## end gnulib module errno
|
||||
|
||||
## begin gnulib module fcntl
|
||||
|
||||
|
||||
@@ -127,6 +161,15 @@ EXTRA_DIST += fd-hook.h
|
||||
|
||||
## end gnulib module fd-hook
|
||||
|
||||
## begin gnulib module getdelim
|
||||
|
||||
|
||||
EXTRA_DIST += getdelim.c
|
||||
|
||||
EXTRA_libgnu_a_SOURCES += getdelim.c
|
||||
|
||||
## end gnulib module getdelim
|
||||
|
||||
## begin gnulib module getdtablesize
|
||||
|
||||
|
||||
@@ -136,6 +179,15 @@ EXTRA_libgnu_a_SOURCES += getdtablesize.c
|
||||
|
||||
## end gnulib module getdtablesize
|
||||
|
||||
## begin gnulib module getline
|
||||
|
||||
|
||||
EXTRA_DIST += getline.c
|
||||
|
||||
EXTRA_libgnu_a_SOURCES += getline.c
|
||||
|
||||
## end gnulib module getline
|
||||
|
||||
## begin gnulib module gettime
|
||||
|
||||
libgnu_a_SOURCES += gettime.c
|
||||
@@ -187,6 +239,27 @@ EXTRA_libgnu_a_SOURCES += msvc-nothrow.c
|
||||
|
||||
## end gnulib module msvc-nothrow
|
||||
|
||||
## begin gnulib module realloc-posix
|
||||
|
||||
|
||||
EXTRA_DIST += realloc.c
|
||||
|
||||
EXTRA_libgnu_a_SOURCES += realloc.c
|
||||
|
||||
## end gnulib module realloc-posix
|
||||
|
||||
## begin gnulib module snippet/_Noreturn
|
||||
|
||||
# Because this Makefile snippet defines a variable used by other
|
||||
# gnulib Makefile snippets, it must be present in all Makefile.am that
|
||||
# need it. This is ensured by the applicability 'all' defined above.
|
||||
|
||||
_NORETURN_H=$(top_srcdir)/build-aux/snippet/_Noreturn.h
|
||||
|
||||
EXTRA_DIST += $(top_srcdir)/build-aux/snippet/_Noreturn.h
|
||||
|
||||
## end gnulib module snippet/_Noreturn
|
||||
|
||||
## begin gnulib module snippet/arg-nonnull
|
||||
|
||||
# The BUILT_SOURCES created by this Makefile snippet are not used via #include
|
||||
@@ -359,6 +432,237 @@ EXTRA_DIST += stdint.in.h
|
||||
|
||||
## end gnulib module stdint
|
||||
|
||||
## begin gnulib module stdio
|
||||
|
||||
BUILT_SOURCES += stdio.h
|
||||
|
||||
# We need the following in order to create <stdio.h> when the system
|
||||
# doesn't have one that works with the given compiler.
|
||||
stdio.h: stdio.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
|
||||
$(AM_V_GEN)rm -f $@-t $@ && \
|
||||
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
|
||||
sed -e 's|@''GUARD_PREFIX''@|GL|g' \
|
||||
-e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
|
||||
-e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
|
||||
-e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
|
||||
-e 's|@''NEXT_STDIO_H''@|$(NEXT_STDIO_H)|g' \
|
||||
-e 's/@''GNULIB_DPRINTF''@/$(GNULIB_DPRINTF)/g' \
|
||||
-e 's/@''GNULIB_FCLOSE''@/$(GNULIB_FCLOSE)/g' \
|
||||
-e 's/@''GNULIB_FDOPEN''@/$(GNULIB_FDOPEN)/g' \
|
||||
-e 's/@''GNULIB_FFLUSH''@/$(GNULIB_FFLUSH)/g' \
|
||||
-e 's/@''GNULIB_FGETC''@/$(GNULIB_FGETC)/g' \
|
||||
-e 's/@''GNULIB_FGETS''@/$(GNULIB_FGETS)/g' \
|
||||
-e 's/@''GNULIB_FOPEN''@/$(GNULIB_FOPEN)/g' \
|
||||
-e 's/@''GNULIB_FPRINTF''@/$(GNULIB_FPRINTF)/g' \
|
||||
-e 's/@''GNULIB_FPRINTF_POSIX''@/$(GNULIB_FPRINTF_POSIX)/g' \
|
||||
-e 's/@''GNULIB_FPURGE''@/$(GNULIB_FPURGE)/g' \
|
||||
-e 's/@''GNULIB_FPUTC''@/$(GNULIB_FPUTC)/g' \
|
||||
-e 's/@''GNULIB_FPUTS''@/$(GNULIB_FPUTS)/g' \
|
||||
-e 's/@''GNULIB_FREAD''@/$(GNULIB_FREAD)/g' \
|
||||
-e 's/@''GNULIB_FREOPEN''@/$(GNULIB_FREOPEN)/g' \
|
||||
-e 's/@''GNULIB_FSCANF''@/$(GNULIB_FSCANF)/g' \
|
||||
-e 's/@''GNULIB_FSEEK''@/$(GNULIB_FSEEK)/g' \
|
||||
-e 's/@''GNULIB_FSEEKO''@/$(GNULIB_FSEEKO)/g' \
|
||||
-e 's/@''GNULIB_FTELL''@/$(GNULIB_FTELL)/g' \
|
||||
-e 's/@''GNULIB_FTELLO''@/$(GNULIB_FTELLO)/g' \
|
||||
-e 's/@''GNULIB_FWRITE''@/$(GNULIB_FWRITE)/g' \
|
||||
-e 's/@''GNULIB_GETC''@/$(GNULIB_GETC)/g' \
|
||||
-e 's/@''GNULIB_GETCHAR''@/$(GNULIB_GETCHAR)/g' \
|
||||
-e 's/@''GNULIB_GETDELIM''@/$(GNULIB_GETDELIM)/g' \
|
||||
-e 's/@''GNULIB_GETLINE''@/$(GNULIB_GETLINE)/g' \
|
||||
-e 's/@''GNULIB_OBSTACK_PRINTF''@/$(GNULIB_OBSTACK_PRINTF)/g' \
|
||||
-e 's/@''GNULIB_OBSTACK_PRINTF_POSIX''@/$(GNULIB_OBSTACK_PRINTF_POSIX)/g' \
|
||||
-e 's/@''GNULIB_PCLOSE''@/$(GNULIB_PCLOSE)/g' \
|
||||
-e 's/@''GNULIB_PERROR''@/$(GNULIB_PERROR)/g' \
|
||||
-e 's/@''GNULIB_POPEN''@/$(GNULIB_POPEN)/g' \
|
||||
-e 's/@''GNULIB_PRINTF''@/$(GNULIB_PRINTF)/g' \
|
||||
-e 's/@''GNULIB_PRINTF_POSIX''@/$(GNULIB_PRINTF_POSIX)/g' \
|
||||
-e 's/@''GNULIB_PUTC''@/$(GNULIB_PUTC)/g' \
|
||||
-e 's/@''GNULIB_PUTCHAR''@/$(GNULIB_PUTCHAR)/g' \
|
||||
-e 's/@''GNULIB_PUTS''@/$(GNULIB_PUTS)/g' \
|
||||
-e 's/@''GNULIB_REMOVE''@/$(GNULIB_REMOVE)/g' \
|
||||
-e 's/@''GNULIB_RENAME''@/$(GNULIB_RENAME)/g' \
|
||||
-e 's/@''GNULIB_RENAMEAT''@/$(GNULIB_RENAMEAT)/g' \
|
||||
-e 's/@''GNULIB_SCANF''@/$(GNULIB_SCANF)/g' \
|
||||
-e 's/@''GNULIB_SNPRINTF''@/$(GNULIB_SNPRINTF)/g' \
|
||||
-e 's/@''GNULIB_SPRINTF_POSIX''@/$(GNULIB_SPRINTF_POSIX)/g' \
|
||||
-e 's/@''GNULIB_STDIO_H_NONBLOCKING''@/$(GNULIB_STDIO_H_NONBLOCKING)/g' \
|
||||
-e 's/@''GNULIB_STDIO_H_SIGPIPE''@/$(GNULIB_STDIO_H_SIGPIPE)/g' \
|
||||
-e 's/@''GNULIB_TMPFILE''@/$(GNULIB_TMPFILE)/g' \
|
||||
-e 's/@''GNULIB_VASPRINTF''@/$(GNULIB_VASPRINTF)/g' \
|
||||
-e 's/@''GNULIB_VDPRINTF''@/$(GNULIB_VDPRINTF)/g' \
|
||||
-e 's/@''GNULIB_VFPRINTF''@/$(GNULIB_VFPRINTF)/g' \
|
||||
-e 's/@''GNULIB_VFPRINTF_POSIX''@/$(GNULIB_VFPRINTF_POSIX)/g' \
|
||||
-e 's/@''GNULIB_VFSCANF''@/$(GNULIB_VFSCANF)/g' \
|
||||
-e 's/@''GNULIB_VSCANF''@/$(GNULIB_VSCANF)/g' \
|
||||
-e 's/@''GNULIB_VPRINTF''@/$(GNULIB_VPRINTF)/g' \
|
||||
-e 's/@''GNULIB_VPRINTF_POSIX''@/$(GNULIB_VPRINTF_POSIX)/g' \
|
||||
-e 's/@''GNULIB_VSNPRINTF''@/$(GNULIB_VSNPRINTF)/g' \
|
||||
-e 's/@''GNULIB_VSPRINTF_POSIX''@/$(GNULIB_VSPRINTF_POSIX)/g' \
|
||||
< $(srcdir)/stdio.in.h | \
|
||||
sed -e 's|@''HAVE_DECL_FPURGE''@|$(HAVE_DECL_FPURGE)|g' \
|
||||
-e 's|@''HAVE_DECL_FSEEKO''@|$(HAVE_DECL_FSEEKO)|g' \
|
||||
-e 's|@''HAVE_DECL_FTELLO''@|$(HAVE_DECL_FTELLO)|g' \
|
||||
-e 's|@''HAVE_DECL_GETDELIM''@|$(HAVE_DECL_GETDELIM)|g' \
|
||||
-e 's|@''HAVE_DECL_GETLINE''@|$(HAVE_DECL_GETLINE)|g' \
|
||||
-e 's|@''HAVE_DECL_OBSTACK_PRINTF''@|$(HAVE_DECL_OBSTACK_PRINTF)|g' \
|
||||
-e 's|@''HAVE_DECL_SNPRINTF''@|$(HAVE_DECL_SNPRINTF)|g' \
|
||||
-e 's|@''HAVE_DECL_VSNPRINTF''@|$(HAVE_DECL_VSNPRINTF)|g' \
|
||||
-e 's|@''HAVE_DPRINTF''@|$(HAVE_DPRINTF)|g' \
|
||||
-e 's|@''HAVE_FSEEKO''@|$(HAVE_FSEEKO)|g' \
|
||||
-e 's|@''HAVE_FTELLO''@|$(HAVE_FTELLO)|g' \
|
||||
-e 's|@''HAVE_PCLOSE''@|$(HAVE_PCLOSE)|g' \
|
||||
-e 's|@''HAVE_POPEN''@|$(HAVE_POPEN)|g' \
|
||||
-e 's|@''HAVE_RENAMEAT''@|$(HAVE_RENAMEAT)|g' \
|
||||
-e 's|@''HAVE_VASPRINTF''@|$(HAVE_VASPRINTF)|g' \
|
||||
-e 's|@''HAVE_VDPRINTF''@|$(HAVE_VDPRINTF)|g' \
|
||||
-e 's|@''REPLACE_DPRINTF''@|$(REPLACE_DPRINTF)|g' \
|
||||
-e 's|@''REPLACE_FCLOSE''@|$(REPLACE_FCLOSE)|g' \
|
||||
-e 's|@''REPLACE_FDOPEN''@|$(REPLACE_FDOPEN)|g' \
|
||||
-e 's|@''REPLACE_FFLUSH''@|$(REPLACE_FFLUSH)|g' \
|
||||
-e 's|@''REPLACE_FOPEN''@|$(REPLACE_FOPEN)|g' \
|
||||
-e 's|@''REPLACE_FPRINTF''@|$(REPLACE_FPRINTF)|g' \
|
||||
-e 's|@''REPLACE_FPURGE''@|$(REPLACE_FPURGE)|g' \
|
||||
-e 's|@''REPLACE_FREOPEN''@|$(REPLACE_FREOPEN)|g' \
|
||||
-e 's|@''REPLACE_FSEEK''@|$(REPLACE_FSEEK)|g' \
|
||||
-e 's|@''REPLACE_FSEEKO''@|$(REPLACE_FSEEKO)|g' \
|
||||
-e 's|@''REPLACE_FTELL''@|$(REPLACE_FTELL)|g' \
|
||||
-e 's|@''REPLACE_FTELLO''@|$(REPLACE_FTELLO)|g' \
|
||||
-e 's|@''REPLACE_GETDELIM''@|$(REPLACE_GETDELIM)|g' \
|
||||
-e 's|@''REPLACE_GETLINE''@|$(REPLACE_GETLINE)|g' \
|
||||
-e 's|@''REPLACE_OBSTACK_PRINTF''@|$(REPLACE_OBSTACK_PRINTF)|g' \
|
||||
-e 's|@''REPLACE_PERROR''@|$(REPLACE_PERROR)|g' \
|
||||
-e 's|@''REPLACE_POPEN''@|$(REPLACE_POPEN)|g' \
|
||||
-e 's|@''REPLACE_PRINTF''@|$(REPLACE_PRINTF)|g' \
|
||||
-e 's|@''REPLACE_REMOVE''@|$(REPLACE_REMOVE)|g' \
|
||||
-e 's|@''REPLACE_RENAME''@|$(REPLACE_RENAME)|g' \
|
||||
-e 's|@''REPLACE_RENAMEAT''@|$(REPLACE_RENAMEAT)|g' \
|
||||
-e 's|@''REPLACE_SNPRINTF''@|$(REPLACE_SNPRINTF)|g' \
|
||||
-e 's|@''REPLACE_SPRINTF''@|$(REPLACE_SPRINTF)|g' \
|
||||
-e 's|@''REPLACE_STDIO_READ_FUNCS''@|$(REPLACE_STDIO_READ_FUNCS)|g' \
|
||||
-e 's|@''REPLACE_STDIO_WRITE_FUNCS''@|$(REPLACE_STDIO_WRITE_FUNCS)|g' \
|
||||
-e 's|@''REPLACE_TMPFILE''@|$(REPLACE_TMPFILE)|g' \
|
||||
-e 's|@''REPLACE_VASPRINTF''@|$(REPLACE_VASPRINTF)|g' \
|
||||
-e 's|@''REPLACE_VDPRINTF''@|$(REPLACE_VDPRINTF)|g' \
|
||||
-e 's|@''REPLACE_VFPRINTF''@|$(REPLACE_VFPRINTF)|g' \
|
||||
-e 's|@''REPLACE_VPRINTF''@|$(REPLACE_VPRINTF)|g' \
|
||||
-e 's|@''REPLACE_VSNPRINTF''@|$(REPLACE_VSNPRINTF)|g' \
|
||||
-e 's|@''REPLACE_VSPRINTF''@|$(REPLACE_VSPRINTF)|g' \
|
||||
-e 's|@''ASM_SYMBOL_PREFIX''@|$(ASM_SYMBOL_PREFIX)|g' \
|
||||
-e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \
|
||||
-e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
|
||||
-e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)'; \
|
||||
} > $@-t && \
|
||||
mv $@-t $@
|
||||
MOSTLYCLEANFILES += stdio.h stdio.h-t
|
||||
|
||||
EXTRA_DIST += stdio.in.h
|
||||
|
||||
## end gnulib module stdio
|
||||
|
||||
## begin gnulib module stdlib
|
||||
|
||||
BUILT_SOURCES += stdlib.h
|
||||
|
||||
# We need the following in order to create <stdlib.h> when the system
|
||||
# doesn't have one that works with the given compiler.
|
||||
stdlib.h: stdlib.in.h $(top_builddir)/config.status $(CXXDEFS_H) \
|
||||
$(_NORETURN_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
|
||||
$(AM_V_GEN)rm -f $@-t $@ && \
|
||||
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
|
||||
sed -e 's|@''GUARD_PREFIX''@|GL|g' \
|
||||
-e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
|
||||
-e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
|
||||
-e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
|
||||
-e 's|@''NEXT_STDLIB_H''@|$(NEXT_STDLIB_H)|g' \
|
||||
-e 's/@''GNULIB__EXIT''@/$(GNULIB__EXIT)/g' \
|
||||
-e 's/@''GNULIB_ATOLL''@/$(GNULIB_ATOLL)/g' \
|
||||
-e 's/@''GNULIB_CALLOC_POSIX''@/$(GNULIB_CALLOC_POSIX)/g' \
|
||||
-e 's/@''GNULIB_CANONICALIZE_FILE_NAME''@/$(GNULIB_CANONICALIZE_FILE_NAME)/g' \
|
||||
-e 's/@''GNULIB_GETLOADAVG''@/$(GNULIB_GETLOADAVG)/g' \
|
||||
-e 's/@''GNULIB_GETSUBOPT''@/$(GNULIB_GETSUBOPT)/g' \
|
||||
-e 's/@''GNULIB_GRANTPT''@/$(GNULIB_GRANTPT)/g' \
|
||||
-e 's/@''GNULIB_MALLOC_POSIX''@/$(GNULIB_MALLOC_POSIX)/g' \
|
||||
-e 's/@''GNULIB_MBTOWC''@/$(GNULIB_MBTOWC)/g' \
|
||||
-e 's/@''GNULIB_MKDTEMP''@/$(GNULIB_MKDTEMP)/g' \
|
||||
-e 's/@''GNULIB_MKOSTEMP''@/$(GNULIB_MKOSTEMP)/g' \
|
||||
-e 's/@''GNULIB_MKOSTEMPS''@/$(GNULIB_MKOSTEMPS)/g' \
|
||||
-e 's/@''GNULIB_MKSTEMP''@/$(GNULIB_MKSTEMP)/g' \
|
||||
-e 's/@''GNULIB_MKSTEMPS''@/$(GNULIB_MKSTEMPS)/g' \
|
||||
-e 's/@''GNULIB_POSIX_OPENPT''@/$(GNULIB_POSIX_OPENPT)/g' \
|
||||
-e 's/@''GNULIB_PTSNAME''@/$(GNULIB_PTSNAME)/g' \
|
||||
-e 's/@''GNULIB_PTSNAME_R''@/$(GNULIB_PTSNAME_R)/g' \
|
||||
-e 's/@''GNULIB_PUTENV''@/$(GNULIB_PUTENV)/g' \
|
||||
-e 's/@''GNULIB_RANDOM''@/$(GNULIB_RANDOM)/g' \
|
||||
-e 's/@''GNULIB_RANDOM_R''@/$(GNULIB_RANDOM_R)/g' \
|
||||
-e 's/@''GNULIB_REALLOC_POSIX''@/$(GNULIB_REALLOC_POSIX)/g' \
|
||||
-e 's/@''GNULIB_REALPATH''@/$(GNULIB_REALPATH)/g' \
|
||||
-e 's/@''GNULIB_RPMATCH''@/$(GNULIB_RPMATCH)/g' \
|
||||
-e 's/@''GNULIB_SECURE_GETENV''@/$(GNULIB_SECURE_GETENV)/g' \
|
||||
-e 's/@''GNULIB_SETENV''@/$(GNULIB_SETENV)/g' \
|
||||
-e 's/@''GNULIB_STRTOD''@/$(GNULIB_STRTOD)/g' \
|
||||
-e 's/@''GNULIB_STRTOLL''@/$(GNULIB_STRTOLL)/g' \
|
||||
-e 's/@''GNULIB_STRTOULL''@/$(GNULIB_STRTOULL)/g' \
|
||||
-e 's/@''GNULIB_SYSTEM_POSIX''@/$(GNULIB_SYSTEM_POSIX)/g' \
|
||||
-e 's/@''GNULIB_UNLOCKPT''@/$(GNULIB_UNLOCKPT)/g' \
|
||||
-e 's/@''GNULIB_UNSETENV''@/$(GNULIB_UNSETENV)/g' \
|
||||
-e 's/@''GNULIB_WCTOMB''@/$(GNULIB_WCTOMB)/g' \
|
||||
< $(srcdir)/stdlib.in.h | \
|
||||
sed -e 's|@''HAVE__EXIT''@|$(HAVE__EXIT)|g' \
|
||||
-e 's|@''HAVE_ATOLL''@|$(HAVE_ATOLL)|g' \
|
||||
-e 's|@''HAVE_CANONICALIZE_FILE_NAME''@|$(HAVE_CANONICALIZE_FILE_NAME)|g' \
|
||||
-e 's|@''HAVE_DECL_GETLOADAVG''@|$(HAVE_DECL_GETLOADAVG)|g' \
|
||||
-e 's|@''HAVE_GETSUBOPT''@|$(HAVE_GETSUBOPT)|g' \
|
||||
-e 's|@''HAVE_GRANTPT''@|$(HAVE_GRANTPT)|g' \
|
||||
-e 's|@''HAVE_MKDTEMP''@|$(HAVE_MKDTEMP)|g' \
|
||||
-e 's|@''HAVE_MKOSTEMP''@|$(HAVE_MKOSTEMP)|g' \
|
||||
-e 's|@''HAVE_MKOSTEMPS''@|$(HAVE_MKOSTEMPS)|g' \
|
||||
-e 's|@''HAVE_MKSTEMP''@|$(HAVE_MKSTEMP)|g' \
|
||||
-e 's|@''HAVE_MKSTEMPS''@|$(HAVE_MKSTEMPS)|g' \
|
||||
-e 's|@''HAVE_POSIX_OPENPT''@|$(HAVE_POSIX_OPENPT)|g' \
|
||||
-e 's|@''HAVE_PTSNAME''@|$(HAVE_PTSNAME)|g' \
|
||||
-e 's|@''HAVE_PTSNAME_R''@|$(HAVE_PTSNAME_R)|g' \
|
||||
-e 's|@''HAVE_RANDOM''@|$(HAVE_RANDOM)|g' \
|
||||
-e 's|@''HAVE_RANDOM_H''@|$(HAVE_RANDOM_H)|g' \
|
||||
-e 's|@''HAVE_RANDOM_R''@|$(HAVE_RANDOM_R)|g' \
|
||||
-e 's|@''HAVE_REALPATH''@|$(HAVE_REALPATH)|g' \
|
||||
-e 's|@''HAVE_RPMATCH''@|$(HAVE_RPMATCH)|g' \
|
||||
-e 's|@''HAVE_SECURE_GETENV''@|$(HAVE_SECURE_GETENV)|g' \
|
||||
-e 's|@''HAVE_DECL_SETENV''@|$(HAVE_DECL_SETENV)|g' \
|
||||
-e 's|@''HAVE_STRTOD''@|$(HAVE_STRTOD)|g' \
|
||||
-e 's|@''HAVE_STRTOLL''@|$(HAVE_STRTOLL)|g' \
|
||||
-e 's|@''HAVE_STRTOULL''@|$(HAVE_STRTOULL)|g' \
|
||||
-e 's|@''HAVE_STRUCT_RANDOM_DATA''@|$(HAVE_STRUCT_RANDOM_DATA)|g' \
|
||||
-e 's|@''HAVE_SYS_LOADAVG_H''@|$(HAVE_SYS_LOADAVG_H)|g' \
|
||||
-e 's|@''HAVE_UNLOCKPT''@|$(HAVE_UNLOCKPT)|g' \
|
||||
-e 's|@''HAVE_DECL_UNSETENV''@|$(HAVE_DECL_UNSETENV)|g' \
|
||||
-e 's|@''REPLACE_CALLOC''@|$(REPLACE_CALLOC)|g' \
|
||||
-e 's|@''REPLACE_CANONICALIZE_FILE_NAME''@|$(REPLACE_CANONICALIZE_FILE_NAME)|g' \
|
||||
-e 's|@''REPLACE_MALLOC''@|$(REPLACE_MALLOC)|g' \
|
||||
-e 's|@''REPLACE_MBTOWC''@|$(REPLACE_MBTOWC)|g' \
|
||||
-e 's|@''REPLACE_MKSTEMP''@|$(REPLACE_MKSTEMP)|g' \
|
||||
-e 's|@''REPLACE_PTSNAME''@|$(REPLACE_PTSNAME)|g' \
|
||||
-e 's|@''REPLACE_PTSNAME_R''@|$(REPLACE_PTSNAME_R)|g' \
|
||||
-e 's|@''REPLACE_PUTENV''@|$(REPLACE_PUTENV)|g' \
|
||||
-e 's|@''REPLACE_RANDOM_R''@|$(REPLACE_RANDOM_R)|g' \
|
||||
-e 's|@''REPLACE_REALLOC''@|$(REPLACE_REALLOC)|g' \
|
||||
-e 's|@''REPLACE_REALPATH''@|$(REPLACE_REALPATH)|g' \
|
||||
-e 's|@''REPLACE_SETENV''@|$(REPLACE_SETENV)|g' \
|
||||
-e 's|@''REPLACE_STRTOD''@|$(REPLACE_STRTOD)|g' \
|
||||
-e 's|@''REPLACE_UNSETENV''@|$(REPLACE_UNSETENV)|g' \
|
||||
-e 's|@''REPLACE_WCTOMB''@|$(REPLACE_WCTOMB)|g' \
|
||||
-e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \
|
||||
-e '/definition of _Noreturn/r $(_NORETURN_H)' \
|
||||
-e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
|
||||
-e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)'; \
|
||||
} > $@-t && \
|
||||
mv $@-t $@
|
||||
MOSTLYCLEANFILES += stdlib.h stdlib.h-t
|
||||
|
||||
EXTRA_DIST += stdlib.in.h
|
||||
|
||||
## end gnulib module stdlib
|
||||
|
||||
## begin gnulib module string
|
||||
|
||||
BUILT_SOURCES += string.h
|
||||
|
||||
279
gl/errno.in.h
Normal file
279
gl/errno.in.h
Normal file
@@ -0,0 +1,279 @@
|
||||
/* A POSIX-like <errno.h>.
|
||||
|
||||
Copyright (C) 2008-2013 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 3, or (at your option)
|
||||
any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifndef _@GUARD_PREFIX@_ERRNO_H
|
||||
|
||||
#if __GNUC__ >= 3
|
||||
@PRAGMA_SYSTEM_HEADER@
|
||||
#endif
|
||||
@PRAGMA_COLUMNS@
|
||||
|
||||
/* The include_next requires a split double-inclusion guard. */
|
||||
#@INCLUDE_NEXT@ @NEXT_ERRNO_H@
|
||||
|
||||
#ifndef _@GUARD_PREFIX@_ERRNO_H
|
||||
#define _@GUARD_PREFIX@_ERRNO_H
|
||||
|
||||
|
||||
/* On native Windows platforms, many macros are not defined. */
|
||||
# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
|
||||
|
||||
/* These are the same values as defined by MSVC 10, for interoperability. */
|
||||
|
||||
# ifndef ENOMSG
|
||||
# define ENOMSG 122
|
||||
# define GNULIB_defined_ENOMSG 1
|
||||
# endif
|
||||
|
||||
# ifndef EIDRM
|
||||
# define EIDRM 111
|
||||
# define GNULIB_defined_EIDRM 1
|
||||
# endif
|
||||
|
||||
# ifndef ENOLINK
|
||||
# define ENOLINK 121
|
||||
# define GNULIB_defined_ENOLINK 1
|
||||
# endif
|
||||
|
||||
# ifndef EPROTO
|
||||
# define EPROTO 134
|
||||
# define GNULIB_defined_EPROTO 1
|
||||
# endif
|
||||
|
||||
# ifndef EBADMSG
|
||||
# define EBADMSG 104
|
||||
# define GNULIB_defined_EBADMSG 1
|
||||
# endif
|
||||
|
||||
# ifndef EOVERFLOW
|
||||
# define EOVERFLOW 132
|
||||
# define GNULIB_defined_EOVERFLOW 1
|
||||
# endif
|
||||
|
||||
# ifndef ENOTSUP
|
||||
# define ENOTSUP 129
|
||||
# define GNULIB_defined_ENOTSUP 1
|
||||
# endif
|
||||
|
||||
# ifndef ENETRESET
|
||||
# define ENETRESET 117
|
||||
# define GNULIB_defined_ENETRESET 1
|
||||
# endif
|
||||
|
||||
# ifndef ECONNABORTED
|
||||
# define ECONNABORTED 106
|
||||
# define GNULIB_defined_ECONNABORTED 1
|
||||
# endif
|
||||
|
||||
# ifndef ECANCELED
|
||||
# define ECANCELED 105
|
||||
# define GNULIB_defined_ECANCELED 1
|
||||
# endif
|
||||
|
||||
# ifndef EOWNERDEAD
|
||||
# define EOWNERDEAD 133
|
||||
# define GNULIB_defined_EOWNERDEAD 1
|
||||
# endif
|
||||
|
||||
# ifndef ENOTRECOVERABLE
|
||||
# define ENOTRECOVERABLE 127
|
||||
# define GNULIB_defined_ENOTRECOVERABLE 1
|
||||
# endif
|
||||
|
||||
# ifndef EINPROGRESS
|
||||
# define EINPROGRESS 112
|
||||
# define EALREADY 103
|
||||
# define ENOTSOCK 128
|
||||
# define EDESTADDRREQ 109
|
||||
# define EMSGSIZE 115
|
||||
# define EPROTOTYPE 136
|
||||
# define ENOPROTOOPT 123
|
||||
# define EPROTONOSUPPORT 135
|
||||
# define EOPNOTSUPP 130
|
||||
# define EAFNOSUPPORT 102
|
||||
# define EADDRINUSE 100
|
||||
# define EADDRNOTAVAIL 101
|
||||
# define ENETDOWN 116
|
||||
# define ENETUNREACH 118
|
||||
# define ECONNRESET 108
|
||||
# define ENOBUFS 119
|
||||
# define EISCONN 113
|
||||
# define ENOTCONN 126
|
||||
# define ETIMEDOUT 138
|
||||
# define ECONNREFUSED 107
|
||||
# define ELOOP 114
|
||||
# define EHOSTUNREACH 110
|
||||
# define EWOULDBLOCK 140
|
||||
# define GNULIB_defined_ESOCK 1
|
||||
# endif
|
||||
|
||||
# ifndef ETXTBSY
|
||||
# define ETXTBSY 139
|
||||
# define ENODATA 120 /* not required by POSIX */
|
||||
# define ENOSR 124 /* not required by POSIX */
|
||||
# define ENOSTR 125 /* not required by POSIX */
|
||||
# define ETIME 137 /* not required by POSIX */
|
||||
# define EOTHER 131 /* not required by POSIX */
|
||||
# define GNULIB_defined_ESTREAMS 1
|
||||
# endif
|
||||
|
||||
/* These are intentionally the same values as the WSA* error numbers, defined
|
||||
in <winsock2.h>. */
|
||||
# define ESOCKTNOSUPPORT 10044 /* not required by POSIX */
|
||||
# define EPFNOSUPPORT 10046 /* not required by POSIX */
|
||||
# define ESHUTDOWN 10058 /* not required by POSIX */
|
||||
# define ETOOMANYREFS 10059 /* not required by POSIX */
|
||||
# define EHOSTDOWN 10064 /* not required by POSIX */
|
||||
# define EPROCLIM 10067 /* not required by POSIX */
|
||||
# define EUSERS 10068 /* not required by POSIX */
|
||||
# define EDQUOT 10069
|
||||
# define ESTALE 10070
|
||||
# define EREMOTE 10071 /* not required by POSIX */
|
||||
# define GNULIB_defined_EWINSOCK 1
|
||||
|
||||
# endif
|
||||
|
||||
|
||||
/* On OSF/1 5.1, when _XOPEN_SOURCE_EXTENDED is not defined, the macros
|
||||
EMULTIHOP, ENOLINK, EOVERFLOW are not defined. */
|
||||
# if @EMULTIHOP_HIDDEN@
|
||||
# define EMULTIHOP @EMULTIHOP_VALUE@
|
||||
# define GNULIB_defined_EMULTIHOP 1
|
||||
# endif
|
||||
# if @ENOLINK_HIDDEN@
|
||||
# define ENOLINK @ENOLINK_VALUE@
|
||||
# define GNULIB_defined_ENOLINK 1
|
||||
# endif
|
||||
# if @EOVERFLOW_HIDDEN@
|
||||
# define EOVERFLOW @EOVERFLOW_VALUE@
|
||||
# define GNULIB_defined_EOVERFLOW 1
|
||||
# endif
|
||||
|
||||
|
||||
/* On OpenBSD 4.0 and on native Windows, the macros ENOMSG, EIDRM, ENOLINK,
|
||||
EPROTO, EMULTIHOP, EBADMSG, EOVERFLOW, ENOTSUP, ECANCELED are not defined.
|
||||
Likewise, on NonStop Kernel, EDQUOT is not defined.
|
||||
Define them here. Values >= 2000 seem safe to use: Solaris ESTALE = 151,
|
||||
HP-UX EWOULDBLOCK = 246, IRIX EDQUOT = 1133.
|
||||
|
||||
Note: When one of these systems defines some of these macros some day,
|
||||
binaries will have to be recompiled so that they recognizes the new
|
||||
errno values from the system. */
|
||||
|
||||
# ifndef ENOMSG
|
||||
# define ENOMSG 2000
|
||||
# define GNULIB_defined_ENOMSG 1
|
||||
# endif
|
||||
|
||||
# ifndef EIDRM
|
||||
# define EIDRM 2001
|
||||
# define GNULIB_defined_EIDRM 1
|
||||
# endif
|
||||
|
||||
# ifndef ENOLINK
|
||||
# define ENOLINK 2002
|
||||
# define GNULIB_defined_ENOLINK 1
|
||||
# endif
|
||||
|
||||
# ifndef EPROTO
|
||||
# define EPROTO 2003
|
||||
# define GNULIB_defined_EPROTO 1
|
||||
# endif
|
||||
|
||||
# ifndef EMULTIHOP
|
||||
# define EMULTIHOP 2004
|
||||
# define GNULIB_defined_EMULTIHOP 1
|
||||
# endif
|
||||
|
||||
# ifndef EBADMSG
|
||||
# define EBADMSG 2005
|
||||
# define GNULIB_defined_EBADMSG 1
|
||||
# endif
|
||||
|
||||
# ifndef EOVERFLOW
|
||||
# define EOVERFLOW 2006
|
||||
# define GNULIB_defined_EOVERFLOW 1
|
||||
# endif
|
||||
|
||||
# ifndef ENOTSUP
|
||||
# define ENOTSUP 2007
|
||||
# define GNULIB_defined_ENOTSUP 1
|
||||
# endif
|
||||
|
||||
# ifndef ENETRESET
|
||||
# define ENETRESET 2011
|
||||
# define GNULIB_defined_ENETRESET 1
|
||||
# endif
|
||||
|
||||
# ifndef ECONNABORTED
|
||||
# define ECONNABORTED 2012
|
||||
# define GNULIB_defined_ECONNABORTED 1
|
||||
# endif
|
||||
|
||||
# ifndef ESTALE
|
||||
# define ESTALE 2009
|
||||
# define GNULIB_defined_ESTALE 1
|
||||
# endif
|
||||
|
||||
# ifndef EDQUOT
|
||||
# define EDQUOT 2010
|
||||
# define GNULIB_defined_EDQUOT 1
|
||||
# endif
|
||||
|
||||
# ifndef ECANCELED
|
||||
# define ECANCELED 2008
|
||||
# define GNULIB_defined_ECANCELED 1
|
||||
# endif
|
||||
|
||||
/* On many platforms, the macros EOWNERDEAD and ENOTRECOVERABLE are not
|
||||
defined. */
|
||||
|
||||
# ifndef EOWNERDEAD
|
||||
# if defined __sun
|
||||
/* Use the same values as defined for Solaris >= 8, for
|
||||
interoperability. */
|
||||
# define EOWNERDEAD 58
|
||||
# define ENOTRECOVERABLE 59
|
||||
# elif (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
|
||||
/* We have a conflict here: pthreads-win32 defines these values
|
||||
differently than MSVC 10. It's hairy to decide which one to use. */
|
||||
# if defined __MINGW32__ && !defined USE_WINDOWS_THREADS
|
||||
/* Use the same values as defined by pthreads-win32, for
|
||||
interoperability. */
|
||||
# define EOWNERDEAD 43
|
||||
# define ENOTRECOVERABLE 44
|
||||
# else
|
||||
/* Use the same values as defined by MSVC 10, for
|
||||
interoperability. */
|
||||
# define EOWNERDEAD 133
|
||||
# define ENOTRECOVERABLE 127
|
||||
# endif
|
||||
# else
|
||||
# define EOWNERDEAD 2013
|
||||
# define ENOTRECOVERABLE 2014
|
||||
# endif
|
||||
# define GNULIB_defined_EOWNERDEAD 1
|
||||
# define GNULIB_defined_ENOTRECOVERABLE 1
|
||||
# endif
|
||||
|
||||
# ifndef EILSEQ
|
||||
# define EILSEQ 2015
|
||||
# define GNULIB_defined_EILSEQ 1
|
||||
# endif
|
||||
|
||||
#endif /* _@GUARD_PREFIX@_ERRNO_H */
|
||||
#endif /* _@GUARD_PREFIX@_ERRNO_H */
|
||||
135
gl/getdelim.c
Normal file
135
gl/getdelim.c
Normal file
@@ -0,0 +1,135 @@
|
||||
/* getdelim.c --- Implementation of replacement getdelim function.
|
||||
Copyright (C) 1994, 1996-1998, 2001, 2003, 2005-2013 Free Software
|
||||
Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation; either version 3, or (at
|
||||
your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
/* Ported from glibc by Simon Josefsson. */
|
||||
|
||||
/* Don't use __attribute__ __nonnull__ in this compilation unit. Otherwise gcc
|
||||
optimizes away the lineptr == NULL || n == NULL || fp == NULL tests below. */
|
||||
#define _GL_ARG_NONNULL(params)
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include <limits.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include <errno.h>
|
||||
|
||||
#ifndef SSIZE_MAX
|
||||
# define SSIZE_MAX ((ssize_t) (SIZE_MAX / 2))
|
||||
#endif
|
||||
|
||||
#if USE_UNLOCKED_IO
|
||||
# include "unlocked-io.h"
|
||||
# define getc_maybe_unlocked(fp) getc(fp)
|
||||
#elif !HAVE_FLOCKFILE || !HAVE_FUNLOCKFILE || !HAVE_DECL_GETC_UNLOCKED
|
||||
# undef flockfile
|
||||
# undef funlockfile
|
||||
# define flockfile(x) ((void) 0)
|
||||
# define funlockfile(x) ((void) 0)
|
||||
# define getc_maybe_unlocked(fp) getc(fp)
|
||||
#else
|
||||
# define getc_maybe_unlocked(fp) getc_unlocked(fp)
|
||||
#endif
|
||||
|
||||
/* Read up to (and including) a DELIMITER from FP into *LINEPTR (and
|
||||
NUL-terminate it). *LINEPTR is a pointer returned from malloc (or
|
||||
NULL), pointing to *N characters of space. It is realloc'ed as
|
||||
necessary. Returns the number of characters read (not including
|
||||
the null terminator), or -1 on error or EOF. */
|
||||
|
||||
ssize_t
|
||||
getdelim (char **lineptr, size_t *n, int delimiter, FILE *fp)
|
||||
{
|
||||
ssize_t result;
|
||||
size_t cur_len = 0;
|
||||
|
||||
if (lineptr == NULL || n == NULL || fp == NULL)
|
||||
{
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
flockfile (fp);
|
||||
|
||||
if (*lineptr == NULL || *n == 0)
|
||||
{
|
||||
char *new_lineptr;
|
||||
*n = 120;
|
||||
new_lineptr = (char *) realloc (*lineptr, *n);
|
||||
if (new_lineptr == NULL)
|
||||
{
|
||||
result = -1;
|
||||
goto unlock_return;
|
||||
}
|
||||
*lineptr = new_lineptr;
|
||||
}
|
||||
|
||||
for (;;)
|
||||
{
|
||||
int i;
|
||||
|
||||
i = getc_maybe_unlocked (fp);
|
||||
if (i == EOF)
|
||||
{
|
||||
result = -1;
|
||||
break;
|
||||
}
|
||||
|
||||
/* Make enough space for len+1 (for final NUL) bytes. */
|
||||
if (cur_len + 1 >= *n)
|
||||
{
|
||||
size_t needed_max =
|
||||
SSIZE_MAX < SIZE_MAX ? (size_t) SSIZE_MAX + 1 : SIZE_MAX;
|
||||
size_t needed = 2 * *n + 1; /* Be generous. */
|
||||
char *new_lineptr;
|
||||
|
||||
if (needed_max < needed)
|
||||
needed = needed_max;
|
||||
if (cur_len + 1 >= needed)
|
||||
{
|
||||
result = -1;
|
||||
errno = EOVERFLOW;
|
||||
goto unlock_return;
|
||||
}
|
||||
|
||||
new_lineptr = (char *) realloc (*lineptr, needed);
|
||||
if (new_lineptr == NULL)
|
||||
{
|
||||
result = -1;
|
||||
goto unlock_return;
|
||||
}
|
||||
|
||||
*lineptr = new_lineptr;
|
||||
*n = needed;
|
||||
}
|
||||
|
||||
(*lineptr)[cur_len] = i;
|
||||
cur_len++;
|
||||
|
||||
if (i == delimiter)
|
||||
break;
|
||||
}
|
||||
(*lineptr)[cur_len] = '\0';
|
||||
result = cur_len ? cur_len : result;
|
||||
|
||||
unlock_return:
|
||||
funlockfile (fp); /* doesn't set errno */
|
||||
|
||||
return result;
|
||||
}
|
||||
27
gl/getline.c
Normal file
27
gl/getline.c
Normal file
@@ -0,0 +1,27 @@
|
||||
/* getline.c --- Implementation of replacement getline function.
|
||||
Copyright (C) 2005-2007, 2009-2013 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation; either version 3, or (at
|
||||
your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
/* Written by Simon Josefsson. */
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
ssize_t
|
||||
getline (char **lineptr, size_t *n, FILE *stream)
|
||||
{
|
||||
return getdelim (lineptr, n, '\n', stream);
|
||||
}
|
||||
137
gl/m4/errno_h.m4
Normal file
137
gl/m4/errno_h.m4
Normal file
@@ -0,0 +1,137 @@
|
||||
# errno_h.m4 serial 12
|
||||
dnl Copyright (C) 2004, 2006, 2008-2013 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_ONCE([gl_HEADER_ERRNO_H],
|
||||
[
|
||||
AC_REQUIRE([AC_PROG_CC])
|
||||
AC_CACHE_CHECK([for complete errno.h], [gl_cv_header_errno_h_complete], [
|
||||
AC_EGREP_CPP([booboo],[
|
||||
#include <errno.h>
|
||||
#if !defined ETXTBSY
|
||||
booboo
|
||||
#endif
|
||||
#if !defined ENOMSG
|
||||
booboo
|
||||
#endif
|
||||
#if !defined EIDRM
|
||||
booboo
|
||||
#endif
|
||||
#if !defined ENOLINK
|
||||
booboo
|
||||
#endif
|
||||
#if !defined EPROTO
|
||||
booboo
|
||||
#endif
|
||||
#if !defined EMULTIHOP
|
||||
booboo
|
||||
#endif
|
||||
#if !defined EBADMSG
|
||||
booboo
|
||||
#endif
|
||||
#if !defined EOVERFLOW
|
||||
booboo
|
||||
#endif
|
||||
#if !defined ENOTSUP
|
||||
booboo
|
||||
#endif
|
||||
#if !defined ENETRESET
|
||||
booboo
|
||||
#endif
|
||||
#if !defined ECONNABORTED
|
||||
booboo
|
||||
#endif
|
||||
#if !defined ESTALE
|
||||
booboo
|
||||
#endif
|
||||
#if !defined EDQUOT
|
||||
booboo
|
||||
#endif
|
||||
#if !defined ECANCELED
|
||||
booboo
|
||||
#endif
|
||||
#if !defined EOWNERDEAD
|
||||
booboo
|
||||
#endif
|
||||
#if !defined ENOTRECOVERABLE
|
||||
booboo
|
||||
#endif
|
||||
#if !defined EILSEQ
|
||||
booboo
|
||||
#endif
|
||||
],
|
||||
[gl_cv_header_errno_h_complete=no],
|
||||
[gl_cv_header_errno_h_complete=yes])
|
||||
])
|
||||
if test $gl_cv_header_errno_h_complete = yes; then
|
||||
ERRNO_H=''
|
||||
else
|
||||
gl_NEXT_HEADERS([errno.h])
|
||||
ERRNO_H='errno.h'
|
||||
fi
|
||||
AC_SUBST([ERRNO_H])
|
||||
AM_CONDITIONAL([GL_GENERATE_ERRNO_H], [test -n "$ERRNO_H"])
|
||||
gl_REPLACE_ERRNO_VALUE([EMULTIHOP])
|
||||
gl_REPLACE_ERRNO_VALUE([ENOLINK])
|
||||
gl_REPLACE_ERRNO_VALUE([EOVERFLOW])
|
||||
])
|
||||
|
||||
# Assuming $1 = EOVERFLOW.
|
||||
# The EOVERFLOW errno value ought to be defined in <errno.h>, according to
|
||||
# POSIX. But some systems (like OpenBSD 4.0 or AIX 3) don't define it, and
|
||||
# some systems (like OSF/1) define it when _XOPEN_SOURCE_EXTENDED is defined.
|
||||
# Check for the value of EOVERFLOW.
|
||||
# Set the variables EOVERFLOW_HIDDEN and EOVERFLOW_VALUE.
|
||||
AC_DEFUN([gl_REPLACE_ERRNO_VALUE],
|
||||
[
|
||||
if test -n "$ERRNO_H"; then
|
||||
AC_CACHE_CHECK([for ]$1[ value], [gl_cv_header_errno_h_]$1, [
|
||||
AC_EGREP_CPP([yes],[
|
||||
#include <errno.h>
|
||||
#ifdef ]$1[
|
||||
yes
|
||||
#endif
|
||||
],
|
||||
[gl_cv_header_errno_h_]$1[=yes],
|
||||
[gl_cv_header_errno_h_]$1[=no])
|
||||
if test $gl_cv_header_errno_h_]$1[ = no; then
|
||||
AC_EGREP_CPP([yes],[
|
||||
#define _XOPEN_SOURCE_EXTENDED 1
|
||||
#include <errno.h>
|
||||
#ifdef ]$1[
|
||||
yes
|
||||
#endif
|
||||
], [gl_cv_header_errno_h_]$1[=hidden])
|
||||
if test $gl_cv_header_errno_h_]$1[ = hidden; then
|
||||
dnl The macro exists but is hidden.
|
||||
dnl Define it to the same value.
|
||||
AC_COMPUTE_INT([gl_cv_header_errno_h_]$1, $1, [
|
||||
#define _XOPEN_SOURCE_EXTENDED 1
|
||||
#include <errno.h>
|
||||
/* The following two lines are a workaround against an autoconf-2.52 bug. */
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
])
|
||||
fi
|
||||
fi
|
||||
])
|
||||
case $gl_cv_header_errno_h_]$1[ in
|
||||
yes | no)
|
||||
]$1[_HIDDEN=0; ]$1[_VALUE=
|
||||
;;
|
||||
*)
|
||||
]$1[_HIDDEN=1; ]$1[_VALUE="$gl_cv_header_errno_h_]$1["
|
||||
;;
|
||||
esac
|
||||
AC_SUBST($1[_HIDDEN])
|
||||
AC_SUBST($1[_VALUE])
|
||||
fi
|
||||
])
|
||||
|
||||
dnl Autoconf >= 2.61 has AC_COMPUTE_INT built-in.
|
||||
dnl Remove this when we can assume autoconf >= 2.61.
|
||||
m4_ifdef([AC_COMPUTE_INT], [], [
|
||||
AC_DEFUN([AC_COMPUTE_INT], [_AC_COMPUTE_INT([$2],[$1],[$3],[$4])])
|
||||
])
|
||||
@@ -1,4 +1,4 @@
|
||||
# serial 12 -*- Autoconf -*-
|
||||
# serial 13 -*- Autoconf -*-
|
||||
# Enable extensions on systems that normally disable them.
|
||||
|
||||
# Copyright (C) 2003, 2006-2013 Free Software Foundation, Inc.
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
# This definition of AC_USE_SYSTEM_EXTENSIONS is stolen from CVS
|
||||
# Autoconf. Perhaps we can remove this once we can assume Autoconf
|
||||
# 2.62 or later everywhere, but since CVS Autoconf mutates rapidly
|
||||
# 2.70 or later everywhere, but since Autoconf mutates rapidly
|
||||
# enough in this area it's likely we'll need to redefine
|
||||
# AC_USE_SYSTEM_EXTENSIONS for quite some time.
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
# ------------------------
|
||||
# Enable extensions on systems that normally disable them,
|
||||
# typically due to standards-conformance issues.
|
||||
#
|
||||
# Remember that #undef in AH_VERBATIM gets replaced with #define by
|
||||
# AC_DEFINE. The goal here is to define all known feature-enabling
|
||||
# macros, then, if reports of conflicts are made, disable macros that
|
||||
@@ -38,8 +39,6 @@ AC_DEFUN_ONCE([AC_USE_SYSTEM_EXTENSIONS],
|
||||
[AC_BEFORE([$0], [AC_COMPILE_IFELSE])dnl
|
||||
AC_BEFORE([$0], [AC_RUN_IFELSE])dnl
|
||||
|
||||
AC_REQUIRE([AC_CANONICAL_HOST])
|
||||
|
||||
AC_CHECK_HEADER([minix/config.h], [MINIX=yes], [MINIX=])
|
||||
if test "$MINIX" = yes; then
|
||||
AC_DEFINE([_POSIX_SOURCE], [1],
|
||||
@@ -50,24 +49,18 @@ AC_BEFORE([$0], [AC_RUN_IFELSE])dnl
|
||||
except with this defined.])
|
||||
AC_DEFINE([_MINIX], [1],
|
||||
[Define to 1 if on MINIX.])
|
||||
AC_DEFINE([_NETBSD_SOURCE], [1],
|
||||
[Define to 1 to make NetBSD features available. MINIX 3 needs this.])
|
||||
fi
|
||||
|
||||
dnl HP-UX 11.11 defines mbstate_t only if _XOPEN_SOURCE is defined to 500,
|
||||
dnl regardless of whether the flags -Ae or _D_HPUX_SOURCE=1 are already
|
||||
dnl provided.
|
||||
case "$host_os" in
|
||||
hpux*)
|
||||
AC_DEFINE([_XOPEN_SOURCE], [500],
|
||||
[Define to 500 only on HP-UX.])
|
||||
;;
|
||||
esac
|
||||
|
||||
AH_VERBATIM([__EXTENSIONS__],
|
||||
dnl Use a different key than __EXTENSIONS__, as that name broke existing
|
||||
dnl configure.ac when using autoheader 2.62.
|
||||
AH_VERBATIM([USE_SYSTEM_EXTENSIONS],
|
||||
[/* Enable extensions on AIX 3, Interix. */
|
||||
#ifndef _ALL_SOURCE
|
||||
# undef _ALL_SOURCE
|
||||
#endif
|
||||
/* Enable general extensions on Mac OS X. */
|
||||
/* Enable general extensions on OS X. */
|
||||
#ifndef _DARWIN_C_SOURCE
|
||||
# undef _DARWIN_C_SOURCE
|
||||
#endif
|
||||
@@ -83,6 +76,12 @@ AC_BEFORE([$0], [AC_RUN_IFELSE])dnl
|
||||
#ifndef _TANDEM_SOURCE
|
||||
# undef _TANDEM_SOURCE
|
||||
#endif
|
||||
/* Enable X/Open extensions if necessary. HP-UX 11.11 defines
|
||||
mbstate_t only if _XOPEN_SOURCE is defined to 500, regardless of
|
||||
whether compiling with -Ae or -D_HPUX_SOURCE=1. */
|
||||
#ifndef _XOPEN_SOURCE
|
||||
# undef _XOPEN_SOURCE
|
||||
#endif
|
||||
/* Enable general extensions on Solaris. */
|
||||
#ifndef __EXTENSIONS__
|
||||
# undef __EXTENSIONS__
|
||||
@@ -103,6 +102,22 @@ AC_BEFORE([$0], [AC_RUN_IFELSE])dnl
|
||||
AC_DEFINE([_GNU_SOURCE])
|
||||
AC_DEFINE([_POSIX_PTHREAD_SEMANTICS])
|
||||
AC_DEFINE([_TANDEM_SOURCE])
|
||||
AC_CACHE_CHECK([whether _XOPEN_SOURCE should be defined],
|
||||
[ac_cv_should_define__xopen_source],
|
||||
[ac_cv_should_define__xopen_source=no
|
||||
AC_COMPILE_IFELSE(
|
||||
[AC_LANG_PROGRAM([[
|
||||
#include <wchar.h>
|
||||
mbstate_t x;]])],
|
||||
[],
|
||||
[AC_COMPILE_IFELSE(
|
||||
[AC_LANG_PROGRAM([[
|
||||
#define _XOPEN_SOURCE 500
|
||||
#include <wchar.h>
|
||||
mbstate_t x;]])],
|
||||
[ac_cv_should_define__xopen_source=yes])])])
|
||||
test $ac_cv_should_define__xopen_source = yes &&
|
||||
AC_DEFINE([_XOPEN_SOURCE], [500])
|
||||
])# AC_USE_SYSTEM_EXTENSIONS
|
||||
|
||||
# gl_USE_SYSTEM_EXTENSIONS
|
||||
|
||||
@@ -18,13 +18,16 @@ AC_DEFUN([gl_EXTERN_INLINE],
|
||||
_GL_INLINE_HEADER_END contains useful stuff to put
|
||||
in the same include file, after uses of _GL_INLINE.
|
||||
|
||||
Suppress extern inline with HP-UX cc, as it appears to be broken; see
|
||||
<http://lists.gnu.org/archive/html/bug-texinfo/2013-02/msg00030.html>.
|
||||
|
||||
Suppress the use of extern inline on Apple's platforms,
|
||||
as Libc-825.25 (2012-09-19) is incompatible with it; see
|
||||
<http://lists.gnu.org/archive/html/bug-gnulib/2012-12/msg00023.html>.
|
||||
Perhaps Apple will fix this some day. */
|
||||
#if ((__GNUC__ \
|
||||
? defined __GNUC_STDC_INLINE__ && __GNUC_STDC_INLINE__ \
|
||||
: 199901L <= __STDC_VERSION__) \
|
||||
: 199901L <= __STDC_VERSION__ && !defined __HP_cc) \
|
||||
&& !defined __APPLE__)
|
||||
# define _GL_INLINE inline
|
||||
# define _GL_EXTERN_INLINE extern inline
|
||||
|
||||
88
gl/m4/getdelim.m4
Normal file
88
gl/m4/getdelim.m4
Normal file
@@ -0,0 +1,88 @@
|
||||
# getdelim.m4 serial 10
|
||||
|
||||
dnl Copyright (C) 2005-2007, 2009-2013 Free Software Foundation, Inc.
|
||||
dnl
|
||||
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_PREREQ([2.59])
|
||||
|
||||
AC_DEFUN([gl_FUNC_GETDELIM],
|
||||
[
|
||||
AC_REQUIRE([gl_STDIO_H_DEFAULTS])
|
||||
|
||||
dnl Persuade glibc <stdio.h> to declare getdelim().
|
||||
AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
|
||||
|
||||
AC_CHECK_DECLS_ONCE([getdelim])
|
||||
|
||||
AC_CHECK_FUNCS_ONCE([getdelim])
|
||||
if test $ac_cv_func_getdelim = yes; then
|
||||
HAVE_GETDELIM=1
|
||||
dnl Found it in some library. Verify that it works.
|
||||
AC_CACHE_CHECK([for working getdelim function], [gl_cv_func_working_getdelim],
|
||||
[echo fooNbarN | tr -d '\012' | tr N '\012' > conftest.data
|
||||
AC_RUN_IFELSE([AC_LANG_SOURCE([[
|
||||
# include <stdio.h>
|
||||
# include <stdlib.h>
|
||||
# include <string.h>
|
||||
int main ()
|
||||
{
|
||||
FILE *in = fopen ("./conftest.data", "r");
|
||||
if (!in)
|
||||
return 1;
|
||||
{
|
||||
/* Test result for a NULL buffer and a zero size.
|
||||
Based on a test program from Karl Heuer. */
|
||||
char *line = NULL;
|
||||
size_t siz = 0;
|
||||
int len = getdelim (&line, &siz, '\n', in);
|
||||
if (!(len == 4 && line && strcmp (line, "foo\n") == 0))
|
||||
return 2;
|
||||
}
|
||||
{
|
||||
/* Test result for a NULL buffer and a non-zero size.
|
||||
This crashes on FreeBSD 8.0. */
|
||||
char *line = NULL;
|
||||
size_t siz = (size_t)(~0) / 4;
|
||||
if (getdelim (&line, &siz, '\n', in) == -1)
|
||||
return 3;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
]])], [gl_cv_func_working_getdelim=yes] dnl The library version works.
|
||||
, [gl_cv_func_working_getdelim=no] dnl The library version does NOT work.
|
||||
, 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) && !defined __UCLIBC__
|
||||
Lucky GNU user
|
||||
#endif
|
||||
#endif
|
||||
],
|
||||
[gl_cv_func_working_getdelim="guessing yes"],
|
||||
[gl_cv_func_working_getdelim="guessing no"])]
|
||||
)])
|
||||
case "$gl_cv_func_working_getdelim" in
|
||||
*no)
|
||||
REPLACE_GETDELIM=1
|
||||
;;
|
||||
esac
|
||||
else
|
||||
HAVE_GETDELIM=0
|
||||
fi
|
||||
|
||||
if test $ac_cv_have_decl_getdelim = no; then
|
||||
HAVE_DECL_GETDELIM=0
|
||||
fi
|
||||
])
|
||||
|
||||
# Prerequisites of lib/getdelim.c.
|
||||
AC_DEFUN([gl_PREREQ_GETDELIM],
|
||||
[
|
||||
AC_CHECK_FUNCS([flockfile funlockfile])
|
||||
AC_CHECK_DECLS([getc_unlocked])
|
||||
])
|
||||
96
gl/m4/getline.m4
Normal file
96
gl/m4/getline.m4
Normal file
@@ -0,0 +1,96 @@
|
||||
# getline.m4 serial 26
|
||||
|
||||
dnl Copyright (C) 1998-2003, 2005-2007, 2009-2013 Free Software Foundation,
|
||||
dnl Inc.
|
||||
dnl
|
||||
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_PREREQ([2.59])
|
||||
|
||||
dnl See if there's a working, system-supplied version of the getline function.
|
||||
dnl We can't just do AC_REPLACE_FUNCS([getline]) because some systems
|
||||
dnl have a function by that name in -linet that doesn't have anything
|
||||
dnl to do with the function we need.
|
||||
AC_DEFUN([gl_FUNC_GETLINE],
|
||||
[
|
||||
AC_REQUIRE([gl_STDIO_H_DEFAULTS])
|
||||
|
||||
dnl Persuade glibc <stdio.h> to declare getline().
|
||||
AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
|
||||
|
||||
AC_CHECK_DECLS_ONCE([getline])
|
||||
|
||||
gl_getline_needs_run_time_check=no
|
||||
AC_CHECK_FUNC([getline],
|
||||
[dnl Found it in some library. Verify that it works.
|
||||
gl_getline_needs_run_time_check=yes],
|
||||
[am_cv_func_working_getline=no])
|
||||
if test $gl_getline_needs_run_time_check = yes; then
|
||||
AC_CACHE_CHECK([for working getline function], [am_cv_func_working_getline],
|
||||
[echo fooNbarN | tr -d '\012' | tr N '\012' > conftest.data
|
||||
AC_RUN_IFELSE([AC_LANG_SOURCE([[
|
||||
# include <stdio.h>
|
||||
# include <stdlib.h>
|
||||
# include <string.h>
|
||||
int main ()
|
||||
{
|
||||
FILE *in = fopen ("./conftest.data", "r");
|
||||
if (!in)
|
||||
return 1;
|
||||
{
|
||||
/* Test result for a NULL buffer and a zero size.
|
||||
Based on a test program from Karl Heuer. */
|
||||
char *line = NULL;
|
||||
size_t siz = 0;
|
||||
int len = getline (&line, &siz, in);
|
||||
if (!(len == 4 && line && strcmp (line, "foo\n") == 0))
|
||||
return 2;
|
||||
}
|
||||
{
|
||||
/* Test result for a NULL buffer and a non-zero size.
|
||||
This crashes on FreeBSD 8.0. */
|
||||
char *line = NULL;
|
||||
size_t siz = (size_t)(~0) / 4;
|
||||
if (getline (&line, &siz, in) == -1)
|
||||
return 3;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
]])], [am_cv_func_working_getline=yes] dnl The library version works.
|
||||
, [am_cv_func_working_getline=no] dnl The library version does NOT work.
|
||||
, 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) && !defined __UCLIBC__
|
||||
Lucky GNU user
|
||||
#endif
|
||||
#endif
|
||||
],
|
||||
[am_cv_func_working_getline="guessing yes"],
|
||||
[am_cv_func_working_getline="guessing no"])]
|
||||
)])
|
||||
fi
|
||||
|
||||
if test $ac_cv_have_decl_getline = no; then
|
||||
HAVE_DECL_GETLINE=0
|
||||
fi
|
||||
|
||||
case "$am_cv_func_working_getline" in
|
||||
*no)
|
||||
dnl Set REPLACE_GETLINE always: Even if we have not found the broken
|
||||
dnl getline function among $LIBS, it may exist in libinet and the
|
||||
dnl executable may be linked with -linet.
|
||||
REPLACE_GETLINE=1
|
||||
;;
|
||||
esac
|
||||
])
|
||||
|
||||
# Prerequisites of lib/getline.c.
|
||||
AC_DEFUN([gl_PREREQ_GETLINE],
|
||||
[
|
||||
:
|
||||
])
|
||||
@@ -27,12 +27,13 @@
|
||||
|
||||
|
||||
# Specification in the form of a command-line invocation:
|
||||
# gnulib-tool --import --dir=. --lib=libgnu --source-base=gl --m4-base=gl/m4 --doc-base=doc --tests-base=gl/tests --aux-dir=build-aux --no-conditional-dependencies --no-libtool --macro-prefix=gl cloexec gettime memmem
|
||||
# gnulib-tool --import --dir=. --lib=libgnu --source-base=gl --m4-base=gl/m4 --doc-base=doc --tests-base=gl/tests --aux-dir=build-aux --no-conditional-dependencies --no-libtool --macro-prefix=gl cloexec getline gettime memmem
|
||||
|
||||
# Specification in the form of a few gnulib-tool.m4 macro invocations:
|
||||
gl_LOCAL_DIR([])
|
||||
gl_MODULES([
|
||||
cloexec
|
||||
getline
|
||||
gettime
|
||||
memmem
|
||||
])
|
||||
|
||||
@@ -42,13 +42,16 @@ AC_DEFUN([gl_EARLY],
|
||||
# Code from module cloexec:
|
||||
# Code from module close:
|
||||
# Code from module dup2:
|
||||
# Code from module errno:
|
||||
# Code from module extensions:
|
||||
AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
|
||||
# Code from module extern-inline:
|
||||
# Code from module fcntl:
|
||||
# Code from module fcntl-h:
|
||||
# Code from module fd-hook:
|
||||
# Code from module getdelim:
|
||||
# Code from module getdtablesize:
|
||||
# Code from module getline:
|
||||
# Code from module gettime:
|
||||
# Code from module gettimeofday:
|
||||
# Code from module include_next:
|
||||
@@ -58,6 +61,8 @@ AC_DEFUN([gl_EARLY],
|
||||
# Code from module msvc-inval:
|
||||
# Code from module msvc-nothrow:
|
||||
# Code from module multiarch:
|
||||
# Code from module realloc-posix:
|
||||
# Code from module snippet/_Noreturn:
|
||||
# Code from module snippet/arg-nonnull:
|
||||
# Code from module snippet/c++defs:
|
||||
# Code from module snippet/warn-on-use:
|
||||
@@ -65,6 +70,8 @@ AC_DEFUN([gl_EARLY],
|
||||
# Code from module stdbool:
|
||||
# Code from module stddef:
|
||||
# Code from module stdint:
|
||||
# Code from module stdio:
|
||||
# Code from module stdlib:
|
||||
# Code from module string:
|
||||
# Code from module sys_time:
|
||||
# Code from module sys_types:
|
||||
@@ -102,6 +109,7 @@ AC_DEFUN([gl_INIT],
|
||||
gl_PREREQ_DUP2
|
||||
fi
|
||||
gl_UNISTD_MODULE_INDICATOR([dup2])
|
||||
gl_HEADER_ERRNO_H
|
||||
AC_REQUIRE([gl_EXTERN_INLINE])
|
||||
gl_FUNC_FCNTL
|
||||
if test $HAVE_FCNTL = 0 || test $REPLACE_FCNTL = 1; then
|
||||
@@ -109,12 +117,24 @@ AC_DEFUN([gl_INIT],
|
||||
fi
|
||||
gl_FCNTL_MODULE_INDICATOR([fcntl])
|
||||
gl_FCNTL_H
|
||||
gl_FUNC_GETDELIM
|
||||
if test $HAVE_GETDELIM = 0 || test $REPLACE_GETDELIM = 1; then
|
||||
AC_LIBOBJ([getdelim])
|
||||
gl_PREREQ_GETDELIM
|
||||
fi
|
||||
gl_STDIO_MODULE_INDICATOR([getdelim])
|
||||
gl_FUNC_GETDTABLESIZE
|
||||
if test $HAVE_GETDTABLESIZE = 0; then
|
||||
AC_LIBOBJ([getdtablesize])
|
||||
gl_PREREQ_GETDTABLESIZE
|
||||
fi
|
||||
gl_UNISTD_MODULE_INDICATOR([getdtablesize])
|
||||
gl_FUNC_GETLINE
|
||||
if test $REPLACE_GETLINE = 1; then
|
||||
AC_LIBOBJ([getline])
|
||||
gl_PREREQ_GETLINE
|
||||
fi
|
||||
gl_STDIO_MODULE_INDICATOR([getline])
|
||||
gl_GETTIME
|
||||
gl_FUNC_GETTIMEOFDAY
|
||||
if test $HAVE_GETTIMEOFDAY = 0 || test $REPLACE_GETTIMEOFDAY = 1; then
|
||||
@@ -146,10 +166,17 @@ AC_DEFUN([gl_INIT],
|
||||
AC_LIBOBJ([msvc-nothrow])
|
||||
fi
|
||||
gl_MULTIARCH
|
||||
gl_FUNC_REALLOC_POSIX
|
||||
if test $REPLACE_REALLOC = 1; then
|
||||
AC_LIBOBJ([realloc])
|
||||
fi
|
||||
gl_STDLIB_MODULE_INDICATOR([realloc-posix])
|
||||
gt_TYPE_SSIZE_T
|
||||
AM_STDBOOL_H
|
||||
gl_STDDEF_H
|
||||
gl_STDINT_H
|
||||
gl_STDIO_H
|
||||
gl_STDLIB_H
|
||||
gl_HEADER_STRING_H
|
||||
gl_HEADER_SYS_TIME_H
|
||||
AC_PROG_MKDIR_P
|
||||
@@ -298,6 +325,7 @@ AC_DEFUN([gltests_LIBSOURCES], [
|
||||
# This macro records the list of files which have been installed by
|
||||
# gnulib-tool and may be removed by future gnulib-tool invocations.
|
||||
AC_DEFUN([gl_FILE_LIST], [
|
||||
build-aux/snippet/_Noreturn.h
|
||||
build-aux/snippet/arg-nonnull.h
|
||||
build-aux/snippet/c++defs.h
|
||||
build-aux/snippet/warn-on-use.h
|
||||
@@ -305,11 +333,14 @@ AC_DEFUN([gl_FILE_LIST], [
|
||||
lib/cloexec.h
|
||||
lib/close.c
|
||||
lib/dup2.c
|
||||
lib/errno.in.h
|
||||
lib/fcntl.c
|
||||
lib/fcntl.in.h
|
||||
lib/fd-hook.c
|
||||
lib/fd-hook.h
|
||||
lib/getdelim.c
|
||||
lib/getdtablesize.c
|
||||
lib/getline.c
|
||||
lib/gettime.c
|
||||
lib/gettimeofday.c
|
||||
lib/memchr.c
|
||||
@@ -319,9 +350,12 @@ AC_DEFUN([gl_FILE_LIST], [
|
||||
lib/msvc-inval.h
|
||||
lib/msvc-nothrow.c
|
||||
lib/msvc-nothrow.h
|
||||
lib/realloc.c
|
||||
lib/stdbool.in.h
|
||||
lib/stddef.in.h
|
||||
lib/stdint.in.h
|
||||
lib/stdio.in.h
|
||||
lib/stdlib.in.h
|
||||
lib/str-two-way.h
|
||||
lib/string.in.h
|
||||
lib/sys_time.in.h
|
||||
@@ -335,17 +369,21 @@ AC_DEFUN([gl_FILE_LIST], [
|
||||
m4/clock_time.m4
|
||||
m4/close.m4
|
||||
m4/dup2.m4
|
||||
m4/errno_h.m4
|
||||
m4/extensions.m4
|
||||
m4/extern-inline.m4
|
||||
m4/fcntl-o.m4
|
||||
m4/fcntl.m4
|
||||
m4/fcntl_h.m4
|
||||
m4/getdelim.m4
|
||||
m4/getdtablesize.m4
|
||||
m4/getline.m4
|
||||
m4/gettime.m4
|
||||
m4/gettimeofday.m4
|
||||
m4/gnulib-common.m4
|
||||
m4/include_next.m4
|
||||
m4/longlong.m4
|
||||
m4/malloc.m4
|
||||
m4/memchr.m4
|
||||
m4/memmem.m4
|
||||
m4/mmap-anon.m4
|
||||
@@ -353,10 +391,13 @@ AC_DEFUN([gl_FILE_LIST], [
|
||||
m4/msvc-nothrow.m4
|
||||
m4/multiarch.m4
|
||||
m4/off_t.m4
|
||||
m4/realloc.m4
|
||||
m4/ssize_t.m4
|
||||
m4/stdbool.m4
|
||||
m4/stddef_h.m4
|
||||
m4/stdint.m4
|
||||
m4/stdio_h.m4
|
||||
m4/stdlib_h.m4
|
||||
m4/string_h.m4
|
||||
m4/sys_socket_h.m4
|
||||
m4/sys_time_h.m4
|
||||
|
||||
98
gl/m4/malloc.m4
Normal file
98
gl/m4/malloc.m4
Normal file
@@ -0,0 +1,98 @@
|
||||
# malloc.m4 serial 14
|
||||
dnl Copyright (C) 2007, 2009-2013 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.
|
||||
|
||||
m4_version_prereq([2.70], [] ,[
|
||||
|
||||
# This is taken from the following Autoconf patch:
|
||||
# http://git.savannah.gnu.org/gitweb/?p=autoconf.git;a=commitdiff;h=7fbb553727ed7e0e689a17594b58559ecf3ea6e9
|
||||
AC_DEFUN([_AC_FUNC_MALLOC_IF],
|
||||
[
|
||||
AC_REQUIRE([AC_HEADER_STDC])dnl
|
||||
AC_REQUIRE([AC_CANONICAL_HOST])dnl for cross-compiles
|
||||
AC_CHECK_HEADERS([stdlib.h])
|
||||
AC_CACHE_CHECK([for GNU libc compatible malloc],
|
||||
[ac_cv_func_malloc_0_nonnull],
|
||||
[AC_RUN_IFELSE(
|
||||
[AC_LANG_PROGRAM(
|
||||
[[#if defined STDC_HEADERS || defined HAVE_STDLIB_H
|
||||
# include <stdlib.h>
|
||||
#else
|
||||
char *malloc ();
|
||||
#endif
|
||||
]],
|
||||
[[return ! malloc (0);]])
|
||||
],
|
||||
[ac_cv_func_malloc_0_nonnull=yes],
|
||||
[ac_cv_func_malloc_0_nonnull=no],
|
||||
[case "$host_os" in
|
||||
# Guess yes on platforms where we know the result.
|
||||
*-gnu* | freebsd* | netbsd* | openbsd* \
|
||||
| hpux* | solaris* | cygwin* | mingw*)
|
||||
ac_cv_func_malloc_0_nonnull=yes ;;
|
||||
# If we don't know, assume the worst.
|
||||
*) ac_cv_func_malloc_0_nonnull=no ;;
|
||||
esac
|
||||
])
|
||||
])
|
||||
AS_IF([test $ac_cv_func_malloc_0_nonnull = yes], [$1], [$2])
|
||||
])# _AC_FUNC_MALLOC_IF
|
||||
|
||||
])
|
||||
|
||||
# gl_FUNC_MALLOC_GNU
|
||||
# ------------------
|
||||
# Test whether 'malloc (0)' is handled like in GNU libc, and replace malloc if
|
||||
# it is not.
|
||||
AC_DEFUN([gl_FUNC_MALLOC_GNU],
|
||||
[
|
||||
AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
|
||||
dnl _AC_FUNC_MALLOC_IF is defined in Autoconf.
|
||||
_AC_FUNC_MALLOC_IF(
|
||||
[AC_DEFINE([HAVE_MALLOC_GNU], [1],
|
||||
[Define to 1 if your system has a GNU libc compatible 'malloc'
|
||||
function, and to 0 otherwise.])],
|
||||
[AC_DEFINE([HAVE_MALLOC_GNU], [0])
|
||||
REPLACE_MALLOC=1
|
||||
])
|
||||
])
|
||||
|
||||
# gl_FUNC_MALLOC_POSIX
|
||||
# --------------------
|
||||
# Test whether 'malloc' is POSIX compliant (sets errno to ENOMEM when it
|
||||
# fails), and replace malloc if it is not.
|
||||
AC_DEFUN([gl_FUNC_MALLOC_POSIX],
|
||||
[
|
||||
AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
|
||||
AC_REQUIRE([gl_CHECK_MALLOC_POSIX])
|
||||
if test $gl_cv_func_malloc_posix = yes; then
|
||||
AC_DEFINE([HAVE_MALLOC_POSIX], [1],
|
||||
[Define if the 'malloc' function is POSIX compliant.])
|
||||
else
|
||||
REPLACE_MALLOC=1
|
||||
fi
|
||||
])
|
||||
|
||||
# Test whether malloc, realloc, calloc are POSIX compliant,
|
||||
# Set gl_cv_func_malloc_posix to yes or no accordingly.
|
||||
AC_DEFUN([gl_CHECK_MALLOC_POSIX],
|
||||
[
|
||||
AC_CACHE_CHECK([whether malloc, realloc, calloc are POSIX compliant],
|
||||
[gl_cv_func_malloc_posix],
|
||||
[
|
||||
dnl It is too dangerous to try to allocate a large amount of memory:
|
||||
dnl some systems go to their knees when you do that. So assume that
|
||||
dnl all Unix implementations of the function are POSIX compliant.
|
||||
AC_COMPILE_IFELSE(
|
||||
[AC_LANG_PROGRAM(
|
||||
[[]],
|
||||
[[#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
|
||||
choke me
|
||||
#endif
|
||||
]])],
|
||||
[gl_cv_func_malloc_posix=yes],
|
||||
[gl_cv_func_malloc_posix=no])
|
||||
])
|
||||
])
|
||||
76
gl/m4/realloc.m4
Normal file
76
gl/m4/realloc.m4
Normal file
@@ -0,0 +1,76 @@
|
||||
# realloc.m4 serial 13
|
||||
dnl Copyright (C) 2007, 2009-2013 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.
|
||||
|
||||
m4_version_prereq([2.70], [] ,[
|
||||
|
||||
# This is taken from the following Autoconf patch:
|
||||
# http://git.savannah.gnu.org/gitweb/?p=autoconf.git;a=commitdiff;h=7fbb553727ed7e0e689a17594b58559ecf3ea6e9
|
||||
AC_DEFUN([_AC_FUNC_REALLOC_IF],
|
||||
[
|
||||
AC_REQUIRE([AC_HEADER_STDC])dnl
|
||||
AC_REQUIRE([AC_CANONICAL_HOST])dnl for cross-compiles
|
||||
AC_CHECK_HEADERS([stdlib.h])
|
||||
AC_CACHE_CHECK([for GNU libc compatible realloc],
|
||||
[ac_cv_func_realloc_0_nonnull],
|
||||
[AC_RUN_IFELSE(
|
||||
[AC_LANG_PROGRAM(
|
||||
[[#if defined STDC_HEADERS || defined HAVE_STDLIB_H
|
||||
# include <stdlib.h>
|
||||
#else
|
||||
char *realloc ();
|
||||
#endif
|
||||
]],
|
||||
[[return ! realloc (0, 0);]])
|
||||
],
|
||||
[ac_cv_func_realloc_0_nonnull=yes],
|
||||
[ac_cv_func_realloc_0_nonnull=no],
|
||||
[case "$host_os" in
|
||||
# Guess yes on platforms where we know the result.
|
||||
*-gnu* | freebsd* | netbsd* | openbsd* \
|
||||
| hpux* | solaris* | cygwin* | mingw*)
|
||||
ac_cv_func_realloc_0_nonnull=yes ;;
|
||||
# If we don't know, assume the worst.
|
||||
*) ac_cv_func_realloc_0_nonnull=no ;;
|
||||
esac
|
||||
])
|
||||
])
|
||||
AS_IF([test $ac_cv_func_realloc_0_nonnull = yes], [$1], [$2])
|
||||
])# AC_FUNC_REALLOC
|
||||
|
||||
])
|
||||
|
||||
# gl_FUNC_REALLOC_GNU
|
||||
# -------------------
|
||||
# Test whether 'realloc (0, 0)' is handled like in GNU libc, and replace
|
||||
# realloc if it is not.
|
||||
AC_DEFUN([gl_FUNC_REALLOC_GNU],
|
||||
[
|
||||
AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
|
||||
dnl _AC_FUNC_REALLOC_IF is defined in Autoconf.
|
||||
_AC_FUNC_REALLOC_IF(
|
||||
[AC_DEFINE([HAVE_REALLOC_GNU], [1],
|
||||
[Define to 1 if your system has a GNU libc compatible 'realloc'
|
||||
function, and to 0 otherwise.])],
|
||||
[AC_DEFINE([HAVE_REALLOC_GNU], [0])
|
||||
REPLACE_REALLOC=1
|
||||
])
|
||||
])# gl_FUNC_REALLOC_GNU
|
||||
|
||||
# gl_FUNC_REALLOC_POSIX
|
||||
# ---------------------
|
||||
# Test whether 'realloc' is POSIX compliant (sets errno to ENOMEM when it
|
||||
# fails), and replace realloc if it is not.
|
||||
AC_DEFUN([gl_FUNC_REALLOC_POSIX],
|
||||
[
|
||||
AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
|
||||
AC_REQUIRE([gl_CHECK_MALLOC_POSIX])
|
||||
if test $gl_cv_func_malloc_posix = yes; then
|
||||
AC_DEFINE([HAVE_REALLOC_POSIX], [1],
|
||||
[Define if the 'realloc' function is POSIX compliant.])
|
||||
else
|
||||
REPLACE_REALLOC=1
|
||||
fi
|
||||
])
|
||||
194
gl/m4/stdio_h.m4
Normal file
194
gl/m4/stdio_h.m4
Normal file
@@ -0,0 +1,194 @@
|
||||
# stdio_h.m4 serial 43
|
||||
dnl Copyright (C) 2007-2013 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_STDIO_H],
|
||||
[
|
||||
AC_REQUIRE([gl_STDIO_H_DEFAULTS])
|
||||
gl_NEXT_HEADERS([stdio.h])
|
||||
|
||||
dnl No need to create extra modules for these functions. Everyone who uses
|
||||
dnl <stdio.h> likely needs them.
|
||||
GNULIB_FSCANF=1
|
||||
gl_MODULE_INDICATOR([fscanf])
|
||||
GNULIB_SCANF=1
|
||||
gl_MODULE_INDICATOR([scanf])
|
||||
GNULIB_FGETC=1
|
||||
GNULIB_GETC=1
|
||||
GNULIB_GETCHAR=1
|
||||
GNULIB_FGETS=1
|
||||
GNULIB_FREAD=1
|
||||
dnl This ifdef is necessary to avoid an error "missing file lib/stdio-read.c"
|
||||
dnl "expected source file, required through AC_LIBSOURCES, not found". It is
|
||||
dnl also an optimization, to avoid performing a configure check whose result
|
||||
dnl is not used. But it does not make the test of GNULIB_STDIO_H_NONBLOCKING
|
||||
dnl or GNULIB_NONBLOCKING redundant.
|
||||
m4_ifdef([gl_NONBLOCKING_IO], [
|
||||
gl_NONBLOCKING_IO
|
||||
if test $gl_cv_have_nonblocking != yes; then
|
||||
REPLACE_STDIO_READ_FUNCS=1
|
||||
AC_LIBOBJ([stdio-read])
|
||||
fi
|
||||
])
|
||||
|
||||
dnl No need to create extra modules for these functions. Everyone who uses
|
||||
dnl <stdio.h> likely needs them.
|
||||
GNULIB_FPRINTF=1
|
||||
GNULIB_PRINTF=1
|
||||
GNULIB_VFPRINTF=1
|
||||
GNULIB_VPRINTF=1
|
||||
GNULIB_FPUTC=1
|
||||
GNULIB_PUTC=1
|
||||
GNULIB_PUTCHAR=1
|
||||
GNULIB_FPUTS=1
|
||||
GNULIB_PUTS=1
|
||||
GNULIB_FWRITE=1
|
||||
dnl This ifdef is necessary to avoid an error "missing file lib/stdio-write.c"
|
||||
dnl "expected source file, required through AC_LIBSOURCES, not found". It is
|
||||
dnl also an optimization, to avoid performing a configure check whose result
|
||||
dnl is not used. But it does not make the test of GNULIB_STDIO_H_SIGPIPE or
|
||||
dnl GNULIB_SIGPIPE redundant.
|
||||
m4_ifdef([gl_SIGNAL_SIGPIPE], [
|
||||
gl_SIGNAL_SIGPIPE
|
||||
if test $gl_cv_header_signal_h_SIGPIPE != yes; then
|
||||
REPLACE_STDIO_WRITE_FUNCS=1
|
||||
AC_LIBOBJ([stdio-write])
|
||||
fi
|
||||
])
|
||||
dnl This ifdef is necessary to avoid an error "missing file lib/stdio-write.c"
|
||||
dnl "expected source file, required through AC_LIBSOURCES, not found". It is
|
||||
dnl also an optimization, to avoid performing a configure check whose result
|
||||
dnl is not used. But it does not make the test of GNULIB_STDIO_H_NONBLOCKING
|
||||
dnl or GNULIB_NONBLOCKING redundant.
|
||||
m4_ifdef([gl_NONBLOCKING_IO], [
|
||||
gl_NONBLOCKING_IO
|
||||
if test $gl_cv_have_nonblocking != yes; then
|
||||
REPLACE_STDIO_WRITE_FUNCS=1
|
||||
AC_LIBOBJ([stdio-write])
|
||||
fi
|
||||
])
|
||||
|
||||
dnl Check for declarations of anything we want to poison if the
|
||||
dnl corresponding gnulib module is not in use, and which is not
|
||||
dnl guaranteed by both C89 and C11.
|
||||
gl_WARN_ON_USE_PREPARE([[#include <stdio.h>
|
||||
]], [dprintf fpurge fseeko ftello getdelim getline gets pclose popen
|
||||
renameat snprintf tmpfile vdprintf vsnprintf])
|
||||
])
|
||||
|
||||
AC_DEFUN([gl_STDIO_MODULE_INDICATOR],
|
||||
[
|
||||
dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
|
||||
AC_REQUIRE([gl_STDIO_H_DEFAULTS])
|
||||
gl_MODULE_INDICATOR_SET_VARIABLE([$1])
|
||||
dnl Define it also as a C macro, for the benefit of the unit tests.
|
||||
gl_MODULE_INDICATOR_FOR_TESTS([$1])
|
||||
])
|
||||
|
||||
AC_DEFUN([gl_STDIO_H_DEFAULTS],
|
||||
[
|
||||
GNULIB_DPRINTF=0; AC_SUBST([GNULIB_DPRINTF])
|
||||
GNULIB_FCLOSE=0; AC_SUBST([GNULIB_FCLOSE])
|
||||
GNULIB_FDOPEN=0; AC_SUBST([GNULIB_FDOPEN])
|
||||
GNULIB_FFLUSH=0; AC_SUBST([GNULIB_FFLUSH])
|
||||
GNULIB_FGETC=0; AC_SUBST([GNULIB_FGETC])
|
||||
GNULIB_FGETS=0; AC_SUBST([GNULIB_FGETS])
|
||||
GNULIB_FOPEN=0; AC_SUBST([GNULIB_FOPEN])
|
||||
GNULIB_FPRINTF=0; AC_SUBST([GNULIB_FPRINTF])
|
||||
GNULIB_FPRINTF_POSIX=0; AC_SUBST([GNULIB_FPRINTF_POSIX])
|
||||
GNULIB_FPURGE=0; AC_SUBST([GNULIB_FPURGE])
|
||||
GNULIB_FPUTC=0; AC_SUBST([GNULIB_FPUTC])
|
||||
GNULIB_FPUTS=0; AC_SUBST([GNULIB_FPUTS])
|
||||
GNULIB_FREAD=0; AC_SUBST([GNULIB_FREAD])
|
||||
GNULIB_FREOPEN=0; AC_SUBST([GNULIB_FREOPEN])
|
||||
GNULIB_FSCANF=0; AC_SUBST([GNULIB_FSCANF])
|
||||
GNULIB_FSEEK=0; AC_SUBST([GNULIB_FSEEK])
|
||||
GNULIB_FSEEKO=0; AC_SUBST([GNULIB_FSEEKO])
|
||||
GNULIB_FTELL=0; AC_SUBST([GNULIB_FTELL])
|
||||
GNULIB_FTELLO=0; AC_SUBST([GNULIB_FTELLO])
|
||||
GNULIB_FWRITE=0; AC_SUBST([GNULIB_FWRITE])
|
||||
GNULIB_GETC=0; AC_SUBST([GNULIB_GETC])
|
||||
GNULIB_GETCHAR=0; AC_SUBST([GNULIB_GETCHAR])
|
||||
GNULIB_GETDELIM=0; AC_SUBST([GNULIB_GETDELIM])
|
||||
GNULIB_GETLINE=0; AC_SUBST([GNULIB_GETLINE])
|
||||
GNULIB_OBSTACK_PRINTF=0; AC_SUBST([GNULIB_OBSTACK_PRINTF])
|
||||
GNULIB_OBSTACK_PRINTF_POSIX=0; AC_SUBST([GNULIB_OBSTACK_PRINTF_POSIX])
|
||||
GNULIB_PCLOSE=0; AC_SUBST([GNULIB_PCLOSE])
|
||||
GNULIB_PERROR=0; AC_SUBST([GNULIB_PERROR])
|
||||
GNULIB_POPEN=0; AC_SUBST([GNULIB_POPEN])
|
||||
GNULIB_PRINTF=0; AC_SUBST([GNULIB_PRINTF])
|
||||
GNULIB_PRINTF_POSIX=0; AC_SUBST([GNULIB_PRINTF_POSIX])
|
||||
GNULIB_PUTC=0; AC_SUBST([GNULIB_PUTC])
|
||||
GNULIB_PUTCHAR=0; AC_SUBST([GNULIB_PUTCHAR])
|
||||
GNULIB_PUTS=0; AC_SUBST([GNULIB_PUTS])
|
||||
GNULIB_REMOVE=0; AC_SUBST([GNULIB_REMOVE])
|
||||
GNULIB_RENAME=0; AC_SUBST([GNULIB_RENAME])
|
||||
GNULIB_RENAMEAT=0; AC_SUBST([GNULIB_RENAMEAT])
|
||||
GNULIB_SCANF=0; AC_SUBST([GNULIB_SCANF])
|
||||
GNULIB_SNPRINTF=0; AC_SUBST([GNULIB_SNPRINTF])
|
||||
GNULIB_SPRINTF_POSIX=0; AC_SUBST([GNULIB_SPRINTF_POSIX])
|
||||
GNULIB_STDIO_H_NONBLOCKING=0; AC_SUBST([GNULIB_STDIO_H_NONBLOCKING])
|
||||
GNULIB_STDIO_H_SIGPIPE=0; AC_SUBST([GNULIB_STDIO_H_SIGPIPE])
|
||||
GNULIB_TMPFILE=0; AC_SUBST([GNULIB_TMPFILE])
|
||||
GNULIB_VASPRINTF=0; AC_SUBST([GNULIB_VASPRINTF])
|
||||
GNULIB_VFSCANF=0; AC_SUBST([GNULIB_VFSCANF])
|
||||
GNULIB_VSCANF=0; AC_SUBST([GNULIB_VSCANF])
|
||||
GNULIB_VDPRINTF=0; AC_SUBST([GNULIB_VDPRINTF])
|
||||
GNULIB_VFPRINTF=0; AC_SUBST([GNULIB_VFPRINTF])
|
||||
GNULIB_VFPRINTF_POSIX=0; AC_SUBST([GNULIB_VFPRINTF_POSIX])
|
||||
GNULIB_VPRINTF=0; AC_SUBST([GNULIB_VPRINTF])
|
||||
GNULIB_VPRINTF_POSIX=0; AC_SUBST([GNULIB_VPRINTF_POSIX])
|
||||
GNULIB_VSNPRINTF=0; AC_SUBST([GNULIB_VSNPRINTF])
|
||||
GNULIB_VSPRINTF_POSIX=0; AC_SUBST([GNULIB_VSPRINTF_POSIX])
|
||||
dnl Assume proper GNU behavior unless another module says otherwise.
|
||||
HAVE_DECL_FPURGE=1; AC_SUBST([HAVE_DECL_FPURGE])
|
||||
HAVE_DECL_FSEEKO=1; AC_SUBST([HAVE_DECL_FSEEKO])
|
||||
HAVE_DECL_FTELLO=1; AC_SUBST([HAVE_DECL_FTELLO])
|
||||
HAVE_DECL_GETDELIM=1; AC_SUBST([HAVE_DECL_GETDELIM])
|
||||
HAVE_DECL_GETLINE=1; AC_SUBST([HAVE_DECL_GETLINE])
|
||||
HAVE_DECL_OBSTACK_PRINTF=1; AC_SUBST([HAVE_DECL_OBSTACK_PRINTF])
|
||||
HAVE_DECL_SNPRINTF=1; AC_SUBST([HAVE_DECL_SNPRINTF])
|
||||
HAVE_DECL_VSNPRINTF=1; AC_SUBST([HAVE_DECL_VSNPRINTF])
|
||||
HAVE_DPRINTF=1; AC_SUBST([HAVE_DPRINTF])
|
||||
HAVE_FSEEKO=1; AC_SUBST([HAVE_FSEEKO])
|
||||
HAVE_FTELLO=1; AC_SUBST([HAVE_FTELLO])
|
||||
HAVE_PCLOSE=1; AC_SUBST([HAVE_PCLOSE])
|
||||
HAVE_POPEN=1; AC_SUBST([HAVE_POPEN])
|
||||
HAVE_RENAMEAT=1; AC_SUBST([HAVE_RENAMEAT])
|
||||
HAVE_VASPRINTF=1; AC_SUBST([HAVE_VASPRINTF])
|
||||
HAVE_VDPRINTF=1; AC_SUBST([HAVE_VDPRINTF])
|
||||
REPLACE_DPRINTF=0; AC_SUBST([REPLACE_DPRINTF])
|
||||
REPLACE_FCLOSE=0; AC_SUBST([REPLACE_FCLOSE])
|
||||
REPLACE_FDOPEN=0; AC_SUBST([REPLACE_FDOPEN])
|
||||
REPLACE_FFLUSH=0; AC_SUBST([REPLACE_FFLUSH])
|
||||
REPLACE_FOPEN=0; AC_SUBST([REPLACE_FOPEN])
|
||||
REPLACE_FPRINTF=0; AC_SUBST([REPLACE_FPRINTF])
|
||||
REPLACE_FPURGE=0; AC_SUBST([REPLACE_FPURGE])
|
||||
REPLACE_FREOPEN=0; AC_SUBST([REPLACE_FREOPEN])
|
||||
REPLACE_FSEEK=0; AC_SUBST([REPLACE_FSEEK])
|
||||
REPLACE_FSEEKO=0; AC_SUBST([REPLACE_FSEEKO])
|
||||
REPLACE_FTELL=0; AC_SUBST([REPLACE_FTELL])
|
||||
REPLACE_FTELLO=0; AC_SUBST([REPLACE_FTELLO])
|
||||
REPLACE_GETDELIM=0; AC_SUBST([REPLACE_GETDELIM])
|
||||
REPLACE_GETLINE=0; AC_SUBST([REPLACE_GETLINE])
|
||||
REPLACE_OBSTACK_PRINTF=0; AC_SUBST([REPLACE_OBSTACK_PRINTF])
|
||||
REPLACE_PERROR=0; AC_SUBST([REPLACE_PERROR])
|
||||
REPLACE_POPEN=0; AC_SUBST([REPLACE_POPEN])
|
||||
REPLACE_PRINTF=0; AC_SUBST([REPLACE_PRINTF])
|
||||
REPLACE_REMOVE=0; AC_SUBST([REPLACE_REMOVE])
|
||||
REPLACE_RENAME=0; AC_SUBST([REPLACE_RENAME])
|
||||
REPLACE_RENAMEAT=0; AC_SUBST([REPLACE_RENAMEAT])
|
||||
REPLACE_SNPRINTF=0; AC_SUBST([REPLACE_SNPRINTF])
|
||||
REPLACE_SPRINTF=0; AC_SUBST([REPLACE_SPRINTF])
|
||||
REPLACE_STDIO_READ_FUNCS=0; AC_SUBST([REPLACE_STDIO_READ_FUNCS])
|
||||
REPLACE_STDIO_WRITE_FUNCS=0; AC_SUBST([REPLACE_STDIO_WRITE_FUNCS])
|
||||
REPLACE_TMPFILE=0; AC_SUBST([REPLACE_TMPFILE])
|
||||
REPLACE_VASPRINTF=0; AC_SUBST([REPLACE_VASPRINTF])
|
||||
REPLACE_VDPRINTF=0; AC_SUBST([REPLACE_VDPRINTF])
|
||||
REPLACE_VFPRINTF=0; AC_SUBST([REPLACE_VFPRINTF])
|
||||
REPLACE_VPRINTF=0; AC_SUBST([REPLACE_VPRINTF])
|
||||
REPLACE_VSNPRINTF=0; AC_SUBST([REPLACE_VSNPRINTF])
|
||||
REPLACE_VSPRINTF=0; AC_SUBST([REPLACE_VSPRINTF])
|
||||
])
|
||||
117
gl/m4/stdlib_h.m4
Normal file
117
gl/m4/stdlib_h.m4
Normal file
@@ -0,0 +1,117 @@
|
||||
# stdlib_h.m4 serial 42
|
||||
dnl Copyright (C) 2007-2013 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_STDLIB_H],
|
||||
[
|
||||
AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
|
||||
gl_NEXT_HEADERS([stdlib.h])
|
||||
|
||||
dnl Check for declarations of anything we want to poison if the
|
||||
dnl corresponding gnulib module is not in use, and which is not
|
||||
dnl guaranteed by C89.
|
||||
gl_WARN_ON_USE_PREPARE([[#include <stdlib.h>
|
||||
#if HAVE_SYS_LOADAVG_H
|
||||
# include <sys/loadavg.h>
|
||||
#endif
|
||||
#if HAVE_RANDOM_H
|
||||
# include <random.h>
|
||||
#endif
|
||||
]], [_Exit atoll canonicalize_file_name getloadavg getsubopt grantpt
|
||||
initstate initstate_r mkdtemp mkostemp mkostemps mkstemp mkstemps
|
||||
posix_openpt ptsname ptsname_r random random_r realpath rpmatch
|
||||
secure_getenv setenv setstate setstate_r srandom srandom_r
|
||||
strtod strtoll strtoull unlockpt unsetenv])
|
||||
])
|
||||
|
||||
AC_DEFUN([gl_STDLIB_MODULE_INDICATOR],
|
||||
[
|
||||
dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
|
||||
AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
|
||||
gl_MODULE_INDICATOR_SET_VARIABLE([$1])
|
||||
dnl Define it also as a C macro, for the benefit of the unit tests.
|
||||
gl_MODULE_INDICATOR_FOR_TESTS([$1])
|
||||
])
|
||||
|
||||
AC_DEFUN([gl_STDLIB_H_DEFAULTS],
|
||||
[
|
||||
GNULIB__EXIT=0; AC_SUBST([GNULIB__EXIT])
|
||||
GNULIB_ATOLL=0; AC_SUBST([GNULIB_ATOLL])
|
||||
GNULIB_CALLOC_POSIX=0; AC_SUBST([GNULIB_CALLOC_POSIX])
|
||||
GNULIB_CANONICALIZE_FILE_NAME=0; AC_SUBST([GNULIB_CANONICALIZE_FILE_NAME])
|
||||
GNULIB_GETLOADAVG=0; AC_SUBST([GNULIB_GETLOADAVG])
|
||||
GNULIB_GETSUBOPT=0; AC_SUBST([GNULIB_GETSUBOPT])
|
||||
GNULIB_GRANTPT=0; AC_SUBST([GNULIB_GRANTPT])
|
||||
GNULIB_MALLOC_POSIX=0; AC_SUBST([GNULIB_MALLOC_POSIX])
|
||||
GNULIB_MBTOWC=0; AC_SUBST([GNULIB_MBTOWC])
|
||||
GNULIB_MKDTEMP=0; AC_SUBST([GNULIB_MKDTEMP])
|
||||
GNULIB_MKOSTEMP=0; AC_SUBST([GNULIB_MKOSTEMP])
|
||||
GNULIB_MKOSTEMPS=0; AC_SUBST([GNULIB_MKOSTEMPS])
|
||||
GNULIB_MKSTEMP=0; AC_SUBST([GNULIB_MKSTEMP])
|
||||
GNULIB_MKSTEMPS=0; AC_SUBST([GNULIB_MKSTEMPS])
|
||||
GNULIB_POSIX_OPENPT=0; AC_SUBST([GNULIB_POSIX_OPENPT])
|
||||
GNULIB_PTSNAME=0; AC_SUBST([GNULIB_PTSNAME])
|
||||
GNULIB_PTSNAME_R=0; AC_SUBST([GNULIB_PTSNAME_R])
|
||||
GNULIB_PUTENV=0; AC_SUBST([GNULIB_PUTENV])
|
||||
GNULIB_RANDOM=0; AC_SUBST([GNULIB_RANDOM])
|
||||
GNULIB_RANDOM_R=0; AC_SUBST([GNULIB_RANDOM_R])
|
||||
GNULIB_REALLOC_POSIX=0; AC_SUBST([GNULIB_REALLOC_POSIX])
|
||||
GNULIB_REALPATH=0; AC_SUBST([GNULIB_REALPATH])
|
||||
GNULIB_RPMATCH=0; AC_SUBST([GNULIB_RPMATCH])
|
||||
GNULIB_SECURE_GETENV=0; AC_SUBST([GNULIB_SECURE_GETENV])
|
||||
GNULIB_SETENV=0; AC_SUBST([GNULIB_SETENV])
|
||||
GNULIB_STRTOD=0; AC_SUBST([GNULIB_STRTOD])
|
||||
GNULIB_STRTOLL=0; AC_SUBST([GNULIB_STRTOLL])
|
||||
GNULIB_STRTOULL=0; AC_SUBST([GNULIB_STRTOULL])
|
||||
GNULIB_SYSTEM_POSIX=0; AC_SUBST([GNULIB_SYSTEM_POSIX])
|
||||
GNULIB_UNLOCKPT=0; AC_SUBST([GNULIB_UNLOCKPT])
|
||||
GNULIB_UNSETENV=0; AC_SUBST([GNULIB_UNSETENV])
|
||||
GNULIB_WCTOMB=0; AC_SUBST([GNULIB_WCTOMB])
|
||||
dnl Assume proper GNU behavior unless another module says otherwise.
|
||||
HAVE__EXIT=1; AC_SUBST([HAVE__EXIT])
|
||||
HAVE_ATOLL=1; AC_SUBST([HAVE_ATOLL])
|
||||
HAVE_CANONICALIZE_FILE_NAME=1; AC_SUBST([HAVE_CANONICALIZE_FILE_NAME])
|
||||
HAVE_DECL_GETLOADAVG=1; AC_SUBST([HAVE_DECL_GETLOADAVG])
|
||||
HAVE_GETSUBOPT=1; AC_SUBST([HAVE_GETSUBOPT])
|
||||
HAVE_GRANTPT=1; AC_SUBST([HAVE_GRANTPT])
|
||||
HAVE_MKDTEMP=1; AC_SUBST([HAVE_MKDTEMP])
|
||||
HAVE_MKOSTEMP=1; AC_SUBST([HAVE_MKOSTEMP])
|
||||
HAVE_MKOSTEMPS=1; AC_SUBST([HAVE_MKOSTEMPS])
|
||||
HAVE_MKSTEMP=1; AC_SUBST([HAVE_MKSTEMP])
|
||||
HAVE_MKSTEMPS=1; AC_SUBST([HAVE_MKSTEMPS])
|
||||
HAVE_POSIX_OPENPT=1; AC_SUBST([HAVE_POSIX_OPENPT])
|
||||
HAVE_PTSNAME=1; AC_SUBST([HAVE_PTSNAME])
|
||||
HAVE_PTSNAME_R=1; AC_SUBST([HAVE_PTSNAME_R])
|
||||
HAVE_RANDOM=1; AC_SUBST([HAVE_RANDOM])
|
||||
HAVE_RANDOM_H=1; AC_SUBST([HAVE_RANDOM_H])
|
||||
HAVE_RANDOM_R=1; AC_SUBST([HAVE_RANDOM_R])
|
||||
HAVE_REALPATH=1; AC_SUBST([HAVE_REALPATH])
|
||||
HAVE_RPMATCH=1; AC_SUBST([HAVE_RPMATCH])
|
||||
HAVE_SECURE_GETENV=1; AC_SUBST([HAVE_SECURE_GETENV])
|
||||
HAVE_SETENV=1; AC_SUBST([HAVE_SETENV])
|
||||
HAVE_DECL_SETENV=1; AC_SUBST([HAVE_DECL_SETENV])
|
||||
HAVE_STRTOD=1; AC_SUBST([HAVE_STRTOD])
|
||||
HAVE_STRTOLL=1; AC_SUBST([HAVE_STRTOLL])
|
||||
HAVE_STRTOULL=1; AC_SUBST([HAVE_STRTOULL])
|
||||
HAVE_STRUCT_RANDOM_DATA=1; AC_SUBST([HAVE_STRUCT_RANDOM_DATA])
|
||||
HAVE_SYS_LOADAVG_H=0; AC_SUBST([HAVE_SYS_LOADAVG_H])
|
||||
HAVE_UNLOCKPT=1; AC_SUBST([HAVE_UNLOCKPT])
|
||||
HAVE_DECL_UNSETENV=1; AC_SUBST([HAVE_DECL_UNSETENV])
|
||||
REPLACE_CALLOC=0; AC_SUBST([REPLACE_CALLOC])
|
||||
REPLACE_CANONICALIZE_FILE_NAME=0; AC_SUBST([REPLACE_CANONICALIZE_FILE_NAME])
|
||||
REPLACE_MALLOC=0; AC_SUBST([REPLACE_MALLOC])
|
||||
REPLACE_MBTOWC=0; AC_SUBST([REPLACE_MBTOWC])
|
||||
REPLACE_MKSTEMP=0; AC_SUBST([REPLACE_MKSTEMP])
|
||||
REPLACE_PTSNAME=0; AC_SUBST([REPLACE_PTSNAME])
|
||||
REPLACE_PTSNAME_R=0; AC_SUBST([REPLACE_PTSNAME_R])
|
||||
REPLACE_PUTENV=0; AC_SUBST([REPLACE_PUTENV])
|
||||
REPLACE_RANDOM_R=0; AC_SUBST([REPLACE_RANDOM_R])
|
||||
REPLACE_REALLOC=0; AC_SUBST([REPLACE_REALLOC])
|
||||
REPLACE_REALPATH=0; AC_SUBST([REPLACE_REALPATH])
|
||||
REPLACE_SETENV=0; AC_SUBST([REPLACE_SETENV])
|
||||
REPLACE_STRTOD=0; AC_SUBST([REPLACE_STRTOD])
|
||||
REPLACE_UNSETENV=0; AC_SUBST([REPLACE_UNSETENV])
|
||||
REPLACE_WCTOMB=0; AC_SUBST([REPLACE_WCTOMB])
|
||||
])
|
||||
79
gl/realloc.c
Normal file
79
gl/realloc.c
Normal file
@@ -0,0 +1,79 @@
|
||||
/* realloc() function that is glibc compatible.
|
||||
|
||||
Copyright (C) 1997, 2003-2004, 2006-2007, 2009-2013 Free Software
|
||||
Foundation, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
/* written by Jim Meyering and Bruno Haible */
|
||||
|
||||
#define _GL_USE_STDLIB_ALLOC 1
|
||||
#include <config.h>
|
||||
|
||||
/* Only the AC_FUNC_REALLOC macro defines 'realloc' already in config.h. */
|
||||
#ifdef realloc
|
||||
# define NEED_REALLOC_GNU 1
|
||||
/* Whereas the gnulib module 'realloc-gnu' defines HAVE_REALLOC_GNU. */
|
||||
#elif GNULIB_REALLOC_GNU && !HAVE_REALLOC_GNU
|
||||
# define NEED_REALLOC_GNU 1
|
||||
#endif
|
||||
|
||||
/* Infer the properties of the system's malloc function.
|
||||
The gnulib module 'malloc-gnu' defines HAVE_MALLOC_GNU. */
|
||||
#if GNULIB_MALLOC_GNU && HAVE_MALLOC_GNU
|
||||
# define SYSTEM_MALLOC_GLIBC_COMPATIBLE 1
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <errno.h>
|
||||
|
||||
/* Change the size of an allocated block of memory P to N bytes,
|
||||
with error checking. If N is zero, change it to 1. If P is NULL,
|
||||
use malloc. */
|
||||
|
||||
void *
|
||||
rpl_realloc (void *p, size_t n)
|
||||
{
|
||||
void *result;
|
||||
|
||||
#if NEED_REALLOC_GNU
|
||||
if (n == 0)
|
||||
{
|
||||
n = 1;
|
||||
|
||||
/* In theory realloc might fail, so don't rely on it to free. */
|
||||
free (p);
|
||||
p = NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (p == NULL)
|
||||
{
|
||||
#if GNULIB_REALLOC_GNU && !NEED_REALLOC_GNU && !SYSTEM_MALLOC_GLIBC_COMPATIBLE
|
||||
if (n == 0)
|
||||
n = 1;
|
||||
#endif
|
||||
result = malloc (n);
|
||||
}
|
||||
else
|
||||
result = realloc (p, n);
|
||||
|
||||
#if !HAVE_REALLOC_POSIX
|
||||
if (result == NULL)
|
||||
errno = ENOMEM;
|
||||
#endif
|
||||
|
||||
return result;
|
||||
}
|
||||
1334
gl/stdio.in.h
Normal file
1334
gl/stdio.in.h
Normal file
File diff suppressed because it is too large
Load Diff
954
gl/stdlib.in.h
Normal file
954
gl/stdlib.in.h
Normal file
@@ -0,0 +1,954 @@
|
||||
/* A GNU-like <stdlib.h>.
|
||||
|
||||
Copyright (C) 1995, 2001-2004, 2006-2013 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
#if __GNUC__ >= 3
|
||||
@PRAGMA_SYSTEM_HEADER@
|
||||
#endif
|
||||
@PRAGMA_COLUMNS@
|
||||
|
||||
#if defined __need_system_stdlib_h || defined __need_malloc_and_calloc
|
||||
/* Special invocation conventions inside some gnulib header files,
|
||||
and inside some glibc header files, respectively. */
|
||||
|
||||
#@INCLUDE_NEXT@ @NEXT_STDLIB_H@
|
||||
|
||||
#else
|
||||
/* Normal invocation convention. */
|
||||
|
||||
#ifndef _@GUARD_PREFIX@_STDLIB_H
|
||||
|
||||
/* The include_next requires a split double-inclusion guard. */
|
||||
#@INCLUDE_NEXT@ @NEXT_STDLIB_H@
|
||||
|
||||
#ifndef _@GUARD_PREFIX@_STDLIB_H
|
||||
#define _@GUARD_PREFIX@_STDLIB_H
|
||||
|
||||
/* NetBSD 5.0 mis-defines NULL. */
|
||||
#include <stddef.h>
|
||||
|
||||
/* MirBSD 10 defines WEXITSTATUS in <sys/wait.h>, not in <stdlib.h>. */
|
||||
#if @GNULIB_SYSTEM_POSIX@ && !defined WEXITSTATUS
|
||||
# include <sys/wait.h>
|
||||
#endif
|
||||
|
||||
/* Solaris declares getloadavg() in <sys/loadavg.h>. */
|
||||
#if (@GNULIB_GETLOADAVG@ || defined GNULIB_POSIXCHECK) && @HAVE_SYS_LOADAVG_H@
|
||||
# include <sys/loadavg.h>
|
||||
#endif
|
||||
|
||||
/* Native Windows platforms declare mktemp() in <io.h>. */
|
||||
#if 0 && ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__)
|
||||
# include <io.h>
|
||||
#endif
|
||||
|
||||
#if @GNULIB_RANDOM_R@
|
||||
|
||||
/* OSF/1 5.1 declares 'struct random_data' in <random.h>, which is included
|
||||
from <stdlib.h> if _REENTRANT is defined. Include it whenever we need
|
||||
'struct random_data'. */
|
||||
# if @HAVE_RANDOM_H@
|
||||
# include <random.h>
|
||||
# endif
|
||||
|
||||
# if !@HAVE_STRUCT_RANDOM_DATA@ || @REPLACE_RANDOM_R@ || !@HAVE_RANDOM_R@
|
||||
# include <stdint.h>
|
||||
# endif
|
||||
|
||||
# if !@HAVE_STRUCT_RANDOM_DATA@
|
||||
/* Define 'struct random_data'.
|
||||
But allow multiple gnulib generated <stdlib.h> replacements to coexist. */
|
||||
# if !GNULIB_defined_struct_random_data
|
||||
struct random_data
|
||||
{
|
||||
int32_t *fptr; /* Front pointer. */
|
||||
int32_t *rptr; /* Rear pointer. */
|
||||
int32_t *state; /* Array of state values. */
|
||||
int rand_type; /* Type of random number generator. */
|
||||
int rand_deg; /* Degree of random number generator. */
|
||||
int rand_sep; /* Distance between front and rear. */
|
||||
int32_t *end_ptr; /* Pointer behind state table. */
|
||||
};
|
||||
# define GNULIB_defined_struct_random_data 1
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if (@GNULIB_MKSTEMP@ || @GNULIB_MKSTEMPS@ || @GNULIB_GETSUBOPT@ || defined GNULIB_POSIXCHECK) && ! defined __GLIBC__ && !((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__)
|
||||
/* On Mac OS X 10.3, only <unistd.h> declares mkstemp. */
|
||||
/* On Mac OS X 10.5, only <unistd.h> declares mkstemps. */
|
||||
/* On Cygwin 1.7.1, only <unistd.h> declares getsubopt. */
|
||||
/* But avoid namespace pollution on glibc systems and native Windows. */
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
|
||||
/* The __attribute__ feature is available in gcc versions 2.5 and later.
|
||||
The attribute __pure__ was added in gcc 2.96. */
|
||||
#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96)
|
||||
# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__))
|
||||
#else
|
||||
# define _GL_ATTRIBUTE_PURE /* empty */
|
||||
#endif
|
||||
|
||||
/* The definition of _Noreturn is copied here. */
|
||||
|
||||
/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
|
||||
|
||||
/* The definition of _GL_ARG_NONNULL is copied here. */
|
||||
|
||||
/* The definition of _GL_WARN_ON_USE is copied here. */
|
||||
|
||||
|
||||
/* Some systems do not define EXIT_*, despite otherwise supporting C89. */
|
||||
#ifndef EXIT_SUCCESS
|
||||
# define EXIT_SUCCESS 0
|
||||
#endif
|
||||
/* Tandem/NSK and other platforms that define EXIT_FAILURE as -1 interfere
|
||||
with proper operation of xargs. */
|
||||
#ifndef EXIT_FAILURE
|
||||
# define EXIT_FAILURE 1
|
||||
#elif EXIT_FAILURE != 1
|
||||
# undef EXIT_FAILURE
|
||||
# define EXIT_FAILURE 1
|
||||
#endif
|
||||
|
||||
|
||||
#if @GNULIB__EXIT@
|
||||
/* Terminate the current process with the given return code, without running
|
||||
the 'atexit' handlers. */
|
||||
# if !@HAVE__EXIT@
|
||||
_GL_FUNCDECL_SYS (_Exit, _Noreturn void, (int status));
|
||||
# endif
|
||||
_GL_CXXALIAS_SYS (_Exit, void, (int status));
|
||||
_GL_CXXALIASWARN (_Exit);
|
||||
#elif defined GNULIB_POSIXCHECK
|
||||
# undef _Exit
|
||||
# if HAVE_RAW_DECL__EXIT
|
||||
_GL_WARN_ON_USE (_Exit, "_Exit is unportable - "
|
||||
"use gnulib module _Exit for portability");
|
||||
# endif
|
||||
#endif
|
||||
|
||||
|
||||
#if @GNULIB_ATOLL@
|
||||
/* Parse a signed decimal integer.
|
||||
Returns the value of the integer. Errors are not detected. */
|
||||
# if !@HAVE_ATOLL@
|
||||
_GL_FUNCDECL_SYS (atoll, long long, (const char *string)
|
||||
_GL_ATTRIBUTE_PURE
|
||||
_GL_ARG_NONNULL ((1)));
|
||||
# endif
|
||||
_GL_CXXALIAS_SYS (atoll, long long, (const char *string));
|
||||
_GL_CXXALIASWARN (atoll);
|
||||
#elif defined GNULIB_POSIXCHECK
|
||||
# undef atoll
|
||||
# if HAVE_RAW_DECL_ATOLL
|
||||
_GL_WARN_ON_USE (atoll, "atoll is unportable - "
|
||||
"use gnulib module atoll for portability");
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if @GNULIB_CALLOC_POSIX@
|
||||
# if @REPLACE_CALLOC@
|
||||
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
||||
# undef calloc
|
||||
# define calloc rpl_calloc
|
||||
# endif
|
||||
_GL_FUNCDECL_RPL (calloc, void *, (size_t nmemb, size_t size));
|
||||
_GL_CXXALIAS_RPL (calloc, void *, (size_t nmemb, size_t size));
|
||||
# else
|
||||
_GL_CXXALIAS_SYS (calloc, void *, (size_t nmemb, size_t size));
|
||||
# endif
|
||||
_GL_CXXALIASWARN (calloc);
|
||||
#elif defined GNULIB_POSIXCHECK
|
||||
# undef calloc
|
||||
/* Assume calloc is always declared. */
|
||||
_GL_WARN_ON_USE (calloc, "calloc is not POSIX compliant everywhere - "
|
||||
"use gnulib module calloc-posix for portability");
|
||||
#endif
|
||||
|
||||
#if @GNULIB_CANONICALIZE_FILE_NAME@
|
||||
# if @REPLACE_CANONICALIZE_FILE_NAME@
|
||||
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
||||
# define canonicalize_file_name rpl_canonicalize_file_name
|
||||
# endif
|
||||
_GL_FUNCDECL_RPL (canonicalize_file_name, char *, (const char *name)
|
||||
_GL_ARG_NONNULL ((1)));
|
||||
_GL_CXXALIAS_RPL (canonicalize_file_name, char *, (const char *name));
|
||||
# else
|
||||
# if !@HAVE_CANONICALIZE_FILE_NAME@
|
||||
_GL_FUNCDECL_SYS (canonicalize_file_name, char *, (const char *name)
|
||||
_GL_ARG_NONNULL ((1)));
|
||||
# endif
|
||||
_GL_CXXALIAS_SYS (canonicalize_file_name, char *, (const char *name));
|
||||
# endif
|
||||
_GL_CXXALIASWARN (canonicalize_file_name);
|
||||
#elif defined GNULIB_POSIXCHECK
|
||||
# undef canonicalize_file_name
|
||||
# if HAVE_RAW_DECL_CANONICALIZE_FILE_NAME
|
||||
_GL_WARN_ON_USE (canonicalize_file_name,
|
||||
"canonicalize_file_name is unportable - "
|
||||
"use gnulib module canonicalize-lgpl for portability");
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if @GNULIB_GETLOADAVG@
|
||||
/* Store max(NELEM,3) load average numbers in LOADAVG[].
|
||||
The three numbers are the load average of the last 1 minute, the last 5
|
||||
minutes, and the last 15 minutes, respectively.
|
||||
LOADAVG is an array of NELEM numbers. */
|
||||
# if !@HAVE_DECL_GETLOADAVG@
|
||||
_GL_FUNCDECL_SYS (getloadavg, int, (double loadavg[], int nelem)
|
||||
_GL_ARG_NONNULL ((1)));
|
||||
# endif
|
||||
_GL_CXXALIAS_SYS (getloadavg, int, (double loadavg[], int nelem));
|
||||
_GL_CXXALIASWARN (getloadavg);
|
||||
#elif defined GNULIB_POSIXCHECK
|
||||
# undef getloadavg
|
||||
# if HAVE_RAW_DECL_GETLOADAVG
|
||||
_GL_WARN_ON_USE (getloadavg, "getloadavg is not portable - "
|
||||
"use gnulib module getloadavg for portability");
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if @GNULIB_GETSUBOPT@
|
||||
/* Assuming *OPTIONP is a comma separated list of elements of the form
|
||||
"token" or "token=value", getsubopt parses the first of these elements.
|
||||
If the first element refers to a "token" that is member of the given
|
||||
NULL-terminated array of tokens:
|
||||
- It replaces the comma with a NUL byte, updates *OPTIONP to point past
|
||||
the first option and the comma, sets *VALUEP to the value of the
|
||||
element (or NULL if it doesn't contain an "=" sign),
|
||||
- It returns the index of the "token" in the given array of tokens.
|
||||
Otherwise it returns -1, and *OPTIONP and *VALUEP are undefined.
|
||||
For more details see the POSIX:2001 specification.
|
||||
http://www.opengroup.org/susv3xsh/getsubopt.html */
|
||||
# if !@HAVE_GETSUBOPT@
|
||||
_GL_FUNCDECL_SYS (getsubopt, int,
|
||||
(char **optionp, char *const *tokens, char **valuep)
|
||||
_GL_ARG_NONNULL ((1, 2, 3)));
|
||||
# endif
|
||||
_GL_CXXALIAS_SYS (getsubopt, int,
|
||||
(char **optionp, char *const *tokens, char **valuep));
|
||||
_GL_CXXALIASWARN (getsubopt);
|
||||
#elif defined GNULIB_POSIXCHECK
|
||||
# undef getsubopt
|
||||
# if HAVE_RAW_DECL_GETSUBOPT
|
||||
_GL_WARN_ON_USE (getsubopt, "getsubopt is unportable - "
|
||||
"use gnulib module getsubopt for portability");
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if @GNULIB_GRANTPT@
|
||||
/* Change the ownership and access permission of the slave side of the
|
||||
pseudo-terminal whose master side is specified by FD. */
|
||||
# if !@HAVE_GRANTPT@
|
||||
_GL_FUNCDECL_SYS (grantpt, int, (int fd));
|
||||
# endif
|
||||
_GL_CXXALIAS_SYS (grantpt, int, (int fd));
|
||||
_GL_CXXALIASWARN (grantpt);
|
||||
#elif defined GNULIB_POSIXCHECK
|
||||
# undef grantpt
|
||||
# if HAVE_RAW_DECL_GRANTPT
|
||||
_GL_WARN_ON_USE (grantpt, "grantpt is not portable - "
|
||||
"use gnulib module grantpt for portability");
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* If _GL_USE_STDLIB_ALLOC is nonzero, the including module does not
|
||||
rely on GNU or POSIX semantics for malloc and realloc (for example,
|
||||
by never specifying a zero size), so it does not need malloc or
|
||||
realloc to be redefined. */
|
||||
#if @GNULIB_MALLOC_POSIX@
|
||||
# if @REPLACE_MALLOC@
|
||||
# if !((defined __cplusplus && defined GNULIB_NAMESPACE) \
|
||||
|| _GL_USE_STDLIB_ALLOC)
|
||||
# undef malloc
|
||||
# define malloc rpl_malloc
|
||||
# endif
|
||||
_GL_FUNCDECL_RPL (malloc, void *, (size_t size));
|
||||
_GL_CXXALIAS_RPL (malloc, void *, (size_t size));
|
||||
# else
|
||||
_GL_CXXALIAS_SYS (malloc, void *, (size_t size));
|
||||
# endif
|
||||
_GL_CXXALIASWARN (malloc);
|
||||
#elif defined GNULIB_POSIXCHECK && !_GL_USE_STDLIB_ALLOC
|
||||
# undef malloc
|
||||
/* Assume malloc is always declared. */
|
||||
_GL_WARN_ON_USE (malloc, "malloc is not POSIX compliant everywhere - "
|
||||
"use gnulib module malloc-posix for portability");
|
||||
#endif
|
||||
|
||||
/* Convert a multibyte character to a wide character. */
|
||||
#if @GNULIB_MBTOWC@
|
||||
# if @REPLACE_MBTOWC@
|
||||
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
||||
# undef mbtowc
|
||||
# define mbtowc rpl_mbtowc
|
||||
# endif
|
||||
_GL_FUNCDECL_RPL (mbtowc, int, (wchar_t *pwc, const char *s, size_t n));
|
||||
_GL_CXXALIAS_RPL (mbtowc, int, (wchar_t *pwc, const char *s, size_t n));
|
||||
# else
|
||||
_GL_CXXALIAS_SYS (mbtowc, int, (wchar_t *pwc, const char *s, size_t n));
|
||||
# endif
|
||||
_GL_CXXALIASWARN (mbtowc);
|
||||
#endif
|
||||
|
||||
#if @GNULIB_MKDTEMP@
|
||||
/* Create a unique temporary directory from TEMPLATE.
|
||||
The last six characters of TEMPLATE must be "XXXXXX";
|
||||
they are replaced with a string that makes the directory name unique.
|
||||
Returns TEMPLATE, or a null pointer if it cannot get a unique name.
|
||||
The directory is created mode 700. */
|
||||
# if !@HAVE_MKDTEMP@
|
||||
_GL_FUNCDECL_SYS (mkdtemp, char *, (char * /*template*/) _GL_ARG_NONNULL ((1)));
|
||||
# endif
|
||||
_GL_CXXALIAS_SYS (mkdtemp, char *, (char * /*template*/));
|
||||
_GL_CXXALIASWARN (mkdtemp);
|
||||
#elif defined GNULIB_POSIXCHECK
|
||||
# undef mkdtemp
|
||||
# if HAVE_RAW_DECL_MKDTEMP
|
||||
_GL_WARN_ON_USE (mkdtemp, "mkdtemp is unportable - "
|
||||
"use gnulib module mkdtemp for portability");
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if @GNULIB_MKOSTEMP@
|
||||
/* Create a unique temporary file from TEMPLATE.
|
||||
The last six characters of TEMPLATE must be "XXXXXX";
|
||||
they are replaced with a string that makes the file name unique.
|
||||
The flags are a bitmask, possibly including O_CLOEXEC (defined in <fcntl.h>)
|
||||
and O_TEXT, O_BINARY (defined in "binary-io.h").
|
||||
The file is then created, with the specified flags, ensuring it didn't exist
|
||||
before.
|
||||
The file is created read-write (mask at least 0600 & ~umask), but it may be
|
||||
world-readable and world-writable (mask 0666 & ~umask), depending on the
|
||||
implementation.
|
||||
Returns the open file descriptor if successful, otherwise -1 and errno
|
||||
set. */
|
||||
# if !@HAVE_MKOSTEMP@
|
||||
_GL_FUNCDECL_SYS (mkostemp, int, (char * /*template*/, int /*flags*/)
|
||||
_GL_ARG_NONNULL ((1)));
|
||||
# endif
|
||||
_GL_CXXALIAS_SYS (mkostemp, int, (char * /*template*/, int /*flags*/));
|
||||
_GL_CXXALIASWARN (mkostemp);
|
||||
#elif defined GNULIB_POSIXCHECK
|
||||
# undef mkostemp
|
||||
# if HAVE_RAW_DECL_MKOSTEMP
|
||||
_GL_WARN_ON_USE (mkostemp, "mkostemp is unportable - "
|
||||
"use gnulib module mkostemp for portability");
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if @GNULIB_MKOSTEMPS@
|
||||
/* Create a unique temporary file from TEMPLATE.
|
||||
The last six characters of TEMPLATE before a suffix of length
|
||||
SUFFIXLEN must be "XXXXXX";
|
||||
they are replaced with a string that makes the file name unique.
|
||||
The flags are a bitmask, possibly including O_CLOEXEC (defined in <fcntl.h>)
|
||||
and O_TEXT, O_BINARY (defined in "binary-io.h").
|
||||
The file is then created, with the specified flags, ensuring it didn't exist
|
||||
before.
|
||||
The file is created read-write (mask at least 0600 & ~umask), but it may be
|
||||
world-readable and world-writable (mask 0666 & ~umask), depending on the
|
||||
implementation.
|
||||
Returns the open file descriptor if successful, otherwise -1 and errno
|
||||
set. */
|
||||
# if !@HAVE_MKOSTEMPS@
|
||||
_GL_FUNCDECL_SYS (mkostemps, int,
|
||||
(char * /*template*/, int /*suffixlen*/, int /*flags*/)
|
||||
_GL_ARG_NONNULL ((1)));
|
||||
# endif
|
||||
_GL_CXXALIAS_SYS (mkostemps, int,
|
||||
(char * /*template*/, int /*suffixlen*/, int /*flags*/));
|
||||
_GL_CXXALIASWARN (mkostemps);
|
||||
#elif defined GNULIB_POSIXCHECK
|
||||
# undef mkostemps
|
||||
# if HAVE_RAW_DECL_MKOSTEMPS
|
||||
_GL_WARN_ON_USE (mkostemps, "mkostemps is unportable - "
|
||||
"use gnulib module mkostemps for portability");
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if @GNULIB_MKSTEMP@
|
||||
/* Create a unique temporary file from TEMPLATE.
|
||||
The last six characters of TEMPLATE must be "XXXXXX";
|
||||
they are replaced with a string that makes the file name unique.
|
||||
The file is then created, ensuring it didn't exist before.
|
||||
The file is created read-write (mask at least 0600 & ~umask), but it may be
|
||||
world-readable and world-writable (mask 0666 & ~umask), depending on the
|
||||
implementation.
|
||||
Returns the open file descriptor if successful, otherwise -1 and errno
|
||||
set. */
|
||||
# if @REPLACE_MKSTEMP@
|
||||
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
||||
# define mkstemp rpl_mkstemp
|
||||
# endif
|
||||
_GL_FUNCDECL_RPL (mkstemp, int, (char * /*template*/) _GL_ARG_NONNULL ((1)));
|
||||
_GL_CXXALIAS_RPL (mkstemp, int, (char * /*template*/));
|
||||
# else
|
||||
# if ! @HAVE_MKSTEMP@
|
||||
_GL_FUNCDECL_SYS (mkstemp, int, (char * /*template*/) _GL_ARG_NONNULL ((1)));
|
||||
# endif
|
||||
_GL_CXXALIAS_SYS (mkstemp, int, (char * /*template*/));
|
||||
# endif
|
||||
_GL_CXXALIASWARN (mkstemp);
|
||||
#elif defined GNULIB_POSIXCHECK
|
||||
# undef mkstemp
|
||||
# if HAVE_RAW_DECL_MKSTEMP
|
||||
_GL_WARN_ON_USE (mkstemp, "mkstemp is unportable - "
|
||||
"use gnulib module mkstemp for portability");
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if @GNULIB_MKSTEMPS@
|
||||
/* Create a unique temporary file from TEMPLATE.
|
||||
The last six characters of TEMPLATE prior to a suffix of length
|
||||
SUFFIXLEN must be "XXXXXX";
|
||||
they are replaced with a string that makes the file name unique.
|
||||
The file is then created, ensuring it didn't exist before.
|
||||
The file is created read-write (mask at least 0600 & ~umask), but it may be
|
||||
world-readable and world-writable (mask 0666 & ~umask), depending on the
|
||||
implementation.
|
||||
Returns the open file descriptor if successful, otherwise -1 and errno
|
||||
set. */
|
||||
# if !@HAVE_MKSTEMPS@
|
||||
_GL_FUNCDECL_SYS (mkstemps, int, (char * /*template*/, int /*suffixlen*/)
|
||||
_GL_ARG_NONNULL ((1)));
|
||||
# endif
|
||||
_GL_CXXALIAS_SYS (mkstemps, int, (char * /*template*/, int /*suffixlen*/));
|
||||
_GL_CXXALIASWARN (mkstemps);
|
||||
#elif defined GNULIB_POSIXCHECK
|
||||
# undef mkstemps
|
||||
# if HAVE_RAW_DECL_MKSTEMPS
|
||||
_GL_WARN_ON_USE (mkstemps, "mkstemps is unportable - "
|
||||
"use gnulib module mkstemps for portability");
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if @GNULIB_POSIX_OPENPT@
|
||||
/* Return an FD open to the master side of a pseudo-terminal. Flags should
|
||||
include O_RDWR, and may also include O_NOCTTY. */
|
||||
# if !@HAVE_POSIX_OPENPT@
|
||||
_GL_FUNCDECL_SYS (posix_openpt, int, (int flags));
|
||||
# endif
|
||||
_GL_CXXALIAS_SYS (posix_openpt, int, (int flags));
|
||||
_GL_CXXALIASWARN (posix_openpt);
|
||||
#elif defined GNULIB_POSIXCHECK
|
||||
# undef posix_openpt
|
||||
# if HAVE_RAW_DECL_POSIX_OPENPT
|
||||
_GL_WARN_ON_USE (posix_openpt, "posix_openpt is not portable - "
|
||||
"use gnulib module posix_openpt for portability");
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if @GNULIB_PTSNAME@
|
||||
/* Return the pathname of the pseudo-terminal slave associated with
|
||||
the master FD is open on, or NULL on errors. */
|
||||
# if @REPLACE_PTSNAME@
|
||||
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
||||
# undef ptsname
|
||||
# define ptsname rpl_ptsname
|
||||
# endif
|
||||
_GL_FUNCDECL_RPL (ptsname, char *, (int fd));
|
||||
_GL_CXXALIAS_RPL (ptsname, char *, (int fd));
|
||||
# else
|
||||
# if !@HAVE_PTSNAME@
|
||||
_GL_FUNCDECL_SYS (ptsname, char *, (int fd));
|
||||
# endif
|
||||
_GL_CXXALIAS_SYS (ptsname, char *, (int fd));
|
||||
# endif
|
||||
_GL_CXXALIASWARN (ptsname);
|
||||
#elif defined GNULIB_POSIXCHECK
|
||||
# undef ptsname
|
||||
# if HAVE_RAW_DECL_PTSNAME
|
||||
_GL_WARN_ON_USE (ptsname, "ptsname is not portable - "
|
||||
"use gnulib module ptsname for portability");
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if @GNULIB_PTSNAME_R@
|
||||
/* Set the pathname of the pseudo-terminal slave associated with
|
||||
the master FD is open on and return 0, or set errno and return
|
||||
non-zero on errors. */
|
||||
# if @REPLACE_PTSNAME_R@
|
||||
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
||||
# undef ptsname_r
|
||||
# define ptsname_r rpl_ptsname_r
|
||||
# endif
|
||||
_GL_FUNCDECL_RPL (ptsname_r, int, (int fd, char *buf, size_t len));
|
||||
_GL_CXXALIAS_RPL (ptsname_r, int, (int fd, char *buf, size_t len));
|
||||
# else
|
||||
# if !@HAVE_PTSNAME_R@
|
||||
_GL_FUNCDECL_SYS (ptsname_r, int, (int fd, char *buf, size_t len));
|
||||
# endif
|
||||
_GL_CXXALIAS_SYS (ptsname_r, int, (int fd, char *buf, size_t len));
|
||||
# endif
|
||||
_GL_CXXALIASWARN (ptsname_r);
|
||||
#elif defined GNULIB_POSIXCHECK
|
||||
# undef ptsname_r
|
||||
# if HAVE_RAW_DECL_PTSNAME_R
|
||||
_GL_WARN_ON_USE (ptsname_r, "ptsname_r is not portable - "
|
||||
"use gnulib module ptsname_r for portability");
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if @GNULIB_PUTENV@
|
||||
# if @REPLACE_PUTENV@
|
||||
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
||||
# undef putenv
|
||||
# define putenv rpl_putenv
|
||||
# endif
|
||||
_GL_FUNCDECL_RPL (putenv, int, (char *string) _GL_ARG_NONNULL ((1)));
|
||||
_GL_CXXALIAS_RPL (putenv, int, (char *string));
|
||||
# else
|
||||
_GL_CXXALIAS_SYS (putenv, int, (char *string));
|
||||
# endif
|
||||
_GL_CXXALIASWARN (putenv);
|
||||
#endif
|
||||
|
||||
|
||||
#if @GNULIB_RANDOM_R@
|
||||
# if !@HAVE_RANDOM_R@
|
||||
# ifndef RAND_MAX
|
||||
# define RAND_MAX 2147483647
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
|
||||
#if @GNULIB_RANDOM@
|
||||
# if !@HAVE_RANDOM@
|
||||
_GL_FUNCDECL_SYS (random, long, (void));
|
||||
# endif
|
||||
_GL_CXXALIAS_SYS (random, long, (void));
|
||||
_GL_CXXALIASWARN (random);
|
||||
#elif defined GNULIB_POSIXCHECK
|
||||
# undef random
|
||||
# if HAVE_RAW_DECL_RANDOM
|
||||
_GL_WARN_ON_USE (random, "random is unportable - "
|
||||
"use gnulib module random for portability");
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if @GNULIB_RANDOM@
|
||||
# if !@HAVE_RANDOM@
|
||||
_GL_FUNCDECL_SYS (srandom, void, (unsigned int seed));
|
||||
# endif
|
||||
_GL_CXXALIAS_SYS (srandom, void, (unsigned int seed));
|
||||
_GL_CXXALIASWARN (srandom);
|
||||
#elif defined GNULIB_POSIXCHECK
|
||||
# undef srandom
|
||||
# if HAVE_RAW_DECL_SRANDOM
|
||||
_GL_WARN_ON_USE (srandom, "srandom is unportable - "
|
||||
"use gnulib module random for portability");
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if @GNULIB_RANDOM@
|
||||
# if !@HAVE_RANDOM@
|
||||
_GL_FUNCDECL_SYS (initstate, char *,
|
||||
(unsigned int seed, char *buf, size_t buf_size)
|
||||
_GL_ARG_NONNULL ((2)));
|
||||
# endif
|
||||
_GL_CXXALIAS_SYS (initstate, char *,
|
||||
(unsigned int seed, char *buf, size_t buf_size));
|
||||
_GL_CXXALIASWARN (initstate);
|
||||
#elif defined GNULIB_POSIXCHECK
|
||||
# undef initstate
|
||||
# if HAVE_RAW_DECL_INITSTATE_R
|
||||
_GL_WARN_ON_USE (initstate, "initstate is unportable - "
|
||||
"use gnulib module random for portability");
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if @GNULIB_RANDOM@
|
||||
# if !@HAVE_RANDOM@
|
||||
_GL_FUNCDECL_SYS (setstate, char *, (char *arg_state) _GL_ARG_NONNULL ((1)));
|
||||
# endif
|
||||
_GL_CXXALIAS_SYS (setstate, char *, (char *arg_state));
|
||||
_GL_CXXALIASWARN (setstate);
|
||||
#elif defined GNULIB_POSIXCHECK
|
||||
# undef setstate
|
||||
# if HAVE_RAW_DECL_SETSTATE_R
|
||||
_GL_WARN_ON_USE (setstate, "setstate is unportable - "
|
||||
"use gnulib module random for portability");
|
||||
# endif
|
||||
#endif
|
||||
|
||||
|
||||
#if @GNULIB_RANDOM_R@
|
||||
# if @REPLACE_RANDOM_R@
|
||||
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
||||
# undef random_r
|
||||
# define random_r rpl_random_r
|
||||
# endif
|
||||
_GL_FUNCDECL_RPL (random_r, int, (struct random_data *buf, int32_t *result)
|
||||
_GL_ARG_NONNULL ((1, 2)));
|
||||
_GL_CXXALIAS_RPL (random_r, int, (struct random_data *buf, int32_t *result));
|
||||
# else
|
||||
# if !@HAVE_RANDOM_R@
|
||||
_GL_FUNCDECL_SYS (random_r, int, (struct random_data *buf, int32_t *result)
|
||||
_GL_ARG_NONNULL ((1, 2)));
|
||||
# endif
|
||||
_GL_CXXALIAS_SYS (random_r, int, (struct random_data *buf, int32_t *result));
|
||||
# endif
|
||||
_GL_CXXALIASWARN (random_r);
|
||||
#elif defined GNULIB_POSIXCHECK
|
||||
# undef random_r
|
||||
# if HAVE_RAW_DECL_RANDOM_R
|
||||
_GL_WARN_ON_USE (random_r, "random_r is unportable - "
|
||||
"use gnulib module random_r for portability");
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if @GNULIB_RANDOM_R@
|
||||
# if @REPLACE_RANDOM_R@
|
||||
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
||||
# undef srandom_r
|
||||
# define srandom_r rpl_srandom_r
|
||||
# endif
|
||||
_GL_FUNCDECL_RPL (srandom_r, int,
|
||||
(unsigned int seed, struct random_data *rand_state)
|
||||
_GL_ARG_NONNULL ((2)));
|
||||
_GL_CXXALIAS_RPL (srandom_r, int,
|
||||
(unsigned int seed, struct random_data *rand_state));
|
||||
# else
|
||||
# if !@HAVE_RANDOM_R@
|
||||
_GL_FUNCDECL_SYS (srandom_r, int,
|
||||
(unsigned int seed, struct random_data *rand_state)
|
||||
_GL_ARG_NONNULL ((2)));
|
||||
# endif
|
||||
_GL_CXXALIAS_SYS (srandom_r, int,
|
||||
(unsigned int seed, struct random_data *rand_state));
|
||||
# endif
|
||||
_GL_CXXALIASWARN (srandom_r);
|
||||
#elif defined GNULIB_POSIXCHECK
|
||||
# undef srandom_r
|
||||
# if HAVE_RAW_DECL_SRANDOM_R
|
||||
_GL_WARN_ON_USE (srandom_r, "srandom_r is unportable - "
|
||||
"use gnulib module random_r for portability");
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if @GNULIB_RANDOM_R@
|
||||
# if @REPLACE_RANDOM_R@
|
||||
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
||||
# undef initstate_r
|
||||
# define initstate_r rpl_initstate_r
|
||||
# endif
|
||||
_GL_FUNCDECL_RPL (initstate_r, int,
|
||||
(unsigned int seed, char *buf, size_t buf_size,
|
||||
struct random_data *rand_state)
|
||||
_GL_ARG_NONNULL ((2, 4)));
|
||||
_GL_CXXALIAS_RPL (initstate_r, int,
|
||||
(unsigned int seed, char *buf, size_t buf_size,
|
||||
struct random_data *rand_state));
|
||||
# else
|
||||
# if !@HAVE_RANDOM_R@
|
||||
_GL_FUNCDECL_SYS (initstate_r, int,
|
||||
(unsigned int seed, char *buf, size_t buf_size,
|
||||
struct random_data *rand_state)
|
||||
_GL_ARG_NONNULL ((2, 4)));
|
||||
# endif
|
||||
_GL_CXXALIAS_SYS (initstate_r, int,
|
||||
(unsigned int seed, char *buf, size_t buf_size,
|
||||
struct random_data *rand_state));
|
||||
# endif
|
||||
_GL_CXXALIASWARN (initstate_r);
|
||||
#elif defined GNULIB_POSIXCHECK
|
||||
# undef initstate_r
|
||||
# if HAVE_RAW_DECL_INITSTATE_R
|
||||
_GL_WARN_ON_USE (initstate_r, "initstate_r is unportable - "
|
||||
"use gnulib module random_r for portability");
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if @GNULIB_RANDOM_R@
|
||||
# if @REPLACE_RANDOM_R@
|
||||
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
||||
# undef setstate_r
|
||||
# define setstate_r rpl_setstate_r
|
||||
# endif
|
||||
_GL_FUNCDECL_RPL (setstate_r, int,
|
||||
(char *arg_state, struct random_data *rand_state)
|
||||
_GL_ARG_NONNULL ((1, 2)));
|
||||
_GL_CXXALIAS_RPL (setstate_r, int,
|
||||
(char *arg_state, struct random_data *rand_state));
|
||||
# else
|
||||
# if !@HAVE_RANDOM_R@
|
||||
_GL_FUNCDECL_SYS (setstate_r, int,
|
||||
(char *arg_state, struct random_data *rand_state)
|
||||
_GL_ARG_NONNULL ((1, 2)));
|
||||
# endif
|
||||
_GL_CXXALIAS_SYS (setstate_r, int,
|
||||
(char *arg_state, struct random_data *rand_state));
|
||||
# endif
|
||||
_GL_CXXALIASWARN (setstate_r);
|
||||
#elif defined GNULIB_POSIXCHECK
|
||||
# undef setstate_r
|
||||
# if HAVE_RAW_DECL_SETSTATE_R
|
||||
_GL_WARN_ON_USE (setstate_r, "setstate_r is unportable - "
|
||||
"use gnulib module random_r for portability");
|
||||
# endif
|
||||
#endif
|
||||
|
||||
|
||||
#if @GNULIB_REALLOC_POSIX@
|
||||
# if @REPLACE_REALLOC@
|
||||
# if !((defined __cplusplus && defined GNULIB_NAMESPACE) \
|
||||
|| _GL_USE_STDLIB_ALLOC)
|
||||
# undef realloc
|
||||
# define realloc rpl_realloc
|
||||
# endif
|
||||
_GL_FUNCDECL_RPL (realloc, void *, (void *ptr, size_t size));
|
||||
_GL_CXXALIAS_RPL (realloc, void *, (void *ptr, size_t size));
|
||||
# else
|
||||
_GL_CXXALIAS_SYS (realloc, void *, (void *ptr, size_t size));
|
||||
# endif
|
||||
_GL_CXXALIASWARN (realloc);
|
||||
#elif defined GNULIB_POSIXCHECK && !_GL_USE_STDLIB_ALLOC
|
||||
# undef realloc
|
||||
/* Assume realloc is always declared. */
|
||||
_GL_WARN_ON_USE (realloc, "realloc is not POSIX compliant everywhere - "
|
||||
"use gnulib module realloc-posix for portability");
|
||||
#endif
|
||||
|
||||
#if @GNULIB_REALPATH@
|
||||
# if @REPLACE_REALPATH@
|
||||
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
||||
# define realpath rpl_realpath
|
||||
# endif
|
||||
_GL_FUNCDECL_RPL (realpath, char *, (const char *name, char *resolved)
|
||||
_GL_ARG_NONNULL ((1)));
|
||||
_GL_CXXALIAS_RPL (realpath, char *, (const char *name, char *resolved));
|
||||
# else
|
||||
# if !@HAVE_REALPATH@
|
||||
_GL_FUNCDECL_SYS (realpath, char *, (const char *name, char *resolved)
|
||||
_GL_ARG_NONNULL ((1)));
|
||||
# endif
|
||||
_GL_CXXALIAS_SYS (realpath, char *, (const char *name, char *resolved));
|
||||
# endif
|
||||
_GL_CXXALIASWARN (realpath);
|
||||
#elif defined GNULIB_POSIXCHECK
|
||||
# undef realpath
|
||||
# if HAVE_RAW_DECL_REALPATH
|
||||
_GL_WARN_ON_USE (realpath, "realpath is unportable - use gnulib module "
|
||||
"canonicalize or canonicalize-lgpl for portability");
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if @GNULIB_RPMATCH@
|
||||
/* Test a user response to a question.
|
||||
Return 1 if it is affirmative, 0 if it is negative, or -1 if not clear. */
|
||||
# if !@HAVE_RPMATCH@
|
||||
_GL_FUNCDECL_SYS (rpmatch, int, (const char *response) _GL_ARG_NONNULL ((1)));
|
||||
# endif
|
||||
_GL_CXXALIAS_SYS (rpmatch, int, (const char *response));
|
||||
_GL_CXXALIASWARN (rpmatch);
|
||||
#elif defined GNULIB_POSIXCHECK
|
||||
# undef rpmatch
|
||||
# if HAVE_RAW_DECL_RPMATCH
|
||||
_GL_WARN_ON_USE (rpmatch, "rpmatch is unportable - "
|
||||
"use gnulib module rpmatch for portability");
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if @GNULIB_SECURE_GETENV@
|
||||
/* Look up NAME in the environment, returning 0 in insecure situations. */
|
||||
# if !@HAVE_SECURE_GETENV@
|
||||
_GL_FUNCDECL_SYS (secure_getenv, char *,
|
||||
(char const *name) _GL_ARG_NONNULL ((1)));
|
||||
# endif
|
||||
_GL_CXXALIAS_SYS (secure_getenv, char *, (char const *name));
|
||||
_GL_CXXALIASWARN (secure_getenv);
|
||||
#elif defined GNULIB_POSIXCHECK
|
||||
# undef secure_getenv
|
||||
# if HAVE_RAW_DECL_SECURE_GETENV
|
||||
_GL_WARN_ON_USE (secure_getenv, "secure_getenv is unportable - "
|
||||
"use gnulib module secure_getenv for portability");
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if @GNULIB_SETENV@
|
||||
/* Set NAME to VALUE in the environment.
|
||||
If REPLACE is nonzero, overwrite an existing value. */
|
||||
# if @REPLACE_SETENV@
|
||||
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
||||
# undef setenv
|
||||
# define setenv rpl_setenv
|
||||
# endif
|
||||
_GL_FUNCDECL_RPL (setenv, int,
|
||||
(const char *name, const char *value, int replace)
|
||||
_GL_ARG_NONNULL ((1)));
|
||||
_GL_CXXALIAS_RPL (setenv, int,
|
||||
(const char *name, const char *value, int replace));
|
||||
# else
|
||||
# if !@HAVE_DECL_SETENV@
|
||||
_GL_FUNCDECL_SYS (setenv, int,
|
||||
(const char *name, const char *value, int replace)
|
||||
_GL_ARG_NONNULL ((1)));
|
||||
# endif
|
||||
_GL_CXXALIAS_SYS (setenv, int,
|
||||
(const char *name, const char *value, int replace));
|
||||
# endif
|
||||
# if !(@REPLACE_SETENV@ && !@HAVE_DECL_SETENV@)
|
||||
_GL_CXXALIASWARN (setenv);
|
||||
# endif
|
||||
#elif defined GNULIB_POSIXCHECK
|
||||
# undef setenv
|
||||
# if HAVE_RAW_DECL_SETENV
|
||||
_GL_WARN_ON_USE (setenv, "setenv is unportable - "
|
||||
"use gnulib module setenv for portability");
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if @GNULIB_STRTOD@
|
||||
/* Parse a double from STRING, updating ENDP if appropriate. */
|
||||
# if @REPLACE_STRTOD@
|
||||
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
||||
# define strtod rpl_strtod
|
||||
# endif
|
||||
_GL_FUNCDECL_RPL (strtod, double, (const char *str, char **endp)
|
||||
_GL_ARG_NONNULL ((1)));
|
||||
_GL_CXXALIAS_RPL (strtod, double, (const char *str, char **endp));
|
||||
# else
|
||||
# if !@HAVE_STRTOD@
|
||||
_GL_FUNCDECL_SYS (strtod, double, (const char *str, char **endp)
|
||||
_GL_ARG_NONNULL ((1)));
|
||||
# endif
|
||||
_GL_CXXALIAS_SYS (strtod, double, (const char *str, char **endp));
|
||||
# endif
|
||||
_GL_CXXALIASWARN (strtod);
|
||||
#elif defined GNULIB_POSIXCHECK
|
||||
# undef strtod
|
||||
# if HAVE_RAW_DECL_STRTOD
|
||||
_GL_WARN_ON_USE (strtod, "strtod is unportable - "
|
||||
"use gnulib module strtod for portability");
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if @GNULIB_STRTOLL@
|
||||
/* Parse a signed integer whose textual representation starts at STRING.
|
||||
The integer is expected to be in base BASE (2 <= BASE <= 36); if BASE == 0,
|
||||
it may be decimal or octal (with prefix "0") or hexadecimal (with prefix
|
||||
"0x").
|
||||
If ENDPTR is not NULL, the address of the first byte after the integer is
|
||||
stored in *ENDPTR.
|
||||
Upon overflow, the return value is LLONG_MAX or LLONG_MIN, and errno is set
|
||||
to ERANGE. */
|
||||
# if !@HAVE_STRTOLL@
|
||||
_GL_FUNCDECL_SYS (strtoll, long long,
|
||||
(const char *string, char **endptr, int base)
|
||||
_GL_ARG_NONNULL ((1)));
|
||||
# endif
|
||||
_GL_CXXALIAS_SYS (strtoll, long long,
|
||||
(const char *string, char **endptr, int base));
|
||||
_GL_CXXALIASWARN (strtoll);
|
||||
#elif defined GNULIB_POSIXCHECK
|
||||
# undef strtoll
|
||||
# if HAVE_RAW_DECL_STRTOLL
|
||||
_GL_WARN_ON_USE (strtoll, "strtoll is unportable - "
|
||||
"use gnulib module strtoll for portability");
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if @GNULIB_STRTOULL@
|
||||
/* Parse an unsigned integer whose textual representation starts at STRING.
|
||||
The integer is expected to be in base BASE (2 <= BASE <= 36); if BASE == 0,
|
||||
it may be decimal or octal (with prefix "0") or hexadecimal (with prefix
|
||||
"0x").
|
||||
If ENDPTR is not NULL, the address of the first byte after the integer is
|
||||
stored in *ENDPTR.
|
||||
Upon overflow, the return value is ULLONG_MAX, and errno is set to
|
||||
ERANGE. */
|
||||
# if !@HAVE_STRTOULL@
|
||||
_GL_FUNCDECL_SYS (strtoull, unsigned long long,
|
||||
(const char *string, char **endptr, int base)
|
||||
_GL_ARG_NONNULL ((1)));
|
||||
# endif
|
||||
_GL_CXXALIAS_SYS (strtoull, unsigned long long,
|
||||
(const char *string, char **endptr, int base));
|
||||
_GL_CXXALIASWARN (strtoull);
|
||||
#elif defined GNULIB_POSIXCHECK
|
||||
# undef strtoull
|
||||
# if HAVE_RAW_DECL_STRTOULL
|
||||
_GL_WARN_ON_USE (strtoull, "strtoull is unportable - "
|
||||
"use gnulib module strtoull for portability");
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if @GNULIB_UNLOCKPT@
|
||||
/* Unlock the slave side of the pseudo-terminal whose master side is specified
|
||||
by FD, so that it can be opened. */
|
||||
# if !@HAVE_UNLOCKPT@
|
||||
_GL_FUNCDECL_SYS (unlockpt, int, (int fd));
|
||||
# endif
|
||||
_GL_CXXALIAS_SYS (unlockpt, int, (int fd));
|
||||
_GL_CXXALIASWARN (unlockpt);
|
||||
#elif defined GNULIB_POSIXCHECK
|
||||
# undef unlockpt
|
||||
# if HAVE_RAW_DECL_UNLOCKPT
|
||||
_GL_WARN_ON_USE (unlockpt, "unlockpt is not portable - "
|
||||
"use gnulib module unlockpt for portability");
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if @GNULIB_UNSETENV@
|
||||
/* Remove the variable NAME from the environment. */
|
||||
# if @REPLACE_UNSETENV@
|
||||
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
||||
# undef unsetenv
|
||||
# define unsetenv rpl_unsetenv
|
||||
# endif
|
||||
_GL_FUNCDECL_RPL (unsetenv, int, (const char *name) _GL_ARG_NONNULL ((1)));
|
||||
_GL_CXXALIAS_RPL (unsetenv, int, (const char *name));
|
||||
# else
|
||||
# if !@HAVE_DECL_UNSETENV@
|
||||
_GL_FUNCDECL_SYS (unsetenv, int, (const char *name) _GL_ARG_NONNULL ((1)));
|
||||
# endif
|
||||
_GL_CXXALIAS_SYS (unsetenv, int, (const char *name));
|
||||
# endif
|
||||
# if !(@REPLACE_UNSETENV@ && !@HAVE_DECL_UNSETENV@)
|
||||
_GL_CXXALIASWARN (unsetenv);
|
||||
# endif
|
||||
#elif defined GNULIB_POSIXCHECK
|
||||
# undef unsetenv
|
||||
# if HAVE_RAW_DECL_UNSETENV
|
||||
_GL_WARN_ON_USE (unsetenv, "unsetenv is unportable - "
|
||||
"use gnulib module unsetenv for portability");
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* Convert a wide character to a multibyte character. */
|
||||
#if @GNULIB_WCTOMB@
|
||||
# if @REPLACE_WCTOMB@
|
||||
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
||||
# undef wctomb
|
||||
# define wctomb rpl_wctomb
|
||||
# endif
|
||||
_GL_FUNCDECL_RPL (wctomb, int, (char *s, wchar_t wc));
|
||||
_GL_CXXALIAS_RPL (wctomb, int, (char *s, wchar_t wc));
|
||||
# else
|
||||
_GL_CXXALIAS_SYS (wctomb, int, (char *s, wchar_t wc));
|
||||
# endif
|
||||
_GL_CXXALIASWARN (wctomb);
|
||||
#endif
|
||||
|
||||
|
||||
#endif /* _@GUARD_PREFIX@_STDLIB_H */
|
||||
#endif /* _@GUARD_PREFIX@_STDLIB_H */
|
||||
#endif
|
||||
@@ -110,6 +110,7 @@
|
||||
/* Get getopt(), optarg, optind, opterr, optopt.
|
||||
But avoid namespace pollution on glibc systems. */
|
||||
#if @GNULIB_UNISTD_H_GETOPT@ && !defined __GLIBC__ && !defined _GL_SYSTEM_GETOPT
|
||||
# define __need_getopt
|
||||
# include <getopt.h>
|
||||
#endif
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ ocserv_SOURCES = main.c main-auth.c worker-vpn.c worker-auth.c tlslib.c \
|
||||
vpn.h cookies.h tlslib.h http-parser/http_parser.h log.c tun.c tun.h \
|
||||
config.c pam.c pam.h worker-resume.c worker.h main-resume.c main.h \
|
||||
main-user.c cookies-gdbm.c cookies-hash.c worker-misc.c setproctitle.h \
|
||||
setproctitle.c worker-privs.c \
|
||||
setproctitle.c worker-privs.c plain.c plain.h \
|
||||
$(CCAN_SOURCES)
|
||||
|
||||
ocserv_SOURCES += ocserv-args.def ocserv-args.c ocserv-args.h
|
||||
|
||||
11
src/config.c
11
src/config.c
@@ -127,6 +127,16 @@ unsigned j;
|
||||
fprintf(stderr, "PAM support is disabled\n");
|
||||
exit(1);
|
||||
#endif
|
||||
} else if (strncasecmp(auth[j], "plain[", 6) == 0) {
|
||||
char* p;
|
||||
config->plain_passwd = strdup(auth[j]+6);
|
||||
p = strchr(config->plain_passwd, ']');
|
||||
if (p == NULL) {
|
||||
fprintf(stderr, "Format error in %s\n", auth[j]);
|
||||
exit(1);
|
||||
}
|
||||
*p = 0;
|
||||
config->auth_types |= AUTH_TYPE_PLAIN;
|
||||
} else if (strcasecmp(auth[j], "certificate") == 0) {
|
||||
config->auth_types |= AUTH_TYPE_CERTIFICATE;
|
||||
} else {
|
||||
@@ -336,6 +346,7 @@ unsigned i;
|
||||
DEL(config->xml_config_hash);
|
||||
DEL(config->cert_hash);
|
||||
#endif
|
||||
DEL(config->plain_passwd);
|
||||
DEL(config->ocsp_response);
|
||||
DEL(config->banner);
|
||||
DEL(config->dh_params_file);
|
||||
|
||||
@@ -42,6 +42,7 @@
|
||||
#include <main.h>
|
||||
#include <ccan/list/list.h>
|
||||
#include "pam.h"
|
||||
#include "plain.h"
|
||||
|
||||
int send_auth_reply(main_server_st* s, struct proc_st* proc,
|
||||
cmd_auth_reply_t r, struct lease_st* lease)
|
||||
@@ -206,16 +207,26 @@ int handle_auth_req(main_server_st *s, struct proc_st* proc,
|
||||
int ret = -1;
|
||||
unsigned username_set = 0;
|
||||
|
||||
if (req->user_pass_present != 0) {
|
||||
#ifdef HAVE_PAM
|
||||
if (req->user_pass_present != 0 && s->config->auth_types & AUTH_TYPE_PAM) {
|
||||
ret = pam_auth_user(req->user, req->pass, proc->groupname, sizeof(proc->groupname));
|
||||
if (ret != 0)
|
||||
ret = -1;
|
||||
if ((s->config->auth_types & AUTH_TYPE_PAM) == AUTH_TYPE_PAM) {
|
||||
ret = pam_auth_user(req->user, req->pass, proc->groupname, sizeof(proc->groupname));
|
||||
if (ret != 0)
|
||||
ret = -1;
|
||||
|
||||
memcpy(proc->username, req->user, MAX_USERNAME_SIZE);
|
||||
username_set = 1;
|
||||
}
|
||||
memcpy(proc->username, req->user, MAX_USERNAME_SIZE);
|
||||
username_set = 1;
|
||||
}
|
||||
#endif
|
||||
if ((s->config->auth_types & AUTH_TYPE_PLAIN) == AUTH_TYPE_PLAIN) {
|
||||
ret = plain_auth_user(s->config->plain_passwd, req->user, req->pass, proc->groupname, sizeof(proc->groupname));
|
||||
if (ret != 0)
|
||||
ret = -1;
|
||||
|
||||
memcpy(proc->username, req->user, MAX_USERNAME_SIZE);
|
||||
username_set = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (s->config->auth_types & AUTH_TYPE_CERTIFICATE) {
|
||||
if (req->tls_auth_ok != 0) {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
*
|
||||
* DO NOT EDIT THIS FILE (ocserv-args.c)
|
||||
*
|
||||
* It has been AutoGen-ed March 7, 2013 at 10:43:26 AM by AutoGen 5.16
|
||||
* It has been AutoGen-ed March 12, 2013 at 11:39:41 PM by AutoGen 5.16
|
||||
* From the definitions ocserv-args.def
|
||||
* and the template file options
|
||||
*
|
||||
|
||||
@@ -75,10 +75,16 @@ An example configuration file follows.
|
||||
|
||||
# User authentication method. Could be set multiple times and in
|
||||
# that case all should succeed. To enable multiple methods use
|
||||
# multiple auth directives. Available options: certificate, pam.
|
||||
# multiple auth directives. Available options: certificate, plain, pam.
|
||||
#auth = "certificate"
|
||||
auth = "pam"
|
||||
|
||||
# The plain option requires specifying a password file which contains
|
||||
# entries of the following format.
|
||||
# "username:groupname:password"
|
||||
# One entry must be listed per line.
|
||||
#auth = "plain[/etc/ocserv-passwd]"
|
||||
|
||||
# A banner to be displayed on clients
|
||||
#banner = "Welcome"
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
*
|
||||
* DO NOT EDIT THIS FILE (ocserv-args.h)
|
||||
*
|
||||
* It has been AutoGen-ed March 7, 2013 at 10:43:26 AM by AutoGen 5.16
|
||||
* It has been AutoGen-ed March 12, 2013 at 11:39:41 PM by AutoGen 5.16
|
||||
* From the definitions ocserv-args.def
|
||||
* and the template file options
|
||||
*
|
||||
|
||||
55
src/plain.c
Normal file
55
src/plain.c
Normal file
@@ -0,0 +1,55 @@
|
||||
#include <config.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <syslog.h>
|
||||
#include <plain.h>
|
||||
|
||||
/* Returns 0 if the user is successfully authenticated, and sets the appropriate group name.
|
||||
*/
|
||||
int plain_auth_user(const char* passwd, const char* user, const char* pass, char *groupname, int groupname_size)
|
||||
{
|
||||
FILE* fp;
|
||||
char * line = NULL;
|
||||
size_t len, ll;
|
||||
char* p;
|
||||
int ret;
|
||||
|
||||
fp = fopen(passwd, "r");
|
||||
if (fp == NULL) {
|
||||
syslog(LOG_AUTH, "error in plain authentication; cannot open: %s", passwd);
|
||||
return -1;
|
||||
}
|
||||
|
||||
while((ll=getline(&line, &len, fp)) > 0) {
|
||||
if (ll <= 2)
|
||||
continue;
|
||||
|
||||
if (line[ll-1] == '\n')
|
||||
line[ll-1] = 0;
|
||||
if (line[ll-2] == '\n')
|
||||
line[ll-2] = 0;
|
||||
|
||||
p = strtok(line, ":");
|
||||
|
||||
if (p != NULL && strcmp(user, p) == 0) {
|
||||
p = strtok(NULL, ":");
|
||||
if (p != NULL) {
|
||||
snprintf(groupname, groupname_size, "%s", p);
|
||||
p = strtok(NULL, ":");
|
||||
if (p != NULL && strcmp(pass, p) == 0) {
|
||||
ret = 0;
|
||||
goto exit;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ret = -1;
|
||||
syslog(LOG_AUTH, "error in plain authentication; error in user '%s'", user);
|
||||
exit:
|
||||
fclose(fp);
|
||||
free(line);
|
||||
return ret;
|
||||
}
|
||||
|
||||
6
src/plain.h
Normal file
6
src/plain.h
Normal file
@@ -0,0 +1,6 @@
|
||||
#ifndef PLAIN_H
|
||||
#define PLAIN_H
|
||||
|
||||
int plain_auth_user(const char* passwd, const char* user, const char* pass, char *groupname, int groupname_size);
|
||||
|
||||
#endif
|
||||
@@ -28,6 +28,7 @@ extern int syslog_open;
|
||||
#define AUTH_TYPE_USERNAME_PASS (1<<0)
|
||||
#define AUTH_TYPE_PAM (1<<1 | AUTH_TYPE_USERNAME_PASS)
|
||||
#define AUTH_TYPE_CERTIFICATE (1<<2)
|
||||
#define AUTH_TYPE_PLAIN (1<<3 | AUTH_TYPE_USERNAME_PASS)
|
||||
|
||||
typedef struct
|
||||
{
|
||||
@@ -70,6 +71,7 @@ struct cfg_st {
|
||||
char *cert_user_oid; /* The OID that will be used to extract the username */
|
||||
char *cert_group_oid; /* The OID that will be used to extract the groupname */
|
||||
unsigned int auth_types; /* or'ed sequence of AUTH_TYPE */
|
||||
char *plain_passwd; /* the password file in plain auth mode */
|
||||
gnutls_certificate_request_t cert_req;
|
||||
char *priorities;
|
||||
char *chroot_dir; /* where the xml files are served from */
|
||||
|
||||
Reference in New Issue
Block a user