+2010-10-23 Bruno Haible <bruno@clisp.org>
+
+ nl_langinfo: Mention problem with CRNCYSTR on NetBSD 5.0.
+ * doc/posix-functions/nl_langinfo.texi: Mention problem with CRNCYSTR.
+ Reported by Eric Blake.
+
+2010-10-23 Bruno Haible <bruno@clisp.org>
+
+ Tests: Fix LOCALE_JA on MirBSD 10.
+ * m4/locale-ja.m4 (gt_LOCALE_JA): Reject a locale identifier that leads
+ to an UTF-8 locale.
+ * m4/locale-fr.m4 (gt_LOCALE_FR): Likewise.
+ * m4/locale-zh.m4 (gt_LOCALE_ZH_CN): Likewise.
+ Reported by Eric Blake.
+
+2010-10-21 Bruno Haible <bruno@clisp.org>
+
+ nl_langinfo test: Avoid test failure on NetBSD 5.
+ * tests/test-nl_langinfo.c (main): Relax test of nl_langinfo(CRNCYSTR).
+ Reported by Eric Blake.
+
+2010-10-21 Eric Blake <eblake@redhat.com>
+
+ c-stack: work around libsigsegv 2.8 bug
+ * lib/c-stack.c (SIGSTKSZ): Increase size to avoid alternate stack
+ overflow on at least PowerPC64.
+
+2010-10-16 Bruno Haible <bruno@clisp.org>
+
+ nextafter: Fix configure check.
+ * modules/nextafter (configure.ac): Correct expected prototype.
+
+2010-10-16 Bruno Haible <bruno@clisp.org>
+
+ termios: Update documentation.
+ * doc/posix-headers/termios.texi: Mention remaining mingw problems.
+
+2010-10-15 Eric Blake <eblake@redhat.com>
+
+ ignore-value: make header idempotent
+ * lib/ignore-value.h: Add double-inclusion guards.
+ Reported by Stefan Berger.
+
+2010-10-15 Jim Meyering <meyering@redhat.com>
+
+ GNUmakefile: handle "stable" target, not "major"
+ * top/GNUmakefile (_is-dist-target): s/major/stable/ to match the
+ lists in maint.mk and announce-gen. Without this, "make stable"
+ would fail to ensure that $(VERSION) is up to date.
+
+2010-10-14 Bruno Haible <bruno@clisp.org>
+
+ vasnprintf: Don't set errno to 0.
+ * lib/vasnprintf.c (VASNPRINTF): Save and restore errno around the
+ block that sets it to 0.
+ Reported by Gianluigi Tiesi <sherpya@netfarm.it>.
+
+2010-10-14 Bruno Haible <bruno@clisp.org>
+
+ socketlib: Fix.
+ * modules/socketlib (Files): Add m4/sys_socket_h.m4. Needed for
+ gl_PREREQ_SYS_H_WINSOCK2.
+ Reported by Ian Beckwith <ianb@erislabs.net>.
+
+2010-10-13 Eric Blake <eblake@redhat.com>
+
+ termios: fix compilation on mingw
+ * m4/termios_h.m4 (gl_TERMIOS_H_DEFAULTS): Set default.
+ (gl_TERMIOS_H): Adjust it on mingw.
+ * modules/termios (Makefile.am): Substitute new key.
+ * lib/termios.in.h (includes): Make include_next conditional.
+ * doc/posix-headers/termios.texi (termios.h): Update
+ documentation.
+ Reported by Daniel P. Berrange.
+
+2010-10-13 Jim Meyering <meyering@redhat.com>
+
+ test-select: avoid warn_unused_result warnings
+ * tests/test-select.c: Include "macros.h".
+ ASSERT that each call to read, write, and pipe succeeds.
+ While not technically required, also check each "close".
+ * modules/select-tests (Files): Add tests/macros.h.
+
+ test-symlinkat: remove declaration of unused local
+ * tests/test-symlinkat.c (main): Remove unused local, "buf".
+
+ test-inttostr: avoid shadowing warnings
+ * tests/test-inttostr.c (main): Rename local, "buf" to "b",
+ and use malloc rather than the stack for the same reason as
+ mentioned in the comment justifying the other allocation.
+
+2010-10-11 Bruno Haible <bruno@clisp.org>
+
+ stdlib: Allow multiple gnulib generated replacements to coexist.
+ * lib/stdlib.in.h (struct random_data): Avoid identical redefinition.
+ Reported by Sam Steingold <sds@gnu.org>.
+
+2010-10-11 Jim Meyering <meyering@redhat.com>
+
+ fix a documentation typo
+ * doc/posix-functions/futimens.texi (futimens): Fix typo: s/itme/item/
+
+2010-10-11 Eric Blake <eblake@redhat.com>
+
+ futimens: work around Solaris 11 bug
+ * m4/futimens.m4 (gl_FUNC_FUTIMENS): Detect the bug.
+ * tests/test-futimens.h (test_futimens): Enhance, rather than
+ weaken test.
+ * doc/posix-functions/futimens.texi (futimens): Document the bug.
+
+2010-10-11 Paul Eggert <eggert@cs.ucla.edu>
+
+ Indentation.
+ * lib/spawn.in.h (verify_POSIX_SPAWN_USEVFORK_no_overlap): Indent
+ higher-level operators more to the left.
+
+2010-10-11 Jim Meyering <meyering@redhat.com>
+
+ test-futimens: avoid unwarranted test failure on Solaris 5.11
+ * tests/test-futimens.h (test_futimens): When provoking EBADF, use an
+ invalid file descriptor, so we don't provoke EFAULT from Solaris 5.11,
+ because it tries to dereference the NULL name argument.
+
+2010-10-11 Bruno Haible <bruno@clisp.org>
+
+ Indentation.
+ * lib/spawn.in.h (verify_POSIX_SPAWN_USEVFORK_no_overlap): Improve
+ indentation.
+
+2010-10-11 Jim Meyering <meyering@redhat.com>
+
+ spawn.in.h: make indentation consistent with parentheses
+ * lib/spawn.in.h (verify_POSIX_SPAWN_USEVFORK_no_overlap):
+ Make indentation consistent with parentheses.
+
+2010-10-11 Gary V. Vaughan <gary@gnu.org>
+
+ Fix mismatched parens in previous commit
+ * lib/spawn.in.h (verify_POSIX_SPAWN_USEVFORK_no_overlap): Fix mismatched
+ parens.
+
+2010-10-10 Paul Eggert <eggert@cs.ucla.edu>
+
+ rewrite int foo[2*X-1] to verify(X) or to int foo[X?1:-1]
+
+ * lib/float+.h (verify_sizeof_flt, verify_sizeof_dbl):
+ (verify_sizeof_ldbl): Rewrite 2*X-1 to X?1:-1.
+ * lib/malloca.c: Include "verify.h".
+ (verify1): Remove, replacing with a verify call.
+ * lib/relocwrapper.c (verify1): Likewise.
+ * lib/vasnprintf.c (mp_limb_verify, mp_twolimb_verify, TCHAR_T_verify):
+ Likewise.
+ * modules/malloca (Depends-on): Add 'verify'.
+ * modules/relocatable-prog-wrapper (Depends-on): Add 'verify'.
+ * modules/vasnprintf (Depends-on): Add 'verify'.
+ * modules/unistdio/u8-vasnprintf (Depends-on): Likewise.
+ * modules/unistdio/u8-u8-vasnprintf (Depends-on): Likewise.
+ * modules/unistdio/u16-vasnprintf (Depends-on): Likewise.
+ * modules/unistdio/u16-u16-vasnprintf (Depends-on): Likewise.
+ * modules/unistdio/u32-vasnprintf (Depends-on): Likewise.
+ * modules/unistdio/u32-u32-vasnprintf (Depends-on): Likewise.
+ * modules/unistdio/ulc-vasnprintf (Depends-on): Likewise.
+
+ prefer (X ? 1 : -1) when converting from boolean (1,0) to int (1,-1)
+
+ Formerly the style was sometimes 2*X - 1, because the C standard
+ was wrongly thought to disallow ?: in integral constant expressions.
+ * lib/inet_ntop.c (verify_int_size): Rewrite 2*X-7 (!) to 4<=X?1:-1.
+ * lib/signal.in.h (verify_NSIG_constraint): Rewrite 2*X-1 to X?1:-1.
+ * lib/spawn.in.h (verify_POSIX_SPAWN_USEVFORK_no_overlap): Likewise.
+ * lib/stdint.in.h (_verify_intmax_size): Likewise.
+ * lib/time.in.h (struct __time_t_must_be_integral): Rewrite
+ 2 * ((time_t) 1 / 2 == 0) - 1 to (time_t) 1; this suffices to
+ verify that time_t cannot be floating.
+
+2010-10-08 Eric Blake <eblake@redhat.com>
+
+ time: enforce recent POSIX ruling that time_t is integral
+ * lib/time.in.h (__time_t_must_be_integral): Detect any
+ problematic systems, allowing the rest of gnulib to assume POSIX.
+
+2010-10-08 Jim Meyering <meyering@redhat.com>
+
+ fdopendir: fix a bug on systems lacking openat and /proc support
+ OpenBSD 4.7 is one such system. The most noticeable effect was
+ failure of any application making nontrivial use of fts: rm, du,
+ chown, chmod etc. E.g., "mkdir -p a/b; ./rm -rf a" would fail with
+ ./rm: traversal failed: `a': Bad file descriptor
+ Debugging that, you see that even though FD 6 was closed just
+ prior to the opendir call in fd_clone_opendir, its resulting
+ dir->dd_fd was 8, rather than the expected value of 6:
+
+ Breakpoint 3, fdopendir_with_dup (fd=6, older_dupfd=-1) at fdopendir.c:93
+ 93 close (fd);
+ (gdb) n
+ 94 dir = fd_clone_opendir (dupfd);
+ (gdb) n
+ 95 saved_errno = errno;
+ (gdb) p dir->dd_fd
+ $11 = 8
+
+ Notice how it closes FD 6, then gets a DIR* pointer using FD 8.
+ The problem is that on OpenBSD, fd_clone_opendir has to resort
+ to using the old-style save/restore CWD mechanism, due to its
+ lack of openat/proc support, and *that* would steal the FD (6)
+ that opendir was supposed to use.
+
+ The fix is to squirrel away the desired FD so that save_cwd uses a
+ different one, and then free the dest FD right before calling opendir.
+ That guarantees opendir will use the required file descriptor.
+
+ * lib/fdopendir.c (fd_clone_opendir): Handle the above.
+
+2010-10-08 Bruno Haible <bruno@clisp.org>
+
+ sys_select: Avoid warning due to undeclared memset() on OpenBSD 4.5.
+ * lib/sys_select.in.h: Include <string.h> also on OpenBSD.
+
+2010-10-08 Bruno Haible <bruno@clisp.org>
+
+ nanosleep: Make replacement POSIX compliant.
+ * lib/nanosleep.c (nanosleep): Return -1/EINVAL if the delay's tv_nsec
+ is out of range.
+ Reported by Jim Meyering.
+
+2010-10-08 Paul Eggert <eggert@cs.ucla.edu>
+
+ bootstrap: add hook for altering gnulib.mk, for Bison
+ * build-aux/bootstrap (gnulib_mk_hook): New function, so that
+ the Bison bootstrapping process can rewrite file names and variables
+ in this file before later parts of 'bootstrap' use the file.
+ Bison wants to include lib/gnulib.mk from the top-level makefile,
+ so it needs the file names in this file to be relative to the top
+ level, not relative to lib; plus it needs variable names to be
+ rewritten.
+ (slurp): Use the new function.
+
+ bootstrap: reformat for readability
+ * build-aux/bootstrap: Rewrite to avoid lines longer than 80 columns.
+
+2010-10-08 Eric Blake <eblake@redhat.com>
+
+ docs: update cygwin progress
+ * doc/posix-functions/cacos.texi (cacos): Added after cygwin
+ 1.7.7.
+ * doc/posix-functions/cacosf.texi (cacosf): Likewise.
+ * doc/posix-functions/cacosh.texi (cacosh): Likewise.
+ * doc/posix-functions/cacoshf.texi (cacoshf): Likewise.
+ * doc/posix-functions/carg.texi (carg): Likewise.
+ * doc/posix-functions/cargf.texi (cargf): Likewise.
+ * doc/posix-functions/casin.texi (casin): Likewise.
+ * doc/posix-functions/casinf.texi (casinf): Likewise.
+ * doc/posix-functions/casinh.texi (casinh): Likewise.
+ * doc/posix-functions/casinhf.texi (casinhf): Likewise.
+ * doc/posix-functions/catan.texi (catan): Likewise.
+ * doc/posix-functions/catanf.texi (catanf): Likewise.
+ * doc/posix-functions/catanh.texi (catanh): Likewise.
+ * doc/posix-functions/catanhf.texi (catanhf): Likewise.
+ * doc/posix-functions/ccos.texi (ccos): Likewise.
+ * doc/posix-functions/ccosf.texi (ccosf): Likewise.
+ * doc/posix-functions/ccosh.texi (ccosh): Likewise.
+ * doc/posix-functions/ccoshf.texi (ccoshf): Likewise.
+ * doc/posix-functions/cexp.texi (cexp): Likewise.
+ * doc/posix-functions/cexpf.texi (cexpf): Likewise.
+ * doc/posix-functions/cimag.texi (cimag): Likewise.
+ * doc/posix-functions/cimagf.texi (cimagf): Likewise.
+ * doc/posix-functions/clog.texi (clog): Likewise.
+ * doc/posix-functions/clogf.texi (clogf): Likewise.
+ * doc/posix-functions/conj.texi (conj): Likewise.
+ * doc/posix-functions/conjf.texi (conjf): Likewise.
+ * doc/posix-functions/cpow.texi (cpow): Likewise.
+ * doc/posix-functions/cpowf.texi (cpowf): Likewise.
+ * doc/posix-functions/cproj.texi (cproj): Likewise.
+ * doc/posix-functions/cprojf.texi (cprojf): Likewise.
+ * doc/posix-functions/creal.texi (creal): Likewise.
+ * doc/posix-functions/crealf.texi (crealf): Likewise.
+ * doc/posix-functions/csin.texi (csin): Likewise.
+ * doc/posix-functions/csinf.texi (csinf): Likewise.
+ * doc/posix-functions/csinh.texi (csinh): Likewise.
+ * doc/posix-functions/csinhf.texi (csinhf): Likewise.
+ * doc/posix-functions/csqrt.texi (csqrt): Likewise.
+ * doc/posix-functions/csqrtf.texi (csqrtf): Likewise.
+ * doc/posix-functions/ctan.texi (ctan): Likewise.
+ * doc/posix-functions/ctanf.texi (ctanf): Likewise.
+ * doc/posix-functions/ctanh.texi (ctanh): Likewise.
+ * doc/posix-functions/ctanhf.texi (ctanhf): Likewise.
+ * doc/posix-headers/complex.texi (complex.h): Likewise.
+
+2010-10-07 Jim Meyering <meyering@redhat.com>
+
+ parse-datetime: avoid compilation failure on OpenBSD 4.7
+ * lib/parse-datetime.y (_STDLIB_H) [_STDLIB_H_]: Define.
+ This works around a compilation failure on OpenBSD 4.7:
+ http://thread.gmane.org/gmane.comp.parsers.bison.bugs/3418
+
+2010-10-07 Eric Blake <eblake@redhat.com>
+
+ docs: update cygwin progress
+ * doc/glibc-functions/mkostemp.texi (mkostemp): Added in cygwin
+ 1.7.6.
+ * doc/glibc-functions/mkostemps.texi (mkostemps): Likewise.
+ * doc/posix-headers/fenv.texi (fenv.h): Added after cygwin 1.7.7.
+ * doc/posix-functions/feclearexcept.texi (feclearexcept): Likewise.
+ * doc/posix-functions/fegetenv.texi (fegetenv): Likewise.
+ * doc/posix-functions/fegetexceptflag.texi (fegetexceptflag):
+ Likewise.
+ * doc/posix-functions/fegetround.texi (fegetround): Likewise.
+ * doc/posix-functions/feholdexcept.texi (feholdexcept): Likewise.
+ * doc/posix-functions/feraiseexcept.texi (feraiseexcept):
+ Likewise.
+ * doc/posix-functions/fesetenv.texi (fesetenv): Likewise.
+ * doc/posix-functions/fesetexceptflag.texi (fesetexceptflag):
+ Likewise.
+ * doc/posix-functions/fesetround.texi (fesetround): Likewise.
+ * doc/posix-functions/fetestexcept.texi (fetestexcept): Likewise.
+ * doc/posix-functions/feupdateenv.texi (feupdateenv): Likewise.
+ * doc/glibc-functions/feenableexcept.texi (feenableexcept):
+ Likewise.
+ * doc/glibc-functions/fedisableexcept.texi (fedisableexcept):
+ Likewise.
+ * doc/glibc-functions/fegetexcept.texi (fegetexcept): Likewise.
+
+ docs: update parse-datetime history
+ * doc/parse-datetime.texi (Authors of parse_datetime): Better
+ documentation of this function's history and alternatives.
+
+ cygwin: use more robust version check
+ * m4/memmem.m4 (gl_FUNC_MEMMEM_SIMPLE, gl_FUNC_MEMMEM): Don't
+ exclude an eventual cygwin 1.9.1.
+ * m4/strstr.m4 (gl_FUNC_STRSTR_SIMPLE, gl_FUNC_STRSTR): Likewise.
+ * m4/strcasestr.m4 (gl_FUNC_STRCASESTR_SIMPLE)
+ (gl_FUNC_STRCASESTR): Likewise.
+ Reported by Bruno Haible.
+
+2010-10-06 Bruno Haible <bruno@clisp.org>
+
+ string, sys_select: Avoid #including large headers unless necessary.
+ * lib/string.in.h: Don't include <unistd.h> except on NetBSD.
+ * lib/sys_select.in.h: Don't include <string.h> except on Solaris,
+ OSF/1, BeOS, Haiku.
+ Reported by Jim Meyering.
+
+2010-10-05 Eric Blake <eblake@redhat.com>
+
+ memmem, strstr, strcasestr: fix bug with long periodic needle
+ * lib/str-two-way.h (two_way_long_needle): Avoid bug with long
+ periodic needle having false positive.
+ * m4/memmem.m4 (gl_FUNC_MEMMEM_SIMPLE): Detect bug in glibc 2.12
+ and cygwin 1.7.7.
+ (gl_FUNC_MEMMEM): Be more pessimistic when cross-compiling.
+ * m4/strcasestr.m4 (gl_FUNC_STRCASESTR_SIMPLE)
+ (gl_FUNC_STRCASESTR): Likewise.
+ * m4/strstr.m4 (gl_FUNC_STRSTR_SIMPLE, gl_FUNC_STRSTR): Likewise.
+ * tests/test-memmem.c (main): Expose the bug.
+ * tests/test-strcasestr.c (main): Likewise.
+ * tests/test-strstr.c (main): Likewise.
+ * tests/test-c-strcasestr.c (main): Likewise.
+ * doc/glibc-functions/memmem.texi (memmem): Document the bug.
+ * doc/posix-functions/strstr.texi (strstr): Likewise.
+ * doc/glibc-functions/strcasestr.texi (strcasestr): Likewise.
+ Reported via http://sourceware.org/bugzilla/show_bug.cgi?id=12092
+
+2010-10-05 Paul Eggert <eggert@cs.ucla.edu>
+
+ parse-datetime: do some more renaming
+ * doc/parse-datetime.texi (Authors of parse_datetime): Call it
+ parse_datetime, not get_date. Mention the renaming.
+ * lib/parse-datetime.y: Call it parse_datetime, not getdate,
+ in comments.
+ * m4/bison.m4: Likewise.
+
+2010-10-05 Eric Blake <eblake@redhat.com>
+
+ parse-datetime: better name than get_date
+ * NEWS: Reword the deprecation notice.
+ * modules/get_date: Rename to modules/parse-datetime.
+ * modules/get_date-tests: Rename to modules/parse-datetime-tests.
+ * m4/get_date.m4: Rename to m4/parse-datetime.m4.
+ * lib/get_date.y: Rename to lib/parse-datetime.y.
+ * tests/test-get_date.c: Rename to tests/test-parse-datetime.c.
+ * doc/get_date.texi: Rename to doc/parse-datetime.texi.
+ * doc/getdate.texi: Provide fallback wrapper.
+ * lib/getdate.h: Move guts, and wrap...
+ * lib/parse-datetime.h: ...new file.
+ * lib/parse-datetime.y (get_date): Rename...
+ (parse_datetime): ...to this.
+ * m4/parse-datetime.m4 (gl_GET_DATE): Rename...
+ (gl_PARSE_DATETIME): ...to this.
+ * doc/posix-functions/getdate.texi (get_date): Provide fallback
+ documentation.
+ * modules/getdate (Files): Provide fallback docs and header.
+ (Notice, Depends-on): Update references.
+ * tests/test-parse-datetime.c: Likewise.
+ * DEPENDENCIES: Likewise.
+ * MODULES.html.sh (Date and time <time.h>): Likewise.
+ * doc/parse-datetime.texi (Date input formats)
+ (Authors of parse_datetime): Likewise.
+ * modules/parse-datetime (Files, configure.ac, Makefile.am)
+ (Include): Likewise.
+ * modules/parse-datetime-tests (Files, Makefile.am): Likewise.
+ * gnulib-tool: Likewise.
+ * m4/bison.m4 (gl_BISON): Likewise.
+ Suggested by Bruno Haible.
+
+2010-10-05 Paul Eggert <eggert@cs.ucla.edu>
+
+ more ports to Solaris tr, which needs [] around ranges
+ * gnulib-tool: Solaris tr needs [] around ranges.
+ * m4/fnmatch.m4 (gl_FUNC_FNMATCH_POSIX): Likewise.
+ * tests/test-pipe-filter-gi1.c (main): Likewise.
+ * tests/test-pipe-filter-ii1.c (main): Likewise.
+
+2010-10-05 Eric Blake <eblake@redhat.com>
+
+ bootstrap: fix Solaris regression
+ * build-aux/bootstrap (check_versions): Solaris tr still needs []
+ around ranges.
+ Reported by Pádraig Brady.
+
+ bootstrap: work with pkg-config
+ * build-aux/bootstrap (check_versions): Also transliterate - in
+ prerequisite name.
+ (print_versions): Be robust to any \ in $buildreq. Avoid listing
+ prerequisites that were already found, to avoid confusion.
+ Reported by Justin Clift.
+
+ faccessat: remove unused wrappers
+ * lib/openat.h (accessat, euidaccesat): Delete, since the mere
+ presence of these wrappers dragged in -lgen on Solaris.
+ Reported by Clemens Brogi; fix suggested by Paul Eggert.
+
+2010-10-05 Jim Meyering <meyering@redhat.com>
+
+ tests: require @PRAGMA_COLUMNS@ with each @PRAGMA_SYSTEM_HEADER@
+ * Makefile (sc_pragma_columns): New syntax-check rule.
+
+2010-10-04 Bruno Haible <bruno@clisp.org>
+
+ gnulib-tool: Synthesize appropriate _LDFLAGS for a libtool library.
+ * gnulib-tool (func_emit_lib_Makefile_am): When preparing for a libtool
+ library, put '-no-undefined' and the link dependencies into _LDFLAGS.
+ Reported by Bruce Korb and Eric Blake.
+
+2010-10-04 Bruno Haible <bruno@clisp.org>
+
+ threadlib: Make option --with-libpth-prefix work.
+ * m4/threadlib.m4 (gl_THREADLIB_BODY): When testing whether pth works,
+ use $LIBPTH, not just -lpth.
+
+2010-10-04 Bruno Haible <bruno@clisp.org>
+
+ Avoid line length limitation from HP NonStop system header files.
+ * m4/include_next.m4 (gl_INCLUDE_NEXT): Define also PRAGMA_COLUMNS.
+ * lib/arpa_inet.in.h: Use PRAGMA_COLUMNS.
+ * lib/ctype.in.h: Likewise.
+ * lib/dirent.in.h: Likewise.
+ * lib/errno.in.h: Likewise.
+ * lib/fcntl.in.h: Likewise.
+ * lib/float.in.h: Likewise.
+ * lib/getopt.in.h: Likewise.
+ * lib/iconv.in.h: Likewise.
+ * lib/inttypes.in.h: Likewise.
+ * lib/langinfo.in.h: Likewise.
+ * lib/locale.in.h: Likewise.
+ * lib/math.in.h: Likewise.
+ * lib/netdb.in.h: Likewise.
+ * lib/netinet_in.in.h: Likewise.
+ * lib/poll.in.h: Likewise.
+ * lib/pthread.in.h: Likewise.
+ * lib/pty.in.h: Likewise.
+ * lib/sched.in.h: Likewise.
+ * lib/se-selinux.in.h: Likewise.
+ * lib/search.in.h: Likewise.
+ * lib/signal.in.h: Likewise.
+ * lib/spawn.in.h: Likewise.
+ * lib/stdarg.in.h: Likewise.
+ * lib/stddef.in.h: Likewise.
+ * lib/stdint.in.h: Likewise.
+ * lib/stdio.in.h: Likewise.
+ * lib/stdlib.in.h: Likewise.
+ * lib/string.in.h: Likewise.
+ * lib/strings.in.h: Likewise.
+ * lib/sys_file.in.h: Likewise.
+ * lib/sys_ioctl.in.h: Likewise.
+ * lib/sys_select.in.h: Likewise.
+ * lib/sys_socket.in.h: Likewise.
+ * lib/sys_stat.in.h: Likewise.
+ * lib/sys_time.in.h: Likewise.
+ * lib/sys_times.in.h: Likewise.
+ * lib/sys_utsname.in.h: Likewise.
+ * lib/sys_wait.in.h: Likewise.
+ * lib/sysexits.in.h: Likewise.
+ * lib/termios.in.h: Likewise.
+ * lib/time.in.h: Likewise.
+ * lib/unistd.in.h: Likewise.
+ * lib/wchar.in.h: Likewise.
+ * lib/wctype.in.h: Likewise.
+ * modules/arpa_inet (Makefile.am): Substitute PRAGMA_COLUMNS.
+ * modules/ctype (Makefile.am): Likewise.
+ * modules/dirent (Makefile.am): Likewise.
+ * modules/errno (Makefile.am): Likewise.
+ * modules/fcntl-h (Makefile.am): Likewise.
+ * modules/float (Makefile.am): Likewise.
+ * modules/getopt-posix (Makefile.am): Likewise.
+ * modules/iconv-h (Makefile.am): Likewise.
+ * modules/inttypes (Makefile.am): Likewise.
+ * modules/langinfo (Makefile.am): Likewise.
+ * modules/locale (Makefile.am): Likewise.
+ * modules/math (Makefile.am): Likewise.
+ * modules/netdb (Makefile.am): Likewise.
+ * modules/netinet_in (Makefile.am): Likewise.
+ * modules/poll-h (Makefile.am): Likewise.
+ * modules/pthread (Makefile.am): Likewise.
+ * modules/pty (Makefile.am): Likewise.
+ * modules/sched (Makefile.am): Likewise.
+ * modules/search (Makefile.am): Likewise.
+ * modules/selinux-h (Makefile.am): Likewise.
+ * modules/signal (Makefile.am): Likewise.
+ * modules/spawn (Makefile.am): Likewise.
+ * modules/stdarg (Makefile.am): Likewise.
+ * modules/stddef (Makefile.am): Likewise.
+ * modules/stdint (Makefile.am): Likewise.
+ * modules/stdio (Makefile.am): Likewise.
+ * modules/stdlib (Makefile.am): Likewise.
+ * modules/string (Makefile.am): Likewise.
+ * modules/strings (Makefile.am): Likewise.
+ * modules/sys_file (Makefile.am): Likewise.
+ * modules/sys_ioctl (Makefile.am): Likewise.
+ * modules/sys_select (Makefile.am): Likewise.
+ * modules/sys_socket (Makefile.am): Likewise.
+ * modules/sys_stat (Makefile.am): Likewise.
+ * modules/sys_time (Makefile.am): Likewise.
+ * modules/sys_times (Makefile.am): Likewise.
+ * modules/sys_utsname (Makefile.am): Likewise.
+ * modules/sys_wait (Makefile.am): Likewise.
+ * modules/sysexits (Makefile.am): Likewise.
+ * modules/termios (Makefile.am): Likewise.
+ * modules/time (Makefile.am): Likewise.
+ * modules/unistd (Makefile.am): Likewise.
+ * modules/wchar (Makefile.am): Likewise.
+ * modules/wctype (Makefile.am): Likewise.
+
+2010-10-04 Bruno Haible <bruno@clisp.org>
+
+ read-file tests: Avoid a test failure on NonStop Kernel.
+ * tests/test-read-file.c (main): Don't assume that /etc/resolv.conf is
+ a regular file.
+ Reported by Joachim Schmitz <schmitz@hp.com>.
+
+2010-10-03 Bruno Haible <bruno@clisp.org>
+
+ gnulib-tool: Fixes for --create-testdir with --libtool.
+ * gnulib-tool (func_get_automake_snippet): Don't augment
+ EXTRA_lib_SOURCES for the pt_chown module, since pt_chown.o goes into
+ an executable.
+ (func_create_testdir): Handle module 'alloca' like func_import.
+ Reported by Bruce Korb <bruce.korb@gmail.com>.
+
+2010-10-03 Paul Eggert <eggert@cs.ucla.edu>
+
+ Avoid some lines longer than 80 characters.
+ * lib/stdint.in.h: Break long comment lines.
+ * lib/math.in.h: Likewise.
+ (_GL_NUM_UINT_WORDS): New macro, for readability.
+ (gl_signbitf, gl_signbitd, gl_signbitl): Use it.
+ * lib/stdio.in.h: Break lines in _GL_WARN_ON_USE calls.
+ * lib/stdlib.in.h: Likewise.
+ * lib/spawn.in.h: Likewise.
+ * lib/sys_socket.in.h: Update an URL.
+ * lib/sys_stat.in.h: Break long line.
+
+2010-10-03 Bruno Haible <bruno@clisp.org>
+ Joachim Schmitz <schmitz@hp.com> (tiny change)
+
+ acl: Add support for ACLs on NonStop Kernel.
+ * m4/acl.m4 (gl_FUNC_ACL): For Solaris, test for facl(), not for acl().
+ Check whether the function aclsort() exists.
+ * lib/acl-internal.h: For Solaris, test HAVE_FACL, not HAVE_ACL.
+ (acl_nontrivial) [HAVE_ACLSORT]: New declaration.
+ * lib/file-has-acl.c: For Solaris, test HAVE_FACL, not HAVE_ACL.
+ (acl_nontrivial [HAVE_ACLSORT]: New function.
+ (file_has_acl): Implement for NonStop Kernel.
+ * lib/set-mode-acl.c: For Solaris, test HAVE_FACL, not HAVE_ACL.
+ (qset_acl): Implement for NonStop Kernel.
+ * lib/copy-acl.c (qcopy_acl): Implement for NonStop Kernel.
+ * tests/test-sameacls.c: For Solaris, test HAVE_FACL, not HAVE_ACL.
+ (main): Implement for NonStop Kernel.
+ * tests/test-file-has-acl.sh (acl_flavor): Set to 'nsk' on NonStop
+ Kernel. Handle this flavor.
+ * tests/test-set-mode-acl.sh: Likewise.
+ * tests/test-copy-acl.sh: Likewise.
+ * tests/test-copy-file.sh: Likewise.
+
+2010-10-03 Bruno Haible <bruno@clisp.org>
+
+ Info about ACLs on NonStop Kernel.
+ * doc/acl-resources.txt: Add info about NonStop Kernel.
+ References by Joachim Schmitz <schmitz@hp.com>.
+
+2010-10-02 Bruno Haible <bruno@clisp.org>
+
+ Define missing EDQUOT on NonStop Kernel.
+ * lib/errno.in.h (EDQUOT): Assign a value if missing.
+ * lib/strerror.c (rpl_strerror): Handle missing EDQUOT.
+ * m4/errno_h.m4 (gl_HEADER_ERRNO_H): Also test whether EDQUOT is
+ missing.
+ * doc/posix-headers/errno.texi: Mention the NSK bug.
+ * doc/posix-functions/strerror.texi: Mention the workaround on NSK.
+ Reported by Joachim Schmitz <schmitz@hp.com>.
+
+2010-10-02 Bruno Haible <bruno@clisp.org>
+
+ Update doc for POSIX:2008.
+ * doc/posix-headers/*.texi [except ucontext.texi, sys_timeb.texi]:
+ Update URL of POSIX specification.
+
+2010-10-02 Bruno Haible <bruno@clisp.org>
+
+ gnulib-tool: In testdirs, use the newest available config.{guess.sub}.
+ * gnulib-tool (func_create_testdir): Use config.guess and config.sub
+ from gnulib, not from Automake.
+
+2010-10-02 Bruno Haible <bruno@clisp.org>
+
+ New module 'system-posix'.
+ * modules/system-posix: New file.
+ * lib/stdlib.in.h: Include <sys/wait.h> only when the 'system-posix'
+ module is present.
+ * m4/stdlib_h.m4 (gl_STDLIB_H_DEFAULTS): Initialize
+ GNULIB_SYSTEM_POSIX.
+ * modules/stdlib (Depends-on): Remove sys_wait.
+ (Makefile.am): Substitute GNULIB_SYSTEM_POSIX.
+ * doc/posix-functions/system.texi: Mention the new module.
+ * doc/posix-headers/stdlib.texi: Likewise.
+ * tests/test-stdlib.c: If GNULIB_TEST_SYSTEM_POSIX is not defined,
+ define test_sys_wait_macros to a no-op.
+ Reported by Sam Steingold <sds@gnu.org>.
+
+2010-09-30 Bruno Haible <bruno@clisp.org>
+
+ More renaming from 'getdate' to 'get_date'.
+ * doc/get_date.texi: Renamed from doc/getdate.texi.
+ * modules/get_date (Files): Update.
+ * MODULES.html.sh (Date and time <time.h>): Update.
+ * DEPENDENCIES: Update.
+ * gnulib-tool: Update comment.
+ * m4/bison.m4 (gl_BISON): Likewise.
+ * m4/get_date.m4 (gl_GET_DATE): Likewise.
+
+2010-09-30 Justin Clift <jclift@redhat.com> (tiny change)
+
+ bootstrap: support ACLOCAL_FLAGS during aclocal
+ * build-aux/bootstrap (aclocal): Honor ACLOCAL_FLAGS, so the user
+ can add additional -I dir for third-party .m4 files.
+
+2010-09-30 Eric Blake <eblake@redhat.com>
+
+ bootstrap: use glibtoolize on MacOS
+ * build-aux/bootstrap (check_versions): Convert libtool into
+ libtoolize.
+ (tool search): Move libtool check earlier, and look for
+ glibtoolize for MacOS.
+ (gnulib_tool_options): Auto-add --libtool when appropriate.
+ Reported by Justin Clift.
+
+ poll: fix typo that broke test on MacOS
+ * m4/poll.m4 (gl_FUNC_POLL): Add missing test.
+ Reported by Justin Clift.
+
+ getdate: rename to get_date
+ Note: getdate.h is not renamed, to minimize client impact.
+ * modules/getdate: Mark obsolete. Move old contents...
+ * modules/get_date: ...to new module name.
+ * modules/getdate-tests: Move...
+ * modules/get_date-tests: ...here.
+ * m4/getdate.m4: Move...
+ * m4/get_date.m4: ...here, and rename gl_GETDATE to gl_GET_DATE.
+ * lib/getdate.y: Move...
+ * lib/get_date.y: ...here.
+ * tests/test-getdate.c: Move...
+ * tests/test-get_date.c: ...here.
+ * doc/posix-functions/getdate.texi (getdate): Update name.
+ * NEWS: Mention the change.
+
+2010-09-29 Bruno Haible <bruno@clisp.org>
+
+ Separate the module 'waitpid' from the module 'sys_wait'.
+ * lib/sys_wait.in.h (waitpid): Declare only if the 'waitpid' module is
+ present.
+ * m4/sys_wait_h.m4 (gl_SYS_WAIT_MODULE_INDICATOR): Invoke
+ gl_MODULE_INDICATOR_FOR_TESTS.
+ (gl_SYS_WAIT_H_DEFAULTS): Initialize GNULIB_WAITPID.
+ * modules/sys_wait (Depends-on): Remove waitpid.
+ (Makefile.am): Substitute GNULIB_WAITPID.
+ * modules/waitpid (configure.ac): Invoke gl_SYS_WAIT_MODULE_INDICATOR.
+ * tests/test-sys_wait-c++.cc (GNULIB_NAMESPACE::waitpid): Check the
+ signature only if the 'waitpid' module is present.
+ * doc/posix-functions/waitpid.texi: Mention the 'waitpid' module.
+ * NEWS: Mention the change.
+ * modules/grantpt (Depends-on): Add waitpid.
+ * modules/wait-process (Depends-on): Likewise.
+
+2010-09-29 Bruno Haible <bruno@clisp.org>
+
+ More tests for module 'sys_wait'.
+ * modules/sys_wait-c++-tests: New file.
+ * tests/test-sys_wait-c++.cc: New file.
+ * modules/sys_wait-tests (Depends-on): Add sys_wait-c++-tests.
+ Reported by Tatsuro MATSUOKA <tmacchant5@yahoo.co.jp>.
+
+2010-09-29 Bruno Haible <bruno@clisp.org>
+
+ New module 'waitpid'.
+ * lib/waitpid.c: New file, extracted from lib/sys_wait.in.h.
+ * lib/sys_wait.in.h: Include <sys/types.h>, c++defs.h, warn-on-use.h.
+ Don't include <process.h>.
+ (waitpid): Declare only, using modern idiom.
+ * m4/waitpid.m4: New file.
+ * m4/sys_wait_h.m4 (gl_SYS_WAIT_H): Check whether waitpid is declared.
+ * modules/waitpid: New file.
+ * modules/sys_wait (Depends-on): Add c++defs, warn-on-use, waitpid.
+ (Makefile.am): Update.
+ Reported by Tatsuro MATSUOKA <tmacchant5@yahoo.co.jp>.
+
+2010-09-28 Bruno Haible <bruno@clisp.org>
+
+ poll: Assume ANSI C.
+ * lib/poll.c (poll): Use an ANSI C declaration.
+
+2010-09-28 Bruno Haible <bruno@clisp.org>
+
+ poll-h: Create poll.h on all platforms.
+ * lib/poll.in.h: Use double-inclusion guard. Don't define POLL*,
+ struct pollfd, nfds_t, INFTIM when the system has <poll.h>.
+ * m4/poll_h.m4 (gl_POLL_H): Set HAVE_POLL_H. Invoke
+ gl_CHECK_NEXT_HEADERS. Don't set POLL_H.
+ (gl_REPLACE_POLL_H): Don't set POLL_H.
+ (gl_POLL_H_DEFAULTS): Don't initialize POLL_H.
+ * modules/poll-h (Depends-on): Add include_next.
+ (Makefile.am): Create poll.h unconditionally. Substitute also
+ HAVE_POLL_H, INCLUDE_NEXT, PRAGMA_SYSTEM_HEADER, NEXT_POLL_H.
+
+2010-09-28 Bruno Haible <bruno@clisp.org>
+
+ Tests for module 'poll-h'.
+ * modules/poll-h-c++-tests: New file.
+ * tests/test-poll-h-c++.cc: New file.
+
+ Tests for module 'poll-h'.
+ * modules/poll-h-tests: New file.
+ * tests/test-poll-h.c: New file.
+
+2010-09-28 Bruno Haible <bruno@clisp.org>
+
+ poll-h: Ensure POLL{RD,WR}{NORM,BAND} are defined on glibc platforms.
+ * modules/poll-h (Depends-on): Add 'extensions'.
+
+2010-09-28 Bruno Haible <bruno@clisp.org>
+
+ New module 'poll-h'.
+ * lib/poll.in.h: Include c++defs.h and warn-on-use.h.
+ (poll): Use modern idiom.
+ * modules/poll-h: New file.
+ * modules/poll (Files): Remove lib/poll.in.h.
+ (Depends-on): Add poll-h.
+ (configure.ac): Invoke gl_POLL_MODULE_INDICATOR.
+ (Makefile.am): Move code for generation of poll.h to modules/poll-h.
+ * m4/poll_h.m4: New file.
+ * m4/poll.m4 (gl_FUNC_POLL): Require gl_POLL_H. Don't check for poll.h
+ here. Don't set POLL_H here. Instead, set HAVE_POLL and REPLACE_POLL
+ and invoke gl_REPLACE_POLL_H.
+ * lib/poll.c: Use common idiom.
+ * tests/test-poll.c: Likewise.
+ * doc/posix-headers/poll.texi: Mention the poll-h module.
+ Suggested by Eric Blake.
+
+2010-09-26 Bruno Haible <bruno@clisp.org>
+
+ sys_wait: Implement WSTOPSIG.
+ * lib/sys_wait.in.h (WSTOPSIG): New macro.
+ Reported by Simon Josefsson.
+
+2010-09-26 Simon Josefsson <simon@josefsson.org>
+
+ stdlib, sys_wait: Avoid compilation error on mingw.
+ * lib/sys_wait.in.h: Include <signal.h>, for SIGTERM.
+
+2010-09-26 Bruno Haible <bruno@clisp.org>
+
+ stdlib tests: Avoid code duplication.
+ * modules/stdlib-tests (Files): Add tests/test-sys_wait.h.
+ * modules/sys_wait-tests (Files): Likewise.
+ * tests/test-sys_wait.h: New file, extracted from tests/test-stdlib.c.
+ * tests/test-stdlib.c: Include test-sys_wait.h.
+ (main): Invoke test_sys_wait_macros.
+ * tests/test-sys_wait.c: Include test-sys_wait.h.
+ (main): Invoke test_sys_wait_macros.
+
+2010-09-25 Simon Josefsson <simon@josefsson.org>
+
+ * modules/getaddrinfo (Depends-on): Depend on the sockets module.
+ * lib/getaddrinfo.c (use_win32_p): Call gl_sockets_startup to make
+ sure Windows sockets are working before calling getaddrinfo.
+ * tests/test-getaddrinfo.c (main): Don't call WSAStartup here.
+ * doc/gnulib.texi (Windows sockets): Fix typo.
+
+2010-09-25 Bruno Haible <bruno@clisp.org>
+
+ Tests for module 'regex-quote'.
+ * modules/regex-quote-tests: New file.
+ * tests/test-regex-quote.c: New file.
+
+ New module 'regex-quote'.
+ * lib/regex-quote.h: New file.
+ * lib/regex-quote.c: New file.
+ * modules/regex-quote: New file.
+ Suggested by Reuben Thomas <rrt@sc3d.org>.
+
+2010-09-24 Bruno Haible <bruno@clisp.org>
+
+ unistr/u8-strchr: Fix a test failure on i586 glibc systems.
+ * tests/unistr/test-strchr.h (test_strchr): Disable an invalid check.
+
+2010-09-23 Bruno Haible <bruno@clisp.org>
+
+ setenv: Relax license.
+ * modules/setenv (License): Change to LGPLv2+, with consent by Eric
+ Blake.
+ Requested by Eric Blake.
+
+2010-09-22 Bruno Haible <bruno@clisp.org>
+
+ termios: Relax license.
+ * modules/termios (License): Change to LGPLv2+.
+ Requested by Eric Blake.
+
+2010-09-22 Bruno Haible <bruno@clisp.org>
+
+ threadlib: Allow the package to change the default to 'no'.
+ * m4/threadlib.m4 (gl_THREADLIB_EARLY_BODY): When
+ gl_THREADLIB_DEFAULT_NO is defined, change the default to 'no'.
+ Reported by Paul Eggert.
+
+2010-09-22 Pádraig Brady <P@draigbrady.com>
+ Bruno Haible <bruno@clisp.org>
+
+ Fix endless loop in mbmemcasecoll.
+ * lib/mbmemcasecoll.c (apply_towlower): When mbrtowc returns 0, copy 1
+ byte.
+ * tests/test-mbmemcasecmp.h (test_ascii): Test embedded NULs.
+
+2010-09-22 Bruno Haible <bruno@clisp.org>
+
+ Tests for module 'memcoll'.
+ * modules/memcoll-tests: New file.
+ * tests/test-memcoll.c: New file, based on tests/test-memcmp.c.
+
+ memcoll, xmemcoll: Clarify size vs. length.
+ * modules/memcoll.c (memcoll0): Clarify specification.
+ * modules/xmemcoll.c (xmemcoll0): Likewise. Reduce by 1 the lengths
+ passed to collate_error.
+
+2010-09-22 Bruno Haible <bruno@clisp.org>
+
+ Tests for module 'memcasecmp'.
+ * modules/memcasecmp-tests: New file.
+ * tests/test-memcasecmp.c: New file, based on tests/test-memcmp.c.
+
+2010-09-22 Paul Eggert <eggert@cs.ucla.edu>
+
+ * lib/pthread.in.h: Add split double-inclusion guard, and include
+ system <pthread.h> if there is one. Use @@-style as in other
+ .in.h files. Define PTHREAD_COND_INITIALIZER etc. only if system
+ pthread.h doesn't.
+ (pthread_mutexattr_destroy, pthread_mutexattr_init):
+ (pthread_mutexattr_settype, pthread_mutex_trylock):
+ New static inline functions, if there's no system <pthread.h>.
+ (pthread_spinlock_t, pthread_spin_init, pthread_spin_destroy):
+ (pthread_spin_lock, pthread_spin_trylock, pthread_spin_unlock):
+ Approximate with mutexes if the system lacks spinlocks, as in
+ MacOS.
+ * m4/pthread.m4 (gl_PTHREAD_CHECK): Require gl_PTHREAD_DEFAULTS.
+ Add gl_CHECK_NEXT_HEADERS for pthread.h, and support the usual
+ @@-style. Check for spinlocks separately.
+ (gl_PTHREAD_DEFAULTS): New macro.
+ * modules/pthread: Redo to use a more typical style for in.h files.
+
+2010-09-21 Eric Blake <eblake@redhat.com>
+
+ net_if: enhance tests
+ * tests/test-net_if.c (main): Move signature checks earlier.
+ Print failures to stderr.
+ * doc/posix-functions/if_freenameindex.texi (if_freenameindex):
+ Document the bug that we do not yet fix.
+
+2010-09-21 Reuben Thomas <rrt@sc3d.org>
+
+ * doc/gnulib.texi (Out of memory handling): Rewrite section to be
+ about gnulib, not GSS.
+
+2010-09-21 Reuben Thomas <rrt@sc3d.org>
+
+ * build-aux/pmccabe2html: Look for sources in src/ instead of lib/.
+ * build-aux/pmccabe2html: Set cut_dir properly, and add mode line
+ for Emacs.
+ * build-aux/pmccabe2html: Make Makefile.am example code more
+ cut-and-paste friendly.
+
+2010-09-21 Simon Josefsson <simon@josefsson.org>
+
+ * tests/test-net_if.c: New file.
+ * modules/net_if-tests: New file.
+
+2010-09-20 Paul Eggert <eggert@cs.ucla.edu>
+
+ pthread: add pthread_spin_destroy
+ * lib/pthread.in.h (pthread_spin_destroy): New function.
+
+2010-09-19 Bruno Haible <bruno@clisp.org>
+
+ gnulib-tool: Fix --help output.
+ * gnulib-tool (func_usage): Fix help message.
+ Reported by Reuben Thomas <rrt@sc3d.org>.
+
+2010-09-18 Jim Meyering <meyering@redhat.com>
+
+ maint.mk: avoid unexpanded \n in two diagnostics
+ * top/maint.mk (sc_prohibit_always_true_header_tests):
+ Don't use a literal \n in a halt=... assignment. It would not be
+ expanded, and the two \n bytes would appear in the diagnostic output
+ rather than the desired newline. Use halt=$$(printf ... instead.
+ (sc_vulnerable_makefile_CVE-2009-4029): Likewise.
+
+2010-09-18 Bruno Haible <bruno@clisp.org>
+
+ netinet_in: Doc tweak.
+ * doc/posix-headers/netinet_in.texi: Mention an affected platform.
+ Reported by Mats Erik Andersson <mats.andersson@gisladisker.se>.
+
+2010-09-18 Jim Meyering <meyering@redhat.com>
+
+ init.sh: correct an outdated comment
+ * tests/init.sh (create_exe_shims_): s/function/alias/
+
+ init.sh: don't let an ephemeral "*.exe" make us skip all dir entries
+ * tests/init.sh (find_exe_basenames_): Don't give up on a directory if
+ a file named "*.exe" is removed between the glob expansion and the
+ processing of that oddly named file.
+
+2010-09-17 Eric Blake <eblake@redhat.com>
+
+ mirbsd: add some more support
+ * m4/c-stack.m4 (AC_SYS_XSI_STACK_OVERFLOW_HEURISTIC): MirBSD is
+ in BSD family.
+ * m4/gc-random.m4 (gl_GC_RANDOM): MirBSD supports same random
+ devices as OpenBSD.
+ * m4/host-os.m4 (mirbsd): Add MirBSD.
+
+ tests: fix unportable assumption on sys/wait.h
+ * tests/test-sys_wait.c (main): Relax test.
+ * tests/test-stdlib.c (main): Likewise.
+
+ init.sh: accomodate directory with no .exes
+ * tests/init.sh: Accomodate directory containing only scripts.
+
+ tests: avoid compiler warning
+ * tests/test-stdlib.c (main): Use the variable.
+
+ fdutimens, fdutimensat: update signature, again
+ * lib/utimens.h (gl_futimens): Delete, and move signature...
+ (fdutimens): ...here.
+ (fdutimensat): Rearrange signature.
+ (lutimensat): Rename variable for clarity.
+ * lib/fdutimensat.c (fdutimensat): Update signature.
+ * lib/utimens.c (fdutimens): Likewise.
+ (gl_futimens): Delete.
+ (utimens, lutimens): Update callers.
+ * lib/futimens.c (futimens): Likewise.
+ * tests/test-fdutimensat.c: Likewise.
+ * tests/test-utimens.c: Likewise.
+ * tests/test-futimens.h: Update comment.
+ * NEWS: Mention this.
+ Suggested by Paul Eggert.
+
+2010-09-17 Bruno Haible <bruno@clisp.org>
+
+ Take over the maintenance of some older macros from Autoconf.
+ * m4/error.m4 (AC_FUNC_ERROR_AT_LINE): New macro, from GNU Autoconf.
+ * m4/lstat.m4 (AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK): New macro, from
+ GNU Autoconf.
+ * m4/memcmp.m4 (AC_FUNC_MEMCMP): New macro, from GNU Autoconf.
+ * m4/mktime.m4 (AC_FUNC_MKTIME): Change comment.
+
+2010-09-17 Eric Blake <eblake@redhat.com>
+
+ fdutimensat: drop atflag validation
+ * lib/fdutimensat.c (fdutimensat): Allow AT_SYMLINK_NOFOLLOW even
+ with valid fd, to close a race scenario where futimens is
+ unsupported and FILE was replaced by a symlink.
+ * tests/test-fdutimensat.c (do_fdutimens, main): Adjust test
+ accordingly.
+ Suggested by Paul Eggert.
+
+2010-09-16 Bruno Haible <bruno@clisp.org>
+
+ unlockpt: Fix declaration within GNULIB_POSIXCHECK.
+ * lib/stdlib.in.h (unlockpt): Fix warning declaration.
+
+2010-09-16 Bruno Haible <bruno@clisp.org>
+
+ login_tty: Fix detection of function on FreeBSD, OpenBSD, NetBSD.
+ * m4/pty.m4 (gl_FUNC_LOGIN_TTY): Augment LIBS while checking whether
+ login_tty exists.
+ Reported by Mats Erik Andersson <mats.andersson@gisladisker.se>.
+
+2010-09-16 Bruno Haible <bruno@clisp.org>
+
+ login_tty: Make the replacement code work on BSD systems.
+ * lib/login_tty.c: Include <sys/ioctl.h>.
+ (login_tty): Use ioctl TIOCSCTTY when available.
+ * modules/login_tty (Depends-on): Add sys_ioctl.
+ Reported by Mats Erik Andersson <mats.andersson@gisladisker.se>.
+
+2010-09-16 Bruno Haible <bruno@clisp.org>
+
+ login_tty: Stricter unit test.
+ * modules/login_tty-tests (Depends-on): Add tcgetsid.
+ * tests/test-login_tty.c (main): Also check the results of tcgetpgrp()
+ and tcgetsid() after login_tty.
+ Reported by Mats Erik Andersson <mats.andersson@gisladisker.se>.
+
+2010-09-16 Bruno Haible <bruno@clisp.org>
+
+ New module 'tcgetsid'.
+ * lib/tcgetsid.c: New file.
+ * m4/tcgetsid.m4: New file.
+ * modules/tcgetsid: New file.
+ * modules/termios (Depends-on): Add c++defs, warn-on-use.
+ (Makefile.am): Ensure c++defs.h, warn-on-use.h get included. Substitute
+ GNULIB_TCGETSID, HAVE_TCGETSID.
+ * lib/termios.in.h: Include <sys/types.h>.
+ (tcgetsid): New declaration.
+ * m4/termios_h.m4 (gl_TERMIOS_H): Check whether tcgetsid is declared.
+ (gl_TERMIOS_H_DEFAULTS): Initialize GNULIB_TCGETSID, HAVE_TCGETSID.
+ * doc/posix-functions/tcgetsid.texi: Mention the new module.
+ * tests/test-termios-c++.cc: Check GNULIB_NAMESPACE::tcgetsid.
+
+2010-09-16 Bruno Haible <bruno@clisp.org>
+
+ Tests for module 'termios'.
+ * modules/termios-c++-tests: New file.
+ * modules/termios-tests: New file.
+ * tests/test-termios-c++.cc: New file.
+ * tests/test-termios.c: New file.
+
+ New module 'termios'.
+ * modules/termios: New file.
+ * lib/termios.in.h: New file.
+ * m4/termios_h.m4: New file.
+ * doc/posix-headers/termios.texi: Mention the new module.
+
+2010-09-16 Eric Blake <eblake@redhat.com>
+
+ fdutimensat: add an atflag parameter
+ * lib/fdutimensat.c (fdutimensat): Add new parameter.
+ * lib/utimens.h (fdutimensat): Update prototype.
+ * tests/test-fdutimensat.c: Adjust test to match.
+ * NEWS: Document the change.
+ Suggested by Paul Eggert.
+
+2010-09-16 Bruno Haible <bruno@clisp.org>
+
+ Fix typos in comments.
+ * lib/striconveh.h: Fix typo in comment.
+ * lib/login_tty.c (login_tty): Likewise.
+
+2010-09-15 Bruno Haible <bruno@clisp.org>
+
+ stdlib: clarify MirBSD WEXITSTATUS bug
+ * lib/stdlib.in.h: Clarify the MirBSD bug regarding WEXITSTATUS.
+ * doc/posix-headers/stdlib.texi (stdlib.h): Likewise.
+
+2010-09-15 Eric Blake <eblake@redhat.com>
+
+ stdlib: work around MirBSD WEXITSTATUS bug
+ * lib/stdlib.in.h (includes): Guarantee WEXITSTATUS.
+ * modules/stdlib (Depends-on): Add sys_wait.
+ * tests/test-sys_wait.c (main): Enhance test.
+ * tests/test-stdlib.c (main): Likewise.
+ * doc/posix-headers/stdlib.texi (stdlib.h): Document the bug.
+
+ docs: mention MacOS issue with WEXITSTATUS(constant)
+ * doc/posix-headers/sys_wait.texi (sys/wait.h): Document the
+ issue.
+ * doc/posix-headers/stdlib.texi (stdlib.h): Likewise.
+
+ strnlen: add tests
+ * modules/strnlen-tests: New file.
+ * tests/test-strnlen.c: Likewise.
+
+2010-09-14 Bruno Haible <bruno@clisp.org>
+
+ unistr/base: Avoid link errors when module 'libunistring' is also used.
+ * lib/unistr.in.h (u8_mbtouc_unsafe, u16_mbtouc_unsafe,
+ u32_mbtouc_unsafe, u8_mbtouc, u16_mbtouc, u32_mbtouc, u8_mbtoucr,
+ u16_mbtoucr, u32_mbtoucr, u8_uctomb_aux, u16_uctomb_aux, u32_uctomb):
+ Declare also when HAVE_LIBUNISTRING is set.
+ Reported by Pádraig Brady <P@draigbrady.com>.
+
+2010-09-14 Eric Blake <eblake@redhat.com>
+
+ test-rawmemchr: make more robust
+ * modules/rawmemchr-tests (Files): Add zerosize-ptr.h, mmap-anon.m4.
+ (Depends-on, configure.ac): Add needed prerequisites to use it.
+ * modules/memchr-tests (Files, Depends-on, configure.ac):
+ Likewise, to avoid implicit reliance on memchr module prereqs.
+ * tests/test-memchr.c (main): Ensure proper masking.
+ * tests/test-rawmemchr.c (main): Likewise. Detect oversized
+ reads.
+
+ memchr: detect glibc Alpha bug
+ Avoids http://sourceware.org/bugzilla/show_bug.cgi?id=12019.
+ * m4/memchr.m4 (gl_FUNC_MEMCHR): Detect glibc 2.11.2 failure on
+ Alpha.
+ * doc/posix-functions/memchr.texi (memchr): Tweak wording.
+ * tests/test-memchr.c (main): Enhance test.
+ Reported by Nelson H. F. Beebe.
+
+2010-09-13 Paul Eggert <eggert@cs.ucla.edu>
+
+ fts, getcwd, glob: audit for dirfd returning -1
+ * lib/fts.c (opendir): Remove #define; no longer used.
+ (opendirat): New arg PDIR_FD. All callers changed.
+ (fts_build, _opendir2): Use new opendirat to avoid the need for
+ dirfd, or for checking whether dirfd returns a negative value.
+ Don't use opendir; always use openat followed by fdopendir.
+ * lib/getcwd.c (__getcwd): Don't reset fd; fdopendir no longer clobbers
+ it.
+ * lib/glob.c (link_exists_p): Add comment explaining why dirfd never
+ returns -1 here.
+ * modules/fts (Depends-on): Remove dirfd.
+ * modules/getcwd (Depends-on): Likewise.
+
+2010-09-13 Eric Blake <eblake@redhat.com>
+
+ float: fix broken MirBSD header
+ * m4/float_h.m4 (gl_FLOAT_H): MirBSD copied OpenBSD's bug.
+ * doc/posix-headers/float.texi (float.h): Document it.
+
+2010-09-13 Paul Eggert <eggert@cs.ucla.edu>
+
+ fts: use O_NOFOLLOW to avoid race condition when opening a directory
+ * lib/fts.c (opendirat): New arg extra_flags.
+ (__opendir2): Use it to avoid following symlinks when opening
+ a directory, if symlinks are not supposed to be followed. See
+ <http://lists.gnu.org/archive/html/bug-gnulib/2010-09/msg00213.html>.
+
+ fdopendir: preserve argument fd before returning
+ * lib/fdopendir.c: Adjust comments to say POSIX, not Solaris.
+ (fdopendir_with_dup, fd_clone_opendir): New static functions.
+ (fdopendir): Use them, arranging for FD to be open to the same
+ directory that it was when it started. (It might be temporarily
+ closed while fdopendir is running, so this not thread- or
+ signal-safe.) Be careful to do the right thing even when file
+ descriptors are scarce and dup fails with errno == EMFILE. See
+ <http://lists.gnu.org/archive/html/bug-gnulib/2010-09/msg00208.html>.
+
+2010-09-10 Paolo Bonzini <bonzini@gnu.org>
+
+ regex: Pass the system regex if its only problem is 32-bit regoff_t.
+ * NEWS: Document change.
+ * m4/regex.m4: Disable test for regoff_t size.
+
+2010-09-13 Jim Meyering <meyering@redhat.com>
+
+ fts: don't operate on an invalid file descriptor after failed dup
+ * lib/fts.c (fts_build): Don't call set_cloexec_flag on a
+ negative file descriptor.
+
+2010-09-12 Paul Eggert <eggert@cs.ucla.edu>
+
+ savedir: add streamsavedir, deprecate fdsavedir
+ * NEWS: Mention deprecation of fdsavedir.
+ * lib/savedir.c (streamsavedir): New extern function, whose name
+ ends in "savedir" to be consistent with the others. This differs
+ from savedirstream in that it doesn't close its argument. The
+ next version of GNU tar will use this instead of fdsavedir, to
+ avoid some race conditions and conserve file descriptors.
+ (savedirstream): Reimplement as a wrapper around streamsavedir.
+ (fdsavedir): Add a comment deprecating this function. As far as
+ I know, only GNU tar used it, and GNU tar doesn't need it any more.
+ * lib/savedir.h (streamsavedir): New decl.
+ (fdsavedir): Add a comment deprecating this.
+
+2010-09-10 Bruno Haible <bruno@clisp.org>
+
+ langinfo: Fix last commit.
+ * m4/langinfo_h.m4 (gl_LANGINFO_H): Initialize
+ HAVE_LANGINFO_T_FMT_AMPM, HAVE_LANGINFO_YESEXPR.
+ Reported by Tom G. Christensen <tgc@jupiterrise.com>.
+
+2010-09-10 Bruno Haible <bruno@clisp.org>
+
+ relocatable-prog-wrapper: Fix compilation failure due to O_EXEC.
+ * lib/progreloc.c (O_EXEC): Define fallback.
+
+2010-09-10 Paul Eggert <eggert@cs.ucla.edu>
+
+ fcntl-h: define O_CLOEXEC and O_EXEC if not defined; use new defines
+ * NEWS: Document recent changes to fcntl-h.
+ * doc/posix-headers/fcntl.texi (fcntl.h): Document that
+ O_CLOEXEC is now defined to 0 if it is not defined, like other flags.
+ Also, O_EXEC is now defined to be O_RDONLY if O_EXEC is not defined.
+ Similarly for O_SEARCH; this last was already true, but not documented.
+ * lib/fcntl.in.h (O_CLOEXEC): Define to 0 if not defined.
+ * lib/dup-safer-flag.c (O_CLOEXEC): Remove now-useless #define.
+ * lib/dup3.c, lib/pipe2.c, tests/test-dup-safer.c, tests/test-fcntl.c:
+ Likewise.
+ * lib/popen-safer.c (open_noinherit): Check whether O_CLOEXEC
+ is zero, not whether it is defined.
+ * tests/test-dup3.c, tests/test-pipe2.c (main): Likewise.
+ * lib/progreloc.c (find_executable): Use O_EXEC rather than O_RDONLY.
+ * lib/open.c (open): Check for O_SEARCH as well as for O_RDONLY.
+
+2010-09-10 Bruno Haible <bruno@clisp.org>
+
+ langinfo, nl_langinfo: Fix for IRIX 5.3.
+ * m4/langinfo_h.m4 (gl_LANGINFO_H): Test whether langinfo.h defines
+ T_FMT_AMPM, YESEXPR. Set HAVE_LANGINFO_T_FMT_AMPM,
+ HAVE_LANGINFO_YESEXPR.
+ * modules/langinfo (Makefile.am): Substitute HAVE_LANGINFO_T_FMT_AMPM,
+ HAVE_LANGINFO_YESEXPR.
+ * lib/langinfo.in.h (T_FMT_AMPM, GNULIB_defined_T_FMT_AMPM): Define if
+ HAVE_LANGINFO_T_FMT_AMPM is 0.
+ (YESEXPR, NOEXPR, GNULIB_defined_YESEXPR): Define if
+ HAVE_LANGINFO_YESEXPR is 0.
+ * lib/nl_langinfo.c (rpl_nl_langinfo): Handle also T_FMT_AMPM, YESEXPR,
+ NOEXPR.
+ * doc/posix-headers/langinfo.texi: Mention the IRIX 5.3 problem.
+ * doc/posix-functions/nl_langinfo.texi: Likewise.
+ Reported by Eric Blake.
+
+2010-09-10 Bruno Haible <bruno@clisp.org>
+
+ pty, readutmp: Fix for FreeBSD 8.0 and OpenBSD 4.6.
+ * doc/glibc-functions/login_tty.texi: Mention the include file problem
+ on FreeBSD 8.0 and OpenBSD 4.6.
+ * lib/pty.in.h: Include <sys/types.h> before <libutil.h>.
+ * m4/pty_h.m4 (gl_PTY_H): Likewise.
+ * m4/pty.m4 (gl_FUNC_FORKPTY, gl_FUNC_OPENPTY): Likewise.
+ * m4/readutmp.m4 (gl_READUTMP): Include <sys/types.h> before <utmp.h>.
+ Invoke AC_INCLUDES_DEFAULT instead of using the undocumented variable
+ ac_includes_default.
+ Reported by Mats Erik Andersson <mats.andersson@gisladisker.se>.
+
+2010-09-09 Eric Blake <eblake@redhat.com>
+
+ strsignal: work around NetBSD bug
+ * m4/strsignal.m4 (gl_FUNC_STRSIGNAL): Also check in <unistd.h>.
+ * lib/string.in.h (includes): Likewise.
+ * doc/posix-functions/strsignal.texi (strsignal): Document the
+ bug.
+ Reported by Nelson H. F. Beebe.
+
+ gnulib-tool: work with NetBSD /bin/sh
+ * gnulib-tool (func_cache_var, func_cache_lookup_module)
+ (func_get_description, func_get_comment, func_get_status)
+ (func_get_notice, func_get_applicability, func_get_filelist)
+ (func_get_dependencies, func_get_autoconf_early_snippet)
+ (func_get_autoconf_snippet, func_get_automake_snippet)
+ (func_get_include_directive, func_get_link_directive)
+ (func_get_license, func_get_maintainer, func_import): Avoid
+ shell syntax errors from parsing syntax extensions.
+
+2010-09-09 Bruno Haible <bruno@clisp.org>
+
+ gnulib-tool: Avoid stderr output on IRIX related to 'alias', 'unalias'.
+ * gnulib-tool: Don't fiddle with file descriptors 0, 1, 2. Instead, use
+ a reliable way to determine whether the 'alias' command works.
+
+2010-09-08 Jim Meyering <meyering@redhat.com>
+
+ init.sh: penalize a set-x-impaired shell; don't disqualify it
+ * tests/init.sh: Too many shells corrupt application stderr when
+ you set -x, so we can't afford to disqualify them, since at least
+ on Irix-6.5, that would disqualify all bourne shells.
+ Instead, use a two-pass approach.
+ On the first pass, try to find a shell that meets the stricter
+ condition that set -x does not corrupt stderr.
+ If no shell meets the stricter condition, retest each candidate
+ shell, but without that extra condition. Finally, when
+ VERBOSE=yes is requested and set -x might cause trouble, simply
+ issue a warning and refrain from enabling debug output.
+
+2010-09-08 Eric Blake <eblake@redhat.com>
+
+ unsetenv: fix OpenBSD bug
+ * m4/setenv.m4 (gl_FUNC_UNSETENV): Check for OpenBSD bug.
+ * doc/posix-functions/unsetenv.texi (unsetenv): Update
+ documentation.
+ Reported by Jim Meyering.
+
+ strtod: work around IRIX 6.5 bug
+ * lib/strtod.c (strtod): Reparse number on shorter string if
+ exponent parse was invalid.
+ * tests/test-strtod.c (main): Add check for "0x1p 2".
+ Reported by Tom G. Christensen.
+
+ getopt: optimize previous patch
+ * m4/getopt.m4 (gl_GETOPT_CHECK_HEADERS): Correctly check for
+ empty variable. Speed up awk script.
+ Reported by Paolo Bonzini.
+
+2010-09-08 Jim Meyering <meyering@redhat.com>
+
+ test.sh: disqualify shells for which set -x corrupts stderr
+ * tests/init.sh: Add a test to disqualify /bin/sh from SunOS 5.11
+ and OpenBSD 4.7. They make it so with "set -x", environment settings
+ appear in stderr output. For example, this command:
+ /bin/sh -c 'set -x; P=1 true 2> err' 2>/dev/null; cat err
+ prints "P=1" on those two systems:
+
+2010-09-08 Bruno Haible <bruno@clisp.org>
+
+ gnulib-tool: Avoid stderr output on IRIX related to 'alias', 'unalias'.
+ * gnulib-tool: Use stderr redirection around the 'alias' and 'unalias'
+ commands, because some shells ignore redirections when there is an
+ error in the command lookup.
+ Reported by Eric Blake.
+
+2010-09-07 Reuben Thomas <rrt@sc3d.org>
+
+ * lib/regex.h: Fix a mention of `regex_compile' (should be
+ `re_compile_pattern').
+ Correct and clarify documentation for RE_CONTEXT_INVALID_DUP.
+ (re_set_registers): Correct name of parameter in comment.
+
+ * doc/regex.texi: Add documentation for missing syntax flags.
+ Remove commented-out documentation of defunct syntax option
+ RE_NO_EMPTY_ALTS.
+ Correct name of RE_CHAR_CLASSES in one incorrect occurrence.
+ Add documentation of re_set_registers.
+ Document trick to re-use a pattern buffer by setting fastmap manually.
+ Update documentation of struct re_pattern_buffer per public members.
+ Uncomment documentation of equivalence class operators and
+ collating symbol operators, since they are now implemented,
+ Explain leftmost-longest matching in relation to alternatives.
+ Tidy documentation of substring matching.
+ Remove POSIX documentation, which is done better in
+ glibc, and refer the reader there. Keep BSD API documentation, as
+ that is not readily available elsewhere.
+
+2010-09-07 Eric Blake <eblake@redhat.com>
+
+ getopt: handle POSIXLY_CORRECT set but not exported
+ * m4/getopt.m4 (gl_GETOPT_CHECK_HEADERS): Restore pre-existing
+ export state of POSIXLY_CORRECT, due to bash set -o posix.
+ Reported by Dustin J. Mitchell.
+
+2010-09-05 Bruno Haible <bruno@clisp.org>
+
+ gnulib-tool: Highlight the changed options.
+ * gnulib-tool (func_usage): Display the --import, --add-import,
+ --remove-import explanations in bold font.
+
+2010-09-06 Karl Berry <karl@gnu.org>
+
+ * doc/gnulib-tool.texi (Modified imports): doc tweaks.
+
+2010-09-05 Bruno Haible <bruno@clisp.org>
+
+ uniwidth/width: Update comment.
+ * lib/uniwidth/width.c (uc_width): Update comment for Unicode >= 3.1.
+ Reported by Emanuele Giaquinta <emanuele.giaquinta@gmail.com>.
+
+2010-09-05 Bruno Haible <bruno@clisp.org>
+
+ isinf, isnan: Relax license.
+ * modules/isinf (License): Change from GPL to LGPL, with consent from
+ Ben Pfaff.
+ * modules/isnan (License): Likewise.
+ Requested by Ludovic Courtès.
+
+2010-09-04 Bruno Haible <bruno@clisp.org>
+
+ gnulib-tool: Help migration from --import to --add-import or --update.
+ * gnulib-tool: Emit a verbose error message when --import is used
+ without any module name.
+
+2010-09-04 Bruno Haible <bruno@clisp.org>
+
+ Update doc about gnulib-tool.
+ * doc/gnulib-tool.texi (VCS Issues): Explain 'gnulib-tool --import' vs.
+ 'gnulib-tool --update' in more detail.
+ Reported by Eric Blake.
+
+2010-09-04 Bruno Haible <bruno@clisp.org>
+
+ gnulib-tool: Change --import. New options --add/remove-import.
+ * gnulib-tool: New options --add-import, --remove-import.
+ (func_usage): Document them.
+ (have_associative): Define always.
+ (func_import): In import mode, don't merge the specified settings with
+ the cached settings. Implement remove-import mode.
+ * doc/gnulib-tool.texi (Modified imports): Mention the new options.
+ Explain when to use them versus --import.
+ (Simple update): Use --add-import instead of --import.
+ * NEWS: Mention the change.
+
+2010-09-04 Bruno Haible <bruno@clisp.org>
+
+ * doc/gnulib-tool.texi (Initial import): Update paragraph about
+ separate gnulib.mk.
+
+2010-09-04 Bruno Haible <bruno@clisp.org>
+
+ gnulib-tool: Don't talk about CVS any more.
+ * gnulib-tool (func_usage, func_import): Write "version control"
+ instead of CVS.
+
+2010-09-04 Jim Meyering <meyering@redhat.com>
+
+ maint.mk: avoid obscure sc_copyright_check failure in coreutils
+ * top/maint.mk (v_etc_file): Prepend $(gnulib_dir)/, to avoid
+ false positives (whose names may be ill-chosen) when searching
+ non-VC'd files. Otherwise, a file named "a b/lib/version-etc.c"
+ would cause a false-positive.
+
+ avoid coreutils "make distcheck" failure
+ Coreutils tests with an absolute build directory name that contains
+ a space. Not quoting this directory name caused a failure.
+ * tests/test-vc-list-files-git.sh: Quote PATH dir name.
+ * tests/test-vc-list-files-cvs.sh: Likewise.
+
+2010-09-04 Bruno Haible <bruno@clisp.org>
+
+ gnulib-tool: Avoid error when run in a package without Makefile.am.
+ * gnulib-tool: When collecting the m4dirs in a package that does not
+ have a Makefile.am, eliminate those directories that contain no
+ gnulib-cache.m4. Fix expression that counts these directories.
+
+2010-09-04 Bruno Haible <bruno@clisp.org>
+
+ update-copyright test: Improve output when perl is missing or too old.
+ * tests/test-update-copyright.sh: Move test of Perl version down after
+ the test whether Perl exists. Provide an explanation relating Perl's
+ error message to Automake's SKIP: message.
+
+2010-09-04 Bruno Haible <bruno@clisp.org>
+
+ Don't augment PATH in TESTS_ENVIRONMENT.
+ * modules/update-copyright-tests (Makefile.am): In TESTS_ENVIRONMENT,
+ set abs_aux_dir instead of augmenting PATH.
+ * modules/vc-list-files-tests (Makefile.am): Likewise.
+ * tests/test-update-copyright.sh: Augment PATH here.
+ * tests/test-vc-list-files-cvs.sh: Augment PATH here, through
+ path_prepend_.
+ * tests/test-vc-list-files-git.sh: Likewise.
+
+2010-09-04 Jim Meyering <meyering@redhat.com>
+
+ tests: prohibit augmenting PATH via TESTS_ENVIRONMENT
+ * Makefile (sc_prohibit_augmenting_PATH_via_TESTS_ENVIRONMENT): New rule.
+
+2010-09-04 Bruno Haible <bruno@clisp.org>
+
+ strdup: Fix compilation error in C++ mode.
+ * lib/string.in.h (strdup): In C++ mode with GNULIB_NAMESPACE, undefine
+ the macro.
+
+2010-09-04 Bruno Haible <bruno@clisp.org>
+
+ dirfd: Fix compilation error in C++ mode on MacOS X, *BSD, IRIX.
+ * lib/dirent.in.h (dirfd): In C++ mode with GNULIB_NAMESPACE, turn the
+ macro into a function.
+ Reported by Jarno Rajahalme <jarno.rajahalme@nsn.com>.
+
+2010-09-04 Bruno Haible <bruno@clisp.org>
+
+ Set PATH_SEPARATOR the same way autoconf does.
+ * build-aux/relocatable.sh.in (func_find_curr_installdir): Determine
+ the value of PATH_SEPARATOR the same way autoconf-generated configure
+ scripts do.
+ * m4/lib-ld.m4 (AC_LIB_PROG_LD): Likewise.
+ * m4/progtest.m4 (AM_PATH_PROG_WITH_TEST): Likewise.
+
+2010-09-04 Stefano Lattarini <stefano.lattarini@gmail.com> (tiny change)
+
+ Set PATH_SEPARATOR the same way autoconf does.
+ * gnulib-tool (func_gnulib_dir): Determine the value of PATH_SEPARATOR
+ the same way autoconf-generated configure scripts do.
+ * posix-modules: Likewise.
+
+2010-09-02 Paul Eggert <eggert@cs.ucla.edu>
+
+ hash: fix safe_hasher const typo
+ * lib/hash.c (safe_hasher): Result is pointer, not pointer to
+ const; otherwise, there is a type error later.
+
+2010-09-02 Jim Meyering <meyering@redhat.com>
+
+ test-update-copyright.sh: require perl 5.8.0
+ * tests/test-update-copyright.sh: Require 5.8.0,
+ which Tom G. Christensen has confirmed is adequate,
+ while 5.6.1 is not.
+
+2010-09-02 Eric Blake <eblake@redhat.com>
+
+ tests: init.sh improvements for re-exec'ing with zsh
+ * tests/init.sh: Borrow autoconf POSIX-mode sanitization. Pass
+ -vx through shell re-exec.
+ Reported by Tom G. Christensen.
+
+ wctype: fix typo in previous commit
+ * m4/wctype_h.m4 (gl_WCTYPE_H): Fix spelling.
+ Reported by Ludovic Courtès.
+
+2010-09-02 Jim Meyering <meyering@redhat.com>
+
+ test-update-copyright.sh: skip test if Perl is too old
+ * tests/test-update-copyright.sh: Exit 77 if Perl is too old.
+ Reported by Tom G. Christensen.
+
+2010-09-02 Bruno Haible <bruno@clisp.org>
+
+ wctype: Avoid compilation error on IRIX 6.5.30.
+ * lib/wctype.in.h (iswblank): Declare with a replacement if
+ REPLACE_ISWBLANK is set.
+ * m4/wctype_h.m4 (gl_WCTYPE_H): Check also whether iswblank is
+ declared. Set REPLACE_ISWBLANK.
+ * modules/wctype (Makefile.am): Substitute REPLACE_ISWBLANK.
+ * doc/posix-functions/iswblank.texi: Mention the IRIX 6.5.30 problem.
+ * doc/posix-headers/wctype.texi: Likewise.
+ Reported by Tom G. Christensen <tgc@jupiterrise.com>.
+
+2010-09-01 Bruno Haible <bruno@clisp.org>
+
+ New module 'socketlib'.
+ * modules/socketlib: New file.
+ * m4/socketlib.m4: New file, extracted from m4/sockets.m4.
+ * m4/sockets.m4 (gl_SOCKETS): Require gl_SOCKETLIB.
+ * modules/sockets (Depends-on): Add socketlib.
+ Suggested by Sam Steingold <sds@gnu.org>.
+
+2010-09-01 Paul Eggert <eggert@cs.ucla.edu>
+
+ fcntl-h, etc.: prefer O_SEARCH to O_RDONLY when applicable
+
+ POSIX 2008 specifies a new 'open' flag O_SEARCH, which can be used
+ when one needs search access to a directory but not read access.
+ On systems where it is available, it works in some cases where
+ O_RDONLY does not, namely on directories that are searchable but
+ not readable, and which need only to be searchable. If O_SEARCH
+ is not available, fall back to the traditional method of using
+ O_RDONLY.
+
+ * lib/fcntl.in.h (O_SEARCH): #define to O_RDONLY if not defined.
+ * lib/chdir-long.c (cdb_advance_fd): Use O_SEARCH, not O_RDONLY,
+ when opening a directory that needs only to be searchable.
+ * lib/chdir-safer.c (chdir_no_follow): Likewise.
+ * lib/fts.c (diropen, fts_open, fd_ring_check): Likewise.
+ * lib/openat-proc.c (openat_proc_name): Likewise.
+ * lib/openat.c (openat_needs_fchdir): Likewise.
+ * lib/save-cwd.c (save_cwd): Likewise.
+ * lib/savewd.c (savewd_save, savewd_chdir): Likewise.
+
+2010-08-28 Bruno Haible <bruno@clisp.org>
+
+ New module 'host-cpu-c-abi'.
+ * modules/host-cpu-c-abi: New file.
+ * m4/host-cpu-c-abi.m4: New file, based on part of
+ clisp/src/m4/general.m4.
+ Requested by Sam Steingold <sds@gnu.org>.
+
+2010-08-31 Eric Blake <eblake@redhat.com>
+ and Jim Meyering <meyering@redhat.com>
+
+ hash: factor, and guard against misbehaving hasher function
+ * lib/hash.c (safe_hasher): New function, to encapsulate the checking
+ of table->hasher's return value. Also protect against a hash value
+ so large that adding it to table->bucket results in a NULL pointer.
+ (hash_lookup, hash_get_next, hash_find_entry, transfer_entries):
+ Use it in place of open-coded check-and-abort.
+
+2010-08-30 Bruno Haible <bruno@clisp.org>
+
+ hash: silence spurious clang warning
+ * lib/hash.c (hash_get_next): Remove unnecessary test against NULL.
+ Reported by Eric Blake.
+
+2010-08-30 Eric Blake <eblake@redhat.com>
+
+ strstr, memmem, strcasestr: avoid leaked shell message
+ * m4/strstr.m4 (gl_FUNC_STRSTR): Avoid "Alarm clock" message from
+ FreeBSD.
+ * m4/strcasestr.m4 (gl_FUNC_STRCASESTR): Likewise.
+ * m4/memmem.m4 (gl_FUNC_MEMMEM): Likewise.
+
+ tests: silence clang warning
+ * tests/test-malloca.c (do_allocation): Avoid dead store.
+
+2010-08-29 Bruno Haible <bruno@clisp.org>
+
+ gettext: Fix recent mistake.
+ * m4/intl.m4 (gt_CHECK_DECL): Fix typo introduced on 2010-08-26.
+
+2010-08-29 Bruno Haible <bruno@clisp.org>
+
+ selinux-h: Offer a --without-selinux option.
+ * m4/selinux-selinux-h.m4 (gl_HEADERS_SELINUX_SELINUX_H): If
+ --without-selinux was specified, skip all tests and define
+ HAVE_SELINUX_SELINUX_H to 0.
+ (gl_LIBSELINUX): Offer --without-selinux option. If it is specified,
+ set LIB_SELINUX to empty.
+ * m4/selinux-context-h.m4 (gl_HEADERS_SELINUX_CONTEXT_H): Require
+ gl_LIBSELINUX. If --without-selinux was specified, replace
+ selinux/context.h.
+ Reported by Johan Hattne <johan.hattne@utsouthwestern.edu>.
+
+2010-08-29 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
+ Bruno Haible <bruno@clisp.org>
+
+ Make the module 'realloc-gnu' work again on AIX and OSF/1.
+ * m4/realloc.m4 (gl_FUNC_REALLOC_GNU): Define HAVE_REALLOC_GNU instead
+ of HAVE_REALLOC.
+ * lib/realloc.c (NEED_REALLOC_GNU): Enable behaviour also when
+ GNULIB_REALLOC_GNU && !HAVE_REALLOC_GNU.
+ (SYSTEM_MALLOC_GLIBC_COMPATIBLE): Adjust definition.
+ * modules/realloc-gnu (configure.ac): Use gl_MODULE_INDICATOR.
+
+2010-08-29 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
+ Bruno Haible <bruno@clisp.org>
+
+ Make the module 'calloc-gnu' work again on AIX and OSF/1.
+ * m4/calloc.m4 (gl_FUNC_CALLOC_GNU): Define HAVE_CALLOC_GNU instead of
+ HAVE_CALLOC.
+ * lib/xmalloc.c: Update accordingly.
+ * lib/calloc.c (NEED_CALLOC_GNU): Enable also when
+ GNULIB_CALLOC_GNU && !HAVE_CALLOC_GNU.
+ * modules/calloc-gnu (configure.ac): Invoke gl_MODULE_INDICATOR.
+
+2010-08-29 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
+ Bruno Haible <bruno@clisp.org>
+
+ Make the module 'malloc-gnu' work again on AIX and OSF/1.
+ * m4/malloc.m4 (gl_FUNC_MALLOC_GNU): Define HAVE_MALLOC_GNU instead of
+ HAVE_MALLOC.
+ * lib/malloc.c (NEED_MALLOC_GNU): Enable behaviour also when
+ GNULIB_MALLOC_GNU && !HAVE_MALLOC_GNU.
+ * modules/malloc-gnu (configure.ac): Use gl_MODULE_INDICATOR.
+
+2010-08-29 Bruno Haible <bruno@clisp.org>
+
+ Update modules list.
+ * MODULES.html.sh (Memory management functions <stdlib.h>): Add
+ malloc-gnu, calloc-gnu, realloc-gnu. Remove malloc, calloc, realloc.
+ (String handling <string.h>): Add astrxfrm.
+ (File system functions): Add readlinkat.
+
+2010-08-28 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
+
+ Tests for module 'realloc-gnu'.
+ * modules/realloc-gnu-tests: New file.
+ * tests/test-realloc-gnu.c: New file.
+
+ Tests for module 'calloc-gnu'.
+ * modules/calloc-gnu-tests: New file.
+ * tests/test-calloc-gnu.c: New file.
+
+ Tests for module 'malloc-gnu'.
+ * modules/malloc-gnu-tests: New file.
+ * tests/test-malloc-gnu.c: New file.
+
+2010-08-28 Bruno Haible <bruno@clisp.org>
+
+ Rename module 'realloc' -> 'realloc-gnu'.
+ * modules/realloc-gnu: New file, copied from modules/realloc.
+ * modules/realloc: Convert to a redirection to 'realloc-gnu'. Mark as
+ obsolete.
+ * modules/mgetgroups (Depends-on): Update.
+ * doc/posix-functions/realloc.texi: Update.
+ * NEWS: Mention the change.
+
+ Rename module 'calloc' -> 'calloc-gnu'.
+ * modules/calloc-gnu: New file, copied from modules/calloc.
+ * modules/calloc: Convert to a redirection to 'calloc-gnu'. Mark as
+ obsolete.
+ * doc/posix-functions/calloc.texi: Update.
+ * NEWS: Mention the change.
+
+ Rename module 'malloc' -> 'malloc-gnu'.
+ * modules/malloc-gnu: New file, copied from modules/malloc.
+ * modules/malloc: Convert to a redirection to 'malloc-gnu'. Mark as
+ obsolete.
+ * modules/argp (Depends-on): Update.
+ * modules/regex (Depends-on): Update.
+ * doc/posix-functions/malloc.texi: Update.
+ * NEWS: Mention the change.
+
2010-08-28 Eric Blake <eblake@redhat.com>
pread, pwrite: add missing dependency
2010-08-28 Bruno Haible <bruno@clisp.org>
+ read-file: Don't occupy too much unused memory.
+ * lib/read-file.c (fread_file): Shrink the buffer at the end.
+
+2010-08-28 Giuseppe Scrivano <gscrivano@gnu.org>
+ Eric Blake <eblake@redhat.com>
+ Bruno Haible <bruno@clisp.org>
+
+ read-file: Avoid memory reallocations with regular files.
+ * lib/read-file.c: Include <sys/stat.h>, <stdio.h>, <stdint.h>.
+ (fread_file): With regular files, use the remaining length as the
+ initial buffer size. Check against overflow.
+ * modules/read-file (Depends-on): Add ftello, malloc-posix, stdint,
+ sys_stat.
+
+2010-08-28 Bruno Haible <bruno@clisp.org>
+
ftello: Relax license.
* modules/ftello (License): Relax to LGPLv2+.
Reported by Eric Blake.
2010-08-28 Bruno Haible <bruno@clisp.org>
+ Prefer using AC_DEFUN_ONCE over AC_DEFUN in projects with gnulib.
+ * m4/iconv.m4 (gl_iconv_AC_DEFUN): Use AC_DEFUN_ONCE if gl_00GNULIB is
+ defined.
+ * m4/libunistring.m4 (gl_libunistring_AC_DEFUN): Likewise.
+ Suggested by Eric Blake.
+
+2010-08-28 Bruno Haible <bruno@clisp.org>
+
sys_socket, netdb: Ensure socklen_t gets defined.
* modules/sys_socket (Depends-on): Add socklen.
* modules/netdb (Depends-on): Likewise.
* m4/lseek.m4 (gl_FUNC_LSEEK): Use correct format for
AC_LINK_IFELSE.
+ include_next: silence autoconf 2.68 warning
+ * m4/include_next.m4 (gl_INCLUDE_NEXT): Mark this use of
+ AC_COMPILE_IFELSE as special.
+ (AC_LANG_DEFINES_PROVIDED): Provide dummy implementation for
+ autoconf < 2.68.
+
acl: fix compilation test
* m4/acl.m4 (gl_FUNC_ALL): Use correct format for
AC_COMPILE_IFELSE.
+2010-08-26 Bruno Haible <bruno@clisp.org>
+
+ Modernize AC_TRY_RUN invocations.
+ * m4/btowc.m4 (gl_FUNC_BTOWC): Use AC_RUN_IFELSE instead of AC_TRY_RUN.
+ * m4/duplocale.m4 (gl_FUNC_DUPLOCALE): Likewise.
+ * m4/exponentd.m4 (gl_DOUBLE_EXPONENT_LOCATION): Likewise.
+ * m4/exponentf.m4 (gl_FLOAT_EXPONENT_LOCATION): Likewise.
+ * m4/exponentl.m4 (gl_LONG_DOUBLE_EXPONENT_LOCATION): Likewise.
+ * m4/fopen.m4 (gl_FUNC_FOPEN): Likewise.
+ * m4/frexp.m4 (gl_FUNC_FREXP_WORKS): Likewise.
+ * m4/frexpl.m4 (gl_FUNC_FREXPL_WORKS): Likewise.
+ * m4/ftello.m4 (gl_FUNC_FTELLO): Likewise.
+ * m4/iconv.m4 (AM_ICONV_LINK): Likewise.
+ * m4/iconv_open.m4 (gl_FUNC_ICONV_OPEN_UTF): Likewise.
+ * m4/intdiv0.m4 (gt_INTDIV0): Likewise.
+ * m4/isnanf.m4 (gl_ISNANF_WORKS): Likewise.
+ * m4/isnanl.m4 (gl_FUNC_ISNANL_WORKS): Likewise.
+ * m4/ldexpl.m4 (gl_FUNC_LDEXPL_WORKS): Likewise.
+ * m4/mbrlen.m4 (gl_MBRLEN_INCOMPLETE_STATE, gl_MBRLEN_RETVAL,
+ gl_MBRLEN_NUL_RETVAL): Likewise.
+ * m4/mbrtowc.m4 (gl_MBRTOWC_INCOMPLETE_STATE, gl_MBRTOWC_SANITYCHECK,
+ gl_MBRTOWC_NULL_ARG, gl_MBRTOWC_RETVAL, gl_MBRTOWC_NUL_RETVAL):
+ Likewise.
+ * m4/mbsrtowcs.m4 (gl_MBSRTOWCS_WORKS): Likewise.
+ * m4/open.m4 (gl_FUNC_OPEN): Likewise.
+ * m4/printf.m4 (gl_PRINTF_SIZES_C99, gl_PRINTF_LONG_DOUBLE,
+ gl_PRINTF_INFINITE, gl_PRINTF_INFINITE_LONG_DOUBLE,
+ gl_PRINTF_DIRECTIVE_A, gl_PRINTF_DIRECTIVE_F, gl_PRINTF_DIRECTIVE_N,
+ gl_PRINTF_DIRECTIVE_LS, gl_PRINTF_POSITIONS, gl_PRINTF_FLAG_GROUPING,
+ gl_PRINTF_FLAG_LEFTADJUST, gl_PRINTF_FLAG_ZERO, gl_PRINTF_PRECISION,
+ gl_SNPRINTF_TRUNCATION_C99, gl_SNPRINTF_RETVAL_C99,
+ gl_SNPRINTF_DIRECTIVE_N, gl_SNPRINTF_SIZE1, gl_VSNPRINTF_ZEROSIZE_C99):
+ Likewise.
+ * m4/printf-posix.m4 (gt_PRINTF_POSIX): Likewise.
+ * m4/signbit.m4 (gl_SIGNBIT, gl_FLOATTYPE_SIGN_LOCATION): Likewise.
+ * m4/stpncpy.m4 (gl_FUNC_STPNCPY): Likewise.
+ * m4/threadlib.m4 (gl_THREADLIB_BODY): Likewise.
+ * m4/truncl.m4 (gl_FUNC_TRUNCL): Likewise.
+ * m4/ttyname_r.m4 (gl_FUNC_TTYNAME_R): Likewise.
+ * m4/wcrtomb.m4 (gl_FUNC_WCRTOMB): Likewise.
+ * m4/wcsrtombs.m4 (gl_WCSRTOMBS_TERMINATION): Likewise.
+ * m4/wctob.m4 (gl_FUNC_WCTOB): Likewise.
+ * m4/wcwidth.m4 (gl_FUNC_WCWIDTH): Likewise.
+
+2010-08-26 Bruno Haible <bruno@clisp.org>
+
+ Modernize AC_TRY_LINK invocations.
+ * m4/acosl.m4 (gl_FUNC_ACOSL): Use AC_LINK_IFELSE instead of
+ AC_TRY_LINK.
+ * m4/argp.m4 (gl_ARGP): Likewise.
+ * m4/asinl.m4 (gl_FUNC_ASINL): Likewise.
+ * m4/atanl.m4 (gl_FUNC_ATANL): Likewise.
+ * m4/ceil.m4 (gl_FUNC_CEIL_LIBS): Likewise.
+ * m4/ceilf.m4 (gl_FUNC_CEILF_LIBS): Likewise.
+ * m4/ceill.m4 (gl_FUNC_CEILL_LIBS): Likewise.
+ * m4/codeset.m4 (AM_LANGINFO_CODESET): Likewise.
+ * m4/cosl.m4 (gl_FUNC_COSL): Likewise.
+ * m4/expl.m4 (gl_FUNC_EXPL): Likewise.
+ * m4/floor.m4 (gl_FUNC_FLOOR_LIBS): Likewise.
+ * m4/floorf.m4 (gl_FUNC_FLOORF_LIBS): Likewise.
+ * m4/floorl.m4 (gl_FUNC_FLOORL_LIBS): Likewise.
+ * m4/frexp.m4 (gl_FUNC_FREXP, gl_CHECK_FREXP_NO_LIBM): Likewise.
+ * m4/frexpl.m4 (gl_FUNC_FREXPL, gl_CHECK_FREXPL_NO_LIBM): Likewise.
+ * m4/ftello.m4 (gl_FUNC_FTELLO): Likewise.
+ * m4/gettext.m4 (AM_GNU_GETTEXT): Likewise.
+ * m4/hostent.m4 (gl_HOSTENT): Likewise.
+ * m4/iconv.m4 (AM_ICONV_LINK): Likewise.
+ * m4/intl.m4 (gt_INTL_SUBDIR_CORE): Likewise.
+ * m4/intlmacosx.m4 (gt_INTL_MACOSX): Likewise.
+ * m4/isnand.m4 (gl_HAVE_ISNAND_IN_LIBM, gl_HAVE_ISNAND_NO_LIBM):
+ Likewise.
+ * m4/isnanf.m4 (gl_HAVE_ISNANF_NO_LIBM, gl_HAVE_ISNANF_IN_LIBM):
+ Likewise.
+ * m4/isnanl.m4 (gl_HAVE_ISNANL_NO_LIBM, gl_HAVE_ISNANL_IN_LIBM):
+ Likewise.
+ * m4/lcmessage.m4 (gt_LC_MESSAGES): Likewise.
+ * m4/ldexpl.m4 (gl_FUNC_LDEXPL, gl_CHECK_LDEXPL_NO_LIBM): Likewise.
+ * m4/lib-link.m4 (AC_LIB_HAVE_LINKFLAGS): Likewise.
+ * m4/logb.m4 (gl_FUNC_LOGB): Likewise.
+ * m4/logl.m4 (gl_FUNC_LOGL): Likewise.
+ * m4/printf-frexp.m4 (gl_FUNC_PRINTF_FREXP): Likewise.
+ * m4/servent.m4 (gl_SERVENT): Likewise.
+ * m4/signbit.m4 (gl_SIGNBIT): Likewise.
+ * m4/sinl.m4 (gl_FUNC_SINL): Likewise.
+ * m4/sqrtl.m4 (gl_FUNC_SQRTL): Likewise.
+ * m4/tanl.m4 (gl_FUNC_TANL): Likewise.
+ * m4/threadlib.m4 (gl_THREADLIB_BODY): Likewise.
+ * m4/trunc.m4 (gl_FUNC_TRUNC): Likewise.
+ * m4/truncf.m4 (gl_FUNC_TRUNCF): Likewise.
+ * m4/truncl.m4 (gl_FUNC_TRUNCL): Likewise.
+ * modules/tsearch-tests (configure.ac): Likewise.
+
+2010-08-26 Bruno Haible <bruno@clisp.org>
+
+ Modernize AC_TRY_COMPILE invocations.
+ * m4/environ.m4 (gt_CHECK_VAR_DECL): Use AC_COMPILE_IFELSE instead of
+ AC_TRY_COMPILE.
+ * m4/iconv.m4 (gl_iconv_AC_DEFUN): Likewise.
+ * m4/intl.m4 (gt_CHECK_DECL): Likewise.
+ * m4/intmax.m4 (gt_TYPE_INTMAX_T): Likewise.
+ * m4/intmax_t.m4 (gt_AC_TYPE_INTMAX_T): Likewise.
+ * m4/inttypes-pri.m4 (gt_INTTYPES_PRI): Likewise.
+ * m4/inttypes_h.m4 (gl_AC_HEADER_INTTYPES_H): Likewise.
+ * m4/locale_h.m4 (gl_LOCALE_H): Likewise.
+ * m4/lock.m4 (gl_LOCK): Likewise.
+ * m4/malloc.m4 (gl_CHECK_MALLOC_POSIX): Likewise.
+ * m4/mbswidth.m4 (gl_MBSWIDTH): Likewise.
+ * m4/minmax.m4 (gl_MINMAX_IN_HEADER): Likewise.
+ * m4/setenv.m4 (gl_FUNC_UNSETENV): Likewise.
+ * m4/size_max.m4 (gl_SIZE_MAX): Likewise.
+ * m4/ssize_t.m4 (gt_TYPE_SSIZE_T): Likewise.
+ * m4/stdarg.m4 (gl_STDARG_H): Likewise.
+ * m4/stdbool.m4 (AC_HEADER_STDBOOL): Likewise.
+ * m4/stdint_h.m4 (gl_AC_HEADER_STDINT_H): Likewise.
+ * m4/visibility.m4 (gl_VISIBILITY): Likewise.
+ * m4/wchar_t.m4 (gt_TYPE_WCHAR_T): Likewise.
+ * m4/wint_t.m4 (gt_TYPE_WINT_T): Likewise.
+ * m4/libunistring.m4 (gl_LIBUNISTRING_CORE): Likewise. Remove
+ extraneous semicolon.
+
2010-08-26 Jim Meyering <meyering@redhat.com>
stat-time: relax license LGPL
* Bison 2.0 or newer.
+ Recommended.
- Needed if you use the 'getdate' module.
+ Needed if you use the 'parse-datetime' module.
+ Homepage:
http://www.gnu.org/software/bison/
+ Download:
func_echo "$element"
func_begin_table
- func_module calloc
+ func_module calloc-gnu
func_module eealloc
func_module free
- func_module malloc
- func_module realloc
+ func_module malloc-gnu
+ func_module realloc-gnu
func_module pagealign_alloc
func_end_table
func_module strstr
func_module strstr-simple
func_module c-strstr
+ func_module astrxfrm
func_module trim
func_module fstrcmp
func_module xstrndup
func_echo "$element"
func_begin_table
- func_module getdate
+ func_module parse-datetime
func_module timegm
func_module tzset
func_end_table
func_module openat-die
func_module pathmax
func_module read-file
+ func_module readlinkat
func_module same
func_module save-cwd
func_module savedir
cd doc && $(MAKE) $@ && $(MAKE) mostlyclean
# Perform some platform independent checks on the gnulib code.
-check: sc_prefer_ac_check_funcs_once
+check: \
+ sc_prohibit_augmenting_PATH_via_TESTS_ENVIRONMENT \
+ sc_pragma_columns \
+ sc_prefer_ac_check_funcs_once
sc_prefer_ac_check_funcs_once:
if test -d .git; then \
in modules/ 1>&2; exit 1; } || : \
else :; fi
+sc_prohibit_augmenting_PATH_via_TESTS_ENVIRONMENT:
+ if test -d .git; then \
+ url=http://thread.gmane.org/gmane.comp.lib.gnulib.bugs/22874; \
+ git grep '^[ ]*TESTS_ENVIRONMENT += PATH=' modules \
+ && { printf '%s\n' 'Do not augment PATH via TESTS_ENVIRONMENT;' \
+ " see <$$url>" 1>&2; exit 1; } || : \
+ else :; fi
+
+sc_pragma_columns:
+ if test -d .git; then \
+ git ls-files|grep '\.in\.h$$' \
+ | xargs grep -l '^@PRAGMA_SYSTEM_HEADER@' \
+ | xargs grep -L '^@PRAGMA_COLUMNS@' \
+ | grep . \
+ && { printf '%s\n' \
+ 'the files listed above use @PRAGMA_SYSTEM_HEADER@' \
+ 'without also using @PRAGMA_COLUMNS@' 1>&2; \
+ exit 1; } || :; \
+ else :; fi
+
# Regenerate some files that are stored in the repository.
regen: MODULES.html
Important notes
---------------
+2010-09-04 gnulib-tool The option '--import' is no longer cumulative; it
+ now expects the complete list of modules and other
+ options on the command line. If you want to
+ augment (not set) the list of modules, use the
+ new option '--add-import' instead of '--import'.
+
User visible incompatible changes
---------------------------------
Date Modules Changes
+2010-10-05 getdate This module is deprecated. Please use the new
+ parse-datetime module for the replacement
+ function parse_datetime(), or help us write
+ getdate-posix for getdate(). Also, the header
+ "getdate.h" has been renamed "parse-datetime.h",
+ and doc/getdate.texi to doc/parse-datetime.texi.
+
+2010-09-29 sys_wait This module no longer provides the waitpid()
+ function. If you need this function, you now need
+ to request the 'waitpid' module.
+
+2010-09-17 utimens The function gl_futimens is removed, and its
+ signature has been migrated to fdutimens. Callers
+ of gl_futimens should change function name, and
+ callers of fdutimens should swap parameter order.
+
+2010-09-17 fdutimensat This function has a new signature: the fd now comes
+ first instead of the dir/name pair, and a new
+ atflag parameter is added at the end. Old code
+ should rearrange parameters, and pass 0 for atflag.
+
+2010-09-13 regex The module is not guaranteeing anymore support for
+ 64-bit regoff_t on 64-bit systems. The size of
+ regoff_t will always be 32-bit unless the program
+ is being configured --with-included-regex. This
+ may change again in the future once glibc provides
+ this feature as well.
+
+2010-09-12 savedir The fdsavedir function is now deprecated.
+
+2010-09-10 fcntl-h This module now defaults O_CLOEXEC to 0, and
+ it defaults O_EXEC and O_SEARCH to O_RDONLY.
+ Use "#if O_CLOEXEC" instead of "#ifdef O_CLOEXEC".
+
+2010-08-28 realloc This module is deprecated. Use 'realloc-gnu'
+ instead. It will be removed 2012-01-01.
+
+2010-08-28 calloc This module is deprecated. Use 'calloc-gnu'
+ instead. It will be removed 2012-01-01.
+
+2010-08-28 malloc This module is deprecated. Use 'malloc-gnu'
+ instead. It will be removed 2012-01-01.
+
2010-08-14 memxfrm This module is renamed to amemxfrm. The include
file is renamed to "amemxfrm.h". The function is
renamed to amemxfrm.
Gnulib stable snapshot
----------------------
+ * 20101024-stable
+
+Snapshot taken based on:
+
+commit ba523890aa7bae76e3ac6b3ce68f22a79d25ce2c
+Date: Wed Oct 13 10:15:38 2010 +0200
+
+with the following additional commits:
+
+ * [b6d1430]->[fef7abe] termios: fix compilation on mingw
+ * [74b1e48]->[7bf74f7] socketlib: Fix.
+ * [d239853]->[ced7fa1] vasnprintf: Don't set errno to 0.
+ * [fdaeccf]->[66e670a] GNUmakefile: handle "stable" target, not "major"
+ * [cac3889]->[7661272] ignore-value: make header idempotent
+ * [61241ea]->[25d72f8] termios: Update documentation.
+ * [94617c2]->[a964f9e] Fix date in ChangeLog.
+ * [3f75f63]->[7966020] nextafter: Fix configure check.
+ * [b86f488]->[ddc319e] c-stack: work around libsigsegv 2.8 bug
+ * [a0598ff]->[69c6204] nl_langinfo test: Avoid test failure on NetBSD 5.
+ * [f8dd25c]->[9116c10] Tests: Fix LOCALE_JA on MirBSD 10.
+ * [9645318]->[87dea4e] nl_langinfo: Mention problem with CRNCYSTR on NetBSD 5.0.
+
+----------------------------------------------------------------------
+
* 20100829-stable
Snapshot taken based on:
# Wrapper for Microsoft lib.exe
me=ar-lib
-scriptversion=2010-08-12.16; # UTC
+scriptversion=2010-09-02.19; # UTC
# Copyright (C) 2010 Free Software
# Foundation, Inc.
esac
done
else
- $AR -NOLOGO -LIST "$archive" | while read member
+ $AR -NOLOGO -LIST "$archive" | sed -e 's/\\/\\\\/g' | while read member
do
$AR -NOLOGO -EXTRACT:"$member" "$archive" || exit $?
done
#! /bin/sh
# Print a version string.
-scriptversion=2010-07-06.10; # UTC
+scriptversion=2010-10-08.16; # UTC
# Bootstrap this package from checked-out sources.
# Any gnulib files needed that are not in modules.
gnulib_files=
+# A function to be called to edit gnulib.mk right after it's created.
+# Override it via your own definition in bootstrap.conf.
+gnulib_mk_hook() { :; }
+
# A function to be called after everything else in this script.
# Override it via your own definition in bootstrap.conf.
bootstrap_epilogue() { :; }
ret=0
while read app req_ver; do
+ # We only need libtoolize from the libtool package.
+ if test "$app" = libtool; then
+ app=libtoolize
+ fi
# Honor $APP variables ($TAR, $AUTOCONF, etc.)
- appvar=`echo $app | tr '[a-z]' '[A-Z]'`
+ appvar=`echo $app | tr '[a-z]-' '[A-Z]_'`
test "$appvar" = TAR && appvar=AMTAR
eval "app=\${$appvar-$app}"
inst_ver=$(get_version $app)
print_versions() {
echo "Program Min_version"
echo "----------------------"
- printf "$buildreq"
+ printf %s "$buildreq"
echo "----------------------"
# can't depend on column -t
}
+use_libtool=0
+# We'd like to use grep -E, to see if any of LT_INIT,
+# AC_PROG_LIBTOOL, AM_PROG_LIBTOOL is used in configure.ac,
+# but that's not portable enough (e.g., for Solaris).
+grep '^[ ]*A[CM]_PROG_LIBTOOL' configure.ac >/dev/null \
+ && use_libtool=1
+grep '^[ ]*LT_INIT' configure.ac >/dev/null \
+ && use_libtool=1
+if test $use_libtool = 1; then
+ find_tool LIBTOOLIZE glibtoolize libtoolize
+fi
+
if ! printf "$buildreq" | check_versions; then
- test -f README-prereq &&
- echo "See README-prereq for notes on obtaining these prerequisite programs:" >&2
- echo
- print_versions
+ echo >&2
+ if test -f README-prereq; then
+ echo "See README-prereq for how to get the prerequisite programs" >&2
+ else
+ echo "Please install the prerequisite programs" >&2
+ fi
exit 1
fi
for file in `ls -a $1/$dir`; do
case $file in
.|..) continue;;
- .*) continue;; # FIXME: should all file names starting with "." be ignored?
+ # FIXME: should all file names starting with "." be ignored?
+ .*) continue;;
esac
test -d $1/$dir/$file && continue
for excluded_file in $excluded_files; do
if test $file = Makefile.am && test "X$gnulib_mk" != XMakefile.am; then
copied=$copied${sep}$gnulib_mk; sep=$nl
remove_intl='/^[^#].*\/intl/s/^/#/;'"s!$bt_regex/!!g"
- sed "$remove_intl" $1/$dir/$file | cmp - $dir/$gnulib_mk > /dev/null || {
+ sed "$remove_intl" $1/$dir/$file |
+ cmp - $dir/$gnulib_mk > /dev/null || {
echo "$0: Copying $1/$dir/$file to $dir/$gnulib_mk ..." &&
rm -f $dir/$gnulib_mk &&
- sed "$remove_intl" $1/$dir/$file >$dir/$gnulib_mk
+ sed "$remove_intl" $1/$dir/$file >$dir/$gnulib_mk &&
+ gnulib_mk_hook $dir/$gnulib_mk
}
elif { test "${2+set}" = set && test -r $2/$dir/$file; } ||
version_controlled_file $dir $file; then
# the name with just ".h". Many gnulib headers are generated,
# e.g., stdint.in.h -> stdint.h, dirent.in.h ->..., etc.
# Likewise for .gperf -> .h, .y -> .c, and .sin -> .sed
- f=`echo "$copied"|sed 's/\.in\.h$/.h/;s/\.sin$/.sed/;s/\.y$/.c/;s/\.gperf$/.h/'`
+ f=`echo "$copied" |
+ sed '
+ s/\.in\.h$/.h/
+ s/\.sin$/.sed/
+ s/\.y$/.c/
+ s/\.gperf$/.h/
+ '
+ `
insert_sorted_if_absent $ig "$f"
# For files like sys_stat.in.h and sys_time.in.h, record as
--local-dir $local_gl_dir\
$gnulib_tool_option_extras\
"
+if test $use_libtool = 1; then
+ case "$gnulib_tool_options " in
+ *' --libtool '*) ;;
+ *) gnulib_tool_options="$gnulib_tool_options --libtool" ;;
+ esac
+fi
echo "$0: $gnulib_tool $gnulib_tool_options --import ..."
$gnulib_tool $gnulib_tool_options --import $gnulib_modules &&
slurp $bt || exit
for command in \
libtool \
- "${ACLOCAL-aclocal} --force -I m4" \
+ "${ACLOCAL-aclocal} --force -I m4 $ACLOCAL_FLAGS" \
"${AUTOCONF-autoconf} --force" \
"${AUTOHEADER-autoheader} --force" \
"${AUTOMAKE-automake} --add-missing --copy --force-missing"
do
if test "$command" = libtool; then
- use_libtool=0
- # We'd like to use grep -E, to see if any of LT_INIT,
- # AC_PROG_LIBTOOL, AM_PROG_LIBTOOL is used in configure.ac,
- # but that's not portable enough (e.g., for Solaris).
- grep '^[ ]*A[CM]_PROG_LIBTOOL' configure.ac >/dev/null \
- && use_libtool=1
- grep '^[ ]*LT_INIT' configure.ac >/dev/null \
- && use_libtool=1
test $use_libtool = 0 \
&& continue
command="${LIBTOOLIZE-libtoolize} -c -f"
#! /bin/sh
# Wrapper for compilers which do not understand `-c -o'.
-scriptversion=2010-08-16.11; # UTC
+scriptversion=2010-09-21.14; # UTC
# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2009, 2010 Free Software
# Foundation, Inc.
}
# func_cl_wrapper cl arg...
-# Adjust compile command to suite cl
+# Adjust compile command to suit cl
func_cl_wrapper ()
{
# Assume a capable shell
+ lib_path=
+ shared=:
linker_opts=
for arg
do
shift
;;
-l*)
- set x "$@" "${1#-l}.lib"
+ lib=${1#-l}
+ found=no
+ save_IFS=$IFS
+ IFS=';'
+ for dir in $lib_path $LIB
+ do
+ IFS=$save_IFS
+ if $shared && test -f "$dir/$lib.dll.lib"; then
+ found=yes
+ set x "$@" "$dir/$lib.dll.lib"
+ break
+ fi
+ if test -f "$dir/$lib.lib"; then
+ found=yes
+ set x "$@" "$dir/$lib.lib"
+ break
+ fi
+ done
+ IFS=$save_IFS
+
+ test "$found" != yes && set x "$@" "$lib.lib"
shift
;;
-L*)
func_file_conv "${1#-L}"
+ if test -z "$lib_path"; then
+ lib_path=$file
+ else
+ lib_path="$lib_path;$file"
+ fi
linker_opts="$linker_opts -LIBPATH:$file"
;;
+ -static)
+ shared=false
+ ;;
-Wl,*)
arg=${1#-Wl,}
save_ifs="$IFS"; IFS=','
set x "$@" -Tp"$file"
shift
;;
- *.c | *.cpp | *.CPP | *.lib | *.LIB | *.Lib)
+ *.c | *.cpp | *.CPP | *.lib | *.LIB | *.Lib | *.OBJ | *.obj | *.[oO])
func_file_conv "$1" mingw
set x "$@" "$file"
shift
# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
# Free Software Foundation, Inc.
-timestamp='2010-08-21'
+timestamp='2010-09-24'
# This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
*:QNX:*:4*)
echo i386-pc-qnx
exit ;;
+ NEO-?:NONSTOP_KERNEL:*:*)
+ echo neo-tandem-nsk${UNAME_RELEASE}
+ exit ;;
NSE-?:NONSTOP_KERNEL:*:*)
echo nse-tandem-nsk${UNAME_RELEASE}
exit ;;
# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
# Free Software Foundation, Inc.
-timestamp='2010-08-13'
+timestamp='2010-09-11'
# This file is (in principle) common to ALL GNU software.
# The presence of a machine in this file suggests that SOME GNU software
| moxie \
| mt \
| msp430 \
- | nds32 | nds32le \
+ | nds32 | nds32le | nds32be \
| nios | nios2 \
| ns16k | ns32k \
| or32 \
| mmix-* \
| mt-* \
| msp430-* \
- | nds32-* | nds32le-* \
+ | nds32-* | nds32le-* | nds32be-* \
| nios-* | nios2-* \
| none-* | np1-* | ns16k-* | ns32k-* \
| orion-* \
np1)
basic_machine=np1-gould
;;
+ neo-tandem)
+ basic_machine=neo-tandem
+ ;;
+ nse-tandem)
+ basic_machine=nse-tandem
+ ;;
nsr-tandem)
basic_machine=nsr-tandem
;;
#! /bin/sh
# depcomp - compile a program generating dependencies as side-effects
-scriptversion=2009-04-28.21; # UTC
+scriptversion=2010-10-07.20; # UTC
-# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007, 2009 Free
-# Software Foundation, Inc.
+# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007, 2009, 2010
+# 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
# This is just like msvisualcpp but w/o cygpath translation.
# Just convert the backslash-escaped backslashes to single forward
# slashes to satisfy depend.m4
- cygpath_u="sed s,\\\\\\\\,/,g"
+ cygpath_u='sed s,\\\\,/,g'
depmode=msvisualcpp
fi
+if test "$depmode" = msvc7msys; then
+ # This is just like msvc7 but w/o cygpath translation.
+ # Just convert the backslash-escaped backslashes to single forward
+ # slashes to satisfy depend.m4
+ cygpath_u='sed s,\\\\,/,g'
+ depmode=msvc7
+fi
+
case "$depmode" in
gcc3)
## gcc 3 implements dependency tracking that does exactly what
rm -f "$tmpdepfile"
;;
+msvc7)
+ if test "$libtool" = yes; then
+ showIncludes=-Wc,-showIncludes
+ else
+ showIncludes=-showIncludes
+ fi
+ "$@" $showIncludes > "$tmpdepfile"
+ stat=$?
+ grep -v '^Note: including file: ' "$tmpdepfile"
+ if test "$stat" = 0; then :
+ else
+ rm -f "$tmpdepfile"
+ exit $stat
+ fi
+ rm -f "$depfile"
+ echo "$object : \\" > "$depfile"
+ # The first sed program below extracts the file names and escapes
+ # backslashes for cygpath. The second sed program outputs the file
+ # name when reading, but also accumulates all include files in the
+ # hold buffer in order to output them again at the end. This only
+ # works with sed implementations that can handle large buffers.
+ sed < "$tmpdepfile" -n '
+/^Note: including file: *\(.*\)/ {
+ s//\1/
+ s/\\/\\\\/g
+ p
+}' | $cygpath_u | sort -u | sed -n '
+s/ /\\ /g
+s/\(.*\)/ \1 \\/p
+s/.\(.*\) \\/\1:/
+H
+$ {
+ s/.*/ /
+ G
+ p
+}' >> "$depfile"
+ rm -f "$tmpdepfile"
+ ;;
+
+msvc7msys)
+ # This case exists only to let depend.m4 do its work. It works by
+ # looking at the text of this script. This case will never be run,
+ # since it is checked for above.
+ exit 1
+ ;;
+
#nosideeffect)
# This comment above is used by automake to tell side-effect
# dependency tracking mechanisms from slower ones.
# gendocs.sh -- generate a GNU manual in many formats. This script is
# mentioned in maintain.texi. See the help message below for usage details.
-scriptversion=2010-07-26.16
+scriptversion=2010-09-17.07
# Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
# Free Software Foundation, Inc.
fi
case $outdir in
- /*) dotdot_outdir="$outdir";;
- *) dotdot_outdir="../$outdir";;
+ /*) abs_outdir=$outdir;;
+ *) abs_outdir=$srcdir/$outdir;;
esac
echo Generating output formats for $srcfile
cmd="$SETLANG $MAKEINFO -o $PACKAGE.info \"$srcfile\""
echo "Generating info files... ($cmd)"
eval "$cmd"
-mkdir -p $outdir/
-tar czf $outdir/$PACKAGE.info.tar.gz $PACKAGE.info*
-info_tgz_size=`calcsize $outdir/$PACKAGE.info.tar.gz`
+mkdir -p "$outdir/"
+tar czf "$outdir/$PACKAGE.info.tar.gz" $PACKAGE.info*
+info_tgz_size=`calcsize "$outdir/$PACKAGE.info.tar.gz"`
# do not mv the info files, there's no point in having them available
# separately on the web.
${DVIPS} $PACKAGE -o
gzip -f -9 $PACKAGE.ps
ps_gz_size=`calcsize $PACKAGE.ps.gz`
-mv $PACKAGE.ps.gz $outdir/
+mv $PACKAGE.ps.gz "$outdir/"
# compress/finish dvi:
gzip -f -9 $PACKAGE.dvi
dvi_gz_size=`calcsize $PACKAGE.dvi.gz`
-mv $PACKAGE.dvi.gz $outdir/
+mv $PACKAGE.dvi.gz "$outdir/"
cmd="$SETLANG ${TEXI2DVI} --pdf \"$srcfile\""
echo "Generating pdf ... ($cmd)"
eval "$cmd"
pdf_size=`calcsize $PACKAGE.pdf`
-mv $PACKAGE.pdf $outdir/
+mv $PACKAGE.pdf "$outdir/"
cmd="$SETLANG $MAKEINFO -o $PACKAGE.txt --no-split --no-headers \"$srcfile\""
echo "Generating ASCII... ($cmd)"
eval "$cmd"
ascii_size=`calcsize $PACKAGE.txt`
-gzip -f -9 -c $PACKAGE.txt >$outdir/$PACKAGE.txt.gz
-ascii_gz_size=`calcsize $outdir/$PACKAGE.txt.gz`
-mv $PACKAGE.txt $outdir/
+gzip -f -9 -c $PACKAGE.txt >"$outdir/$PACKAGE.txt.gz"
+ascii_gz_size=`calcsize "$outdir/$PACKAGE.txt.gz"`
+mv $PACKAGE.txt "$outdir/"
html_split()
{
(
cd ${split_html_dir} || exit 1
ln -sf ${PACKAGE}.html index.html
- tar -czf $dotdot_outdir/${PACKAGE}.html_$1.tar.gz -- *.html
+ tar -czf "$abs_outdir/${PACKAGE}.html_$1.tar.gz" -- *.html
)
- eval html_$1_tgz_size=`calcsize $outdir/${PACKAGE}.html_$1.tar.gz`
- rm -f $outdir/html_$1/*.html
- mkdir -p $outdir/html_$1/
- mv ${split_html_dir}/*.html $outdir/html_$1/
+ eval html_$1_tgz_size=`calcsize "$outdir/${PACKAGE}.html_$1.tar.gz"`
+ rm -f "$outdir"/html_$1/*.html
+ mkdir -p "$outdir/html_$1/"
+ mv ${split_html_dir}/*.html "$outdir/html_$1/"
rmdir ${split_html_dir}
}
rm -rf $PACKAGE.html # in case a directory is left over
eval "$cmd"
html_mono_size=`calcsize $PACKAGE.html`
- gzip -f -9 -c $PACKAGE.html >$outdir/$PACKAGE.html.gz
- html_mono_gz_size=`calcsize $outdir/$PACKAGE.html.gz`
- mv $PACKAGE.html $outdir/
+ gzip -f -9 -c $PACKAGE.html >"$outdir/$PACKAGE.html.gz"
+ html_mono_gz_size=`calcsize "$outdir/$PACKAGE.html.gz"`
+ mv $PACKAGE.html "$outdir/"
cmd="$SETLANG $MAKEINFO --html -o $PACKAGE.html $htmlarg \"$srcfile\""
echo "Generating html by node... ($cmd)"
split_html_dir=$PACKAGE.html
(
cd ${split_html_dir} || exit 1
- tar -czf $dotdot_outdir/${PACKAGE}.html_node.tar.gz -- *.html
+ tar -czf "$abs_outdir/${PACKAGE}.html_node.tar.gz" -- *.html
)
- html_node_tgz_size=`calcsize $outdir/${PACKAGE}.html_node.tar.gz`
- rm -f $outdir/html_node/*.html
- mkdir -p $outdir/html_node/
- mv ${split_html_dir}/*.html $outdir/html_node/
+ html_node_tgz_size=`calcsize "$outdir/${PACKAGE}.html_node.tar.gz"`
+ rm -f "$outdir"/html_node/*.html
+ mkdir -p "$outdir/html_node/"
+ mv ${split_html_dir}/*.html "$outdir/html_node/"
rmdir ${split_html_dir}
else
cmd="$SETLANG $TEXI2HTML --output $PACKAGE.html $htmlarg \"$srcfile\""
rm -rf $PACKAGE.html # in case a directory is left over
eval "$cmd"
html_mono_size=`calcsize $PACKAGE.html`
- gzip -f -9 -c $PACKAGE.html >$outdir/$PACKAGE.html.gz
- html_mono_gz_size=`calcsize $outdir/$PACKAGE.html.gz`
- mv $PACKAGE.html $outdir/
+ gzip -f -9 -c $PACKAGE.html >"$outdir/$PACKAGE.html.gz"
+ html_mono_gz_size=`calcsize "$outdir/$PACKAGE.html.gz"`
+ mv $PACKAGE.html "$outdir/"
html_split node
html_split chapter
echo Making .tar.gz for sources...
d=`dirname $srcfile`
-srcfiles=`ls $d/*.texinfo $d/*.texi $d/*.txi $d/*.eps 2>/dev/null` || true
-tar cvzfh $outdir/$PACKAGE.texi.tar.gz $srcfiles
-texi_tgz_size=`calcsize $outdir/$PACKAGE.texi.tar.gz`
+(
+ cd "$d"
+ srcfiles=`ls *.texinfo *.texi *.txi *.eps 2>/dev/null` || true
+ tar cvzfh "$abs_outdir/$PACKAGE.texi.tar.gz" $srcfiles
+)
+texi_tgz_size=`calcsize "$outdir/$PACKAGE.texi.tar.gz"`
if test -n "$docbook"; then
cmd="$SETLANG $MAKEINFO -o - --docbook \"$srcfile\" > ${srcdir}/$PACKAGE-db.xml"
echo "Generating docbook XML... ($cmd)"
eval "$cmd"
docbook_xml_size=`calcsize $PACKAGE-db.xml`
- gzip -f -9 -c $PACKAGE-db.xml >$outdir/$PACKAGE-db.xml.gz
- docbook_xml_gz_size=`calcsize $outdir/$PACKAGE-db.xml.gz`
- mv $PACKAGE-db.xml $outdir/
+ gzip -f -9 -c $PACKAGE-db.xml >"$outdir/$PACKAGE-db.xml.gz"
+ docbook_xml_gz_size=`calcsize "$outdir/$PACKAGE-db.xml.gz"`
+ mv $PACKAGE-db.xml "$outdir/"
- cmd="${DOCBOOK2HTML} -o $split_html_db_dir ${outdir}/$PACKAGE-db.xml"
+ cmd="${DOCBOOK2HTML} -o $split_html_db_dir \"${outdir}/$PACKAGE-db.xml\""
echo "Generating docbook HTML... ($cmd)"
eval "$cmd"
split_html_db_dir=html_node_db
(
cd ${split_html_db_dir} || exit 1
- tar -czf $dotdot_outdir/${PACKAGE}.html_node_db.tar.gz -- *.html
+ tar -czf "$abs_outdir/${PACKAGE}.html_node_db.tar.gz" -- *.html
)
- html_node_db_tgz_size=`calcsize $outdir/${PACKAGE}.html_node_db.tar.gz`
- rm -f $outdir/html_node_db/*.html
- mkdir -p $outdir/html_node_db
- mv ${split_html_db_dir}/*.html $outdir/html_node_db/
+ html_node_db_tgz_size=`calcsize "$outdir/${PACKAGE}.html_node_db.tar.gz"`
+ rm -f "$outdir"/html_node_db/*.html
+ mkdir -p "$outdir/html_node_db"
+ mv ${split_html_db_dir}/*.html "$outdir/html_node_db/"
rmdir ${split_html_db_dir}
- cmd="${DOCBOOK2TXT} ${outdir}/$PACKAGE-db.xml"
+ cmd="${DOCBOOK2TXT} \"${outdir}/$PACKAGE-db.xml\""
echo "Generating docbook ASCII... ($cmd)"
eval "$cmd"
docbook_ascii_size=`calcsize $PACKAGE-db.txt`
- mv $PACKAGE-db.txt $outdir/
+ mv $PACKAGE-db.txt "$outdir/"
- cmd="${DOCBOOK2PS} ${outdir}/$PACKAGE-db.xml"
+ cmd="${DOCBOOK2PS} \"${outdir}/$PACKAGE-db.xml\""
echo "Generating docbook PS... ($cmd)"
eval "$cmd"
- gzip -f -9 -c $PACKAGE-db.ps >$outdir/$PACKAGE-db.ps.gz
- docbook_ps_gz_size=`calcsize $outdir/$PACKAGE-db.ps.gz`
- mv $PACKAGE-db.ps $outdir/
+ gzip -f -9 -c $PACKAGE-db.ps >"$outdir/$PACKAGE-db.ps.gz"
+ docbook_ps_gz_size=`calcsize "$outdir/$PACKAGE-db.ps.gz"`
+ mv $PACKAGE-db.ps "$outdir/"
- cmd="${DOCBOOK2PDF} ${outdir}/$PACKAGE-db.xml"
+ cmd="${DOCBOOK2PDF} \"${outdir}/$PACKAGE-db.xml\""
echo "Generating docbook PDF... ($cmd)"
eval "$cmd"
docbook_pdf_size=`calcsize $PACKAGE-db.pdf`
- mv $PACKAGE-db.pdf $outdir/
+ mv $PACKAGE-db.pdf "$outdir/"
fi
echo "Writing index file..."
-e "s,%%SCRIPTURL%%,$scripturl,g" \
-e "s!%%SCRIPTNAME%%!$prog!g" \
-e "$CONDS" \
-$GENDOCS_TEMPLATE_DIR/gendocs_template >$outdir/index.html
+$GENDOCS_TEMPLATE_DIR/gendocs_template >"$outdir/index.html"
echo "Done, see $outdir/ subdirectory for new files."
-# pmccabe2html - AWK script to convert pmccabe output to html
+# pmccabe2html - AWK script to convert pmccabe output to html -*- awk -*-
# Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
# Typical Invocation is from a Makefile.am:
#
# cyclo-$(PACKAGE).html:
-# $(PMCCABE) ${top_srcdir}/lib/*.[ch] \
-# | sort -nr \
-# | $(AWK) -f ${top_srcdir}/build-aux/pmccabe2html \
-# -v lang=html -v name="$(PACKAGE_NAME)" \
-# -v vcurl="http://git.savannah.gnu.org/gitweb/?p=$(PACKAGE).git;a=blob;f=%FILENAME%;hb=HEAD" \
-# -v url="http://www.gnu.org/software/$(PACKAGE)/" \
-# -v css=${top_srcdir}/build-aux/pmccabe.css \
-# > $@-tmp
-# mv $@-tmp $@
+# $(PMCCABE) ${top_srcdir}/src/*.[ch] \
+# | sort -nr \
+# | $(AWK) -f ${top_srcdir}/build-aux/pmccabe2html \
+# -v lang=html -v name="$(PACKAGE_NAME)" \
+# -v vcurl="http://git.savannah.gnu.org/gitweb/?p=$(PACKAGE).git;a=blob;f=%FILENAME%;hb=HEAD" \
+# -v url="http://www.gnu.org/software/$(PACKAGE)/" \
+# -v css=${top_srcdir}/build-aux/pmccabe.css \
+# -v cut_dir=${top_srcdir}/ \
+# > $@-tmp
+# mv $@-tmp $@
#
# The variables available are:
# lang output language, either 'html' or 'wiki'
cyclo_simple_max = 10
cyclo_moderate_max = 20
cyclo_high_max = 50
- cut_dir = "/../"
source_file_link_tmpl = vcurl
# HTML options
*/* | *\\*) ;;
*) # Need to look in the PATH.
if test "${PATH_SEPARATOR+set}" != set; then
- func_tmpdir
- { echo "#! /bin/sh"; echo "exit 0"; } > "$tmp"/conf.sh
- chmod +x "$tmp"/conf.sh
- if (PATH="/nonexistent;$tmp"; conf.sh) >/dev/null 2>&1; then
- PATH_SEPARATOR=';'
- else
- PATH_SEPARATOR=:
- fi
- rm -rf "$tmp"
+ # Determine PATH_SEPARATOR by trying to find /bin/sh in a PATH which
+ # contains only /bin. Note that ksh looks also at the FPATH variable,
+ # so we have to set that as well for the test.
+ PATH_SEPARATOR=:
+ (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \
+ && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \
+ || PATH_SEPARATOR=';'
+ }
fi
save_IFS="$IFS"; IFS="$PATH_SEPARATOR"
for dir in $PATH; do
% Load plain if necessary, i.e., if running under initex.
\expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi
%
-\def\texinfoversion{2010-06-17.11}
+\def\texinfoversion{2010-09-06.17}
%
% Copyright 1985, 1986, 1988, 1990, 1991, 1992, 1993, 1994, 1995,
% 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
% and 2) do not add an italic correction.
\def\dosmartslant#1#2{%
\ifusingtt
- {\ttsl #2\let\next=\relax}%
+ {{\ttsl #2}\let\next=\relax}%
{\def\next{{#1#2}\futurelet\next\smartitaliccorrection}}%
\next
}
\def\commondummies{%
%
% \definedummyword defines \#1 as \string\#1\space, thus effectively
- % preventing its expansion. This is used only for control% words,
+ % preventing its expansion. This is used only for control words,
% not control letters, because the \space would be incorrect for
% control characters, but is needed to separate the control word
% from whatever follows.
\commondummiesnofonts
%
\definedummyletter\_%
+ \definedummyletter\-%
%
% Non-English letters.
\definedummyword\AA
\definedummyword\TeX
%
% Assorted special characters.
+ \definedummyword\arrow
\definedummyword\bullet
\definedummyword\comma
\definedummyword\copyright
\definedummyword\equiv
\definedummyword\error
\definedummyword\euro
+ \definedummyword\expansion
+ \definedummyword\geq
\definedummyword\guillemetleft
\definedummyword\guillemetright
\definedummyword\guilsinglleft
\definedummyword\guilsinglright
- \definedummyword\expansion
+ \definedummyword\leq
\definedummyword\minus
\definedummyword\ogonek
\definedummyword\pounds
\definedummyword\b
\definedummyword\i
\definedummyword\r
+ \definedummyword\sansserif
\definedummyword\sc
+ \definedummyword\slanted
\definedummyword\t
%
% Commands that take arguments.
\definedummyword\code
\definedummyword\command
\definedummyword\dfn
+ \definedummyword\dmn
\definedummyword\email
\definedummyword\emph
\definedummyword\env
\definedummyword\file
+ \definedummyword\indicateurl
\definedummyword\kbd
\definedummyword\key
\definedummyword\math
\def\definedummyaccent##1{\let##1\asis}%
% We can just ignore other control letters.
\def\definedummyletter##1{\let##1\empty}%
- % Hopefully, all control words can become @asis.
+ % All control words become @asis by default; overrides below.
\let\definedummyword\definedummyaccent
%
\commondummiesnofonts
%
\def\ { }%
\def\@{@}%
- % how to handle braces?
\def\_{\normalunderscore}%
+ \def\-{}% @- shouldn't affect sorting
+ %
+ % Unfortunately, texindex is not prepared to handle braces in the
+ % content at all. So for index sorting, we map @{ and @} to strings
+ % starting with |, since that ASCII character is between ASCII { and }.
+ \def\{{|a}%
+ \def\}{|b}%
%
% Non-English letters.
\def\AA{AA}%
%
% Assorted special characters.
% (The following {} will end up in the sort string, but that's ok.)
+ \def\arrow{->}%
\def\bullet{bullet}%
\def\comma{,}%
\def\copyright{copyright}%
\def\error{error}%
\def\euro{euro}%
\def\expansion{==>}%
+ \def\geq{>=}%
\def\guillemetleft{<<}%
\def\guillemetright{>>}%
\def\guilsinglleft{<}%
\def\guilsinglright{>}%
+ \def\leq{<=}%
\def\minus{-}%
\def\point{.}%
\def\pounds{pounds}%
\angleleft un\-de\-fined\angleright
\iflinks
\ifhavexrefs
- \message{\linenumber Undefined cross reference `#1'.}%
+ {\toks0 = {#1}% avoid expansion of possibly-complex value
+ \message{\linenumber Undefined cross reference `\the\toks0'.}}%
\else
\ifwarnedxrefs\else
\global\warnedxrefstrue
\gdef^^ea{\ogonek{e}}
\gdef^^eb{\"e}
\gdef^^ec{\v e}
- \gdef^^ed{\'\i}
- \gdef^^ee{\^\i}
+ \gdef^^ed{\'{\dotless{i}}}
+ \gdef^^ee{\^{\dotless{i}}}
\gdef^^ef{\v d}
%
\gdef^^f0{\dh}
gnulib.info-3
gnulib.info-4
gnulib.info-5
+gnulib.info-6
gnulib.html
gnulib.pdf
updated-stamp
acledit
+NonStop Kernel ACLs
+
+Documentation:
+ http://bizsupport1.austin.hp.com/bc/docs/support/SupportManual/c02492445/c02492445.pdf p. 249..260
+ http://bizsupport1.austin.hp.com/bc/docs/support/SupportManual/c02128649/c02128649.pdf
+ http://bizsupport2.austin.hp.com/bc/docs/support/SupportManual/c02128680/c02128680.pdf
+Includes:
+ <sys/acl.h>
+Library:
+ none needed
+Functions:
+ acl
+ aclsort
+Utilities:
+ getacl
+ setacl
+
+
Cygwin ACLs
Documentation:
-@c GNU date syntax documentation
-
-@c Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
-@c 2004, 2005, 2006, 2009, 2010 Free Software Foundation, Inc.
-
-@c Permission is granted to copy, distribute and/or modify this document
-@c under the terms of the GNU Free Documentation License, Version 1.3 or
-@c any later version published by the Free Software Foundation; with no
-@c Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
-@c Texts. A copy of the license is included in the ``GNU Free
-@c Documentation License'' file as part of this distribution.
-
-@node Date input formats
-@chapter Date input formats
-
-@cindex date input formats
-@findex get_date
-
-First, a quote:
-
-@quotation
-Our units of temporal measurement, from seconds on up to months, are so
-complicated, asymmetrical and disjunctive so as to make coherent mental
-reckoning in time all but impossible. Indeed, had some tyrannical god
-contrived to enslave our minds to time, to make it all but impossible
-for us to escape subjection to sodden routines and unpleasant surprises,
-he could hardly have done better than handing down our present system.
-It is like a set of trapezoidal building blocks, with no vertical or
-horizontal surfaces, like a language in which the simplest thought
-demands ornate constructions, useless particles and lengthy
-circumlocutions. Unlike the more successful patterns of language and
-science, which enable us to face experience boldly or at least
-level-headedly, our system of temporal calculation silently and
-persistently encourages our terror of time.
-
-@dots{} It is as though architects had to measure length in feet, width
-in meters and height in ells; as though basic instruction manuals
-demanded a knowledge of five different languages. It is no wonder then
-that we often look into our own immediate past or future, last Tuesday
-or a week from Sunday, with feelings of helpless confusion. @dots{}
-
---- Robert Grudin, @cite{Time and the Art of Living}.
-@end quotation
-
-This section describes the textual date representations that @sc{gnu}
-programs accept. These are the strings you, as a user, can supply as
-arguments to the various programs. The C interface (via the
-@code{get_date} function) is not described here.
-
-@menu
-* General date syntax:: Common rules.
-* Calendar date items:: 19 Dec 1994.
-* Time of day items:: 9:20pm.
-* Time zone items:: @sc{est}, @sc{pdt}, @sc{gmt}.
-* Day of week items:: Monday and others.
-* Relative items in date strings:: next tuesday, 2 years ago.
-* Pure numbers in date strings:: 19931219, 1440.
-* Seconds since the Epoch:: @@1078100502.
-* Specifying time zone rules:: TZ="America/New_York", TZ="UTC0".
-* Authors of get_date:: Bellovin, Eggert, Salz, Berets, et al.
-@end menu
-
-
-@node General date syntax
-@section General date syntax
-
-@cindex general date syntax
-
-@cindex items in date strings
-A @dfn{date} is a string, possibly empty, containing many items
-separated by whitespace. The whitespace may be omitted when no
-ambiguity arises. The empty string means the beginning of today (i.e.,
-midnight). Order of the items is immaterial. A date string may contain
-many flavors of items:
-
-@itemize @bullet
-@item calendar date items
-@item time of day items
-@item time zone items
-@item day of the week items
-@item relative items
-@item pure numbers.
-@end itemize
-
-@noindent We describe each of these item types in turn, below.
-
-@cindex numbers, written-out
-@cindex ordinal numbers
-@findex first @r{in date strings}
-@findex next @r{in date strings}
-@findex last @r{in date strings}
-A few ordinal numbers may be written out in words in some contexts. This is
-most useful for specifying day of the week items or relative items (see
-below). Among the most commonly used ordinal numbers, the word
-@samp{last} stands for @math{-1}, @samp{this} stands for 0, and
-@samp{first} and @samp{next} both stand for 1. Because the word
-@samp{second} stands for the unit of time there is no way to write the
-ordinal number 2, but for convenience @samp{third} stands for 3,
-@samp{fourth} for 4, @samp{fifth} for 5,
-@samp{sixth} for 6, @samp{seventh} for 7, @samp{eighth} for 8,
-@samp{ninth} for 9, @samp{tenth} for 10, @samp{eleventh} for 11 and
-@samp{twelfth} for 12.
-
-@cindex months, written-out
-When a month is written this way, it is still considered to be written
-numerically, instead of being ``spelled in full''; this changes the
-allowed strings.
-
-@cindex language, in dates
-In the current implementation, only English is supported for words and
-abbreviations like @samp{AM}, @samp{DST}, @samp{EST}, @samp{first},
-@samp{January}, @samp{Sunday}, @samp{tomorrow}, and @samp{year}.
-
-@cindex language, in dates
-@cindex time zone item
-The output of the @command{date} command
-is not always acceptable as a date string,
-not only because of the language problem, but also because there is no
-standard meaning for time zone items like @samp{IST}. When using
-@command{date} to generate a date string intended to be parsed later,
-specify a date format that is independent of language and that does not
-use time zone items other than @samp{UTC} and @samp{Z}. Here are some
-ways to do this:
-
-@example
-$ LC_ALL=C TZ=UTC0 date
-Mon Mar 1 00:21:42 UTC 2004
-$ TZ=UTC0 date +'%Y-%m-%d %H:%M:%SZ'
-2004-03-01 00:21:42Z
-$ date --iso-8601=ns | tr T ' ' # --iso-8601 is a GNU extension.
-2004-02-29 16:21:42,692722128-0800
-$ date --rfc-2822 # a GNU extension
-Sun, 29 Feb 2004 16:21:42 -0800
-$ date +'%Y-%m-%d %H:%M:%S %z' # %z is a GNU extension.
-2004-02-29 16:21:42 -0800
-$ date +'@@%s.%N' # %s and %N are GNU extensions.
-@@1078100502.692722128
-@end example
-
-@cindex case, ignored in dates
-@cindex comments, in dates
-Alphabetic case is completely ignored in dates. Comments may be introduced
-between round parentheses, as long as included parentheses are properly
-nested. Hyphens not followed by a digit are currently ignored. Leading
-zeros on numbers are ignored.
-
-Invalid dates like @samp{2005-02-29} or times like @samp{24:00} are
-rejected. In the typical case of a host that does not support leap
-seconds, a time like @samp{23:59:60} is rejected even if it
-corresponds to a valid leap second.
-
-
-@node Calendar date items
-@section Calendar date items
-
-@cindex calendar date item
-
-A @dfn{calendar date item} specifies a day of the year. It is
-specified differently, depending on whether the month is specified
-numerically or literally. All these strings specify the same calendar date:
-
-@example
-1972-09-24 # @sc{iso} 8601.
-72-9-24 # Assume 19xx for 69 through 99,
- # 20xx for 00 through 68.
-72-09-24 # Leading zeros are ignored.
-9/24/72 # Common U.S. writing.
-24 September 1972
-24 Sept 72 # September has a special abbreviation.
-24 Sep 72 # Three-letter abbreviations always allowed.
-Sep 24, 1972
-24-sep-72
-24sep72
-@end example
-
-The year can also be omitted. In this case, the last specified year is
-used, or the current year if none. For example:
-
-@example
-9/24
-sep 24
-@end example
-
-Here are the rules.
-
-@cindex @sc{iso} 8601 date format
-@cindex date format, @sc{iso} 8601
-For numeric months, the @sc{iso} 8601 format
-@samp{@var{year}-@var{month}-@var{day}} is allowed, where @var{year} is
-any positive number, @var{month} is a number between 01 and 12, and
-@var{day} is a number between 01 and 31. A leading zero must be present
-if a number is less than ten. If @var{year} is 68 or smaller, then 2000
-is added to it; otherwise, if @var{year} is less than 100,
-then 1900 is added to it. The construct
-@samp{@var{month}/@var{day}/@var{year}}, popular in the United States,
-is accepted. Also @samp{@var{month}/@var{day}}, omitting the year.
-
-@cindex month names in date strings
-@cindex abbreviations for months
-Literal months may be spelled out in full: @samp{January},
-@samp{February}, @samp{March}, @samp{April}, @samp{May}, @samp{June},
-@samp{July}, @samp{August}, @samp{September}, @samp{October},
-@samp{November} or @samp{December}. Literal months may be abbreviated
-to their first three letters, possibly followed by an abbreviating dot.
-It is also permitted to write @samp{Sept} instead of @samp{September}.
-
-When months are written literally, the calendar date may be given as any
-of the following:
-
-@example
-@var{day} @var{month} @var{year}
-@var{day} @var{month}
-@var{month} @var{day} @var{year}
-@var{day}-@var{month}-@var{year}
-@end example
-
-Or, omitting the year:
-
-@example
-@var{month} @var{day}
-@end example
-
-
-@node Time of day items
-@section Time of day items
-
-@cindex time of day item
-
-A @dfn{time of day item} in date strings specifies the time on a given
-day. Here are some examples, all of which represent the same time:
-
-@example
-20:02:00.000000
-20:02
-8:02pm
-20:02-0500 # In @sc{est} (U.S. Eastern Standard Time).
-@end example
-
-More generally, the time of day may be given as
-@samp{@var{hour}:@var{minute}:@var{second}}, where @var{hour} is
-a number between 0 and 23, @var{minute} is a number between 0 and
-59, and @var{second} is a number between 0 and 59 possibly followed by
-@samp{.} or @samp{,} and a fraction containing one or more digits.
-Alternatively,
-@samp{:@var{second}} can be omitted, in which case it is taken to
-be zero. On the rare hosts that support leap seconds, @var{second}
-may be 60.
-
-@findex am @r{in date strings}
-@findex pm @r{in date strings}
-@findex midnight @r{in date strings}
-@findex noon @r{in date strings}
-If the time is followed by @samp{am} or @samp{pm} (or @samp{a.m.}
-or @samp{p.m.}), @var{hour} is restricted to run from 1 to 12, and
-@samp{:@var{minute}} may be omitted (taken to be zero). @samp{am}
-indicates the first half of the day, @samp{pm} indicates the second
-half of the day. In this notation, 12 is the predecessor of 1:
-midnight is @samp{12am} while noon is @samp{12pm}.
-(This is the zero-oriented interpretation of @samp{12am} and @samp{12pm},
-as opposed to the old tradition derived from Latin
-which uses @samp{12m} for noon and @samp{12pm} for midnight.)
-
-@cindex time zone correction
-@cindex minutes, time zone correction by
-The time may alternatively be followed by a time zone correction,
-expressed as @samp{@var{s}@var{hh}@var{mm}}, where @var{s} is @samp{+}
-or @samp{-}, @var{hh} is a number of zone hours and @var{mm} is a number
-of zone minutes.
-The zone minutes term, @var{mm}, may be omitted, in which case
-the one- or two-digit correction is interpreted as a number of hours.
-You can also separate @var{hh} from @var{mm} with a colon.
-When a time zone correction is given this way, it
-forces interpretation of the time relative to
-Coordinated Universal Time (@sc{utc}), overriding any previous
-specification for the time zone or the local time zone. For example,
-@samp{+0530} and @samp{+05:30} both stand for the time zone 5.5 hours
-ahead of @sc{utc} (e.g., India).
-This is the best way to
-specify a time zone correction by fractional parts of an hour.
-The maximum zone correction is 24 hours.
-
-Either @samp{am}/@samp{pm} or a time zone correction may be specified,
-but not both.
-
-
-@node Time zone items
-@section Time zone items
-
-@cindex time zone item
-
-A @dfn{time zone item} specifies an international time zone, indicated
-by a small set of letters, e.g., @samp{UTC} or @samp{Z}
-for Coordinated Universal
-Time. Any included periods are ignored. By following a
-non-daylight-saving time zone by the string @samp{DST} in a separate
-word (that is, separated by some white space), the corresponding
-daylight saving time zone may be specified.
-Alternatively, a non-daylight-saving time zone can be followed by a
-time zone correction, to add the two values. This is normally done
-only for @samp{UTC}; for example, @samp{UTC+05:30} is equivalent to
-@samp{+05:30}.
-
-Time zone items other than @samp{UTC} and @samp{Z}
-are obsolescent and are not recommended, because they
-are ambiguous; for example, @samp{EST} has a different meaning in
-Australia than in the United States. Instead, it's better to use
-unambiguous numeric time zone corrections like @samp{-0500}, as
-described in the previous section.
-
-If neither a time zone item nor a time zone correction is supplied,
-time stamps are interpreted using the rules of the default time zone
-(@pxref{Specifying time zone rules}).
-
-
-@node Day of week items
-@section Day of week items
-
-@cindex day of week item
-
-The explicit mention of a day of the week will forward the date
-(only if necessary) to reach that day of the week in the future.
-
-Days of the week may be spelled out in full: @samp{Sunday},
-@samp{Monday}, @samp{Tuesday}, @samp{Wednesday}, @samp{Thursday},
-@samp{Friday} or @samp{Saturday}. Days may be abbreviated to their
-first three letters, optionally followed by a period. The special
-abbreviations @samp{Tues} for @samp{Tuesday}, @samp{Wednes} for
-@samp{Wednesday} and @samp{Thur} or @samp{Thurs} for @samp{Thursday} are
-also allowed.
-
-@findex next @var{day}
-@findex last @var{day}
-A number may precede a day of the week item to move forward
-supplementary weeks. It is best used in expression like @samp{third
-monday}. In this context, @samp{last @var{day}} or @samp{next
-@var{day}} is also acceptable; they move one week before or after
-the day that @var{day} by itself would represent.
-
-A comma following a day of the week item is ignored.
-
-
-@node Relative items in date strings
-@section Relative items in date strings
-
-@cindex relative items in date strings
-@cindex displacement of dates
-
-@dfn{Relative items} adjust a date (or the current date if none) forward
-or backward. The effects of relative items accumulate. Here are some
-examples:
-
-@example
-1 year
-1 year ago
-3 years
-2 days
-@end example
-
-@findex year @r{in date strings}
-@findex month @r{in date strings}
-@findex fortnight @r{in date strings}
-@findex week @r{in date strings}
-@findex day @r{in date strings}
-@findex hour @r{in date strings}
-@findex minute @r{in date strings}
-The unit of time displacement may be selected by the string @samp{year}
-or @samp{month} for moving by whole years or months. These are fuzzy
-units, as years and months are not all of equal duration. More precise
-units are @samp{fortnight} which is worth 14 days, @samp{week} worth 7
-days, @samp{day} worth 24 hours, @samp{hour} worth 60 minutes,
-@samp{minute} or @samp{min} worth 60 seconds, and @samp{second} or
-@samp{sec} worth one second. An @samp{s} suffix on these units is
-accepted and ignored.
-
-@findex ago @r{in date strings}
-The unit of time may be preceded by a multiplier, given as an optionally
-signed number. Unsigned numbers are taken as positively signed. No
-number at all implies 1 for a multiplier. Following a relative item by
-the string @samp{ago} is equivalent to preceding the unit by a
-multiplier with value @math{-1}.
-
-@findex day @r{in date strings}
-@findex tomorrow @r{in date strings}
-@findex yesterday @r{in date strings}
-The string @samp{tomorrow} is worth one day in the future (equivalent
-to @samp{day}), the string @samp{yesterday} is worth
-one day in the past (equivalent to @samp{day ago}).
-
-@findex now @r{in date strings}
-@findex today @r{in date strings}
-@findex this @r{in date strings}
-The strings @samp{now} or @samp{today} are relative items corresponding
-to zero-valued time displacement, these strings come from the fact
-a zero-valued time displacement represents the current time when not
-otherwise changed by previous items. They may be used to stress other
-items, like in @samp{12:00 today}. The string @samp{this} also has
-the meaning of a zero-valued time displacement, but is preferred in
-date strings like @samp{this thursday}.
-
-When a relative item causes the resulting date to cross a boundary
-where the clocks were adjusted, typically for daylight saving time,
-the resulting date and time are adjusted accordingly.
-
-The fuzz in units can cause problems with relative items. For
-example, @samp{2003-07-31 -1 month} might evaluate to 2003-07-01,
-because 2003-06-31 is an invalid date. To determine the previous
-month more reliably, you can ask for the month before the 15th of the
-current month. For example:
-
-@example
-$ date -R
-Thu, 31 Jul 2003 13:02:39 -0700
-$ date --date='-1 month' +'Last month was %B?'
-Last month was July?
-$ date --date="$(date +%Y-%m-15) -1 month" +'Last month was %B!'
-Last month was June!
-@end example
-
-Also, take care when manipulating dates around clock changes such as
-daylight saving leaps. In a few cases these have added or subtracted
-as much as 24 hours from the clock, so it is often wise to adopt
-universal time by setting the @env{TZ} environment variable to
-@samp{UTC0} before embarking on calendrical calculations.
-
-@node Pure numbers in date strings
-@section Pure numbers in date strings
-
-@cindex pure numbers in date strings
-
-The precise interpretation of a pure decimal number depends
-on the context in the date string.
-
-If the decimal number is of the form @var{yyyy}@var{mm}@var{dd} and no
-other calendar date item (@pxref{Calendar date items}) appears before it
-in the date string, then @var{yyyy} is read as the year, @var{mm} as the
-month number and @var{dd} as the day of the month, for the specified
-calendar date.
-
-If the decimal number is of the form @var{hh}@var{mm} and no other time
-of day item appears before it in the date string, then @var{hh} is read
-as the hour of the day and @var{mm} as the minute of the hour, for the
-specified time of day. @var{mm} can also be omitted.
-
-If both a calendar date and a time of day appear to the left of a number
-in the date string, but no relative item, then the number overrides the
-year.
-
-
-@node Seconds since the Epoch
-@section Seconds since the Epoch
-
-If you precede a number with @samp{@@}, it represents an internal time
-stamp as a count of seconds. The number can contain an internal
-decimal point (either @samp{.} or @samp{,}); any excess precision not
-supported by the internal representation is truncated toward minus
-infinity. Such a number cannot be combined with any other date
-item, as it specifies a complete time stamp.
-
-@cindex beginning of time, for @acronym{POSIX}
-@cindex epoch, for @acronym{POSIX}
-Internally, computer times are represented as a count of seconds since
-an epoch---a well-defined point of time. On @acronym{GNU} and
-@acronym{POSIX} systems, the epoch is 1970-01-01 00:00:00 @sc{utc}, so
-@samp{@@0} represents this time, @samp{@@1} represents 1970-01-01
-00:00:01 @sc{utc}, and so forth. @acronym{GNU} and most other
-@acronym{POSIX}-compliant systems support such times as an extension
-to @acronym{POSIX}, using negative counts, so that @samp{@@-1}
-represents 1969-12-31 23:59:59 @sc{utc}.
-
-Traditional Unix systems count seconds with 32-bit two's-complement
-integers and can represent times from 1901-12-13 20:45:52 through
-2038-01-19 03:14:07 @sc{utc}. More modern systems use 64-bit counts
-of seconds with nanosecond subcounts, and can represent all the times
-in the known lifetime of the universe to a resolution of 1 nanosecond.
-
-On most hosts, these counts ignore the presence of leap seconds.
-For example, on most hosts @samp{@@915148799} represents 1998-12-31
-23:59:59 @sc{utc}, @samp{@@915148800} represents 1999-01-01 00:00:00
-@sc{utc}, and there is no way to represent the intervening leap second
-1998-12-31 23:59:60 @sc{utc}.
-
-@node Specifying time zone rules
-@section Specifying time zone rules
-
-@vindex TZ
-Normally, dates are interpreted using the rules of the current time
-zone, which in turn are specified by the @env{TZ} environment
-variable, or by a system default if @env{TZ} is not set. To specify a
-different set of default time zone rules that apply just to one date,
-start the date with a string of the form @samp{TZ="@var{rule}"}. The
-two quote characters (@samp{"}) must be present in the date, and any
-quotes or backslashes within @var{rule} must be escaped by a
-backslash.
-
-For example, with the @acronym{GNU} @command{date} command you can
-answer the question ``What time is it in New York when a Paris clock
-shows 6:30am on October 31, 2004?'' by using a date beginning with
-@samp{TZ="Europe/Paris"} as shown in the following shell transcript:
-
-@example
-$ export TZ="America/New_York"
-$ date --date='TZ="Europe/Paris" 2004-10-31 06:30'
-Sun Oct 31 01:30:00 EDT 2004
-@end example
-
-In this example, the @option{--date} operand begins with its own
-@env{TZ} setting, so the rest of that operand is processed according
-to @samp{Europe/Paris} rules, treating the string @samp{2004-10-31
-06:30} as if it were in Paris. However, since the output of the
-@command{date} command is processed according to the overall time zone
-rules, it uses New York time. (Paris was normally six hours ahead of
-New York in 2004, but this example refers to a brief Halloween period
-when the gap was five hours.)
-
-A @env{TZ} value is a rule that typically names a location in the
-@uref{http://www.twinsun.com/tz/tz-link.htm, @samp{tz} database}.
-A recent catalog of location names appears in the
-@uref{http://twiki.org/cgi-bin/xtra/tzdate, TWiki Date and Time
-Gateway}. A few non-@acronym{GNU} hosts require a colon before a
-location name in a @env{TZ} setting, e.g.,
-@samp{TZ=":America/New_York"}.
-
-The @samp{tz} database includes a wide variety of locations ranging
-from @samp{Arctic/Longyearbyen} to @samp{Antarctica/South_Pole}, but
-if you are at sea and have your own private time zone, or if you are
-using a non-@acronym{GNU} host that does not support the @samp{tz}
-database, you may need to use a @acronym{POSIX} rule instead. Simple
-@acronym{POSIX} rules like @samp{UTC0} specify a time zone without
-daylight saving time; other rules can specify simple daylight saving
-regimes. @xref{TZ Variable,, Specifying the Time Zone with @code{TZ},
-libc, The GNU C Library}.
-
-@node Authors of get_date
-@section Authors of @code{get_date}
-
-@cindex authors of @code{get_date}
-
-@cindex Bellovin, Steven M.
-@cindex Salz, Rich
-@cindex Berets, Jim
-@cindex MacKenzie, David
-@cindex Meyering, Jim
-@cindex Eggert, Paul
-@code{get_date} was originally implemented by Steven M. Bellovin
-(@email{smb@@research.att.com}) while at the University of North Carolina
-at Chapel Hill. The code was later tweaked by a couple of people on
-Usenet, then completely overhauled by Rich $alz (@email{rsalz@@bbn.com})
-and Jim Berets (@email{jberets@@bbn.com}) in August, 1990. Various
-revisions for the @sc{gnu} system were made by David MacKenzie, Jim Meyering,
-Paul Eggert and others.
-
-@cindex Pinard, F.
-@cindex Berry, K.
-This chapter was originally produced by Fran@,{c}ois Pinard
-(@email{pinard@@iro.umontreal.ca}) from the @file{getdate.y} source code,
-and then edited by K.@: Berry (@email{kb@@cs.umb.edu}).
+@include parse-datetime.texi
@itemize
@item
This function is missing on some platforms:
-MacOS X 10.3, FreeBSD 5.2.1, NetBSD 3.0, OpenBSD 3.8, AIX 5.1, HP-UX 11, IRIX 6.5, OSF/1 5.1, Solaris 10, Cygwin, mingw, Interix 3.5, BeOS.
+MacOS X 10.3, FreeBSD 5.2.1, NetBSD 3.0, OpenBSD 3.8, AIX 5.1, HP-UX
+11, IRIX 6.5, OSF/1 5.1, Solaris 10, Cygwin 1.7.7, mingw, Interix 3.5, BeOS.
@end itemize
@itemize
@item
This function is missing on some platforms:
-MacOS X 10.3, FreeBSD 5.2.1, NetBSD 3.0, OpenBSD 3.8, AIX 5.1, HP-UX 11, IRIX 6.5, OSF/1 5.1, Solaris 10, Cygwin, mingw, Interix 3.5, BeOS.
+MacOS X 10.3, FreeBSD 5.2.1, NetBSD 3.0, OpenBSD 3.8, AIX 5.1, HP-UX
+11, IRIX 6.5, OSF/1 5.1, Solaris 10, Cygwin 1.7.7, mingw, Interix 3.5, BeOS.
@end itemize
@itemize
@item
This function is missing on all non-glibc platforms:
-MacOS X 10.3, FreeBSD 6.0, NetBSD 3.0, OpenBSD 3.8, AIX 5.1, HP-UX 11, IRIX 6.5, OSF/1 5.1, Solaris 10, Cygwin, mingw, Interix 3.5, BeOS.
+MacOS X 10.3, FreeBSD 6.0, NetBSD 3.0, OpenBSD 3.8, AIX 5.1, HP-UX 11,
+IRIX 6.5, OSF/1 5.1, Solaris 10, Cygwin 1.7.7, mingw, Interix 3.5, BeOS.
@end itemize
This function is declared in @code{<utmp.h>} on glibc, Cygwin,
in @code{<util.h>} on MacOS X 10.3, NetBSD 3.0, OpenBSD 3.8,
in @code{<libutil.h>} on FreeBSD 6.0, Haiku, and not declared at all
-on OSF/1 5.1, Interix 3.5.
+on OSF/1 5.1, Interix 3.5. Also note that @code{<sys/types.h>} is
+a prerequisite of @code{<utmp.h>} on FreeBSD 8.0, OpenBSD 4.6 and
+of @code{<libutil.h>} on FreeBSD 8.0.
@end itemize
@item
This function has reversed arguments on some older platforms:
Linux libc 5.0.9
+@item
+This function can trigger false positives for long periodic needles on
+some platforms:
+glibc 2.12, Cygwin 1.7.7.
@end itemize
Portability problems fixed by Gnulib module @code{memmem}:
Portability problems fixed by Gnulib:
@itemize
@item
-This function is missing on all non-glibc platforms:
-MacOS X 10.3, FreeBSD 6.0, NetBSD 3.0, OpenBSD 3.8, AIX 5.1, HP-UX 11, IRIX 6.5, OSF/1 5.1, Solaris 10, Cygwin, mingw, Interix 3.5, BeOS.
+This function is missing on many non-glibc platforms:
+MacOS X 10.3, FreeBSD 6.0, NetBSD 3.0, OpenBSD 3.8, AIX 5.1, HP-UX 11,
+IRIX 6.5, OSF/1 5.1, Solaris 10, Cygwin 1.7.5, mingw, Interix 3.5, BeOS.
@end itemize
Portability problems not fixed by Gnulib:
Portability problems fixed by Gnulib:
@itemize
@item
-This function is missing on all non-glibc platforms:
-glibc 2.10, MacOS X 10.3, FreeBSD 6.0, NetBSD 3.0, OpenBSD 3.8, AIX 5.1, HP-UX 11, IRIX 6.5, OSF/1 5.1, Solaris 10, Cygwin, mingw, Interix 3.5, BeOS.
+This function is missing on many non-glibc platforms:
+glibc 2.10, MacOS X 10.3, FreeBSD 6.0, NetBSD 3.0, OpenBSD 3.8, AIX
+5.1, HP-UX 11, IRIX 6.5, OSF/1 5.1, Solaris 10, Cygwin 1.7.5, mingw, Interix 3.5, BeOS.
@end itemize
Portability problems not fixed by Gnulib:
@item
This function can trigger memchr bugs on some platforms:
glibc 2.10.
+
+@item
+This function can trigger false positives for long periodic needles on
+some platforms:
+glibc 2.12, Cygwin 1.7.7.
@end itemize
Portability problems fixed by Gnulib module @code{strcasestr}:
By default, the source code is copied into @file{lib/} and the M4
macros in @file{m4/}. You can override these paths by using
@code{--source-base=DIRECTORY} and @code{--m4-base=DIRECTORY}. Some
-modules also provide other files necessary for building. These files
+modules also provide other files necessary for building. These files
are copied into the directory specified by @samp{AC_CONFIG_AUX_DIR} in
@file{configure.ac} or by the @code{--aux-dir=DIRECTORY} option. If
neither is specified, the current directory is assumed.
this option is generally discouraged.
@code{gnulib-tool} will overwrite any pre-existing files, in
-particular @file{Makefile.am}. Unfortunately, separating the
+particular @file{Makefile.am}. It is also possible to separate the
generated @file{Makefile.am} content (for building the gnulib library)
-into a separate file, say @file{gnulib.mk}, that could be included
-by your handwritten @file{Makefile.am} is not possible, due to how
-variable assignments are handled by Automake.
+into a separate file, say @file{gnulib.mk}, that can be included by your
+handwritten @file{Makefile.am}, but this is a more advanced use of
+@code{gnulib-tool}.
Consequently, it is a good idea to choose directories that are not
already used by your projects, to separate gnulib imported files from
You can at any moment decide to use Gnulib differently than the last time.
-If you only want to use more Gnulib modules, simply invoke
-@command{gnulib-tool --import @var{new-modules}}. @code{gnulib-tool}
-remembers which modules were used last time. The list of modules that
-you pass after @samp{--import} is @emph{added} to the previous list of
-modules.
+There are two ways to change how Gnulib is used. Which one you'll use,
+depends on where you keep track of options and module names that you pass
+to @code{gnulib-tool}.
-For most changes, such as added or removed modules, or even different
-choices of @samp{--lib}, @samp{--source-base} or @samp{--aux-dir}, there
-are two ways to perform the change.
-
-The standard way is to modify manually the file @file{gnulib-cache.m4}
-in the M4 macros directory, then launch @samp{gnulib-tool --import}.
+@itemize @bullet
+@item
+If you store the options and module names in a file under your own
+control, such as @file{autogen.sh}, @file{bootstrap},
+@file{bootstrap.conf}, or similar, simply invoke @command{gnulib-tool}
+again, with modified options and more or fewer module names.
-The other way is to call @command{gnulib-tool} again, with the changed
-command-line options. Note that this doesn't let you remove modules,
-because as you just learned, the list of modules is always cumulated.
-Also this way is often impractical, because you don't remember the way
-you invoked @code{gnulib-tool} last time.
+@item
+@code{gnulib-tool} remembers which modules were used last time. If you
+want to rely on @code{gnulib-tool}'s own memory of the last used
+options and module names, you can use the commands
+@command{gnulib-tool --add-import} and
+@command{gnulib-tool --remove-import}.
+
+So, if you only want to use more Gnulib modules, simply invoke
+@command{gnulib-tool --add-import @var{new-modules}}. The list of
+modules that you pass after @samp{--add-import} is @emph{added} to the
+previous list of modules.
+
+Similarly, if you want to use fewer Gnulib modules, simply invoke
+@command{gnulib-tool --remove-import @var{unneeded-modules}}. The list
+of modules that you pass after @samp{--remove-import} is @emph{removed}
+from the previous list of modules. Note that if a module is then still
+needed as dependency of other modules, it will be used nevertheless.
+If you want to @emph{really} not use a module any more, regardless of
+whether other modules may need it, you need to use the @samp{--avoid}
+option.
+
+For other changes, such as different choices of @samp{--lib},
+@samp{--source-base} or @samp{--aux-dir}, the normal way is to
+modify manually the file @file{gnulib-cache.m4} in the M4 macros
+directory, then launch @samp{gnulib-tool --add-import}.
The only change for which this doesn't work is a change of the
@samp{--m4-base} directory. Because, when you pass a different value of
@samp{--m4-base}, @code{gnulib-tool} will not find the previous
-@file{gnulib-cache.m4} file any more... A possible solution is to manually
-copy the @file{gnulib-cache.m4} into the new M4 macro directory.
+@file{gnulib-cache.m4} file any more. A possible solution is to
+manually copy the @file{gnulib-cache.m4} into the new M4 macro directory.
-In the @file{gnulib-cache.m4}, the macros have the following meaning:
+In the @file{gnulib-cache.m4} file, the macros have the following meaning:
@table @code
@item gl_MODULES
The argument is a space separated list of the requested modules, not including
file. Corresponds to the @samp{--macro-prefix} command line argument.
@end table
+@end itemize
@node Simple update
@section Simple update
does it:
@smallexample
-$ gnulib-tool --import
+$ gnulib-tool --add-import
@end smallexample
@noindent
@item
In projects which customarily omit from their VCS all files that are
generated from other source files, none of these files and directories
-are added into the VCS. The only file that must be added to the VCS
-is @file{gnulib-cache.m4} in the M4 macros directory. Also, the
-script for restoring files not in the VCS, customarily called
-@file{autogen.sh} or @file{bootstrap}, will typically contain the
-statement for restoring the omitted files:
+are added into the VCS. As described in @ref{Modified imports}, there
+are two ways to keep track of options and module names that are passed
+to @code{gnulib-tool}. The command for restoring the omitted files
+depends on it:
+
+@itemize @bullet
+@item
+If they are stored in a file other than @code{gnulib-cache.m4}, such as
+@file{autogen.sh}, @file{bootstrap}, @file{bootstrap.conf}, or similar,
+the restoration command is the entire @code{gnulib-tool ... --import ...}
+invocation with all options and module names.
+
+@item
+If the project relies on @code{gnulib-tool}'s memory of the last used
+options and module names, then the file @file{gnulib-cache.m4} in the M4
+macros directory must be added to the VCS, and the restoration command
+is:
@smallexample
$ gnulib-tool --update
@end smallexample
-The @samp{--update} option operates much like the @samp{--import} option,
-but it does not offer the possibility to change the way Gnulib is used.
-Also it does not report in the ChangeLogs the files that it had to add
-because they were missing.
+The @samp{--update} option operates much like the @samp{--add-import}
+option, but it does not offer the possibility to change the way Gnulib is
+used. Also it does not report in the ChangeLogs the files that it had to
+add because they were missing.
+
+@end itemize
Gnulib includes the file @file{build-aux/bootstrap} to aid a developer
in using this setup. Furthermore, in projects that use git for
@cindex Out of Memory handling
@cindex Memory allocation failure
-The GSS API does not have a standard error code for the out of memory
-error condition. Instead of adding a non-standard error code, this
-library has chosen to adopt a different strategy. Out of memory
-handling happens in rare situations, but performing the out of memory
-error handling after almost all API function invocations pollute your
-source code and might make it harder to spot more serious problems.
-The strategy chosen improves code readability and robustness.
+The gnulib API does not have a standard error code for the out of memory
+error condition. Instead of adding a non-standard error code, gnulib
+has chosen to adopt a different strategy. Out of memory handling
+happens in rare situations, but performing the out of memory error
+handling after almost all API function invocations pollute your source
+code and might make it harder to spot more serious problems. The
+strategy chosen improves code readability and robustness.
@cindex Aborting execution
For most applications, aborting the application with an error message
when the out of memory situation occurs is the best that can be wished
-for. This is how the library behaves by default.
-
-@vindex xalloc_fail_func
-However, we realize that some applications may not want to have the
-GSS library abort execution in any situation. The GSS library supports
-a hook to let the application regain control and perform its own
-cleanups when an out of memory situation has occurred. The application
-can define a function (having a @code{void} prototype, i.e., no return
-value and no parameters) and set the library variable
-@code{xalloc_fail_func} to that function. The variable should be
+for. This is how the library behaves by default (using
+the @samp{xalloc-die} module).
+
+@vindex xalloc_die
+However, we realize that some applications may not want to abort
+execution in any situation. Gnulib supports a hook to let the
+application regain control and perform its own cleanups when an out of
+memory situation has occurred. The application can define a function
+(having a @code{void} prototype, i.e., no return value and no
+parameters) and set the library variable
+@code{xalloc_die} to that function. The variable should be
declared as follows.
@example
-extern void (*xalloc_fail_func) (void);
+extern void (*xalloc_die) (void);
@end example
-The GSS library will invoke this function if an out of memory error
-occurs. Note that after this the GSS library is in an undefined
-state, so you must unload or restart the application to continue call
-GSS library functions. The hook is only intended to allow the
-application to log the situation in a special way. Of course, care
-must be taken to not allocate more memory, as that will likely also
-fail.
+Gnulib will invoke this function if an out of memory error occurs. Note
+that the function should not return. Of course, care must be taken to
+not allocate more memory, as that will likely also fail.
@node Obsolete modules
Windows 2000 does not have getaddrinfo in its @file{WS2_32.DLL}.
Thus, if you want to assume Windows XP or later, you can add
-AC_DEFINE(WINVER, 0x0501) to avoid compiling to (partial) getaddrinfo
+AC_DEFINE(WINVER, 0x0501) to avoid compiling the (partial) getaddrinfo
implementation.
If you want to support Windows 2000, don't do anything. The
@c For double-sided printing, uncomment:
@c @setchapternewpage odd
@c This date is automagically updated when you save this file:
-@set lastupdate July 5, 2010
+@set lastupdate October 8, 2010
@c %**end of header
@dircategory GNU organization
@cindex advisory committee
The GNU Advisory Committee helps to coordinate activities in the GNU
-project on behalf of RMS. If you have any organizational questions or
-concerns you can contact the committee at
-@email{gnu-advisory@@gnu.org}. The committee holds a regular monthly
-meeting to discuss any issues that have been raised. The minutes of
-the meeting are sent to the @code{gnu-prog} list, and can also be
-found, along with additional information, in
+project on behalf of RMS (Richard Stallman, the Chief GNUisance). If
+you have any organizational questions or concerns you can contact the
+committee at @email{gnu-advisory@@gnu.org}. See
+@url{http://www.gnu.org/contact/gnu-advisory.html} for the current
+committee members. Additional information is in
@file{/gd/gnuorg/advisory}.
--- /dev/null
+@c GNU date syntax documentation
+
+@c Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
+@c 2004, 2005, 2006, 2009, 2010 Free Software Foundation, Inc.
+
+@c Permission is granted to copy, distribute and/or modify this document
+@c under the terms of the GNU Free Documentation License, Version 1.3 or
+@c any later version published by the Free Software Foundation; with no
+@c Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
+@c Texts. A copy of the license is included in the ``GNU Free
+@c Documentation License'' file as part of this distribution.
+
+@node Date input formats
+@chapter Date input formats
+
+@cindex date input formats
+@findex parse_datetime
+
+First, a quote:
+
+@quotation
+Our units of temporal measurement, from seconds on up to months, are so
+complicated, asymmetrical and disjunctive so as to make coherent mental
+reckoning in time all but impossible. Indeed, had some tyrannical god
+contrived to enslave our minds to time, to make it all but impossible
+for us to escape subjection to sodden routines and unpleasant surprises,
+he could hardly have done better than handing down our present system.
+It is like a set of trapezoidal building blocks, with no vertical or
+horizontal surfaces, like a language in which the simplest thought
+demands ornate constructions, useless particles and lengthy
+circumlocutions. Unlike the more successful patterns of language and
+science, which enable us to face experience boldly or at least
+level-headedly, our system of temporal calculation silently and
+persistently encourages our terror of time.
+
+@dots{} It is as though architects had to measure length in feet, width
+in meters and height in ells; as though basic instruction manuals
+demanded a knowledge of five different languages. It is no wonder then
+that we often look into our own immediate past or future, last Tuesday
+or a week from Sunday, with feelings of helpless confusion. @dots{}
+
+--- Robert Grudin, @cite{Time and the Art of Living}.
+@end quotation
+
+This section describes the textual date representations that @sc{gnu}
+programs accept. These are the strings you, as a user, can supply as
+arguments to the various programs. The C interface (via the
+@code{parse_datetime} function) is not described here.
+
+@menu
+* General date syntax:: Common rules.
+* Calendar date items:: 19 Dec 1994.
+* Time of day items:: 9:20pm.
+* Time zone items:: @sc{est}, @sc{pdt}, @sc{gmt}.
+* Day of week items:: Monday and others.
+* Relative items in date strings:: next tuesday, 2 years ago.
+* Pure numbers in date strings:: 19931219, 1440.
+* Seconds since the Epoch:: @@1078100502.
+* Specifying time zone rules:: TZ="America/New_York", TZ="UTC0".
+* Authors of parse_datetime:: Bellovin, Eggert, Salz, Berets, et al.
+@end menu
+
+
+@node General date syntax
+@section General date syntax
+
+@cindex general date syntax
+
+@cindex items in date strings
+A @dfn{date} is a string, possibly empty, containing many items
+separated by whitespace. The whitespace may be omitted when no
+ambiguity arises. The empty string means the beginning of today (i.e.,
+midnight). Order of the items is immaterial. A date string may contain
+many flavors of items:
+
+@itemize @bullet
+@item calendar date items
+@item time of day items
+@item time zone items
+@item day of the week items
+@item relative items
+@item pure numbers.
+@end itemize
+
+@noindent We describe each of these item types in turn, below.
+
+@cindex numbers, written-out
+@cindex ordinal numbers
+@findex first @r{in date strings}
+@findex next @r{in date strings}
+@findex last @r{in date strings}
+A few ordinal numbers may be written out in words in some contexts. This is
+most useful for specifying day of the week items or relative items (see
+below). Among the most commonly used ordinal numbers, the word
+@samp{last} stands for @math{-1}, @samp{this} stands for 0, and
+@samp{first} and @samp{next} both stand for 1. Because the word
+@samp{second} stands for the unit of time there is no way to write the
+ordinal number 2, but for convenience @samp{third} stands for 3,
+@samp{fourth} for 4, @samp{fifth} for 5,
+@samp{sixth} for 6, @samp{seventh} for 7, @samp{eighth} for 8,
+@samp{ninth} for 9, @samp{tenth} for 10, @samp{eleventh} for 11 and
+@samp{twelfth} for 12.
+
+@cindex months, written-out
+When a month is written this way, it is still considered to be written
+numerically, instead of being ``spelled in full''; this changes the
+allowed strings.
+
+@cindex language, in dates
+In the current implementation, only English is supported for words and
+abbreviations like @samp{AM}, @samp{DST}, @samp{EST}, @samp{first},
+@samp{January}, @samp{Sunday}, @samp{tomorrow}, and @samp{year}.
+
+@cindex language, in dates
+@cindex time zone item
+The output of the @command{date} command
+is not always acceptable as a date string,
+not only because of the language problem, but also because there is no
+standard meaning for time zone items like @samp{IST}. When using
+@command{date} to generate a date string intended to be parsed later,
+specify a date format that is independent of language and that does not
+use time zone items other than @samp{UTC} and @samp{Z}. Here are some
+ways to do this:
+
+@example
+$ LC_ALL=C TZ=UTC0 date
+Mon Mar 1 00:21:42 UTC 2004
+$ TZ=UTC0 date +'%Y-%m-%d %H:%M:%SZ'
+2004-03-01 00:21:42Z
+$ date --iso-8601=ns | tr T ' ' # --iso-8601 is a GNU extension.
+2004-02-29 16:21:42,692722128-0800
+$ date --rfc-2822 # a GNU extension
+Sun, 29 Feb 2004 16:21:42 -0800
+$ date +'%Y-%m-%d %H:%M:%S %z' # %z is a GNU extension.
+2004-02-29 16:21:42 -0800
+$ date +'@@%s.%N' # %s and %N are GNU extensions.
+@@1078100502.692722128
+@end example
+
+@cindex case, ignored in dates
+@cindex comments, in dates
+Alphabetic case is completely ignored in dates. Comments may be introduced
+between round parentheses, as long as included parentheses are properly
+nested. Hyphens not followed by a digit are currently ignored. Leading
+zeros on numbers are ignored.
+
+Invalid dates like @samp{2005-02-29} or times like @samp{24:00} are
+rejected. In the typical case of a host that does not support leap
+seconds, a time like @samp{23:59:60} is rejected even if it
+corresponds to a valid leap second.
+
+
+@node Calendar date items
+@section Calendar date items
+
+@cindex calendar date item
+
+A @dfn{calendar date item} specifies a day of the year. It is
+specified differently, depending on whether the month is specified
+numerically or literally. All these strings specify the same calendar date:
+
+@example
+1972-09-24 # @sc{iso} 8601.
+72-9-24 # Assume 19xx for 69 through 99,
+ # 20xx for 00 through 68.
+72-09-24 # Leading zeros are ignored.
+9/24/72 # Common U.S. writing.
+24 September 1972
+24 Sept 72 # September has a special abbreviation.
+24 Sep 72 # Three-letter abbreviations always allowed.
+Sep 24, 1972
+24-sep-72
+24sep72
+@end example
+
+The year can also be omitted. In this case, the last specified year is
+used, or the current year if none. For example:
+
+@example
+9/24
+sep 24
+@end example
+
+Here are the rules.
+
+@cindex @sc{iso} 8601 date format
+@cindex date format, @sc{iso} 8601
+For numeric months, the @sc{iso} 8601 format
+@samp{@var{year}-@var{month}-@var{day}} is allowed, where @var{year} is
+any positive number, @var{month} is a number between 01 and 12, and
+@var{day} is a number between 01 and 31. A leading zero must be present
+if a number is less than ten. If @var{year} is 68 or smaller, then 2000
+is added to it; otherwise, if @var{year} is less than 100,
+then 1900 is added to it. The construct
+@samp{@var{month}/@var{day}/@var{year}}, popular in the United States,
+is accepted. Also @samp{@var{month}/@var{day}}, omitting the year.
+
+@cindex month names in date strings
+@cindex abbreviations for months
+Literal months may be spelled out in full: @samp{January},
+@samp{February}, @samp{March}, @samp{April}, @samp{May}, @samp{June},
+@samp{July}, @samp{August}, @samp{September}, @samp{October},
+@samp{November} or @samp{December}. Literal months may be abbreviated
+to their first three letters, possibly followed by an abbreviating dot.
+It is also permitted to write @samp{Sept} instead of @samp{September}.
+
+When months are written literally, the calendar date may be given as any
+of the following:
+
+@example
+@var{day} @var{month} @var{year}
+@var{day} @var{month}
+@var{month} @var{day} @var{year}
+@var{day}-@var{month}-@var{year}
+@end example
+
+Or, omitting the year:
+
+@example
+@var{month} @var{day}
+@end example
+
+
+@node Time of day items
+@section Time of day items
+
+@cindex time of day item
+
+A @dfn{time of day item} in date strings specifies the time on a given
+day. Here are some examples, all of which represent the same time:
+
+@example
+20:02:00.000000
+20:02
+8:02pm
+20:02-0500 # In @sc{est} (U.S. Eastern Standard Time).
+@end example
+
+More generally, the time of day may be given as
+@samp{@var{hour}:@var{minute}:@var{second}}, where @var{hour} is
+a number between 0 and 23, @var{minute} is a number between 0 and
+59, and @var{second} is a number between 0 and 59 possibly followed by
+@samp{.} or @samp{,} and a fraction containing one or more digits.
+Alternatively,
+@samp{:@var{second}} can be omitted, in which case it is taken to
+be zero. On the rare hosts that support leap seconds, @var{second}
+may be 60.
+
+@findex am @r{in date strings}
+@findex pm @r{in date strings}
+@findex midnight @r{in date strings}
+@findex noon @r{in date strings}
+If the time is followed by @samp{am} or @samp{pm} (or @samp{a.m.}
+or @samp{p.m.}), @var{hour} is restricted to run from 1 to 12, and
+@samp{:@var{minute}} may be omitted (taken to be zero). @samp{am}
+indicates the first half of the day, @samp{pm} indicates the second
+half of the day. In this notation, 12 is the predecessor of 1:
+midnight is @samp{12am} while noon is @samp{12pm}.
+(This is the zero-oriented interpretation of @samp{12am} and @samp{12pm},
+as opposed to the old tradition derived from Latin
+which uses @samp{12m} for noon and @samp{12pm} for midnight.)
+
+@cindex time zone correction
+@cindex minutes, time zone correction by
+The time may alternatively be followed by a time zone correction,
+expressed as @samp{@var{s}@var{hh}@var{mm}}, where @var{s} is @samp{+}
+or @samp{-}, @var{hh} is a number of zone hours and @var{mm} is a number
+of zone minutes.
+The zone minutes term, @var{mm}, may be omitted, in which case
+the one- or two-digit correction is interpreted as a number of hours.
+You can also separate @var{hh} from @var{mm} with a colon.
+When a time zone correction is given this way, it
+forces interpretation of the time relative to
+Coordinated Universal Time (@sc{utc}), overriding any previous
+specification for the time zone or the local time zone. For example,
+@samp{+0530} and @samp{+05:30} both stand for the time zone 5.5 hours
+ahead of @sc{utc} (e.g., India).
+This is the best way to
+specify a time zone correction by fractional parts of an hour.
+The maximum zone correction is 24 hours.
+
+Either @samp{am}/@samp{pm} or a time zone correction may be specified,
+but not both.
+
+
+@node Time zone items
+@section Time zone items
+
+@cindex time zone item
+
+A @dfn{time zone item} specifies an international time zone, indicated
+by a small set of letters, e.g., @samp{UTC} or @samp{Z}
+for Coordinated Universal
+Time. Any included periods are ignored. By following a
+non-daylight-saving time zone by the string @samp{DST} in a separate
+word (that is, separated by some white space), the corresponding
+daylight saving time zone may be specified.
+Alternatively, a non-daylight-saving time zone can be followed by a
+time zone correction, to add the two values. This is normally done
+only for @samp{UTC}; for example, @samp{UTC+05:30} is equivalent to
+@samp{+05:30}.
+
+Time zone items other than @samp{UTC} and @samp{Z}
+are obsolescent and are not recommended, because they
+are ambiguous; for example, @samp{EST} has a different meaning in
+Australia than in the United States. Instead, it's better to use
+unambiguous numeric time zone corrections like @samp{-0500}, as
+described in the previous section.
+
+If neither a time zone item nor a time zone correction is supplied,
+time stamps are interpreted using the rules of the default time zone
+(@pxref{Specifying time zone rules}).
+
+
+@node Day of week items
+@section Day of week items
+
+@cindex day of week item
+
+The explicit mention of a day of the week will forward the date
+(only if necessary) to reach that day of the week in the future.
+
+Days of the week may be spelled out in full: @samp{Sunday},
+@samp{Monday}, @samp{Tuesday}, @samp{Wednesday}, @samp{Thursday},
+@samp{Friday} or @samp{Saturday}. Days may be abbreviated to their
+first three letters, optionally followed by a period. The special
+abbreviations @samp{Tues} for @samp{Tuesday}, @samp{Wednes} for
+@samp{Wednesday} and @samp{Thur} or @samp{Thurs} for @samp{Thursday} are
+also allowed.
+
+@findex next @var{day}
+@findex last @var{day}
+A number may precede a day of the week item to move forward
+supplementary weeks. It is best used in expression like @samp{third
+monday}. In this context, @samp{last @var{day}} or @samp{next
+@var{day}} is also acceptable; they move one week before or after
+the day that @var{day} by itself would represent.
+
+A comma following a day of the week item is ignored.
+
+
+@node Relative items in date strings
+@section Relative items in date strings
+
+@cindex relative items in date strings
+@cindex displacement of dates
+
+@dfn{Relative items} adjust a date (or the current date if none) forward
+or backward. The effects of relative items accumulate. Here are some
+examples:
+
+@example
+1 year
+1 year ago
+3 years
+2 days
+@end example
+
+@findex year @r{in date strings}
+@findex month @r{in date strings}
+@findex fortnight @r{in date strings}
+@findex week @r{in date strings}
+@findex day @r{in date strings}
+@findex hour @r{in date strings}
+@findex minute @r{in date strings}
+The unit of time displacement may be selected by the string @samp{year}
+or @samp{month} for moving by whole years or months. These are fuzzy
+units, as years and months are not all of equal duration. More precise
+units are @samp{fortnight} which is worth 14 days, @samp{week} worth 7
+days, @samp{day} worth 24 hours, @samp{hour} worth 60 minutes,
+@samp{minute} or @samp{min} worth 60 seconds, and @samp{second} or
+@samp{sec} worth one second. An @samp{s} suffix on these units is
+accepted and ignored.
+
+@findex ago @r{in date strings}
+The unit of time may be preceded by a multiplier, given as an optionally
+signed number. Unsigned numbers are taken as positively signed. No
+number at all implies 1 for a multiplier. Following a relative item by
+the string @samp{ago} is equivalent to preceding the unit by a
+multiplier with value @math{-1}.
+
+@findex day @r{in date strings}
+@findex tomorrow @r{in date strings}
+@findex yesterday @r{in date strings}
+The string @samp{tomorrow} is worth one day in the future (equivalent
+to @samp{day}), the string @samp{yesterday} is worth
+one day in the past (equivalent to @samp{day ago}).
+
+@findex now @r{in date strings}
+@findex today @r{in date strings}
+@findex this @r{in date strings}
+The strings @samp{now} or @samp{today} are relative items corresponding
+to zero-valued time displacement, these strings come from the fact
+a zero-valued time displacement represents the current time when not
+otherwise changed by previous items. They may be used to stress other
+items, like in @samp{12:00 today}. The string @samp{this} also has
+the meaning of a zero-valued time displacement, but is preferred in
+date strings like @samp{this thursday}.
+
+When a relative item causes the resulting date to cross a boundary
+where the clocks were adjusted, typically for daylight saving time,
+the resulting date and time are adjusted accordingly.
+
+The fuzz in units can cause problems with relative items. For
+example, @samp{2003-07-31 -1 month} might evaluate to 2003-07-01,
+because 2003-06-31 is an invalid date. To determine the previous
+month more reliably, you can ask for the month before the 15th of the
+current month. For example:
+
+@example
+$ date -R
+Thu, 31 Jul 2003 13:02:39 -0700
+$ date --date='-1 month' +'Last month was %B?'
+Last month was July?
+$ date --date="$(date +%Y-%m-15) -1 month" +'Last month was %B!'
+Last month was June!
+@end example
+
+Also, take care when manipulating dates around clock changes such as
+daylight saving leaps. In a few cases these have added or subtracted
+as much as 24 hours from the clock, so it is often wise to adopt
+universal time by setting the @env{TZ} environment variable to
+@samp{UTC0} before embarking on calendrical calculations.
+
+@node Pure numbers in date strings
+@section Pure numbers in date strings
+
+@cindex pure numbers in date strings
+
+The precise interpretation of a pure decimal number depends
+on the context in the date string.
+
+If the decimal number is of the form @var{yyyy}@var{mm}@var{dd} and no
+other calendar date item (@pxref{Calendar date items}) appears before it
+in the date string, then @var{yyyy} is read as the year, @var{mm} as the
+month number and @var{dd} as the day of the month, for the specified
+calendar date.
+
+If the decimal number is of the form @var{hh}@var{mm} and no other time
+of day item appears before it in the date string, then @var{hh} is read
+as the hour of the day and @var{mm} as the minute of the hour, for the
+specified time of day. @var{mm} can also be omitted.
+
+If both a calendar date and a time of day appear to the left of a number
+in the date string, but no relative item, then the number overrides the
+year.
+
+
+@node Seconds since the Epoch
+@section Seconds since the Epoch
+
+If you precede a number with @samp{@@}, it represents an internal time
+stamp as a count of seconds. The number can contain an internal
+decimal point (either @samp{.} or @samp{,}); any excess precision not
+supported by the internal representation is truncated toward minus
+infinity. Such a number cannot be combined with any other date
+item, as it specifies a complete time stamp.
+
+@cindex beginning of time, for @acronym{POSIX}
+@cindex epoch, for @acronym{POSIX}
+Internally, computer times are represented as a count of seconds since
+an epoch---a well-defined point of time. On @acronym{GNU} and
+@acronym{POSIX} systems, the epoch is 1970-01-01 00:00:00 @sc{utc}, so
+@samp{@@0} represents this time, @samp{@@1} represents 1970-01-01
+00:00:01 @sc{utc}, and so forth. @acronym{GNU} and most other
+@acronym{POSIX}-compliant systems support such times as an extension
+to @acronym{POSIX}, using negative counts, so that @samp{@@-1}
+represents 1969-12-31 23:59:59 @sc{utc}.
+
+Traditional Unix systems count seconds with 32-bit two's-complement
+integers and can represent times from 1901-12-13 20:45:52 through
+2038-01-19 03:14:07 @sc{utc}. More modern systems use 64-bit counts
+of seconds with nanosecond subcounts, and can represent all the times
+in the known lifetime of the universe to a resolution of 1 nanosecond.
+
+On most hosts, these counts ignore the presence of leap seconds.
+For example, on most hosts @samp{@@915148799} represents 1998-12-31
+23:59:59 @sc{utc}, @samp{@@915148800} represents 1999-01-01 00:00:00
+@sc{utc}, and there is no way to represent the intervening leap second
+1998-12-31 23:59:60 @sc{utc}.
+
+@node Specifying time zone rules
+@section Specifying time zone rules
+
+@vindex TZ
+Normally, dates are interpreted using the rules of the current time
+zone, which in turn are specified by the @env{TZ} environment
+variable, or by a system default if @env{TZ} is not set. To specify a
+different set of default time zone rules that apply just to one date,
+start the date with a string of the form @samp{TZ="@var{rule}"}. The
+two quote characters (@samp{"}) must be present in the date, and any
+quotes or backslashes within @var{rule} must be escaped by a
+backslash.
+
+For example, with the @acronym{GNU} @command{date} command you can
+answer the question ``What time is it in New York when a Paris clock
+shows 6:30am on October 31, 2004?'' by using a date beginning with
+@samp{TZ="Europe/Paris"} as shown in the following shell transcript:
+
+@example
+$ export TZ="America/New_York"
+$ date --date='TZ="Europe/Paris" 2004-10-31 06:30'
+Sun Oct 31 01:30:00 EDT 2004
+@end example
+
+In this example, the @option{--date} operand begins with its own
+@env{TZ} setting, so the rest of that operand is processed according
+to @samp{Europe/Paris} rules, treating the string @samp{2004-10-31
+06:30} as if it were in Paris. However, since the output of the
+@command{date} command is processed according to the overall time zone
+rules, it uses New York time. (Paris was normally six hours ahead of
+New York in 2004, but this example refers to a brief Halloween period
+when the gap was five hours.)
+
+A @env{TZ} value is a rule that typically names a location in the
+@uref{http://www.twinsun.com/tz/tz-link.htm, @samp{tz} database}.
+A recent catalog of location names appears in the
+@uref{http://twiki.org/cgi-bin/xtra/tzdate, TWiki Date and Time
+Gateway}. A few non-@acronym{GNU} hosts require a colon before a
+location name in a @env{TZ} setting, e.g.,
+@samp{TZ=":America/New_York"}.
+
+The @samp{tz} database includes a wide variety of locations ranging
+from @samp{Arctic/Longyearbyen} to @samp{Antarctica/South_Pole}, but
+if you are at sea and have your own private time zone, or if you are
+using a non-@acronym{GNU} host that does not support the @samp{tz}
+database, you may need to use a @acronym{POSIX} rule instead. Simple
+@acronym{POSIX} rules like @samp{UTC0} specify a time zone without
+daylight saving time; other rules can specify simple daylight saving
+regimes. @xref{TZ Variable,, Specifying the Time Zone with @code{TZ},
+libc, The GNU C Library}.
+
+@node Authors of parse_datetime
+@section Authors of @code{parse_datetime}
+@c the anchor keeps the old node name, to try to avoid breaking links
+@anchor{Authors of get_date}
+
+@cindex authors of @code{parse_datetime}
+
+@cindex Bellovin, Steven M.
+@cindex Salz, Rich
+@cindex Berets, Jim
+@cindex MacKenzie, David
+@cindex Meyering, Jim
+@cindex Eggert, Paul
+@code{parse_datetime} started life as @code{getdate}, as originally
+implemented by Steven M. Bellovin
+(@email{smb@@research.att.com}) while at the University of North Carolina
+at Chapel Hill. The code was later tweaked by a couple of people on
+Usenet, then completely overhauled by Rich $alz (@email{rsalz@@bbn.com})
+and Jim Berets (@email{jberets@@bbn.com}) in August, 1990. Various
+revisions for the @sc{gnu} system were made by David MacKenzie, Jim Meyering,
+Paul Eggert and others, including renaming it to @code{get_date} to
+avoid a conflict with the alternative Posix function @code{getdate},
+and a later rename to @code{parse_datetime}. The Posix function
+@code{getdate} can parse more locale-specific dates using
+@code{strptime}, but relies on an environment variable and external
+file, and lacks the thread-safety of @code{parse_datetime}.
+
+@cindex Pinard, F.
+@cindex Berry, K.
+This chapter was originally produced by Fran@,{c}ois Pinard
+(@email{pinard@@iro.umontreal.ca}) from the @file{parse_datetime.y} source code,
+and then edited by K.@: Berry (@email{kb@@cs.umb.edu}).
@itemize
@item
This function is missing on some platforms:
-FreeBSD 6.0, NetBSD 3.0, OpenBSD 3.8, AIX 5.1, HP-UX 11, IRIX 6.5, OSF/1 4.0, Solaris 9, Cygwin, mingw, Interix 3.5.
+FreeBSD 6.0, NetBSD 3.0, OpenBSD 3.8, AIX 5.1, HP-UX 11, IRIX 6.5,
+OSF/1 4.0, Solaris 9, Cygwin 1.7.7, mingw, Interix 3.5.
@end itemize
@itemize
@item
This function is missing on some platforms:
-FreeBSD 6.0, NetBSD 3.0, OpenBSD 3.8, AIX 5.1, HP-UX 11, IRIX 6.5, OSF/1 4.0, Solaris 9, Cygwin, mingw, Interix 3.5.
+FreeBSD 6.0, NetBSD 3.0, OpenBSD 3.8, AIX 5.1, HP-UX 11, IRIX 6.5,
+OSF/1 4.0, Solaris 9, Cygwin 1.7.7, mingw, Interix 3.5.
@end itemize
@itemize
@item
This function is missing on some platforms:
-FreeBSD 6.0, NetBSD 3.0, OpenBSD 3.8, AIX 5.1, HP-UX 11, IRIX 6.5, OSF/1 4.0, Solaris 9, Cygwin, mingw, Interix 3.5.
+FreeBSD 6.0, NetBSD 3.0, OpenBSD 3.8, AIX 5.1, HP-UX 11, IRIX 6.5,
+OSF/1 4.0, Solaris 9, Cygwin 1.7.7, mingw, Interix 3.5.
@end itemize
@itemize
@item
This function is missing on some platforms:
-FreeBSD 6.0, NetBSD 3.0, OpenBSD 3.8, AIX 5.1, HP-UX 11, IRIX 6.5, OSF/1 4.0, Solaris 9, Cygwin, mingw, Interix 3.5.
+FreeBSD 6.0, NetBSD 3.0, OpenBSD 3.8, AIX 5.1, HP-UX 11, IRIX 6.5,
+OSF/1 4.0, Solaris 9, Cygwin 1.7.7, mingw, Interix 3.5.
@end itemize
@itemize
@end itemize
-Extension: Gnulib provides a module @samp{calloc} that substitutes a
+Extension: Gnulib provides a module @samp{calloc-gnu} that substitutes a
@code{calloc} implementation that behaves more like the glibc implementation.
@itemize
@item
This function is missing on some platforms:
-FreeBSD 6.0, NetBSD 3.0, OpenBSD 3.8, AIX 5.1, HP-UX 11, IRIX 6.5, OSF/1 4.0, Solaris 9, Cygwin, mingw, Interix 3.5.
+FreeBSD 6.0, NetBSD 3.0, OpenBSD 3.8, AIX 5.1, HP-UX 11, IRIX 6.5,
+OSF/1 4.0, Solaris 9, Cygwin 1.7.7, mingw, Interix 3.5.
@end itemize
@itemize
@item
This function is missing on some platforms:
-FreeBSD 6.0, NetBSD 3.0, OpenBSD 3.8, AIX 5.1, HP-UX 11, IRIX 6.5, OSF/1 4.0, Solaris 9, Cygwin, mingw., Interix 3.5
+FreeBSD 6.0, NetBSD 3.0, OpenBSD 3.8, AIX 5.1, HP-UX 11, IRIX 6.5,
+OSF/1 4.0, Solaris 9, Cygwin 1.7.7, mingw., Interix 3.5
@end itemize
@itemize
@item
This function is missing on some platforms:
-FreeBSD 6.0, NetBSD 3.0, OpenBSD 3.8, AIX 5.1, HP-UX 11, IRIX 6.5, OSF/1 4.0, Solaris 9, Cygwin, mingw, Interix 3.5.
+FreeBSD 6.0, NetBSD 3.0, OpenBSD 3.8, AIX 5.1, HP-UX 11, IRIX 6.5,
+OSF/1 4.0, Solaris 9, Cygwin 1.7.7, mingw, Interix 3.5.
@end itemize
@itemize
@item
This function is missing on some platforms:
-FreeBSD 6.0, NetBSD 3.0, OpenBSD 3.8, AIX 5.1, HP-UX 11, IRIX 6.5, OSF/1 4.0, Solaris 9, Cygwin, mingw, Interix 3.5.
+FreeBSD 6.0, NetBSD 3.0, OpenBSD 3.8, AIX 5.1, HP-UX 11, IRIX 6.5,
+OSF/1 4.0, Solaris 9, Cygwin 1.7.7, mingw, Interix 3.5.
@end itemize
@itemize
@item
This function is missing on some platforms:
-FreeBSD 6.0, NetBSD 3.0, OpenBSD 3.8, AIX 5.1, HP-UX 11, IRIX 6.5, OSF/1 4.0, Solaris 9, Cygwin, mingw, Interix 3.5.
+FreeBSD 6.0, NetBSD 3.0, OpenBSD 3.8, AIX 5.1, HP-UX 11, IRIX 6.5,
+OSF/1 4.0, Solaris 9, Cygwin 1.7.7, mingw, Interix 3.5.
@end itemize
@itemize
@item
This function is missing on some platforms:
-FreeBSD 6.0, NetBSD 3.0, OpenBSD 3.8, AIX 5.1, HP-UX 11, IRIX 6.5, OSF/1 4.0, Solaris 9, Cygwin, mingw, Interix 3.5.
+FreeBSD 6.0, NetBSD 3.0, OpenBSD 3.8, AIX 5.1, HP-UX 11, IRIX 6.5,
+OSF/1 4.0, Solaris 9, Cygwin 1.7.7, mingw, Interix 3.5.
@end itemize
@itemize
@item
This function is missing on some platforms:
-FreeBSD 6.0, NetBSD 3.0, OpenBSD 3.8, AIX 5.1, HP-UX 11, IRIX 6.5, OSF/1 4.0, Solaris 9, Cygwin, mingw, Interix 3.5.
+FreeBSD 6.0, NetBSD 3.0, OpenBSD 3.8, AIX 5.1, HP-UX 11, IRIX 6.5,
+OSF/1 4.0, Solaris 9, Cygwin 1.7.7, mingw, Interix 3.5.
@end itemize
@itemize
@item
This function is missing on some platforms:
-FreeBSD 6.0, NetBSD 3.0, OpenBSD 3.8, AIX 5.1, HP-UX 11, IRIX 6.5, OSF/1 4.0, Solaris 9, Cygwin, mingw, Interix 3.5.
+FreeBSD 6.0, NetBSD 3.0, OpenBSD 3.8, AIX 5.1, HP-UX 11, IRIX 6.5,
+OSF/1 4.0, Solaris 9, Cygwin 1.7.7, mingw, Interix 3.5.
@end itemize
@itemize
@item
This function is missing on some platforms:
-FreeBSD 6.0, NetBSD 3.0, OpenBSD 3.8, AIX 5.1, HP-UX 11, IRIX 6.5, OSF/1 4.0, Solaris 9, Cygwin, mingw, Interix 3.5.
+FreeBSD 6.0, NetBSD 3.0, OpenBSD 3.8, AIX 5.1, HP-UX 11, IRIX 6.5,
+OSF/1 4.0, Solaris 9, Cygwin 1.7.7, mingw, Interix 3.5.
@end itemize
@itemize
@item
This function is missing on some platforms:
-FreeBSD 6.0, NetBSD 3.0, OpenBSD 3.8, AIX 5.1, HP-UX 11, IRIX 6.5, OSF/1 4.0, Solaris 9, Cygwin, mingw, Interix 3.5.
+FreeBSD 6.0, NetBSD 3.0, OpenBSD 3.8, AIX 5.1, HP-UX 11, IRIX 6.5,
+OSF/1 4.0, Solaris 9, Cygwin 1.7.7, mingw, Interix 3.5.
@end itemize
@itemize
@item
This function is missing on some platforms:
-FreeBSD 6.0, NetBSD 3.0, OpenBSD 3.8, AIX 5.1, HP-UX 11, IRIX 6.5, Solaris 9, Cygwin, mingw, Interix 3.5.
+FreeBSD 6.0, NetBSD 3.0, OpenBSD 3.8, AIX 5.1, HP-UX 11, IRIX 6.5,
+Solaris 9, Cygwin 1.7.7, mingw, Interix 3.5.
@end itemize
@itemize
@item
This function is missing on some platforms:
-FreeBSD 6.0, NetBSD 3.0, OpenBSD 3.8, AIX 5.1, HP-UX 11, IRIX 6.5, Solaris 9, Cygwin, mingw, Interix 3.5.
+FreeBSD 6.0, NetBSD 3.0, OpenBSD 3.8, AIX 5.1, HP-UX 11, IRIX 6.5,
+Solaris 9, Cygwin 1.7.7, mingw, Interix 3.5.
@end itemize
@itemize
@item
This function is missing on some platforms:
-FreeBSD 6.0, NetBSD 3.0, OpenBSD 3.8, AIX 5.1, HP-UX 11, IRIX 6.5, OSF/1 4.0, Solaris 9, Cygwin, mingw, Interix 3.5.
+FreeBSD 6.0, NetBSD 3.0, OpenBSD 3.8, AIX 5.1, HP-UX 11, IRIX 6.5,
+OSF/1 4.0, Solaris 9, Cygwin 1.7.7, mingw, Interix 3.5.
@end itemize
@itemize
@item
This function is missing on some platforms:
-FreeBSD 6.0, NetBSD 3.0, OpenBSD 3.8, AIX 5.1, HP-UX 11, IRIX 6.5, OSF/1 4.0, Solaris 9, Cygwin, mingw, Interix 3.5.
+FreeBSD 6.0, NetBSD 3.0, OpenBSD 3.8, AIX 5.1, HP-UX 11, IRIX 6.5,
+OSF/1 4.0, Solaris 9, Cygwin 1.7.7, mingw, Interix 3.5.
@end itemize
@itemize
@item
This function is missing on some platforms:
-FreeBSD 6.0, NetBSD 3.0, OpenBSD 3.8, AIX 5.1, HP-UX 11, IRIX 6.5, Solaris 9, Cygwin, mingw, Interix 3.5.
+FreeBSD 6.0, NetBSD 3.0, OpenBSD 3.8, AIX 5.1, HP-UX 11, IRIX 6.5,
+Solaris 9, Cygwin 1.7.7, mingw, Interix 3.5.
@end itemize
@itemize
@item
This function is missing on some platforms:
-FreeBSD 6.0, NetBSD 3.0, OpenBSD 3.8, AIX 5.1, HP-UX 11, IRIX 6.5, Solaris 9, Cygwin, mingw, Interix 3.5.
+FreeBSD 6.0, NetBSD 3.0, OpenBSD 3.8, AIX 5.1, HP-UX 11, IRIX 6.5,
+Solaris 9, Cygwin 1.7.7, mingw, Interix 3.5.
@end itemize
@itemize
@item
This function is missing on some platforms:
-FreeBSD 5.2.1, NetBSD 3.0, OpenBSD 3.8, AIX 5.1, HP-UX 11, IRIX 6.5, OSF/1 4.0, Solaris 9, Cygwin, mingw, Interix 3.5.
+FreeBSD 5.2.1, NetBSD 3.0, OpenBSD 3.8, AIX 5.1, HP-UX 11, IRIX 6.5,
+OSF/1 4.0, Solaris 9, Cygwin 1.7.7, mingw, Interix 3.5.
@end itemize
@itemize
@item
This function is missing on some platforms:
-FreeBSD 5.2.1, NetBSD 3.0, OpenBSD 3.8, AIX 5.1, HP-UX 11, IRIX 6.5, OSF/1 4.0, Solaris 9, Cygwin, mingw, Interix 3.5.
+FreeBSD 5.2.1, NetBSD 3.0, OpenBSD 3.8, AIX 5.1, HP-UX 11, IRIX 6.5,
+OSF/1 4.0, Solaris 9, Cygwin 1.7.7, mingw, Interix 3.5.
@end itemize
@itemize
@item
This function is missing on some platforms:
-FreeBSD 6.0, NetBSD 3.0, OpenBSD 3.8, AIX 5.1, HP-UX 11, IRIX 6.5, Solaris 9, Cygwin, mingw, Interix 3.5.
+FreeBSD 6.0, NetBSD 3.0, OpenBSD 3.8, AIX 5.1, HP-UX 11, IRIX 6.5,
+Solaris 9, Cygwin 1.7.7, mingw, Interix 3.5.
@end itemize
@itemize
@item
This function is missing on some platforms:
-FreeBSD 6.0, NetBSD 3.0, OpenBSD 3.8, AIX 5.1, HP-UX 11, IRIX 6.5, Solaris 9, Cygwin, mingw, Interix 3.5.
+FreeBSD 6.0, NetBSD 3.0, OpenBSD 3.8, AIX 5.1, HP-UX 11, IRIX 6.5,
+Solaris 9, Cygwin 1.7.7, mingw, Interix 3.5.
@end itemize
@itemize
@item
This function is missing on some platforms:
-FreeBSD 5.2.1, NetBSD 3.0, OpenBSD 3.8, AIX 5.1, HP-UX 11, IRIX 6.5, OSF/1 4.0, Solaris 9, Cygwin, mingw, Interix 3.5.
+FreeBSD 5.2.1, NetBSD 3.0, OpenBSD 3.8, AIX 5.1, HP-UX 11, IRIX 6.5,
+OSF/1 4.0, Solaris 9, Cygwin 1.7.7, mingw, Interix 3.5.
@end itemize
@itemize
@item
This function is missing on some platforms:
-FreeBSD 5.2.1, NetBSD 3.0, OpenBSD 3.8, AIX 5.1, HP-UX 11, IRIX 6.5, OSF/1 4.0, Solaris 9, Cygwin, mingw, Interix 3.5.
+FreeBSD 5.2.1, NetBSD 3.0, OpenBSD 3.8, AIX 5.1, HP-UX 11, IRIX 6.5,
+OSF/1 4.0, Solaris 9, Cygwin 1.7.7, mingw, Interix 3.5.
@end itemize
@itemize
@item
This function is missing on some platforms:
-FreeBSD 6.0, NetBSD 3.0, OpenBSD 3.8, AIX 5.1, HP-UX 11, IRIX 6.5, Solaris 9, Cygwin, mingw, Interix 3.5.
+FreeBSD 6.0, NetBSD 3.0, OpenBSD 3.8, AIX 5.1, HP-UX 11, IRIX 6.5,
+Solaris 9, Cygwin 1.7.7, mingw, Interix 3.5.
@end itemize
@itemize
@item
This function is missing on some platforms:
-FreeBSD 6.0, NetBSD 3.0, OpenBSD 3.8, AIX 5.1, HP-UX 11, IRIX 6.5, Solaris 9, Cygwin, mingw, Interix 3.5.
+FreeBSD 6.0, NetBSD 3.0, OpenBSD 3.8, AIX 5.1, HP-UX 11, IRIX 6.5,
+Solaris 9, Cygwin 1.7.7, mingw, Interix 3.5.
@end itemize
@itemize
@item
This function is missing on some platforms:
-FreeBSD 6.0, NetBSD 3.0, OpenBSD 3.8, AIX 5.1, HP-UX 11, IRIX 6.5, OSF/1 4.0, Solaris 9, Cygwin, mingw, Interix 3.5.
+FreeBSD 6.0, NetBSD 3.0, OpenBSD 3.8, AIX 5.1, HP-UX 11, IRIX 6.5,
+OSF/1 4.0, Solaris 9, Cygwin 1.7.7, mingw, Interix 3.5.
@item
The glibc implementation is or was broken.
@end itemize
@itemize
@item
This function is missing on some platforms:
-FreeBSD 6.0, NetBSD 3.0, OpenBSD 3.8, AIX 5.1, HP-UX 11, IRIX 6.5, OSF/1 4.0, Solaris 9, Cygwin, mingw, Interix 3.5.
+FreeBSD 6.0, NetBSD 3.0, OpenBSD 3.8, AIX 5.1, HP-UX 11, IRIX 6.5,
+OSF/1 4.0, Solaris 9, Cygwin 1.7.7, mingw, Interix 3.5.
@item
The glibc implementation is or was broken.
@end itemize
@itemize
@item
This function is missing on some platforms:
-FreeBSD 5.2.1, NetBSD 3.0, OpenBSD 3.8, AIX 5.1, HP-UX 11, IRIX 6.5, OSF/1 4.0, Solaris 9, Cygwin, mingw, Interix 3.5.
+FreeBSD 5.2.1, NetBSD 3.0, OpenBSD 3.8, AIX 5.1, HP-UX 11, IRIX 6.5,
+OSF/1 4.0, Solaris 9, Cygwin 1.7.7, mingw, Interix 3.5.
@end itemize
@itemize
@item
This function is missing on some platforms:
-FreeBSD 5.2.1, NetBSD 3.0, OpenBSD 3.8, AIX 5.1, HP-UX 11, IRIX 6.5, OSF/1 4.0, Solaris 9, Cygwin, mingw, Interix 3.5.
+FreeBSD 5.2.1, NetBSD 3.0, OpenBSD 3.8, AIX 5.1, HP-UX 11, IRIX 6.5,
+OSF/1 4.0, Solaris 9, Cygwin 1.7.7, mingw, Interix 3.5.
@end itemize
@itemize
@item
This function is missing on some platforms:
-FreeBSD 6.0, NetBSD 3.0, OpenBSD 3.8, AIX 5.1, HP-UX 11, IRIX 6.5, Solaris 9, Cygwin, mingw, Interix 3.5.
+FreeBSD 6.0, NetBSD 3.0, OpenBSD 3.8, AIX 5.1, HP-UX 11, IRIX 6.5,
+Solaris 9, Cygwin 1.7.7, mingw, Interix 3.5.
@end itemize
@itemize
@item
This function is missing on some platforms:
-FreeBSD 6.0, NetBSD 3.0, OpenBSD 3.8, AIX 5.1, HP-UX 11, IRIX 6.5, Solaris 9, Cygwin, mingw, Interix 3.5.
+FreeBSD 6.0, NetBSD 3.0, OpenBSD 3.8, AIX 5.1, HP-UX 11, IRIX 6.5,
+Solaris 9, Cygwin 1.7.7, mingw, Interix 3.5.
@end itemize
@itemize
@item
This function is missing on some platforms:
-FreeBSD 6.0, NetBSD 3.0, OpenBSD 3.8, AIX 5.1, HP-UX 11, IRIX 6.5, OSF/1 4.0, Solaris 9, Cygwin, mingw, Interix 3.5.
+FreeBSD 6.0, NetBSD 3.0, OpenBSD 3.8, AIX 5.1, HP-UX 11, IRIX 6.5,
+OSF/1 4.0, Solaris 9, Cygwin 1.7.7, mingw, Interix 3.5.
@end itemize
@itemize
@item
This function is missing on some platforms:
-FreeBSD 6.0, NetBSD 3.0, OpenBSD 3.8, AIX 5.1, HP-UX 11, IRIX 6.5, OSF/1 4.0, Solaris 9, Cygwin, mingw, Interix 3.5.
+FreeBSD 6.0, NetBSD 3.0, OpenBSD 3.8, AIX 5.1, HP-UX 11, IRIX 6.5,
+OSF/1 4.0, Solaris 9, Cygwin 1.7.7, mingw, Interix 3.5.
@end itemize
@itemize
@item
This function is missing on some platforms:
-FreeBSD 6.0, NetBSD 3.0, OpenBSD 3.8, AIX 5.1, HP-UX 11, IRIX 6.5, Solaris 9, Cygwin, mingw, Interix 3.5.
+FreeBSD 6.0, NetBSD 3.0, OpenBSD 3.8, AIX 5.1, HP-UX 11, IRIX 6.5,
+Solaris 9, Cygwin 1.7.7, mingw, Interix 3.5.
@end itemize
@itemize
@item
This function is missing on some platforms:
-FreeBSD 6.0, NetBSD 3.0, OpenBSD 3.8, AIX 5.1, HP-UX 11, IRIX 6.5, Solaris 9, Cygwin, mingw, Interix 3.5.
+FreeBSD 6.0, NetBSD 3.0, OpenBSD 3.8, AIX 5.1, HP-UX 11, IRIX 6.5,
+Solaris 9, Cygwin 1.7.7, mingw, Interix 3.5.
@end itemize
@itemize
@item
This function is missing on some platforms:
-FreeBSD 6.0, NetBSD 3.0, OpenBSD 3.8, AIX 5.1, HP-UX 11, IRIX 6.5, OSF/1 4.0, Solaris 9, Cygwin, mingw, Interix 3.5.
+FreeBSD 6.0, NetBSD 3.0, OpenBSD 3.8, AIX 5.1, HP-UX 11, IRIX 6.5,
+OSF/1 4.0, Solaris 9, Cygwin 1.7.7, mingw, Interix 3.5.
@end itemize
@itemize
@item
This function is missing on some platforms:
-FreeBSD 6.0, NetBSD 3.0, OpenBSD 3.8, AIX 5.1, HP-UX 11, IRIX 6.5, OSF/1 4.0, Solaris 9, Cygwin, mingw, Interix 3.5.
+FreeBSD 6.0, NetBSD 3.0, OpenBSD 3.8, AIX 5.1, HP-UX 11, IRIX 6.5,
+OSF/1 4.0, Solaris 9, Cygwin 1.7.7, mingw, Interix 3.5.
@end itemize
@itemize
@item
This function is missing on some platforms:
-FreeBSD 6.0, NetBSD 3.0, OpenBSD 3.8, AIX 5.1, HP-UX 11, IRIX 6.5, OSF/1 4.0, Solaris 9, Cygwin, mingw, Interix 3.5.
+FreeBSD 6.0, NetBSD 3.0, OpenBSD 3.8, AIX 5.1, HP-UX 11, IRIX 6.5,
+OSF/1 4.0, Solaris 9, Cygwin 1.7.7, mingw, Interix 3.5.
@end itemize
@itemize
@item
This function is missing on some platforms:
-FreeBSD 6.0, NetBSD 3.0, OpenBSD 3.8, AIX 5.1, HP-UX 11, IRIX 6.5, OSF/1 4.0, Solaris 9, Cygwin, mingw, Interix 3.5.
+FreeBSD 6.0, NetBSD 3.0, OpenBSD 3.8, AIX 5.1, HP-UX 11, IRIX 6.5,
+OSF/1 4.0, Solaris 9, Cygwin 1.7.7, mingw, Interix 3.5.
@end itemize
@itemize
@item
This function is missing on some platforms:
-MacOS X 10.3, FreeBSD 6.0, NetBSD 3.0, OpenBSD 3.8, AIX 5.1, IRIX 6.5, OSF/1 5.1, Solaris 9, Cygwin, Interix 3.5.
+MacOS X 10.3, FreeBSD 6.0, NetBSD 3.0, OpenBSD 3.8, AIX 5.1, IRIX 6.5,
+OSF/1 5.1, Solaris 9, Cygwin 1.7.7, Interix 3.5.
@end itemize
@itemize
@item
This function is missing on some platforms:
-MacOS X 10.3, FreeBSD 5.2.1, NetBSD 3.0, OpenBSD 3.8, AIX 5.1, IRIX 6.5, OSF/1 5.1, Solaris 9, Cygwin, Interix 3.5.
+MacOS X 10.3, FreeBSD 5.2.1, NetBSD 3.0, OpenBSD 3.8, AIX 5.1, IRIX
+6.5, OSF/1 5.1, Solaris 9, Cygwin 1.7.7, Interix 3.5.
@end itemize
@itemize
@item
This function is missing on some platforms:
-FreeBSD 6.0, NetBSD 3.0, OpenBSD 3.8, AIX 5.1, IRIX 6.5, OSF/1 5.1, Solaris 9, Cygwin, Interix 3.5.
+FreeBSD 6.0, NetBSD 3.0, OpenBSD 3.8, AIX 5.1, IRIX 6.5, OSF/1 5.1,
+Solaris 9, Cygwin 1.7.7, Interix 3.5.
@end itemize
@itemize
@item
This function is missing on some platforms:
-MacOS X 10.3, FreeBSD 6.0, NetBSD 3.0, OpenBSD 3.8, AIX 5.1, IRIX 6.5, Solaris 9, Cygwin, Interix 3.5.
+MacOS X 10.3, FreeBSD 6.0, NetBSD 3.0, OpenBSD 3.8, AIX 5.1, IRIX 6.5,
+Solaris 9, Cygwin 1.7.7, Interix 3.5.
@end itemize
@itemize
@item
This function is missing on some platforms:
-MacOS X 10.3, FreeBSD 5.2.1, NetBSD 3.0, OpenBSD 3.8, AIX 5.1, IRIX 6.5, OSF/1 5.1, Solaris 9, Cygwin, Interix 3.5.
+MacOS X 10.3, FreeBSD 5.2.1, NetBSD 3.0, OpenBSD 3.8, AIX 5.1, IRIX
+6.5, OSF/1 5.1, Solaris 9, Cygwin 1.7.7, Interix 3.5.
@end itemize
@itemize
@item
This function is missing on some platforms:
-MacOS X 10.3, FreeBSD 5.2.1, NetBSD 3.0, OpenBSD 3.8, AIX 5.1, IRIX 6.5, OSF/1 5.1, Solaris 9, Cygwin, Interix 3.5.
+MacOS X 10.3, FreeBSD 5.2.1, NetBSD 3.0, OpenBSD 3.8, AIX 5.1, IRIX
+6.5, OSF/1 5.1, Solaris 9, Cygwin 1.7.7, Interix 3.5.
@end itemize
@itemize
@item
This function is missing on some platforms:
-MacOS X 10.3, FreeBSD 6.0, NetBSD 3.0, OpenBSD 3.8, AIX 5.1, IRIX 6.5, OSF/1 5.1, Solaris 9, Cygwin, Interix 3.5.
+MacOS X 10.3, FreeBSD 6.0, NetBSD 3.0, OpenBSD 3.8, AIX 5.1, IRIX 6.5,
+OSF/1 5.1, Solaris 9, Cygwin 1.7.7, Interix 3.5.
@end itemize
@itemize
@item
This function is missing on some platforms:
-FreeBSD 5.2.1, NetBSD 3.0, OpenBSD 3.8, AIX 5.1, IRIX 6.5, OSF/1 5.1, Solaris 9, Cygwin, Interix 3.5.
+FreeBSD 5.2.1, NetBSD 3.0, OpenBSD 3.8, AIX 5.1, IRIX 6.5, OSF/1 5.1,
+Solaris 9, Cygwin 1.7.7, Interix 3.5.
@end itemize
@itemize
@item
This function is missing on some platforms:
-MacOS X 10.3, FreeBSD 6.0, NetBSD 3.0, OpenBSD 3.8, AIX 5.1, IRIX 6.5, Solaris 9, Cygwin, Interix 3.5.
+MacOS X 10.3, FreeBSD 6.0, NetBSD 3.0, OpenBSD 3.8, AIX 5.1, IRIX 6.5,
+Solaris 9, Cygwin 1.7.7, Interix 3.5.
@end itemize
@itemize
@item
This function is missing on some platforms:
-MacOS X 10.3, FreeBSD 6.0, NetBSD 3.0, OpenBSD 3.8, AIX 5.1, IRIX 6.5, OSF/1 5.1, Solaris 9, Cygwin, Interix 3.5.
+MacOS X 10.3, FreeBSD 6.0, NetBSD 3.0, OpenBSD 3.8, AIX 5.1, IRIX 6.5,
+OSF/1 5.1, Solaris 9, Cygwin 1.7.7, Interix 3.5.
@end itemize
@itemize
@item
This function is missing on some platforms:
-MacOS X 10.3, FreeBSD 5.2.1, NetBSD 3.0, OpenBSD 3.8, AIX 5.1, IRIX 6.5, OSF/1 5.1, Solaris 9, Cygwin, Interix 3.5.
+MacOS X 10.3, FreeBSD 5.2.1, NetBSD 3.0, OpenBSD 3.8, AIX 5.1, IRIX
+6.5, OSF/1 5.1, Solaris 9, Cygwin 1.7.7, Interix 3.5.
@end itemize
When using @code{UTIME_OMIT} for the modification time, but specifying
an access time, some systems fail to update the change time:
Linux kernel 2.6.32.
+@item
+Passing @code{AT_FDCWD} as the fd argument does not properly fail with
+@code{EBADF} on some systems:
+glibc 2.11, Solaris 11.
@end itemize
Portability problems not fixed by Gnulib:
MacOS X 10.3, FreeBSD 6.0, NetBSD 3.0, OpenBSD 3.8, Cygwin, mingw, BeOS.
@end itemize
-Gnulib provides a module @code{getdate} that contains a function @code{get_date}
+Gnulib provides a module @code{parse-datetime} that contains a function
+@code{parse_datetime}
that has similar functionality as the @code{getdate} function.
@itemize
@item
This function is missing on some platforms:
-OpenBSD 3.8, HP-UX 11, IRIX 6.5, OSF/1 4.0, Solaris 7, Cygwin 1.5.x, mingw, Interix 3.5, BeOS.
+OpenBSD 3.8, HP-UX 11, IRIX 6.5, OSF/1 4.0, Solaris 7, Cygwin 1.5.x,
+mingw, Interix 3.5, BeOS.
+
+@item
+This is available only as a macro, rather than a function, on some
+platforms:
+OpenBSD 4.6, MirBSD 10.
@end itemize
This function is missing on some platforms:
AIX 4.3.2, IRIX 6.5, OSF/1 5.1, Solaris 9, mingw.
@item
+This function is declared but not defined on some platforms:
+IRIX 6.5.30.
+@item
This function returns 0 for all possible arguments on some platforms:
Linux libc5.
@end itemize
AIX 5.1, OSF/1 5.1.
@end itemize
-Extension: Gnulib provides a module @samp{malloc} that substitutes a
+Extension: Gnulib provides a module @samp{malloc-gnu} that substitutes a
@code{malloc} implementation that behaves more like the glibc implementation,
regarding the result of @code{malloc (0)}.
@item
This function dereferences too much memory on some platforms:
-glibc 2.10 on x86_64, IA-64, Alpha.
+glibc 2.10 on x86_64, IA-64; glibc 2.11 on Alpha.
@end itemize
Portability problems not fixed by Gnulib:
The constants @code{ERA}, @code{ERA_D_FMT}, @code{ERA_D_T_FMT},
@code{ERA_T_FMT}, @code{ALT_DIGITS} are not supported on some platforms:
OpenBSD 3.8.
+@item
+The constants @code{T_FMT_AMPM}, @code{YESEXPR}, @code{NOEXPR} are not
+supported on some platforms:
+IRIX 5.3.
@end itemize
Portability problems not fixed by Gnulib:
@item
On Cygwin 1.7.0, only the charset portion of a locale designation is honored.
+
+@item
+On NetBSD 5.0, in some locales, @code{nl_langinfo(CRNCYSTR)} returns the
+empty string, although the local currency symbol, as returned by
+@code{localeconv()->currency_symbol}, is non-empty.
@end itemize
@itemize
@end itemize
-Extension: Gnulib provides a module @samp{realloc} that substitutes a
+Extension: Gnulib provides a module @samp{realloc-gnu} that substitutes a
@code{realloc} implementation that behaves more like the glibc implementation.
@item
This function does not support the error values that are specified by POSIX
but not defined by the system, on some platforms:
-OpenBSD 4.0, OSF/1 5.1, Cygwin 1.5.x, mingw.
+OpenBSD 4.0, OSF/1 5.1, NonStop Kernel, Cygwin 1.5.x, mingw.
@item
This function fails to return a string for out-of-range integers on
some platforms:
This function does not return a string for out-of-range numbers on
some platforms:
Solaris, AIX 5.1.
+
+@item
+This function is declared in @code{unistd.h} instead of
+@code{string.h} on some platforms:
+NetBSD 5.0.
@end itemize
Portability problems not fixed by Gnulib:
@item
This function can trigger memchr bugs on some platforms:
glibc 2.10.
+@item
+This function can trigger false positives for long periodic needles on
+some platforms:
+glibc 2.12, Cygwin 1.7.7.
@end itemize
Portability problems fixed by Gnulib @code{strstr}:
POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/functions/system.html}
-Gnulib module: ---
+Gnulib module: system-posix
Portability problems fixed by Gnulib:
@itemize
+@item
+The macros @code{WIFSIGNALED}, @code{WIFEXITED}, @code{WIFSTOPPED},
+@code{WTERMSIG}, @code{WEXITSTATUS}, @code{WNOHANG}, @code{WUNTRACED},
+@code{WSTOPSIG} are not defined in @code{<stdlib.h>} (only in
+@code{<sys/wait.h>}) on some platforms:
+MirBSD 10.
@end itemize
Portability problems not fixed by Gnulib:
POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/functions/tcgetsid.html}
-Gnulib module: ---
+Gnulib module: tcgetsid
Portability problems fixed by Gnulib:
@itemize
+This function is missing on some platforms:
+MacOS X 10.3, FreeBSD 6.0, OpenBSD 4.5, Cygwin, mingw, Interix 3.5, BeOS.
@end itemize
Portability problems not fixed by Gnulib:
@itemize
@item
-This function is missing on some platforms:
-MacOS X 10.3, FreeBSD 6.0, OpenBSD 3.8, Cygwin, mingw, Interix 3.5, BeOS.
+This function always fails on some platforms:
+FreeBSD 6.0, Cygwin, mingw, Interix 3.5, BeOS.
@end itemize
POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/functions/unsetenv.html}
-Gnulib module: setenv
+Gnulib module: unsetenv
Portability problems fixed by Gnulib:
@itemize
@item
On some platforms, this function does not fail with @samp{EINVAL} when
passed an empty string or a string containing @samp{=}:
-FreeBSD 6.0, NetBSD 1.6, OpenBSD 3.8.
+FreeBSD 6.0, NetBSD 1.6, OpenBSD 4.7.
@item
This function removes only the first value association for the given
environment variable, not all of them, on some platforms:
POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/functions/waitpid.html}
-Gnulib module: ---
+Gnulib module: waitpid
Portability problems fixed by Gnulib:
@itemize
+@item
+This function is missing on some platforms:
+mingw.
@end itemize
Portability problems not fixed by Gnulib:
@itemize
-@item
-This function is missing on some platforms:
-mingw.
@end itemize
@node aio.h
@section @file{aio.h}
-POSIX specification:@* @url{http://www.opengroup.org/susv3xbd/aio.h.html}
+POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/basedefs/aio.h.html}
Gnulib module: ---
@node arpa/inet.h
@section @file{arpa/inet.h}
-POSIX specification:@* @url{http://www.opengroup.org/susv3xbd/arpa/inet.h.html}
+POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/basedefs/arpa_inet.h.html}
Gnulib module: arpa_inet
@node assert.h
@section @file{assert.h}
-POSIX specification:@* @url{http://www.opengroup.org/susv3xbd/assert.h.html}
+POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/basedefs/assert.h.html}
Gnulib module: ---
@node complex.h
@section @file{complex.h}
-POSIX specification:@* @url{http://www.opengroup.org/susv3xbd/complex.h.html}
+POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/basedefs/complex.h.html}
Gnulib module: ---
@itemize
@item
This header file is missing on some platforms:
-NetBSD 3.0, OpenBSD 3.8, AIX 5.1, HP-UX 11, IRIX 6.5, OSF/1 5.1, Cygwin, mingw,
-Interix 3.5, BeOS.
+NetBSD 3.0, OpenBSD 3.8, AIX 5.1, HP-UX 11, IRIX 6.5, OSF/1 5.1,
+Cygwin 1.7.7, mingw, Interix 3.5, BeOS.
@end itemize
@node cpio.h
@section @file{cpio.h}
-POSIX specification:@* @url{http://www.opengroup.org/susv3xbd/cpio.h.html}
+POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/basedefs/cpio.h.html}
Gnulib module: ---
@node ctype.h
@section @file{ctype.h}
-POSIX specification:@* @url{http://www.opengroup.org/susv3xbd/ctype.h.html}
+POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/basedefs/ctype.h.html}
Gnulib module: ctype
@node dirent.h
@section @file{dirent.h}
-POSIX specification:@* @url{http://www.opengroup.org/susv3xbd/dirent.h.html}
+POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/basedefs/dirent.h.html}
Gnulib module: dirent
@node dlfcn.h
@section @file{dlfcn.h}
-POSIX specification:@* @url{http://www.opengroup.org/susv3xbd/dlfcn.h.html}
+POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/basedefs/dlfcn.h.html}
Gnulib module: ---
@node errno.h
@section @file{errno.h}
-POSIX specification:@* @url{http://www.opengroup.org/susv3xbd/errno.h.html}
+POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/basedefs/errno.h.html}
Gnulib module: errno
The macro @code{ESTALE} is not defined on some platforms:
mingw, Interix 3.5.
@item
+The macro @code{EDQUOT} is not defined on some platforms:
+NonStop Kernel, mingw.
+@item
The macros @code{EWOULDBLOCK}, @code{ETXTBSY}, @code{ELOOP}, @code{ENOTSOCK},
@code{EDESTADDRREQ}, @code{EMSGSIZE}, @code{EPROTOTYPE}, @code{ENOPROTOOPT},
@code{EPROTONOSUPPORT}, @code{EOPNOTSUPP}, @code{EAFNOSUPPORT},
@code{EADDRINUSE}, @code{EADDRNOTAVAIL}, @code{ENETDOWN}, @code{ENETUNREACH},
@code{ENETRESET}, @code{ECONNABORTED}, @code{ECONNRESET}, @code{ENOBUFS},
@code{EISCONN}, @code{ENOTCONN}, @code{ETIMEDOUT}, @code{ECONNREFUSED},
-@code{EHOSTUNREACH}, @code{EALREADY}, @code{EINPROGRESS}, @code{EDQUOT} are
-not defined on some platforms:
+@code{EHOSTUNREACH}, @code{EALREADY}, @code{EINPROGRESS} are not defined on
+some platforms:
mingw.
@end itemize
@node fcntl.h
@section @file{fcntl.h}
-POSIX specification:@* @url{http://www.opengroup.org/susv3xbd/fcntl.h.html}
+POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/basedefs/fcntl.h.html}
Gnulib module: fcntl-h
Portability problems fixed by Gnulib:
@itemize
@item
-@samp{O_NOCTTY}, @samp{O_DSYNC}, @samp{O_NONBLOCK}, @samp{O_RSYNC},
-@samp{O_SYNC}, @samp{O_DIRECTORY}, @samp{O_NOFOLLOW}, and
-@samp{O_TTY_INIT} are not defined on some platforms.
+@samp{O_CLOEXEC}, @samp{O_DIRECTORY}, @samp{O_DSYNC}, @samp{O_NOCTTY},
+@samp{O_NOFOLLOW}, @samp{O_NONBLOCK}, @samp{O_RSYNC}, @samp{O_SYNC},
+and @samp{O_TTY_INIT} are not defined on some platforms. Gnulib defines
+these macros to 0.
+
+@item
+@samp{O_EXEC} and @samp{O_SEARCH} are not defined on some platforms.
+Gnulib defines these macros to @samp{O_RDONLY}, which is typically 0.
@item
@samp{O_BINARY}, @samp{O_TEXT} (not specified by POSIX, but essential for
Portability problems not fixed by Gnulib:
@itemize
@item
-@samp{O_CLOEXEC} is not defined on some platforms. The gnulib
-replacement is not atomic on these platforms.
-
-@item
-@samp{O_SEARCH} and @samp{O_EXEC} are not defined
-on some platforms.
-
-@item
@samp{F_SETFD}, @samp{F_GETFL}, @samp{F_SETFL}, @samp{F_GETLK},
@samp{F_SETLK}, @samp{F_SETLOKW}, @samp{F_GETOWN}, and @samp{F_SETOWN}
are not defined on some platforms:
@node fenv.h
@section @file{fenv.h}
-POSIX specification:@* @url{http://www.opengroup.org/susv3xbd/fenv.h.html}
+POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/basedefs/fenv.h.html}
Gnulib module: ---
@itemize
@item
This header file is missing on some platforms:
-FreeBSD 5.2.1, NetBSD 3.0, OpenBSD 3.8, AIX 5.1, IRIX 6.5, OSF/1 5.1, Cygwin,
-Interix 3.5, BeOS.
+FreeBSD 5.2.1, NetBSD 3.0, OpenBSD 3.8, AIX 5.1, IRIX 6.5, OSF/1 5.1,
+Cygwin 1.7.7, Interix 3.5, BeOS.
@end itemize
@node float.h
@section @file{float.h}
-POSIX specification:@* @url{http://www.opengroup.org/susv3xbd/float.h.html}
+POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/basedefs/float.h.html}
Gnulib module: float
@itemize
@item
The values of @code{LDBL_*} macros are incorrect on some platforms:
-On OpenBSD 4.0 and BeOS, they are the same as the values of the
+On OpenBSD 4.0, MirBSD 10, and BeOS, they are the same as the values of the
@code{DBL_*} macros, although @samp{long double} is a larger type than
@samp{double}.
@end itemize
@node fmtmsg.h
@section @file{fmtmsg.h}
-POSIX specification:@* @url{http://www.opengroup.org/susv3xbd/fmtmsg.h.html}
+POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/basedefs/fmtmsg.h.html}
Gnulib module: ---
@node fnmatch.h
@section @file{fnmatch.h}
-POSIX specification:@* @url{http://www.opengroup.org/susv3xbd/fnmatch.h.html}
+POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/basedefs/fnmatch.h.html}
Gnulib module: fnmatch-posix or fnmatch-gnu
@node ftw.h
@section @file{ftw.h}
-POSIX specification:@* @url{http://www.opengroup.org/susv3xbd/ftw.h.html}
+POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/basedefs/ftw.h.html}
Gnulib module: ---
@node glob.h
@section @file{glob.h}
-POSIX specification:@* @url{http://www.opengroup.org/susv3xbd/glob.h.html}
+POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/basedefs/glob.h.html}
Gnulib module: glob
@node grp.h
@section @file{grp.h}
-POSIX specification:@* @url{http://www.opengroup.org/susv3xbd/grp.h.html}
+POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/basedefs/grp.h.html}
Gnulib module: ---
@node iconv.h
@section @file{iconv.h}
-POSIX specification:@* @url{http://www.opengroup.org/susv3xbd/iconv.h.html}
+POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/basedefs/iconv.h.html}
Gnulib module: iconv
@node inttypes.h
@section @file{inttypes.h}
-POSIX specification:@* @url{http://www.opengroup.org/susv3xbd/inttypes.h.html}
+POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/basedefs/inttypes.h.html}
Gnulib module: inttypes
@node iso646.h
@section @file{iso646.h}
-POSIX specification:@* @url{http://www.opengroup.org/susv3xbd/iso646.h.html}
+POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/basedefs/iso646.h.html}
Gnulib module: ---
@node langinfo.h
@section @file{langinfo.h}
-POSIX specification:@* @url{http://www.opengroup.org/susv3xbd/langinfo.h.html}
+POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/basedefs/langinfo.h.html}
Gnulib module: langinfo
The constants @code{ERA}, @code{ERA_D_FMT}, @code{ERA_D_T_FMT},
@code{ERA_T_FMT}, @code{ALT_DIGITS} are not defined on some platforms:
OpenBSD 3.8.
+@item
+The constants @code{T_FMT_AMPM}, @code{YESEXPR}, @code{NOEXPR} are not
+defined on some platforms:
+IRIX 5.3.
@end itemize
Portability problems not fixed by Gnulib:
@node libgen.h
@section @file{libgen.h}
-POSIX specification:@* @url{http://www.opengroup.org/susv3xbd/libgen.h.html}
+POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/basedefs/libgen.h.html}
Gnulib module: ---
@node limits.h
@section @file{limits.h}
-POSIX specification:@* @url{http://www.opengroup.org/susv3xbd/limits.h.html}
+POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/basedefs/limits.h.html}
Gnulib module: gethostname
@node locale.h
@section @file{locale.h}
-POSIX specification:@* @url{http://www.opengroup.org/susv3xbd/locale.h.html}
+POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/basedefs/locale.h.html}
Gnulib module: locale
@node math.h
@section @file{math.h}
-POSIX specification:@* @url{http://www.opengroup.org/susv3xbd/math.h.html}
+POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/basedefs/math.h.html}
Gnulib module: math
@node monetary.h
@section @file{monetary.h}
-POSIX specification:@* @url{http://www.opengroup.org/susv3xbd/monetary.h.html}
+POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/basedefs/monetary.h.html}
Gnulib module: ---
@node mqueue.h
@section @file{mqueue.h}
-POSIX specification:@* @url{http://www.opengroup.org/susv3xbd/mqueue.h.html}
+POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/basedefs/mqueue.h.html}
Gnulib module: ---
@node ndbm.h
@section @file{ndbm.h}
-POSIX specification:@* @url{http://www.opengroup.org/susv3xbd/ndbm.h.html}
+POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/basedefs/ndbm.h.html}
Gnulib module: ---
@node net/if.h
@section @file{net/if.h}
-POSIX specification:@* @url{http://www.opengroup.org/susv3xbd/net/if.h.html}
+POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/basedefs/net_if.h.html}
Gnulib module: ---
@node netdb.h
@section @file{netdb.h}
-POSIX specification:@* @url{http://www.opengroup.org/susv3xbd/netdb.h.html}
+POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/basedefs/netdb.h.html}
Gnulib module: netdb
@node netinet/in.h
@section @file{netinet/in.h}
-POSIX specification:@* @url{http://www.opengroup.org/susv3xbd/netinet/in.h.html}
+POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/basedefs/netinet_in.h.html}
Gnulib module: netinet_in
This header file is missing on some platforms:
mingw, BeOS.
@item
-This header file is not self-contained on some platforms: it requires
-@code{<sys/types.h>} to be included first.
+This header file is not self-contained on some platforms (it requires
+@code{<sys/types.h>} to be included first):
+OpenBSD 4.6.
@end itemize
Portability problems not fixed by Gnulib:
@node netinet/tcp.h
@section @file{netinet/tcp.h}
-POSIX specification:@* @url{http://www.opengroup.org/susv3xbd/netinet/tcp.h.html}
+POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/basedefs/netinet_tcp.h.html}
Gnulib module: ---
@node nl_types.h
@section @file{nl_types.h}
-POSIX specification:@* @url{http://www.opengroup.org/susv3xbd/nl/types.h.html}
+POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/basedefs/nl_types.h.html}
Gnulib module: ---
@node poll.h
@section @file{poll.h}
-POSIX specification:@* @url{http://www.opengroup.org/susv3xbd/poll.h.html}
+POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/basedefs/poll.h.html}
-Gnulib module: poll
+Gnulib module: poll-h
Portability problems fixed by Gnulib:
@itemize
@node pthread.h
@section @file{pthread.h}
-POSIX specification:@* @url{http://www.opengroup.org/susv3xbd/pthread.h.html}
+POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/basedefs/pthread.h.html}
Gnulib module: ---
@node pwd.h
@section @file{pwd.h}
-POSIX specification:@* @url{http://www.opengroup.org/susv3xbd/pwd.h.html}
+POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/basedefs/pwd.h.html}
Gnulib module: ---
@node regex.h
@section @file{regex.h}
-POSIX specification:@* @url{http://www.opengroup.org/susv3xbd/regex.h.html}
+POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/basedefs/regex.h.html}
Gnulib module: regex
@node sched.h
@section @file{sched.h}
-POSIX specification:@* @url{http://www.opengroup.org/susv3xbd/sched.h.html}
+POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/basedefs/sched.h.html}
Gnulib module: sched
@node search.h
@section @file{search.h}
-POSIX specification:@* @url{http://www.opengroup.org/susv3xbd/search.h.html}
+POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/basedefs/search.h.html}
Gnulib module: search
@node semaphore.h
@section @file{semaphore.h}
-POSIX specification:@* @url{http://www.opengroup.org/susv3xbd/semaphore.h.html}
+POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/basedefs/semaphore.h.html}
Gnulib module: ---
@node setjmp.h
@section @file{setjmp.h}
-POSIX specification:@* @url{http://www.opengroup.org/susv3xbd/setjmp.h.html}
+POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/basedefs/setjmp.h.html}
Gnulib module: ---
@node signal.h
@section @file{signal.h}
-POSIX specification:@* @url{http://www.opengroup.org/susv3xbd/signal.h.html}
+POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/basedefs/signal.h.html}
Gnulib module: signal
@node spawn.h
@section @file{spawn.h}
-POSIX specification:@* @url{http://www.opengroup.org/susv3xbd/spawn.h.html}
+POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/basedefs/spawn.h.html}
Gnulib module: spawn
@node stdarg.h
@section @file{stdarg.h}
-POSIX specification:@* @url{http://www.opengroup.org/susv3xbd/stdarg.h.html}
+POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/basedefs/stdarg.h.html}
Gnulib module: stdarg
@node stdbool.h
@section @file{stdbool.h}
-POSIX specification:@* @url{http://www.opengroup.org/susv3xbd/stdbool.h.html}
+POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/basedefs/stdbool.h.html}
Gnulib module: stdbool
@node stddef.h
@section @file{stddef.h}
-POSIX specification:@* @url{http://www.opengroup.org/susv3xbd/stddef.h.html}
+POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/basedefs/stddef.h.html}
Gnulib module: stddef
@node stdint.h
@section @file{stdint.h}
-POSIX specification:@* @url{http://www.opengroup.org/susv3xbd/stdint.h.html}
+POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/basedefs/stdint.h.html}
Gnulib module: stdint
@node stdio.h
@section @file{stdio.h}
-POSIX specification:@* @url{http://www.opengroup.org/susv3xbd/stdio.h.html}
+POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/basedefs/stdio.h.html}
Gnulib module: stdio
@node stdlib.h
@section @file{stdlib.h}
-POSIX specification:@* @url{http://www.opengroup.org/susv3xbd/stdlib.h.html}
+POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/basedefs/stdlib.h.html}
-Gnulib module: stdlib
+Gnulib module: stdlib, system-posix
-Portability problems fixed by Gnulib:
+Portability problems fixed by the Gnulib module @code{stdlib}:
@itemize
@item
The macros @code{EXIT_SUCCESS} and @code{EXIT_FAILURE} are not defined on
NetBSD 5.0
@end itemize
+Portability problems fixed by the Gnulib module @code{system-posix}:
+@itemize
+@item
+The macros @code{WIFSIGNALED}, @code{WIFEXITED}, @code{WIFSTOPPED},
+@code{WTERMSIG}, @code{WEXITSTATUS}, @code{WNOHANG}, @code{WUNTRACED},
+@code{WSTOPSIG} are not defined in this header file (only in
+@code{<sys/wait.h>}) on some platforms:
+MirBSD 10.
+@end itemize
+
Portability problems not fixed by Gnulib:
@itemize
+@item
+System status macros such as @code{WEXITSTATUS} require an lvalue
+argument on some platforms.
+MacOS X 10.5.
@end itemize
@node string.h
@section @file{string.h}
-POSIX specification:@* @url{http://www.opengroup.org/susv3xbd/string.h.html}
+POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/basedefs/string.h.html}
Gnulib module: string
@node strings.h
@section @file{strings.h}
-POSIX specification:@* @url{http://www.opengroup.org/susv3xbd/strings.h.html}
+POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/basedefs/strings.h.html}
Gnulib module: ---
@node stropts.h
@section @file{stropts.h}
-POSIX specification:@* @url{http://www.opengroup.org/susv3xbd/stropts.h.html}
+POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/basedefs/stropts.h.html}
Gnulib module: ---
@node sys/ipc.h
@section @file{sys/ipc.h}
-POSIX specification:@* @url{http://www.opengroup.org/susv3xbd/sys/ipc.h.html}
+POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/basedefs/sys_ipc.h.html}
Gnulib module: ---
@node sys/mman.h
@section @file{sys/mman.h}
-POSIX specification:@* @url{http://www.opengroup.org/susv3xbd/sys/mman.h.html}
+POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/basedefs/sys_mman.h.html}
Gnulib module: ---
@node sys/msg.h
@section @file{sys/msg.h}
-POSIX specification:@* @url{http://www.opengroup.org/susv3xbd/sys/msg.h.html}
+POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/basedefs/sys_msg.h.html}
Gnulib module: ---
@node sys/resource.h
@section @file{sys/resource.h}
-POSIX specification:@* @url{http://www.opengroup.org/susv3xbd/sys/resource.h.html}
+POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/basedefs/sys_resource.h.html}
Gnulib module: ---
@node sys/select.h
@section @file{sys/select.h}
-POSIX specification:@* @url{http://www.opengroup.org/susv3xbd/sys/select.h.html}
+POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/basedefs/sys_select.h.html}
Gnulib module: sys_select
@node sys/sem.h
@section @file{sys/sem.h}
-POSIX specification:@* @url{http://www.opengroup.org/susv3xbd/sys/sem.h.html}
+POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/basedefs/sys_sem.h.html}
Gnulib module: ---
@node sys/shm.h
@section @file{sys/shm.h}
-POSIX specification:@* @url{http://www.opengroup.org/susv3xbd/sys/shm.h.html}
+POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/basedefs/sys_shm.h.html}
Gnulib module: ---
@node sys/socket.h
@section @file{sys/socket.h}
-POSIX specification:@* @url{http://www.opengroup.org/susv3xbd/sys/socket.h.html}
+POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/basedefs/sys_socket.h.html}
Gnulib module: sys_socket
@node sys/stat.h
@section @file{sys/stat.h}
-POSIX specification:@* @url{http://www.opengroup.org/susv3xbd/sys/stat.h.html}
+POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/basedefs/sys_stat.h.html}
Gnulib module: sys_stat
@node sys/statvfs.h
@section @file{sys/statvfs.h}
-POSIX specification:@* @url{http://www.opengroup.org/susv3xbd/sys/statvfs.h.html}
+POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/basedefs/sys_statvfs.h.html}
Gnulib module: ---
@node sys/time.h
@section @file{sys/time.h}
-POSIX specification:@* @url{http://www.opengroup.org/susv3xbd/sys/time.h.html}
+POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/basedefs/sys_time.h.html}
Gnulib module: sys_time
@node sys/times.h
@section @file{sys/times.h}
-POSIX specification:@* @url{http://www.opengroup.org/susv3xbd/sys/times.h.html}
+POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/basedefs/sys_times.h.html}
Gnulib module: sys_times
@node sys/types.h
@section @file{sys/types.h}
-POSIX specification:@* @url{http://www.opengroup.org/susv3xbd/sys/types.h.html}
+POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/basedefs/sys_types.h.html}
Gnulib module: ---
@node sys/uio.h
@section @file{sys/uio.h}
-POSIX specification:@* @url{http://www.opengroup.org/susv3xbd/sys/uio.h.html}
+POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/basedefs/sys_uio.h.html}
Gnulib module: ---
@node sys/un.h
@section @file{sys/un.h}
-POSIX specification:@* @url{http://www.opengroup.org/susv3xbd/sys/un.h.html}
+POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/basedefs/sys_un.h.html}
Gnulib module: ---
@node sys/utsname.h
@section @file{sys/utsname.h}
-POSIX specification:@* @url{http://www.opengroup.org/susv3xbd/sys/utsname.h.html}
+POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/basedefs/sys_utsname.h.html}
Gnulib module: sys_utsname
@node sys/wait.h
@section @file{sys/wait.h}
-POSIX specification:@* @url{http://www.opengroup.org/susv3xbd/sys/wait.h.html}
+POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/basedefs/sys_wait.h.html}
Gnulib module: sys_wait
Portability problems not fixed by Gnulib:
@itemize
+@item
+System status macros such as @code{WEXITSTATUS} require an lvalue
+argument on some platforms.
+MacOS X 10.5.
@end itemize
@node syslog.h
@section @file{syslog.h}
-POSIX specification:@* @url{http://www.opengroup.org/susv3xbd/syslog.h.html}
+POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/basedefs/syslog.h.html}
Gnulib module: ---
@node tar.h
@section @file{tar.h}
-POSIX specification:@* @url{http://www.opengroup.org/susv3xbd/tar.h.html}
+POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/basedefs/tar.h.html}
Gnulib module: ---
@node termios.h
@section @file{termios.h}
-POSIX specification:@* @url{http://www.opengroup.org/susv3xbd/termios.h.html}
+POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/basedefs/termios.h.html}
-Gnulib module: ---
+Gnulib module: termios
Portability problems fixed by Gnulib:
@itemize
+@item
+This header file is missing on some platforms:
+mingw.
@end itemize
Portability problems not fixed by Gnulib:
@itemize
@item
-This header file is missing on some platforms:
+The types @code{struct termios}, @code{cc_t}, @code{speed_t}, @code{tcflag_t}
+are not defined on some platforms:
mingw.
@end itemize
@node tgmath.h
@section @file{tgmath.h}
-POSIX specification:@* @url{http://www.opengroup.org/susv3xbd/tgmath.h.html}
+POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/basedefs/tgmath.h.html}
Gnulib module: ---
@node time.h
@section @file{time.h}
-POSIX specification:@* @url{http://www.opengroup.org/susv3xbd/time.h.html}
+POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/basedefs/time.h.html}
Gnulib module: time
@node trace.h
@section @file{trace.h}
-POSIX specification:@* @url{http://www.opengroup.org/susv3xbd/trace.h.html}
+POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/basedefs/trace.h.html}
Gnulib module: ---
@node ulimit.h
@section @file{ulimit.h}
-POSIX specification:@* @url{http://www.opengroup.org/susv3xbd/ulimit.h.html}
+POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/basedefs/ulimit.h.html}
Gnulib module: ---
@node unistd.h
@section @file{unistd.h}
-POSIX specification:@* @url{http://www.opengroup.org/susv3xbd/unistd.h.html}
+POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/basedefs/unistd.h.html}
Gnulib module: unistd
@node utime.h
@section @file{utime.h}
-POSIX specification:@* @url{http://www.opengroup.org/susv3xbd/utime.h.html}
+POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/basedefs/utime.h.html}
Gnulib module: ---
@node utmpx.h
@section @file{utmpx.h}
-POSIX specification:@* @url{http://www.opengroup.org/susv3xbd/utmpx.h.html}
+POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/basedefs/utmpx.h.html}
Gnulib module: ---
@node wchar.h
@section @file{wchar.h}
-POSIX specification:@* @url{http://www.opengroup.org/susv3xbd/wchar.h.html}
+POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/basedefs/wchar.h.html}
Gnulib module: wchar
@node wctype.h
@section @file{wctype.h}
-POSIX specification:@* @url{http://www.opengroup.org/susv3xbd/wctype.h.html}
+POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/basedefs/wctype.h.html}
Gnulib module: wctype
The functions @code{isw*} are missing on some platforms:
FreeBSD 4.11.
@item
+The function @code{iswblank} is declared but not defined on some platforms:
+IRIX 6.5.30.
+@item
The functions @code{isw*} are actually defined as macros that don't work,
on IRIX 5.3.
@end itemize
@node wordexp.h
@section @file{wordexp.h}
-POSIX specification:@* @url{http://www.opengroup.org/susv3xbd/wordexp.h.html}
+POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/basedefs/wordexp.h.html}
Gnulib module: ---
The Regex library is used by including @file{regex.h}.
@pindex regex.h
Regex provides three groups of functions with which you can operate on
-regular expressions. One group---the @sc{gnu} group---is more powerful
-but not completely compatible with the other two, namely the @sc{posix}
-and Berkeley @sc{unix} groups; its interface was designed specifically
-for @sc{gnu}. The other groups have the same interfaces as do the
-regular expression functions in @sc{posix} and Berkeley
-@sc{unix}.
+regular expressions. One group---the @sc{gnu} group---is more
+powerful but not completely compatible with the other two, namely the
+@sc{posix} and Berkeley @sc{unix} groups; its interface was designed
+specifically for @sc{gnu}.
We wrote this chapter with programmers in mind, not users of
programs---such as Emacs---that use Regex. We describe the Regex
In any particular syntax for regular expressions, some characters are
always special, others are sometimes special, and others are never
special. The particular syntax that Regex recognizes for a given
-regular expression depends on the value in the @code{syntax} field of
-the pattern buffer of that regular expression.
+regular expression depends on the current syntax (as set by
+@code{re_set_syntax}) when the pattern buffer of that regular expression
+was compiled.
You get a pattern buffer by compiling a regular expression. @xref{GNU
-Pattern Buffers}, and @ref{POSIX Pattern Buffers}, for more information
-on pattern buffers. @xref{GNU Regular Expression Compiling}, @ref{POSIX
+Pattern Buffers}, for more information on pattern buffers. @xref{GNU
Regular Expression Compiling}, and @ref{BSD Regular Expression
Compiling}, for more information on compiling.
-Regex considers the value of the @code{syntax} field to be a collection
-of bits; we refer to these bits as @dfn{syntax bits}. In most cases,
-they affect what characters represent what operators. We describe the
-meanings of the operators to which we refer in @ref{Common Operators},
-@ref{GNU Operators}, and @ref{GNU Emacs Operators}.
+Regex considers the current syntax to be a collection of bits; we refer
+to these bits as @dfn{syntax bits}. In most cases, they affect what
+characters represent what operators. We describe the meanings of the
+operators to which we refer in @ref{Common Operators}, @ref{GNU
+Operators}, and @ref{GNU Emacs Operators}.
For reference, here is the complete list of syntax bits, in alphabetical
order:
it is the beginning of a valid interval and the syntax bit
@code{RE_INTERVALS} is set.
+@cnindex RE_CONTEXT_INVALID_DUP
+@item RE_CONTEXT_INVALID_DUP
+If this bit is set, then an open-interval operator cannot occur at the
+start of a regular expression, or immediately after an alternation,
+open-group or close-interval operator.
+
@cnindex RE_CONTEXT_INVALID_OPS
@item RE_CONTEXT_INVALID_OPS
If this bit is set, then repetition and alternation operators can't be
Whether or not they will in fact be operators in certain positions
depends on other syntax bits.
+@cnindex RE_DEBUG
+@item RE_DEBUG
+If this bit is set, and the regex library was compiled with
+@code{-DDEBUG}, then internal debugging is turned on; if unset, then
+it is turned off.
+
@cnindex RE_DOT_NEWLINE
@item RE_DOT_NEWLINE
If this bit is set, then the match-any-character operator matches
If this bit is set, then the match-any-character operator doesn't match
a null character; if this bit isn't set, then it does.
+@cnindex RE_HAT_LISTS_NOT_NEWLINE
+@item RE_HAT_LISTS_NOT_NEWLINE
+If this bit is set, nonmatching lists @samp{[^...]} do not match
+newline; if not set, they do.
+
+@cnindex RE_ICASE
+@item RE_ICASE
+If this bit is set, then ignore case when matching; otherwise, case is
+significant.
+
@cnindex RE_INTERVALS
@item RE_INTERVALS
If this bit is set, then Regex recognizes interval operators; if this bit
isn't set, then it doesn't.
+@cnindex RE_INVALID_INTERVAL_ORD
+@item RE_INVALID_INTERVAL_ORD
+If this bit is set, a syntactically invalid interval is treated as a
+string of ordinary characters. For example, the extended regular
+expression @samp{a@{1} is treated as @samp{a\@{1}.
+
@cnindex RE_LIMITED_OPS
@item RE_LIMITED_OPS
If this bit is set, then Regex doesn't recognize the match-one-or-more,
point collates lower than its starting point is invalid; if this bit
isn't set, then Regex considers such a range to be empty.
+@cnindex RE_NO_GNU_OPS
+@item RE_NO_GNU_OPS
+If this bit is set, GNU regex operators are not recognized; otherwise,
+they are.
+
+@cnindex RE_NO_POSIX_BACKTRACKING
+@item RE_NO_POSIX_BACKTRACKING
+If this bit is set, succeed as soon as we match the whole pattern,
+without further backtracking. This means that a match may not be
+the leftmost longest; @pxref{What Gets Matched?} for what this means.
+
+@cnindex RE_NO_SUB
+@item RE_NO_SUB
+If this bit is set, then @code{no_sub} will be set to one during
+@code{re_compile_pattern}. This causes matching and searching routines
+not to record substring match information.
+
@cnindex RE_UNMATCHED_RIGHT_PAREN_ORD
@item RE_UNMATCHED_RIGHT_PAREN_ORD
If this bit is set and the regular expression has no matching open-group
@section Predefined Syntaxes
If you're programming with Regex, you can set a pattern buffer's
-(@pxref{GNU Pattern Buffers}, and @ref{POSIX Pattern Buffers})
-@code{syntax} field either to an arbitrary combination of syntax bits
+(@pxref{GNU Pattern Buffers})
+syntax either to an arbitrary combination of syntax bits
(@pxref{Syntax Bits}) or else to the configurations defined by Regex.
These configurations define the syntaxes used by certain
programs---@sc{gnu} Emacs,
@samp{foo|bar|quux} would match any of @samp{foo}, @samp{bar} or
@samp{quux}.
-@ignore
-@c Nobody needs to disallow empty alternatives any more.
-If the syntax bit @code{RE_NO_EMPTY_ALTS} is set, then if either of the regular
-expressions @var{a} or @var{b} is empty, the
-regular expression is invalid. More precisely, if this syntax bit is
-set, then the alternation operator can't:
-
-@itemize @bullet
-@item
-be first or last in a regular expression;
-
-@item
-follow either another alternation operator or an open-group operator
-(@pxref{Grouping Operators}); or
-
-@item
-precede a close-group operator.
-
-@end itemize
-
-@noindent
-For example, supposing @samp{(} and @samp{)} represent the open and
-close-group operators, then @samp{|foo}, @samp{foo|}, @samp{foo||bar},
-@samp{foo(|bar)}, and @samp{(foo|)bar} would all be invalid.
-@end ignore
-
The alternation operator operates on the @emph{largest} possible
surrounding regular expressions. (Put another way, it has the lowest
precedence of any regular expression operator.)
take, say, the first (``depth-first'') combination it could match, since
then it would be content to match just @samp{fooqbar}.
-@comment xx something about leftmost-longest
+Note that since the default behavior is to return the leftmost longest
+match, when more than one of a series of alternatives matches the actual
+match will be the longest matching alternative, not necessarily the
+first in the list.
@node List Operators
@dfn{Lists}, also called @dfn{bracket expressions}, are a set of one or
more items. An @dfn{item} is a character,
-@ignore
-(These get added when they get implemented.)
a collating symbol, an equivalence class expression,
-@end ignore
a character class expression, or a range expression. The syntax bits
affect which kinds of items you can put in a list. We explain the last
-two items in subsections below. Empty lists are invalid.
+four items in subsections below. Empty lists are invalid.
A @dfn{matching list} matches a single character represented by one of
the list items. You form a matching list by enclosing one or more items
For example, @samp{[^ab]} matches any character except @samp{a} or
@samp{b}.
-If the @code{posix_newline} field in the pattern buffer (@pxref{GNU
-Pattern Buffers} is set, then nonmatching lists do not match a newline.
+If the syntax bit @code{RE_HAT_LISTS_NOT_NEWLINE} is set, then
+nonmatching lists do not match a newline.
Most characters lose any special meaning inside a list. The special
characters inside a list follow.
quotes the next character if the syntax bit @code{RE_BACKSLASH_ESCAPE_IN_LISTS} is
set.
-@ignore
-Put these in if they get implemented.
-
@item [.
represents the open-collating-symbol operator (@pxref{Collating Symbol
Operators}).
@item =]
represents the close-equivalence-class operator.
-@end ignore
-
@item [:
represents the open-character-class operator (@pxref{Character Class
Operators}) if the syntax bit @code{RE_CHAR_CLASSES} is set and what
@samp{.} and @samp{*}.
@menu
+* Collating Symbol Operators:: [.elem.]
+* Equivalence Class Operators:: [=class=]
* Character Class Operators:: [:class:]
* Range Operator:: start-end
@end menu
-@ignore
-(If collating symbols and equivalence class expressions get implemented,
-then add this.)
-node Collating Symbol Operators
-subsubsection Collating Symbol Operators (@code{[.} @dots{} @code{.]})
+@node Collating Symbol Operators
+@subsection Collating Symbol Operators (@code{[.} @dots{} @code{.]})
-If the syntax bit @code{XX} is set, then you can represent
-collating symbols inside lists. You form a @dfn{collating symbol} by
+Collating symbols can be represented inside lists.
+You form a @dfn{collating symbol} by
putting a collating element between an @dfn{open-collating-symbol
operator} and an @dfn{close-collating-symbol operator}. @samp{[.}
represents the open-collating-symbol operator and @samp{.]} represents
the close-collating-symbol operator. For example, if @samp{ll} is a
collating element, then @samp{[[.ll.]]} would match @samp{ll}.
-node Equivalence Class Operators
-subsubsection Equivalence Class Operators (@code{[=} @dots{} @code{=]})
+@node Equivalence Class Operators
+@subsection Equivalence Class Operators (@code{[=} @dots{} @code{=]})
@cindex equivalence class expression in regex
@cindex @samp{[=} in regex
@cindex @samp{=]} in regex
-If the syntax bit @code{XX} is set, then Regex recognizes equivalence class
+Regex recognizes equivalence class
expressions inside lists. A @dfn{equivalence class expression} is a set
of collating elements which all belong to the same equivalence class.
You form an equivalence class expression by putting a collating
the matcher considers the equivalence class expression to be a collating
symbol.
-@end ignore
-
@node Character Class Operators
@subsection Character Class Operators (@code{[:} @dots{} @code{:]})
@cindex @samp{[:} in regex
@cindex @samp{:]} in regex
-If the syntax bit @code{RE_CHARACTER_CLASSES} is set, then Regex
-recognizes character class expressions inside lists. A @dfn{character
-class expression} matches one character from a given class. You form a
-character class expression by putting a character class name between an
-@dfn{open-character-class operator} (represented by @samp{[:}) and a
-@dfn{close-character-class operator} (represented by @samp{:]}). The
-character class names and their meanings are:
+If the syntax bit @code{RE_CHAR_CLASSES} is set, then Regex recognizes
+character class expressions inside lists. A @dfn{character class
+expression} matches one character from a given class. You form a
+character class expression by putting a character class name between
+an @dfn{open-character-class operator} (represented by @samp{[:}) and
+a @dfn{close-character-class operator} (represented by @samp{:]}).
+The character class names and their meanings are:
@table @code
those characters
that fall between two elements in the current collating sequence. You
form a range expression by putting a @dfn{range operator} between two
-@ignore
-(If these get implemented, then substitute this for ``characters.'')
of any of the following: characters, collating elements, collating symbols,
and equivalence class expressions. The starting point of the range and
the ending point of the range don't have to be the same kind of item,
e.g., the starting point could be a collating element and the ending
point could be an equivalence class expression. If a range's ending
point is an equivalence class, then all the collating elements in that
-class will be in the range.
-@end ignore
-characters.@footnote{You can't use a character class for the starting
+class will be in the range.@footnote{You can't use a character class for the starting
or ending point of a range, since a character class is not a single
character.} @samp{-} represents the range operator. For example,
@samp{a-f} within a list represents all the characters from @samp{a}
@vindex not_bol @r{field in pattern buffer}
If the @code{not_bol} field is set in the pattern buffer (@pxref{GNU
Pattern Buffers}), then @samp{^} fails to match at the beginning of the
-string. @xref{POSIX Matching}, for when you might find this useful.
-
-@vindex newline_anchor @r{field in pattern buffer}
-If the @code{newline_anchor} field is set in the pattern buffer, then
-@samp{^} fails to match after a newline. This is useful when you do not
-regard the string to be matched as broken into lines.
+string. This lets you match against pieces of a line, as you would need to if,
+say, searching for repeated instances of a given pattern in a line; it
+would work correctly for patterns both with and without
+match-beginning-of-line operators.
@node Match-end-of-line Operator
Here we describe how you use the Regex data structures and functions in
C programs. Regex has three interfaces: one designed for @sc{gnu}, one
-compatible with @sc{posix} and one compatible with Berkeley @sc{unix}.
+compatible with @sc{posix} (as specified by @sc{posix}, draft
+1003.2/D11.2), and one compatible with Berkeley @sc{unix}. The
+@sc{posix} interface is not documented here; see the documentation of
+GNU libc, or the POSIX man pages. The Berkeley @sc{unix} interface is
+documented here for convenience, since its documentation is not
+otherwise readily available on GNU systems.
@menu
* GNU Regex Functions::
-* POSIX Regex Functions::
* BSD Regex Functions::
@end menu
You can have several different pattern buffers simultaneously, each
holding a compiled pattern for a different regular expression.
-@file{regex.h} defines the pattern buffer @code{struct} as follows:
+@file{regex.h} defines the pattern buffer @code{struct} with the
+following public fields:
@example
- /* Space that holds the compiled pattern. It is declared as
- `unsigned char *' because its elements are
- sometimes used as array indexes. */
unsigned char *buffer;
-
- /* Number of bytes to which `buffer' points. */
unsigned long allocated;
-
- /* Number of bytes actually used in `buffer'. */
- unsigned long used;
-
- /* Syntax setting with which the pattern was compiled. */
- reg_syntax_t syntax;
-
- /* Pointer to a fastmap, if any, otherwise zero. re_search uses
- the fastmap, if there is one, to skip over impossible
- starting points for matches. */
char *fastmap;
-
- /* Either a translate table to apply to all characters before
- comparing them, or zero for no translation. The translation
- is applied to a pattern when it is compiled and to a string
- when it is matched. */
char *translate;
-
- /* Number of subexpressions found by the compiler. */
size_t re_nsub;
-
- /* Zero if this pattern cannot match the empty string, one else.
- Well, in truth it's used only in `re_search_2', to see
- whether or not we should use the fastmap, so we don't set
- this absolutely perfectly; see `re_compile_fastmap' (the
- `duplicate' case). */
- unsigned can_be_null : 1;
-
- /* If REGS_UNALLOCATED, allocate space in the `regs' structure
- for `max (RE_NREGS, re_nsub + 1)' groups.
- If REGS_REALLOCATE, reallocate space if necessary.
- If REGS_FIXED, use what's there. */
-#define REGS_UNALLOCATED 0
-#define REGS_REALLOCATE 1
-#define REGS_FIXED 2
- unsigned regs_allocated : 2;
-
- /* Set to zero when `regex_compile' compiles a pattern; set to one
- by `re_compile_fastmap' if it updates the fastmap. */
- unsigned fastmap_accurate : 1;
-
- /* If set, `re_match_2' does not return information about
- subexpressions. */
unsigned no_sub : 1;
-
- /* If set, a beginning-of-line anchor doesn't match at the
- beginning of the string. */
unsigned not_bol : 1;
-
- /* Similarly for an end-of-line anchor. */
unsigned not_eol : 1;
-
- /* If true, an anchor at a newline matches. */
- unsigned newline_anchor : 1;
-
@end example
@vindex buffer @r{field, set by @code{re_compile_pattern}}
to the compiled pattern.
-@item used
-@vindex used @r{field, set by @code{re_compile_pattern}}
-to the number of bytes the compiled pattern in @code{buffer} occupies.
-
@item syntax
@vindex syntax @r{field, set by @code{re_compile_pattern}}
to the current value of @code{re_syntax_options}.
@vindex re_nsub @r{field, set by @code{re_compile_pattern}}
to the number of subexpressions in @var{regex}.
-@item fastmap_accurate
-@vindex fastmap_accurate @r{field, set by @code{re_compile_pattern}}
-to zero on the theory that the pattern you're compiling is different
-than the one previously compiled into @code{buffer}; in that case (since
-you can't make a fastmap without a compiled pattern),
-@code{fastmap} would either contain an incompatible fastmap, or nothing
-at all.
-
-@c xx what else?
@end table
If @code{re_compile_pattern} can't compile @var{regex}, it returns an
-error string corresponding to one of the errors listed in @ref{POSIX
-Regular Expression Compiling}.
+error string corresponding to a @sc{posix} error code.
@node GNU Matching
pass zero.
@code{re_match} matches the regular expression in @var{pattern_buffer}
-against the string @var{string} according to the syntax in
-@var{pattern_buffers}'s @code{syntax} field. (@xref{GNU Regular
-Expression Compiling}, for how to set it.) The function returns
-@math{-1} if the compiled pattern does not match any part of
-@var{string} and @math{-2} if an internal error happens; otherwise, it
-returns how many (possibly zero) characters of @var{string} the pattern
-matched.
+against the string @var{string} according to the syntax of
+@var{pattern_buffer}. (@xref{GNU Regular Expression Compiling}, for how
+to set it.) The function returns @math{-1} if the compiled pattern does
+not match any part of @var{string} and @math{-2} if an internal error
+happens; otherwise, it returns how many (possibly zero) characters of
+@var{string} the pattern matched.
An example: suppose @var{pattern_buffer} points to a pattern buffer
containing the compiled pattern for @samp{a*}, and @var{string} points
when @code{fastmap} is nonzero, it automatically compiles a fastmap the
first time you search using a particular compiled pattern.
+By setting the buffer’s @code{fastmap} field before calling
+@code{re_compile_pattern}, you can reuse a buffer data structure across
+multiple searches with different patterns, and allocate the fastmap only
+once. Nonetheless, the fastmap must be recompiled each time the buffer
+has a new pattern compiled into it.
+
To compile a fastmap yourself, use:
@findex re_compile_fastmap
zero-length arrays; conceptually, it is simplest to think of them as
arrays.)
-The @code{start} and @code{end} arrays are allocated in various ways,
-depending on the value of the @code{regs_allocated}
-@vindex regs_allocated
-field in the pattern buffer passed to the matcher.
-
+The @code{start} and @code{end} arrays are allocated in one of two ways.
The simplest and perhaps most useful is to let the matcher (re)allocate
enough space to record information for all the groups in the regular
-expression. If @code{regs_allocated} is @code{REGS_UNALLOCATED},
-@vindex REGS_UNALLOCATED
-the matcher allocates @math{1 + @var{re_nsub}} (another field in the
-pattern buffer; @pxref{GNU Pattern Buffers}). The extra element is set
-to @math{-1}, and sets @code{regs_allocated} to @code{REGS_REALLOCATE}.
-@vindex REGS_REALLOCATE
-Then on subsequent calls with the same pattern buffer and @var{regs}
-arguments, the matcher reallocates more space if necessary.
-
-It would perhaps be more logical to make the @code{regs_allocated} field
-part of the @code{re_registers} structure, instead of part of the
-pattern buffer. But in that case the caller would be forced to
-initialize the structure before passing it. Much existing code doesn't
-do this initialization, and it's arguably better to avoid it anyway.
-
-@code{re_compile_pattern} sets @code{regs_allocated} to
-@code{REGS_UNALLOCATED},
-so if you use the GNU regular expression
-functions, you get this behavior by default.
-
-xx document re_set_registers
-
-@sc{posix}, on the other hand, requires a different interface: the
-caller is supposed to pass in a fixed-length array which the matcher
-fills. Therefore, if @code{regs_allocated} is @code{REGS_FIXED}
-@vindex REGS_FIXED
-the matcher simply fills that array.
+expression. If @code{re_set_registers} is not called before searching
+or matching, then the matcher allocates two arrays each of @math{1 +
+@var{re_nsub}} elements (@var{re_nsub} is another field in the pattern
+buffer; @pxref{GNU Pattern Buffers}). The extra element is set to
+@math{-1}. Then on subsequent calls with the same pattern buffer and
+@var{regs} arguments, the matcher reallocates more space if necessary.
+
+The function:
+
+@findex re_set_registers
+@example
+void
+re_set_registers (struct re_pattern_buffer *@var{buffer},
+ struct re_registers *@var{regs},
+ size_t @var{num_regs},
+ regoff_t *@var{starts}, regoff_t *@var{ends})
+@end example
+
+@noindent sets @var{regs} to hold @var{num_regs} registers, storing
+them in @var{starts} and @var{ends}. Subsequent matches using
+@var{buffer} and @var{regs} will use this memory for recording
+register information. @var{starts} and @var{ends} must be allocated
+with malloc, and must each be at least @math{@var{num_regs} *
+@code{sizeof (regoff_t)}} bytes long.
+
+If @var{num_regs} is zero, then subsequent matches should allocate
+their own register data.
+
+Unless this function is called, the first search or match using
+@var{buffer} will allocate its own register data, without freeing the
+old data.
The following examples illustrate the information recorded in the
@code{re_registers} structure. (In all of them, @samp{(} represents the
open-group and @samp{)} the close-group operator. The first character
in the string @var{string} is at index 0.)
-@c xx i'm not sure this is all true anymore.
-
@itemize @bullet
@item
If the regular expression has an @w{@var{i}-th}
-group not contained within another group that matches a
+group that matches a
substring of @var{string}, then the function sets
@code{@w{@var{regs}->}start[@var{i}]} to the index in @var{string} where
the substring matched by the @w{@var{i}-th} group begins, and
0 in @code{@w{@var{regs}->}start[1]} and 0 in @code{@w{@var{regs}->}end[1]}
@end itemize
-@ignore
-The function sets @code{@w{@var{regs}->}start[0]} and
-@code{@w{@var{regs}->}end[0]} to analogous information about the entire
-pattern.
-
-For example, when you match the pattern @samp{(a*)} against the empty
-string, you get:
-
-@itemize
-@item
-0 in @code{@w{@var{regs}->}start[0]} and 0 in @code{@w{@var{regs}->}end[0]}
-
-@item
-0 in @code{@w{@var{regs}->}start[1]} and 0 in @code{@w{@var{regs}->}end[1]}
-@end itemize
-@end ignore
-
@item
If an @w{@var{i}-th} group contains a @w{@var{j}-th} group
in turn not contained within any other group within group @var{i} and
@node Freeing GNU Pattern Buffers
@subsection Freeing GNU Pattern Buffers
-To free any allocated fields of a pattern buffer, you can use the
-@sc{posix} function described in @ref{Freeing POSIX Pattern Buffers},
-since the type @code{regex_t}---the type for @sc{posix} pattern
-buffers---is equivalent to the type @code{re_pattern_buffer}. After
-freeing a pattern buffer, you need to again compile a regular expression
-in it (@pxref{GNU Regular Expression Compiling}) before passing it to
-a matching or searching function.
-
-
-@node POSIX Regex Functions
-@section POSIX Regex Functions
-
-If you're writing code that has to be @sc{posix} compatible, you'll need
-to use these functions. Their interfaces are as specified by @sc{posix},
-draft 1003.2/D11.2.
-
-@menu
-* POSIX Pattern Buffers:: The regex_t type.
-* POSIX Regular Expression Compiling:: regcomp ()
-* POSIX Matching:: regexec ()
-* Reporting Errors:: regerror ()
-* Using Byte Offsets:: The regmatch_t type.
-* Freeing POSIX Pattern Buffers:: regfree ()
-@end menu
-
-
-@node POSIX Pattern Buffers
-@subsection POSIX Pattern Buffers
-
-To compile or match a given regular expression the @sc{posix} way, you
-must supply a pattern buffer exactly the way you do for @sc{gnu}
-(@pxref{GNU Pattern Buffers}). @sc{posix} pattern buffers have type
-@code{regex_t}, which is equivalent to the @sc{gnu} pattern buffer
-type @code{re_pattern_buffer}.
-
-
-@node POSIX Regular Expression Compiling
-@subsection POSIX Regular Expression Compiling
-
-With @sc{posix}, you can only search for a given regular expression; you
-can't match it. To do this, you must first compile it in a
-pattern buffer, using @code{regcomp}.
-
-@ignore
-Before calling @code{regcomp}, you must initialize this pattern buffer
-as you do for @sc{gnu} (@pxref{GNU Regular Expression Compiling}). See
-below, however, for how to choose a syntax with which to compile.
-@end ignore
-
-To compile a pattern buffer, use:
-
-@findex regcomp
-@example
-int
-regcomp (regex_t *@var{preg}, const char *@var{regex}, int @var{cflags})
-@end example
-
-@noindent
-@var{preg} is the initialized pattern buffer's address, @var{regex} is
-the regular expression's address, and @var{cflags} is the compilation
-flags, which Regex considers as a collection of bits. Here are the
-valid bits, as defined in @file{regex.h}:
-
-@table @code
-
-@item REG_EXTENDED
-@vindex REG_EXTENDED
-says to use @sc{posix} Extended Regular Expression syntax; if this isn't
-set, then says to use @sc{posix} Basic Regular Expression syntax.
-@code{regcomp} sets @var{preg}'s @code{syntax} field accordingly.
-
-@item REG_ICASE
-@vindex REG_ICASE
-@cindex ignoring case
-says to ignore case; @code{regcomp} sets @var{preg}'s @code{translate}
-field to a translate table which ignores case, replacing anything you've
-put there before.
-
-@item REG_NOSUB
-@vindex REG_NOSUB
-says to set @var{preg}'s @code{no_sub} field; @pxref{POSIX Matching},
-for what this means.
-
-@item REG_NEWLINE
-@vindex REG_NEWLINE
-says that a:
-
-@itemize @bullet
-
-@item
-match-any-character operator (@pxref{Match-any-character
-Operator}) doesn't match a newline.
-
-@item
-nonmatching list not containing a newline (@pxref{List
-Operators}) matches a newline.
-
-@item
-match-beginning-of-line operator (@pxref{Match-beginning-of-line
-Operator}) matches the empty string immediately after a newline,
-regardless of how @code{REG_NOTBOL} is set (@pxref{POSIX Matching}, for
-an explanation of @code{REG_NOTBOL}).
-
-@item
-match-end-of-line operator (@pxref{Match-beginning-of-line
-Operator}) matches the empty string immediately before a newline,
-regardless of how @code{REG_NOTEOL} is set (@pxref{POSIX Matching},
-for an explanation of @code{REG_NOTEOL}).
-
-@end itemize
-
-@end table
-
-If @code{regcomp} successfully compiles the regular expression, it
-returns zero and sets @code{*@var{pattern_buffer}} to the compiled
-pattern. Except for @code{syntax} (which it sets as explained above), it
-also sets the same fields the same way as does the @sc{gnu} compiling
-function (@pxref{GNU Regular Expression Compiling}).
-
-If @code{regcomp} can't compile the regular expression, it returns one
-of the error codes listed here. (Except when noted differently, the
-syntax of in all examples below is basic regular expression syntax.)
-
-@table @code
-
-@comment repetitions
-@item REG_BADRPT
-For example, the consecutive repetition operators @samp{**} in
-@samp{a**} are invalid. As another example, if the syntax is extended
-regular expression syntax, then the repetition operator @samp{*} with
-nothing on which to operate in @samp{*} is invalid.
-
-@item REG_BADBR
-For example, the @var{count} @samp{-1} in @samp{a\@{-1} is invalid.
-
-@item REG_EBRACE
-For example, @samp{a\@{1} is missing a close-interval operator.
-
-@comment lists
-@item REG_EBRACK
-For example, @samp{[a} is missing a close-list operator.
-
-@item REG_ERANGE
-For example, the range ending point @samp{z} that collates lower than
-does its starting point @samp{a} in @samp{[z-a]} is invalid. Also, the
-range with the character class @samp{[:alpha:]} as its starting point in
-@samp{[[:alpha:]-|]}.
-
-@item REG_ECTYPE
-For example, the character class name @samp{foo} in @samp{[[:foo:]} is
-invalid.
-
-@comment groups
-@item REG_EPAREN
-For example, @samp{a\)} is missing an open-group operator and @samp{\(a}
-is missing a close-group operator.
-
-@item REG_ESUBREG
-For example, the back reference @samp{\2} that refers to a nonexistent
-subexpression in @samp{\(a\)\2} is invalid.
-
-@comment unfinished business
-
-@item REG_EEND
-Returned when a regular expression causes no other more specific error.
-
-@item REG_EESCAPE
-For example, the trailing backslash @samp{\} in @samp{a\} is invalid, as is the
-one in @samp{\}.
-
-@comment kitchen sink
-@item REG_BADPAT
-For example, in the extended regular expression syntax, the empty group
-@samp{()} in @samp{a()b} is invalid.
-
-@comment internal
-@item REG_ESIZE
-Returned when a regular expression needs a pattern buffer larger than
-65536 bytes.
-
-@item REG_ESPACE
-Returned when a regular expression makes Regex to run out of memory.
-
-@end table
-
-
-@node POSIX Matching
-@subsection POSIX Matching
-
-Matching the @sc{posix} way means trying to match a null-terminated
-string starting at its first character. Once you've compiled a pattern
-into a pattern buffer (@pxref{POSIX Regular Expression Compiling}), you
-can ask the matcher to match that pattern against a string using:
-
-@findex regexec
-@example
-int
-regexec (const regex_t *@var{preg}, const char *@var{string},
- size_t @var{nmatch}, regmatch_t @var{pmatch}[], int @var{eflags})
-@end example
-
-@noindent
-@var{preg} is the address of a pattern buffer for a compiled pattern.
-@var{string} is the string you want to match.
-
-@xref{Using Byte Offsets}, for an explanation of @var{pmatch}. If you
-pass zero for @var{nmatch} or you compiled @var{preg} with the
-compilation flag @code{REG_NOSUB} set, then @code{regexec} will ignore
-@var{pmatch}; otherwise, you must allocate it to have at least
-@var{nmatch} elements. @code{regexec} will record @var{nmatch} byte
-offsets in @var{pmatch}, and set to @math{-1} any unused elements up to
-@math{@var{pmatch}@code{[@var{nmatch}]} - 1}.
-
-@var{eflags} specifies @dfn{execution flags}---namely, the two bits
-@code{REG_NOTBOL} and @code{REG_NOTEOL} (defined in @file{regex.h}). If
-you set @code{REG_NOTBOL}, then the match-beginning-of-line operator
-(@pxref{Match-beginning-of-line Operator}) always fails to match.
-This lets you match against pieces of a line, as you would need to if,
-say, searching for repeated instances of a given pattern in a line; it
-would work correctly for patterns both with and without
-match-beginning-of-line operators. @code{REG_NOTEOL} works analogously
-for the match-end-of-line operator (@pxref{Match-end-of-line
-Operator}); it exists for symmetry.
-
-@code{regexec} tries to find a match for @var{preg} in @var{string}
-according to the syntax in @var{preg}'s @code{syntax} field.
-(@xref{POSIX Regular Expression Compiling}, for how to set it.) The
-function returns zero if the compiled pattern matches @var{string} and
-@code{REG_NOMATCH} (defined in @file{regex.h}) if it doesn't.
-
-@node Reporting Errors
-@subsection Reporting Errors
-
-If either @code{regcomp} or @code{regexec} fail, they return a nonzero
-error code, the possibilities for which are defined in @file{regex.h}.
-@xref{POSIX Regular Expression Compiling}, and @ref{POSIX Matching}, for
-what these codes mean. To get an error string corresponding to these
-codes, you can use:
-
-@findex regerror
-@example
-size_t
-regerror (int @var{errcode},
- const regex_t *@var{preg},
- char *@var{errbuf},
- size_t @var{errbuf_size})
-@end example
-
-@noindent
-@var{errcode} is an error code, @var{preg} is the address of the pattern
-buffer which provoked the error, @var{errbuf} is the error buffer, and
-@var{errbuf_size} is @var{errbuf}'s size.
-
-@code{regerror} returns the size in bytes of the error string
-corresponding to @var{errcode} (including its terminating null). If
-@var{errbuf} and @var{errbuf_size} are nonzero, it also returns in
-@var{errbuf} the first @math{@var{errbuf_size} - 1} characters of the
-error string, followed by a null.
-@var{errbuf_size} must be a nonnegative number less than or equal to the
-size in bytes of @var{errbuf}.
-
-You can call @code{regerror} with a null @var{errbuf} and a zero
-@var{errbuf_size} to determine how large @var{errbuf} need be to
-accommodate @code{regerror}'s error string.
-
-@node Using Byte Offsets
-@subsection Using Byte Offsets
-
-In @sc{posix}, variables of type @code{regmatch_t} hold analogous
-information, but are not identical to, @sc{gnu}'s registers (@pxref{Using
-Registers}). To get information about registers in @sc{posix}, pass to
-@code{regexec} a nonzero @var{pmatch} of type @code{regmatch_t}, i.e.,
-the address of a structure of this type, defined in
-@file{regex.h}:
-
-@tindex regmatch_t
-@example
-typedef struct
-@{
- regoff_t rm_so;
- regoff_t rm_eo;
-@} regmatch_t;
-@end example
-
-When reading in @ref{Using Registers}, about how the matching function
-stores the information into the registers, substitute @var{pmatch} for
-@var{regs}, @code{@w{@var{pmatch}[@var{i}]->}rm_so} for
-@code{@w{@var{regs}->}start[@var{i}]} and
-@code{@w{@var{pmatch}[@var{i}]->}rm_eo} for
-@code{@w{@var{regs}->}end[@var{i}]}.
-
-@node Freeing POSIX Pattern Buffers
-@subsection Freeing POSIX Pattern Buffers
-
-To free any allocated fields of a pattern buffer, use:
+To free any allocated fields of a pattern buffer, use the @sc{posix}
+function @code{regfree}:
@findex regfree
@example
@end example
@noindent
-@var{preg} is the pattern buffer whose allocated fields you want freed.
-@code{regfree} also sets @var{preg}'s @code{allocated} and @code{used}
-fields to zero. After freeing a pattern buffer, you need to again
-compile a regular expression in it (@pxref{POSIX Regular Expression
-Compiling}) before passing it to the matching function (@pxref{POSIX
-Matching}).
+@var{preg} is the pattern buffer whose allocated fields you want freed;
+this works because since the type @code{regex_t}---the type for
+@sc{posix} pattern buffers---is equivalent to the type
+@code{re_pattern_buffer}.
+
+@code{regfree} also sets @var{preg}'s @code{allocated} field to zero.
+After a buffer has been freed, it must have a regular expression
+compiled in it before passing it to a matching or searching function.
@node BSD Regex Functions
@setfilename standards.info
@settitle GNU Coding Standards
@c This date is automagically updated when you save this file:
-@set lastupdate August 24, 2010
+@set lastupdate September 9, 2010
@c %**end of header
@dircategory GNU organization
If your program creates complicated data structures, just make them in
memory and give a fatal error if @code{malloc} returns zero.
+@pindex valgrind
+@cindex memory leak
+Memory leak detectors such as @command{valgrind} can be useful, but
+don't complicate a program merely to avoid their false alarms. For
+example, if memory is used until just before a process exits, don't
+free it simply to silence a leak detector.
+
@node File Usage
@section File Usage
@cindex file usage
If you want to do this, then do. The compiler should be your servant,
not your master.
+@pindex clang
+@pindex lint
+Don't make the program ugly just to placate static analysis tools such
+as @command{lint}, @command{clang}, and GCC with extra warnings
+options such as @option{-Wconversion} and @option{-Wundef}. These
+tools can help find bugs and unclear code, but they can also generate
+so many false alarms that that it hurts readability to silence them
+with unnecessary casts, wrappers, and other complications. For
+example, please don't insert casts to @code{void} or calls to
+do-nothing functions merely to pacify a lint checker.
+
Declarations of external functions and functions to appear later in the
source file should all go in one place near the beginning of the file
(somewhere before the first function definition in the file), or else
all its uses. This makes the program even cleaner.
Don't use local variables or parameters that shadow global identifiers.
+GCC's @samp{-Wshadow} option can detect this problem.
@cindex multiple variables in a line
Don't declare multiple variables in one declaration that spans lines.
fatal ("virtual memory exhausted");
@end example
-@pindex lint
-Don't make the program ugly to placate @code{lint}. Please don't insert any
-casts to @code{void}. Zero without a cast is perfectly fine as a null
-pointer constant, except when calling a varargs function.
+This example uses zero without a cast as a null pointer constant.
+This is perfectly fine, except that a cast is needed when calling a
+varargs function or when using @code{sizeof}.
@node Names
@section Naming Variables, Functions, and Files
# outputs to stdout the --help usage message.
func_usage ()
{
+ # This use of bold display can be removed on 2011-01-01.
+ if case "$TERM" in
+ xterm*) test -t 1;;
+ *) false;;
+ esac; then
+ # Assume xterm compatible escape sequences.
+ bold_on=`printf '\x1b[1m'`
+ bold_off=`printf '\x1b[0m'`
+ else
+ bold_on=
+ bold_off=
+ fi
echo "\
Usage: gnulib-tool --list
- gnulib-tool --find filename
+ gnulib-tool --find filename${bold_on}
gnulib-tool --import [module1 ... moduleN]
+ gnulib-tool --add-import [module1 ... moduleN]
+ gnulib-tool --remove-import [module1 ... moduleN]${bold_off}
gnulib-tool --update
gnulib-tool --create-testdir --dir=directory [module1 ... moduleN]
gnulib-tool --create-megatestdir --dir=directory [module1 ... moduleN]
gnulib-tool --copy-file file [destination]
Operation modes:
+
--list print the available module names
- --find find the modules which contain the specified file
- --import import the given modules into the current package;
+ --find find the modules which contain the specified file${bold_on}
+ --import import the given modules into the current package
+ --add-import augment the list of imports from gnulib into the
+ current package, by adding the given modules;
if no modules are specified, update the current
package from the current gnulib
+ --remove-import reduce the list of imports from gnulib into the
+ current package, by removing the given modules${bold_off}
--update update the current package, restore files omitted
- from CVS
+ from version control
--create-testdir create a scratch package with the given modules
--create-megatestdir create a mega scratch package with the given modules
one by one and all together
--copy-file copy a file that is not part of any module
General options:
+
--dir=DIRECTORY Specify the target directory.
For --import, this specifies where your
configure.ac can be found. Defaults to current
--verbose Increase verbosity. May be repeated.
--quiet Decrease verbosity. May be repeated.
-Options for --import, --update:
+Options for --import, --add/remove-import, --update:
+
--dry-run Only print what would have been done.
-Options for --import, --create-[mega]testdir, --[mega]test:
+Options for --import, --add/remove-import,
+ --create-[mega]testdir, --[mega]test:
+
--with-tests Include unit tests for the included modules.
--with-obsolete Include obsolete modules when they occur among the
dependencies. By default, dependencies to obsolete
--libtool Use libtool rules.
--no-libtool Don't use libtool rules.
-Options for --import:
+Options for --import, --add/remove-import:
+
--lib=LIBRARY Specify the library name. Defaults to 'libgnu'.
--source-base=DIRECTORY
Directory relative to --dir where source code is
Directory relative to --dir where unit tests are
placed (default \"tests\").
--aux-dir=DIRECTORY Directory relative to --dir where auxiliary build
- tools are placed (default \"build-aux\").
+ tools are placed (default comes from configure.ac).
--lgpl[=2|=3] Abort if modules aren't available under the LGPL.
Also modify license template from GPL to LGPL.
The version number of the LGPL can be specified;
--no-changelog Don't update or create ChangeLog files.
Options for --create-[mega]testdir, --[mega]test:
+
--without-c++-tests Exclude unit tests for C++ interoperability.
--without-longrunning-tests
Exclude unit tests that are long-runners.
--without-unportable-tests
Exclude unit tests that fail on some platforms.
-Options for --import, --update, --create-[mega]testdir, --[mega]test:
+Options for --import, --add/remove-import, --update,
+ --create-[mega]testdir, --[mega]test:
+
-s, --symbolic, --symlink Make symbolic links instead of copying files.
--local-symlink Make symbolic links instead of copying files, only
for files from the local override directory.
-Options for --import, --update:
+Options for --import, --add/remove-import, --update:
+
-S, --more-symlinks Make symbolic links instead of copying files, and
don't replace copyright notices.
# explicit canonicalization command when $PATH contains no empty fields.
self_abspathname=
if test "${PATH_SEPARATOR+set}" != set; then
- func_tmpdir
- { echo "#! /bin/sh"; echo "exit 0"; } > "$tmp"/conf.sh
- chmod +x "$tmp"/conf.sh
- if (PATH="/nonexistent;$tmp"; conf.sh) >/dev/null 2>&1; then
- PATH_SEPARATOR=';'
- else
- PATH_SEPARATOR=:
- fi
- rm -rf "$tmp"
+ # Determine PATH_SEPARATOR by trying to find /bin/sh in a PATH which
+ # contains only /bin. Note that ksh looks also at the FPATH variable,
+ # so we have to set that as well for the test.
+ PATH_SEPARATOR=:
+ (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \
+ && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \
+ || PATH_SEPARATOR=';'
+ }
fi
if test "$PATH_SEPARATOR" = ";"; then
# On Windows, programs are searched in "." before $PATH.
# that the top-level statement containing the test starts after the 'alias'
# command.
if test -z "$have_echo"; then
-bsd_echo ()
+ bsd_echo ()
{
cat <<EOF
$*
EOF
}
-alias echo=bsd_echo 2>/dev/null
+ if (alias echo=bsd_echo) 2>/dev/null; then
+ alias echo=bsd_echo 2>/dev/null
+ fi
fi
if test -z "$have_echo" \
&& echo '\t' | grep t > /dev/null; then
have_echo=yes
fi
if test -z "$have_echo"; then
- unalias echo 2>/dev/null
+ if (alias echo=bsd_echo) 2>/dev/null; then
+ unalias echo 2>/dev/null
+ fi
fi
# For Solaris /bin/sh and OSF/1 /bin/sh: respawn using /bin/ksh.
if test -z "$have_echo" \
# Command-line option processing.
# Removes the OPTIONS from the arguments. Sets the variables:
-# - mode list or import or create-testdir or create-megatestdir
+# - mode list or import or add-import or remove-import or update
+# or create-testdir or create-megatestdir
# - destdir from --dir
# - local_gnulib_dir from --local-dir
# - modcache true or false, from --cache-modules/--no-cache-modules
--import | --impor | --impo | --imp | --im | --i )
mode=import
shift ;;
+ --add-import | --add-impor | --add-impo | --add-imp | --add-im | --add-i | --add- | --add | --ad )
+ mode=add-import
+ shift ;;
+ --remove-import | --remove-impor | --remove-impo | --remove-imp | --remove-im | --remove-i | --remove- | --remove | --remov | --remo | --rem | --re | --r )
+ mode=remove-import
+ shift ;;
--update | --updat | --upda | --upd | --up | --u )
mode=update
shift ;;
esac
done
- if test "$mode" = import; then
+ if case "$mode" in import | add-import | remove-import) true;; *) false;; esac; then
if test -n "$excl_cxx_tests" || test -n "$excl_longrunning_tests" \
|| test -n "$excl_privileged_tests" || test -n "$excl_unportable_tests"; then
- echo "gnulib-tool: invalid options for 'import' mode" 1>&2
+ echo "gnulib-tool: invalid options for '$mode' mode" 1>&2
echo "Try 'gnulib-tool --help' for more information." 1>&2
func_exit 1
fi
fi
+ # This code helps migrating from --import to --add-import or --update. It can
+ # be removed on 2012-01-01.
+ if test "$mode" = import && test $# = 0; then
+ echo "gnulib-tool: cowardly refusing to erase the module list." 1>&2
+ echo "The meaning of the option '--import' has changed." 1>&2
+ echo "See the documentation at" 1>&2
+ echo "<http://www.gnu.org/software/gnulib/manual/html_node/Modified-imports.html>." 1>&2
+ echo "For updating to a newer version of gnulib, use" 1>&2
+ echo " gnulib-tool --add-import" 1>&2
+ echo "For restoring files that were omitted from version control, use" 1>&2
+ echo " gnulib-tool --update" 1>&2
+ func_exit 1
+ fi
if test "$mode" = update; then
if test $# != 0; then
echo "gnulib-tool: too many arguments in 'update' mode" 1>&2
DEFAULT_AUTOCONF_MINVERSION="2.59"
autoconf_minversion=
configure_ac=
- if { test "$mode" = import || test "$mode" = update; } && test -n "$destdir"; then
+ if case "$mode" in import | add-import | remove-import | update) true;; *) false;; esac \
+ && test -n "$destdir"; then
if test -f "$destdir"/configure.ac; then
configure_ac="$destdir/configure.ac"
else
fi
if test -n "$configure_ac"; then
# Use sed, not autoconf --trace, to look for the AC_PREREQ invocation,
- # because when some m4 files are omitted from a CVS repository,
+ # because when some m4 files are omitted from a version control repository,
# "autoconf --trace=AC_PREREQ" fails with an error message like this:
# m4: aclocal.m4:851: Cannot open m4/absolute-header.m4: No such file or directory
# autom4te: m4 failed with exit status: 1
done
signal=0
+# Note: The 'eval' silences stderr output in dash.
+if (declare -A x && { x[f/2]='foo'; x[f/3]='bar'; eval test '${x[f/2]}' = foo; }) 2>/dev/null; then
+ # Zsh 4 and Bash 4 have associative arrays.
+ have_associative=true
+else
+ # For other shells, use 'eval' with computed shell variable names.
+ have_associative=false
+fi
+
# func_lookup_file file
# looks up a file in $local_gnulib_dir or $gnulib_dir, or combines it through
# 'patch'.
if $modcache; then
- # Note: The 'eval' silences stderr output in dash.
- if (declare -A x && { x[f/2]='foo'; x[f/3]='bar'; eval test '${x[f/2]}' = foo; }) 2>/dev/null; then
- # Zsh 4 and Bash 4 have associative arrays.
- have_associative=true
- else
- # For other shells, use 'eval' with computed shell variable names.
- have_associative=false
- fi
-
if $have_associative; then
# Declare the associative arrays.
# ${param//pattern/replacement}
# as a shorthand for
# `echo "$param" | sed -e "s/pattern/replacement/g"`.
- # Note: The 'eval' above silences stderr output in dash.
- func_cache_var ()
+ # Note: The 'eval' is necessary for dash and NetBSD /bin/sh.
+ eval 'func_cache_var ()
{
cachevar=c_${1//[!a-zA-Z0-9_]/_}
- }
+ }'
else
func_cache_var ()
{
func_cache_lookup_module ()
{
if $have_associative; then
- cached=${modcache_cached[$1]}
+ eval 'cached=${modcache_cached[$1]}'
else
func_cache_var "$1"
eval "cached=\"\$${cachevar}_cached\""
# Not found in cache. Look it up on the file system.
func_lookup_file "modules/$1"
if $have_associative; then
- modcache_cached[$1]=yes
+ eval 'modcache_cached[$1]=yes'
else
eval "${cachevar}_cached=\"\$1\""
fi
func_cache_lookup_module "$1"
# Output the field's value, including the final newline (if any).
if $have_associative; then
- if test -n "${modcache_description[$1]+set}"; then
- echo "${modcache_description[$1]}"
+ if eval 'test -n "${modcache_description[$1]+set}"'; then
+ eval 'echo "${modcache_description[$1]}"'
fi
else
eval "field_set=\"\$${cachevar}_description_set\""
func_cache_lookup_module "$1"
# Output the field's value, including the final newline (if any).
if $have_associative; then
- if test -n "${modcache_comment[$1]+set}"; then
- echo "${modcache_comment[$1]}"
+ if eval 'test -n "${modcache_comment[$1]+set}"'; then
+ eval 'echo "${modcache_comment[$1]}"'
fi
else
eval "field_set=\"\$${cachevar}_comment_set\""
func_cache_lookup_module "$1"
# Output the field's value, including the final newline (if any).
if $have_associative; then
- if test -n "${modcache_status[$1]+set}"; then
- echo "${modcache_status[$1]}"
+ if eval 'test -n "${modcache_status[$1]+set}"'; then
+ eval 'echo "${modcache_status[$1]}"'
fi
else
eval "field_set=\"\$${cachevar}_status_set\""
func_cache_lookup_module "$1"
# Output the field's value, including the final newline (if any).
if $have_associative; then
- if test -n "${modcache_notice[$1]+set}"; then
- echo "${modcache_notice[$1]}"
+ if eval 'test -n "${modcache_notice[$1]+set}"'; then
+ eval 'echo "${modcache_notice[$1]}"'
fi
else
eval "field_set=\"\$${cachevar}_notice_set\""
func_cache_lookup_module "$1"
# Get the field's value, without the final newline.
if $have_associative; then
- my_applicability="${modcache_applicability[$1]}"
+ eval 'my_applicability="${modcache_applicability[$1]}"'
else
eval "my_applicability=\"\$${cachevar}_applicability\""
fi
func_cache_lookup_module "$1"
# Output the field's value, including the final newline (if any).
if $have_associative; then
- if test -n "${modcache_files[$1]+set}"; then
- echo "${modcache_files[$1]}"
+ if eval 'test -n "${modcache_files[$1]+set}"'; then
+ eval 'echo "${modcache_files[$1]}"'
fi
else
eval "field_set=\"\$${cachevar}_files_set\""
func_cache_lookup_module "$1"
# Output the field's value, including the final newline (if any).
if $have_associative; then
- if test -n "${modcache_dependson[$1]+set}"; then
- echo "${modcache_dependson[$1]}"
+ if eval 'test -n "${modcache_dependson[$1]+set}"'; then
+ eval 'echo "${modcache_dependson[$1]}"'
fi
else
eval "field_set=\"\$${cachevar}_dependson_set\""
func_cache_lookup_module "$1"
# Output the field's value, including the final newline (if any).
if $have_associative; then
- if test -n "${modcache_configureac_early[$1]+set}"; then
- echo "${modcache_configureac_early[$1]}"
+ if eval 'test -n "${modcache_configureac_early[$1]+set}"'; then
+ eval 'echo "${modcache_configureac_early[$1]}"'
fi
else
eval "field_set=\"\$${cachevar}_configureac_early_set\""
func_cache_lookup_module "$1"
# Output the field's value, including the final newline (if any).
if $have_associative; then
- if test -n "${modcache_configureac[$1]+set}"; then
- echo "${modcache_configureac[$1]}"
+ if eval 'test -n "${modcache_configureac[$1]+set}"'; then
+ eval 'echo "${modcache_configureac[$1]}"'
fi
else
eval "field_set=\"\$${cachevar}_configureac_set\""
func_cache_lookup_module "$1"
# Output the field's value, including the final newline (if any).
if $have_associative; then
- if test -n "${modcache_makefile[$1]+set}"; then
- echo "${modcache_makefile[$1]}"
+ if eval 'test -n "${modcache_makefile[$1]+set}"'; then
+ eval 'echo "${modcache_makefile[$1]}"'
fi
else
eval "field_set=\"\$${cachevar}_makefile_set\""
sed -n -e "/^Makefile\.am$sed_extract_prog" < "$lookedup_file"
else
if $have_associative; then
- if test -n "${modcache_makefile[$1]+set}"; then
- echo "${modcache_makefile[$1]}"
+ if eval 'test -n "${modcache_makefile[$1]+set}"'; then
+ eval 'echo "${modcache_makefile[$1]}"'
fi
else
eval 'field_set="$'"${cachevar}"'_makefile_set"'
# automake will generate a useless dependency; this is harmless.
case "$1" in
relocatable-prog-wrapper) ;;
+ pt_chown) ;;
*)
func_filter_filelist extra_files "$nl" "$extra_files" '' '.c' '' ''
if test -n "$extra_files"; then
func_cache_lookup_module "$1"
# Output the field's value, including the final newline (if any).
if $have_associative; then
- if test -n "${modcache_include[$1]+set}"; then
- echo "${modcache_include[$1]}"
+ if eval 'test -n "${modcache_include[$1]+set}"'; then
+ eval 'echo "${modcache_include[$1]}"'
fi
else
eval "field_set=\"\$${cachevar}_include_set\""
func_cache_lookup_module "$1"
# Output the field's value, including the final newline (if any).
if $have_associative; then
- if test -n "${modcache_link[$1]+set}"; then
- echo "${modcache_link[$1]}"
+ if eval 'test -n "${modcache_link[$1]+set}"'; then
+ eval 'echo "${modcache_link[$1]}"'
fi
else
eval "field_set=\"\$${cachevar}_link_set\""
func_cache_lookup_module "$1"
# Output the field's value, including the final newline (if any).
if $have_associative; then
- if test -n "${modcache_license[$1]+set}"; then
- echo "${modcache_license[$1]}"
+ if eval 'test -n "${modcache_license[$1]+set}"'; then
+ eval 'echo "${modcache_license[$1]}"'
fi
else
eval "field_set=\"\$${cachevar}_license_set\""
func_cache_lookup_module "$1"
# Output the field's value, including the final newline (if any).
if $have_associative; then
- if test -n "${modcache_maintainer[$1]+set}"; then
- echo "${modcache_maintainer[$1]}"
+ if eval 'test -n "${modcache_maintainer[$1]+set}"'; then
+ eval 'echo "${modcache_maintainer[$1]}"'
fi
else
eval "field_set=\"\$${cachevar}_maintainer_set\""
echo "EXTRA_${libname}_${libext}_SOURCES ="
if test "$libtool" = true; then
echo "${libname}_${libext}_LDFLAGS = \$(AM_LDFLAGS)"
+ echo "${libname}_${libext}_LDFLAGS += -no-undefined"
+ # Synthesize an ${libname}_${libext}_LDFLAGS augmentation by combining
+ # the link dependencies of all modules.
+ for module in $modules; do
+ func_verify_nontests_module
+ if test -n "$module"; then
+ func_get_link_directive "$module"
+ fi
+ done \
+ | LC_ALL=C sed -e '/^$/d' -e 's/ when linking with libtool.*//' \
+ | LC_ALL=C sort -u \
+ | LC_ALL=C sed -e 's/^/'"${libname}_${libext}"'_LDFLAGS += /'
fi
echo
if test -n "$pobase"; then
# func_import modules
# Uses also the variables
+# - mode import or add-import or remove-import or update
# - destdir target directory
# - local_gnulib_dir from --local-dir
# - modcache true or false, from --cache-modules/--no-cache-modules
# - verbose integer, default 0, inc/decremented by --verbose/--quiet
# - libname library name
+# - supplied_libname true if --lib was given, blank otherwise
# - sourcebase directory relative to destdir where to place source code
# - m4base directory relative to destdir where to place *.m4 macros
# - pobase directory relative to destdir where to place *.po files
func_import ()
{
# Get the cached settings.
+ # In 'import' mode, we read them only for the purpose of knowing the old
+ # installed file list, and don't use them as defaults.
cached_local_gnulib_dir=
cached_specified_modules=
cached_incobsolete=
fi
fi
- # Merge the cached settings with the specified ones.
- # The m4base must be the same as expected from the pathname.
- if test -n "$cached_m4base" && test "$cached_m4base" != "$m4base"; then
- func_fatal_error "$m4base/gnulib-cache.m4 is expected to contain gl_M4_BASE([$m4base])"
- fi
- # The local_gnulib_dir defaults to the cached one. Recall that the cached one
- # is relative to $destdir, whereas the one we use is relative to . or absolute.
- if test -z "$local_gnulib_dir"; then
- if test -n "$cached_local_gnulib_dir"; then
- case "$destdir" in
- /*)
- local_gnulib_dir="$destdir/$cached_local_gnulib_dir" ;;
- *)
- case "$cached_local_gnulib_dir" in
- /*)
- local_gnulib_dir="$destdir/$cached_local_gnulib_dir" ;;
- *)
- func_relconcat "$destdir" "$cached_local_gnulib_dir"
- local_gnulib_dir="$relconcat" ;;
- esac ;;
- esac
+ if test "$mode" = import; then
+ # In 'import' mode, the new set of specified modules overrides the cached
+ # set of modules. Ignore the cached settings.
+ specified_modules="$1"
+ else
+ # Merge the cached settings with the specified ones.
+ # The m4base must be the same as expected from the pathname.
+ if test -n "$cached_m4base" && test "$cached_m4base" != "$m4base"; then
+ func_fatal_error "$m4base/gnulib-cache.m4 is expected to contain gl_M4_BASE([$m4base])"
fi
- fi
- # Append the cached and the specified module names. So that
- # "gnulib-tool --import foo" means to add the module foo.
- specified_modules="$cached_specified_modules $1"
- # Included obsolete modules among the dependencies if specified either way.
- if test -z "$incobsolete"; then
- incobsolete="$cached_incobsolete"
- fi
- # Included special kinds of tests modules among the dependencies if specified
- # either way.
- if test -z "$inc_cxx_tests"; then
- inc_cxx_tests="$cached_inc_cxx_tests"
- fi
- if test -z "$inc_longrunning_tests"; then
- inc_longrunning_tests="$cached_inc_longrunning_tests"
- fi
- if test -z "$inc_privileged_tests"; then
- inc_privileged_tests="$cached_inc_privileged_tests"
- fi
- if test -z "$inc_unportable_tests"; then
- inc_unportable_tests="$cached_inc_unportable_tests"
- fi
- if test -z "$inc_all_tests"; then
- inc_all_tests="$cached_inc_all_tests"
- fi
- # --without-*-tests options are not supported here.
- excl_cxx_tests=
- excl_longrunning_tests=
- excl_privileged_tests=
- excl_unportable_tests=
- # Append the cached and the specified avoidlist. This is probably better
- # than dropping the cached one when --avoid is specified at least once.
- avoidlist=`for m in $cached_avoidlist $avoidlist; do echo $m; done | LC_ALL=C sort -u`
- avoidlist=`echo $avoidlist`
-
- # The sourcebase defaults to the cached one.
- if test -z "$sourcebase"; then
- sourcebase="$cached_sourcebase"
+ # The local_gnulib_dir defaults to the cached one. Recall that the cached one
+ # is relative to $destdir, whereas the one we use is relative to . or absolute.
+ if test -z "$local_gnulib_dir"; then
+ if test -n "$cached_local_gnulib_dir"; then
+ case "$destdir" in
+ /*)
+ local_gnulib_dir="$destdir/$cached_local_gnulib_dir" ;;
+ *)
+ case "$cached_local_gnulib_dir" in
+ /*)
+ local_gnulib_dir="$destdir/$cached_local_gnulib_dir" ;;
+ *)
+ func_relconcat "$destdir" "$cached_local_gnulib_dir"
+ local_gnulib_dir="$relconcat" ;;
+ esac ;;
+ esac
+ fi
+ fi
+ case $mode in
+ add-import)
+ # Append the cached and the specified module names. So that
+ # "gnulib-tool --add-import foo" means to add the module foo.
+ specified_modules="$cached_specified_modules $1"
+ ;;
+ remove-import)
+ # Take the cached module names, minus the specified module names.
+ specified_modules=
+ if $have_associative; then
+ # Use an associative array, for O(N) worst-case run time.
+ declare -A to_remove
+ for m in $1; do
+ eval 'to_remove[$m]=yes'
+ done
+ for module in $cached_specified_modules; do
+ if eval 'test -z "${to_remove[$module]}"'; then
+ func_append specified_modules "$module "
+ fi
+ done
+ else
+ # This loop has O(N²) worst-case run time.
+ for module in $cached_specified_modules; do
+ to_remove=
+ for m in $1; do
+ if test "$m" = "$module"; then
+ to_remove=yes
+ break
+ fi
+ done
+ if test -z "$to_remove"; then
+ func_append specified_modules "$module "
+ fi
+ done
+ fi
+ ;;
+ update)
+ # Take the cached module names. There are no specified module names.
+ specified_modules="$cached_specified_modules"
+ ;;
+ esac
+ # Included obsolete modules among the dependencies if specified either way.
+ if test -z "$incobsolete"; then
+ incobsolete="$cached_incobsolete"
+ fi
+ # Included special kinds of tests modules among the dependencies if specified
+ # either way.
+ if test -z "$inc_cxx_tests"; then
+ inc_cxx_tests="$cached_inc_cxx_tests"
+ fi
+ if test -z "$inc_longrunning_tests"; then
+ inc_longrunning_tests="$cached_inc_longrunning_tests"
+ fi
+ if test -z "$inc_privileged_tests"; then
+ inc_privileged_tests="$cached_inc_privileged_tests"
+ fi
+ if test -z "$inc_unportable_tests"; then
+ inc_unportable_tests="$cached_inc_unportable_tests"
+ fi
+ if test -z "$inc_all_tests"; then
+ inc_all_tests="$cached_inc_all_tests"
+ fi
+ # Append the cached and the specified avoidlist. This is probably better
+ # than dropping the cached one when --avoid is specified at least once.
+ avoidlist=`for m in $cached_avoidlist $avoidlist; do echo $m; done | LC_ALL=C sort -u`
+ avoidlist=`echo $avoidlist`
+
+ # The sourcebase defaults to the cached one.
if test -z "$sourcebase"; then
- func_fatal_error "missing --source-base option"
+ sourcebase="$cached_sourcebase"
+ if test -z "$sourcebase"; then
+ func_fatal_error "missing --source-base option"
+ fi
fi
- fi
- # The pobase defaults to the cached one.
- if test -z "$pobase"; then
- pobase="$cached_pobase"
- fi
- # The docbase defaults to the cached one.
- if test -z "$docbase"; then
- docbase="$cached_docbase"
+ # The pobase defaults to the cached one.
+ if test -z "$pobase"; then
+ pobase="$cached_pobase"
+ fi
+ # The docbase defaults to the cached one.
if test -z "$docbase"; then
- func_fatal_error "missing --doc-base option. --doc-base has been introduced on 2006-07-11; if your last invocation of 'gnulib-tool --import' is before that date, you need to run 'gnulib-tool --import' once, with a --doc-base option."
+ docbase="$cached_docbase"
+ if test -z "$docbase"; then
+ func_fatal_error "missing --doc-base option. --doc-base has been introduced on 2006-07-11; if your last invocation of 'gnulib-tool --import' is before that date, you need to run 'gnulib-tool --import' once, with a --doc-base option."
+ fi
fi
- fi
- # The testsbase defaults to the cached one.
- if test -z "$testsbase"; then
- testsbase="$cached_testsbase"
+ # The testsbase defaults to the cached one.
if test -z "$testsbase"; then
- func_fatal_error "missing --tests-base option"
+ testsbase="$cached_testsbase"
+ if test -z "$testsbase"; then
+ func_fatal_error "missing --tests-base option"
+ fi
fi
- fi
- # Require the tests if specified either way.
- if test -z "$inctests"; then
- inctests="$cached_inctests"
- fi
- # The libname defaults to the cached one.
- if test -z "$supplied_libname"; then
- libname="$cached_libname"
- if test -z "$libname"; then
- func_fatal_error "missing --lib option"
+ # Require the tests if specified either way.
+ if test -z "$inctests"; then
+ inctests="$cached_inctests"
fi
- fi
- # Require LGPL if specified either way.
- if test -z "$lgpl"; then
- lgpl="$cached_lgpl"
- fi
- # The makefile_name defaults to the cached one.
- if test -z "$makefile_name"; then
- makefile_name="$cached_makefile_name"
- fi
- # Use libtool if specified either way, or if guessed.
- if test -z "$libtool"; then
- if test -n "$cached_m4base"; then
- libtool="$cached_libtool"
- else
- libtool="$guessed_libtool"
+ # The libname defaults to the cached one.
+ if test -z "$supplied_libname"; then
+ libname="$cached_libname"
+ if test -z "$libname"; then
+ func_fatal_error "missing --lib option"
+ fi
fi
- fi
- # The macro_prefix defaults to the cached one.
- if test -z "$macro_prefix"; then
- macro_prefix="$cached_macro_prefix"
+ # Require LGPL if specified either way.
+ if test -z "$lgpl"; then
+ lgpl="$cached_lgpl"
+ fi
+ # The makefile_name defaults to the cached one.
+ if test -z "$makefile_name"; then
+ makefile_name="$cached_makefile_name"
+ fi
+ # Use libtool if specified either way, or if guessed.
+ if test -z "$libtool"; then
+ if test -n "$cached_m4base"; then
+ libtool="$cached_libtool"
+ else
+ libtool="$guessed_libtool"
+ fi
+ fi
+ # The macro_prefix defaults to the cached one.
if test -z "$macro_prefix"; then
- func_fatal_error "missing --macro-prefix option"
+ macro_prefix="$cached_macro_prefix"
+ if test -z "$macro_prefix"; then
+ func_fatal_error "missing --macro-prefix option"
+ fi
+ fi
+ # The po_domain defaults to the cached one.
+ if test -z "$po_domain"; then
+ po_domain="$cached_po_domain"
+ fi
+ # The vc_files defaults to the cached one.
+ if test -z "$vc_files"; then
+ vc_files="$cached_vc_files"
fi
fi
- # The po_domain defaults to the cached one.
- if test -z "$po_domain"; then
- po_domain="$cached_po_domain"
- fi
- # The vc_files defaults to the cached one.
- if test -z "$vc_files"; then
- vc_files="$cached_vc_files"
- fi
+ # --without-*-tests options are not supported here.
+ excl_cxx_tests=
+ excl_longrunning_tests=
+ excl_privileged_tests=
+ excl_unportable_tests=
# Canonicalize the list of specified modules.
specified_modules=`for m in $specified_modules; do echo $m; done | LC_ALL=C sort -u`
else
# Install the file.
# Don't protest if the file should be there but isn't: it happens
- # frequently that developers don't put autogenerated files into CVS.
+ # frequently that developers don't put autogenerated files under version control.
func_add_file
func_append added_files "$g$nl"
fi
echo "#"
echo "# This file represents the specification of how gnulib-tool is used."
echo "# It acts as a cache: It is written and read by gnulib-tool."
- echo "# In projects using CVS, this file is meant to be stored in CVS,"
- echo "# like the configure.ac and various Makefile.am files."
+ echo "# In projects that use version control, this file is meant to be put under"
+ echo "# version control, like the configure.ac and various Makefile.am files."
echo
echo
echo "# Specification in the form of a command-line invocation:"
echo "# This file represents the compiled summary of the specification in"
echo "# gnulib-cache.m4. It lists the computed macro invocations that need"
echo "# to be invoked from configure.ac."
- echo "# In projects using CVS, this file can be treated like other built files."
+ echo "# In projects that use version control, this file can be treated like"
+ echo "# other built files."
echo
echo
echo "# This macro should be invoked from $configure_ac, in the section"
# _LIBDEPS and _LTLIBDEPS variables are not needed if this library is
# created using libtool, because libtool already handles the dependencies.
if test "$libtool" != true; then
- libname_upper=`echo "$libname" | LC_ALL=C tr 'a-z-' 'A-Z_'`
+ libname_upper=`echo "$libname" | LC_ALL=C tr '[a-z]-' '[A-Z]_'`
echo " ${libname_upper}_LIBDEPS=\"\$gl_libdeps\""
echo " AC_SUBST([${libname_upper}_LIBDEPS])"
echo " ${libname_upper}_LTLIBDEPS=\"\$gl_ltlibdeps\""
echo "File list:"
echo "$files" | sed -e 's/^/ /'
fi
+ # Add files for which the copy in gnulib is newer than the one that
+ # "automake --add-missing --copy" would provide.
+ files="$files build-aux/config.guess"
+ files="$files build-aux/config.sub"
+ files=`for f in $files; do echo $f; done | LC_ALL=C sort -u`
rewritten='%REWRITTEN%'
sed_rewrite_files="\
*)
func_get_autoconf_snippet "$module" \
| sed -e "$sed_replace_build_aux"
+ if test "$module" = 'alloca' && test "$libtool" = true; then
+ echo 'changequote(,)dnl'
+ echo 'LTALLOCA=`echo "$ALLOCA" | sed -e '"'"'s/\.[^.]* /.lo /g;s/\.[^.]*$/.lo/'"'"'`'
+ echo 'changequote([, ])dnl'
+ echo 'AC_SUBST([LTALLOCA])'
+ fi
;;
esac
fi
# _LIBDEPS and _LTLIBDEPS variables are not needed if this library is
# created using libtool, because libtool already handles the dependencies.
if test "$libtool" != true; then
- libname_upper=`echo "$libname" | LC_ALL=C tr 'a-z-' 'A-Z_'`
+ libname_upper=`echo "$libname" | LC_ALL=C tr '[a-z]-' '[A-Z]_'`
echo " ${libname_upper}_LIBDEPS=\"\$gl_libdeps\""
echo " AC_SUBST([${libname_upper}_LIBDEPS])"
echo " ${libname_upper}_LTLIBDEPS=\"\$gl_ltlibdeps\""
if test -n "$module"; then
func_get_autoconf_snippet "$module" \
| sed -e "$sed_replace_build_aux"
+ if test "$module" = 'alloca' && test "$libtool" = true; then
+ echo 'changequote(,)dnl'
+ echo 'LTALLOCA=`echo "$ALLOCA" | sed -e '"'"'s/\.[^.]* /.lo /g;s/\.[^.]*$/.lo/'"'"'`'
+ echo 'changequote([, ])dnl'
+ echo 'AC_SUBST([LTALLOCA])'
+ fi
fi
done
func_emit_initmacro_end $macro_prefix
# _LIBDEPS and _LTLIBDEPS variables are not needed if this library is
# created using libtool, because libtool already handles the dependencies.
if test "$libtool" != true; then
- libname_upper=`echo "$libname" | LC_ALL=C tr 'a-z-' 'A-Z_'`
+ libname_upper=`echo "$libname" | LC_ALL=C tr '[a-z]-' '[A-Z]_'`
echo " ${libname_upper}_LIBDEPS=\"\$gl_libdeps\""
echo " AC_SUBST([${libname_upper}_LIBDEPS])"
echo " ${libname_upper}_LTLIBDEPS=\"\$gl_ltlibdeps\""
) || func_exit 1
fi
# Need to run configure and make once, to create built files that are to be
- # distributed (such as getdate.c).
+ # distributed (such as parse-datetime.c).
sed_remove_make_variables='s,[$]([A-Za-z0-9_]*),,g'
# Extract the value of "CLEANFILES += ..." and "MOSTLYCLEANFILES += ...".
cleaned_files=`sed -e "$sed_remove_backslash_newline" < "$testdir/$sourcebase/Makefile.am" \
done
;;
- import | update )
+ import | add-import | remove-import | update )
# Where to import.
if test -z "$destdir"; then
fi
# Determine where to apply func_import.
- if test -n "$m4base"; then
+ if test "$mode" = import; then
# Apply func_import to a particular gnulib directory.
- # Any number of additional modules can be given.
- if test ! -f "$destdir/$m4base"/gnulib-cache.m4; then
- # First use of gnulib in the given m4base.
- test -n "$supplied_libname" || supplied_libname=true
- test -n "$sourcebase" || sourcebase="lib"
- test -n "$docbase" || docbase="doc"
- test -n "$testsbase" || testsbase="tests"
- test -n "$macro_prefix" || macro_prefix="gl"
- fi
+ # The command line contains the complete specification; don't look at
+ # the contents of gnulib-cache.m4.
+ test -n "$supplied_libname" || supplied_libname=true
+ test -n "$sourcebase" || sourcebase="lib"
+ test -n "$m4base" || m4base="m4"
+ test -n "$docbase" || docbase="doc"
+ test -n "$testsbase" || testsbase="tests"
+ test -n "$macro_prefix" || macro_prefix="gl"
func_import "$*"
else
- # Apply func_import to all gnulib directories.
- # To get this list of directories, look at Makefile.am. (Not at
- # configure, because it may be omitted from CVS. Also, don't run
- # "find $destdir -name gnulib-cache.m4", as it might be too expensive.)
- m4dirs=
- m4dirs_count=0
- if test -f "$destdir"/Makefile.am; then
- aclocal_amflags=`sed -n -e 's/^ACLOCAL_AMFLAGS[ ]*=\(.*\)$/\1/p' "$destdir"/Makefile.am`
- m4dir_is_next=
- for arg in $aclocal_amflags; do
- if test -n "$m4dir_is_next"; then
- # Ignore absolute directory pathnames, like /usr/local/share/aclocal.
- case "$arg" in
- /*) ;;
- *)
- if test -f "$destdir/$arg"/gnulib-cache.m4; then
- func_append m4dirs " $arg"
- m4dirs_count=`expr $m4dirs_count + 1`
- fi
- ;;
- esac
- m4dir_is_next=
- else
- if test "X$arg" = "X-I"; then
- m4dir_is_next=yes
- else
+ if test -n "$m4base"; then
+ # Apply func_import to a particular gnulib directory.
+ # Any number of additional modules can be given.
+ if test ! -f "$destdir/$m4base"/gnulib-cache.m4; then
+ # First use of gnulib in the given m4base.
+ test -n "$supplied_libname" || supplied_libname=true
+ test -n "$sourcebase" || sourcebase="lib"
+ test -n "$docbase" || docbase="doc"
+ test -n "$testsbase" || testsbase="tests"
+ test -n "$macro_prefix" || macro_prefix="gl"
+ fi
+ func_import "$*"
+ else
+ # Apply func_import to all gnulib directories.
+ # To get this list of directories, look at Makefile.am. (Not at
+ # configure, because it may be omitted from version control. Also,
+ # don't run "find $destdir -name gnulib-cache.m4", as it might be
+ # too expensive.)
+ m4dirs=
+ m4dirs_count=0
+ if test -f "$destdir"/Makefile.am; then
+ aclocal_amflags=`sed -n -e 's/^ACLOCAL_AMFLAGS[ ]*=\(.*\)$/\1/p' "$destdir"/Makefile.am`
+ m4dir_is_next=
+ for arg in $aclocal_amflags; do
+ if test -n "$m4dir_is_next"; then
+ # Ignore absolute directory pathnames, like /usr/local/share/aclocal.
+ case "$arg" in
+ /*) ;;
+ *)
+ if test -f "$destdir/$arg"/gnulib-cache.m4; then
+ func_append m4dirs " $arg"
+ m4dirs_count=`expr $m4dirs_count + 1`
+ fi
+ ;;
+ esac
m4dir_is_next=
+ else
+ if test "X$arg" = "X-I"; then
+ m4dir_is_next=yes
+ else
+ m4dir_is_next=
+ fi
fi
+ done
+ else
+ # No Makefile.am! Oh well. Look at the last generated aclocal.m4.
+ if test -f "$destdir"/aclocal.m4; then
+ sedexpr1='s,^m4_include(\[\(.*\)])$,\1,p'
+ sedexpr2='s,^[^/]*$,.,'
+ sedexpr3='s,/[^/]*$,,'
+ m4dirs=`sed -n -e "$sedexpr1" aclocal.m4 | sed -e "$sedexpr2" -e "$sedexpr3" | LC_ALL=C sort -u`
+ m4dirs=`for arg in $m4dirs; do if test -f "$destdir/$arg"/gnulib-cache.m4; then echo $arg; fi; done`
+ m4dirs_count=`for arg in $m4dirs; do echo "$arg"; done | wc -l`
fi
- done
- else
- # No Makefile.am! Oh well. Look at the last generated aclocal.m4.
- if test -f "$destdir"/aclocal.m4; then
- sedexpr1='s,^m4_include(\[\(.*\)])$,\1,p'
- sedexpr2='s,^[^/]*$,.,'
- sedexpr3='s,/[^/]*$,,'
- m4dirs=`sed -n -e "$sedexpr1" aclocal.m4 | sed -e "$sedexpr2" -e "$sedexpr3" | LC_ALL=C sort -u`
- m4dirs_count=`printf %s "$m4dirs" | wc -l`
fi
- fi
- if test $m4dirs_count = 0; then
- # First use of gnulib in a package.
- # Any number of additional modules can be given.
- test -n "$supplied_libname" || supplied_libname=true
- test -n "$sourcebase" || sourcebase="lib"
- m4base="m4"
- test -n "$docbase" || docbase="doc"
- test -n "$testsbase" || testsbase="tests"
- test -n "$macro_prefix" || macro_prefix="gl"
- func_import "$*"
- else
- if test $m4dirs_count = 1; then
- # There's only one use of gnulib here. Assume the user means it.
+ if test $m4dirs_count = 0; then
+ # First use of gnulib in a package.
# Any number of additional modules can be given.
- for m4base in $m4dirs; do
- func_import "$*"
- done
+ test -n "$supplied_libname" || supplied_libname=true
+ test -n "$sourcebase" || sourcebase="lib"
+ m4base="m4"
+ test -n "$docbase" || docbase="doc"
+ test -n "$testsbase" || testsbase="tests"
+ test -n "$macro_prefix" || macro_prefix="gl"
+ func_import "$*"
else
- # Ambiguous - guess what the user meant.
- if test $# = 0; then
- # No further arguments. Guess the user wants to update all of them.
+ if test $m4dirs_count = 1; then
+ # There's only one use of gnulib here. Assume the user means it.
+ # Any number of additional modules can be given.
for m4base in $m4dirs; do
- # Perform func_import in a subshell, so that variable values
- # such as
- # local_gnulib_dir, incobsolete, inc_cxx_tests,
- # inc_longrunning_tests, inc_privileged_tests,
- # inc_unportable_tests, inc_all_tests, avoidlist, sourcebase,
- # m4base, pobase, docbase, testsbase, inctests, libname, lgpl,
- # makefile_name, libtool, macro_prefix, po_domain, vc_files
- # don't propagate from one directory to another.
- (func_import) || func_exit 1
+ func_import "$*"
done
else
- # Really ambiguous.
- func_fatal_error "Ambiguity: to which directory should the modules be added? Please specify at least --m4-base=..."
+ # Ambiguous - guess what the user meant.
+ if test $# = 0; then
+ # No further arguments. Guess the user wants to update all of them.
+ for m4base in $m4dirs; do
+ # Perform func_import in a subshell, so that variable values
+ # such as
+ # local_gnulib_dir, incobsolete, inc_cxx_tests,
+ # inc_longrunning_tests, inc_privileged_tests,
+ # inc_unportable_tests, inc_all_tests, avoidlist, sourcebase,
+ # m4base, pobase, docbase, testsbase, inctests, libname, lgpl,
+ # makefile_name, libtool, macro_prefix, po_domain, vc_files
+ # don't propagate from one directory to another.
+ (func_import) || func_exit 1
+ done
+ else
+ # Really ambiguous.
+ func_fatal_error "Ambiguity: to which directory should the modules be added? Please specify at least --m4-base=..."
+ fi
fi
fi
fi
else
# Install the file.
# Don't protest if the file should be there but isn't: it happens
- # frequently that developers don't put autogenerated files into CVS.
+ # frequently that developers don't put autogenerated files under version
+ # control.
func_add_file
fi
rm -f "$tmpfile"
#if HAVE_SYS_ACL_H
# include <sys/acl.h>
#endif
-#if defined HAVE_ACL && ! defined GETACLCNT && defined ACL_CNT
+#if defined HAVE_FACL && ! defined GETACLCNT && defined ACL_CNT
# define GETACLCNT ACL_CNT
#endif
extern int acl_access_nontrivial (acl_t);
# endif
-# elif HAVE_ACL && defined GETACL /* Solaris, Cygwin, not HP-UX */
+# elif HAVE_FACL && defined GETACL /* Solaris, Cygwin, not HP-UX */
/* Set to 1 if a file's mode is implicit by the ACL.
Set to 0 if a file's mode is stored independently from the ACL. */
Return 0 if it is trivial, i.e. equivalent to a simple stat() mode. */
extern int acl_nontrivial (struct acl *a);
+# elif HAVE_ACLSORT /* NonStop Kernel */
+
+/* Return 1 if the given ACL is non-trivial.
+ Return 0 if it is trivial, i.e. equivalent to a simple stat() mode. */
+extern int acl_nontrivial (int count, struct acl *entries);
+
# endif
#endif
#if __GNUC__ >= 3
@PRAGMA_SYSTEM_HEADER@
#endif
+@PRAGMA_COLUMNS@
/* Gnulib's sys/socket.h is responsible for pulling in winsock2.h etc
under MinGW.
#endif
#ifndef SIGSTKSZ
# define SIGSTKSZ 16384
+#elif HAVE_LIBSIGSEGV && SIGSTKSZ < 16384
+/* libsigsegv 2.6 through 2.8 have a bug where some architectures use
+ more than the Linux default of an 8k alternate stack when deciding
+ if a fault was caused by stack overflow. */
+# undef SIGSTKSZ
+# define SIGSTKSZ 16384
#endif
#include <stdlib.h>
#include <config.h>
/* Only the AC_FUNC_CALLOC macro defines 'calloc' already in config.h. */
#ifdef calloc
-# define NEED_CALLOC_GNU
+# define NEED_CALLOC_GNU 1
# undef calloc
+/* Whereas the gnulib module 'calloc-gnu' defines HAVE_CALLOC_GNU. */
+#elif GNULIB_CALLOC_GNU && !HAVE_CALLOC_GNU
+# define NEED_CALLOC_GNU 1
#endif
/* Specification. */
{
void *result;
-#ifdef NEED_CALLOC_GNU
+#if NEED_CALLOC_GNU
if (n == 0 || s == 0)
{
n = 1;
cdb_advance_fd (struct cd_buf *cdb, char const *dir)
{
int new_fd = openat (cdb->fd, dir,
- O_RDONLY | O_DIRECTORY | O_NOCTTY | O_NONBLOCK);
+ O_SEARCH | O_DIRECTORY | O_NOCTTY | O_NONBLOCK);
if (new_fd < 0)
return -1;
#endif
/* Like chdir, but fail if DIR is a symbolic link to a directory (or
- similar funny business), or if DIR is not readable. This avoids a
- minor race condition between when a directory is created or statted
- and when the process chdirs into it. */
+ similar funny business). This avoids a minor race condition
+ between when a directory is created or statted and when the process
+ chdirs into it.
+
+ On older systems lacking full support for O_SEARCH, this function
+ can also fail if DIR is not readable. */
int
chdir_no_follow (char const *dir)
{
int result = 0;
int saved_errno;
int fd = open (dir,
- O_RDONLY | O_DIRECTORY | O_NOCTTY | O_NOFOLLOW | O_NONBLOCK);
+ O_SEARCH | O_DIRECTORY | O_NOCTTY | O_NOFOLLOW | O_NONBLOCK);
if (fd < 0)
return -1;
return 0;
+#elif USE_ACL && HAVE_ACLSORT /* NonStop Kernel */
+
+ int count;
+ struct acl entries[NACLENTRIES];
+ int ret;
+
+ for (;;)
+ {
+ count = acl ((char *) src_name, ACL_CNT, NACLENTRIES, NULL);
+
+ if (count < 0)
+ {
+ if (0)
+ {
+ count = 0;
+ break;
+ }
+ else
+ return -2;
+ }
+
+ if (count == 0)
+ break;
+
+ if (count > NACLENTRIES)
+ /* If NACLENTRIES cannot be trusted, use dynamic memory allocation. */
+ abort ();
+
+ if (acl ((char *) src_name, ACL_GET, count, entries) == count)
+ break;
+ /* Huh? The number of ACL entries changed since the last call.
+ Repeat. */
+ }
+
+ if (count == 0)
+ return qset_acl (dst_name, dest_desc, mode);
+
+ ret = acl ((char *) dst_name, ACL_SET, count, entries);
+ if (ret < 0)
+ {
+ int saved_errno = errno;
+
+ if (0)
+ {
+ if (!acl_nontrivial (count, entries))
+ return chmod_or_fchmod (dst_name, dest_desc, mode);
+ }
+
+ chmod_or_fchmod (dst_name, dest_desc, mode);
+ errno = saved_errno;
+ return -1;
+ }
+
+ if (mode & (S_ISUID | S_ISGID | S_ISVTX))
+ {
+ /* We did not call chmod so far, and either the mode and the ACL are
+ separate or special bits are to be set which don't fit into ACLs. */
+
+ return chmod_or_fchmod (dst_name, dest_desc, mode);
+ }
+ return 0;
+
#else
return qset_acl (dst_name, dest_desc, mode);
#if __GNUC__ >= 3
@PRAGMA_SYSTEM_HEADER@
#endif
+@PRAGMA_COLUMNS@
/* Include the original <ctype.h>. */
/* The include_next requires a split double-inclusion guard. */
#if __GNUC__ >= 3
@PRAGMA_SYSTEM_HEADER@
#endif
+@PRAGMA_COLUMNS@
/* The include_next requires a split double-inclusion guard. */
#@INCLUDE_NEXT@ @NEXT_DIRENT_H@
_GL_FUNCDECL_RPL (dirfd, int, (DIR *) _GL_ARG_NONNULL ((1)));
_GL_CXXALIAS_RPL (dirfd, int, (DIR *));
# else
+# if defined __cplusplus && defined GNULIB_NAMESPACE && defined dirfd
+ /* dirfd is defined as a macro and not as a function.
+ Turn it into a function and get rid of the macro. */
+static inline int (dirfd) (DIR *dp) { return dirfd (dp); }
+# undef dirfd
+# endif
# if !(@HAVE_DECL_DIRFD@ || defined dirfd)
_GL_FUNCDECL_SYS (dirfd, int, (DIR *) _GL_ARG_NONNULL ((1)));
# endif
#include "cloexec.h"
-#ifndef O_CLOEXEC
-# define O_CLOEXEC 0
-#endif
-
/* Like dup, but do not return STDIN_FILENO, STDOUT_FILENO, or
STDERR_FILENO. If FLAG contains O_CLOEXEC, behave like
fcntl(F_DUPFD_CLOEXEC) rather than fcntl(F_DUPFD). */
/* Upper bound on getdtablesize(). See lib/getdtablesize.c. */
# define OPEN_MAX_MAX 0x10000
-#else
-/* Unix API. */
-
-# ifndef O_CLOEXEC
-# define O_CLOEXEC 0
-# endif
-
#endif
int
#if __GNUC__ >= 3
@PRAGMA_SYSTEM_HEADER@
#endif
+@PRAGMA_COLUMNS@
/* The include_next requires a split double-inclusion guard. */
#@INCLUDE_NEXT@ @NEXT_ERRNO_H@
/* 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.
# 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
#if __GNUC__ >= 3
@PRAGMA_SYSTEM_HEADER@
#endif
+@PRAGMA_COLUMNS@
#if defined __need_system_fcntl_h
/* Special invocation convention. */
# define O_CLOEXEC O_NOINHERIT
#endif
+#ifndef O_CLOEXEC
+# define O_CLOEXEC 0
+#endif
+
#ifndef O_DIRECT
# define O_DIRECT 0
#endif
# define O_DSYNC 0
#endif
+#ifndef O_EXEC
+# define O_EXEC O_RDONLY /* This is often close enough in older systems. */
+#endif
+
#ifndef O_NDELAY
# define O_NDELAY 0
#endif
# define O_RSYNC 0
#endif
+#ifndef O_SEARCH
+# define O_SEARCH O_RDONLY /* This is often close enough in older systems. */
+#endif
+
#ifndef O_SYNC
# define O_SYNC 0
#endif
# include "dirent--.h"
# endif
-/* Replacement for Solaris' function by the same name.
- <http://www.google.com/search?q=fdopendir+site:docs.sun.com>
+static DIR *fdopendir_with_dup (int, int);
+static DIR *fd_clone_opendir (int);
+
+/* Replacement for POSIX fdopendir.
+
First, try to simulate it via opendir ("/proc/self/fd/FD"). Failing
that, simulate it by using fchdir metadata, or by doing
save_cwd/fchdir/opendir(".")/restore_cwd.
If either the save_cwd or the restore_cwd fails (relatively unlikely),
then give a diagnostic and exit nonzero.
- Otherwise, this function works just like Solaris' fdopendir.
+
+ If successful, the resulting stream is based on FD in
+ implementations where streams are based on file descriptors and in
+ applications where no other thread or signal handler allocates or
+ frees file descriptors. In other cases, consult dirfd on the result
+ to find out whether FD is still being used.
+
+ Otherwise, this function works just like POSIX fdopendir.
W A R N I N G:
- Unlike other fd-related functions, this one effectively consumes
- its FD parameter. The caller should not close or otherwise
- manipulate FD if this function returns successfully. Also, this
- implementation does not guarantee that dirfd(fdopendir(n))==n;
- the open directory stream may use a clone of FD, or have no
- associated fd at all. */
+
+ Unlike other fd-related functions, this one places constraints on FD.
+ If this function returns successfully, FD is under control of the
+ dirent.h system, and the caller should not close or modify the state of
+ FD other than by the dirent.h functions. */
DIR *
fdopendir (int fd)
{
+ return fdopendir_with_dup (fd, -1);
+}
+
+/* Like fdopendir, except that if OLDER_DUPFD is not -1, it is known
+ to be a dup of FD which is less than FD - 1 and which will be
+ closed by the caller and not otherwise used by the caller. This
+ function makes sure that FD is closed and all file descriptors less
+ than FD are open, and then calls fd_clone_opendir on a dup of FD.
+ That way, barring race conditions, fd_clone_opendir returns a
+ stream whose file descriptor is FD. */
+static DIR *
+fdopendir_with_dup (int fd, int older_dupfd)
+{
+ int dupfd = dup (fd);
+ if (dupfd < 0 && errno == EMFILE)
+ dupfd = older_dupfd;
+ if (dupfd < 0)
+ return NULL;
+ else
+ {
+ DIR *dir;
+ int saved_errno;
+ if (dupfd < fd - 1 && dupfd != older_dupfd)
+ {
+ dir = fdopendir_with_dup (fd, dupfd);
+ saved_errno = errno;
+ }
+ else
+ {
+ close (fd);
+ dir = fd_clone_opendir (dupfd);
+ saved_errno = errno;
+ if (! dir)
+ {
+ int fd1 = dup (dupfd);
+ if (fd1 != fd)
+ openat_save_fail (fd1 < 0 ? errno : EBADF);
+ }
+ }
+
+ if (dupfd != older_dupfd)
+ close (dupfd);
+ errno = saved_errno;
+ return dir;
+ }
+}
+
+/* Like fdopendir, except the result controls a clone of FD. It is
+ the caller's responsibility both to close FD and (if the result is
+ not null) to closedir the result. */
+static DIR *
+fd_clone_opendir (int fd)
+{
int saved_errno;
DIR *dir;
dir = opendir (name);
saved_errno = errno;
# else /* !REPLACE_FCHDIR */
+
+ /* Occupy the destination FD slot, so that save_cwd cannot hijack it. */
+ int fd_reserve = dup (fd);
+ if (fd_reserve < 0)
+ {
+ saved_errno = errno;
+ dir = NULL;
+ goto fail;
+ }
+
struct saved_cwd saved_cwd;
if (save_cwd (&saved_cwd) != 0)
openat_save_fail (errno);
+ /* Liberate the target file descriptor, so that opendir uses it. */
+ close (fd_reserve);
+
if (fchdir (fd) != 0)
{
dir = NULL;
# endif /* !REPLACE_FCHDIR */
}
- if (dir)
- close (fd);
+ fail:
if (proc_file != buf)
free (proc_file);
errno = saved_errno;
use just futimes (or equivalent) instead of utimes (or equivalent),
and fail if on an old system without futimes (or equivalent).
If TIMESPEC is null, set the time stamps to the current time.
+ ATFLAG is passed to utimensat if FD is negative or futimens was
+ unsupported, which can allow operation on FILE as a symlink.
Return 0 on success, -1 (setting errno) on failure. */
int
-fdutimensat (int dir, char const *file, int fd, struct timespec const ts[2])
+fdutimensat (int fd, int dir, char const *file, struct timespec const ts[2],
+ int atflag)
{
int result = 1;
if (0 <= fd)
result = futimens (fd, ts);
if (file && (fd < 0 || (result == -1 && errno == ENOSYS)))
- result = utimensat (dir, file, ts, 0);
+ result = utimensat (dir, file, ts, atflag);
if (result == 1)
{
errno = EBADF;
# endif
-#elif USE_ACL && HAVE_ACL && defined GETACL /* Solaris, Cygwin, not HP-UX */
+#elif USE_ACL && HAVE_FACL && defined GETACL /* Solaris, Cygwin, not HP-UX */
# if !defined ACL_NO_TRIVIAL /* Solaris <= 10, Cygwin */
# endif
+#elif USE_ACL && HAVE_ACLSORT /* NonStop Kernel */
+
+/* Test an ACL retrieved with ACL_GET.
+ Return 1 if the given ACL, consisting of COUNT entries, is non-trivial.
+ Return 0 if it is trivial, i.e. equivalent to a simple stat() mode. */
+int
+acl_nontrivial (int count, struct acl *entries)
+{
+ int i;
+
+ for (i = 0; i < count; i++)
+ {
+ struct acl *ace = &entries[i];
+
+ /* Note: If ace->a_type = USER_OBJ, ace->a_id is the st_uid from stat().
+ If ace->a_type = GROUP_OBJ, ace->a_id is the st_gid from stat().
+ We don't need to check ace->a_id in these cases. */
+ if (!(ace->a_type == USER_OBJ /* no need to check ace->a_id here */
+ || ace->a_type == GROUP_OBJ /* no need to check ace->a_id here */
+ || ace->a_type == CLASS_OBJ
+ || ace->a_type == OTHER_OBJ))
+ return 1;
+ }
+ return 0;
+}
+
#endif
return ACL_NOT_WELL_SUPPORTED (errno) ? 0 : -1;
return ret;
-# elif HAVE_ACL && defined GETACLCNT /* Solaris, Cygwin, not HP-UX */
+# elif HAVE_FACL && defined GETACLCNT /* Solaris, Cygwin, not HP-UX */
# if defined ACL_NO_TRIVIAL
return acl_nontrivial (&u.a);
+# elif HAVE_ACLSORT /* NonStop Kernel */
+
+ int count;
+ struct acl entries[NACLENTRIES];
+
+ for (;;)
+ {
+ count = acl ((char *) name, ACL_CNT, NACLENTRIES, NULL);
+
+ if (count < 0)
+ return -1;
+
+ if (count == 0)
+ return 0;
+
+ if (count > NACLENTRIES)
+ /* If NACLENTRIES cannot be trusted, use dynamic memory
+ allocation. */
+ abort ();
+
+ /* If there are more than 4 entries, there cannot be only the
+ four base ACL entries. */
+ if (count > 4)
+ return 1;
+
+ if (acl ((char *) name, ACL_GET, count, entries) == count)
+ return acl_nontrivial (count, entries);
+ /* Huh? The number of ACL entries changed since the last call.
+ Repeat. */
+ }
+
# endif
}
#endif
#define SIZEOF_LDBL ((LDBL_TOTAL_BIT + CHAR_BIT - 1) / CHAR_BIT)
/* Verify that SIZEOF_FLT <= sizeof (float) etc. */
-typedef int verify_sizeof_flt[2 * (SIZEOF_FLT <= sizeof (float)) - 1];
-typedef int verify_sizeof_dbl[2 * (SIZEOF_DBL <= sizeof (double)) - 1];
-typedef int verify_sizeof_ldbl[2 * (SIZEOF_LDBL <= sizeof (long double)) - 1];
+typedef int verify_sizeof_flt[SIZEOF_FLT <= sizeof (float) ? 1 : -1];
+typedef int verify_sizeof_dbl[SIZEOF_DBL <= sizeof (double) ? 1 : - 1];
+typedef int verify_sizeof_ldbl[SIZEOF_LDBL <= sizeof (long double) ? 1 : - 1];
#endif /* _FLOATPLUS_H */
#if __GNUC__ >= 3
@PRAGMA_SYSTEM_HEADER@
#endif
+@PRAGMA_COLUMNS@
/* The include_next requires a split double-inclusion guard. */
#@INCLUDE_NEXT@ @NEXT_FLOAT_H@
# define fchdir __fchdir
# undef open
# define open __open
-# undef opendir
-# define opendir __opendir
# undef readdir
# define readdir __readdir
#else
/* FIXME: if others need this function, move it into lib/openat.c */
static inline DIR *
internal_function
-opendirat (int fd, char const *dir)
+opendirat (int fd, char const *dir, int extra_flags, int *pdir_fd)
{
int new_fd = openat (fd, dir,
- O_RDONLY | O_DIRECTORY | O_NOCTTY | O_NONBLOCK);
+ (O_RDONLY | O_DIRECTORY | O_NOCTTY | O_NONBLOCK
+ | extra_flags));
DIR *dirp;
if (new_fd < 0)
return NULL;
set_cloexec_flag (new_fd, true);
dirp = fdopendir (new_fd);
- if (dirp == NULL)
+ if (dirp)
+ *pdir_fd = new_fd;
+ else
{
int saved_errno = errno;
close (new_fd);
internal_function
diropen (FTS const *sp, char const *dir)
{
- int open_flags = (O_RDONLY | O_DIRECTORY | O_NOCTTY | O_NONBLOCK
+ int open_flags = (O_SEARCH | O_DIRECTORY | O_NOCTTY | O_NONBLOCK
| (ISSET (FTS_PHYSICAL) ? O_NOFOLLOW : 0));
int fd = (ISSET (FTS_CWDFD)
early, doing it here saves us the trouble of ensuring
later (where it'd be messier) that "." can in fact
be opened. If not, revert to FTS_NOCHDIR mode. */
- int fd = open (".", O_RDONLY);
+ int fd = open (".", O_SEARCH);
if (fd < 0)
{
/* Even if `.' is unreadable, don't revert to FTS_NOCHDIR mode
bool nostat;
size_t len, maxlen, new_len;
char *cp;
+ int dir_fd;
/* Set current node pointer. */
cur = sp->fts_cur;
oflag = DTF_HIDEW|DTF_NODUP|DTF_REWIND;
#else
# define __opendir2(file, flag) \
- ( ! ISSET(FTS_NOCHDIR) && ISSET(FTS_CWDFD) \
- ? opendirat(sp->fts_cwd_fd, file) \
- : opendir(file))
+ opendirat((! ISSET(FTS_NOCHDIR) && ISSET(FTS_CWDFD) \
+ ? sp->fts_cwd_fd : AT_FDCWD), \
+ file, \
+ ((ISSET(FTS_PHYSICAL) \
+ && ! (ISSET(FTS_COMFOLLOW) \
+ && cur->fts_level == FTS_ROOTLEVEL)) \
+ ? O_NOFOLLOW : 0), \
+ &dir_fd)
#endif
if ((dirp = __opendir2(cur->fts_accpath, oflag)) == NULL) {
if (type == BREAD) {
* checking FTS_NS on the returned nodes.
*/
if (nlinks || type == BREAD) {
- int dir_fd = dirfd(dirp);
- if (ISSET(FTS_CWDFD) && 0 <= dir_fd)
+ if (ISSET(FTS_CWDFD))
{
dir_fd = dup (dir_fd);
- set_cloexec_flag (dir_fd, true);
+ if (0 <= dir_fd)
+ set_cloexec_flag (dir_fd, true);
}
if (dir_fd < 0 || fts_safe_changedir(sp, cur, dir_fd, NULL)) {
if (nlinks && type == BREAD)
int fd = i_ring_pop (&fd_w);
if (0 <= fd)
{
- int parent_fd = openat (cwd_fd, "..", O_RDONLY);
+ int parent_fd = openat (cwd_fd, "..", O_SEARCH);
if (parent_fd < 0)
{
// Warn?
/* fdutimens also works around bugs in native futimens, when running
with glibc compiled against newer headers but on a Linux kernel
older than 2.6.32. */
- return fdutimens (NULL, fd, times);
+ return fdutimens (fd, NULL, times);
}
# define WIN32_NATIVE
#endif
+/* gl_sockets_startup */
+#include "sockets.h"
+
#ifdef WIN32_NATIVE
typedef int (WSAAPI *getaddrinfo_func) (const char*, const char*,
const struct addrinfo*,
return 0;
}
+ gl_sockets_startup (SOCKETS_1_1);
+
return 1;
}
#endif
dirstream = fdopendir (fd);
if (dirstream == NULL)
goto lose;
- /* Reset fd. It may have been closed by fdopendir. */
- fd = dirfd (dirstream);
fd_needs_closing = false;
#else
dirstream = __opendir (dotlist);
-/* Parse a string into an internal time stamp.
-
- Copyright (C) 1995, 1997, 1998, 2003, 2004, 2007, 2009, 2010 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/>. */
-
-#include <stdbool.h>
-#include <time.h>
-
-bool get_date (struct timespec *, char const *, struct timespec const *);
+/* Obsolete; consider using parse-datetime.h instead. */
+#include "parse-datetime.h"
+#define get_date(a, b, c) parse_datetime (a, b, c)
+++ /dev/null
-%{
-/* Parse a string into an internal time stamp.
-
- Copyright (C) 1999, 2000, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
- 2010 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/>. */
-
-/* Originally written by Steven M. Bellovin <smb@research.att.com> while
- at the University of North Carolina at Chapel Hill. Later tweaked by
- a couple of people on Usenet. Completely overhauled by Rich $alz
- <rsalz@bbn.com> and Jim Berets <jberets@bbn.com> in August, 1990.
-
- Modified by Paul Eggert <eggert@twinsun.com> in August 1999 to do
- the right thing about local DST. Also modified by Paul Eggert
- <eggert@cs.ucla.edu> in February 2004 to support
- nanosecond-resolution time stamps, and in October 2004 to support
- TZ strings in dates. */
-
-/* FIXME: Check for arithmetic overflow in all cases, not just
- some of them. */
-
-#include <config.h>
-
-#include "getdate.h"
-
-#include "intprops.h"
-#include "timespec.h"
-#include "verify.h"
-
-/* There's no need to extend the stack, so there's no need to involve
- alloca. */
-#define YYSTACK_USE_ALLOCA 0
-
-/* Tell Bison how much stack space is needed. 20 should be plenty for
- this grammar, which is not right recursive. Beware setting it too
- high, since that might cause problems on machines whose
- implementations have lame stack-overflow checking. */
-#define YYMAXDEPTH 20
-#define YYINITDEPTH YYMAXDEPTH
-
-/* Since the code of getdate.y is not included in the Emacs executable
- itself, there is no need to #define static in this file. Even if
- the code were included in the Emacs executable, it probably
- wouldn't do any harm to #undef it here; this will only cause
- problems if we try to write to a static variable, which I don't
- think this code needs to do. */
-#ifdef emacs
-# undef static
-#endif
-
-#include <c-ctype.h>
-#include <limits.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "xalloc.h"
-
-
-/* ISDIGIT differs from isdigit, as follows:
- - Its arg may be any int or unsigned int; it need not be an unsigned char
- or EOF.
- - It's typically faster.
- POSIX says that only '0' through '9' are digits. Prefer ISDIGIT to
- isdigit unless it's important to use the locale's definition
- of `digit' even when the host does not conform to POSIX. */
-#define ISDIGIT(c) ((unsigned int) (c) - '0' <= 9)
-
-/* Shift A right by B bits portably, by dividing A by 2**B and
- truncating towards minus infinity. A and B should be free of side
- effects, and B should be in the range 0 <= B <= INT_BITS - 2, where
- INT_BITS is the number of useful bits in an int. GNU code can
- assume that INT_BITS is at least 32.
-
- ISO C99 says that A >> B is implementation-defined if A < 0. Some
- implementations (e.g., UNICOS 9.0 on a Cray Y-MP EL) don't shift
- right in the usual way when A < 0, so SHR falls back on division if
- ordinary A >> B doesn't seem to be the usual signed shift. */
-#define SHR(a, b) \
- (-1 >> 1 == -1 \
- ? (a) >> (b) \
- : (a) / (1 << (b)) - ((a) % (1 << (b)) < 0))
-
-#define EPOCH_YEAR 1970
-#define TM_YEAR_BASE 1900
-
-#define HOUR(x) ((x) * 60)
-
-/* long_time_t is a signed integer type that contains all time_t values. */
-verify (TYPE_IS_INTEGER (time_t));
-#if TIME_T_FITS_IN_LONG_INT
-typedef long int long_time_t;
-#else
-typedef time_t long_time_t;
-#endif
-
-/* Lots of this code assumes time_t and time_t-like values fit into
- long_time_t. */
-verify (TYPE_MINIMUM (long_time_t) <= TYPE_MINIMUM (time_t)
- && TYPE_MAXIMUM (time_t) <= TYPE_MAXIMUM (long_time_t));
-
-/* FIXME: It also assumes that signed integer overflow silently wraps around,
- but this is not true any more with recent versions of GCC 4. */
-
-/* An integer value, and the number of digits in its textual
- representation. */
-typedef struct
-{
- bool negative;
- long int value;
- size_t digits;
-} textint;
-
-/* An entry in the lexical lookup table. */
-typedef struct
-{
- char const *name;
- int type;
- int value;
-} table;
-
-/* Meridian: am, pm, or 24-hour style. */
-enum { MERam, MERpm, MER24 };
-
-enum { BILLION = 1000000000, LOG10_BILLION = 9 };
-
-/* Relative times. */
-typedef struct
-{
- /* Relative year, month, day, hour, minutes, seconds, and nanoseconds. */
- long int year;
- long int month;
- long int day;
- long int hour;
- long int minutes;
- long_time_t seconds;
- long int ns;
-} relative_time;
-
-#if HAVE_COMPOUND_LITERALS
-# define RELATIVE_TIME_0 ((relative_time) { 0, 0, 0, 0, 0, 0, 0 })
-#else
-static relative_time const RELATIVE_TIME_0;
-#endif
-
-/* Information passed to and from the parser. */
-typedef struct
-{
- /* The input string remaining to be parsed. */
- const char *input;
-
- /* N, if this is the Nth Tuesday. */
- long int day_ordinal;
-
- /* Day of week; Sunday is 0. */
- int day_number;
-
- /* tm_isdst flag for the local zone. */
- int local_isdst;
-
- /* Time zone, in minutes east of UTC. */
- long int time_zone;
-
- /* Style used for time. */
- int meridian;
-
- /* Gregorian year, month, day, hour, minutes, seconds, and nanoseconds. */
- textint year;
- long int month;
- long int day;
- long int hour;
- long int minutes;
- struct timespec seconds; /* includes nanoseconds */
-
- /* Relative year, month, day, hour, minutes, seconds, and nanoseconds. */
- relative_time rel;
-
- /* Presence or counts of nonterminals of various flavors parsed so far. */
- bool timespec_seen;
- bool rels_seen;
- size_t dates_seen;
- size_t days_seen;
- size_t local_zones_seen;
- size_t dsts_seen;
- size_t times_seen;
- size_t zones_seen;
-
- /* Table of local time zone abbrevations, terminated by a null entry. */
- table local_time_zone_table[3];
-} parser_control;
-
-union YYSTYPE;
-static int yylex (union YYSTYPE *, parser_control *);
-static int yyerror (parser_control const *, char const *);
-static long int time_zone_hhmm (parser_control *, textint, long int);
-
-/* Extract into *PC any date and time info from a string of digits
- of the form e.g., YYYYMMDD, YYMMDD, HHMM, HH (and sometimes YYY,
- YYYY, ...). */
-static void
-digits_to_date_time (parser_control *pc, textint text_int)
-{
- if (pc->dates_seen && ! pc->year.digits
- && ! pc->rels_seen && (pc->times_seen || 2 < text_int.digits))
- pc->year = text_int;
- else
- {
- if (4 < text_int.digits)
- {
- pc->dates_seen++;
- pc->day = text_int.value % 100;
- pc->month = (text_int.value / 100) % 100;
- pc->year.value = text_int.value / 10000;
- pc->year.digits = text_int.digits - 4;
- }
- else
- {
- pc->times_seen++;
- if (text_int.digits <= 2)
- {
- pc->hour = text_int.value;
- pc->minutes = 0;
- }
- else
- {
- pc->hour = text_int.value / 100;
- pc->minutes = text_int.value % 100;
- }
- pc->seconds.tv_sec = 0;
- pc->seconds.tv_nsec = 0;
- pc->meridian = MER24;
- }
- }
-}
-
-/* Increment PC->rel by FACTOR * REL (FACTOR is 1 or -1). */
-static void
-apply_relative_time (parser_control *pc, relative_time rel, int factor)
-{
- pc->rel.ns += factor * rel.ns;
- pc->rel.seconds += factor * rel.seconds;
- pc->rel.minutes += factor * rel.minutes;
- pc->rel.hour += factor * rel.hour;
- pc->rel.day += factor * rel.day;
- pc->rel.month += factor * rel.month;
- pc->rel.year += factor * rel.year;
- pc->rels_seen = true;
-}
-
-/* Set PC-> hour, minutes, seconds and nanoseconds members from arguments. */
-static void
-set_hhmmss (parser_control *pc, long int hour, long int minutes,
- time_t sec, long int nsec)
-{
- pc->hour = hour;
- pc->minutes = minutes;
- pc->seconds.tv_sec = sec;
- pc->seconds.tv_nsec = nsec;
-}
-
-%}
-
-/* We want a reentrant parser, even if the TZ manipulation and the calls to
- localtime and gmtime are not reentrant. */
-%pure-parser
-%parse-param { parser_control *pc }
-%lex-param { parser_control *pc }
-
-/* This grammar has 20 shift/reduce conflicts. */
-%expect 20
-
-%union
-{
- long int intval;
- textint textintval;
- struct timespec timespec;
- relative_time rel;
-}
-
-%token tAGO tDST
-
-%token tYEAR_UNIT tMONTH_UNIT tHOUR_UNIT tMINUTE_UNIT tSEC_UNIT
-%token <intval> tDAY_UNIT tDAY_SHIFT
-
-%token <intval> tDAY tDAYZONE tLOCAL_ZONE tMERIDIAN
-%token <intval> tMONTH tORDINAL tZONE
-
-%token <textintval> tSNUMBER tUNUMBER
-%token <timespec> tSDECIMAL_NUMBER tUDECIMAL_NUMBER
-
-%type <intval> o_colon_minutes o_merid
-%type <timespec> seconds signed_seconds unsigned_seconds
-
-%type <rel> relunit relunit_snumber dayshift
-
-%%
-
-spec:
- timespec
- | items
- ;
-
-timespec:
- '@' seconds
- {
- pc->seconds = $2;
- pc->timespec_seen = true;
- }
- ;
-
-items:
- /* empty */
- | items item
- ;
-
-item:
- time
- { pc->times_seen++; }
- | local_zone
- { pc->local_zones_seen++; }
- | zone
- { pc->zones_seen++; }
- | date
- { pc->dates_seen++; }
- | day
- { pc->days_seen++; }
- | rel
- | number
- | hybrid
- ;
-
-time:
- tUNUMBER tMERIDIAN
- {
- set_hhmmss (pc, $1.value, 0, 0, 0);
- pc->meridian = $2;
- }
- | tUNUMBER ':' tUNUMBER o_merid
- {
- set_hhmmss (pc, $1.value, $3.value, 0, 0);
- pc->meridian = $4;
- }
- | tUNUMBER ':' tUNUMBER tSNUMBER o_colon_minutes
- {
- set_hhmmss (pc, $1.value, $3.value, 0, 0);
- pc->meridian = MER24;
- pc->zones_seen++;
- pc->time_zone = time_zone_hhmm (pc, $4, $5);
- }
- | tUNUMBER ':' tUNUMBER ':' unsigned_seconds o_merid
- {
- set_hhmmss (pc, $1.value, $3.value, $5.tv_sec, $5.tv_nsec);
- pc->meridian = $6;
- }
- | tUNUMBER ':' tUNUMBER ':' unsigned_seconds tSNUMBER o_colon_minutes
- {
- set_hhmmss (pc, $1.value, $3.value, $5.tv_sec, $5.tv_nsec);
- pc->meridian = MER24;
- pc->zones_seen++;
- pc->time_zone = time_zone_hhmm (pc, $6, $7);
- }
- ;
-
-local_zone:
- tLOCAL_ZONE
- {
- pc->local_isdst = $1;
- pc->dsts_seen += (0 < $1);
- }
- | tLOCAL_ZONE tDST
- {
- pc->local_isdst = 1;
- pc->dsts_seen += (0 < $1) + 1;
- }
- ;
-
-zone:
- tZONE
- { pc->time_zone = $1; }
- | tZONE relunit_snumber
- { pc->time_zone = $1;
- apply_relative_time (pc, $2, 1); }
- | tZONE tSNUMBER o_colon_minutes
- { pc->time_zone = $1 + time_zone_hhmm (pc, $2, $3); }
- | tDAYZONE
- { pc->time_zone = $1 + 60; }
- | tZONE tDST
- { pc->time_zone = $1 + 60; }
- ;
-
-day:
- tDAY
- {
- pc->day_ordinal = 0;
- pc->day_number = $1;
- }
- | tDAY ','
- {
- pc->day_ordinal = 0;
- pc->day_number = $1;
- }
- | tORDINAL tDAY
- {
- pc->day_ordinal = $1;
- pc->day_number = $2;
- }
- | tUNUMBER tDAY
- {
- pc->day_ordinal = $1.value;
- pc->day_number = $2;
- }
- ;
-
-date:
- tUNUMBER '/' tUNUMBER
- {
- pc->month = $1.value;
- pc->day = $3.value;
- }
- | tUNUMBER '/' tUNUMBER '/' tUNUMBER
- {
- /* Interpret as YYYY/MM/DD if the first value has 4 or more digits,
- otherwise as MM/DD/YY.
- The goal in recognizing YYYY/MM/DD is solely to support legacy
- machine-generated dates like those in an RCS log listing. If
- you want portability, use the ISO 8601 format. */
- if (4 <= $1.digits)
- {
- pc->year = $1;
- pc->month = $3.value;
- pc->day = $5.value;
- }
- else
- {
- pc->month = $1.value;
- pc->day = $3.value;
- pc->year = $5;
- }
- }
- | tUNUMBER tSNUMBER tSNUMBER
- {
- /* ISO 8601 format. YYYY-MM-DD. */
- pc->year = $1;
- pc->month = -$2.value;
- pc->day = -$3.value;
- }
- | tUNUMBER tMONTH tSNUMBER
- {
- /* e.g. 17-JUN-1992. */
- pc->day = $1.value;
- pc->month = $2;
- pc->year.value = -$3.value;
- pc->year.digits = $3.digits;
- }
- | tMONTH tSNUMBER tSNUMBER
- {
- /* e.g. JUN-17-1992. */
- pc->month = $1;
- pc->day = -$2.value;
- pc->year.value = -$3.value;
- pc->year.digits = $3.digits;
- }
- | tMONTH tUNUMBER
- {
- pc->month = $1;
- pc->day = $2.value;
- }
- | tMONTH tUNUMBER ',' tUNUMBER
- {
- pc->month = $1;
- pc->day = $2.value;
- pc->year = $4;
- }
- | tUNUMBER tMONTH
- {
- pc->day = $1.value;
- pc->month = $2;
- }
- | tUNUMBER tMONTH tUNUMBER
- {
- pc->day = $1.value;
- pc->month = $2;
- pc->year = $3;
- }
- ;
-
-rel:
- relunit tAGO
- { apply_relative_time (pc, $1, -1); }
- | relunit
- { apply_relative_time (pc, $1, 1); }
- | dayshift
- { apply_relative_time (pc, $1, 1); }
- ;
-
-relunit:
- tORDINAL tYEAR_UNIT
- { $$ = RELATIVE_TIME_0; $$.year = $1; }
- | tUNUMBER tYEAR_UNIT
- { $$ = RELATIVE_TIME_0; $$.year = $1.value; }
- | tYEAR_UNIT
- { $$ = RELATIVE_TIME_0; $$.year = 1; }
- | tORDINAL tMONTH_UNIT
- { $$ = RELATIVE_TIME_0; $$.month = $1; }
- | tUNUMBER tMONTH_UNIT
- { $$ = RELATIVE_TIME_0; $$.month = $1.value; }
- | tMONTH_UNIT
- { $$ = RELATIVE_TIME_0; $$.month = 1; }
- | tORDINAL tDAY_UNIT
- { $$ = RELATIVE_TIME_0; $$.day = $1 * $2; }
- | tUNUMBER tDAY_UNIT
- { $$ = RELATIVE_TIME_0; $$.day = $1.value * $2; }
- | tDAY_UNIT
- { $$ = RELATIVE_TIME_0; $$.day = $1; }
- | tORDINAL tHOUR_UNIT
- { $$ = RELATIVE_TIME_0; $$.hour = $1; }
- | tUNUMBER tHOUR_UNIT
- { $$ = RELATIVE_TIME_0; $$.hour = $1.value; }
- | tHOUR_UNIT
- { $$ = RELATIVE_TIME_0; $$.hour = 1; }
- | tORDINAL tMINUTE_UNIT
- { $$ = RELATIVE_TIME_0; $$.minutes = $1; }
- | tUNUMBER tMINUTE_UNIT
- { $$ = RELATIVE_TIME_0; $$.minutes = $1.value; }
- | tMINUTE_UNIT
- { $$ = RELATIVE_TIME_0; $$.minutes = 1; }
- | tORDINAL tSEC_UNIT
- { $$ = RELATIVE_TIME_0; $$.seconds = $1; }
- | tUNUMBER tSEC_UNIT
- { $$ = RELATIVE_TIME_0; $$.seconds = $1.value; }
- | tSDECIMAL_NUMBER tSEC_UNIT
- { $$ = RELATIVE_TIME_0; $$.seconds = $1.tv_sec; $$.ns = $1.tv_nsec; }
- | tUDECIMAL_NUMBER tSEC_UNIT
- { $$ = RELATIVE_TIME_0; $$.seconds = $1.tv_sec; $$.ns = $1.tv_nsec; }
- | tSEC_UNIT
- { $$ = RELATIVE_TIME_0; $$.seconds = 1; }
- | relunit_snumber
- ;
-
-relunit_snumber:
- tSNUMBER tYEAR_UNIT
- { $$ = RELATIVE_TIME_0; $$.year = $1.value; }
- | tSNUMBER tMONTH_UNIT
- { $$ = RELATIVE_TIME_0; $$.month = $1.value; }
- | tSNUMBER tDAY_UNIT
- { $$ = RELATIVE_TIME_0; $$.day = $1.value * $2; }
- | tSNUMBER tHOUR_UNIT
- { $$ = RELATIVE_TIME_0; $$.hour = $1.value; }
- | tSNUMBER tMINUTE_UNIT
- { $$ = RELATIVE_TIME_0; $$.minutes = $1.value; }
- | tSNUMBER tSEC_UNIT
- { $$ = RELATIVE_TIME_0; $$.seconds = $1.value; }
- ;
-
-dayshift:
- tDAY_SHIFT
- { $$ = RELATIVE_TIME_0; $$.day = $1; }
- ;
-
-seconds: signed_seconds | unsigned_seconds;
-
-signed_seconds:
- tSDECIMAL_NUMBER
- | tSNUMBER
- { $$.tv_sec = $1.value; $$.tv_nsec = 0; }
- ;
-
-unsigned_seconds:
- tUDECIMAL_NUMBER
- | tUNUMBER
- { $$.tv_sec = $1.value; $$.tv_nsec = 0; }
- ;
-
-number:
- tUNUMBER
- { digits_to_date_time (pc, $1); }
- ;
-
-hybrid:
- tUNUMBER relunit_snumber
- {
- /* Hybrid all-digit and relative offset, so that we accept e.g.,
- "YYYYMMDD +N days" as well as "YYYYMMDD N days". */
- digits_to_date_time (pc, $1);
- apply_relative_time (pc, $2, 1);
- }
- ;
-
-o_colon_minutes:
- /* empty */
- { $$ = -1; }
- | ':' tUNUMBER
- { $$ = $2.value; }
- ;
-
-o_merid:
- /* empty */
- { $$ = MER24; }
- | tMERIDIAN
- { $$ = $1; }
- ;
-
-%%
-
-static table const meridian_table[] =
-{
- { "AM", tMERIDIAN, MERam },
- { "A.M.", tMERIDIAN, MERam },
- { "PM", tMERIDIAN, MERpm },
- { "P.M.", tMERIDIAN, MERpm },
- { NULL, 0, 0 }
-};
-
-static table const dst_table[] =
-{
- { "DST", tDST, 0 }
-};
-
-static table const month_and_day_table[] =
-{
- { "JANUARY", tMONTH, 1 },
- { "FEBRUARY", tMONTH, 2 },
- { "MARCH", tMONTH, 3 },
- { "APRIL", tMONTH, 4 },
- { "MAY", tMONTH, 5 },
- { "JUNE", tMONTH, 6 },
- { "JULY", tMONTH, 7 },
- { "AUGUST", tMONTH, 8 },
- { "SEPTEMBER",tMONTH, 9 },
- { "SEPT", tMONTH, 9 },
- { "OCTOBER", tMONTH, 10 },
- { "NOVEMBER", tMONTH, 11 },
- { "DECEMBER", tMONTH, 12 },
- { "SUNDAY", tDAY, 0 },
- { "MONDAY", tDAY, 1 },
- { "TUESDAY", tDAY, 2 },
- { "TUES", tDAY, 2 },
- { "WEDNESDAY",tDAY, 3 },
- { "WEDNES", tDAY, 3 },
- { "THURSDAY", tDAY, 4 },
- { "THUR", tDAY, 4 },
- { "THURS", tDAY, 4 },
- { "FRIDAY", tDAY, 5 },
- { "SATURDAY", tDAY, 6 },
- { NULL, 0, 0 }
-};
-
-static table const time_units_table[] =
-{
- { "YEAR", tYEAR_UNIT, 1 },
- { "MONTH", tMONTH_UNIT, 1 },
- { "FORTNIGHT",tDAY_UNIT, 14 },
- { "WEEK", tDAY_UNIT, 7 },
- { "DAY", tDAY_UNIT, 1 },
- { "HOUR", tHOUR_UNIT, 1 },
- { "MINUTE", tMINUTE_UNIT, 1 },
- { "MIN", tMINUTE_UNIT, 1 },
- { "SECOND", tSEC_UNIT, 1 },
- { "SEC", tSEC_UNIT, 1 },
- { NULL, 0, 0 }
-};
-
-/* Assorted relative-time words. */
-static table const relative_time_table[] =
-{
- { "TOMORROW", tDAY_SHIFT, 1 },
- { "YESTERDAY",tDAY_SHIFT, -1 },
- { "TODAY", tDAY_SHIFT, 0 },
- { "NOW", tDAY_SHIFT, 0 },
- { "LAST", tORDINAL, -1 },
- { "THIS", tORDINAL, 0 },
- { "NEXT", tORDINAL, 1 },
- { "FIRST", tORDINAL, 1 },
-/*{ "SECOND", tORDINAL, 2 }, */
- { "THIRD", tORDINAL, 3 },
- { "FOURTH", tORDINAL, 4 },
- { "FIFTH", tORDINAL, 5 },
- { "SIXTH", tORDINAL, 6 },
- { "SEVENTH", tORDINAL, 7 },
- { "EIGHTH", tORDINAL, 8 },
- { "NINTH", tORDINAL, 9 },
- { "TENTH", tORDINAL, 10 },
- { "ELEVENTH", tORDINAL, 11 },
- { "TWELFTH", tORDINAL, 12 },
- { "AGO", tAGO, 1 },
- { NULL, 0, 0 }
-};
-
-/* The universal time zone table. These labels can be used even for
- time stamps that would not otherwise be valid, e.g., GMT time
- stamps in London during summer. */
-static table const universal_time_zone_table[] =
-{
- { "GMT", tZONE, HOUR ( 0) }, /* Greenwich Mean */
- { "UT", tZONE, HOUR ( 0) }, /* Universal (Coordinated) */
- { "UTC", tZONE, HOUR ( 0) },
- { NULL, 0, 0 }
-};
-
-/* The time zone table. This table is necessarily incomplete, as time
- zone abbreviations are ambiguous; e.g. Australians interpret "EST"
- as Eastern time in Australia, not as US Eastern Standard Time.
- You cannot rely on getdate to handle arbitrary time zone
- abbreviations; use numeric abbreviations like `-0500' instead. */
-static table const time_zone_table[] =
-{
- { "WET", tZONE, HOUR ( 0) }, /* Western European */
- { "WEST", tDAYZONE, HOUR ( 0) }, /* Western European Summer */
- { "BST", tDAYZONE, HOUR ( 0) }, /* British Summer */
- { "ART", tZONE, -HOUR ( 3) }, /* Argentina */
- { "BRT", tZONE, -HOUR ( 3) }, /* Brazil */
- { "BRST", tDAYZONE, -HOUR ( 3) }, /* Brazil Summer */
- { "NST", tZONE, -(HOUR ( 3) + 30) }, /* Newfoundland Standard */
- { "NDT", tDAYZONE,-(HOUR ( 3) + 30) }, /* Newfoundland Daylight */
- { "AST", tZONE, -HOUR ( 4) }, /* Atlantic Standard */
- { "ADT", tDAYZONE, -HOUR ( 4) }, /* Atlantic Daylight */
- { "CLT", tZONE, -HOUR ( 4) }, /* Chile */
- { "CLST", tDAYZONE, -HOUR ( 4) }, /* Chile Summer */
- { "EST", tZONE, -HOUR ( 5) }, /* Eastern Standard */
- { "EDT", tDAYZONE, -HOUR ( 5) }, /* Eastern Daylight */
- { "CST", tZONE, -HOUR ( 6) }, /* Central Standard */
- { "CDT", tDAYZONE, -HOUR ( 6) }, /* Central Daylight */
- { "MST", tZONE, -HOUR ( 7) }, /* Mountain Standard */
- { "MDT", tDAYZONE, -HOUR ( 7) }, /* Mountain Daylight */
- { "PST", tZONE, -HOUR ( 8) }, /* Pacific Standard */
- { "PDT", tDAYZONE, -HOUR ( 8) }, /* Pacific Daylight */
- { "AKST", tZONE, -HOUR ( 9) }, /* Alaska Standard */
- { "AKDT", tDAYZONE, -HOUR ( 9) }, /* Alaska Daylight */
- { "HST", tZONE, -HOUR (10) }, /* Hawaii Standard */
- { "HAST", tZONE, -HOUR (10) }, /* Hawaii-Aleutian Standard */
- { "HADT", tDAYZONE, -HOUR (10) }, /* Hawaii-Aleutian Daylight */
- { "SST", tZONE, -HOUR (12) }, /* Samoa Standard */
- { "WAT", tZONE, HOUR ( 1) }, /* West Africa */
- { "CET", tZONE, HOUR ( 1) }, /* Central European */
- { "CEST", tDAYZONE, HOUR ( 1) }, /* Central European Summer */
- { "MET", tZONE, HOUR ( 1) }, /* Middle European */
- { "MEZ", tZONE, HOUR ( 1) }, /* Middle European */
- { "MEST", tDAYZONE, HOUR ( 1) }, /* Middle European Summer */
- { "MESZ", tDAYZONE, HOUR ( 1) }, /* Middle European Summer */
- { "EET", tZONE, HOUR ( 2) }, /* Eastern European */
- { "EEST", tDAYZONE, HOUR ( 2) }, /* Eastern European Summer */
- { "CAT", tZONE, HOUR ( 2) }, /* Central Africa */
- { "SAST", tZONE, HOUR ( 2) }, /* South Africa Standard */
- { "EAT", tZONE, HOUR ( 3) }, /* East Africa */
- { "MSK", tZONE, HOUR ( 3) }, /* Moscow */
- { "MSD", tDAYZONE, HOUR ( 3) }, /* Moscow Daylight */
- { "IST", tZONE, (HOUR ( 5) + 30) }, /* India Standard */
- { "SGT", tZONE, HOUR ( 8) }, /* Singapore */
- { "KST", tZONE, HOUR ( 9) }, /* Korea Standard */
- { "JST", tZONE, HOUR ( 9) }, /* Japan Standard */
- { "GST", tZONE, HOUR (10) }, /* Guam Standard */
- { "NZST", tZONE, HOUR (12) }, /* New Zealand Standard */
- { "NZDT", tDAYZONE, HOUR (12) }, /* New Zealand Daylight */
- { NULL, 0, 0 }
-};
-
-/* Military time zone table. */
-static table const military_table[] =
-{
- { "A", tZONE, -HOUR ( 1) },
- { "B", tZONE, -HOUR ( 2) },
- { "C", tZONE, -HOUR ( 3) },
- { "D", tZONE, -HOUR ( 4) },
- { "E", tZONE, -HOUR ( 5) },
- { "F", tZONE, -HOUR ( 6) },
- { "G", tZONE, -HOUR ( 7) },
- { "H", tZONE, -HOUR ( 8) },
- { "I", tZONE, -HOUR ( 9) },
- { "K", tZONE, -HOUR (10) },
- { "L", tZONE, -HOUR (11) },
- { "M", tZONE, -HOUR (12) },
- { "N", tZONE, HOUR ( 1) },
- { "O", tZONE, HOUR ( 2) },
- { "P", tZONE, HOUR ( 3) },
- { "Q", tZONE, HOUR ( 4) },
- { "R", tZONE, HOUR ( 5) },
- { "S", tZONE, HOUR ( 6) },
- { "T", tZONE, HOUR ( 7) },
- { "U", tZONE, HOUR ( 8) },
- { "V", tZONE, HOUR ( 9) },
- { "W", tZONE, HOUR (10) },
- { "X", tZONE, HOUR (11) },
- { "Y", tZONE, HOUR (12) },
- { "Z", tZONE, HOUR ( 0) },
- { NULL, 0, 0 }
-};
-
-\f
-
-/* Convert a time zone expressed as HH:MM into an integer count of
- minutes. If MM is negative, then S is of the form HHMM and needs
- to be picked apart; otherwise, S is of the form HH. As specified in
- http://www.opengroup.org/susv3xbd/xbd_chap08.html#tag_08_03, allow
- only valid TZ range, and consider first two digits as hours, if no
- minutes specified. */
-
-static long int
-time_zone_hhmm (parser_control *pc, textint s, long int mm)
-{
- long int n_minutes;
-
- /* If the length of S is 1 or 2 and no minutes are specified,
- interpret it as a number of hours. */
- if (s.digits <= 2 && mm < 0)
- s.value *= 100;
-
- if (mm < 0)
- n_minutes = (s.value / 100) * 60 + s.value % 100;
- else
- n_minutes = s.value * 60 + (s.negative ? -mm : mm);
-
- /* If the absolute number of minutes is larger than 24 hours,
- arrange to reject it by incrementing pc->zones_seen. Thus,
- we allow only values in the range UTC-24:00 to UTC+24:00. */
- if (24 * 60 < abs (n_minutes))
- pc->zones_seen++;
-
- return n_minutes;
-}
-
-static int
-to_hour (long int hours, int meridian)
-{
- switch (meridian)
- {
- default: /* Pacify GCC. */
- case MER24:
- return 0 <= hours && hours < 24 ? hours : -1;
- case MERam:
- return 0 < hours && hours < 12 ? hours : hours == 12 ? 0 : -1;
- case MERpm:
- return 0 < hours && hours < 12 ? hours + 12 : hours == 12 ? 12 : -1;
- }
-}
-
-static long int
-to_year (textint textyear)
-{
- long int year = textyear.value;
-
- if (year < 0)
- year = -year;
-
- /* XPG4 suggests that years 00-68 map to 2000-2068, and
- years 69-99 map to 1969-1999. */
- else if (textyear.digits == 2)
- year += year < 69 ? 2000 : 1900;
-
- return year;
-}
-
-static table const *
-lookup_zone (parser_control const *pc, char const *name)
-{
- table const *tp;
-
- for (tp = universal_time_zone_table; tp->name; tp++)
- if (strcmp (name, tp->name) == 0)
- return tp;
-
- /* Try local zone abbreviations before those in time_zone_table, as
- the local ones are more likely to be right. */
- for (tp = pc->local_time_zone_table; tp->name; tp++)
- if (strcmp (name, tp->name) == 0)
- return tp;
-
- for (tp = time_zone_table; tp->name; tp++)
- if (strcmp (name, tp->name) == 0)
- return tp;
-
- return NULL;
-}
-
-#if ! HAVE_TM_GMTOFF
-/* Yield the difference between *A and *B,
- measured in seconds, ignoring leap seconds.
- The body of this function is taken directly from the GNU C Library;
- see src/strftime.c. */
-static long int
-tm_diff (struct tm const *a, struct tm const *b)
-{
- /* Compute intervening leap days correctly even if year is negative.
- Take care to avoid int overflow in leap day calculations. */
- int a4 = SHR (a->tm_year, 2) + SHR (TM_YEAR_BASE, 2) - ! (a->tm_year & 3);
- int b4 = SHR (b->tm_year, 2) + SHR (TM_YEAR_BASE, 2) - ! (b->tm_year & 3);
- int a100 = a4 / 25 - (a4 % 25 < 0);
- int b100 = b4 / 25 - (b4 % 25 < 0);
- int a400 = SHR (a100, 2);
- int b400 = SHR (b100, 2);
- int intervening_leap_days = (a4 - b4) - (a100 - b100) + (a400 - b400);
- long int ayear = a->tm_year;
- long int years = ayear - b->tm_year;
- long int days = (365 * years + intervening_leap_days
- + (a->tm_yday - b->tm_yday));
- return (60 * (60 * (24 * days + (a->tm_hour - b->tm_hour))
- + (a->tm_min - b->tm_min))
- + (a->tm_sec - b->tm_sec));
-}
-#endif /* ! HAVE_TM_GMTOFF */
-
-static table const *
-lookup_word (parser_control const *pc, char *word)
-{
- char *p;
- char *q;
- size_t wordlen;
- table const *tp;
- bool period_found;
- bool abbrev;
-
- /* Make it uppercase. */
- for (p = word; *p; p++)
- {
- unsigned char ch = *p;
- *p = c_toupper (ch);
- }
-
- for (tp = meridian_table; tp->name; tp++)
- if (strcmp (word, tp->name) == 0)
- return tp;
-
- /* See if we have an abbreviation for a month. */
- wordlen = strlen (word);
- abbrev = wordlen == 3 || (wordlen == 4 && word[3] == '.');
-
- for (tp = month_and_day_table; tp->name; tp++)
- if ((abbrev ? strncmp (word, tp->name, 3) : strcmp (word, tp->name)) == 0)
- return tp;
-
- if ((tp = lookup_zone (pc, word)))
- return tp;
-
- if (strcmp (word, dst_table[0].name) == 0)
- return dst_table;
-
- for (tp = time_units_table; tp->name; tp++)
- if (strcmp (word, tp->name) == 0)
- return tp;
-
- /* Strip off any plural and try the units table again. */
- if (word[wordlen - 1] == 'S')
- {
- word[wordlen - 1] = '\0';
- for (tp = time_units_table; tp->name; tp++)
- if (strcmp (word, tp->name) == 0)
- return tp;
- word[wordlen - 1] = 'S'; /* For "this" in relative_time_table. */
- }
-
- for (tp = relative_time_table; tp->name; tp++)
- if (strcmp (word, tp->name) == 0)
- return tp;
-
- /* Military time zones. */
- if (wordlen == 1)
- for (tp = military_table; tp->name; tp++)
- if (word[0] == tp->name[0])
- return tp;
-
- /* Drop out any periods and try the time zone table again. */
- for (period_found = false, p = q = word; (*p = *q); q++)
- if (*q == '.')
- period_found = true;
- else
- p++;
- if (period_found && (tp = lookup_zone (pc, word)))
- return tp;
-
- return NULL;
-}
-
-static int
-yylex (YYSTYPE *lvalp, parser_control *pc)
-{
- unsigned char c;
- size_t count;
-
- for (;;)
- {
- while (c = *pc->input, c_isspace (c))
- pc->input++;
-
- if (ISDIGIT (c) || c == '-' || c == '+')
- {
- char const *p;
- int sign;
- unsigned long int value;
- if (c == '-' || c == '+')
- {
- sign = c == '-' ? -1 : 1;
- while (c = *++pc->input, c_isspace (c))
- continue;
- if (! ISDIGIT (c))
- /* skip the '-' sign */
- continue;
- }
- else
- sign = 0;
- p = pc->input;
- for (value = 0; ; value *= 10)
- {
- unsigned long int value1 = value + (c - '0');
- if (value1 < value)
- return '?';
- value = value1;
- c = *++p;
- if (! ISDIGIT (c))
- break;
- if (ULONG_MAX / 10 < value)
- return '?';
- }
- if ((c == '.' || c == ',') && ISDIGIT (p[1]))
- {
- time_t s;
- int ns;
- int digits;
- unsigned long int value1;
-
- /* Check for overflow when converting value to time_t. */
- if (sign < 0)
- {
- s = - value;
- if (0 < s)
- return '?';
- value1 = -s;
- }
- else
- {
- s = value;
- if (s < 0)
- return '?';
- value1 = s;
- }
- if (value != value1)
- return '?';
-
- /* Accumulate fraction, to ns precision. */
- p++;
- ns = *p++ - '0';
- for (digits = 2; digits <= LOG10_BILLION; digits++)
- {
- ns *= 10;
- if (ISDIGIT (*p))
- ns += *p++ - '0';
- }
-
- /* Skip excess digits, truncating toward -Infinity. */
- if (sign < 0)
- for (; ISDIGIT (*p); p++)
- if (*p != '0')
- {
- ns++;
- break;
- }
- while (ISDIGIT (*p))
- p++;
-
- /* Adjust to the timespec convention, which is that
- tv_nsec is always a positive offset even if tv_sec is
- negative. */
- if (sign < 0 && ns)
- {
- s--;
- if (! (s < 0))
- return '?';
- ns = BILLION - ns;
- }
-
- lvalp->timespec.tv_sec = s;
- lvalp->timespec.tv_nsec = ns;
- pc->input = p;
- return sign ? tSDECIMAL_NUMBER : tUDECIMAL_NUMBER;
- }
- else
- {
- lvalp->textintval.negative = sign < 0;
- if (sign < 0)
- {
- lvalp->textintval.value = - value;
- if (0 < lvalp->textintval.value)
- return '?';
- }
- else
- {
- lvalp->textintval.value = value;
- if (lvalp->textintval.value < 0)
- return '?';
- }
- lvalp->textintval.digits = p - pc->input;
- pc->input = p;
- return sign ? tSNUMBER : tUNUMBER;
- }
- }
-
- if (c_isalpha (c))
- {
- char buff[20];
- char *p = buff;
- table const *tp;
-
- do
- {
- if (p < buff + sizeof buff - 1)
- *p++ = c;
- c = *++pc->input;
- }
- while (c_isalpha (c) || c == '.');
-
- *p = '\0';
- tp = lookup_word (pc, buff);
- if (! tp)
- return '?';
- lvalp->intval = tp->value;
- return tp->type;
- }
-
- if (c != '(')
- return *pc->input++;
- count = 0;
- do
- {
- c = *pc->input++;
- if (c == '\0')
- return c;
- if (c == '(')
- count++;
- else if (c == ')')
- count--;
- }
- while (count != 0);
- }
-}
-
-/* Do nothing if the parser reports an error. */
-static int
-yyerror (parser_control const *pc _GL_UNUSED,
- char const *s _GL_UNUSED)
-{
- return 0;
-}
-
-/* If *TM0 is the old and *TM1 is the new value of a struct tm after
- passing it to mktime, return true if it's OK that mktime returned T.
- It's not OK if *TM0 has out-of-range members. */
-
-static bool
-mktime_ok (struct tm const *tm0, struct tm const *tm1, time_t t)
-{
- if (t == (time_t) -1)
- {
- /* Guard against falsely reporting an error when parsing a time
- stamp that happens to equal (time_t) -1, on a host that
- supports such a time stamp. */
- tm1 = localtime (&t);
- if (!tm1)
- return false;
- }
-
- return ! ((tm0->tm_sec ^ tm1->tm_sec)
- | (tm0->tm_min ^ tm1->tm_min)
- | (tm0->tm_hour ^ tm1->tm_hour)
- | (tm0->tm_mday ^ tm1->tm_mday)
- | (tm0->tm_mon ^ tm1->tm_mon)
- | (tm0->tm_year ^ tm1->tm_year));
-}
-
-/* A reasonable upper bound for the size of ordinary TZ strings.
- Use heap allocation if TZ's length exceeds this. */
-enum { TZBUFSIZE = 100 };
-
-/* Return a copy of TZ, stored in TZBUF if it fits, and heap-allocated
- otherwise. */
-static char *
-get_tz (char tzbuf[TZBUFSIZE])
-{
- char *tz = getenv ("TZ");
- if (tz)
- {
- size_t tzsize = strlen (tz) + 1;
- tz = (tzsize <= TZBUFSIZE
- ? memcpy (tzbuf, tz, tzsize)
- : xmemdup (tz, tzsize));
- }
- return tz;
-}
-
-/* Parse a date/time string, storing the resulting time value into *RESULT.
- The string itself is pointed to by P. Return true if successful.
- P can be an incomplete or relative time specification; if so, use
- *NOW as the basis for the returned time. */
-bool
-get_date (struct timespec *result, char const *p, struct timespec const *now)
-{
- time_t Start;
- long int Start_ns;
- struct tm const *tmp;
- struct tm tm;
- struct tm tm0;
- parser_control pc;
- struct timespec gettime_buffer;
- unsigned char c;
- bool tz_was_altered = false;
- char *tz0 = NULL;
- char tz0buf[TZBUFSIZE];
- bool ok = true;
-
- if (! now)
- {
- gettime (&gettime_buffer);
- now = &gettime_buffer;
- }
-
- Start = now->tv_sec;
- Start_ns = now->tv_nsec;
-
- tmp = localtime (&now->tv_sec);
- if (! tmp)
- return false;
-
- while (c = *p, c_isspace (c))
- p++;
-
- if (strncmp (p, "TZ=\"", 4) == 0)
- {
- char const *tzbase = p + 4;
- size_t tzsize = 1;
- char const *s;
-
- for (s = tzbase; *s; s++, tzsize++)
- if (*s == '\\')
- {
- s++;
- if (! (*s == '\\' || *s == '"'))
- break;
- }
- else if (*s == '"')
- {
- char *z;
- char *tz1;
- char tz1buf[TZBUFSIZE];
- bool large_tz = TZBUFSIZE < tzsize;
- bool setenv_ok;
- /* Free tz0, in case this is the 2nd or subsequent time through. */
- free (tz0);
- tz0 = get_tz (tz0buf);
- z = tz1 = large_tz ? xmalloc (tzsize) : tz1buf;
- for (s = tzbase; *s != '"'; s++)
- *z++ = *(s += *s == '\\');
- *z = '\0';
- setenv_ok = setenv ("TZ", tz1, 1) == 0;
- if (large_tz)
- free (tz1);
- if (!setenv_ok)
- goto fail;
- tz_was_altered = true;
- p = s + 1;
- }
- }
-
- /* As documented, be careful to treat the empty string just like
- a date string of "0". Without this, an empty string would be
- declared invalid when parsed during a DST transition. */
- if (*p == '\0')
- p = "0";
-
- pc.input = p;
- pc.year.value = tmp->tm_year;
- pc.year.value += TM_YEAR_BASE;
- pc.year.digits = 0;
- pc.month = tmp->tm_mon + 1;
- pc.day = tmp->tm_mday;
- pc.hour = tmp->tm_hour;
- pc.minutes = tmp->tm_min;
- pc.seconds.tv_sec = tmp->tm_sec;
- pc.seconds.tv_nsec = Start_ns;
- tm.tm_isdst = tmp->tm_isdst;
-
- pc.meridian = MER24;
- pc.rel = RELATIVE_TIME_0;
- pc.timespec_seen = false;
- pc.rels_seen = false;
- pc.dates_seen = 0;
- pc.days_seen = 0;
- pc.times_seen = 0;
- pc.local_zones_seen = 0;
- pc.dsts_seen = 0;
- pc.zones_seen = 0;
-
-#if HAVE_STRUCT_TM_TM_ZONE
- pc.local_time_zone_table[0].name = tmp->tm_zone;
- pc.local_time_zone_table[0].type = tLOCAL_ZONE;
- pc.local_time_zone_table[0].value = tmp->tm_isdst;
- pc.local_time_zone_table[1].name = NULL;
-
- /* Probe the names used in the next three calendar quarters, looking
- for a tm_isdst different from the one we already have. */
- {
- int quarter;
- for (quarter = 1; quarter <= 3; quarter++)
- {
- time_t probe = Start + quarter * (90 * 24 * 60 * 60);
- struct tm const *probe_tm = localtime (&probe);
- if (probe_tm && probe_tm->tm_zone
- && probe_tm->tm_isdst != pc.local_time_zone_table[0].value)
- {
- {
- pc.local_time_zone_table[1].name = probe_tm->tm_zone;
- pc.local_time_zone_table[1].type = tLOCAL_ZONE;
- pc.local_time_zone_table[1].value = probe_tm->tm_isdst;
- pc.local_time_zone_table[2].name = NULL;
- }
- break;
- }
- }
- }
-#else
-#if HAVE_TZNAME
- {
-# if !HAVE_DECL_TZNAME
- extern char *tzname[];
-# endif
- int i;
- for (i = 0; i < 2; i++)
- {
- pc.local_time_zone_table[i].name = tzname[i];
- pc.local_time_zone_table[i].type = tLOCAL_ZONE;
- pc.local_time_zone_table[i].value = i;
- }
- pc.local_time_zone_table[i].name = NULL;
- }
-#else
- pc.local_time_zone_table[0].name = NULL;
-#endif
-#endif
-
- if (pc.local_time_zone_table[0].name && pc.local_time_zone_table[1].name
- && ! strcmp (pc.local_time_zone_table[0].name,
- pc.local_time_zone_table[1].name))
- {
- /* This locale uses the same abbrevation for standard and
- daylight times. So if we see that abbreviation, we don't
- know whether it's daylight time. */
- pc.local_time_zone_table[0].value = -1;
- pc.local_time_zone_table[1].name = NULL;
- }
-
- if (yyparse (&pc) != 0)
- goto fail;
-
- if (pc.timespec_seen)
- *result = pc.seconds;
- else
- {
- if (1 < (pc.times_seen | pc.dates_seen | pc.days_seen | pc.dsts_seen
- | (pc.local_zones_seen + pc.zones_seen)))
- goto fail;
-
- tm.tm_year = to_year (pc.year) - TM_YEAR_BASE;
- tm.tm_mon = pc.month - 1;
- tm.tm_mday = pc.day;
- if (pc.times_seen || (pc.rels_seen && ! pc.dates_seen && ! pc.days_seen))
- {
- tm.tm_hour = to_hour (pc.hour, pc.meridian);
- if (tm.tm_hour < 0)
- goto fail;
- tm.tm_min = pc.minutes;
- tm.tm_sec = pc.seconds.tv_sec;
- }
- else
- {
- tm.tm_hour = tm.tm_min = tm.tm_sec = 0;
- pc.seconds.tv_nsec = 0;
- }
-
- /* Let mktime deduce tm_isdst if we have an absolute time stamp. */
- if (pc.dates_seen | pc.days_seen | pc.times_seen)
- tm.tm_isdst = -1;
-
- /* But if the input explicitly specifies local time with or without
- DST, give mktime that information. */
- if (pc.local_zones_seen)
- tm.tm_isdst = pc.local_isdst;
-
- tm0 = tm;
-
- Start = mktime (&tm);
-
- if (! mktime_ok (&tm0, &tm, Start))
- {
- if (! pc.zones_seen)
- goto fail;
- else
- {
- /* Guard against falsely reporting errors near the time_t
- boundaries when parsing times in other time zones. For
- example, suppose the input string "1969-12-31 23:00:00 -0100",
- the current time zone is 8 hours ahead of UTC, and the min
- time_t value is 1970-01-01 00:00:00 UTC. Then the min
- localtime value is 1970-01-01 08:00:00, and mktime will
- therefore fail on 1969-12-31 23:00:00. To work around the
- problem, set the time zone to 1 hour behind UTC temporarily
- by setting TZ="XXX1:00" and try mktime again. */
-
- long int time_zone = pc.time_zone;
- long int abs_time_zone = time_zone < 0 ? - time_zone : time_zone;
- long int abs_time_zone_hour = abs_time_zone / 60;
- int abs_time_zone_min = abs_time_zone % 60;
- char tz1buf[sizeof "XXX+0:00"
- + sizeof pc.time_zone * CHAR_BIT / 3];
- if (!tz_was_altered)
- tz0 = get_tz (tz0buf);
- sprintf (tz1buf, "XXX%s%ld:%02d", "-" + (time_zone < 0),
- abs_time_zone_hour, abs_time_zone_min);
- if (setenv ("TZ", tz1buf, 1) != 0)
- goto fail;
- tz_was_altered = true;
- tm = tm0;
- Start = mktime (&tm);
- if (! mktime_ok (&tm0, &tm, Start))
- goto fail;
- }
- }
-
- if (pc.days_seen && ! pc.dates_seen)
- {
- tm.tm_mday += ((pc.day_number - tm.tm_wday + 7) % 7
- + 7 * (pc.day_ordinal
- - (0 < pc.day_ordinal
- && tm.tm_wday != pc.day_number)));
- tm.tm_isdst = -1;
- Start = mktime (&tm);
- if (Start == (time_t) -1)
- goto fail;
- }
-
- /* Add relative date. */
- if (pc.rel.year | pc.rel.month | pc.rel.day)
- {
- int year = tm.tm_year + pc.rel.year;
- int month = tm.tm_mon + pc.rel.month;
- int day = tm.tm_mday + pc.rel.day;
- if (((year < tm.tm_year) ^ (pc.rel.year < 0))
- | ((month < tm.tm_mon) ^ (pc.rel.month < 0))
- | ((day < tm.tm_mday) ^ (pc.rel.day < 0)))
- goto fail;
- tm.tm_year = year;
- tm.tm_mon = month;
- tm.tm_mday = day;
- tm.tm_hour = tm0.tm_hour;
- tm.tm_min = tm0.tm_min;
- tm.tm_sec = tm0.tm_sec;
- tm.tm_isdst = tm0.tm_isdst;
- Start = mktime (&tm);
- if (Start == (time_t) -1)
- goto fail;
- }
-
- /* The only "output" of this if-block is an updated Start value,
- so this block must follow others that clobber Start. */
- if (pc.zones_seen)
- {
- long int delta = pc.time_zone * 60;
- time_t t1;
-#ifdef HAVE_TM_GMTOFF
- delta -= tm.tm_gmtoff;
-#else
- time_t t = Start;
- struct tm const *gmt = gmtime (&t);
- if (! gmt)
- goto fail;
- delta -= tm_diff (&tm, gmt);
-#endif
- t1 = Start - delta;
- if ((Start < t1) != (delta < 0))
- goto fail; /* time_t overflow */
- Start = t1;
- }
-
- /* Add relative hours, minutes, and seconds. On hosts that support
- leap seconds, ignore the possibility of leap seconds; e.g.,
- "+ 10 minutes" adds 600 seconds, even if one of them is a
- leap second. Typically this is not what the user wants, but it's
- too hard to do it the other way, because the time zone indicator
- must be applied before relative times, and if mktime is applied
- again the time zone will be lost. */
- {
- long int sum_ns = pc.seconds.tv_nsec + pc.rel.ns;
- long int normalized_ns = (sum_ns % BILLION + BILLION) % BILLION;
- time_t t0 = Start;
- long int d1 = 60 * 60 * pc.rel.hour;
- time_t t1 = t0 + d1;
- long int d2 = 60 * pc.rel.minutes;
- time_t t2 = t1 + d2;
- long_time_t d3 = pc.rel.seconds;
- long_time_t t3 = t2 + d3;
- long int d4 = (sum_ns - normalized_ns) / BILLION;
- long_time_t t4 = t3 + d4;
- time_t t5 = t4;
-
- if ((d1 / (60 * 60) ^ pc.rel.hour)
- | (d2 / 60 ^ pc.rel.minutes)
- | ((t1 < t0) ^ (d1 < 0))
- | ((t2 < t1) ^ (d2 < 0))
- | ((t3 < t2) ^ (d3 < 0))
- | ((t4 < t3) ^ (d4 < 0))
- | (t5 != t4))
- goto fail;
-
- result->tv_sec = t5;
- result->tv_nsec = normalized_ns;
- }
- }
-
- goto done;
-
- fail:
- ok = false;
- done:
- if (tz_was_altered)
- ok &= (tz0 ? setenv ("TZ", tz0, 1) : unsetenv ("TZ")) == 0;
- if (tz0 != tz0buf)
- free (tz0);
- return ok;
-}
-
-#if TEST
-
-int
-main (int ac, char **av)
-{
- char buff[BUFSIZ];
-
- printf ("Enter date, or blank line to exit.\n\t> ");
- fflush (stdout);
-
- buff[BUFSIZ - 1] = '\0';
- while (fgets (buff, BUFSIZ - 1, stdin) && buff[0])
- {
- struct timespec d;
- struct tm const *tm;
- if (! get_date (&d, buff, NULL))
- printf ("Bad format - couldn't convert.\n");
- else if (! (tm = localtime (&d.tv_sec)))
- {
- long int sec = d.tv_sec;
- printf ("localtime (%ld) failed\n", sec);
- }
- else
- {
- int ns = d.tv_nsec;
- printf ("%04ld-%02d-%02d %02d:%02d:%02d.%09d\n",
- tm->tm_year + 1900L, tm->tm_mon + 1, tm->tm_mday,
- tm->tm_hour, tm->tm_min, tm->tm_sec, ns);
- }
- printf ("\t> ");
- fflush (stdout);
- }
- return 0;
-}
-#endif /* TEST */
#if __GNUC__ >= 3
@PRAGMA_SYSTEM_HEADER@
#endif
+@PRAGMA_COLUMNS@
/* The include_next requires a split double-inclusion guard. We must
also inform the replacement unistd.h to not recursively use
return link_exists2_p (dir, dirlen, fname, pglob);
else
{
+ /* dfd cannot be -1 here, because dirfd never returns -1 on
+ glibc, or on hosts that have fstatat. */
struct_stat64 st64;
return __fxstatat64 (_STAT_VER, dfd, fname, &st64, 0) == 0;
}
(unsigned long int) max_bucket_length);
}
+/* Hash KEY and return a pointer to the selected bucket.
+ If TABLE->hasher misbehaves, abort. */
+static struct hash_entry *
+safe_hasher (const Hash_table *table, const void *key)
+{
+ size_t n = table->hasher (key, table->n_buckets);
+ if (! (n < table->n_buckets))
+ abort ();
+ return table->bucket + n;
+}
+
/* If ENTRY matches an entry already in the hash table, return the
entry from the table. Otherwise, return NULL. */
void *
hash_lookup (const Hash_table *table, const void *entry)
{
- struct hash_entry const *bucket
- = table->bucket + table->hasher (entry, table->n_buckets);
+ struct hash_entry const *bucket = safe_hasher (table, entry);
struct hash_entry const *cursor;
- if (! (bucket < table->bucket_limit))
- abort ();
-
if (bucket->data == NULL)
return NULL;
void *
hash_get_next (const Hash_table *table, const void *entry)
{
- struct hash_entry const *bucket
- = table->bucket + table->hasher (entry, table->n_buckets);
+ struct hash_entry const *bucket = safe_hasher (table, entry);
struct hash_entry const *cursor;
- if (! (bucket < table->bucket_limit))
- abort ();
-
/* Find next entry in the same bucket. */
- for (cursor = bucket; cursor; cursor = cursor->next)
- if (cursor->data == entry && cursor->next)
- return cursor->next->data;
+ cursor = bucket;
+ do
+ {
+ if (cursor->data == entry && cursor->next)
+ return cursor->next->data;
+ cursor = cursor->next;
+ }
+ while (cursor != NULL);
/* Find first entry in any subsequent bucket. */
while (++bucket < table->bucket_limit)
hash_find_entry (Hash_table *table, const void *entry,
struct hash_entry **bucket_head, bool delete)
{
- struct hash_entry *bucket
- = table->bucket + table->hasher (entry, table->n_buckets);
+ struct hash_entry *bucket = safe_hasher (table, entry);
struct hash_entry *cursor;
- if (! (bucket < table->bucket_limit))
- abort ();
-
*bucket_head = bucket;
/* Test for empty bucket. */
for (cursor = bucket->next; cursor; cursor = next)
{
data = cursor->data;
- new_bucket = (dst->bucket + dst->hasher (data, dst->n_buckets));
-
- if (! (new_bucket < dst->bucket_limit))
- abort ();
+ new_bucket = safe_hasher (dst, data);
next = cursor->next;
bucket->next = NULL;
if (safe)
continue;
- new_bucket = (dst->bucket + dst->hasher (data, dst->n_buckets));
-
- if (! (new_bucket < dst->bucket_limit))
- abort ();
+ new_bucket = safe_hasher (dst, data);
if (new_bucket->data)
{
#if __GNUC__ >= 3
@PRAGMA_SYSTEM_HEADER@
#endif
+@PRAGMA_COLUMNS@
/* The include_next requires a split double-inclusion guard. */
#@INCLUDE_NEXT@ @NEXT_ICONV_H@
"copy.c:233: warning: ignoring return value of 'fchown',
declared with attribute warn_unused_result". */
+#ifndef _GL_IGNORE_VALUE_H
+# define _GL_IGNORE_VALUE_H
+
static inline void ignore_value (int i) { (void) i; }
static inline void ignore_ptr (void* p) { (void) p; }
/* FIXME: what about aggregate types? */
+
+#endif
* WARNING: Don't even consider trying to compile this on a system where
* sizeof(int) < 4. sizeof(int) > 4 is fine; all the world's not a VAX.
*/
-typedef int verify_int_size[2 * sizeof (int) - 7];
+typedef int verify_int_size[4 <= sizeof (int) ? 1 : -1];
static const char *inet_ntop4 (const unsigned char *src, char *dst, socklen_t size);
#if HAVE_IPV6
#if __GNUC__ >= 3
@PRAGMA_SYSTEM_HEADER@
#endif
+@PRAGMA_COLUMNS@
/* Include the original <inttypes.h> if it exists, and if this file
has not been included yet or if this file includes gnulib stdint.h
#if __GNUC__ >= 3
@PRAGMA_SYSTEM_HEADER@
#endif
+@PRAGMA_COLUMNS@
/* The include_next requires a split double-inclusion guard. */
#if @HAVE_LANGINFO_H@
# define GNULIB_defined_CODESET 1
# endif
+# if !@HAVE_LANGINFO_T_FMT_AMPM@
+# define T_FMT_AMPM 10006
+# define GNULIB_defined_T_FMT_AMPM 1
+# endif
+
# if !@HAVE_LANGINFO_ERA@
# define ERA 10047
# define ERA_D_FMT 10048
# define GNULIB_defined_ERA 1
# endif
+# if !@HAVE_LANGINFO_YESEXPR@
+# define YESEXPR 10053
+# define NOEXPR 10054
+# define GNULIB_defined_YESEXPR 1
+# endif
+
#endif
/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
#if __GNUC__ >= 3
@PRAGMA_SYSTEM_HEADER@
#endif
+@PRAGMA_COLUMNS@
/* The include_next requires a split double-inclusion guard. */
#@INCLUDE_NEXT@ @NEXT_LOCALE_H@
#include <fcntl.h>
#include <unistd.h>
+#include <sys/ioctl.h>
int
login_tty (int slave_fd)
setsid ();
/* Make fd the controlling terminal for the current process.
- On Solaris: A terminal becomes the controlling terminal of a session
- if it is being open()ed, at a moment when
- 1. it is not already the controlling terminal of some session, and
- 2. the process that open()s it is a session leader that does not have
- a controlling terminal.
- We assume condition 1, try to ensure condition 2, and then open() it. */
+ On BSD and OSF/1: There is ioctl TIOCSCTTY for this purpose.
+ On Solaris:
+ A terminal becomes the controlling terminal of a session
+ if it is being open()ed, at a moment when
+ 1. it is not already the controlling terminal of some session, and
+ 2. the process that open()s it is a session leader that does not have
+ a controlling terminal.
+ We assume condition 1, try to ensure condition 2, and then open() it.
+ */
for (i = 0; i < 3; i++)
if (i != slave_fd)
close (i);
+#ifdef TIOCSCTTY
+ if (ioctl (slave_fd, TIOCSCTTY, NULL) < 0)
+ return -1;
+#else
{
char *slave_name;
int dummy_fd;
return -1;
close (dummy_fd);
}
+#endif
- /* Assign fd to the standard input, standard output, and standardd error of
+ /* Assign fd to the standard input, standard output, and standard error of
the current process. */
for (i = 0; i < 3; i++)
if (slave_fd != i)
#include <config.h>
/* Only the AC_FUNC_MALLOC macro defines 'malloc' already in config.h. */
#ifdef malloc
-# define NEED_MALLOC_GNU
+# define NEED_MALLOC_GNU 1
# undef malloc
+/* Whereas the gnulib module 'malloc-gnu' defines HAVE_MALLOC_GNU. */
+#elif GNULIB_MALLOC_GNU && !HAVE_MALLOC_GNU
+# define NEED_MALLOC_GNU 1
#endif
/* Specification. */
{
void *result;
-#ifdef NEED_MALLOC_GNU
+#if NEED_MALLOC_GNU
if (n == 0)
n = 1;
#endif
/* Specification. */
#include "malloca.h"
+#include "verify.h"
+
/* Use the system functions, not the gnulib overrides in this file. */
#undef malloc
#define HEADER_SIZE \
(((sizeof (struct preliminary_header) + sa_alignment_max - 1) / sa_alignment_max) * sa_alignment_max)
struct header { void *next; char room[HEADER_SIZE - sizeof (struct preliminary_header) + MAGIC_SIZE]; };
-/* Verify that HEADER_SIZE == sizeof (struct header). */
-typedef int verify1[2 * (HEADER_SIZE == sizeof (struct header)) - 1];
+verify (HEADER_SIZE == sizeof (struct header));
/* We make the hash table quite big, so that during lookups the probability
of empty hash buckets is quite high. There is no need to make the hash
table resizable, because when the hash table gets filled so much that the
#if __GNUC__ >= 3
@PRAGMA_SYSTEM_HEADER@
#endif
+@PRAGMA_COLUMNS@
/* The include_next requires a split double-inclusion guard. */
#@INCLUDE_NEXT_AS_FIRST_DIRECTIVE@ @NEXT_AS_FIRST_DIRECTIVE_MATH_H@
This function is a gnulib extension, unlike isnan() which applied only
to 'double' numbers earlier but now is a type-generic macro. */
# if @HAVE_ISNAND@
-/* The original <math.h> included above provides a declaration of isnan macro. */
+/* The original <math.h> included above provides a declaration of isnan
+ macro. */
# if __GNUC__ >= 4
/* GCC 4.0 and newer provides three built-ins for isnan. */
# undef isnand
#if @GNULIB_ISNANL@
/* Test for NaN for 'long double' numbers. */
# if @HAVE_ISNANL@
-/* The original <math.h> included above provides a declaration of isnan macro or (older) isnanl function. */
+/* The original <math.h> included above provides a declaration of isnan
+ macro or (older) isnanl function. */
# if __GNUC__ >= 4
/* GCC 4.0 and newer provides three built-ins for isnan. */
# undef isnanl
_GL_EXTERN_C int gl_signbitd (double arg);
_GL_EXTERN_C int gl_signbitl (long double arg);
# if __GNUC__ >= 2 && !__STRICT_ANSI__
+# define _GL_NUM_UINT_WORDS(type) \
+ ((sizeof (type) + sizeof (unsigned int) - 1) / sizeof (unsigned int))
# if defined FLT_SIGNBIT_WORD && defined FLT_SIGNBIT_BIT && !defined gl_signbitf
# define gl_signbitf_OPTIMIZED_MACRO
# define gl_signbitf(arg) \
({ union { float _value; \
- unsigned int _word[(sizeof (float) + sizeof (unsigned int) - 1) / sizeof (unsigned int)]; \
+ unsigned int _word[_GL_NUM_UINT_WORDS (float)]; \
} _m; \
_m._value = (arg); \
(_m._word[FLT_SIGNBIT_WORD] >> FLT_SIGNBIT_BIT) & 1; \
# if defined DBL_SIGNBIT_WORD && defined DBL_SIGNBIT_BIT && !defined gl_signbitd
# define gl_signbitd_OPTIMIZED_MACRO
# define gl_signbitd(arg) \
- ({ union { double _value; \
- unsigned int _word[(sizeof (double) + sizeof (unsigned int) - 1) / sizeof (unsigned int)]; \
+ ({ union { double _value; \
+ unsigned int _word[_GL_NUM_UINT_WORDS (double)]; \
} _m; \
_m._value = (arg); \
(_m._word[DBL_SIGNBIT_WORD] >> DBL_SIGNBIT_BIT) & 1; \
# define gl_signbitl_OPTIMIZED_MACRO
# define gl_signbitl(arg) \
({ union { long double _value; \
- unsigned int _word[(sizeof (long double) + sizeof (unsigned int) - 1) / sizeof (unsigned int)]; \
+ unsigned int _word[_GL_NUM_UINT_WORDS (long double)]; \
} _m; \
_m._value = (arg); \
- (_m._word[LDBL_SIGNBIT_WORD] >> LDBL_SIGNBIT_BIT) & 1; \
+ (_m._word[LDBL_SIGNBIT_WORD] >> LDBL_SIGNBIT_BIT) & 1; \
})
# endif
# endif
/* Locale-specific case-ignoring memory comparison.
- Copyright (C) 2001, 2009, 2010 Free Software Foundation, Inc.
+ Copyright (C) 2001, 2009-2010 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2001.
This program is free software: you can redistribute it and/or modify it
break;
if (n1 != (size_t)(-1))
{
- wint_t wc2 = towlower (wc1);
+ wint_t wc2;
+ if (n1 == 0) /* NUL character? */
+ n1 = 1;
+
+ wc2 = towlower (wc1);
if (wc2 != wc1)
{
size_t n2;
return diff;
}
-/* Compare S1 (with size S1SIZE) and S2 (with length S2SIZE) according
- to the LC_COLLATE locale. S1 and S2 are both blocks of memory with
- nonzero sizes, and the last byte in each block must be a null byte.
+/* Compare S1 (a memory block of size S1SIZE, with a NUL as last byte)
+ and S2 (a memory block of size S2SIZE, with a NUL as last byte)
+ according to the LC_COLLATE locale. S1SIZE and S2SIZE must be > 0.
Set errno to an error number if there is an error, and to zero
otherwise. */
int
/* nanosleep mishandles large sleeps due to internal overflow
problems. The worst known case of this is cygwin 1.5.x, which
can't sleep more than 49.7 days (2**32 milliseconds). Solve this
- by breaking the sleep up into smaller chunks. Verify that time_t
- is large enough. */
- verify (TYPE_MAXIMUM (time_t) / 49 / 24 / 60 / 60);
- const time_t limit = 49 * 24 * 60 * 60;
- time_t seconds = requested_delay->tv_sec;
- struct timespec intermediate;
- intermediate.tv_nsec = 0;
-
- while (limit < seconds)
+ by breaking the sleep up into smaller chunks. */
+
+ if (requested_delay->tv_nsec < 0 || BILLION <= requested_delay->tv_nsec)
{
- int result;
- intermediate.tv_sec = limit;
- result = nanosleep (&intermediate, remaining_delay);
- seconds -= limit;
- if (result)
- {
- if (remaining_delay)
- {
- remaining_delay->tv_sec += seconds;
- remaining_delay->tv_nsec += requested_delay->tv_nsec;
- if (BILLION <= requested_delay->tv_nsec)
- {
- remaining_delay->tv_sec++;
- remaining_delay->tv_nsec -= BILLION;
- }
- }
- return result;
- }
+ errno = EINVAL;
+ return -1;
}
- intermediate.tv_sec = seconds;
- intermediate.tv_nsec = requested_delay->tv_nsec;
- return nanosleep (&intermediate, remaining_delay);
+
+ {
+ /* Verify that time_t is large enough. */
+ verify (TYPE_MAXIMUM (time_t) / 49 / 24 / 60 / 60);
+ const time_t limit = 49 * 24 * 60 * 60;
+ time_t seconds = requested_delay->tv_sec;
+ struct timespec intermediate;
+ intermediate.tv_nsec = 0;
+
+ while (limit < seconds)
+ {
+ int result;
+ intermediate.tv_sec = limit;
+ result = nanosleep (&intermediate, remaining_delay);
+ seconds -= limit;
+ if (result)
+ {
+ if (remaining_delay)
+ {
+ remaining_delay->tv_sec += seconds;
+ remaining_delay->tv_nsec += requested_delay->tv_nsec;
+ if (BILLION <= requested_delay->tv_nsec)
+ {
+ remaining_delay->tv_sec++;
+ remaining_delay->tv_nsec -= BILLION;
+ }
+ }
+ return result;
+ }
+ }
+ intermediate.tv_sec = seconds;
+ intermediate.tv_nsec = requested_delay->tv_nsec;
+ return nanosleep (&intermediate, remaining_delay);
+ }
}
#elif (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
#if __GNUC__ >= 3
@PRAGMA_SYSTEM_HEADER@
#endif
+@PRAGMA_COLUMNS@
#if @HAVE_NETDB_H@
#if __GNUC__ >= 3
@PRAGMA_SYSTEM_HEADER@
#endif
+@PRAGMA_COLUMNS@
#if @HAVE_NETINET_IN_H@
return "";
}
# endif
+# if GNULIB_defined_T_FMT_AMPM
+ case T_FMT_AMPM:
+ return "%I:%M:%S %p";
+# endif
# if GNULIB_defined_ERA
case ERA:
/* The format is not standardized. In glibc it is a sequence of strings
strings, appended in memory. */
return "\0\0\0\0\0\0\0\0\0\0";
# endif
+# if GNULIB_defined_YESEXPR
+ case YESEXPR:
+ return "^[yY]";
+ case NOEXPR:
+ return "^[nN]";
+# endif
default:
break;
}
override fstat() in fchdir.c to hide the fact that we have a
dummy. */
if (REPLACE_OPEN_DIRECTORY && fd < 0 && errno == EACCES
- && (flags & O_ACCMODE) == O_RDONLY)
+ && ((flags & O_ACCMODE) == O_RDONLY
+ || (O_SEARCH != O_RDONLY && (flags & O_ACCMODE) == O_SEARCH)))
{
struct stat statbuf;
if (stat (filename, &statbuf) == 0 && S_ISDIR (statbuf.st_mode))
problem is exhibited on code that built on Solaris 8 and
running on Solaris 10. */
- int proc_self_fd = open ("/proc/self/fd", O_RDONLY);
+ int proc_self_fd = open ("/proc/self/fd", O_SEARCH);
if (proc_self_fd < 0)
proc_status = -1;
else
openat_needs_fchdir (void)
{
bool needs_fchdir = true;
- int fd = open ("/", O_RDONLY);
+ int fd = open ("/", O_SEARCH);
if (0 <= fd)
{
return fstatat (fd, name, st, AT_SYMLINK_NOFOLLOW);
}
-#if GNULIB_FACCESSAT
/* For now, there are no wrappers named laccessat or leuidaccessat,
since gnulib doesn't support faccessat(,AT_SYMLINK_NOFOLLOW) and
- since access rights on symlinks are of limited utility. */
-
-static inline int
-accessat (int fd, char const *file, int mode)
-{
- return faccessat (fd, file, mode, 0);
-}
-
-static inline int
-euidaccessat (int fd, char const *file, int mode)
-{
- return faccessat (fd, file, mode, AT_EACCESS);
-}
-#endif
+ since access rights on symlinks are of limited utility. Likewise,
+ wrappers are not provided for accessat or euidaccessat, so as to
+ avoid dragging in -lgen on some platforms. */
#endif /* _GL_HEADER_OPENAT */
--- /dev/null
+/* Parse a string into an internal time stamp.
+
+ Copyright (C) 1995, 1997, 1998, 2003, 2004, 2007, 2009, 2010 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/>. */
+
+#include <stdbool.h>
+#include <time.h>
+
+bool parse_datetime (struct timespec *, char const *, struct timespec const *);
--- /dev/null
+%{
+/* Parse a string into an internal time stamp.
+
+ Copyright (C) 1999, 2000, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
+ 2010 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/>. */
+
+/* Originally written by Steven M. Bellovin <smb@research.att.com> while
+ at the University of North Carolina at Chapel Hill. Later tweaked by
+ a couple of people on Usenet. Completely overhauled by Rich $alz
+ <rsalz@bbn.com> and Jim Berets <jberets@bbn.com> in August, 1990.
+
+ Modified by Paul Eggert <eggert@twinsun.com> in August 1999 to do
+ the right thing about local DST. Also modified by Paul Eggert
+ <eggert@cs.ucla.edu> in February 2004 to support
+ nanosecond-resolution time stamps, and in October 2004 to support
+ TZ strings in dates. */
+
+/* FIXME: Check for arithmetic overflow in all cases, not just
+ some of them. */
+
+#include <config.h>
+
+#include "parse-datetime.h"
+
+#include "intprops.h"
+#include "timespec.h"
+#include "verify.h"
+
+/* There's no need to extend the stack, so there's no need to involve
+ alloca. */
+#define YYSTACK_USE_ALLOCA 0
+
+/* Tell Bison how much stack space is needed. 20 should be plenty for
+ this grammar, which is not right recursive. Beware setting it too
+ high, since that might cause problems on machines whose
+ implementations have lame stack-overflow checking. */
+#define YYMAXDEPTH 20
+#define YYINITDEPTH YYMAXDEPTH
+
+/* Since the code of parse-datetime.y is not included in the Emacs executable
+ itself, there is no need to #define static in this file. Even if
+ the code were included in the Emacs executable, it probably
+ wouldn't do any harm to #undef it here; this will only cause
+ problems if we try to write to a static variable, which I don't
+ think this code needs to do. */
+#ifdef emacs
+# undef static
+#endif
+
+#include <c-ctype.h>
+#include <limits.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "xalloc.h"
+
+/* Bison's skeleton tests _STDLIB_H, while some stdlib.h headers
+ use _STDLIB_H_ as witness. Map the latter to the one bison uses. */
+/* FIXME: this is temporary. Remove when we have a mechanism to ensure
+ that the version we're using is fixed, too. */
+#ifdef _STDLIB_H_
+# undef _STDLIB_H
+# define _STDLIB_H 1
+#endif
+
+/* ISDIGIT differs from isdigit, as follows:
+ - Its arg may be any int or unsigned int; it need not be an unsigned char
+ or EOF.
+ - It's typically faster.
+ POSIX says that only '0' through '9' are digits. Prefer ISDIGIT to
+ isdigit unless it's important to use the locale's definition
+ of `digit' even when the host does not conform to POSIX. */
+#define ISDIGIT(c) ((unsigned int) (c) - '0' <= 9)
+
+/* Shift A right by B bits portably, by dividing A by 2**B and
+ truncating towards minus infinity. A and B should be free of side
+ effects, and B should be in the range 0 <= B <= INT_BITS - 2, where
+ INT_BITS is the number of useful bits in an int. GNU code can
+ assume that INT_BITS is at least 32.
+
+ ISO C99 says that A >> B is implementation-defined if A < 0. Some
+ implementations (e.g., UNICOS 9.0 on a Cray Y-MP EL) don't shift
+ right in the usual way when A < 0, so SHR falls back on division if
+ ordinary A >> B doesn't seem to be the usual signed shift. */
+#define SHR(a, b) \
+ (-1 >> 1 == -1 \
+ ? (a) >> (b) \
+ : (a) / (1 << (b)) - ((a) % (1 << (b)) < 0))
+
+#define EPOCH_YEAR 1970
+#define TM_YEAR_BASE 1900
+
+#define HOUR(x) ((x) * 60)
+
+/* long_time_t is a signed integer type that contains all time_t values. */
+verify (TYPE_IS_INTEGER (time_t));
+#if TIME_T_FITS_IN_LONG_INT
+typedef long int long_time_t;
+#else
+typedef time_t long_time_t;
+#endif
+
+/* Lots of this code assumes time_t and time_t-like values fit into
+ long_time_t. */
+verify (TYPE_MINIMUM (long_time_t) <= TYPE_MINIMUM (time_t)
+ && TYPE_MAXIMUM (time_t) <= TYPE_MAXIMUM (long_time_t));
+
+/* FIXME: It also assumes that signed integer overflow silently wraps around,
+ but this is not true any more with recent versions of GCC 4. */
+
+/* An integer value, and the number of digits in its textual
+ representation. */
+typedef struct
+{
+ bool negative;
+ long int value;
+ size_t digits;
+} textint;
+
+/* An entry in the lexical lookup table. */
+typedef struct
+{
+ char const *name;
+ int type;
+ int value;
+} table;
+
+/* Meridian: am, pm, or 24-hour style. */
+enum { MERam, MERpm, MER24 };
+
+enum { BILLION = 1000000000, LOG10_BILLION = 9 };
+
+/* Relative times. */
+typedef struct
+{
+ /* Relative year, month, day, hour, minutes, seconds, and nanoseconds. */
+ long int year;
+ long int month;
+ long int day;
+ long int hour;
+ long int minutes;
+ long_time_t seconds;
+ long int ns;
+} relative_time;
+
+#if HAVE_COMPOUND_LITERALS
+# define RELATIVE_TIME_0 ((relative_time) { 0, 0, 0, 0, 0, 0, 0 })
+#else
+static relative_time const RELATIVE_TIME_0;
+#endif
+
+/* Information passed to and from the parser. */
+typedef struct
+{
+ /* The input string remaining to be parsed. */
+ const char *input;
+
+ /* N, if this is the Nth Tuesday. */
+ long int day_ordinal;
+
+ /* Day of week; Sunday is 0. */
+ int day_number;
+
+ /* tm_isdst flag for the local zone. */
+ int local_isdst;
+
+ /* Time zone, in minutes east of UTC. */
+ long int time_zone;
+
+ /* Style used for time. */
+ int meridian;
+
+ /* Gregorian year, month, day, hour, minutes, seconds, and nanoseconds. */
+ textint year;
+ long int month;
+ long int day;
+ long int hour;
+ long int minutes;
+ struct timespec seconds; /* includes nanoseconds */
+
+ /* Relative year, month, day, hour, minutes, seconds, and nanoseconds. */
+ relative_time rel;
+
+ /* Presence or counts of nonterminals of various flavors parsed so far. */
+ bool timespec_seen;
+ bool rels_seen;
+ size_t dates_seen;
+ size_t days_seen;
+ size_t local_zones_seen;
+ size_t dsts_seen;
+ size_t times_seen;
+ size_t zones_seen;
+
+ /* Table of local time zone abbrevations, terminated by a null entry. */
+ table local_time_zone_table[3];
+} parser_control;
+
+union YYSTYPE;
+static int yylex (union YYSTYPE *, parser_control *);
+static int yyerror (parser_control const *, char const *);
+static long int time_zone_hhmm (parser_control *, textint, long int);
+
+/* Extract into *PC any date and time info from a string of digits
+ of the form e.g., YYYYMMDD, YYMMDD, HHMM, HH (and sometimes YYY,
+ YYYY, ...). */
+static void
+digits_to_date_time (parser_control *pc, textint text_int)
+{
+ if (pc->dates_seen && ! pc->year.digits
+ && ! pc->rels_seen && (pc->times_seen || 2 < text_int.digits))
+ pc->year = text_int;
+ else
+ {
+ if (4 < text_int.digits)
+ {
+ pc->dates_seen++;
+ pc->day = text_int.value % 100;
+ pc->month = (text_int.value / 100) % 100;
+ pc->year.value = text_int.value / 10000;
+ pc->year.digits = text_int.digits - 4;
+ }
+ else
+ {
+ pc->times_seen++;
+ if (text_int.digits <= 2)
+ {
+ pc->hour = text_int.value;
+ pc->minutes = 0;
+ }
+ else
+ {
+ pc->hour = text_int.value / 100;
+ pc->minutes = text_int.value % 100;
+ }
+ pc->seconds.tv_sec = 0;
+ pc->seconds.tv_nsec = 0;
+ pc->meridian = MER24;
+ }
+ }
+}
+
+/* Increment PC->rel by FACTOR * REL (FACTOR is 1 or -1). */
+static void
+apply_relative_time (parser_control *pc, relative_time rel, int factor)
+{
+ pc->rel.ns += factor * rel.ns;
+ pc->rel.seconds += factor * rel.seconds;
+ pc->rel.minutes += factor * rel.minutes;
+ pc->rel.hour += factor * rel.hour;
+ pc->rel.day += factor * rel.day;
+ pc->rel.month += factor * rel.month;
+ pc->rel.year += factor * rel.year;
+ pc->rels_seen = true;
+}
+
+/* Set PC-> hour, minutes, seconds and nanoseconds members from arguments. */
+static void
+set_hhmmss (parser_control *pc, long int hour, long int minutes,
+ time_t sec, long int nsec)
+{
+ pc->hour = hour;
+ pc->minutes = minutes;
+ pc->seconds.tv_sec = sec;
+ pc->seconds.tv_nsec = nsec;
+}
+
+%}
+
+/* We want a reentrant parser, even if the TZ manipulation and the calls to
+ localtime and gmtime are not reentrant. */
+%pure-parser
+%parse-param { parser_control *pc }
+%lex-param { parser_control *pc }
+
+/* This grammar has 20 shift/reduce conflicts. */
+%expect 20
+
+%union
+{
+ long int intval;
+ textint textintval;
+ struct timespec timespec;
+ relative_time rel;
+}
+
+%token tAGO tDST
+
+%token tYEAR_UNIT tMONTH_UNIT tHOUR_UNIT tMINUTE_UNIT tSEC_UNIT
+%token <intval> tDAY_UNIT tDAY_SHIFT
+
+%token <intval> tDAY tDAYZONE tLOCAL_ZONE tMERIDIAN
+%token <intval> tMONTH tORDINAL tZONE
+
+%token <textintval> tSNUMBER tUNUMBER
+%token <timespec> tSDECIMAL_NUMBER tUDECIMAL_NUMBER
+
+%type <intval> o_colon_minutes o_merid
+%type <timespec> seconds signed_seconds unsigned_seconds
+
+%type <rel> relunit relunit_snumber dayshift
+
+%%
+
+spec:
+ timespec
+ | items
+ ;
+
+timespec:
+ '@' seconds
+ {
+ pc->seconds = $2;
+ pc->timespec_seen = true;
+ }
+ ;
+
+items:
+ /* empty */
+ | items item
+ ;
+
+item:
+ time
+ { pc->times_seen++; }
+ | local_zone
+ { pc->local_zones_seen++; }
+ | zone
+ { pc->zones_seen++; }
+ | date
+ { pc->dates_seen++; }
+ | day
+ { pc->days_seen++; }
+ | rel
+ | number
+ | hybrid
+ ;
+
+time:
+ tUNUMBER tMERIDIAN
+ {
+ set_hhmmss (pc, $1.value, 0, 0, 0);
+ pc->meridian = $2;
+ }
+ | tUNUMBER ':' tUNUMBER o_merid
+ {
+ set_hhmmss (pc, $1.value, $3.value, 0, 0);
+ pc->meridian = $4;
+ }
+ | tUNUMBER ':' tUNUMBER tSNUMBER o_colon_minutes
+ {
+ set_hhmmss (pc, $1.value, $3.value, 0, 0);
+ pc->meridian = MER24;
+ pc->zones_seen++;
+ pc->time_zone = time_zone_hhmm (pc, $4, $5);
+ }
+ | tUNUMBER ':' tUNUMBER ':' unsigned_seconds o_merid
+ {
+ set_hhmmss (pc, $1.value, $3.value, $5.tv_sec, $5.tv_nsec);
+ pc->meridian = $6;
+ }
+ | tUNUMBER ':' tUNUMBER ':' unsigned_seconds tSNUMBER o_colon_minutes
+ {
+ set_hhmmss (pc, $1.value, $3.value, $5.tv_sec, $5.tv_nsec);
+ pc->meridian = MER24;
+ pc->zones_seen++;
+ pc->time_zone = time_zone_hhmm (pc, $6, $7);
+ }
+ ;
+
+local_zone:
+ tLOCAL_ZONE
+ {
+ pc->local_isdst = $1;
+ pc->dsts_seen += (0 < $1);
+ }
+ | tLOCAL_ZONE tDST
+ {
+ pc->local_isdst = 1;
+ pc->dsts_seen += (0 < $1) + 1;
+ }
+ ;
+
+zone:
+ tZONE
+ { pc->time_zone = $1; }
+ | tZONE relunit_snumber
+ { pc->time_zone = $1;
+ apply_relative_time (pc, $2, 1); }
+ | tZONE tSNUMBER o_colon_minutes
+ { pc->time_zone = $1 + time_zone_hhmm (pc, $2, $3); }
+ | tDAYZONE
+ { pc->time_zone = $1 + 60; }
+ | tZONE tDST
+ { pc->time_zone = $1 + 60; }
+ ;
+
+day:
+ tDAY
+ {
+ pc->day_ordinal = 0;
+ pc->day_number = $1;
+ }
+ | tDAY ','
+ {
+ pc->day_ordinal = 0;
+ pc->day_number = $1;
+ }
+ | tORDINAL tDAY
+ {
+ pc->day_ordinal = $1;
+ pc->day_number = $2;
+ }
+ | tUNUMBER tDAY
+ {
+ pc->day_ordinal = $1.value;
+ pc->day_number = $2;
+ }
+ ;
+
+date:
+ tUNUMBER '/' tUNUMBER
+ {
+ pc->month = $1.value;
+ pc->day = $3.value;
+ }
+ | tUNUMBER '/' tUNUMBER '/' tUNUMBER
+ {
+ /* Interpret as YYYY/MM/DD if the first value has 4 or more digits,
+ otherwise as MM/DD/YY.
+ The goal in recognizing YYYY/MM/DD is solely to support legacy
+ machine-generated dates like those in an RCS log listing. If
+ you want portability, use the ISO 8601 format. */
+ if (4 <= $1.digits)
+ {
+ pc->year = $1;
+ pc->month = $3.value;
+ pc->day = $5.value;
+ }
+ else
+ {
+ pc->month = $1.value;
+ pc->day = $3.value;
+ pc->year = $5;
+ }
+ }
+ | tUNUMBER tSNUMBER tSNUMBER
+ {
+ /* ISO 8601 format. YYYY-MM-DD. */
+ pc->year = $1;
+ pc->month = -$2.value;
+ pc->day = -$3.value;
+ }
+ | tUNUMBER tMONTH tSNUMBER
+ {
+ /* e.g. 17-JUN-1992. */
+ pc->day = $1.value;
+ pc->month = $2;
+ pc->year.value = -$3.value;
+ pc->year.digits = $3.digits;
+ }
+ | tMONTH tSNUMBER tSNUMBER
+ {
+ /* e.g. JUN-17-1992. */
+ pc->month = $1;
+ pc->day = -$2.value;
+ pc->year.value = -$3.value;
+ pc->year.digits = $3.digits;
+ }
+ | tMONTH tUNUMBER
+ {
+ pc->month = $1;
+ pc->day = $2.value;
+ }
+ | tMONTH tUNUMBER ',' tUNUMBER
+ {
+ pc->month = $1;
+ pc->day = $2.value;
+ pc->year = $4;
+ }
+ | tUNUMBER tMONTH
+ {
+ pc->day = $1.value;
+ pc->month = $2;
+ }
+ | tUNUMBER tMONTH tUNUMBER
+ {
+ pc->day = $1.value;
+ pc->month = $2;
+ pc->year = $3;
+ }
+ ;
+
+rel:
+ relunit tAGO
+ { apply_relative_time (pc, $1, -1); }
+ | relunit
+ { apply_relative_time (pc, $1, 1); }
+ | dayshift
+ { apply_relative_time (pc, $1, 1); }
+ ;
+
+relunit:
+ tORDINAL tYEAR_UNIT
+ { $$ = RELATIVE_TIME_0; $$.year = $1; }
+ | tUNUMBER tYEAR_UNIT
+ { $$ = RELATIVE_TIME_0; $$.year = $1.value; }
+ | tYEAR_UNIT
+ { $$ = RELATIVE_TIME_0; $$.year = 1; }
+ | tORDINAL tMONTH_UNIT
+ { $$ = RELATIVE_TIME_0; $$.month = $1; }
+ | tUNUMBER tMONTH_UNIT
+ { $$ = RELATIVE_TIME_0; $$.month = $1.value; }
+ | tMONTH_UNIT
+ { $$ = RELATIVE_TIME_0; $$.month = 1; }
+ | tORDINAL tDAY_UNIT
+ { $$ = RELATIVE_TIME_0; $$.day = $1 * $2; }
+ | tUNUMBER tDAY_UNIT
+ { $$ = RELATIVE_TIME_0; $$.day = $1.value * $2; }
+ | tDAY_UNIT
+ { $$ = RELATIVE_TIME_0; $$.day = $1; }
+ | tORDINAL tHOUR_UNIT
+ { $$ = RELATIVE_TIME_0; $$.hour = $1; }
+ | tUNUMBER tHOUR_UNIT
+ { $$ = RELATIVE_TIME_0; $$.hour = $1.value; }
+ | tHOUR_UNIT
+ { $$ = RELATIVE_TIME_0; $$.hour = 1; }
+ | tORDINAL tMINUTE_UNIT
+ { $$ = RELATIVE_TIME_0; $$.minutes = $1; }
+ | tUNUMBER tMINUTE_UNIT
+ { $$ = RELATIVE_TIME_0; $$.minutes = $1.value; }
+ | tMINUTE_UNIT
+ { $$ = RELATIVE_TIME_0; $$.minutes = 1; }
+ | tORDINAL tSEC_UNIT
+ { $$ = RELATIVE_TIME_0; $$.seconds = $1; }
+ | tUNUMBER tSEC_UNIT
+ { $$ = RELATIVE_TIME_0; $$.seconds = $1.value; }
+ | tSDECIMAL_NUMBER tSEC_UNIT
+ { $$ = RELATIVE_TIME_0; $$.seconds = $1.tv_sec; $$.ns = $1.tv_nsec; }
+ | tUDECIMAL_NUMBER tSEC_UNIT
+ { $$ = RELATIVE_TIME_0; $$.seconds = $1.tv_sec; $$.ns = $1.tv_nsec; }
+ | tSEC_UNIT
+ { $$ = RELATIVE_TIME_0; $$.seconds = 1; }
+ | relunit_snumber
+ ;
+
+relunit_snumber:
+ tSNUMBER tYEAR_UNIT
+ { $$ = RELATIVE_TIME_0; $$.year = $1.value; }
+ | tSNUMBER tMONTH_UNIT
+ { $$ = RELATIVE_TIME_0; $$.month = $1.value; }
+ | tSNUMBER tDAY_UNIT
+ { $$ = RELATIVE_TIME_0; $$.day = $1.value * $2; }
+ | tSNUMBER tHOUR_UNIT
+ { $$ = RELATIVE_TIME_0; $$.hour = $1.value; }
+ | tSNUMBER tMINUTE_UNIT
+ { $$ = RELATIVE_TIME_0; $$.minutes = $1.value; }
+ | tSNUMBER tSEC_UNIT
+ { $$ = RELATIVE_TIME_0; $$.seconds = $1.value; }
+ ;
+
+dayshift:
+ tDAY_SHIFT
+ { $$ = RELATIVE_TIME_0; $$.day = $1; }
+ ;
+
+seconds: signed_seconds | unsigned_seconds;
+
+signed_seconds:
+ tSDECIMAL_NUMBER
+ | tSNUMBER
+ { $$.tv_sec = $1.value; $$.tv_nsec = 0; }
+ ;
+
+unsigned_seconds:
+ tUDECIMAL_NUMBER
+ | tUNUMBER
+ { $$.tv_sec = $1.value; $$.tv_nsec = 0; }
+ ;
+
+number:
+ tUNUMBER
+ { digits_to_date_time (pc, $1); }
+ ;
+
+hybrid:
+ tUNUMBER relunit_snumber
+ {
+ /* Hybrid all-digit and relative offset, so that we accept e.g.,
+ "YYYYMMDD +N days" as well as "YYYYMMDD N days". */
+ digits_to_date_time (pc, $1);
+ apply_relative_time (pc, $2, 1);
+ }
+ ;
+
+o_colon_minutes:
+ /* empty */
+ { $$ = -1; }
+ | ':' tUNUMBER
+ { $$ = $2.value; }
+ ;
+
+o_merid:
+ /* empty */
+ { $$ = MER24; }
+ | tMERIDIAN
+ { $$ = $1; }
+ ;
+
+%%
+
+static table const meridian_table[] =
+{
+ { "AM", tMERIDIAN, MERam },
+ { "A.M.", tMERIDIAN, MERam },
+ { "PM", tMERIDIAN, MERpm },
+ { "P.M.", tMERIDIAN, MERpm },
+ { NULL, 0, 0 }
+};
+
+static table const dst_table[] =
+{
+ { "DST", tDST, 0 }
+};
+
+static table const month_and_day_table[] =
+{
+ { "JANUARY", tMONTH, 1 },
+ { "FEBRUARY", tMONTH, 2 },
+ { "MARCH", tMONTH, 3 },
+ { "APRIL", tMONTH, 4 },
+ { "MAY", tMONTH, 5 },
+ { "JUNE", tMONTH, 6 },
+ { "JULY", tMONTH, 7 },
+ { "AUGUST", tMONTH, 8 },
+ { "SEPTEMBER",tMONTH, 9 },
+ { "SEPT", tMONTH, 9 },
+ { "OCTOBER", tMONTH, 10 },
+ { "NOVEMBER", tMONTH, 11 },
+ { "DECEMBER", tMONTH, 12 },
+ { "SUNDAY", tDAY, 0 },
+ { "MONDAY", tDAY, 1 },
+ { "TUESDAY", tDAY, 2 },
+ { "TUES", tDAY, 2 },
+ { "WEDNESDAY",tDAY, 3 },
+ { "WEDNES", tDAY, 3 },
+ { "THURSDAY", tDAY, 4 },
+ { "THUR", tDAY, 4 },
+ { "THURS", tDAY, 4 },
+ { "FRIDAY", tDAY, 5 },
+ { "SATURDAY", tDAY, 6 },
+ { NULL, 0, 0 }
+};
+
+static table const time_units_table[] =
+{
+ { "YEAR", tYEAR_UNIT, 1 },
+ { "MONTH", tMONTH_UNIT, 1 },
+ { "FORTNIGHT",tDAY_UNIT, 14 },
+ { "WEEK", tDAY_UNIT, 7 },
+ { "DAY", tDAY_UNIT, 1 },
+ { "HOUR", tHOUR_UNIT, 1 },
+ { "MINUTE", tMINUTE_UNIT, 1 },
+ { "MIN", tMINUTE_UNIT, 1 },
+ { "SECOND", tSEC_UNIT, 1 },
+ { "SEC", tSEC_UNIT, 1 },
+ { NULL, 0, 0 }
+};
+
+/* Assorted relative-time words. */
+static table const relative_time_table[] =
+{
+ { "TOMORROW", tDAY_SHIFT, 1 },
+ { "YESTERDAY",tDAY_SHIFT, -1 },
+ { "TODAY", tDAY_SHIFT, 0 },
+ { "NOW", tDAY_SHIFT, 0 },
+ { "LAST", tORDINAL, -1 },
+ { "THIS", tORDINAL, 0 },
+ { "NEXT", tORDINAL, 1 },
+ { "FIRST", tORDINAL, 1 },
+/*{ "SECOND", tORDINAL, 2 }, */
+ { "THIRD", tORDINAL, 3 },
+ { "FOURTH", tORDINAL, 4 },
+ { "FIFTH", tORDINAL, 5 },
+ { "SIXTH", tORDINAL, 6 },
+ { "SEVENTH", tORDINAL, 7 },
+ { "EIGHTH", tORDINAL, 8 },
+ { "NINTH", tORDINAL, 9 },
+ { "TENTH", tORDINAL, 10 },
+ { "ELEVENTH", tORDINAL, 11 },
+ { "TWELFTH", tORDINAL, 12 },
+ { "AGO", tAGO, 1 },
+ { NULL, 0, 0 }
+};
+
+/* The universal time zone table. These labels can be used even for
+ time stamps that would not otherwise be valid, e.g., GMT time
+ stamps in London during summer. */
+static table const universal_time_zone_table[] =
+{
+ { "GMT", tZONE, HOUR ( 0) }, /* Greenwich Mean */
+ { "UT", tZONE, HOUR ( 0) }, /* Universal (Coordinated) */
+ { "UTC", tZONE, HOUR ( 0) },
+ { NULL, 0, 0 }
+};
+
+/* The time zone table. This table is necessarily incomplete, as time
+ zone abbreviations are ambiguous; e.g. Australians interpret "EST"
+ as Eastern time in Australia, not as US Eastern Standard Time.
+ You cannot rely on parse_datetime to handle arbitrary time zone
+ abbreviations; use numeric abbreviations like `-0500' instead. */
+static table const time_zone_table[] =
+{
+ { "WET", tZONE, HOUR ( 0) }, /* Western European */
+ { "WEST", tDAYZONE, HOUR ( 0) }, /* Western European Summer */
+ { "BST", tDAYZONE, HOUR ( 0) }, /* British Summer */
+ { "ART", tZONE, -HOUR ( 3) }, /* Argentina */
+ { "BRT", tZONE, -HOUR ( 3) }, /* Brazil */
+ { "BRST", tDAYZONE, -HOUR ( 3) }, /* Brazil Summer */
+ { "NST", tZONE, -(HOUR ( 3) + 30) }, /* Newfoundland Standard */
+ { "NDT", tDAYZONE,-(HOUR ( 3) + 30) }, /* Newfoundland Daylight */
+ { "AST", tZONE, -HOUR ( 4) }, /* Atlantic Standard */
+ { "ADT", tDAYZONE, -HOUR ( 4) }, /* Atlantic Daylight */
+ { "CLT", tZONE, -HOUR ( 4) }, /* Chile */
+ { "CLST", tDAYZONE, -HOUR ( 4) }, /* Chile Summer */
+ { "EST", tZONE, -HOUR ( 5) }, /* Eastern Standard */
+ { "EDT", tDAYZONE, -HOUR ( 5) }, /* Eastern Daylight */
+ { "CST", tZONE, -HOUR ( 6) }, /* Central Standard */
+ { "CDT", tDAYZONE, -HOUR ( 6) }, /* Central Daylight */
+ { "MST", tZONE, -HOUR ( 7) }, /* Mountain Standard */
+ { "MDT", tDAYZONE, -HOUR ( 7) }, /* Mountain Daylight */
+ { "PST", tZONE, -HOUR ( 8) }, /* Pacific Standard */
+ { "PDT", tDAYZONE, -HOUR ( 8) }, /* Pacific Daylight */
+ { "AKST", tZONE, -HOUR ( 9) }, /* Alaska Standard */
+ { "AKDT", tDAYZONE, -HOUR ( 9) }, /* Alaska Daylight */
+ { "HST", tZONE, -HOUR (10) }, /* Hawaii Standard */
+ { "HAST", tZONE, -HOUR (10) }, /* Hawaii-Aleutian Standard */
+ { "HADT", tDAYZONE, -HOUR (10) }, /* Hawaii-Aleutian Daylight */
+ { "SST", tZONE, -HOUR (12) }, /* Samoa Standard */
+ { "WAT", tZONE, HOUR ( 1) }, /* West Africa */
+ { "CET", tZONE, HOUR ( 1) }, /* Central European */
+ { "CEST", tDAYZONE, HOUR ( 1) }, /* Central European Summer */
+ { "MET", tZONE, HOUR ( 1) }, /* Middle European */
+ { "MEZ", tZONE, HOUR ( 1) }, /* Middle European */
+ { "MEST", tDAYZONE, HOUR ( 1) }, /* Middle European Summer */
+ { "MESZ", tDAYZONE, HOUR ( 1) }, /* Middle European Summer */
+ { "EET", tZONE, HOUR ( 2) }, /* Eastern European */
+ { "EEST", tDAYZONE, HOUR ( 2) }, /* Eastern European Summer */
+ { "CAT", tZONE, HOUR ( 2) }, /* Central Africa */
+ { "SAST", tZONE, HOUR ( 2) }, /* South Africa Standard */
+ { "EAT", tZONE, HOUR ( 3) }, /* East Africa */
+ { "MSK", tZONE, HOUR ( 3) }, /* Moscow */
+ { "MSD", tDAYZONE, HOUR ( 3) }, /* Moscow Daylight */
+ { "IST", tZONE, (HOUR ( 5) + 30) }, /* India Standard */
+ { "SGT", tZONE, HOUR ( 8) }, /* Singapore */
+ { "KST", tZONE, HOUR ( 9) }, /* Korea Standard */
+ { "JST", tZONE, HOUR ( 9) }, /* Japan Standard */
+ { "GST", tZONE, HOUR (10) }, /* Guam Standard */
+ { "NZST", tZONE, HOUR (12) }, /* New Zealand Standard */
+ { "NZDT", tDAYZONE, HOUR (12) }, /* New Zealand Daylight */
+ { NULL, 0, 0 }
+};
+
+/* Military time zone table. */
+static table const military_table[] =
+{
+ { "A", tZONE, -HOUR ( 1) },
+ { "B", tZONE, -HOUR ( 2) },
+ { "C", tZONE, -HOUR ( 3) },
+ { "D", tZONE, -HOUR ( 4) },
+ { "E", tZONE, -HOUR ( 5) },
+ { "F", tZONE, -HOUR ( 6) },
+ { "G", tZONE, -HOUR ( 7) },
+ { "H", tZONE, -HOUR ( 8) },
+ { "I", tZONE, -HOUR ( 9) },
+ { "K", tZONE, -HOUR (10) },
+ { "L", tZONE, -HOUR (11) },
+ { "M", tZONE, -HOUR (12) },
+ { "N", tZONE, HOUR ( 1) },
+ { "O", tZONE, HOUR ( 2) },
+ { "P", tZONE, HOUR ( 3) },
+ { "Q", tZONE, HOUR ( 4) },
+ { "R", tZONE, HOUR ( 5) },
+ { "S", tZONE, HOUR ( 6) },
+ { "T", tZONE, HOUR ( 7) },
+ { "U", tZONE, HOUR ( 8) },
+ { "V", tZONE, HOUR ( 9) },
+ { "W", tZONE, HOUR (10) },
+ { "X", tZONE, HOUR (11) },
+ { "Y", tZONE, HOUR (12) },
+ { "Z", tZONE, HOUR ( 0) },
+ { NULL, 0, 0 }
+};
+
+\f
+
+/* Convert a time zone expressed as HH:MM into an integer count of
+ minutes. If MM is negative, then S is of the form HHMM and needs
+ to be picked apart; otherwise, S is of the form HH. As specified in
+ http://www.opengroup.org/susv3xbd/xbd_chap08.html#tag_08_03, allow
+ only valid TZ range, and consider first two digits as hours, if no
+ minutes specified. */
+
+static long int
+time_zone_hhmm (parser_control *pc, textint s, long int mm)
+{
+ long int n_minutes;
+
+ /* If the length of S is 1 or 2 and no minutes are specified,
+ interpret it as a number of hours. */
+ if (s.digits <= 2 && mm < 0)
+ s.value *= 100;
+
+ if (mm < 0)
+ n_minutes = (s.value / 100) * 60 + s.value % 100;
+ else
+ n_minutes = s.value * 60 + (s.negative ? -mm : mm);
+
+ /* If the absolute number of minutes is larger than 24 hours,
+ arrange to reject it by incrementing pc->zones_seen. Thus,
+ we allow only values in the range UTC-24:00 to UTC+24:00. */
+ if (24 * 60 < abs (n_minutes))
+ pc->zones_seen++;
+
+ return n_minutes;
+}
+
+static int
+to_hour (long int hours, int meridian)
+{
+ switch (meridian)
+ {
+ default: /* Pacify GCC. */
+ case MER24:
+ return 0 <= hours && hours < 24 ? hours : -1;
+ case MERam:
+ return 0 < hours && hours < 12 ? hours : hours == 12 ? 0 : -1;
+ case MERpm:
+ return 0 < hours && hours < 12 ? hours + 12 : hours == 12 ? 12 : -1;
+ }
+}
+
+static long int
+to_year (textint textyear)
+{
+ long int year = textyear.value;
+
+ if (year < 0)
+ year = -year;
+
+ /* XPG4 suggests that years 00-68 map to 2000-2068, and
+ years 69-99 map to 1969-1999. */
+ else if (textyear.digits == 2)
+ year += year < 69 ? 2000 : 1900;
+
+ return year;
+}
+
+static table const *
+lookup_zone (parser_control const *pc, char const *name)
+{
+ table const *tp;
+
+ for (tp = universal_time_zone_table; tp->name; tp++)
+ if (strcmp (name, tp->name) == 0)
+ return tp;
+
+ /* Try local zone abbreviations before those in time_zone_table, as
+ the local ones are more likely to be right. */
+ for (tp = pc->local_time_zone_table; tp->name; tp++)
+ if (strcmp (name, tp->name) == 0)
+ return tp;
+
+ for (tp = time_zone_table; tp->name; tp++)
+ if (strcmp (name, tp->name) == 0)
+ return tp;
+
+ return NULL;
+}
+
+#if ! HAVE_TM_GMTOFF
+/* Yield the difference between *A and *B,
+ measured in seconds, ignoring leap seconds.
+ The body of this function is taken directly from the GNU C Library;
+ see src/strftime.c. */
+static long int
+tm_diff (struct tm const *a, struct tm const *b)
+{
+ /* Compute intervening leap days correctly even if year is negative.
+ Take care to avoid int overflow in leap day calculations. */
+ int a4 = SHR (a->tm_year, 2) + SHR (TM_YEAR_BASE, 2) - ! (a->tm_year & 3);
+ int b4 = SHR (b->tm_year, 2) + SHR (TM_YEAR_BASE, 2) - ! (b->tm_year & 3);
+ int a100 = a4 / 25 - (a4 % 25 < 0);
+ int b100 = b4 / 25 - (b4 % 25 < 0);
+ int a400 = SHR (a100, 2);
+ int b400 = SHR (b100, 2);
+ int intervening_leap_days = (a4 - b4) - (a100 - b100) + (a400 - b400);
+ long int ayear = a->tm_year;
+ long int years = ayear - b->tm_year;
+ long int days = (365 * years + intervening_leap_days
+ + (a->tm_yday - b->tm_yday));
+ return (60 * (60 * (24 * days + (a->tm_hour - b->tm_hour))
+ + (a->tm_min - b->tm_min))
+ + (a->tm_sec - b->tm_sec));
+}
+#endif /* ! HAVE_TM_GMTOFF */
+
+static table const *
+lookup_word (parser_control const *pc, char *word)
+{
+ char *p;
+ char *q;
+ size_t wordlen;
+ table const *tp;
+ bool period_found;
+ bool abbrev;
+
+ /* Make it uppercase. */
+ for (p = word; *p; p++)
+ {
+ unsigned char ch = *p;
+ *p = c_toupper (ch);
+ }
+
+ for (tp = meridian_table; tp->name; tp++)
+ if (strcmp (word, tp->name) == 0)
+ return tp;
+
+ /* See if we have an abbreviation for a month. */
+ wordlen = strlen (word);
+ abbrev = wordlen == 3 || (wordlen == 4 && word[3] == '.');
+
+ for (tp = month_and_day_table; tp->name; tp++)
+ if ((abbrev ? strncmp (word, tp->name, 3) : strcmp (word, tp->name)) == 0)
+ return tp;
+
+ if ((tp = lookup_zone (pc, word)))
+ return tp;
+
+ if (strcmp (word, dst_table[0].name) == 0)
+ return dst_table;
+
+ for (tp = time_units_table; tp->name; tp++)
+ if (strcmp (word, tp->name) == 0)
+ return tp;
+
+ /* Strip off any plural and try the units table again. */
+ if (word[wordlen - 1] == 'S')
+ {
+ word[wordlen - 1] = '\0';
+ for (tp = time_units_table; tp->name; tp++)
+ if (strcmp (word, tp->name) == 0)
+ return tp;
+ word[wordlen - 1] = 'S'; /* For "this" in relative_time_table. */
+ }
+
+ for (tp = relative_time_table; tp->name; tp++)
+ if (strcmp (word, tp->name) == 0)
+ return tp;
+
+ /* Military time zones. */
+ if (wordlen == 1)
+ for (tp = military_table; tp->name; tp++)
+ if (word[0] == tp->name[0])
+ return tp;
+
+ /* Drop out any periods and try the time zone table again. */
+ for (period_found = false, p = q = word; (*p = *q); q++)
+ if (*q == '.')
+ period_found = true;
+ else
+ p++;
+ if (period_found && (tp = lookup_zone (pc, word)))
+ return tp;
+
+ return NULL;
+}
+
+static int
+yylex (YYSTYPE *lvalp, parser_control *pc)
+{
+ unsigned char c;
+ size_t count;
+
+ for (;;)
+ {
+ while (c = *pc->input, c_isspace (c))
+ pc->input++;
+
+ if (ISDIGIT (c) || c == '-' || c == '+')
+ {
+ char const *p;
+ int sign;
+ unsigned long int value;
+ if (c == '-' || c == '+')
+ {
+ sign = c == '-' ? -1 : 1;
+ while (c = *++pc->input, c_isspace (c))
+ continue;
+ if (! ISDIGIT (c))
+ /* skip the '-' sign */
+ continue;
+ }
+ else
+ sign = 0;
+ p = pc->input;
+ for (value = 0; ; value *= 10)
+ {
+ unsigned long int value1 = value + (c - '0');
+ if (value1 < value)
+ return '?';
+ value = value1;
+ c = *++p;
+ if (! ISDIGIT (c))
+ break;
+ if (ULONG_MAX / 10 < value)
+ return '?';
+ }
+ if ((c == '.' || c == ',') && ISDIGIT (p[1]))
+ {
+ time_t s;
+ int ns;
+ int digits;
+ unsigned long int value1;
+
+ /* Check for overflow when converting value to time_t. */
+ if (sign < 0)
+ {
+ s = - value;
+ if (0 < s)
+ return '?';
+ value1 = -s;
+ }
+ else
+ {
+ s = value;
+ if (s < 0)
+ return '?';
+ value1 = s;
+ }
+ if (value != value1)
+ return '?';
+
+ /* Accumulate fraction, to ns precision. */
+ p++;
+ ns = *p++ - '0';
+ for (digits = 2; digits <= LOG10_BILLION; digits++)
+ {
+ ns *= 10;
+ if (ISDIGIT (*p))
+ ns += *p++ - '0';
+ }
+
+ /* Skip excess digits, truncating toward -Infinity. */
+ if (sign < 0)
+ for (; ISDIGIT (*p); p++)
+ if (*p != '0')
+ {
+ ns++;
+ break;
+ }
+ while (ISDIGIT (*p))
+ p++;
+
+ /* Adjust to the timespec convention, which is that
+ tv_nsec is always a positive offset even if tv_sec is
+ negative. */
+ if (sign < 0 && ns)
+ {
+ s--;
+ if (! (s < 0))
+ return '?';
+ ns = BILLION - ns;
+ }
+
+ lvalp->timespec.tv_sec = s;
+ lvalp->timespec.tv_nsec = ns;
+ pc->input = p;
+ return sign ? tSDECIMAL_NUMBER : tUDECIMAL_NUMBER;
+ }
+ else
+ {
+ lvalp->textintval.negative = sign < 0;
+ if (sign < 0)
+ {
+ lvalp->textintval.value = - value;
+ if (0 < lvalp->textintval.value)
+ return '?';
+ }
+ else
+ {
+ lvalp->textintval.value = value;
+ if (lvalp->textintval.value < 0)
+ return '?';
+ }
+ lvalp->textintval.digits = p - pc->input;
+ pc->input = p;
+ return sign ? tSNUMBER : tUNUMBER;
+ }
+ }
+
+ if (c_isalpha (c))
+ {
+ char buff[20];
+ char *p = buff;
+ table const *tp;
+
+ do
+ {
+ if (p < buff + sizeof buff - 1)
+ *p++ = c;
+ c = *++pc->input;
+ }
+ while (c_isalpha (c) || c == '.');
+
+ *p = '\0';
+ tp = lookup_word (pc, buff);
+ if (! tp)
+ return '?';
+ lvalp->intval = tp->value;
+ return tp->type;
+ }
+
+ if (c != '(')
+ return *pc->input++;
+ count = 0;
+ do
+ {
+ c = *pc->input++;
+ if (c == '\0')
+ return c;
+ if (c == '(')
+ count++;
+ else if (c == ')')
+ count--;
+ }
+ while (count != 0);
+ }
+}
+
+/* Do nothing if the parser reports an error. */
+static int
+yyerror (parser_control const *pc _GL_UNUSED,
+ char const *s _GL_UNUSED)
+{
+ return 0;
+}
+
+/* If *TM0 is the old and *TM1 is the new value of a struct tm after
+ passing it to mktime, return true if it's OK that mktime returned T.
+ It's not OK if *TM0 has out-of-range members. */
+
+static bool
+mktime_ok (struct tm const *tm0, struct tm const *tm1, time_t t)
+{
+ if (t == (time_t) -1)
+ {
+ /* Guard against falsely reporting an error when parsing a time
+ stamp that happens to equal (time_t) -1, on a host that
+ supports such a time stamp. */
+ tm1 = localtime (&t);
+ if (!tm1)
+ return false;
+ }
+
+ return ! ((tm0->tm_sec ^ tm1->tm_sec)
+ | (tm0->tm_min ^ tm1->tm_min)
+ | (tm0->tm_hour ^ tm1->tm_hour)
+ | (tm0->tm_mday ^ tm1->tm_mday)
+ | (tm0->tm_mon ^ tm1->tm_mon)
+ | (tm0->tm_year ^ tm1->tm_year));
+}
+
+/* A reasonable upper bound for the size of ordinary TZ strings.
+ Use heap allocation if TZ's length exceeds this. */
+enum { TZBUFSIZE = 100 };
+
+/* Return a copy of TZ, stored in TZBUF if it fits, and heap-allocated
+ otherwise. */
+static char *
+get_tz (char tzbuf[TZBUFSIZE])
+{
+ char *tz = getenv ("TZ");
+ if (tz)
+ {
+ size_t tzsize = strlen (tz) + 1;
+ tz = (tzsize <= TZBUFSIZE
+ ? memcpy (tzbuf, tz, tzsize)
+ : xmemdup (tz, tzsize));
+ }
+ return tz;
+}
+
+/* Parse a date/time string, storing the resulting time value into *RESULT.
+ The string itself is pointed to by P. Return true if successful.
+ P can be an incomplete or relative time specification; if so, use
+ *NOW as the basis for the returned time. */
+bool
+parse_datetime (struct timespec *result, char const *p,
+ struct timespec const *now)
+{
+ time_t Start;
+ long int Start_ns;
+ struct tm const *tmp;
+ struct tm tm;
+ struct tm tm0;
+ parser_control pc;
+ struct timespec gettime_buffer;
+ unsigned char c;
+ bool tz_was_altered = false;
+ char *tz0 = NULL;
+ char tz0buf[TZBUFSIZE];
+ bool ok = true;
+
+ if (! now)
+ {
+ gettime (&gettime_buffer);
+ now = &gettime_buffer;
+ }
+
+ Start = now->tv_sec;
+ Start_ns = now->tv_nsec;
+
+ tmp = localtime (&now->tv_sec);
+ if (! tmp)
+ return false;
+
+ while (c = *p, c_isspace (c))
+ p++;
+
+ if (strncmp (p, "TZ=\"", 4) == 0)
+ {
+ char const *tzbase = p + 4;
+ size_t tzsize = 1;
+ char const *s;
+
+ for (s = tzbase; *s; s++, tzsize++)
+ if (*s == '\\')
+ {
+ s++;
+ if (! (*s == '\\' || *s == '"'))
+ break;
+ }
+ else if (*s == '"')
+ {
+ char *z;
+ char *tz1;
+ char tz1buf[TZBUFSIZE];
+ bool large_tz = TZBUFSIZE < tzsize;
+ bool setenv_ok;
+ /* Free tz0, in case this is the 2nd or subsequent time through. */
+ free (tz0);
+ tz0 = get_tz (tz0buf);
+ z = tz1 = large_tz ? xmalloc (tzsize) : tz1buf;
+ for (s = tzbase; *s != '"'; s++)
+ *z++ = *(s += *s == '\\');
+ *z = '\0';
+ setenv_ok = setenv ("TZ", tz1, 1) == 0;
+ if (large_tz)
+ free (tz1);
+ if (!setenv_ok)
+ goto fail;
+ tz_was_altered = true;
+ p = s + 1;
+ }
+ }
+
+ /* As documented, be careful to treat the empty string just like
+ a date string of "0". Without this, an empty string would be
+ declared invalid when parsed during a DST transition. */
+ if (*p == '\0')
+ p = "0";
+
+ pc.input = p;
+ pc.year.value = tmp->tm_year;
+ pc.year.value += TM_YEAR_BASE;
+ pc.year.digits = 0;
+ pc.month = tmp->tm_mon + 1;
+ pc.day = tmp->tm_mday;
+ pc.hour = tmp->tm_hour;
+ pc.minutes = tmp->tm_min;
+ pc.seconds.tv_sec = tmp->tm_sec;
+ pc.seconds.tv_nsec = Start_ns;
+ tm.tm_isdst = tmp->tm_isdst;
+
+ pc.meridian = MER24;
+ pc.rel = RELATIVE_TIME_0;
+ pc.timespec_seen = false;
+ pc.rels_seen = false;
+ pc.dates_seen = 0;
+ pc.days_seen = 0;
+ pc.times_seen = 0;
+ pc.local_zones_seen = 0;
+ pc.dsts_seen = 0;
+ pc.zones_seen = 0;
+
+#if HAVE_STRUCT_TM_TM_ZONE
+ pc.local_time_zone_table[0].name = tmp->tm_zone;
+ pc.local_time_zone_table[0].type = tLOCAL_ZONE;
+ pc.local_time_zone_table[0].value = tmp->tm_isdst;
+ pc.local_time_zone_table[1].name = NULL;
+
+ /* Probe the names used in the next three calendar quarters, looking
+ for a tm_isdst different from the one we already have. */
+ {
+ int quarter;
+ for (quarter = 1; quarter <= 3; quarter++)
+ {
+ time_t probe = Start + quarter * (90 * 24 * 60 * 60);
+ struct tm const *probe_tm = localtime (&probe);
+ if (probe_tm && probe_tm->tm_zone
+ && probe_tm->tm_isdst != pc.local_time_zone_table[0].value)
+ {
+ {
+ pc.local_time_zone_table[1].name = probe_tm->tm_zone;
+ pc.local_time_zone_table[1].type = tLOCAL_ZONE;
+ pc.local_time_zone_table[1].value = probe_tm->tm_isdst;
+ pc.local_time_zone_table[2].name = NULL;
+ }
+ break;
+ }
+ }
+ }
+#else
+#if HAVE_TZNAME
+ {
+# if !HAVE_DECL_TZNAME
+ extern char *tzname[];
+# endif
+ int i;
+ for (i = 0; i < 2; i++)
+ {
+ pc.local_time_zone_table[i].name = tzname[i];
+ pc.local_time_zone_table[i].type = tLOCAL_ZONE;
+ pc.local_time_zone_table[i].value = i;
+ }
+ pc.local_time_zone_table[i].name = NULL;
+ }
+#else
+ pc.local_time_zone_table[0].name = NULL;
+#endif
+#endif
+
+ if (pc.local_time_zone_table[0].name && pc.local_time_zone_table[1].name
+ && ! strcmp (pc.local_time_zone_table[0].name,
+ pc.local_time_zone_table[1].name))
+ {
+ /* This locale uses the same abbrevation for standard and
+ daylight times. So if we see that abbreviation, we don't
+ know whether it's daylight time. */
+ pc.local_time_zone_table[0].value = -1;
+ pc.local_time_zone_table[1].name = NULL;
+ }
+
+ if (yyparse (&pc) != 0)
+ goto fail;
+
+ if (pc.timespec_seen)
+ *result = pc.seconds;
+ else
+ {
+ if (1 < (pc.times_seen | pc.dates_seen | pc.days_seen | pc.dsts_seen
+ | (pc.local_zones_seen + pc.zones_seen)))
+ goto fail;
+
+ tm.tm_year = to_year (pc.year) - TM_YEAR_BASE;
+ tm.tm_mon = pc.month - 1;
+ tm.tm_mday = pc.day;
+ if (pc.times_seen || (pc.rels_seen && ! pc.dates_seen && ! pc.days_seen))
+ {
+ tm.tm_hour = to_hour (pc.hour, pc.meridian);
+ if (tm.tm_hour < 0)
+ goto fail;
+ tm.tm_min = pc.minutes;
+ tm.tm_sec = pc.seconds.tv_sec;
+ }
+ else
+ {
+ tm.tm_hour = tm.tm_min = tm.tm_sec = 0;
+ pc.seconds.tv_nsec = 0;
+ }
+
+ /* Let mktime deduce tm_isdst if we have an absolute time stamp. */
+ if (pc.dates_seen | pc.days_seen | pc.times_seen)
+ tm.tm_isdst = -1;
+
+ /* But if the input explicitly specifies local time with or without
+ DST, give mktime that information. */
+ if (pc.local_zones_seen)
+ tm.tm_isdst = pc.local_isdst;
+
+ tm0 = tm;
+
+ Start = mktime (&tm);
+
+ if (! mktime_ok (&tm0, &tm, Start))
+ {
+ if (! pc.zones_seen)
+ goto fail;
+ else
+ {
+ /* Guard against falsely reporting errors near the time_t
+ boundaries when parsing times in other time zones. For
+ example, suppose the input string "1969-12-31 23:00:00 -0100",
+ the current time zone is 8 hours ahead of UTC, and the min
+ time_t value is 1970-01-01 00:00:00 UTC. Then the min
+ localtime value is 1970-01-01 08:00:00, and mktime will
+ therefore fail on 1969-12-31 23:00:00. To work around the
+ problem, set the time zone to 1 hour behind UTC temporarily
+ by setting TZ="XXX1:00" and try mktime again. */
+
+ long int time_zone = pc.time_zone;
+ long int abs_time_zone = time_zone < 0 ? - time_zone : time_zone;
+ long int abs_time_zone_hour = abs_time_zone / 60;
+ int abs_time_zone_min = abs_time_zone % 60;
+ char tz1buf[sizeof "XXX+0:00"
+ + sizeof pc.time_zone * CHAR_BIT / 3];
+ if (!tz_was_altered)
+ tz0 = get_tz (tz0buf);
+ sprintf (tz1buf, "XXX%s%ld:%02d", "-" + (time_zone < 0),
+ abs_time_zone_hour, abs_time_zone_min);
+ if (setenv ("TZ", tz1buf, 1) != 0)
+ goto fail;
+ tz_was_altered = true;
+ tm = tm0;
+ Start = mktime (&tm);
+ if (! mktime_ok (&tm0, &tm, Start))
+ goto fail;
+ }
+ }
+
+ if (pc.days_seen && ! pc.dates_seen)
+ {
+ tm.tm_mday += ((pc.day_number - tm.tm_wday + 7) % 7
+ + 7 * (pc.day_ordinal
+ - (0 < pc.day_ordinal
+ && tm.tm_wday != pc.day_number)));
+ tm.tm_isdst = -1;
+ Start = mktime (&tm);
+ if (Start == (time_t) -1)
+ goto fail;
+ }
+
+ /* Add relative date. */
+ if (pc.rel.year | pc.rel.month | pc.rel.day)
+ {
+ int year = tm.tm_year + pc.rel.year;
+ int month = tm.tm_mon + pc.rel.month;
+ int day = tm.tm_mday + pc.rel.day;
+ if (((year < tm.tm_year) ^ (pc.rel.year < 0))
+ | ((month < tm.tm_mon) ^ (pc.rel.month < 0))
+ | ((day < tm.tm_mday) ^ (pc.rel.day < 0)))
+ goto fail;
+ tm.tm_year = year;
+ tm.tm_mon = month;
+ tm.tm_mday = day;
+ tm.tm_hour = tm0.tm_hour;
+ tm.tm_min = tm0.tm_min;
+ tm.tm_sec = tm0.tm_sec;
+ tm.tm_isdst = tm0.tm_isdst;
+ Start = mktime (&tm);
+ if (Start == (time_t) -1)
+ goto fail;
+ }
+
+ /* The only "output" of this if-block is an updated Start value,
+ so this block must follow others that clobber Start. */
+ if (pc.zones_seen)
+ {
+ long int delta = pc.time_zone * 60;
+ time_t t1;
+#ifdef HAVE_TM_GMTOFF
+ delta -= tm.tm_gmtoff;
+#else
+ time_t t = Start;
+ struct tm const *gmt = gmtime (&t);
+ if (! gmt)
+ goto fail;
+ delta -= tm_diff (&tm, gmt);
+#endif
+ t1 = Start - delta;
+ if ((Start < t1) != (delta < 0))
+ goto fail; /* time_t overflow */
+ Start = t1;
+ }
+
+ /* Add relative hours, minutes, and seconds. On hosts that support
+ leap seconds, ignore the possibility of leap seconds; e.g.,
+ "+ 10 minutes" adds 600 seconds, even if one of them is a
+ leap second. Typically this is not what the user wants, but it's
+ too hard to do it the other way, because the time zone indicator
+ must be applied before relative times, and if mktime is applied
+ again the time zone will be lost. */
+ {
+ long int sum_ns = pc.seconds.tv_nsec + pc.rel.ns;
+ long int normalized_ns = (sum_ns % BILLION + BILLION) % BILLION;
+ time_t t0 = Start;
+ long int d1 = 60 * 60 * pc.rel.hour;
+ time_t t1 = t0 + d1;
+ long int d2 = 60 * pc.rel.minutes;
+ time_t t2 = t1 + d2;
+ long_time_t d3 = pc.rel.seconds;
+ long_time_t t3 = t2 + d3;
+ long int d4 = (sum_ns - normalized_ns) / BILLION;
+ long_time_t t4 = t3 + d4;
+ time_t t5 = t4;
+
+ if ((d1 / (60 * 60) ^ pc.rel.hour)
+ | (d2 / 60 ^ pc.rel.minutes)
+ | ((t1 < t0) ^ (d1 < 0))
+ | ((t2 < t1) ^ (d2 < 0))
+ | ((t3 < t2) ^ (d3 < 0))
+ | ((t4 < t3) ^ (d4 < 0))
+ | (t5 != t4))
+ goto fail;
+
+ result->tv_sec = t5;
+ result->tv_nsec = normalized_ns;
+ }
+ }
+
+ goto done;
+
+ fail:
+ ok = false;
+ done:
+ if (tz_was_altered)
+ ok &= (tz0 ? setenv ("TZ", tz0, 1) : unsetenv ("TZ")) == 0;
+ if (tz0 != tz0buf)
+ free (tz0);
+ return ok;
+}
+
+#if TEST
+
+int
+main (int ac, char **av)
+{
+ char buff[BUFSIZ];
+
+ printf ("Enter date, or blank line to exit.\n\t> ");
+ fflush (stdout);
+
+ buff[BUFSIZ - 1] = '\0';
+ while (fgets (buff, BUFSIZ - 1, stdin) && buff[0])
+ {
+ struct timespec d;
+ struct tm const *tm;
+ if (! parse_datetime (&d, buff, NULL))
+ printf ("Bad format - couldn't convert.\n");
+ else if (! (tm = localtime (&d.tv_sec)))
+ {
+ long int sec = d.tv_sec;
+ printf ("localtime (%ld) failed\n", sec);
+ }
+ else
+ {
+ int ns = d.tv_nsec;
+ printf ("%04ld-%02d-%02d %02d:%02d:%02d.%09d\n",
+ tm->tm_year + 1900L, tm->tm_mon + 1, tm->tm_mday,
+ tm->tm_hour, tm->tm_min, tm->tm_sec, ns);
+ }
+ printf ("\t> ");
+ fflush (stdout);
+ }
+ return 0;
+}
+#endif /* TEST */
# include <io.h>
-#else
-/* Unix API. */
-
-# ifndef O_CLOEXEC
-# define O_CLOEXEC 0
-# endif
-
#endif
int
#include <alloca.h>
#include <sys/types.h>
-#include "poll.h"
+
+/* Specification. */
+#include <poll.h>
+
#include <errno.h>
#include <limits.h>
#include <assert.h>
#endif /* !MinGW */
int
-poll (pfd, nfd, timeout)
- struct pollfd *pfd;
- nfds_t nfd;
- int timeout;
+poll (struct pollfd *pfd, nfds_t nfd, int timeout)
{
#ifndef WIN32_NATIVE
fd_set rfds, wfds, efds;
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
#ifndef _GL_POLL_H
+
+#if __GNUC__ >= 3
+@PRAGMA_SYSTEM_HEADER@
+#endif
+@PRAGMA_COLUMNS@
+
+/* The include_next requires a split double-inclusion guard. */
+#if @HAVE_POLL_H@
+# @INCLUDE_NEXT@ @NEXT_POLL_H@
+#endif
+
+#ifndef _GL_POLL_H
#define _GL_POLL_H
+
+/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
+
+/* The definition of _GL_WARN_ON_USE is copied here. */
+
+
+#if !@HAVE_POLL_H@
+
/* fake a poll(2) environment */
-#define POLLIN 0x0001 /* any readable data available */
-#define POLLPRI 0x0002 /* OOB/Urgent readable data */
-#define POLLOUT 0x0004 /* file descriptor is writeable */
-#define POLLERR 0x0008 /* some poll error occurred */
-#define POLLHUP 0x0010 /* file descriptor was "hung up" */
-#define POLLNVAL 0x0020 /* requested events "invalid" */
-#define POLLRDNORM 0x0040
-#define POLLRDBAND 0x0080
-#define POLLWRNORM 0x0100
-#define POLLWRBAND 0x0200
+# define POLLIN 0x0001 /* any readable data available */
+# define POLLPRI 0x0002 /* OOB/Urgent readable data */
+# define POLLOUT 0x0004 /* file descriptor is writeable */
+# define POLLERR 0x0008 /* some poll error occurred */
+# define POLLHUP 0x0010 /* file descriptor was "hung up" */
+# define POLLNVAL 0x0020 /* requested events "invalid" */
+# define POLLRDNORM 0x0040
+# define POLLRDBAND 0x0080
+# define POLLWRNORM 0x0100
+# define POLLWRBAND 0x0200
struct pollfd
{
typedef unsigned long nfds_t;
-extern int poll (struct pollfd *pfd, nfds_t nfd, int timeout);
-
/* Define INFTIM only if doing so conforms to POSIX. */
-#if !defined (_POSIX_C_SOURCE) && !defined (_XOPEN_SOURCE)
-#define INFTIM (-1)
+# if !defined (_POSIX_C_SOURCE) && !defined (_XOPEN_SOURCE)
+# define INFTIM (-1)
+# endif
+
#endif
+
+#if @GNULIB_POLL@
+# if @REPLACE_POLL@
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# undef poll
+# define poll rpl_poll
+# endif
+_GL_FUNCDECL_RPL (poll, int, (struct pollfd *pfd, nfds_t nfd, int timeout));
+_GL_CXXALIAS_RPL (poll, int, (struct pollfd *pfd, nfds_t nfd, int timeout));
+# else
+# if !@HAVE_POLL@
+_GL_FUNCDECL_SYS (poll, int, (struct pollfd *pfd, nfds_t nfd, int timeout));
+# endif
+_GL_CXXALIAS_SYS (poll, int, (struct pollfd *pfd, nfds_t nfd, int timeout));
+# endif
+_GL_CXXALIASWARN (poll);
+#elif defined GNULIB_POSIXCHECK
+# undef poll
+# if HAVE_RAW_DECL_POLL
+_GL_WARN_ON_USE (poll, "poll is unportable - "
+ "use gnulib module poll for portability");
+# endif
+#endif
+
+
+#endif /* _GL_POLL_H */
#endif /* _GL_POLL_H */
open_noinherit (char const *name, int flags)
{
int fd;
-#ifdef O_CLOEXEC
+#if O_CLOEXEC
/* 0 = unknown, 1 = yes, -1 = no. */
static int have_cloexec;
if (have_cloexec >= 0)
# include "xalloc.h"
#endif
+#ifndef O_EXEC
+# define O_EXEC O_RDONLY /* This is often close enough in older systems. */
+#endif
+
/* Declare canonicalize_file_name.
The <stdlib.h> included above may be the system's one, not the gnulib
one. */
if (link != NULL && link[0] != '[')
return link;
if (executable_fd < 0)
- executable_fd = open ("/proc/self/exe", O_RDONLY, 0);
+ executable_fd = open ("/proc/self/exe", O_EXEC, 0);
{
char buf[6+10+5];
if (link != NULL && link[0] != '[')
return link;
if (executable_fd < 0)
- executable_fd = open (buf, O_RDONLY, 0);
+ executable_fd = open (buf, O_EXEC, 0);
}
}
#endif
/* Written by Paul Eggert and Glen Lenker. */
#ifndef _GL_PTHREAD_H_
+
+#if __GNUC__ >= 3
+@PRAGMA_SYSTEM_HEADER@
+#endif
+@PRAGMA_COLUMNS@
+
+/* The include_next requires a split double-inclusion guard. */
+#if @HAVE_PTHREAD_H@
+# @INCLUDE_NEXT@ @NEXT_PTHREAD_H@
+#endif
+
+#ifndef _GL_PTHREAD_H_
#define _GL_PTHREAD_H_
#include <errno.h>
#include <sys/types.h>
#include <time.h>
-#ifndef HAVE_PTHREAD_T
+#if ! @HAVE_PTHREAD_T@
typedef int pthread_t;
typedef int pthread_attr_t;
typedef int pthread_barrier_t;
typedef int pthread_once_t;
typedef int pthread_rwlock_t;
typedef int pthread_rwlockattr_t;
- typedef int pthread_spinlock_t;
#endif
+#ifndef PTHREAD_COND_INITIALIZER
#define PTHREAD_COND_INITIALIZER { 0 }
#define PTHREAD_MUTEX_INITIALIZER { 0 }
#define PTHREAD_ONCE_INIT { 0 }
#define PTHREAD_SCOPE_SYSTEM 0
#define PTHREAD_SCOPE_PROCESS 1
+#endif
+
+#if ! @HAVE_PTHREAD_T@
/* Provide substitutes for the thread functions that should work
adequately on a single-threaded implementation, where
}
static inline int
+pthread_mutexattr_destroy (pthread_mutexattr_t *attr)
+{
+ return 0;
+}
+
+static inline int
+pthread_mutexattr_init (pthread_mutexattr_t *attr)
+{
+ return 0;
+}
+
+static inline int
+pthread_mutexattr_settype (pthread_mutexattr_t *attr, int attr_type)
+{
+ return 0;
+}
+
+static inline int
pthread_mutex_destroy (pthread_mutex_t *mutex)
{
/* MUTEX is never seriously used. */
}
static inline int
+pthread_mutex_trylock (pthread_mutex_t *mutex)
+{
+ return pthread_mutex_lock (mutex);
+}
+
+static inline int
pthread_mutex_unlock (pthread_mutex_t *mutex)
{
/* There is only one thread, so it always unlocks successfully.
return 0;
}
+#endif
+
+#if ! @HAVE_PTHREAD_SPINLOCK_T@
+
+/* Approximate spinlocks with mutexes. */
+
+typedef pthread_mutex_t pthread_spinlock_t;
+
static inline int
pthread_spin_init (pthread_spinlock_t *lock, int pshared)
{
- /* LOCK is never seriously used. */
- return 0;
+ return pthread_mutex_init (lock, NULL);
+}
+
+static inline int
+pthread_spin_destroy (pthread_spinlock_t *lock)
+{
+ return pthread_mutex_destroy (lock);
}
static inline int
pthread_spin_lock (pthread_spinlock_t *lock)
{
- /* Only one thread, so it always gets the lock. */
- return 0;
+ return pthread_mutex_lock (lock);
}
static inline int
pthread_spin_trylock (pthread_spinlock_t *lock)
{
- /* Only one thread, so it always gets the lock. Assume that a
- thread never tries a lock that it already holds. */
- return 0;
+ return pthread_mutex_trylock (lock);
}
static inline int
pthread_spin_unlock (pthread_spinlock_t *lock)
{
- /* Only one thread, so spin locks are no-ops. */
- return 0;
+ return pthread_mutex_unlock (lock);
}
+#endif
#endif /* _GL_PTHREAD_H_ */
+#endif /* _GL_PTHREAD_H_ */
#if __GNUC__ >= 3
@PRAGMA_SYSTEM_HEADER@
#endif
+@PRAGMA_COLUMNS@
/* The include_next requires a split double-inclusion guard. */
#if @HAVE_PTY_H@
# include <util.h>
#endif
#if @HAVE_LIBUTIL_H@
+/* <sys/types.h> is a prerequisite of <libutil.h> on FreeBSD 8.0. */
+# include <sys/types.h>
# include <libutil.h>
#endif
#include "read-file.h"
-/* Get realloc, free. */
+/* Get fstat. */
+#include <sys/stat.h>
+
+/* Get ftello. */
+#include <stdio.h>
+
+/* Get SIZE_MAX. */
+#include <stdint.h>
+
+/* Get malloc, realloc, free. */
#include <stdlib.h>
/* Get errno. */
{
char *buf = NULL;
size_t alloc = 0;
- size_t size = 0;
- int save_errno;
-
- for (;;)
- {
- size_t count;
- size_t requested;
-
- if (size + BUFSIZ + 1 > alloc)
- {
- char *new_buf;
-
- alloc += alloc / 2;
- if (alloc < size + BUFSIZ + 1)
- alloc = size + BUFSIZ + 1;
- new_buf = realloc (buf, alloc);
- if (!new_buf)
- {
- save_errno = errno;
+ /* For a regular file, allocate a buffer that has exactly the right
+ size. This avoids the need to do dynamic reallocations later. */
+ {
+ struct stat st;
+
+ if (fstat (fileno (stream), &st) >= 0 && S_ISREG (st.st_mode))
+ {
+ off_t pos = ftello (stream);
+
+ if (pos >= 0 && pos < st.st_size)
+ {
+ off_t alloc_off = st.st_size - pos;
+
+ if (SIZE_MAX <= alloc_off)
+ {
+ errno = ENOMEM;
+ return NULL;
+ }
+
+ alloc = alloc_off + 1;
+
+ buf = malloc (alloc);
+ if (!buf)
+ /* errno is ENOMEM. */
+ return NULL;
+ }
+ }
+ }
+
+ {
+ size_t size = 0; /* number of bytes read so far */
+ int save_errno;
+
+ for (;;)
+ {
+ size_t count;
+ size_t requested;
+
+ if (size + BUFSIZ + 1 > alloc)
+ {
+ char *new_buf;
+ size_t new_alloc = alloc + alloc / 2;
+
+ /* Check against overflow. */
+ if (new_alloc < alloc)
+ {
+ save_errno = ENOMEM;
+ break;
+ }
+
+ alloc = new_alloc;
+ if (alloc < size + BUFSIZ + 1)
+ alloc = size + BUFSIZ + 1;
+
+ new_buf = realloc (buf, alloc);
+ if (!new_buf)
+ {
+ save_errno = errno;
+ break;
+ }
+
+ buf = new_buf;
+ }
+
+ requested = alloc - size - 1;
+ count = fread (buf + size, 1, requested, stream);
+ size += count;
+
+ if (count != requested)
+ {
+ save_errno = errno;
+ if (ferror (stream))
break;
- }
- buf = new_buf;
- }
-
- requested = alloc - size - 1;
- count = fread (buf + size, 1, requested, stream);
- size += count;
-
- if (count != requested)
- {
- save_errno = errno;
- if (ferror (stream))
- break;
- buf[size] = '\0';
- *length = size;
- return buf;
- }
- }
-
- free (buf);
- errno = save_errno;
- return NULL;
+ /* Shrink the allocated memory if possible. */
+ if (size + 1 < alloc)
+ {
+ char *smaller_buf = realloc (buf, size + 1);
+ if (smaller_buf != NULL)
+ buf = smaller_buf;
+ }
+
+ buf[size] = '\0';
+ *length = size;
+ return buf;
+ }
+ }
+
+ free (buf);
+ errno = save_errno;
+ return NULL;
+ }
}
static char *
/* 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.
- Only the AC_FUNC_MALLOC macro defines 'malloc' already in config.h. */
-#if GNULIB_MALLOC_GNU && !defined malloc
+ The gnulib module 'malloc-gnu' defines HAVE_MALLOC_GNU. */
+#if GNULIB_MALLOC_GNU && HAVE_MALLOC_GNU
# define SYSTEM_MALLOC_GLIBC_COMPATIBLE 1
#endif
--- /dev/null
+/* Construct a regular expression from a literal string.
+ Copyright (C) 1995, 2010 Free Software Foundation, Inc.
+ Written by Bruno Haible <haible@clisp.cons.org>, 2010.
+
+ 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/>. */
+
+#include <config.h>
+
+/* Specification. */
+#include "regex-quote.h"
+
+#include <string.h>
+
+#include "mbuiter.h"
+#include "xalloc.h"
+
+/* Characters that are special in a BRE. */
+static const char bre_special[] = "$^.*[]\\";
+
+/* Characters that are special in an ERE. */
+static const char ere_special[] = "$^.*[]\\+?()";
+
+size_t
+regex_quote_length (const char *string, int cflags)
+{
+ const char *special = (cflags != 0 ? ere_special : bre_special);
+ size_t length;
+ mbui_iterator_t iter;
+
+ length = 0;
+ for (mbui_init (iter, string); mbui_avail (iter); mbui_advance (iter))
+ {
+ /* We know that special contains only ASCII characters. */
+ if (mb_len (mbui_cur (iter)) == 1
+ && strchr (special, * mbui_cur_ptr (iter)))
+ length += 1;
+ length += mb_len (mbui_cur (iter));
+ }
+ return length;
+}
+
+/* Copies the quoted string to p and returns the incremented p.
+ There must be room for regex_quote_length (string, cflags) + 1 bytes at p.
+ */
+char *
+regex_quote_copy (char *p, const char *string, int cflags)
+{
+ const char *special = (cflags != 0 ? ere_special : bre_special);
+ mbui_iterator_t iter;
+
+ for (mbui_init (iter, string); mbui_avail (iter); mbui_advance (iter))
+ {
+ /* We know that special contains only ASCII characters. */
+ if (mb_len (mbui_cur (iter)) == 1
+ && strchr (special, * mbui_cur_ptr (iter)))
+ *p++ = '\\';
+ memcpy (p, mbui_cur_ptr (iter), mb_len (mbui_cur (iter)));
+ p += mb_len (mbui_cur (iter));
+ }
+ return p;
+}
+
+/* Returns the freshly allocated quoted string. */
+char *
+regex_quote (const char *string, int cflags)
+{
+ size_t length = regex_quote_length (string, cflags);
+ char *result = XNMALLOC (length + 1, char);
+ char *p;
+
+ p = result;
+ p = regex_quote_copy (p, string, cflags);
+ *p = '\0';
+ return result;
+}
--- /dev/null
+/* Construct a regular expression from a literal string.
+ Copyright (C) 1995, 2010 Free Software Foundation, Inc.
+ Written by Bruno Haible <haible@clisp.cons.org>, 2010.
+
+ 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/>. */
+
+#include <stddef.h>
+
+/* regex_quote converts a literal string to a regular expression that will
+ look for this literal string.
+ cflags can be 0 or REG_EXTENDED.
+ If it is 0, the result is a Basic Regular Expression (BRE)
+ <http://www.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap09.html#tag_09_03>.
+ If it is REG_EXTENDED, the result is an Extended Regular Expression (ERE)
+ <http://www.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap09.html#tag_09_04>.
+ The result is not anchored; if you want it to match only complete lines,
+ you need to add "^" at the beginning of the result and "$" at the end of the
+ result.
+ */
+
+/* Returns the number of bytes needed for the quoted string. */
+extern size_t regex_quote_length (const char *string, int cflags);
+
+/* Copies the quoted string to p and returns the incremented p.
+ There must be room for regex_quote_length (string, cflags) + 1 bytes at p.
+ */
+extern char * regex_quote_copy (char *p, const char *string, int cflags);
+
+/* Returns the freshly allocated quoted string. */
+extern char * regex_quote (const char *string, int cflags);
/* If this bit is set, then ^ and $ are always anchors (outside bracket
expressions, of course).
If this bit is not set, then it depends:
- ^ is an anchor if it is at the beginning of a regular
- expression or after an open-group or an alternation operator;
- $ is an anchor if it is at the end of a regular expression, or
- before a close-group or an alternation operator.
+ ^ is an anchor if it is at the beginning of a regular
+ expression or after an open-group or an alternation operator;
+ $ is an anchor if it is at the end of a regular expression, or
+ before a close-group or an alternation operator.
This bit could be (re)combined with RE_CONTEXT_INDEP_OPS, because
POSIX draft 11.2 says that * etc. in leading positions is undefined.
whether ^ should be special. */
# define RE_CARET_ANCHORS_HERE (RE_ICASE << 1)
-/* If this bit is set, then \{ cannot be first in an bre or
- immediately after an alternation or begin-group operator. */
+/* If this bit is set, then \{ cannot be first in a regex or
+ immediately after an alternation, open-group or \} operator. */
# define RE_CONTEXT_INVALID_DUP (RE_CARET_ANCHORS_HERE << 1)
/* If this bit is set, then no_sub will be set to 1 during
#endif
unsigned int _REG_RE_NAME (regs_allocated) : 2;
- /* Set to zero when `regex_compile' compiles a pattern; set to one
- by `re_compile_fastmap' if it updates the fastmap. */
+ /* Set to zero when `re_compile_pattern' compiles a pattern; set to
+ one by `re_compile_fastmap' if it updates the fastmap. */
unsigned int _REG_RE_NAME (fastmap_accurate) : 1;
/* If set, `re_match_2' does not return information about
register data.
Unless this function is called, the first search or match using
- PATTERN_BUFFER will allocate its own register data, without
- freeing the old data. */
+ BUFFER will allocate its own register data, without freeing the old
+ data. */
extern void re_set_registers (struct re_pattern_buffer *__buffer,
struct re_registers *__regs,
__re_size_t __num_regs,
#include "progname.h"
#include "relocatable.h"
#include "c-ctype.h"
+#include "verify.h"
/* Use the system functions, not the gnulib overrides in this file. */
#undef fprintf
/* List of directories that contain the libraries. */
static const char *libdirs[] = { LIBDIRS NULL };
/* Verify that at least one directory is given. */
-typedef int verify1[2 * (sizeof (libdirs) / sizeof (libdirs[0]) > 1) - 1];
+verify (sizeof (libdirs) / sizeof (libdirs[0]) > 1);
/* Relocate the list of directories that contain the libraries. */
static void
{
cwd->name = NULL;
- cwd->desc = open (".", O_RDONLY);
+ cwd->desc = open (".", O_SEARCH);
if (!GNULIB_FCNTL_SAFER)
cwd->desc = fd_safer (cwd->desc);
if (cwd->desc < 0)
/* Return a freshly allocated string containing the file names
in directory DIRP, separated by '\0' characters;
the end is marked by two '\0' characters in a row.
- Return NULL (setting errno) if DIRP cannot be read or closed.
+ Return NULL (setting errno) if DIRP cannot be read.
If DIRP is NULL, return NULL without affecting errno. */
-static char *
-savedirstream (DIR *dirp)
+char *
+streamsavedir (DIR *dirp)
{
char *name_space;
size_t allocated = NAME_SIZE_DEFAULT;
}
name_space[used] = '\0';
save_errno = errno;
- if (closedir (dirp) != 0)
- save_errno = errno;
if (save_errno != 0)
{
free (name_space);
return name_space;
}
+/* Like savedirstreamp (DIRP), except also close DIRP. */
+
+static char *
+savedirstream (DIR *dirp)
+{
+ char *name_space = streamsavedir (dirp);
+ if (dirp && closedir (dirp) != 0)
+ {
+ int save_errno = errno;
+ free (name_space);
+ errno = save_errno;
+ return NULL;
+ }
+ return name_space;
+}
+
/* Return a freshly allocated string containing the file names
in directory DIR, separated by '\0' characters;
the end is marked by two '\0' characters in a row.
the end is marked by two '\0' characters in a row.
Return NULL (setting errno) if FD cannot be read or closed. */
+/* deprecated */
char *
fdsavedir (int fd)
{
/* Written by David MacKenzie <djm@gnu.ai.mit.edu>. */
-#if !defined SAVEDIR_H_
-# define SAVEDIR_H_
+#ifndef _GL_SAVEDIR_H
+#define _GL_SAVEDIR_H
+#include <dirent.h>
+char *streamsavedir (DIR *dirp);
char *savedir (char const *dir);
-char *fdsavedir (int fd);
+char *fdsavedir (int fd); /* deprecated */
#endif
case INITIAL_STATE:
/* Save the working directory, or prepare to fall back if possible. */
{
- int fd = open_safer (".", O_RDONLY);
+ int fd = open_safer (".", O_SEARCH);
if (0 <= fd)
{
wd->state = FD_STATE;
|| (options & (HAVE_WORKING_O_NOFOLLOW ? SAVEWD_CHDIR_NOFOLLOW : 0)))
{
fd = open (dir,
- (O_RDONLY | O_DIRECTORY | O_NOCTTY | O_NONBLOCK
+ (O_SEARCH | O_DIRECTORY | O_NOCTTY | O_NONBLOCK
| (options & SAVEWD_CHDIR_NOFOLLOW ? O_NOFOLLOW : 0)));
if (open_result)
#if __GNUC__ >= 3
@PRAGMA_SYSTEM_HEADER@
#endif
+@PRAGMA_COLUMNS@
/* The include_next requires a split double-inclusion guard. */
#if @HAVE_SCHED_H@
# if __GNUC__ >= 3
@PRAGMA_SYSTEM_HEADER@
# endif
+@PRAGMA_COLUMNS@
# if HAVE_SELINUX_SELINUX_H
#if __GNUC__ >= 3
@PRAGMA_SYSTEM_HEADER@
#endif
+@PRAGMA_COLUMNS@
/* The include_next requires a split double-inclusion guard. */
#if @HAVE_SEARCH_H@
return chmod_or_fchmod (name, desc, mode);
# endif
-# elif HAVE_ACL && defined GETACLCNT /* Solaris, Cygwin, not HP-UX */
+# elif HAVE_FACL && defined GETACLCNT /* Solaris, Cygwin, not HP-UX */
# if defined ACL_NO_TRIVIAL
/* Solaris 10 (newer version), which has additional API declared in
return ret;
+# elif HAVE_ACLSORT /* NonStop Kernel */
+
+ struct acl entries[4];
+ int ret;
+
+ entries[0].a_type = USER_OBJ;
+ entries[0].a_id = 0; /* irrelevant */
+ entries[0].a_perm = (mode >> 6) & 7;
+ entries[1].a_type = GROUP_OBJ;
+ entries[1].a_id = 0; /* irrelevant */
+ entries[1].a_perm = (mode >> 3) & 7;
+ entries[2].a_type = CLASS_OBJ;
+ entries[2].a_id = 0;
+ entries[2].a_perm = (mode >> 3) & 7;
+ entries[3].a_type = OTHER_OBJ;
+ entries[3].a_id = 0;
+ entries[3].a_perm = mode & 7;
+
+ ret = aclsort (sizeof (entries) / sizeof (struct acl), 1, entries);
+ if (ret > 0)
+ abort ();
+ if (ret < 0)
+ {
+ if (0)
+ return chmod_or_fchmod (name, desc, mode);
+ return -1;
+ }
+
+ ret = acl ((char *) name, ACL_SET,
+ sizeof (entries) / sizeof (struct acl), entries);
+ if (ret < 0)
+ {
+ if (0)
+ return chmod_or_fchmod (name, desc, mode);
+ return -1;
+ }
+
+ if (mode & (S_ISUID | S_ISGID | S_ISVTX))
+ {
+ /* We did not call chmod so far, so the special bits have not yet
+ been set. */
+ return chmod_or_fchmod (name, desc, mode);
+ }
+ return 0;
+
# else /* Unknown flavor of ACLs */
return chmod_or_fchmod (name, desc, mode);
# endif
#if __GNUC__ >= 3
@PRAGMA_SYSTEM_HEADER@
#endif
+@PRAGMA_COLUMNS@
#if defined __need_sig_atomic_t || defined __need_sigset_t
/* Special invocation convention inside glibc header files. */
# endif
/* This code supports only 32 signals. */
-typedef int verify_NSIG_constraint[2 * (NSIG <= 32) - 1];
+typedef int verify_NSIG_constraint[NSIG <= 32 ? 1 : -1];
# endif
#if __GNUC__ >= 3
@PRAGMA_SYSTEM_HEADER@
#endif
+@PRAGMA_COLUMNS@
/* The include_next requires a split double-inclusion guard. */
#if @HAVE_SPAWN_H@
| (POSIX_SPAWN_SETSCHEDULER > 0 ? POSIX_SPAWN_SETSCHEDULER - 1 : 0)) \
+ 1)
typedef int verify_POSIX_SPAWN_USEVFORK_no_overlap
- [2 * (((POSIX_SPAWN_RESETIDS | POSIX_SPAWN_SETPGROUP
- | POSIX_SPAWN_SETSIGDEF | POSIX_SPAWN_SETSIGMASK
- | POSIX_SPAWN_SETSCHEDPARAM | POSIX_SPAWN_SETSCHEDULER)
- & POSIX_SPAWN_USEVFORK) == 0) - 1];
+ [(((POSIX_SPAWN_RESETIDS | POSIX_SPAWN_SETPGROUP
+ | POSIX_SPAWN_SETSIGDEF | POSIX_SPAWN_SETSIGMASK
+ | POSIX_SPAWN_SETSCHEDPARAM | POSIX_SPAWN_SETSCHEDULER)
+ & POSIX_SPAWN_USEVFORK)
+ == 0)
+ ? 1 : -1];
#if @GNULIB_POSIX_SPAWN@
#elif defined GNULIB_POSIXCHECK
# undef posix_spawnattr_destroy
# if HAVE_RAW_DECL_POSIX_SPAWNATTR_DESTROY
-_GL_WARN_ON_USE (posix_spawnattr_destroy, "posix_spawnattr_destroy is unportable - "
+_GL_WARN_ON_USE (posix_spawnattr_destroy,
+ "posix_spawnattr_destroy is unportable - "
"use gnulib module posix_spawnattr_destroy for portability");
# endif
#endif
#elif defined GNULIB_POSIXCHECK
# undef posix_spawnattr_getsigdefault
# if HAVE_RAW_DECL_POSIX_SPAWNATTR_GETSIGDEFAULT
-_GL_WARN_ON_USE (posix_spawnattr_getsigdefault, "posix_spawnattr_getsigdefault is unportable - "
+_GL_WARN_ON_USE (posix_spawnattr_getsigdefault,
+ "posix_spawnattr_getsigdefault is unportable - "
"use gnulib module posix_spawnattr_getsigdefault for portability");
# endif
#endif
#elif defined GNULIB_POSIXCHECK
# undef posix_spawnattr_setsigdefault
# if HAVE_RAW_DECL_POSIX_SPAWNATTR_SETSIGDEFAULT
-_GL_WARN_ON_USE (posix_spawnattr_setsigdefault, "posix_spawnattr_setsigdefault is unportable - "
+_GL_WARN_ON_USE (posix_spawnattr_setsigdefault,
+ "posix_spawnattr_setsigdefault is unportable - "
"use gnulib module posix_spawnattr_setsigdefault for portability");
# endif
#endif
#elif defined GNULIB_POSIXCHECK
# undef posix_spawnattr_getsigmask
# if HAVE_RAW_DECL_POSIX_SPAWNATTR_GETSIGMASK
-_GL_WARN_ON_USE (posix_spawnattr_getsigmask, "posix_spawnattr_getsigmask is unportable - "
+_GL_WARN_ON_USE (posix_spawnattr_getsigmask,
+ "posix_spawnattr_getsigmask is unportable - "
"use gnulib module posix_spawnattr_getsigmask for portability");
# endif
#endif
#elif defined GNULIB_POSIXCHECK
# undef posix_spawnattr_setsigmask
# if HAVE_RAW_DECL_POSIX_SPAWNATTR_SETSIGMASK
-_GL_WARN_ON_USE (posix_spawnattr_setsigmask, "posix_spawnattr_setsigmask is unportable - "
+_GL_WARN_ON_USE (posix_spawnattr_setsigmask,
+ "posix_spawnattr_setsigmask is unportable - "
"use gnulib module posix_spawnattr_setsigmask for portability");
# endif
#endif
#elif defined GNULIB_POSIXCHECK
# undef posix_spawnattr_getflags
# if HAVE_RAW_DECL_POSIX_SPAWNATTR_GETFLAGS
-_GL_WARN_ON_USE (posix_spawnattr_getflags, "posix_spawnattr_getflags is unportable - "
+_GL_WARN_ON_USE (posix_spawnattr_getflags,
+ "posix_spawnattr_getflags is unportable - "
"use gnulib module posix_spawnattr_getflags for portability");
# endif
#endif
#elif defined GNULIB_POSIXCHECK
# undef posix_spawnattr_setflags
# if HAVE_RAW_DECL_POSIX_SPAWNATTR_SETFLAGS
-_GL_WARN_ON_USE (posix_spawnattr_setflags, "posix_spawnattr_setflags is unportable - "
+_GL_WARN_ON_USE (posix_spawnattr_setflags,
+ "posix_spawnattr_setflags is unportable - "
"use gnulib module posix_spawnattr_setflags for portability");
# endif
#endif
#elif defined GNULIB_POSIXCHECK
# undef posix_spawnattr_getpgroup
# if HAVE_RAW_DECL_POSIX_SPAWNATTR_GETPGROUP
-_GL_WARN_ON_USE (posix_spawnattr_getpgroup, "posix_spawnattr_getpgroup is unportable - "
+_GL_WARN_ON_USE (posix_spawnattr_getpgroup,
+ "posix_spawnattr_getpgroup is unportable - "
"use gnulib module posix_spawnattr_getpgroup for portability");
# endif
#endif
#elif defined GNULIB_POSIXCHECK
# undef posix_spawnattr_setpgroup
# if HAVE_RAW_DECL_POSIX_SPAWNATTR_SETPGROUP
-_GL_WARN_ON_USE (posix_spawnattr_setpgroup, "posix_spawnattr_setpgroup is unportable - "
+_GL_WARN_ON_USE (posix_spawnattr_setpgroup,
+ "posix_spawnattr_setpgroup is unportable - "
"use gnulib module posix_spawnattr_setpgroup for portability");
# endif
#endif
#elif defined GNULIB_POSIXCHECK
# undef posix_spawnattr_getschedpolicy
# if HAVE_RAW_DECL_POSIX_SPAWNATTR_GETSCHEDPOLICY
-_GL_WARN_ON_USE (posix_spawnattr_getschedpolicy, "posix_spawnattr_getschedpolicy is unportable - "
+_GL_WARN_ON_USE (posix_spawnattr_getschedpolicy,
+ "posix_spawnattr_getschedpolicy is unportable - "
"use gnulib module posix_spawnattr_getschedpolicy for portability");
# endif
#endif
#elif defined GNULIB_POSIXCHECK
# undef posix_spawnattr_setschedpolicy
# if HAVE_RAW_DECL_POSIX_SPAWNATTR_SETSCHEDPOLICY
-_GL_WARN_ON_USE (posix_spawnattr_setschedpolicy, "posix_spawnattr_setschedpolicy is unportable - "
+_GL_WARN_ON_USE (posix_spawnattr_setschedpolicy,
+ "posix_spawnattr_setschedpolicy is unportable - "
"use gnulib module posix_spawnattr_setschedpolicy for portability");
# endif
#endif
#elif defined GNULIB_POSIXCHECK
# undef posix_spawnattr_getschedparam
# if HAVE_RAW_DECL_POSIX_SPAWNATTR_GETSCHEDPARAM
-_GL_WARN_ON_USE (posix_spawnattr_getschedparam, "posix_spawnattr_getschedparam is unportable - "
+_GL_WARN_ON_USE (posix_spawnattr_getschedparam,
+ "posix_spawnattr_getschedparam is unportable - "
"use gnulib module posix_spawnattr_getschedparam for portability");
# endif
#endif
#elif defined GNULIB_POSIXCHECK
# undef posix_spawnattr_setschedparam
# if HAVE_RAW_DECL_POSIX_SPAWNATTR_SETSCHEDPARAM
-_GL_WARN_ON_USE (posix_spawnattr_setschedparam, "posix_spawnattr_setschedparam is unportable - "
+_GL_WARN_ON_USE (posix_spawnattr_setschedparam,
+ "posix_spawnattr_setschedparam is unportable - "
"use gnulib module posix_spawnattr_setschedparam for portability");
# endif
#endif
#elif defined GNULIB_POSIXCHECK
# undef posix_spawn_file_actions_init
# if HAVE_RAW_DECL_POSIX_SPAWN_FILE_ACTIONS_INIT
-_GL_WARN_ON_USE (posix_spawn_file_actions_init, "posix_spawn_file_actions_init is unportable - "
+_GL_WARN_ON_USE (posix_spawn_file_actions_init,
+ "posix_spawn_file_actions_init is unportable - "
"use gnulib module posix_spawn_file_actions_init for portability");
# endif
#endif
#elif defined GNULIB_POSIXCHECK
# undef posix_spawn_file_actions_destroy
# if HAVE_RAW_DECL_POSIX_SPAWN_FILE_ACTIONS_DESTROY
-_GL_WARN_ON_USE (posix_spawn_file_actions_destroy, "posix_spawn_file_actions_destroy is unportable - "
+_GL_WARN_ON_USE (posix_spawn_file_actions_destroy,
+ "posix_spawn_file_actions_destroy is unportable - "
"use gnulib module posix_spawn_file_actions_destroy for portability");
# endif
#endif
#elif defined GNULIB_POSIXCHECK
# undef posix_spawn_file_actions_addopen
# if HAVE_RAW_DECL_POSIX_SPAWN_FILE_ACTIONS_ADDOPEN
-_GL_WARN_ON_USE (posix_spawn_file_actions_addopen, "posix_spawn_file_actions_addopen is unportable - "
+_GL_WARN_ON_USE (posix_spawn_file_actions_addopen,
+ "posix_spawn_file_actions_addopen is unportable - "
"use gnulib module posix_spawn_file_actions_addopen for portability");
# endif
#endif
#elif defined GNULIB_POSIXCHECK
# undef posix_spawn_file_actions_addclose
# if HAVE_RAW_DECL_POSIX_SPAWN_FILE_ACTIONS_ADDCLOSE
-_GL_WARN_ON_USE (posix_spawn_file_actions_addclose, "posix_spawn_file_actions_addclose is unportable - "
+_GL_WARN_ON_USE (posix_spawn_file_actions_addclose,
+ "posix_spawn_file_actions_addclose is unportable - "
"use gnulib module posix_spawn_file_actions_addclose for portability");
# endif
#endif
#elif defined GNULIB_POSIXCHECK
# undef posix_spawn_file_actions_adddup2
# if HAVE_RAW_DECL_POSIX_SPAWN_FILE_ACTIONS_ADDDUP2
-_GL_WARN_ON_USE (posix_spawn_file_actions_adddup2, "posix_spawn_file_actions_adddup2 is unportable - "
+_GL_WARN_ON_USE (posix_spawn_file_actions_adddup2,
+ "posix_spawn_file_actions_adddup2 is unportable - "
"use gnulib module posix_spawn_file_actions_adddup2 for portability");
# endif
#endif
#if __GNUC__ >= 3
@PRAGMA_SYSTEM_HEADER@
#endif
+@PRAGMA_COLUMNS@
/* The include_next requires a split double-inclusion guard. */
#@INCLUDE_NEXT@ @NEXT_STDARG_H@
#if __GNUC__ >= 3
@PRAGMA_SYSTEM_HEADER@
#endif
+@PRAGMA_COLUMNS@
#if defined __need_wchar_t || defined __need_size_t \
|| defined __need_ptrdiff_t || defined __need_NULL \
#if __GNUC__ >= 3
@PRAGMA_SYSTEM_HEADER@
#endif
+@PRAGMA_COLUMNS@
/* When including a system file that in turn includes <inttypes.h>,
use the system <inttypes.h>, not our substitute. This avoids
/* Verify that intmax_t and uintmax_t have the same size. Too much code
breaks if this is not the case. If this check fails, the reason is likely
to be found in the autoconf macros. */
-typedef int _verify_intmax_size[2 * (sizeof (intmax_t) == sizeof (uintmax_t)) - 1];
+typedef int _verify_intmax_size[sizeof (intmax_t) == sizeof (uintmax_t)
+ ? 1 : -1];
/* 7.18.2. Limits of specified-width integer types */
/* wchar_t limits */
/* Get WCHAR_MIN, WCHAR_MAX.
- This include is not on the top, above, because on OSF/1 4.0 we have a sequence of nested
- includes <wchar.h> -> <stdio.h> -> <getopt.h> -> <stdlib.h>, and the latter includes
+ This include is not on the top, above, because on OSF/1 4.0 we have a
+ sequence of nested includes
+ <wchar.h> -> <stdio.h> -> <getopt.h> -> <stdlib.h>, and the latter includes
<stdint.h> and assumes its types are already defined. */
#if ! (defined WCHAR_MIN && defined WCHAR_MAX)
# define _GL_JUST_INCLUDE_SYSTEM_WCHAR_H
#if __GNUC__ >= 3
@PRAGMA_SYSTEM_HEADER@
#endif
+@PRAGMA_COLUMNS@
#if defined __need_FILE || defined __need___FILE
/* Special invocation convention inside glibc header files. */
#elif defined GNULIB_POSIXCHECK
# undef freopen
/* Assume freopen is always declared. */
-_GL_WARN_ON_USE (freopen, "freopen on Win32 platforms is not POSIX compatible - "
+_GL_WARN_ON_USE (freopen,
+ "freopen on Win32 platforms is not POSIX compatible - "
"use gnulib module freopen for portability");
#endif
#if __GNUC__ >= 3
@PRAGMA_SYSTEM_HEADER@
#endif
+@PRAGMA_COLUMNS@
#if defined __need_malloc_and_calloc
/* Special invocation convention inside glibc header files. */
/* 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
#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. */
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
#if (@GNULIB_MKSTEMP@ || @GNULIB_GETSUBOPT@ || defined GNULIB_POSIXCHECK) && ! defined __GLIBC__ && !((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__)
#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 - "
+_GL_WARN_ON_USE (canonicalize_file_name,
+ "canonicalize_file_name is unportable - "
"use gnulib module canonicalize-lgpl for portability");
# endif
#endif
#elif defined GNULIB_POSIXCHECK
# undef unlockpt
# if HAVE_RAW_DECL_UNLOCKPT
-_GL_WARN_ON_USE (ptsname, "unlockpt is not portable - "
+_GL_WARN_ON_USE (unlockpt, "unlockpt is not portable - "
"use gnulib module unlockpt for portability");
# endif
#endif
a byte out of place, there can be no match until
after the mismatch. */
shift = needle_len - period;
- memory = 0;
}
+ memory = 0;
j += shift;
continue;
}
break;
# endif
+# if GNULIB_defined_EDQUOT
+ case EDQUOT:
+ msg = "Disk quota exceeded";
+ break;
+# endif
+
# if GNULIB_defined_ECANCELED
case ECANCELED:
msg = "Operation canceled";
#if HAVE_ICONV
-/* An conversion descriptor for use by the iconveh functions. */
+/* A conversion descriptor for use by the iconveh functions. */
typedef struct
{
/* Conversion descriptor from FROM_CODESET to TO_CODESET, or (iconv_t)(-1)
#if __GNUC__ >= 3
@PRAGMA_SYSTEM_HEADER@
#endif
+@PRAGMA_COLUMNS@
/* The include_next requires a split double-inclusion guard. */
#@INCLUDE_NEXT@ @NEXT_STRING_H@
# define _GL_ATTRIBUTE_PURE /* empty */
#endif
+/* NetBSD 5.0 declares strsignal in <unistd.h>, not in <string.h>. */
+/* But in any case avoid namespace pollution on glibc systems. */
+#if (@GNULIB_STRSIGNAL@ || defined GNULIB_POSIXCHECK) && defined __NetBSD__ \
+ && ! defined __GLIBC__
+# include <unistd.h>
+#endif
/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
_GL_FUNCDECL_RPL (strdup, char *, (char const *__s) _GL_ARG_NONNULL ((1)));
_GL_CXXALIAS_RPL (strdup, char *, (char const *__s));
# else
+# if defined __cplusplus && defined GNULIB_NAMESPACE && defined strdup
+ /* strdup exists as a function and as a macro. Get rid of the macro. */
+# undef strdup
+# endif
# if !(@HAVE_DECL_STRDUP@ || defined strdup)
_GL_FUNCDECL_SYS (strdup, char *, (char const *__s) _GL_ARG_NONNULL ((1)));
# endif
#if __GNUC__ >= 3
@PRAGMA_SYSTEM_HEADER@
#endif
+@PRAGMA_COLUMNS@
/* The include_next requires a split double-inclusion guard. */
#@INCLUDE_NEXT@ @NEXT_STRINGS_H@
#include <limits.h>
#include <math.h>
#include <stdbool.h>
+#include <string.h>
#include "c-ctype.h"
const char *s = nptr;
const char *end;
char *endbuf;
+ int saved_errno;
/* Eat whitespace. */
while (locale_isspace (*s))
if (*s == '-' || *s == '+')
++s;
+ saved_errno = errno;
num = underlying_strtod (s, &endbuf);
end = endbuf;
end = p;
}
}
+ else
+ {
+ /* If "1e 1" was misparsed as 10.0 instead of 1.0, re-do the
+ underlying strtod on a copy of the original string
+ truncated to avoid the bug. */
+ const char *e = s + 1;
+ while (e < end && c_tolower (*e) != 'e')
+ e++;
+ if (e < end && ! c_isdigit (e[1 + (e[1] == '-' || e[1] == '+')]))
+ {
+ char *dup = strdup (s);
+ errno = saved_errno;
+ if (!dup)
+ {
+ /* Not really our day, is it. Rounding errors are
+ better than outright failure. */
+ num = parse_number (s, 10, 10, 1, 'e', &endbuf);
+ }
+ else
+ {
+ dup[e - s] = '\0';
+ num = underlying_strtod (dup, &endbuf);
+ saved_errno = errno;
+ free (dup);
+ errno = saved_errno;
+ }
+ end = e;
+ }
+ }
s = end;
}
#if __GNUC__ >= 3
@PRAGMA_SYSTEM_HEADER@
#endif
+@PRAGMA_COLUMNS@
/* The include_next requires a split double-inclusion guard. */
#if @HAVE_SYS_FILE_H@
#if __GNUC__ >= 3
@PRAGMA_SYSTEM_HEADER@
#endif
+@PRAGMA_COLUMNS@
/* The include_next requires a split double-inclusion guard. */
#if @HAVE_SYS_IOCTL_H@
# if __GNUC__ >= 3
@PRAGMA_SYSTEM_HEADER@
# endif
+@PRAGMA_COLUMNS@
/* On OSF/1, <sys/types.h> and <sys/time.h> include <sys/select.h>.
Simply delegate to the system's header in this case. */
/* On Solaris 10, <sys/select.h> provides an FD_ZERO implementation
that relies on memset(), but without including <string.h>.
- But avoid namespace pollution on glibc systems. */
-# ifndef __GLIBC__
+ But in any case avoid namespace pollution on glibc systems. */
+# if (defined __OpenBSD__ || defined __sun || defined __osf__ || defined __BEOS__) \
+ && ! defined __GLIBC__
# include <string.h>
# endif
#if __GNUC__ >= 3
@PRAGMA_SYSTEM_HEADER@
#endif
+@PRAGMA_COLUMNS@
#if defined _GL_ALREADY_INCLUDING_SYS_SOCKET_H
/* Special invocation convention:
adding AC_DEFINE(WINVER, 0x0501) to configure.ac. Note that your
code may not run on older Windows releases then. My Windows 2000
box was not able to run the code, for example. The situation is
- slightly confusing because:
- http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winsock/winsock/getaddrinfo_2.asp
+ slightly confusing because
+ <http://msdn.microsoft.com/en-us/library/ms738520>
suggests that getaddrinfo should be available on all Windows
releases. */
#if __GNUC__ >= 3
@PRAGMA_SYSTEM_HEADER@
#endif
+@PRAGMA_COLUMNS@
#if defined __need_system_sys_stat_h
/* Special invocation convention. */
# else /* !_LARGE_FILES */
# define stat(name, st) rpl_stat (name, st)
# endif /* !_LARGE_FILES */
-_GL_EXTERN_C int stat (const char *name, struct stat *buf) _GL_ARG_NONNULL ((1, 2));
+_GL_EXTERN_C int stat (const char *name, struct stat *buf)
+ _GL_ARG_NONNULL ((1, 2));
# endif
#elif defined GNULIB_POSIXCHECK
# undef stat
#if __GNUC__ >= 3
@PRAGMA_SYSTEM_HEADER@
#endif
+@PRAGMA_COLUMNS@
#if defined _GL_SYS_TIME_H
# if __GNUC__ >= 3
@PRAGMA_SYSTEM_HEADER@
# endif
+@PRAGMA_COLUMNS@
# if @HAVE_SYS_TIMES_H@
# @INCLUDE_NEXT@ @NEXT_SYS_TIMES_H@
#if __GNUC__ >= 3
@PRAGMA_SYSTEM_HEADER@
#endif
+@PRAGMA_COLUMNS@
#if @HAVE_SYS_UTSNAME_H@
# @INCLUDE_NEXT@ @NEXT_SYS_UTSNAME_H@
#if __GNUC__ >= 3
@PRAGMA_SYSTEM_HEADER@
#endif
+@PRAGMA_COLUMNS@
/* The include_next requires a split double-inclusion guard. */
#if !((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__)
#ifndef _GL_SYS_WAIT_H
#define _GL_SYS_WAIT_H
+/* Get pid_t. */
+#include <sys/types.h>
+
+
+/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
+
+/* The definition of _GL_WARN_ON_USE is copied here. */
+
+
#if !((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__)
/* Unix API. */
# define WEXITSTATUS(x) (((x) >> 8) & 0xff)
# endif
+/* The stopping signal. Only to be accessed if WIFSTOPPED(x) is true. */
+# ifndef WSTOPSIG
+# define WSTOPSIG(x) (((x) >> 8) & 0x7f)
+# endif
+
/* True if the process dumped core. Not standardized by POSIX. */
# ifndef WCOREDUMP
# define WCOREDUMP(x) ((x) & 0x80)
# endif
-# ifdef __cplusplus
-extern "C" {
-# endif
-
-/* Declarations of functions. */
-
-# ifdef __cplusplus
-}
-# endif
-
#else
/* Native Windows API. */
-# include <process.h>
-
-# define waitpid(pid,statusp,options) _cwait (statusp, pid, WAIT_CHILD)
+# include <signal.h> /* for SIGTERM */
/* The following macros apply to an argument x, that is a status of a process,
as returned by waitpid() or, equivalently, _cwait() or GetExitCodeProcess().
# define WEXITSTATUS(x) (x)
+/* There are no stopping signals. */
+# define WSTOPSIG(x) 0
+
/* There are no core dumps. */
# define WCOREDUMP(x) 0
#endif
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Declarations of functions. */
+
+#if @GNULIB_WAITPID@
+# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
+_GL_FUNCDECL_SYS (waitpid, pid_t, (pid_t pid, int *statusp, int options));
+# endif
+_GL_CXXALIAS_SYS (waitpid, pid_t, (pid_t pid, int *statusp, int options));
+_GL_CXXALIASWARN (waitpid);
+#elif defined GNULIB_POSIXCHECK
+# undef waitpid
+# if HAVE_RAW_DECL_WAITPID
+_GL_WARN_ON_USE (waitpid, "waitpid is unportable - "
+ "use gnulib module sys_wait for portability");
+# endif
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
#endif /* _GL_SYS_WAIT_H */
#endif /* _GL_SYS_WAIT_H */
#if __GNUC__ >= 3
@PRAGMA_SYSTEM_HEADER@
#endif
+@PRAGMA_COLUMNS@
#if @HAVE_SYSEXITS_H@
--- /dev/null
+/* Determine the session ID of the controlling terminal of the current process.
+ Copyright (C) 2010 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software Foundation,
+ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include <config.h>
+
+#define USE_OLD_TTY /* needed on OpenBSD 4.5, so that TIOCGSID gets defined */
+
+/* Specification. */
+#include <termios.h>
+
+#include <errno.h>
+#include <sys/ioctl.h>
+
+pid_t
+tcgetsid (int fd)
+{
+#ifdef TIOCGSID /* MacOS X, OpenBSD */
+ int sid;
+
+ if (ioctl (fd, TIOCGSID, &sid) < 0)
+ return -1; /* errno is set here */
+
+ return sid;
+#else /* FreeBSD, Cygwin, mingw */
+ errno = ENOSYS;
+ return -1;
+#endif
+}
--- /dev/null
+/* Substitute for and wrapper around <termios.h>.
+ Copyright (C) 2010 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software Foundation,
+ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#ifndef _GL_TERMIOS_H
+
+#if __GNUC__ >= 3
+@PRAGMA_SYSTEM_HEADER@
+#endif
+@PRAGMA_COLUMNS@
+
+/* The include_next requires a split double-inclusion guard. */
+#if @HAVE_TERMIOS_H@
+# @INCLUDE_NEXT@ @NEXT_TERMIOS_H@
+#endif
+
+#ifndef _GL_TERMIOS_H
+#define _GL_TERMIOS_H
+
+#if @GNULIB_TCGETSID@
+/* Get pid_t. */
+# include <sys/types.h>
+#endif
+
+/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
+
+/* The definition of _GL_WARN_ON_USE is copied here. */
+
+
+/* Declare overridden functions. */
+
+#if @GNULIB_TCGETSID@
+/* Return the session ID of the controlling terminal of the current process.
+ The argument is a descriptor if this controlling terminal.
+ Return -1, with errno set, upon failure. errno = ENOSYS means that the
+ function is unsupported. */
+# if !@HAVE_TCGETSID@
+_GL_FUNCDECL_SYS (tcgetsid, pid_t, (int fd));
+# endif
+_GL_CXXALIAS_SYS (tcgetsid, pid_t, (int fd));
+_GL_CXXALIASWARN (tcgetsid);
+#elif defined GNULIB_POSIXCHECK
+# undef tcgetsid
+# if HAVE_RAW_DECL_TCGETSID
+_GL_WARN_ON_USE (tcgetsid, "tcgetsid is not portable - "
+ "use gnulib module tcgetsid for portability");
+# endif
+#endif
+
+
+#endif /* _GL_TERMIOS_H */
+#endif /* _GL_TERMIOS_H */
#if __GNUC__ >= 3
@PRAGMA_SYSTEM_HEADER@
#endif
+@PRAGMA_COLUMNS@
/* Don't get in the way of glibc when it includes time.h merely to
declare a few standard symbols, rather than to declare all the
# endif
# endif
+/* Per http://austingroupbugs.net/view.php?id=327, POSIX requires
+ time_t to be an integer type, even though C99 permits floating
+ point. We don't know of any implementation that uses floating
+ point, and it is much easier to write code that doesn't have to
+ worry about that corner case, so we force the issue. */
+struct __time_t_must_be_integral {
+ unsigned int __floating_time_t_unsupported : (time_t) 1;
+};
+
/* Sleep for at least RQTP seconds unless interrupted, If interrupted,
return -1 and store the remaining time into RMTP. See
<http://www.opengroup.org/susv3xsh/nanosleep.html>. */
#if __GNUC__ >= 3
@PRAGMA_SYSTEM_HEADER@
#endif
+@PRAGMA_COLUMNS@
/* Special invocation convention:
- On mingw, several headers, including <winsock2.h>, include <unistd.h>,
/* The variants with _safe suffix are safe, even if the library is compiled
without --enable-safety. */
-#ifdef GNULIB_UNISTR_U8_MBTOUC_UNSAFE
+#if GNULIB_UNISTR_U8_MBTOUC_UNSAFE || HAVE_LIBUNISTRING
# if !HAVE_INLINE
extern int
u8_mbtouc_unsafe (ucs4_t *puc, const uint8_t *s, size_t n);
# endif
#endif
-#ifdef GNULIB_UNISTR_U16_MBTOUC_UNSAFE
+#if GNULIB_UNISTR_U16_MBTOUC_UNSAFE || HAVE_LIBUNISTRING
# if !HAVE_INLINE
extern int
u16_mbtouc_unsafe (ucs4_t *puc, const uint16_t *s, size_t n);
# endif
#endif
-#ifdef GNULIB_UNISTR_U32_MBTOUC_UNSAFE
+#if GNULIB_UNISTR_U32_MBTOUC_UNSAFE || HAVE_LIBUNISTRING
# if !HAVE_INLINE
extern int
u32_mbtouc_unsafe (ucs4_t *puc, const uint32_t *s, size_t n);
# endif
#endif
-#ifdef GNULIB_UNISTR_U8_MBTOUC
+#if GNULIB_UNISTR_U8_MBTOUC || HAVE_LIBUNISTRING
# if !HAVE_INLINE
extern int
u8_mbtouc (ucs4_t *puc, const uint8_t *s, size_t n);
# endif
#endif
-#ifdef GNULIB_UNISTR_U16_MBTOUC
+#if GNULIB_UNISTR_U16_MBTOUC || HAVE_LIBUNISTRING
# if !HAVE_INLINE
extern int
u16_mbtouc (ucs4_t *puc, const uint16_t *s, size_t n);
# endif
#endif
-#ifdef GNULIB_UNISTR_U32_MBTOUC
+#if GNULIB_UNISTR_U32_MBTOUC || HAVE_LIBUNISTRING
# if !HAVE_INLINE
extern int
u32_mbtouc (ucs4_t *puc, const uint32_t *s, size_t n);
/* Similar to u*_mbtouc(), except that the return value gives more details
about the failure, similar to mbrtowc(). */
-#ifdef GNULIB_UNISTR_U8_MBTOUCR
+#if GNULIB_UNISTR_U8_MBTOUCR || HAVE_LIBUNISTRING
extern int
u8_mbtoucr (ucs4_t *puc, const uint8_t *s, size_t n);
#endif
-#ifdef GNULIB_UNISTR_U16_MBTOUCR
+#if GNULIB_UNISTR_U16_MBTOUCR || HAVE_LIBUNISTRING
extern int
u16_mbtoucr (ucs4_t *puc, const uint16_t *s, size_t n);
#endif
-#ifdef GNULIB_UNISTR_U32_MBTOUCR
+#if GNULIB_UNISTR_U32_MBTOUCR || HAVE_LIBUNISTRING
extern int
u32_mbtoucr (ucs4_t *puc, const uint32_t *s, size_t n);
#endif
/* Similar to wctomb(), except that s must not be NULL, and the argument n
must be specified. */
-#ifdef GNULIB_UNISTR_U8_UCTOMB
+#if GNULIB_UNISTR_U8_UCTOMB || HAVE_LIBUNISTRING
/* Auxiliary function, also used by u8_chr, u8_strchr, u8_strrchr. */
extern int
u8_uctomb_aux (uint8_t *s, ucs4_t uc, int n);
# endif
#endif
-#ifdef GNULIB_UNISTR_U16_UCTOMB
+#if GNULIB_UNISTR_U16_UCTOMB || HAVE_LIBUNISTRING
/* Auxiliary function, also used by u16_chr, u16_strchr, u16_strrchr. */
extern int
u16_uctomb_aux (uint16_t *s, ucs4_t uc, int n);
# endif
#endif
-#ifdef GNULIB_UNISTR_U32_UCTOMB
+#if GNULIB_UNISTR_U32_UCTOMB || HAVE_LIBUNISTRING
# if !HAVE_INLINE
extern int
u32_uctomb (uint32_t *s, ucs4_t uc, int n);
}
}
/* Test for double-width character.
- * Generated from "grep '^....;[WF]' EastAsianWidth.txt"
- * and "grep '^....;[^WF]' EastAsianWidth.txt"
+ * Generated from "grep '^[^;]\{4,5\};[WF]' EastAsianWidth.txt"
+ * and "grep '^[^;]\{4,5\};[^WF]' EastAsianWidth.txt"
*/
if (uc >= 0x1100
&& ((uc < 0x1160) /* Hangul Jamo */
Return 0 on success, -1 (setting errno) on failure. */
int
-fdutimens (char const *file, int fd, struct timespec const timespec[2])
+fdutimens (int fd, char const *file, struct timespec const timespec[2])
{
struct timespec adjusted_timespec[2];
struct timespec *ts = timespec ? adjusted_timespec : NULL;
}
}
-/* Set the access and modification time stamps of FD (a.k.a. FILE) to be
- TIMESPEC[0] and TIMESPEC[1], respectively.
- FD must be either negative -- in which case it is ignored --
- or a file descriptor that is open on FILE.
- If FD is nonnegative, then FILE can be NULL, which means
- use just futimes (or equivalent) instead of utimes (or equivalent),
- and fail if on an old system without futimes (or equivalent).
- If TIMESPEC is null, set the time stamps to the current time.
- Return 0 on success, -1 (setting errno) on failure. */
-
-int
-gl_futimens (int fd, char const *file, struct timespec const timespec[2])
-{
- return fdutimens (file, fd, timespec);
-}
-
/* Set the access and modification time stamps of FILE to be
TIMESPEC[0] and TIMESPEC[1], respectively. */
int
utimens (char const *file, struct timespec const timespec[2])
{
- return fdutimens (file, -1, timespec);
+ return fdutimens (-1, file, timespec);
}
/* Set the access and modification time stamps of FILE to be
/* The Linux kernel did not support symlink timestamps until
utimensat, in version 2.6.22, so we don't need to mimic
- gl_futimens' worry about buggy NFS clients. But we do have to
+ fdutimens' worry about buggy NFS clients. But we do have to
worry about bogus return values. */
#if HAVE_UTIMENSAT
if (!(adjustment_needed || REPLACE_FUNC_STAT_FILE) && lstat (file, &st))
return -1;
if (!S_ISLNK (st.st_mode))
- return fdutimens (file, -1, ts);
+ return fdutimens (-1, file, ts);
errno = ENOSYS;
return -1;
}
#include <time.h>
-int fdutimens (char const *, int, struct timespec const [2]);
-int gl_futimens (int, char const *, struct timespec const [2]);
+int fdutimens (int, char const *, struct timespec const [2]);
int utimens (char const *, struct timespec const [2]);
int lutimens (char const *, struct timespec const [2]);
# include <fcntl.h>
# include <sys/stat.h>
-int fdutimensat (int dir, char const *name, int fd, struct timespec const [2]);
+int fdutimensat (int fd, int dir, char const *name, struct timespec const [2],
+ int atflag);
/* Using this function makes application code slightly more readable. */
static inline int
-lutimensat (int fd, char const *file, struct timespec const times[2])
+lutimensat (int dir, char const *file, struct timespec const times[2])
{
- return utimensat (fd, file, times, AT_SYMLINK_NOFOLLOW);
+ return utimensat (dir, file, times, AT_SYMLINK_NOFOLLOW);
}
#endif
/* Checked size_t computations. */
#include "xsize.h"
+#include "verify.h"
+
#if (NEED_PRINTF_DOUBLE || NEED_PRINTF_LONG_DOUBLE) && !defined IN_LIBINTL
# include <math.h>
# include "float+.h"
typedef unsigned int mp_limb_t;
# define GMP_LIMB_BITS 32
-typedef int mp_limb_verify[2 * (sizeof (mp_limb_t) * CHAR_BIT == GMP_LIMB_BITS) - 1];
+verify (sizeof (mp_limb_t) * CHAR_BIT == GMP_LIMB_BITS);
typedef unsigned long long mp_twolimb_t;
# define GMP_TWOLIMB_BITS 64
-typedef int mp_twolimb_verify[2 * (sizeof (mp_twolimb_t) * CHAR_BIT == GMP_TWOLIMB_BITS) - 1];
+verify (sizeof (mp_twolimb_t) * CHAR_BIT == GMP_TWOLIMB_BITS);
/* Representation of a bignum >= 0. */
typedef struct
size_t characters;
# if !DCHAR_IS_TCHAR
/* This code assumes that TCHAR_T is 'char'. */
- typedef int TCHAR_T_verify[2 * (sizeof (TCHAR_T) == 1) - 1];
+ verify (sizeof (TCHAR_T) == 1);
TCHAR_T *tmpsrc;
DCHAR_T *tmpdst;
size_t tmpdst_len;
TCHAR_T *fbp;
unsigned int prefix_count;
int prefixes[2] IF_LINT (= { 0 });
+ int orig_errno;
#if !USE_SNPRINTF
size_t tmp_length;
TCHAR_T tmpbuf[700];
*(TCHAR_T *) (result + length) = '\0';
#endif
+ orig_errno = errno;
+
for (;;)
{
int count = -1;
DCHAR_T *tmpdst;
size_t tmpdst_len;
/* This code assumes that TCHAR_T is 'char'. */
- typedef int TCHAR_T_verify
- [2 * (sizeof (TCHAR_T) == 1) - 1];
+ verify (sizeof (TCHAR_T) == 1);
# if USE_SNPRINTF
tmpsrc = (TCHAR_T *) (result + length);
# else
length += count;
break;
}
+ errno = orig_errno;
#undef pad_ourselves
#undef prec_ourselves
}
--- /dev/null
+/* Wait for process state change.
+ Copyright (C) 2001-2003, 2005-2010 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software Foundation,
+ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+#include <config.h>
+
+/* Specification. */
+#include <sys/wait.h>
+
+/* Implementation for native Win32 systems. */
+
+#include <process.h> /* for _cwait, WAIT_CHILD */
+
+pid_t
+waitpid (pid_t pid, int *statusp, int options)
+{
+ return _cwait (statusp, pid, WAIT_CHILD);
+}
#if __GNUC__ >= 3
@PRAGMA_SYSTEM_HEADER@
#endif
+@PRAGMA_COLUMNS@
#if defined __need_mbstate_t || defined __need_wint_t || (defined __hpux && ((defined _INTTYPES_INCLUDED && !defined strtoimax) || defined _GL_JUST_INCLUDE_SYSTEM_WCHAR_H)) || defined _GL_ALREADY_INCLUDING_WCHAR_H
/* Special invocation convention:
#if __GNUC__ >= 3
@PRAGMA_SYSTEM_HEADER@
#endif
+@PRAGMA_COLUMNS@
#if @HAVE_WINT_T@
/* Solaris 2.5 has a bug: <wchar.h> must be included before <wctype.h>.
return (wc >= 'a' && wc <= 'z' ? wc - 'a' + 'A' : wc);
}
-#elif ! @HAVE_ISWBLANK@
+#elif ! @HAVE_ISWBLANK@ || @REPLACE_ISWBLANK@
/* Only the iswblank function is missing. */
+# if @REPLACE_ISWBLANK@
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# define iswblank rpl_iswblank
+# endif
+# endif
+
static inline int
-iswblank (wint_t wc)
+# if @REPLACE_ISWBLANK@
+rpl_iswblank
+# else
+iswblank
+# endif
+ (wint_t wc)
{
return wc == ' ' || wc == '\t';
}
#else
_GL_CXXALIAS_SYS (iswalnum, int, (wint_t wc));
_GL_CXXALIAS_SYS (iswalpha, int, (wint_t wc));
+# if @REPLACE_ISWBLANK@
+_GL_CXXALIAS_RPL (iswblank, int, (wint_t wc));
+# else
_GL_CXXALIAS_SYS (iswblank, int, (wint_t wc));
+# endif
_GL_CXXALIAS_SYS (iswcntrl, int, (wint_t wc));
_GL_CXXALIAS_SYS (iswdigit, int, (wint_t wc));
_GL_CXXALIAS_SYS (iswgraph, int, (wint_t wc));
/* 1 if calloc is known to be compatible with GNU calloc. This
matters if we are not also using the calloc module, which defines
- HAVE_CALLOC and supports the GNU API even on non-GNU platforms. */
-#if defined HAVE_CALLOC || defined __GLIBC__
+ HAVE_CALLOC_GNU and supports the GNU API even on non-GNU platforms. */
+#if defined HAVE_CALLOC_GNU || defined __GLIBC__
enum { HAVE_GNU_CALLOC = 1 };
#else
enum { HAVE_GNU_CALLOC = 0 };
return diff;
}
-/* Compare S1 (with size S1SIZE) and S2 (with length S2SIZE) according
- to the LC_COLLATE locale. S1 and S2 are both blocks of memory with
- nonzero sizes, and the last byte in each block must be a null byte.
+/* Compare S1 (a memory block of size S1SIZE, with a NUL as last byte)
+ and S2 (a memory block of size S2SIZE, with a NUL as last byte)
+ according to the LC_COLLATE locale. S1SIZE and S2SIZE must be > 0.
Report an error and exit if there is an error. */
int
-xmemcoll0 (char const *s1, size_t s1len, char const *s2, size_t s2len)
+xmemcoll0 (char const *s1, size_t s1size, char const *s2, size_t s2size)
{
- int diff = memcoll0 (s1, s1len, s2, s2len);
+ int diff = memcoll0 (s1, s1size, s2, s2size);
int collation_errno = errno;
if (collation_errno)
- collate_error (collation_errno, s1, s1len, s2, s2len);
+ collate_error (collation_errno, s1, s1size - 1, s2, s2size - 1);
return diff;
}
# acl.m4 - check for access control list (ACL) primitives
-# serial 10
+# serial 11
# Copyright (C) 2002, 2004-2010 Free Software Foundation, Inc.
# This file is free software; the Free Software Foundation
dnl Test for Solaris API (Solaris, Cygwin).
if test $use_acl = 0; then
- AC_CHECK_FUNCS([acl])
- if test $ac_cv_func_acl = yes; then
+ AC_CHECK_FUNCS([facl])
+ if test $ac_cv_func_facl = yes; then
AC_SEARCH_LIBS([acl_trivial], [sec],
[if test "$ac_cv_search_acl_trivial" != "none required"; then
LIB_ACL=$ac_cv_search_acl_trivial
fi
dnl Test for HP-UX API.
- if test $use_acl = 0 || test "$ac_cv_func_acl" = yes; then
+ if test $use_acl = 0; then
AC_CHECK_FUNCS([getacl])
if test $ac_cv_func_getacl = yes; then
use_acl=1
fi
fi
+ dnl Test for NonStop Kernel API.
+ if test $use_acl = 0; then
+ AC_CHECK_FUNCS([aclsort])
+ if test $ac_cv_func_aclsort = yes; then
+ use_acl=1
+ fi
+ fi
+
LIBS=$ac_save_LIBS
fi
if test "x$enable_acl$use_acl" = "xyes0"; then
-# acosl.m4 serial 2
+# acosl.m4 serial 3
dnl Copyright (C) 2010 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
AC_CACHE_CHECK([whether acosl() can be used without linking with libm],
[gl_cv_func_acosl_no_libm],
[
- AC_TRY_LINK([#ifndef __NO_MATH_INLINES
- # define __NO_MATH_INLINES 1 /* for glibc */
- #endif
- #include <math.h>
- long double x;],
- [return acosl (x) > 1;],
+ AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[#ifndef __NO_MATH_INLINES
+ # define __NO_MATH_INLINES 1 /* for glibc */
+ #endif
+ #include <math.h>
+ long double x;]],
+ [[return acosl (x) > 1;]])],
[gl_cv_func_acosl_no_libm=yes],
[gl_cv_func_acosl_no_libm=no])
])
[
save_LIBS="$LIBS"
LIBS="$LIBS -lm"
- AC_TRY_LINK([#ifndef __NO_MATH_INLINES
- # define __NO_MATH_INLINES 1 /* for glibc */
- #endif
- #include <math.h>
- long double x;],
- [return acosl (x) > 1;],
+ AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[#ifndef __NO_MATH_INLINES
+ # define __NO_MATH_INLINES 1 /* for glibc */
+ #endif
+ #include <math.h>
+ long double x;]],
+ [[return acosl (x) > 1;]])],
[gl_cv_func_acosl_in_libm=yes],
[gl_cv_func_acosl_in_libm=no])
LIBS="$save_LIBS"
-# argp.m4 serial 10
-dnl Copyright (C) 2003-2007, 2009-2010 Free Software Foundation, Inc.
+# argp.m4 serial 11
+dnl Copyright (C) 2003-2010 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.
# be defined and other not, I prefer to stay on the safe side and to
# test each one separately.
AC_MSG_CHECKING([whether program_invocation_name is defined])
- AC_TRY_LINK([#include <argp.h>],
- [ program_invocation_name = "test"; ],
- [ AC_DEFINE([HAVE_PROGRAM_INVOCATION_NAME], [1],
- [Define if program_invocation_name is defined])
- AC_MSG_RESULT([yes])],
- [ AC_MSG_RESULT([no])] )
+ AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <argp.h>]],
+ [[program_invocation_name = "test";]])],
+ [AC_DEFINE([HAVE_PROGRAM_INVOCATION_NAME], [1],
+ [Define if program_invocation_name is defined])
+ AC_MSG_RESULT([yes])],
+ [AC_MSG_RESULT([no])])
AC_MSG_CHECKING([whether program_invocation_short_name is defined])
- AC_TRY_LINK([#include <argp.h>],
- [ program_invocation_short_name = "test"; ],
- [ AC_DEFINE([HAVE_PROGRAM_INVOCATION_SHORT_NAME], [1],
- [Define if program_invocation_short_name is defined])
- AC_MSG_RESULT([yes])],
- [ AC_MSG_RESULT([no])] )
+ AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <argp.h>]],
+ [[program_invocation_short_name = "test";]])],
+ [AC_DEFINE([HAVE_PROGRAM_INVOCATION_SHORT_NAME], [1],
+ [Define if program_invocation_short_name is defined])
+ AC_MSG_RESULT([yes])],
+ [AC_MSG_RESULT([no])])
AC_CHECK_DECLS_ONCE([clearerr_unlocked])
AC_CHECK_DECLS_ONCE([feof_unlocked])
-# asinl.m4 serial 2
+# asinl.m4 serial 3
dnl Copyright (C) 2010 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
AC_CACHE_CHECK([whether asinl() can be used without linking with libm],
[gl_cv_func_asinl_no_libm],
[
- AC_TRY_LINK([#ifndef __NO_MATH_INLINES
- # define __NO_MATH_INLINES 1 /* for glibc */
- #endif
- #include <math.h>
- long double x;],
- [return asinl (x) > 1;],
+ AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[#ifndef __NO_MATH_INLINES
+ # define __NO_MATH_INLINES 1 /* for glibc */
+ #endif
+ #include <math.h>
+ long double x;]],
+ [[return asinl (x) > 1;]])],
[gl_cv_func_asinl_no_libm=yes],
[gl_cv_func_asinl_no_libm=no])
])
[
save_LIBS="$LIBS"
LIBS="$LIBS -lm"
- AC_TRY_LINK([#ifndef __NO_MATH_INLINES
- # define __NO_MATH_INLINES 1 /* for glibc */
- #endif
- #include <math.h>
- long double x;],
- [return asinl (x) > 1;],
+ AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[#ifndef __NO_MATH_INLINES
+ # define __NO_MATH_INLINES 1 /* for glibc */
+ #endif
+ #include <math.h>
+ long double x;]],
+ [[return asinl (x) > 1;]])],
[gl_cv_func_asinl_in_libm=yes],
[gl_cv_func_asinl_in_libm=no])
LIBS="$save_LIBS"
-# atanl.m4 serial 2
+# atanl.m4 serial 3
dnl Copyright (C) 2010 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
AC_CACHE_CHECK([whether atanl() can be used without linking with libm],
[gl_cv_func_atanl_no_libm],
[
- AC_TRY_LINK([#ifndef __NO_MATH_INLINES
- # define __NO_MATH_INLINES 1 /* for glibc */
- #endif
- #include <math.h>
- long double x;],
- [return atanl (x) > 1;],
+ AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[#ifndef __NO_MATH_INLINES
+ # define __NO_MATH_INLINES 1 /* for glibc */
+ #endif
+ #include <math.h>
+ long double x;]],
+ [[return atanl (x) > 1;]])],
[gl_cv_func_atanl_no_libm=yes],
[gl_cv_func_atanl_no_libm=no])
])
[
save_LIBS="$LIBS"
LIBS="$LIBS -lm"
- AC_TRY_LINK([#ifndef __NO_MATH_INLINES
- # define __NO_MATH_INLINES 1 /* for glibc */
- #endif
- #include <math.h>
- long double x;],
- [return atanl (x) > 1;],
+ AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[#ifndef __NO_MATH_INLINES
+ # define __NO_MATH_INLINES 1 /* for glibc */
+ #endif
+ #include <math.h>
+ long double x;]],
+ [[return atanl (x) > 1;]])],
[gl_cv_func_atanl_in_libm=yes],
[gl_cv_func_atanl_in_libm=no])
LIBS="$save_LIBS"
-# serial 5
+# serial 6
# Copyright (C) 2002, 2005, 2009, 2010 Free Software Foundation, Inc.
# This file is free software; the Free Software Foundation
AC_DEFUN([gl_BISON],
[
- # getdate.y works with bison only.
+ # parse-datetime.y works with bison only.
: ${YACC='bison -y'}
dnl
dnl Declaring YACC & YFLAGS precious will not be necessary after GNULIB
dnl requires an Autoconf greater than 2.59c, but it will probably still be
dnl useful to override the description of YACC in the --help output, re
-dnl getdate.y assuming `bison -y'.
+dnl parse-datetime.y assuming `bison -y'.
AC_ARG_VAR([YACC],
[The `Yet Another C Compiler' implementation to use. Defaults to `bison -y'.
Values other than `bison -y' will most likely break on most systems.])dnl
-# btowc.m4 serial 6
+# btowc.m4 serial 7
dnl Copyright (C) 2008-2010 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
AC_CACHE_CHECK([whether btowc(0) is correct],
[gl_cv_func_btowc_nul],
[
- AC_TRY_RUN([
+ AC_RUN_IFELSE(
+ [AC_LANG_SOURCE([[
#include <stdio.h>
#include <string.h>
#include <wchar.h>
if (btowc ('\0') != 0)
return 1;
return 0;
-}],
+}]])],
[gl_cv_func_btowc_nul=yes],
[gl_cv_func_btowc_nul=no],
[
esac
changequote([,])dnl
if test $LOCALE_FR != none; then
- AC_TRY_RUN([
+ AC_RUN_IFELSE(
+ [AC_LANG_SOURCE([[
#include <locale.h>
#include <stdio.h>
#include <string.h>
return 1;
}
return 0;
-}],
+}]])],
[gl_cv_func_btowc_eof=yes],
[gl_cv_func_btowc_eof=no],
[:])
# Written by Paul Eggert.
-# serial 10
+# serial 11
AC_DEFUN([AC_SYS_XSI_STACK_OVERFLOW_HEURISTIC],
[# for STACK_DIRECTION
dnl is accessed, or when the stack overflows.
dnl Either { SIGSEGV } or { SIGSEGV, SIGBUS }.
case "$host_os" in
- sunos4* | freebsd* | dragonfly* | openbsd* | netbsd* | kfreebsd* | knetbsd*) # BSD systems
+ sunos4* | freebsd* | dragonfly* | openbsd* | mirbsd* | netbsd* | kfreebsd* | knetbsd*) # BSD systems
FAULT_YIELDS_SIGBUS=1 ;;
hpux*) # HP-UX
FAULT_YIELDS_SIGBUS=1 ;;
-# calloc.m4 serial 10
+# calloc.m4 serial 11
# Copyright (C) 2004-2010 Free Software Foundation, Inc.
# This file is free software; the Free Software Foundation
[
AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
_AC_FUNC_CALLOC_IF(
- [AC_DEFINE([HAVE_CALLOC], [1],
+ [AC_DEFINE([HAVE_CALLOC_GNU], [1],
[Define to 1 if your system has a GNU libc compatible `calloc'
function, and to 0 otherwise.])],
- [AC_DEFINE([HAVE_CALLOC], [0])
+ [AC_DEFINE([HAVE_CALLOC_GNU], [0])
gl_REPLACE_CALLOC
])
])# gl_FUNC_CALLOC_GNU
-# ceil.m4 serial 3
+# ceil.m4 serial 4
dnl Copyright (C) 2007, 2009, 2010 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
[
gl_CACHE_VAL_SILENT([gl_cv_func_ceil_libm], [
gl_cv_func_ceil_libm=?
- AC_TRY_LINK([
- #ifndef __NO_MATH_INLINES
- # define __NO_MATH_INLINES 1 /* for glibc */
- #endif
- #include <math.h>
- double x;],
- [x = ceil(x);],
+ AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[#ifndef __NO_MATH_INLINES
+ # define __NO_MATH_INLINES 1 /* for glibc */
+ #endif
+ #include <math.h>
+ double x;]],
+ [[x = ceil(x);]])],
[gl_cv_func_ceil_libm=])
if test "$gl_cv_func_ceil_libm" = "?"; then
save_LIBS="$LIBS"
LIBS="$LIBS -lm"
- AC_TRY_LINK([
- #ifndef __NO_MATH_INLINES
- # define __NO_MATH_INLINES 1 /* for glibc */
- #endif
- #include <math.h>
- double x;],
- [x = ceil(x);],
+ AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[#ifndef __NO_MATH_INLINES
+ # define __NO_MATH_INLINES 1 /* for glibc */
+ #endif
+ #include <math.h>
+ double x;]],
+ [[x = ceil(x);]])],
[gl_cv_func_ceil_libm="-lm"])
LIBS="$save_LIBS"
fi
-# ceilf.m4 serial 6
+# ceilf.m4 serial 7
dnl Copyright (C) 2007, 2009-2010 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
[
gl_CACHE_VAL_SILENT([gl_cv_func_ceilf_libm], [
gl_cv_func_ceilf_libm=?
- AC_TRY_LINK([
- #ifndef __NO_MATH_INLINES
- # define __NO_MATH_INLINES 1 /* for glibc */
- #endif
- #include <math.h>
- float x;],
- [x = ceilf(x);],
+ AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[#ifndef __NO_MATH_INLINES
+ # define __NO_MATH_INLINES 1 /* for glibc */
+ #endif
+ #include <math.h>
+ float x;]],
+ [[x = ceilf(x);]])],
[gl_cv_func_ceilf_libm=])
if test "$gl_cv_func_ceilf_libm" = "?"; then
save_LIBS="$LIBS"
LIBS="$LIBS -lm"
- AC_TRY_LINK([
- #ifndef __NO_MATH_INLINES
- # define __NO_MATH_INLINES 1 /* for glibc */
- #endif
- #include <math.h>
- float x;],
- [x = ceilf(x);],
+ AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[#ifndef __NO_MATH_INLINES
+ # define __NO_MATH_INLINES 1 /* for glibc */
+ #endif
+ #include <math.h>
+ float x;]],
+ [[x = ceilf(x);]])],
[gl_cv_func_ceilf_libm="-lm"])
LIBS="$save_LIBS"
fi
-# ceill.m4 serial 6
+# ceill.m4 serial 7
dnl Copyright (C) 2007, 2009-2010 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
[
gl_CACHE_VAL_SILENT([gl_cv_func_ceill_libm], [
gl_cv_func_ceill_libm=?
- AC_TRY_LINK([
- #ifndef __NO_MATH_INLINES
- # define __NO_MATH_INLINES 1 /* for glibc */
- #endif
- #include <math.h>
- long double x;],
- [x = ceill(x);],
+ AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[#ifndef __NO_MATH_INLINES
+ # define __NO_MATH_INLINES 1 /* for glibc */
+ #endif
+ #include <math.h>
+ long double x;]],
+ [[x = ceill(x);]])],
[gl_cv_func_ceill_libm=])
if test "$gl_cv_func_ceill_libm" = "?"; then
save_LIBS="$LIBS"
LIBS="$LIBS -lm"
- AC_TRY_LINK([
- #ifndef __NO_MATH_INLINES
- # define __NO_MATH_INLINES 1 /* for glibc */
- #endif
- #include <math.h>
- long double x;],
- [x = ceill(x);],
+ AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[#ifndef __NO_MATH_INLINES
+ # define __NO_MATH_INLINES 1 /* for glibc */
+ #endif
+ #include <math.h>
+ long double x;]],
+ [[x = ceill(x);]])],
[gl_cv_func_ceill_libm="-lm"])
LIBS="$save_LIBS"
fi
-# codeset.m4 serial 4 (gettext-0.18)
+# codeset.m4 serial 5 (gettext-0.18.2)
dnl Copyright (C) 2000-2002, 2006, 2008-2010 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
AC_DEFUN([AM_LANGINFO_CODESET],
[
AC_CACHE_CHECK([for nl_langinfo and CODESET], [am_cv_langinfo_codeset],
- [AC_TRY_LINK([#include <langinfo.h>],
- [char* cs = nl_langinfo(CODESET); return !cs;],
- [am_cv_langinfo_codeset=yes],
- [am_cv_langinfo_codeset=no])
+ [AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[#include <langinfo.h>]],
+ [[char* cs = nl_langinfo(CODESET); return !cs;]])],
+ [am_cv_langinfo_codeset=yes],
+ [am_cv_langinfo_codeset=no])
])
if test $am_cv_langinfo_codeset = yes; then
AC_DEFINE([HAVE_LANGINFO_CODESET], [1],
-# cosl.m4 serial 2
+# cosl.m4 serial 3
dnl Copyright (C) 2010 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
AC_CACHE_CHECK([whether cosl() can be used without linking with libm],
[gl_cv_func_cosl_no_libm],
[
- AC_TRY_LINK([#ifndef __NO_MATH_INLINES
- # define __NO_MATH_INLINES 1 /* for glibc */
- #endif
- #include <math.h>
- long double x;],
- [return cosl (x) > 0.4;],
+ AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[#ifndef __NO_MATH_INLINES
+ # define __NO_MATH_INLINES 1 /* for glibc */
+ #endif
+ #include <math.h>
+ long double x;]],
+ [[return cosl (x) > 0.4;]])],
[gl_cv_func_cosl_no_libm=yes],
[gl_cv_func_cosl_no_libm=no])
])
[
save_LIBS="$LIBS"
LIBS="$LIBS -lm"
- AC_TRY_LINK([#ifndef __NO_MATH_INLINES
- # define __NO_MATH_INLINES 1 /* for glibc */
- #endif
- #include <math.h>
- long double x;],
- [return cosl (x) > 0.4;],
+ AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[#ifndef __NO_MATH_INLINES
+ # define __NO_MATH_INLINES 1 /* for glibc */
+ #endif
+ #include <math.h>
+ long double x;]],
+ [[return cosl (x) > 0.4;]])],
[gl_cv_func_cosl_in_libm=yes],
[gl_cv_func_cosl_in_libm=no])
LIBS="$save_LIBS"
-# duplocale.m4 serial 3
+# duplocale.m4 serial 4
dnl Copyright (C) 2009-2010 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
AC_REQUIRE([gl_LOCALE_H])
AC_CACHE_CHECK([whether duplocale(LC_GLOBAL_LOCALE) works],
[gl_cv_func_duplocale_works],
- [AC_TRY_RUN([
+ [AC_RUN_IFELSE(
+ [AC_LANG_SOURCE([[
#include <locale.h>
#if HAVE_XLOCALE_H
# include <xlocale.h>
if (duplocale (LC_GLOBAL_LOCALE) == (locale_t)0)
return 1;
return 0;
-}], [gl_cv_func_duplocale_works=yes], [gl_cv_func_duplocale_works=no],
+}]])],
+ [gl_cv_func_duplocale_works=yes],
+ [gl_cv_func_duplocale_works=no],
[dnl Guess it works except on glibc < 2.12 and AIX.
case "$host_os" in
aix*) gl_cv_func_duplocale_works="guessing no";;
-# environ.m4 serial 4
+# environ.m4 serial 5
dnl Copyright (C) 2001-2004, 2006-2010 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
define([gt_cv_var], [gt_cv_var_]$2[_declaration])
AC_MSG_CHECKING([if $2 is properly declared])
AC_CACHE_VAL([gt_cv_var], [
- AC_TRY_COMPILE([$1
- extern struct { int foo; } $2;],
- [$2.foo = 1;],
- gt_cv_var=no,
- gt_cv_var=yes)])
+ AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[$1
+ extern struct { int foo; } $2;]],
+ [[$2.foo = 1;]])],
+ [gt_cv_var=no],
+ [gt_cv_var=yes])])
AC_MSG_RESULT([$gt_cv_var])
if test $gt_cv_var = yes; then
AC_DEFINE([HAVE_]m4_translit($2, [a-z], [A-Z])[_DECL], 1,
-# errno_h.m4 serial 6
-dnl Copyright (C) 2004, 2006, 2008, 2009, 2010 Free Software Foundation, Inc.
+# errno_h.m4 serial 7
+dnl Copyright (C) 2004, 2006, 2008-2010 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.
#if !defined ESTALE
booboo
#endif
+#if !defined EDQUOT
+booboo
+#endif
#if !defined ECANCELED
booboo
#endif
-#serial 12
+#serial 13
# Copyright (C) 1996-1998, 2001-2004, 2009-2010 Free Software Foundation, Inc.
#
gl_PREREQ_ERROR
])
+# Redefine AC_FUNC_ERROR_AT_LINE, because it is no longer maintained in
+# Autoconf.
+AC_DEFUN([AC_FUNC_ERROR_AT_LINE],
+[
+ AC_LIBSOURCES([error.h, error.c])dnl
+ AC_CACHE_CHECK([for error_at_line], [ac_cv_lib_error_at_line],
+ [AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[#include <error.h>]],
+ [[error_at_line (0, 0, "", 0, "an error occurred");]])],
+ [ac_cv_lib_error_at_line=yes],
+ [ac_cv_lib_error_at_line=no])])
+ if test $ac_cv_lib_error_at_line = no; then
+ AC_LIBOBJ([error])
+ fi
+])
+
# Prerequisites of lib/error.c.
AC_DEFUN([gl_PREREQ_ERROR],
[
-# expl.m4 serial 1
+# expl.m4 serial 2
dnl Copyright (C) 2010 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
AC_CACHE_CHECK([whether expl() can be used without linking with libm],
[gl_cv_func_expl_no_libm],
[
- AC_TRY_LINK([#ifndef __NO_MATH_INLINES
- # define __NO_MATH_INLINES 1 /* for glibc */
- #endif
- #include <math.h>
- long double x;],
- [return expl (x) > 1.5;],
+ AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[#ifndef __NO_MATH_INLINES
+ # define __NO_MATH_INLINES 1 /* for glibc */
+ #endif
+ #include <math.h>
+ long double x;]],
+ [[return expl (x) > 1.5;]])],
[gl_cv_func_expl_no_libm=yes],
[gl_cv_func_expl_no_libm=no])
])
[
save_LIBS="$LIBS"
LIBS="$LIBS -lm"
- AC_TRY_LINK([#ifndef __NO_MATH_INLINES
- # define __NO_MATH_INLINES 1 /* for glibc */
- #endif
- #include <math.h>
- long double x;],
- [return expl (x) > 1.5;],
+ AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[#ifndef __NO_MATH_INLINES
+ # define __NO_MATH_INLINES 1 /* for glibc */
+ #endif
+ #include <math.h>
+ long double x;]],
+ [[return expl (x) > 1.5;]])],
[gl_cv_func_expl_in_libm=yes],
[gl_cv_func_expl_in_libm=no])
LIBS="$save_LIBS"
-# exponentd.m4 serial 1
-dnl Copyright (C) 2007-2010 Free Software Foundation, Inc.
+# exponentd.m4 serial 2
+dnl Copyright (C) 2007-2008, 2010 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_CACHE_CHECK([where to find the exponent in a 'double'],
[gl_cv_cc_double_expbit0],
[
- AC_TRY_RUN([
+ AC_RUN_IFELSE(
+ [AC_LANG_SOURCE([[
#include <float.h>
#include <stddef.h>
#include <stdio.h>
fprintf (fp, "unknown");
return (fclose (fp) != 0);
}
- ],
+ ]])],
[gl_cv_cc_double_expbit0=`cat conftest.out`],
[gl_cv_cc_double_expbit0="unknown"],
[
-# exponentf.m4 serial 1
-dnl Copyright (C) 2007-2010 Free Software Foundation, Inc.
+# exponentf.m4 serial 2
+dnl Copyright (C) 2007-2008, 2010 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_CACHE_CHECK([where to find the exponent in a 'float'],
[gl_cv_cc_float_expbit0],
[
- AC_TRY_RUN([
+ AC_RUN_IFELSE(
+ [AC_LANG_SOURCE([[
#include <float.h>
#include <stddef.h>
#include <stdio.h>
fprintf (fp, "unknown");
return (fclose (fp) != 0);
}
- ],
+ ]])],
[gl_cv_cc_float_expbit0=`cat conftest.out`],
[gl_cv_cc_float_expbit0="unknown"],
[gl_cv_cc_float_expbit0="word 0 bit 23"])
-# exponentl.m4 serial 2
+# exponentl.m4 serial 3
dnl Copyright (C) 2007-2010 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
AC_CACHE_CHECK([where to find the exponent in a 'long double'],
[gl_cv_cc_long_double_expbit0],
[
- AC_TRY_RUN([
+ AC_RUN_IFELSE(
+ [AC_LANG_SOURCE([[
#include <float.h>
#include <stddef.h>
#include <stdio.h>
fprintf (fp, "unknown");
return (fclose (fp) != 0);
}
- ],
+ ]])],
[gl_cv_cc_long_double_expbit0=`cat conftest.out`],
[gl_cv_cc_long_double_expbit0="unknown"],
[
-# float_h.m4 serial 3
+# float_h.m4 serial 4
dnl Copyright (C) 2007, 2009, 2010 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
AC_REQUIRE([AC_CANONICAL_HOST])
FLOAT_H=
case "$host_os" in
- beos* | openbsd*)
+ beos* | openbsd* | mirbsd*)
FLOAT_H=float.h
gl_CHECK_NEXT_HEADERS([float.h])
;;
-# floor.m4 serial 3
+# floor.m4 serial 4
dnl Copyright (C) 2007, 2009, 2010 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
[
gl_CACHE_VAL_SILENT([gl_cv_func_floor_libm], [
gl_cv_func_floor_libm=?
- AC_TRY_LINK([
- #ifndef __NO_MATH_INLINES
- # define __NO_MATH_INLINES 1 /* for glibc */
- #endif
- #include <math.h>
- double x;],
- [x = floor(x);],
+ AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[#ifndef __NO_MATH_INLINES
+ # define __NO_MATH_INLINES 1 /* for glibc */
+ #endif
+ #include <math.h>
+ double x;]],
+ [[x = floor(x);]])],
[gl_cv_func_floor_libm=])
if test "$gl_cv_func_floor_libm" = "?"; then
save_LIBS="$LIBS"
LIBS="$LIBS -lm"
- AC_TRY_LINK([
- #ifndef __NO_MATH_INLINES
- # define __NO_MATH_INLINES 1 /* for glibc */
- #endif
- #include <math.h>
- double x;],
- [x = floor(x);],
+ AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[#ifndef __NO_MATH_INLINES
+ # define __NO_MATH_INLINES 1 /* for glibc */
+ #endif
+ #include <math.h>
+ double x;]],
+ [[x = floor(x);]])],
[gl_cv_func_floor_libm="-lm"])
LIBS="$save_LIBS"
fi
-# floorf.m4 serial 6
+# floorf.m4 serial 7
dnl Copyright (C) 2007, 2009-2010 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
[
gl_CACHE_VAL_SILENT([gl_cv_func_floorf_libm], [
gl_cv_func_floorf_libm=?
- AC_TRY_LINK([
- #ifndef __NO_MATH_INLINES
- # define __NO_MATH_INLINES 1 /* for glibc */
- #endif
- #include <math.h>
- float x;],
- [x = floorf(x);],
+ AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[#ifndef __NO_MATH_INLINES
+ # define __NO_MATH_INLINES 1 /* for glibc */
+ #endif
+ #include <math.h>
+ float x;]],
+ [[x = floorf(x);]])],
[gl_cv_func_floorf_libm=])
if test "$gl_cv_func_floorf_libm" = "?"; then
save_LIBS="$LIBS"
LIBS="$LIBS -lm"
- AC_TRY_LINK([
- #ifndef __NO_MATH_INLINES
- # define __NO_MATH_INLINES 1 /* for glibc */
- #endif
- #include <math.h>
- float x;],
- [x = floorf(x);],
+ AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[#ifndef __NO_MATH_INLINES
+ # define __NO_MATH_INLINES 1 /* for glibc */
+ #endif
+ #include <math.h>
+ float x;]],
+ [[x = floorf(x);]])],
[gl_cv_func_floorf_libm="-lm"])
LIBS="$save_LIBS"
fi
-# floorl.m4 serial 6
+# floorl.m4 serial 7
dnl Copyright (C) 2007, 2009-2010 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
[
gl_CACHE_VAL_SILENT([gl_cv_func_floorl_libm], [
gl_cv_func_floorl_libm=?
- AC_TRY_LINK([
- #ifndef __NO_MATH_INLINES
- # define __NO_MATH_INLINES 1 /* for glibc */
- #endif
- #include <math.h>
- long double x;],
- [x = floorl(x);],
+ AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[#ifndef __NO_MATH_INLINES
+ # define __NO_MATH_INLINES 1 /* for glibc */
+ #endif
+ #include <math.h>
+ long double x;]],
+ [[x = floorl(x);]])],
[gl_cv_func_floorl_libm=])
if test "$gl_cv_func_floorl_libm" = "?"; then
save_LIBS="$LIBS"
LIBS="$LIBS -lm"
- AC_TRY_LINK([
- #ifndef __NO_MATH_INLINES
- # define __NO_MATH_INLINES 1 /* for glibc */
- #endif
- #include <math.h>
- long double x;],
- [x = floorl(x);],
+ AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[#ifndef __NO_MATH_INLINES
+ # define __NO_MATH_INLINES 1 /* for glibc */
+ #endif
+ #include <math.h>
+ long double x;]],
+ [[x = floorl(x);]])],
[gl_cv_func_floorl_libm="-lm"])
LIBS="$save_LIBS"
fi
AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
FNMATCH_H=
- gl_fnmatch_required_lowercase=`echo $gl_fnmatch_required | tr 'A-Z' 'a-z'`
+ gl_fnmatch_required_lowercase=`
+ echo $gl_fnmatch_required | tr '[[A-Z]]' '[[a-z]]'
+ `
gl_fnmatch_cache_var="gl_cv_func_fnmatch_${gl_fnmatch_required_lowercase}"
AC_CACHE_CHECK([for working $gl_fnmatch_required fnmatch],
[$gl_fnmatch_cache_var],
AC_CACHE_CHECK([whether fopen recognizes a trailing slash],
[gl_cv_func_fopen_slash],
[
- AC_TRY_RUN([
+ AC_RUN_IFELSE(
+ [AC_LANG_SOURCE([[
#include <stddef.h>
#include <stdio.h>
int main ()
{
return fopen ("conftest.sl/", "w") != NULL;
-}], [gl_cv_func_fopen_slash=yes], [gl_cv_func_fopen_slash=no],
+}]])],
+ [gl_cv_func_fopen_slash=yes],
+ [gl_cv_func_fopen_slash=no],
[
changequote(,)dnl
case "$host_os" in
-# frexp.m4 serial 8
+# frexp.m4 serial 9
dnl Copyright (C) 2007-2010 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
[
save_LIBS="$LIBS"
LIBS="$LIBS -lm"
- AC_TRY_LINK([#include <math.h>
- double x;],
- [int e; return frexp (x, &e) > 0;],
+ AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[#include <math.h>
+ double x;]],
+ [[int e; return frexp (x, &e) > 0;]])],
[gl_cv_func_frexp_in_libm=yes],
[gl_cv_func_frexp_in_libm=no])
LIBS="$save_LIBS"
AC_CACHE_CHECK([whether frexp() can be used without linking with libm],
[gl_cv_func_frexp_no_libm],
[
- AC_TRY_LINK([#include <math.h>
- double x;],
- [int e; return frexp (x, &e) > 0;],
+ AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[#include <math.h>
+ double x;]],
+ [[int e; return frexp (x, &e) > 0;]])],
[gl_cv_func_frexp_no_libm=yes],
[gl_cv_func_frexp_no_libm=no])
])
AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
AC_CACHE_CHECK([whether frexp works], [gl_cv_func_frexp_works],
[
- AC_TRY_RUN([
+ AC_RUN_IFELSE(
+ [AC_LANG_SOURCE([[
#include <float.h>
#include <math.h>
#include <string.h>
return 1;
}
return 0;
-}], [gl_cv_func_frexp_works=yes], [gl_cv_func_frexp_works=no],
- [case "$host_os" in
- netbsd* | irix* | mingw*) gl_cv_func_frexp_works="guessing no";;
- *) gl_cv_func_frexp_works="guessing yes";;
- esac
- ])
+}]])],
+ [gl_cv_func_frexp_works=yes],
+ [gl_cv_func_frexp_works=no],
+ [case "$host_os" in
+ netbsd* | irix* | mingw*) gl_cv_func_frexp_works="guessing no";;
+ *) gl_cv_func_frexp_works="guessing yes";;
+ esac
+ ])
])
])
-# frexpl.m4 serial 11
+# frexpl.m4 serial 12
dnl Copyright (C) 2007-2010 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
[
save_LIBS="$LIBS"
LIBS="$LIBS -lm"
- AC_TRY_LINK([#include <math.h>
- long double x;],
- [int e; return frexpl (x, &e) > 0;],
+ AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[#include <math.h>
+ long double x;]],
+ [[int e; return frexpl (x, &e) > 0;]])],
[gl_cv_func_frexpl_in_libm=yes],
[gl_cv_func_frexpl_in_libm=no])
LIBS="$save_LIBS"
AC_CACHE_CHECK([whether frexpl() can be used without linking with libm],
[gl_cv_func_frexpl_no_libm],
[
- AC_TRY_LINK([#include <math.h>
- long double x;],
- [int e; return frexpl (x, &e) > 0;],
+ AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[#include <math.h>
+ long double x;]],
+ [[int e; return frexpl (x, &e) > 0;]])],
[gl_cv_func_frexpl_no_libm=yes],
[gl_cv_func_frexpl_no_libm=no])
])
AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
AC_CACHE_CHECK([whether frexpl works], [gl_cv_func_frexpl_works],
[
- AC_TRY_RUN([
+ AC_RUN_IFELSE(
+ [AC_LANG_SOURCE([[
#include <float.h>
#include <math.h>
/* Override the values of <float.h>, like done in float.in.h. */
return 1;
}
return 0;
-}], [gl_cv_func_frexpl_works=yes], [gl_cv_func_frexpl_works=no],
- [
+}]])],
+ [gl_cv_func_frexpl_works=yes],
+ [gl_cv_func_frexpl_works=no],
+ [
changequote(,)dnl
- case "$host_os" in
- aix | aix[3-6]* | beos* | darwin* | irix* | mingw* | pw*)
- gl_cv_func_frexpl_works="guessing no";;
- *) gl_cv_func_frexpl_works="guessing yes";;
- esac
+ case "$host_os" in
+ aix | aix[3-6]* | beos* | darwin* | irix* | mingw* | pw*)
+ gl_cv_func_frexpl_works="guessing no";;
+ *) gl_cv_func_frexpl_works="guessing yes";;
+ esac
changequote([,])dnl
- ])
+ ])
])
])
-# ftello.m4 serial 7
+# ftello.m4 serial 8
dnl Copyright (C) 2007-2010 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
AC_CACHE_CHECK([for ftello], [gl_cv_func_ftello],
[
- AC_TRY_LINK([#include <stdio.h>], [ftello (stdin);],
- [gl_cv_func_ftello=yes], [gl_cv_func_ftello=no])
+ AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[#include <stdio.h>]],
+ [[ftello (stdin);]])],
+ [gl_cv_func_ftello=yes],
+ [gl_cv_func_ftello=no])
])
if test $gl_cv_func_ftello = no; then
HAVE_FTELLO=0
*) gl_cv_func_ftello_works="guessing yes" ;;
esac
changequote([,])dnl
- AC_TRY_RUN([
+ AC_RUN_IFELSE(
+ [AC_LANG_SOURCE([[
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
/* The file's contents is now "foogarsh!". */
return 0;
-}], [gl_cv_func_ftello_works=yes], [gl_cv_func_ftello_works=no], [:])
+}]])],
+ [gl_cv_func_ftello_works=yes],
+ [gl_cv_func_ftello_works=no], [:])
])
case "$gl_cv_func_ftello_works" in
*yes) ;;
-# serial 4
+# serial 5
# See if we need to provide futimens replacement.
dnl Copyright (C) 2009, 2010 Free Software Foundation, Inc.
#include <fcntl.h>
#include <sys/stat.h>
#include <unistd.h>
+#include <errno.h>
]], [[struct timespec ts[2] = { { 1, UTIME_OMIT }, { 1, UTIME_NOW } };
int fd = creat ("conftest.file", 0600);
struct stat st;
if (fd < 0) return 1;
+ errno = 0;
if (futimens (AT_FDCWD, NULL) == 0) return 2;
- if (futimens (fd, ts)) return 3;
+ if (errno != EBADF) return 3;
+ if (futimens (fd, ts)) return 4;
sleep (1);
ts[0].tv_nsec = UTIME_NOW;
ts[1].tv_nsec = UTIME_OMIT;
- if (futimens (fd, ts)) return 4;
- if (fstat (fd, &st)) return 5;
- if (st.st_ctime < st.st_atime) return 6;
+ if (futimens (fd, ts)) return 5;
+ if (fstat (fd, &st)) return 6;
+ if (st.st_ctime < st.st_atime) return 7;
]])],
dnl FIXME: simplify this in 2012, when file system bugs are no longer common
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
-# gc-random.m4 serial 4
+# gc-random.m4 serial 5
dnl Copyright (C) 2005-2010 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
AC_REQUIRE([AC_CANONICAL_HOST])dnl
case "$host_os" in
- *openbsd*)
+ *openbsd* | *mirbsd*)
NAME_OF_RANDOM_DEVICE="/dev/srandom"
NAME_OF_PSEUDO_RANDOM_DEVICE="/dev/prandom"
NAME_OF_NONCE_DEVICE="/dev/urandom"
+++ /dev/null
-# getdate.m4 serial 16
-dnl Copyright (C) 2002-2006, 2008-2010 Free Software Foundation, Inc.
-dnl This file is free software; the Free Software Foundation
-dnl gives unlimited permission to copy and/or distribute it,
-dnl with or without modifications, as long as this notice is preserved.
-
-dnl Define HAVE_COMPOUND_LITERALS if the C compiler supports compound literals
-dnl as in ISO C99.
-dnl Note that compound literals such as (struct s) { 3, 4 } can be used for
-dnl initialization of stack-allocated variables, but are not constant
-dnl expressions and therefore cannot be used as initializer for global or
-dnl static variables (even though gcc supports this in pre-C99 mode).
-AC_DEFUN([gl_C_COMPOUND_LITERALS],
-[
- AC_CACHE_CHECK([for compound literals], [gl_cv_compound_literals],
- [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[struct s { int i, j; };]],
- [[struct s t = (struct s) { 3, 4 };
- if (t.i != 0) return 0;]])],
- gl_cv_compound_literals=yes,
- gl_cv_compound_literals=no)])
- if test $gl_cv_compound_literals = yes; then
- AC_DEFINE([HAVE_COMPOUND_LITERALS], [1],
- [Define if you have compound literals.])
- fi
-])
-
-AC_DEFUN([gl_GETDATE],
-[
- dnl Prerequisites of lib/getdate.h.
- AC_REQUIRE([AM_STDBOOL_H])
- AC_REQUIRE([gl_TIMESPEC])
-
- dnl Prerequisites of lib/getdate.y.
- AC_REQUIRE([gl_BISON])
- AC_REQUIRE([gl_C_COMPOUND_LITERALS])
- AC_STRUCT_TIMEZONE
- AC_REQUIRE([gl_CLOCK_TIME])
- AC_REQUIRE([gl_TM_GMTOFF])
- AC_COMPILE_IFELSE(
- [AC_LANG_SOURCE([[
-#include <time.h> /* for time_t */
-#include <limits.h> /* for CHAR_BIT, LONG_MIN, LONG_MAX */
-#define TYPE_MINIMUM(t) \
- ((t) ((t) 0 < (t) -1 ? (t) 0 : ~ (t) 0 << (sizeof (t) * CHAR_BIT - 1)))
-#define TYPE_MAXIMUM(t) \
- ((t) ((t) 0 < (t) -1 ? (t) -1 : ~ (~ (t) 0 << (sizeof (t) * CHAR_BIT - 1))))
-typedef int verify_min[2 * (LONG_MIN <= TYPE_MINIMUM (time_t)) - 1];
-typedef int verify_max[2 * (TYPE_MAXIMUM (time_t) <= LONG_MAX) - 1];
- ]])],
- [AC_DEFINE([TIME_T_FITS_IN_LONG_INT], [1],
- [Define to 1 if all 'time_t' values fit in a 'long int'.])
- ])
-])
-# getopt.m4 serial 29
+# getopt.m4 serial 31
dnl Copyright (C) 2002-2006, 2008-2010 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
AC_DEFUN([gl_GETOPT_CHECK_HEADERS],
[
AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
+ AC_REQUIRE([AC_PROG_AWK]) dnl for awk that supports ENVIRON
dnl Persuade Solaris <unistd.h> to declare optarg, optind, opterr, optopt.
AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
# optstring is necessary for programs like m4 that have POSIX-mandated
# semantics for supporting options interspersed with files.
# Also, since getopt_long is a GNU extension, we require optind=0.
- gl_had_POSIXLY_CORRECT=${POSIXLY_CORRECT:+yes}
+ # Bash ties 'set -o posix' to a non-exported POSIXLY_CORRECT;
+ # so take care to revert to the correct (non-)export state.
+dnl GNU Coding Standards currently allow awk but not env; besides, env
+dnl is ambiguous with environment values that contain newlines.
+ gl_awk_probe='BEGIN { if ("POSIXLY_CORRECT" in ENVIRON) print "x" }'
+ case ${POSIXLY_CORRECT+x}`$AWK "$gl_awk_probe" </dev/null` in
+ xx) gl_had_POSIXLY_CORRECT=exported ;;
+ x) gl_had_POSIXLY_CORRECT=yes ;;
+ *) gl_had_POSIXLY_CORRECT= ;;
+ esac
POSIXLY_CORRECT=1
export POSIXLY_CORRECT
AC_RUN_IFELSE(
*) gl_cv_func_getopt_gnu=yes;;
esac
])
- if test "$gl_had_POSIXLY_CORRECT" != yes; then
- AS_UNSET([POSIXLY_CORRECT])
- fi
+ case $gl_had_POSIXLY_CORRECT in
+ exported) ;;
+ yes) AS_UNSET([POSIXLY_CORRECT]); POSIXLY_CORRECT=1 ;;
+ *) AS_UNSET([POSIXLY_CORRECT]) ;;
+ esac
])
if test "$gl_cv_func_getopt_gnu" = "no"; then
gl_replace_getopt=yes
-# gettext.m4 serial 63 (gettext-0.18)
+# gettext.m4 serial 64 (gettext-0.18.2)
dnl Copyright (C) 1995-2010 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
fi
AC_CACHE_CHECK([for GNU gettext in libc], [$gt_func_gnugettext_libc],
- [AC_TRY_LINK([#include <libintl.h>
+ [AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[
+#include <libintl.h>
$gt_revision_test_code
extern int _nl_msg_cat_cntr;
-extern int *_nl_domain_bindings;],
- [bindtextdomain ("", "");
-return * gettext ("")$gt_expression_test_code + _nl_msg_cat_cntr + *_nl_domain_bindings],
+extern int *_nl_domain_bindings;
+ ]],
+ [[
+bindtextdomain ("", "");
+return * gettext ("")$gt_expression_test_code + _nl_msg_cat_cntr + *_nl_domain_bindings
+ ]])],
[eval "$gt_func_gnugettext_libc=yes"],
[eval "$gt_func_gnugettext_libc=no"])])
gt_save_LIBS="$LIBS"
LIBS="$LIBS $LIBINTL"
dnl Now see whether libintl exists and does not depend on libiconv.
- AC_TRY_LINK([#include <libintl.h>
+ AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[
+#include <libintl.h>
$gt_revision_test_code
extern int _nl_msg_cat_cntr;
extern
#ifdef __cplusplus
"C"
#endif
-const char *_nl_expand_alias (const char *);],
- [bindtextdomain ("", "");
-return * gettext ("")$gt_expression_test_code + _nl_msg_cat_cntr + *_nl_expand_alias ("")],
+const char *_nl_expand_alias (const char *);
+ ]],
+ [[
+bindtextdomain ("", "");
+return * gettext ("")$gt_expression_test_code + _nl_msg_cat_cntr + *_nl_expand_alias ("")
+ ]])],
[eval "$gt_func_gnugettext_libintl=yes"],
[eval "$gt_func_gnugettext_libintl=no"])
dnl Now see whether libintl exists and depends on libiconv.
if { eval "gt_val=\$$gt_func_gnugettext_libintl"; test "$gt_val" != yes; } && test -n "$LIBICONV"; then
LIBS="$LIBS $LIBICONV"
- AC_TRY_LINK([#include <libintl.h>
+ AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[
+#include <libintl.h>
$gt_revision_test_code
extern int _nl_msg_cat_cntr;
extern
#ifdef __cplusplus
"C"
#endif
-const char *_nl_expand_alias (const char *);],
- [bindtextdomain ("", "");
-return * gettext ("")$gt_expression_test_code + _nl_msg_cat_cntr + *_nl_expand_alias ("")],
- [LIBINTL="$LIBINTL $LIBICONV"
- LTLIBINTL="$LTLIBINTL $LTLIBICONV"
- eval "$gt_func_gnugettext_libintl=yes"
- ])
+const char *_nl_expand_alias (const char *);
+ ]],
+ [[
+bindtextdomain ("", "");
+return * gettext ("")$gt_expression_test_code + _nl_msg_cat_cntr + *_nl_expand_alias ("")
+ ]])],
+ [LIBINTL="$LIBINTL $LIBICONV"
+ LTLIBINTL="$LTLIBINTL $LTLIBICONV"
+ eval "$gt_func_gnugettext_libintl=yes"
+ ])
fi
CPPFLAGS="$gt_save_CPPFLAGS"
LIBS="$gt_save_LIBS"])
--- /dev/null
+# host-cpu-c-abi.m4 serial 1
+dnl Copyright (C) 2002-2010 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+dnl From Bruno Haible and Sam Steingold.
+
+dnl Sets the HOST_CPU_C_ABI variable to the canonical name of the CPU with its
+dnl C language ABI (application binary interface).
+dnl Also defines __${HOST_CPU_C_ABI}__ as a C macro in config.h.
+dnl
+dnl This canonical name can be used to select a particular assembly language
+dnl source file that will interoperate with C code on the given host.
+dnl
+dnl For example:
+dnl * 'i386' and 'sparc' are different canonical names, because code for i386
+dnl will not run on SPARC CPUs and vice versa. They have different
+dnl instruction sets.
+dnl * 'sparc' and 'sparc64' are different canonical names, because code for
+dnl 'sparc' and code for 'sparc64' cannot be linked together: 'sparc' code
+dnl contains 32-bit instructions, whereas 'sparc64' code contains 64-bit
+dnl instructions. A process on a SPARC CPU can be in 32-bit mode or in 64-bit
+dnl mode, but not both.
+dnl * 'mips' and 'mipsn32' are different canonical names, because they use
+dnl different argument passing and return conventions for C functions, and
+dnl although the instruction set of 'mips' is a large subset of the
+dnl instruction set of 'mipsn32'.
+dnl * 'mipsn32' and 'mips64' are different canonical names, because they use
+dnl different sizes for the C types like 'int' and 'void *', and although
+dnl the instruction sets of 'mipsn32' and 'mips64' are the same.
+dnl * 'arm' and 'armel' are different canonical names, because they use
+dnl different memory ordering for the C types like 'int', and although
+dnl the instruction sets of 'arm' and 'armel' are the same.
+dnl * The same name 'i386' is used for CPUs of type i386, i486, i586
+dnl (Pentium), AMD K7, Pentium II, Pentium IV, etc., because
+dnl - Instructions that do not exist on all of these CPUs (cmpxchg,
+dnl MMX, SSE, SSE2, 3DNow! etc.) are not frequently used. If your
+dnl assembly language source files use such instructions, you will
+dnl need to make the distinction.
+dnl - Speed of execution of the common instruction set is reasonable across
+dnl the entire family of CPUs. If you have assembly language source files
+dnl that are optimized for particular CPU types (like GNU gmp has), you
+dnl will need to make the distinction.
+dnl See <http://en.wikipedia.org/wiki/X86_instruction_listings>.
+AC_DEFUN([gl_HOST_CPU_C_ABI],
+[
+ AC_REQUIRE([AC_CANONICAL_HOST])
+ AC_CACHE_CHECK([host CPU and C ABI], [gl_cv_host_cpu_c_abi],
+ [case "$host_cpu" in
+
+changequote(,)dnl
+ i[4567]86 )
+changequote([,])dnl
+ gl_cv_host_cpu_c_abi=i386
+ ;;
+
+ x86_64 )
+ # On x86_64 systems, the C compiler may still be generating
+ # 32-bit code.
+ AC_EGREP_CPP([yes],
+ [#if defined __LP64__ || defined __x86_64__ || defined __amd64__
+ yes
+ #endif],
+ [gl_cv_host_cpu_c_abi=x86_64],
+ [gl_cv_host_cpu_c_abi=i386])
+ ;;
+
+changequote(,)dnl
+ alphaev[4-8] | alphaev56 | alphapca5[67] | alphaev6[78] )
+changequote([,])dnl
+ gl_cv_host_cpu_c_abi=alpha
+ ;;
+
+ arm* )
+ AC_EGREP_CPP([yes],
+ [#if defined __ARMEL__
+ yes
+ #endif],
+ [gl_cv_host_cpu_c_abi=armel],
+ [gl_cv_host_cpu_c_abi=arm])
+ ;;
+
+ hppa1.0 | hppa1.1 | hppa2.0* | hppa64 )
+ # TODO: Distinguish hppa and hppa64 correctly.
+ gl_cv_host_cpu_c_abi=hppa
+ ;;
+
+ mips* )
+ # We should also check for (_MIPS_SZPTR == 64), but gcc keeps this
+ # at 32.
+ AC_EGREP_CPP([yes],
+ [#if defined _MIPS_SZLONG && (_MIPS_SZLONG == 64)
+ yes
+ #endif],
+ [gl_cv_host_cpu_c_abi=mips64],
+ [# Strictly speaking, the MIPS ABI (-32 or -n32) is independent
+ # from the CPU identification (-mips[12] or -mips[34]). But -n32
+ # is commonly used together with -mips3, and it's easier to test
+ # the CPU identification.
+ AC_EGREP_CPP([yes],
+ [#if __mips >= 3
+ yes
+ #endif],
+ [gl_cv_host_cpu_c_abi=mipsn32],
+ [gl_cv_host_cpu_c_abi=mips])])
+ ;;
+
+ powerpc64 )
+ # On powerpc64 systems, the C compiler may still be generating
+ # 32-bit code.
+ AC_EGREP_CPP([yes],
+ [#if defined __powerpc64__ || defined _ARCH_PPC64
+ yes
+ #endif],
+ [gl_cv_host_cpu_c_abi=powerpc64],
+ [gl_cv_host_cpu_c_abi=powerpc])
+ ;;
+
+ rs6000 )
+ gl_cv_host_cpu_c_abi=powerpc
+ ;;
+
+ # TODO: Distinguish s390 and s390x correctly.
+
+ sparc | sparc64 )
+ # UltraSPARCs running Linux have `uname -m` = "sparc64", but the
+ # C compiler still generates 32-bit code.
+ AC_EGREP_CPP([yes],
+ [#if defined __sparcv9 || defined __arch64__
+ yes
+ #endif],
+ [gl_cv_host_cpu_c_abi=sparc64],
+ [gl_cv_host_cpu_c_abi=sparc])
+ ;;
+
+ *)
+ gl_cv_host_cpu_c_abi="$host_cpu"
+ ;;
+ esac
+ ])
+
+ HOST_CPU_C_ABI="$gl_cv_host_cpu_c_abi"
+ AC_SUBST([HOST_CPU_C_ABI])
+
+ # This was AC_DEFINE_UNQUOTED([__${gl_cv_host_cpu_c_abi}__]) earlier,
+ # but KAI C++ 3.2d doesn't like this.
+ cat >> confdefs.h <<EOF
+#ifndef __${gl_cv_host_cpu_c_abi}__
+#define __${gl_cv_host_cpu_c_abi}__ 1
+#endif
+EOF
+ AH_TOP([/* CPU and C ABI indicator */
+#ifndef __i386__
+#undef __i386__
+#endif
+#ifndef __x86_64__
+#undef __x86_64__
+#endif
+#ifndef __alpha__
+#undef __alpha__
+#endif
+#ifndef __arm__
+#undef __arm__
+#endif
+#ifndef __armel__
+#undef __armel__
+#endif
+#ifndef __hppa__
+#undef __hppa__
+#endif
+#ifndef __hppa64__
+#undef __hppa64__
+#endif
+#ifndef __ia64__
+#undef __ia64__
+#endif
+#ifndef __m68k__
+#undef __m68k__
+#endif
+#ifndef __mips__
+#undef __mips__
+#endif
+#ifndef __mipsn32__
+#undef __mipsn32__
+#endif
+#ifndef __mips64__
+#undef __mips64__
+#endif
+#ifndef __powerpc__
+#undef __powerpc__
+#endif
+#ifndef __powerpc64__
+#undef __powerpc64__
+#endif
+#ifndef __s390__
+#undef __s390__
+#endif
+#ifndef __s390x__
+#undef __s390x__
+#endif
+#ifndef __sh__
+#undef __sh__
+#endif
+#ifndef __sparc__
+#undef __sparc__
+#endif
+#ifndef __sparc64__
+#undef __sparc64__
+#endif
+])
+
+])
-# serial 7
+# serial 8
# Copyright (C) 2001, 2003-2004, 2006, 2009-2010 Free Software Foundation, Inc.
# This file is free software; the Free Software Foundation
nonstopux*) os='NonStop-UX';;
netbsd*-gnu*) os='GNU/NetBSD';; # NetBSD kernel+libc, GNU userland
netbsd*) os='NetBSD';;
+ mirbsd*) os='MirBSD';;
knetbsd*-gnu) os='GNU/kNetBSD';; # NetBSD kernel, GNU libc+userland
kfreebsd*-gnu) os='GNU/kFreeBSD';; # FreeBSD kernel, GNU libc+userland
msdosdjgpp*) os='DJGPP';;
-# hostent.m4 serial 1
-dnl Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc.
+# hostent.m4 serial 2
+dnl Copyright (C) 2008, 2010 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.
[gl_cv_w32_gethostbyname=no
gl_save_LIBS="$LIBS"
LIBS="$LIBS -lws2_32"
- AC_TRY_LINK([
+ AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[
#ifdef HAVE_WINSOCK2_H
#include <winsock2.h>
#endif
#include <stddef.h>
-], [gethostbyname(NULL);], [gl_cv_w32_gethostbyname=yes])
+ ]],
+ [[gethostbyname(NULL);]])],
+ [gl_cv_w32_gethostbyname=yes])
LIBS="$gl_save_LIBS"
])
if test "$gl_cv_w32_gethostbyname" = "yes"; then
-# iconv.m4 serial 11b
+# iconv.m4 serial 15 (gettext-0.18.2)
dnl Copyright (C) 2000-2002, 2007-2010 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 Add $INCICONV to CPPFLAGS before performing the following checks,
dnl because if the user has installed libiconv and not disabled its use
dnl via --without-libiconv-prefix, he wants to use it. The first
- dnl AC_TRY_LINK will then fail, the second AC_TRY_LINK will succeed.
+ dnl AC_LINK_IFELSE will then fail, the second AC_LINK_IFELSE will succeed.
am_save_CPPFLAGS="$CPPFLAGS"
AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCICONV])
AC_CACHE_CHECK([for iconv], [am_cv_func_iconv], [
am_cv_func_iconv="no, consider installing GNU libiconv"
am_cv_lib_iconv=no
- AC_TRY_LINK([#include <stdlib.h>
-#include <iconv.h>],
- [iconv_t cd = iconv_open("","");
- iconv(cd,NULL,NULL,NULL,NULL);
- iconv_close(cd);],
+ AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[
+#include <stdlib.h>
+#include <iconv.h>
+ ]],
+ [[iconv_t cd = iconv_open("","");
+ iconv(cd,NULL,NULL,NULL,NULL);
+ iconv_close(cd);]])],
[am_cv_func_iconv=yes])
if test "$am_cv_func_iconv" != yes; then
am_save_LIBS="$LIBS"
LIBS="$LIBS $LIBICONV"
- AC_TRY_LINK([#include <stdlib.h>
-#include <iconv.h>],
- [iconv_t cd = iconv_open("","");
- iconv(cd,NULL,NULL,NULL,NULL);
- iconv_close(cd);],
+ AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[
+#include <stdlib.h>
+#include <iconv.h>
+ ]],
+ [[iconv_t cd = iconv_open("","");
+ iconv(cd,NULL,NULL,NULL,NULL);
+ iconv_close(cd);]])],
[am_cv_lib_iconv=yes]
[am_cv_func_iconv=yes])
LIBS="$am_save_LIBS"
if test $am_cv_lib_iconv = yes; then
LIBS="$LIBS $LIBICONV"
fi
- AC_TRY_RUN([
+ AC_RUN_IFELSE(
+ [AC_LANG_SOURCE([[
#include <iconv.h>
#include <string.h>
int main ()
&& iconv_open ("utf8", "eucJP") == (iconv_t)(-1))
return 1;
return 0;
-}], [am_cv_func_iconv_works=yes], [am_cv_func_iconv_works=no],
+}]])],
+ [am_cv_func_iconv_works=yes],
+ [am_cv_func_iconv_works=no],
[
changequote(,)dnl
case "$host_os" in
m4_version_prereq([2.64],
[[AC_DEFUN_ONCE(
[$1], [$2])]],
- [[AC_DEFUN(
- [$1], [$2])]]))
+ [m4_ifdef([gl_00GNULIB],
+ [[AC_DEFUN_ONCE(
+ [$1], [$2])]],
+ [[AC_DEFUN(
+ [$1], [$2])]])]))
gl_iconv_AC_DEFUN([AM_ICONV],
[
AM_ICONV_LINK
if test "$am_cv_func_iconv" = yes; then
AC_MSG_CHECKING([for iconv declaration])
AC_CACHE_VAL([am_cv_proto_iconv], [
- AC_TRY_COMPILE([
+ AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[
#include <stdlib.h>
#include <iconv.h>
extern
#else
size_t iconv();
#endif
-], [], [am_cv_proto_iconv_arg1=""], [am_cv_proto_iconv_arg1="const"])
+ ]],
+ [[]])],
+ [am_cv_proto_iconv_arg1=""],
+ [am_cv_proto_iconv_arg1="const"])
am_cv_proto_iconv="extern size_t iconv (iconv_t cd, $am_cv_proto_iconv_arg1 char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);"])
am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'`
AC_MSG_RESULT([
-# iconv_open.m4 serial 7
+# iconv_open.m4 serial 8
dnl Copyright (C) 2007-2010 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
[
save_LIBS="$LIBS"
LIBS="$LIBS $LIBICONV"
- AC_TRY_RUN([
+ AC_RUN_IFELSE(
+ [AC_LANG_SOURCE([[
#include <iconv.h>
#include <errno.h>
#include <stdio.h>
ASSERT (iconv_close (cd) == 0);
}
return 0;
-}], [gl_cv_func_iconv_supports_utf=yes], [gl_cv_func_iconv_supports_utf=no],
+}]])],
+ [gl_cv_func_iconv_supports_utf=yes],
+ [gl_cv_func_iconv_supports_utf=no],
[
dnl We know that GNU libiconv, GNU libc, and Solaris >= 9 do.
dnl OSF/1 5.1 has these encodings, but inserts a BOM in the "to"
-# include_next.m4 serial 14
+# include_next.m4 serial 16
dnl Copyright (C) 2006-2010 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 __STDC__ evaluates to 0 instead of to 1. The latter is an undesired side
dnl effect; we are therefore careful to use 'defined __STDC__' or '1' instead
dnl of plain '__STDC__'.
+dnl
+dnl PRAGMA_COLUMNS can be used in files that override system header files, so
+dnl as to avoid compilation errors on HP NonStop systems when the gnulib file
+dnl is included by a system header file that does a "#pragma COLUMNS 80" (which
+dnl has the effect of truncating the lines of that file and all files that it
+dnl includes to 80 columns) and the gnulib file has lines longer than 80
+dnl columns.
AC_DEFUN([gl_INCLUDE_NEXT],
[
EOF
gl_save_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$gl_save_CPPFLAGS -Iconftestd1b -Iconftestd2"
- AC_COMPILE_IFELSE([#include <conftest.h>],
+dnl We intentionally avoid using AC_LANG_SOURCE here.
+ AC_COMPILE_IFELSE([AC_LANG_DEFINES_PROVIDED[#include <conftest.h>]],
[gl_cv_have_include_next=yes],
[CPPFLAGS="$gl_save_CPPFLAGS -Iconftestd1a -Iconftestd2"
- AC_COMPILE_IFELSE([#include <conftest.h>],
+ AC_COMPILE_IFELSE([AC_LANG_DEFINES_PROVIDED[#include <conftest.h>]],
[gl_cv_have_include_next=buggy],
[gl_cv_have_include_next=no])
])
AC_SUBST([INCLUDE_NEXT])
AC_SUBST([INCLUDE_NEXT_AS_FIRST_DIRECTIVE])
AC_SUBST([PRAGMA_SYSTEM_HEADER])
+ AC_CACHE_CHECK([whether system header files limit the line length],
+ [gl_cv_pragma_columns],
+ [dnl HP NonStop systems, which define __TANDEM, have this misfeature.
+ AC_EGREP_CPP([choke me],
+ [
+#ifdef __TANDEM
+choke me
+#endif
+ ],
+ [gl_cv_pragma_columns=yes],
+ [gl_cv_pragma_columns=no])
+ ])
+ if test $gl_cv_pragma_columns = yes; then
+ PRAGMA_COLUMNS="#pragma COLUMNS 10000"
+ else
+ PRAGMA_COLUMNS=
+ fi
+ AC_SUBST([PRAGMA_COLUMNS])
])
# gl_CHECK_NEXT_HEADERS(HEADER1 HEADER2 ...)
[$gl_next_as_first_directive])
AS_VAR_POPDEF([gl_next_header])])
])
+
+# Autoconf 2.68 added warnings for our use of AC_COMPILE_IFELSE;
+# this fallback is safe for all earlier autoconf versions.
+m4_define_default([AC_LANG_DEFINES_PROVIDED])
-# intdiv0.m4 serial 3 (gettext-0.18)
-dnl Copyright (C) 2002, 2007-2010 Free Software Foundation, Inc.
+# intdiv0.m4 serial 4 (gettext-0.18.2)
+dnl Copyright (C) 2002, 2007-2008, 2010 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.
esac
changequote([,])dnl
if test -z "$gt_cv_int_divbyzero_sigfpe"; then
- AC_TRY_RUN([
+ AC_RUN_IFELSE(
+ [AC_LANG_SOURCE([[
#include <stdlib.h>
#include <signal.h>
nan = y / y;
exit (1);
}
-], [gt_cv_int_divbyzero_sigfpe=yes], [gt_cv_int_divbyzero_sigfpe=no],
+]])],
+ [gt_cv_int_divbyzero_sigfpe=yes],
+ [gt_cv_int_divbyzero_sigfpe=no],
[
# Guess based on the CPU.
changequote(,)dnl
-# intl.m4 serial 17 (gettext-0.18)
-dnl Copyright (C) 1995-2009 Free Software Foundation, Inc.
+# intl.m4 serial 17b
+dnl Copyright (C) 1995-2010 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
dnl Ulrich Drepper <drepper@cygnus.com>, 1995-2000.
dnl Bruno Haible <haible@clisp.cons.org>, 2000-2009.
-AC_PREREQ([2.52])
+AC_PREREQ([2.53])
dnl Checks for all prerequisites of the intl subdirectory,
dnl except for INTL_LIBTOOL_SUFFIX_PREFIX (and possibly LIBTOOL), INTLOBJS,
AC_REQUIRE([gt_INTTYPES_PRI])dnl
AC_REQUIRE([gl_LOCK])dnl
- AC_TRY_LINK(
- [int foo (int a) { a = __builtin_expect (a, 10); return a == 10 ? 0 : 1; }],
- [],
+ AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[int foo (int a) { a = __builtin_expect (a, 10); return a == 10 ? 0 : 1; }]],
+ [[]])],
[AC_DEFINE([HAVE_BUILTIN_EXPECT], [1],
[Define to 1 if the compiler understands __builtin_expect.])])
AC_DEFUN([gt_CHECK_DECL],
[
AC_CACHE_CHECK([whether $1 is declared], [ac_cv_have_decl_$1],
- [AC_TRY_COMPILE([$2], [
+ [AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[$2]],
+ [[
#ifndef $1
char *p = (char *) $1;
#endif
-], ac_cv_have_decl_$1=yes, ac_cv_have_decl_$1=no)])
+ ]])],
+ [ac_cv_have_decl_$1=yes],
+ [ac_cv_have_decl_$1=no])])
if test $ac_cv_have_decl_$1 = yes; then
gt_value=1
else
-# intlmacosx.m4 serial 3 (gettext-0.18)
+# intlmacosx.m4 serial 4 (gettext-0.18.2)
dnl Copyright (C) 2004-2010 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
[gt_cv_func_CFPreferencesCopyAppValue],
[gt_save_LIBS="$LIBS"
LIBS="$LIBS -Wl,-framework -Wl,CoreFoundation"
- AC_TRY_LINK([#include <CoreFoundation/CFPreferences.h>],
- [CFPreferencesCopyAppValue(NULL, NULL)],
+ AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[#include <CoreFoundation/CFPreferences.h>]],
+ [[CFPreferencesCopyAppValue(NULL, NULL)]])],
[gt_cv_func_CFPreferencesCopyAppValue=yes],
[gt_cv_func_CFPreferencesCopyAppValue=no])
LIBS="$gt_save_LIBS"])
AC_CACHE_CHECK([for CFLocaleCopyCurrent], [gt_cv_func_CFLocaleCopyCurrent],
[gt_save_LIBS="$LIBS"
LIBS="$LIBS -Wl,-framework -Wl,CoreFoundation"
- AC_TRY_LINK([#include <CoreFoundation/CFLocale.h>], [CFLocaleCopyCurrent();],
+ AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[#include <CoreFoundation/CFLocale.h>]],
+ [[CFLocaleCopyCurrent();]])],
[gt_cv_func_CFLocaleCopyCurrent=yes],
[gt_cv_func_CFLocaleCopyCurrent=no])
LIBS="$gt_save_LIBS"])
-# intmax.m4 serial 5 (gettext-0.18)
+# intmax.m4 serial 6 (gettext-0.18.2)
dnl Copyright (C) 2002-2005, 2008-2010 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
AC_REQUIRE([gl_AC_HEADER_INTTYPES_H])
AC_REQUIRE([gl_AC_HEADER_STDINT_H])
AC_CACHE_CHECK([for intmax_t], [gt_cv_c_intmax_t],
- [AC_TRY_COMPILE([
+ [AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[
#include <stddef.h>
#include <stdlib.h>
#if HAVE_STDINT_H_WITH_UINTMAX
#if HAVE_INTTYPES_H_WITH_UINTMAX
#include <inttypes.h>
#endif
-], [intmax_t x = -1;
- return !x;],
+ ]],
+ [[intmax_t x = -1;
+ return !x;]])],
[gt_cv_c_intmax_t=yes],
[gt_cv_c_intmax_t=no])])
if test $gt_cv_c_intmax_t = yes; then
-# intmax_t.m4 serial 7
+# intmax_t.m4 serial 8
dnl Copyright (C) 1997-2004, 2006-2007, 2009-2010 Free Software Foundation,
dnl Inc.
dnl This file is free software; the Free Software Foundation
dnl From Paul Eggert.
-AC_PREREQ([2.13])
+AC_PREREQ([2.53])
# Define intmax_t to 'long' or 'long long'
# if it is not already defined in <stdint.h> or <inttypes.h>.
AC_REQUIRE([gl_AC_HEADER_INTTYPES_H])
AC_REQUIRE([gl_AC_HEADER_STDINT_H])
AC_CACHE_CHECK([for intmax_t], [gt_cv_c_intmax_t],
- [AC_TRY_COMPILE([
+ [AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[
#include <stddef.h>
#include <stdlib.h>
#if HAVE_STDINT_H_WITH_UINTMAX
#if HAVE_INTTYPES_H_WITH_UINTMAX
#include <inttypes.h>
#endif
-], [intmax_t x = -1; return !x;], gt_cv_c_intmax_t=yes, gt_cv_c_intmax_t=no)])
+ ]],
+ [[intmax_t x = -1; return !x;]])],
+ [gt_cv_c_intmax_t=yes],
+ [gt_cv_c_intmax_t=no])])
if test $gt_cv_c_intmax_t = yes; then
AC_DEFINE([HAVE_INTMAX_T], [1],
[Define if you have the 'intmax_t' type in <stdint.h> or <inttypes.h>.])
-# inttypes-pri.m4 serial 6 (gettext-0.18)
+# inttypes-pri.m4 serial 7 (gettext-0.18.2)
dnl Copyright (C) 1997-2002, 2006, 2008-2010 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 From Bruno Haible.
-AC_PREREQ([2.52])
+AC_PREREQ([2.53])
# Define PRI_MACROS_BROKEN if <inttypes.h> exists and defines the PRI*
# macros to non-string values. This is the case on AIX 4.3.3.
AC_CACHE_CHECK([whether the inttypes.h PRIxNN macros are broken],
[gt_cv_inttypes_pri_broken],
[
- AC_TRY_COMPILE([#include <inttypes.h>
+ AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[
+#include <inttypes.h>
#ifdef PRId32
char *p = PRId32;
#endif
-], [], [gt_cv_inttypes_pri_broken=no], [gt_cv_inttypes_pri_broken=yes])
+ ]],
+ [[]])],
+ [gt_cv_inttypes_pri_broken=no],
+ [gt_cv_inttypes_pri_broken=yes])
])
fi
if test "$gt_cv_inttypes_pri_broken" = yes; then
-# inttypes_h.m4 serial 9
+# inttypes_h.m4 serial 10
dnl Copyright (C) 1997-2004, 2006, 2008-2010 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
AC_DEFUN([gl_AC_HEADER_INTTYPES_H],
[
AC_CACHE_CHECK([for inttypes.h], [gl_cv_header_inttypes_h],
- [AC_TRY_COMPILE(
- [#include <sys/types.h>
-#include <inttypes.h>],
- [uintmax_t i = (uintmax_t) -1; return !i;],
- [gl_cv_header_inttypes_h=yes],
- [gl_cv_header_inttypes_h=no])])
+ [AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[
+#include <sys/types.h>
+#include <inttypes.h>
+ ]],
+ [[uintmax_t i = (uintmax_t) -1; return !i;]])],
+ [gl_cv_header_inttypes_h=yes],
+ [gl_cv_header_inttypes_h=no])])
if test $gl_cv_header_inttypes_h = yes; then
AC_DEFINE_UNQUOTED([HAVE_INTTYPES_H_WITH_UINTMAX], [1],
[Define if <inttypes.h> exists, doesn't clash with <sys/types.h>,
-# isnand.m4 serial 6
+# isnand.m4 serial 7
dnl Copyright (C) 2007-2010 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
[
save_LIBS="$LIBS"
LIBS="$LIBS -lm"
- AC_TRY_LINK([#include <math.h>
- #if __GNUC__ >= 4
- # undef isnand
- # define isnand(x) __builtin_isnand ((double)(x))
- #elif defined isnan
- # undef isnand
- # define isnand(x) isnan ((double)(x))
- #endif
- double x;],
- [return isnand (x);],
+ AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[#include <math.h>
+ #if __GNUC__ >= 4
+ # undef isnand
+ # define isnand(x) __builtin_isnand ((double)(x))
+ #elif defined isnan
+ # undef isnand
+ # define isnand(x) isnan ((double)(x))
+ #endif
+ double x;]],
+ [[return isnand (x);]])],
[gl_cv_func_isnand_in_libm=yes],
[gl_cv_func_isnand_in_libm=no])
LIBS="$save_LIBS"
AC_CACHE_CHECK([whether isnan(double) can be used without linking with libm],
[gl_cv_func_isnand_no_libm],
[
- AC_TRY_LINK([#include <math.h>
- #if __GNUC__ >= 4
- # undef isnand
- # define isnand(x) __builtin_isnan ((double)(x))
- #else
- # undef isnand
- # define isnand(x) isnan ((double)(x))
- #endif
- double x;],
- [return isnand (x);],
+ AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[#include <math.h>
+ #if __GNUC__ >= 4
+ # undef isnand
+ # define isnand(x) __builtin_isnan ((double)(x))
+ #else
+ # undef isnand
+ # define isnand(x) isnan ((double)(x))
+ #endif
+ double x;]],
+ [[return isnand (x);]])],
[gl_cv_func_isnand_no_libm=yes],
[gl_cv_func_isnand_no_libm=no])
])
-# isnanf.m4 serial 10
+# isnanf.m4 serial 11
dnl Copyright (C) 2007-2010 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
AC_CACHE_CHECK([whether isnan(float) can be used without linking with libm],
[gl_cv_func_isnanf_no_libm],
[
- AC_TRY_LINK([#include <math.h>
- #if __GNUC__ >= 4
- # undef isnanf
- # define isnanf(x) __builtin_isnanf ((float)(x))
- #elif defined isnan
- # undef isnanf
- # define isnanf(x) isnan ((float)(x))
- #endif
- float x;],
- [return isnanf (x);],
+ AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[#include <math.h>
+ #if __GNUC__ >= 4
+ # undef isnanf
+ # define isnanf(x) __builtin_isnanf ((float)(x))
+ #elif defined isnan
+ # undef isnanf
+ # define isnanf(x) isnan ((float)(x))
+ #endif
+ float x;]],
+ [[return isnanf (x);]])],
[gl_cv_func_isnanf_no_libm=yes],
[gl_cv_func_isnanf_no_libm=no])
])
[
save_LIBS="$LIBS"
LIBS="$LIBS -lm"
- AC_TRY_LINK([#include <math.h>
- #if __GNUC__ >= 4
- # undef isnanf
- # define isnanf(x) __builtin_isnanf ((float)(x))
- #elif defined isnan
- # undef isnanf
- # define isnanf(x) isnan ((float)(x))
- #endif
- float x;],
- [return isnanf (x);],
+ AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[#include <math.h>
+ #if __GNUC__ >= 4
+ # undef isnanf
+ # define isnanf(x) __builtin_isnanf ((float)(x))
+ #elif defined isnan
+ # undef isnanf
+ # define isnanf(x) isnan ((float)(x))
+ #endif
+ float x;]],
+ [[return isnanf (x);]])],
[gl_cv_func_isnanf_in_libm=yes],
[gl_cv_func_isnanf_in_libm=no])
LIBS="$save_LIBS"
AC_REQUIRE([gl_FLOAT_EXPONENT_LOCATION])
AC_CACHE_CHECK([whether isnan(float) works], [gl_cv_func_isnanf_works],
[
- AC_TRY_RUN([
+ AC_RUN_IFELSE(
+ [AC_LANG_SOURCE([[
#include <math.h>
#if __GNUC__ >= 4
# undef isnanf
#endif
return 0;
-}], [gl_cv_func_isnanf_works=yes], [gl_cv_func_isnanf_works=no],
+}]])],
+ [gl_cv_func_isnanf_works=yes],
+ [gl_cv_func_isnanf_works=no],
[case "$host_os" in
irix* | solaris*) gl_cv_func_isnanf_works="guessing no";;
*) gl_cv_func_isnanf_works="guessing yes";;
-# isnanl.m4 serial 12
+# isnanl.m4 serial 13
dnl Copyright (C) 2007-2010 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
AC_CACHE_CHECK([whether isnan(long double) can be used without linking with libm],
[gl_cv_func_isnanl_no_libm],
[
- AC_TRY_LINK([#include <math.h>
- #if __GNUC__ >= 4
- # undef isnanl
- # define isnanl(x) __builtin_isnanl ((long double)(x))
- #elif defined isnan
- # undef isnanl
- # define isnanl(x) isnan ((long double)(x))
- #endif
- long double x;],
- [return isnanl (x);],
+ AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[#include <math.h>
+ #if __GNUC__ >= 4
+ # undef isnanl
+ # define isnanl(x) __builtin_isnanl ((long double)(x))
+ #elif defined isnan
+ # undef isnanl
+ # define isnanl(x) isnan ((long double)(x))
+ #endif
+ long double x;]],
+ [[return isnanl (x);]])],
[gl_cv_func_isnanl_no_libm=yes],
[gl_cv_func_isnanl_no_libm=no])
])
[
save_LIBS="$LIBS"
LIBS="$LIBS -lm"
- AC_TRY_LINK([#include <math.h>
- #if __GNUC__ >= 4
- # undef isnanl
- # define isnanl(x) __builtin_isnanl ((long double)(x))
- #elif defined isnan
- # undef isnanl
- # define isnanl(x) isnan ((long double)(x))
- #endif
- long double x;],
- [return isnanl (x);],
+ AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[#include <math.h>
+ #if __GNUC__ >= 4
+ # undef isnanl
+ # define isnanl(x) __builtin_isnanl ((long double)(x))
+ #elif defined isnan
+ # undef isnanl
+ # define isnanl(x) isnan ((long double)(x))
+ #endif
+ long double x;]],
+ [[return isnanl (x);]])],
[gl_cv_func_isnanl_in_libm=yes],
[gl_cv_func_isnanl_in_libm=no])
LIBS="$save_LIBS"
AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
AC_CACHE_CHECK([whether isnanl works], [gl_cv_func_isnanl_works],
[
- AC_TRY_RUN([
+ AC_RUN_IFELSE(
+ [AC_LANG_SOURCE([[
#include <float.h>
#include <limits.h>
#include <math.h>
#endif
return 0;
-}], [gl_cv_func_isnanl_works=yes], [gl_cv_func_isnanl_works=no],
- [case "$host_cpu" in
- # Guess no on ia64, x86_64, i386.
- ia64 | x86_64 | i*86) gl_cv_func_isnanl_works="guessing no";;
- *)
- case "$host_os" in
- netbsd*) gl_cv_func_isnanl_works="guessing no";;
- *) gl_cv_func_isnanl_works="guessing yes";;
- esac
- ;;
- esac
- ])
+}]])],
+ [gl_cv_func_isnanl_works=yes],
+ [gl_cv_func_isnanl_works=no],
+ [case "$host_cpu" in
+ # Guess no on ia64, x86_64, i386.
+ ia64 | x86_64 | i*86) gl_cv_func_isnanl_works="guessing no";;
+ *)
+ case "$host_os" in
+ netbsd*) gl_cv_func_isnanl_works="guessing no";;
+ *) gl_cv_func_isnanl_works="guessing yes";;
+ esac
+ ;;
+ esac
+ ])
])
])
-# langinfo_h.m4 serial 6
+# langinfo_h.m4 serial 7
dnl Copyright (C) 2009-2010 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 Determine whether <langinfo.h> exists. It is missing on mingw and BeOS.
HAVE_LANGINFO_CODESET=0
+ HAVE_LANGINFO_T_FMT_AMPM=0
HAVE_LANGINFO_ERA=0
+ HAVE_LANGINFO_YESEXPR=0
AC_CHECK_HEADERS_ONCE([langinfo.h])
if test $ac_cv_header_langinfo_h = yes; then
HAVE_LANGINFO_H=1
dnl Determine what <langinfo.h> defines. CODESET and ERA etc. are missing
- dnl on OpenBSD 3.8.
+ dnl on OpenBSD 3.8. T_FMT_AMPM and YESEXPR, NOEXPR are missing on IRIX 5.3.
AC_CACHE_CHECK([whether langinfo.h defines CODESET],
[gl_cv_header_langinfo_codeset],
[AC_COMPILE_IFELSE(
if test $gl_cv_header_langinfo_codeset = yes; then
HAVE_LANGINFO_CODESET=1
fi
+ AC_CACHE_CHECK([whether langinfo.h defines T_FMT_AMPM],
+ [gl_cv_header_langinfo_t_fmt_ampm],
+ [AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM([[#include <langinfo.h>
+int a = T_FMT_AMPM;
+]])],
+ [gl_cv_header_langinfo_t_fmt_ampm=yes],
+ [gl_cv_header_langinfo_t_fmt_ampm=no])
+ ])
+ if test $gl_cv_header_langinfo_t_fmt_ampm = yes; then
+ HAVE_LANGINFO_T_FMT_AMPM=1
+ fi
AC_CACHE_CHECK([whether langinfo.h defines ERA],
[gl_cv_header_langinfo_era],
[AC_COMPILE_IFELSE(
if test $gl_cv_header_langinfo_era = yes; then
HAVE_LANGINFO_ERA=1
fi
+ AC_CACHE_CHECK([whether langinfo.h defines YESEXPR],
+ [gl_cv_header_langinfo_yesexpr],
+ [AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM([[#include <langinfo.h>
+int a = YESEXPR;
+]])],
+ [gl_cv_header_langinfo_yesexpr=yes],
+ [gl_cv_header_langinfo_yesexpr=no])
+ ])
+ if test $gl_cv_header_langinfo_yesexpr = yes; then
+ HAVE_LANGINFO_YESEXPR=1
+ fi
else
HAVE_LANGINFO_H=0
fi
AC_SUBST([HAVE_LANGINFO_H])
AC_SUBST([HAVE_LANGINFO_CODESET])
+ AC_SUBST([HAVE_LANGINFO_T_FMT_AMPM])
AC_SUBST([HAVE_LANGINFO_ERA])
+ AC_SUBST([HAVE_LANGINFO_YESEXPR])
dnl Check for declarations of anything we want to poison if the
dnl corresponding gnulib module is not in use.
-# lcmessage.m4 serial 6 (gettext-0.18)
+# lcmessage.m4 serial 7 (gettext-0.18.2)
dnl Copyright (C) 1995-2002, 2004-2005, 2008-2010 Free Software Foundation,
dnl Inc.
dnl This file is free software; the Free Software Foundation
AC_DEFUN([gt_LC_MESSAGES],
[
AC_CACHE_CHECK([for LC_MESSAGES], [gt_cv_val_LC_MESSAGES],
- [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
- [gt_cv_val_LC_MESSAGES=yes], [gt_cv_val_LC_MESSAGES=no])])
+ [AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[#include <locale.h>]],
+ [[return LC_MESSAGES]])],
+ [gt_cv_val_LC_MESSAGES=yes],
+ [gt_cv_val_LC_MESSAGES=no])])
if test $gt_cv_val_LC_MESSAGES = yes; then
AC_DEFINE([HAVE_LC_MESSAGES], [1],
[Define if your <locale.h> file defines LC_MESSAGES.])
-# ldexpl.m4 serial 7
+# ldexpl.m4 serial 8
dnl Copyright (C) 2007-2010 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
[
save_LIBS="$LIBS"
LIBS="$LIBS -lm"
- AC_TRY_LINK([#include <math.h>
- long double x;],
- [return ldexpl (x, -1) > 0;],
+ AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[#include <math.h>
+ long double x;]],
+ [[return ldexpl (x, -1) > 0;]])],
[gl_cv_func_ldexpl_in_libm=yes],
[gl_cv_func_ldexpl_in_libm=no])
LIBS="$save_LIBS"
AC_CACHE_CHECK([whether ldexpl() can be used without linking with libm],
[gl_cv_func_ldexpl_no_libm],
[
- AC_TRY_LINK([#include <math.h>
- long double x;],
- [return ldexpl (x, -1) > 0;],
+ AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[#include <math.h>
+ long double x;]],
+ [[return ldexpl (x, -1) > 0;]])],
[gl_cv_func_ldexpl_no_libm=yes],
[gl_cv_func_ldexpl_no_libm=no])
])
AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
AC_CACHE_CHECK([whether ldexpl works], [gl_cv_func_ldexpl_works],
[
- AC_TRY_RUN([
+ AC_RUN_IFELSE(
+ [AC_LANG_SOURCE([[
#include <math.h>
extern long double ldexpl (long double, int);
int main()
volatile long double x2 = 1.73205L;
volatile long double y2 = ldexpl (x2, 0);
return (y1 != 0.5L) || (y2 != x2);
-}], [gl_cv_func_ldexpl_works=yes], [gl_cv_func_ldexpl_works=no],
- [
+}]])],
+ [gl_cv_func_ldexpl_works=yes],
+ [gl_cv_func_ldexpl_works=no],
+ [
changequote(,)dnl
- case "$host_os" in
- aix | aix[3-6]*) gl_cv_func_ldexpl_works="guessing no";;
- *) gl_cv_func_ldexpl_works="guessing yes";;
- esac
+ case "$host_os" in
+ aix | aix[3-6]*) gl_cv_func_ldexpl_works="guessing no";;
+ *) gl_cv_func_ldexpl_works="guessing yes";;
+ esac
changequote([,])dnl
- ])
+ ])
])
])
-# lib-ld.m4 serial 4 (gettext-0.18)
+# lib-ld.m4 serial 5 (gettext-0.18.2)
dnl Copyright (C) 1996-2003, 2009-2010 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
# Prepare PATH_SEPARATOR.
# The user is always right.
if test "${PATH_SEPARATOR+set}" != set; then
- echo "#! /bin/sh" >conf$$.sh
- echo "exit 0" >>conf$$.sh
- chmod +x conf$$.sh
- if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
- PATH_SEPARATOR=';'
- else
- PATH_SEPARATOR=:
- fi
- rm -f conf$$.sh
+ # Determine PATH_SEPARATOR by trying to find /bin/sh in a PATH which
+ # contains only /bin. Note that ksh looks also at the FPATH variable,
+ # so we have to set that as well for the test.
+ PATH_SEPARATOR=:
+ (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \
+ && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \
+ || PATH_SEPARATOR=';'
+ }
fi
ac_prog=ld
if test "$GCC" = yes; then
-# lib-link.m4 serial 24 (gettext-0.18.2)
+# lib-link.m4 serial 25 (gettext-0.18.2)
dnl Copyright (C) 2001-2010 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
*" -l"*) LIBS="$LIBS $LIB[]NAME" ;;
*) LIBS="$LIB[]NAME $LIBS" ;;
esac
- AC_TRY_LINK([$3], [$4],
+ AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM([[$3]], [[$4]])],
[ac_cv_lib[]Name=yes],
[ac_cv_lib[]Name='m4_if([$5], [], [no], [[$5]])'])
LIBS="$ac_save_LIBS"
-# libunistring.m4 serial 9
+# libunistring.m4 serial 11
dnl Copyright (C) 2009-2010 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
m4_version_prereq([2.64],
[[AC_DEFUN_ONCE(
[$1], [$2])]],
- [[AC_DEFUN(
- [$1], [$2])]]))
+ [m4_ifdef([gl_00GNULIB],
+ [[AC_DEFUN_ONCE(
+ [$1], [$2])]],
+ [[AC_DEFUN(
+ [$1], [$2])]])]))
gl_libunistring_AC_DEFUN([gl_LIBUNISTRING],
[
AC_BEFORE([$0], [gl_LIBUNISTRING_MODULE])
dnl Use other tests to distinguish them.
if test $gl_libunistring_hexversion = 9; then
dnl Version 0.9.2 introduced the header <unistring/cdefs.h>.
- AC_TRY_COMPILE([#include <unistring/cdefs.h>], ,
+ AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM([[#include <unistring/cdefs.h>]], [[]])],
[gl_cv_libunistring_version092=true],
- [gl_cv_libunistring_version092=false]);
+ [gl_cv_libunistring_version092=false])
if $gl_cv_libunistring_version092; then
dnl Version 0.9.3 changed a comment in <unistr.h>.
gl_ABSOLUTE_HEADER_ONE([unistr.h])
fi
else
dnl Version 0.9.1 introduced the type casing_suffix_context_t.
- AC_TRY_COMPILE([#include <unicase.h>
- casing_suffix_context_t ct;], ,
+ AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[#include <unicase.h>
+ casing_suffix_context_t ct;]],
+ [[]])],
[gl_cv_libunistring_version091=true],
[gl_cv_libunistring_version091=false])
if $gl_cv_libunistring_version091; then
-# locale-fr.m4 serial 11
+# locale-fr.m4 serial 12
dnl Copyright (C) 2003, 2005-2010 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
is empty, and the behaviour of Tcl 8.4 in this locale is not useful.
On OpenBSD 4.0, when an unsupported locale is specified, setlocale()
succeeds but then nl_langinfo(CODESET) is "646". In this situation,
- some unit tests fail. */
+ some unit tests fail.
+ On MirBSD 10, when an unsupported locale is specified, setlocale()
+ succeeds but then nl_langinfo(CODESET) is "UTF-8". */
#if HAVE_LANGINFO_CODESET
{
const char *cs = nl_langinfo (CODESET);
- if (cs[0] == '\0' || strcmp (cs, "ASCII") == 0 || strcmp (cs, "646") == 0)
+ if (cs[0] == '\0' || strcmp (cs, "ASCII") == 0 || strcmp (cs, "646") == 0
+ || strcmp (cs, "UTF-8") == 0)
return 1;
}
#endif
-# locale-ja.m4 serial 7
+# locale-ja.m4 serial 8
dnl Copyright (C) 2003, 2005-2010 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
is empty, and the behaviour of Tcl 8.4 in this locale is not useful.
On OpenBSD 4.0, when an unsupported locale is specified, setlocale()
succeeds but then nl_langinfo(CODESET) is "646". In this situation,
- some unit tests fail. */
+ some unit tests fail.
+ On MirBSD 10, when an unsupported locale is specified, setlocale()
+ succeeds but then nl_langinfo(CODESET) is "UTF-8". */
#if HAVE_LANGINFO_CODESET
{
const char *cs = nl_langinfo (CODESET);
- if (cs[0] == '\0' || strcmp (cs, "ASCII") == 0 || strcmp (cs, "646") == 0)
+ if (cs[0] == '\0' || strcmp (cs, "ASCII") == 0 || strcmp (cs, "646") == 0
+ || strcmp (cs, "UTF-8") == 0)
return 1;
}
#endif
if (MB_CUR_MAX == 1)
return 1;
/* Check whether in a month name, no byte in the range 0x80..0x9F occurs.
- This excludes the UTF-8 encoding. */
+ This excludes the UTF-8 encoding (except on MirBSD). */
t.tm_year = 1975 - 1900; t.tm_mon = 2 - 1; t.tm_mday = 4;
if (strftime (buf, sizeof (buf), "%B", &t) < 2) return 1;
for (p = buf; *p != '\0'; p++)
-# locale-zh.m4 serial 6
+# locale-zh.m4 serial 7
dnl Copyright (C) 2003, 2005-2010 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
is empty, and the behaviour of Tcl 8.4 in this locale is not useful.
On OpenBSD 4.0, when an unsupported locale is specified, setlocale()
succeeds but then nl_langinfo(CODESET) is "646". In this situation,
- some unit tests fail. */
+ some unit tests fail.
+ On MirBSD 10, when an unsupported locale is specified, setlocale()
+ succeeds but then nl_langinfo(CODESET) is "UTF-8". */
#if HAVE_LANGINFO_CODESET
{
const char *cs = nl_langinfo (CODESET);
- if (cs[0] == '\0' || strcmp (cs, "ASCII") == 0 || strcmp (cs, "646") == 0)
+ if (cs[0] == '\0' || strcmp (cs, "ASCII") == 0 || strcmp (cs, "646") == 0
+ || strcmp (cs, "UTF-8") == 0)
return 1;
}
#endif
if (strchr (getenv ("LC_ALL"), '.') == NULL) return 1;
#endif
/* Check whether in a month name, no byte in the range 0x80..0x9F occurs.
- This excludes the UTF-8 encoding. */
+ This excludes the UTF-8 encoding (except on MirBSD). */
t.tm_year = 1975 - 1900; t.tm_mon = 2 - 1; t.tm_mday = 4;
if (strftime (buf, sizeof (buf), "%B", &t) < 2) return 1;
for (p = buf; *p != '\0'; p++)
-# locale_h.m4 serial 10
+# locale_h.m4 serial 11
dnl Copyright (C) 2007, 2009-2010 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
AC_CACHE_CHECK([whether locale.h conforms to POSIX:2001],
[gl_cv_header_locale_h_posix2001],
- [AC_TRY_COMPILE([#include <locale.h>
-int x = LC_MESSAGES;], [],
+ [AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[#include <locale.h>
+ int x = LC_MESSAGES;]],
+ [[]])],
[gl_cv_header_locale_h_posix2001=yes],
[gl_cv_header_locale_h_posix2001=no])])
dnl itself, we assume that <xlocale.h> will do so.
AC_CACHE_CHECK([whether locale.h defines locale_t],
[gl_cv_header_locale_has_locale_t],
- [AC_TRY_COMPILE([#include <locale.h>
-locale_t x;], [],
+ [AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[#include <locale.h>
+ locale_t x;]],
+ [[]])],
[gl_cv_header_locale_has_locale_t=yes],
[gl_cv_header_locale_has_locale_t=no])
])
-# lock.m4 serial 10 (gettext-0.18)
+# lock.m4 serial 11 (gettext-0.18.2)
dnl Copyright (C) 2005-2010 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
[],
[#include <pthread.h>])
# glibc defines PTHREAD_MUTEX_RECURSIVE as enum, not as a macro.
- AC_TRY_COMPILE([#include <pthread.h>],
- [#if __FreeBSD__ == 4
+ AC_COMPILE_IFELSE([
+ AC_LANG_PROGRAM(
+ [[#include <pthread.h>]],
+ [[
+#if __FreeBSD__ == 4
error "No, in FreeBSD 4.0 recursive mutexes actually don't work."
#else
int x = (int)PTHREAD_MUTEX_RECURSIVE;
return !x;
-#endif],
+#endif
+ ]])],
[AC_DEFINE([HAVE_PTHREAD_MUTEX_RECURSIVE], [1],
[Define if the <pthread.h> defines PTHREAD_MUTEX_RECURSIVE.])])
fi
-# logb.m4 serial 1
+# logb.m4 serial 2
dnl Copyright (C) 2010 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
fi
dnl Test whether logb() can be used without libm.
LOGB_LIBM=?
- AC_TRY_LINK([
- #ifndef __NO_MATH_INLINES
- # define __NO_MATH_INLINES 1 /* for glibc */
- #endif
- #include <math.h>
- extern double logb (double x);
- double x;],
- [x = logb(x);],
+ AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[#ifndef __NO_MATH_INLINES
+ # define __NO_MATH_INLINES 1 /* for glibc */
+ #endif
+ #include <math.h>
+ extern double logb (double x);
+ double x;]],
+ [[x = logb(x);]])],
[LOGB_LIBM=])
if test "$LOGB_LIBM" = "?"; then
save_LIBS="$LIBS"
LIBS="$LIBS -lm"
- AC_TRY_LINK([
- #ifndef __NO_MATH_INLINES
- # define __NO_MATH_INLINES 1 /* for glibc */
- #endif
- #include <math.h>
- extern double logb (double x);
- double x;],
- [x = logb(x);],
+ AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[#ifndef __NO_MATH_INLINES
+ # define __NO_MATH_INLINES 1 /* for glibc */
+ #endif
+ #include <math.h>
+ extern double logb (double x);
+ double x;]],
+ [[x = logb(x);]])],
[LOGB_LIBM="-lm"])
LIBS="$save_LIBS"
fi
-# logl.m4 serial 2
+# logl.m4 serial 3
dnl Copyright (C) 2010 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
AC_CACHE_CHECK([whether logl() can be used without linking with libm],
[gl_cv_func_logl_no_libm],
[
- AC_TRY_LINK([#ifndef __NO_MATH_INLINES
- # define __NO_MATH_INLINES 1 /* for glibc */
- #endif
- #include <math.h>
- long double x;],
- [return logl (x) > 1;],
+ AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[#ifndef __NO_MATH_INLINES
+ # define __NO_MATH_INLINES 1 /* for glibc */
+ #endif
+ #include <math.h>
+ long double x;]],
+ [[return logl (x) > 1;]])],
[gl_cv_func_logl_no_libm=yes],
[gl_cv_func_logl_no_libm=no])
])
[
save_LIBS="$LIBS"
LIBS="$LIBS -lm"
- AC_TRY_LINK([#ifndef __NO_MATH_INLINES
- # define __NO_MATH_INLINES 1 /* for glibc */
- #endif
- #include <math.h>
- long double x;],
- [return logl (x) > 1;],
+ AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[#ifndef __NO_MATH_INLINES
+ # define __NO_MATH_INLINES 1 /* for glibc */
+ #endif
+ #include <math.h>
+ long double x;]],
+ [[return logl (x) > 1;]])],
[gl_cv_func_logl_in_libm=yes],
[gl_cv_func_logl_in_libm=no])
LIBS="$save_LIBS"
-# serial 20
+# serial 21
# Copyright (C) 1997-2001, 2003-2010 Free Software Foundation, Inc.
#
HAVE_LSTAT=0
fi
])
+
+# Redefine AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK, because it is no longer
+# maintained in Autoconf.
+AC_DEFUN([AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK],
+[
+ AC_CACHE_CHECK([whether lstat correctly handles trailing slash],
+ [ac_cv_func_lstat_dereferences_slashed_symlink],
+ [rm -f conftest.sym conftest.file
+ echo >conftest.file
+ if test "$as_ln_s" = "ln -s" && ln -s conftest.file conftest.sym; then
+ AC_RUN_IFELSE(
+ [AC_LANG_PROGRAM(
+ [AC_INCLUDES_DEFAULT],
+ [[struct stat sbuf;
+ /* Linux will dereference the symlink and fail, as required by
+ POSIX. That is better in the sense that it means we will not
+ have to compile and use the lstat wrapper. */
+ return lstat ("conftest.sym/", &sbuf) == 0;
+ ]])],
+ [ac_cv_func_lstat_dereferences_slashed_symlink=yes],
+ [ac_cv_func_lstat_dereferences_slashed_symlink=no],
+ [# When cross-compiling, be pessimistic so we will end up using the
+ # replacement version of lstat that checks for trailing slashes and
+ # calls lstat a second time when necessary.
+ ac_cv_func_lstat_dereferences_slashed_symlink=no
+ ])
+ else
+ # If the 'ln -s' command failed, then we probably don't even
+ # have an lstat function.
+ ac_cv_func_lstat_dereferences_slashed_symlink=no
+ fi
+ rm -f conftest.sym conftest.file
+ ])
+ test $ac_cv_func_lstat_dereferences_slashed_symlink = yes &&
+ AC_DEFINE_UNQUOTED([LSTAT_FOLLOWS_SLASHED_SYMLINK], [1],
+ [Define to 1 if `lstat' dereferences a symlink specified
+ with a trailing slash.])
+ if test "x$ac_cv_func_lstat_dereferences_slashed_symlink" = xno; then
+ AC_LIBOBJ([lstat])
+ fi
+])
-# malloc.m4 serial 10
+# malloc.m4 serial 12
dnl Copyright (C) 2007, 2009, 2010 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
dnl _AC_FUNC_MALLOC_IF is defined in Autoconf.
_AC_FUNC_MALLOC_IF(
- [AC_DEFINE([HAVE_MALLOC], [1],
+ [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], [0])
+ [AC_DEFINE([HAVE_MALLOC_GNU], [0])
gl_REPLACE_MALLOC
])
])
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_TRY_COMPILE([],
- [#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
- choke me
- #endif
- ], [gl_cv_func_malloc_posix=yes], [gl_cv_func_malloc_posix=no])
+ 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])
])
])
esac
changequote([,])dnl
if test $LOCALE_JA != none; then
- AC_TRY_RUN([
+ AC_RUN_IFELSE(
+ [AC_LANG_SOURCE([[
#include <locale.h>
#include <string.h>
#include <wchar.h>
return 1;
}
return 0;
-}],
+}]])],
[gl_cv_func_mbrlen_incomplete_state=yes],
[gl_cv_func_mbrlen_incomplete_state=no],
[])
esac
changequote([,])dnl
if test $LOCALE_FR_UTF8 != none || test $LOCALE_JA != none; then
- AC_TRY_RUN([
+ AC_RUN_IFELSE(
+ [AC_LANG_SOURCE([[
#include <locale.h>
#include <string.h>
#include <wchar.h>
}
}
return 0;
-}],
+}]])],
[gl_cv_func_mbrlen_retval=yes],
[gl_cv_func_mbrlen_retval=no],
[])
esac
changequote([,])dnl
if test $LOCALE_ZH_CN != none; then
- AC_TRY_RUN([
+ AC_RUN_IFELSE(
+ [AC_LANG_SOURCE([[
#include <locale.h>
#include <string.h>
#include <wchar.h>
return 1;
}
return 0;
-}],
+}]])],
[gl_cv_func_mbrlen_nul_retval=yes],
[gl_cv_func_mbrlen_nul_retval=no],
[])
esac
changequote([,])dnl
if test $LOCALE_JA != none; then
- AC_TRY_RUN([
+ AC_RUN_IFELSE(
+ [AC_LANG_SOURCE([[
#include <locale.h>
#include <string.h>
#include <wchar.h>
return 1;
}
return 0;
-}],
+}]])],
[gl_cv_func_mbrtowc_incomplete_state=yes],
[gl_cv_func_mbrtowc_incomplete_state=no],
[:])
esac
changequote([,])dnl
if test $LOCALE_ZH_CN != none; then
- AC_TRY_RUN([
+ AC_RUN_IFELSE(
+ [AC_LANG_SOURCE([[
#include <locale.h>
#include <stdlib.h>
#include <string.h>
return 1;
}
return 0;
-}],
+}]])],
[gl_cv_func_mbrtowc_sanitycheck=yes],
[gl_cv_func_mbrtowc_sanitycheck=no],
[:])
esac
changequote([,])dnl
if test $LOCALE_FR_UTF8 != none; then
- AC_TRY_RUN([
+ AC_RUN_IFELSE(
+ [AC_LANG_SOURCE([[
#include <locale.h>
#include <string.h>
#include <wchar.h>
return 1;
}
return 0;
-}], [gl_cv_func_mbrtowc_null_arg=yes], [gl_cv_func_mbrtowc_null_arg=no], [:])
+}]])],
+ [gl_cv_func_mbrtowc_null_arg=yes],
+ [gl_cv_func_mbrtowc_null_arg=no],
+ [:])
fi
])
])
esac
changequote([,])dnl
if test $LOCALE_FR_UTF8 != none || test $LOCALE_JA != none; then
- AC_TRY_RUN([
+ AC_RUN_IFELSE(
+ [AC_LANG_SOURCE([[
#include <locale.h>
#include <string.h>
#include <wchar.h>
}
}
return 0;
-}],
+}]])],
[gl_cv_func_mbrtowc_retval=yes],
[gl_cv_func_mbrtowc_retval=no],
[:])
esac
changequote([,])dnl
if test $LOCALE_ZH_CN != none; then
- AC_TRY_RUN([
+ AC_RUN_IFELSE(
+ [AC_LANG_SOURCE([[
#include <locale.h>
#include <string.h>
#include <wchar.h>
return 1;
}
return 0;
-}],
+}]])],
[gl_cv_func_mbrtowc_nul_retval=yes],
[gl_cv_func_mbrtowc_nul_retval=no],
[:])
-# mbsrtowcs.m4 serial 6
+# mbsrtowcs.m4 serial 7
dnl Copyright (C) 2008-2010 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
esac
changequote([,])dnl
if test $LOCALE_FR_UTF8 != none || test $LOCALE_JA != none || test $LOCALE_ZH_CN != none; then
- AC_TRY_RUN([
+ AC_RUN_IFELSE(
+ [AC_LANG_SOURCE([[
#include <locale.h>
#include <string.h>
#include <wchar.h>
}
}
return 0;
-}],
+}]])],
[gl_cv_func_mbsrtowcs_works=yes],
[gl_cv_func_mbsrtowcs_works=no],
[:])
-# mbswidth.m4 serial 17
+# mbswidth.m4 serial 18
dnl Copyright (C) 2000-2002, 2004, 2006-2010 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 UnixWare 7.1.1 <wchar.h> has a declaration of a function mbswidth()
dnl that clashes with ours.
AC_CACHE_CHECK([whether mbswidth is declared in <wchar.h>],
- ac_cv_have_decl_mbswidth,
- [AC_TRY_COMPILE([
+ [ac_cv_have_decl_mbswidth],
+ [AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[
/* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before
<wchar.h>.
BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be included
#include <stdio.h>
#include <time.h>
#include <wchar.h>
-], [
+ ]],
+ [[
char *p = (char *) mbswidth;
return !p;
-], ac_cv_have_decl_mbswidth=yes, ac_cv_have_decl_mbswidth=no)])
+ ]])],
+ [ac_cv_have_decl_mbswidth=yes],
+ [ac_cv_have_decl_mbswidth=no])])
if test $ac_cv_have_decl_mbswidth = yes; then
ac_val=1
else
-# memchr.m4 serial 8
+# memchr.m4 serial 9
dnl Copyright (C) 2002-2004, 2009-2010 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
strcpy (fence - 9, "12345678");
if (memchr (fence - 9, 0, 79) != fence - 1)
return 2;
+ if (memchr (fence - 1, 0, 3) != fence - 1)
+ return 3;
}
return 0;
]])], [gl_cv_func_memchr_works=yes], [gl_cv_func_memchr_works=no],
-# memcmp.m4 serial 14
+# memcmp.m4 serial 15
dnl Copyright (C) 2002-2004, 2007-2010 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
fi
])
+# Redefine AC_FUNC_MEMCMP, because it is no longer maintained in Autoconf.
+AC_DEFUN([AC_FUNC_MEMCMP],
+[
+ AC_CACHE_CHECK([for working memcmp], [ac_cv_func_memcmp_working],
+ [AC_RUN_IFELSE(
+ [AC_LANG_PROGRAM(
+ [AC_INCLUDES_DEFAULT],
+ [[/* Some versions of memcmp are not 8-bit clean. */
+ char c0 = '\100', c1 = '\200', c2 = '\201';
+ if (memcmp(&c0, &c2, 1) >= 0 || memcmp(&c1, &c2, 1) >= 0)
+ return 1;
+ /* The Next x86 OpenStep bug shows up only when comparing 16 bytes
+ or more and with at least one buffer not starting on a 4-byte
+ boundary. William Lewis provided this test program. */
+ {
+ char foo[21];
+ char bar[21];
+ int i;
+ for (i = 0; i < 4; i++)
+ {
+ char *a = foo + i;
+ char *b = bar + i;
+ strcpy (a, "--------01111111");
+ strcpy (b, "--------10000000");
+ if (memcmp (a, b, 16) >= 0)
+ return 1;
+ }
+ return 0;
+ }
+ ]])],
+ [ac_cv_func_memcmp_working=yes],
+ [ac_cv_func_memcmp_working=no],
+ [ac_cv_func_memcmp_working=no])])
+ test $ac_cv_func_memcmp_working = no &&
+ AC_LIBOBJ([memcmp])
+])
+
# Prerequisites of lib/memcmp.c.
AC_DEFUN([gl_PREREQ_MEMCMP], [:])
-# memmem.m4 serial 14
+# memmem.m4 serial 17
dnl Copyright (C) 2002, 2003, 2004, 2007, 2008, 2009, 2010 Free Software
dnl Foundation, Inc.
dnl This file is free software; the Free Software Foundation
AC_CHECK_DECLS_ONCE([memmem])
if test $ac_cv_have_decl_memmem = no; then
HAVE_DECL_MEMMEM=0
+ else
+ dnl Detect http://sourceware.org/bugzilla/show_bug.cgi?id=12092.
+ AC_CACHE_CHECK([whether memmem works],
+ [gl_cv_func_memmem_works_always],
+ [AC_RUN_IFELSE([AC_LANG_PROGRAM([[
+#include <string.h> /* for memmem */
+#define P "_EF_BF_BD"
+#define HAYSTACK "F_BD_CE_BD" P P P P "_C3_88_20" P P P "_C3_A7_20" P
+#define NEEDLE P P P P P
+]], [[return !!memmem (HAYSTACK, strlen (HAYSTACK), NEEDLE, strlen (NEEDLE));
+ ]])],
+ [gl_cv_func_memmem_works_always=yes],
+ [gl_cv_func_memmem_works_always=no],
+ [dnl glibc 2.12 and cygwin 1.7.7 have a known bug. Assume that it
+ dnl works on all other platforms, even if it is not linear.
+ AC_EGREP_CPP([Lucky user],
+ [
+#ifdef __GNU_LIBRARY__
+ #include <features.h>
+ #if (__GLIBC__ == 2 && __GLIBC_MINOR__ > 12) || (__GLIBC__ > 2)
+ Lucky user
+ #endif
+#elif defined __CYGWIN__
+ #include <cygwin/version.h>
+ #if CYGWIN_VERSION_DLL_COMBINED > CYGWIN_VERSION_DLL_MAKE_COMBINED (1007, 7)
+ Lucky user
+ #endif
+#else
+ Lucky user
+#endif
+ ],
+ [gl_cv_func_memmem_works_always=yes],
+ [gl_cv_func_memmem_works_always="guessing no"])
+ ])
+ ])
+ if test "$gl_cv_func_memmem_works_always" != yes; then
+ REPLACE_MEMMEM=1
+ AC_LIBOBJ([memmem])
+ fi
fi
gl_PREREQ_MEMMEM
]) # gl_FUNC_MEMMEM_SIMPLE
AC_DEFUN([gl_FUNC_MEMMEM],
[
AC_REQUIRE([gl_FUNC_MEMMEM_SIMPLE])
- if test $ac_cv_have_decl_memmem = yes; then
+ if test $HAVE_MEMMEM = 1 && test $REPLACE_MEMMEM = 0; then
AC_CACHE_CHECK([whether memmem works in linear time],
- [gl_cv_func_memmem_works],
+ [gl_cv_func_memmem_works_fast],
[AC_RUN_IFELSE([AC_LANG_PROGRAM([[
#include <signal.h> /* for signal */
#include <string.h> /* for memmem */
#include <stdlib.h> /* for malloc */
#include <unistd.h> /* for alarm */
+static void quit (int sig) { exit (sig + 128); }
]], [[size_t m = 1000000;
char *haystack = (char *) malloc (2 * m + 1);
char *needle = (char *) malloc (m + 1);
void *result = 0;
/* Failure to compile this test due to missing alarm is okay,
since all such platforms (mingw) also lack memmem. */
- signal (SIGALRM, SIG_DFL);
+ signal (SIGALRM, quit);
alarm (5);
/* Check for quadratic performance. */
if (haystack && needle)
}
/* Check for empty needle behavior. */
return !result || !memmem ("a", 1, 0, 0);]])],
- [gl_cv_func_memmem_works=yes], [gl_cv_func_memmem_works=no],
- [dnl Only glibc >= 2.9 and cygwin >= 1.7.0 are known to have a
- dnl memmem that works in linear time.
+ [gl_cv_func_memmem_works_fast=yes], [gl_cv_func_memmem_works_fast=no],
+ [dnl Only glibc > 2.12 and cygwin > 1.7.7 are known to have a
+ dnl bug-free memmem that works in linear time.
AC_EGREP_CPP([Lucky user],
[
#include <features.h>
#ifdef __GNU_LIBRARY__
- #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 9) || (__GLIBC__ > 2)
+ #if (__GLIBC__ == 2 && __GLIBC_MINOR__ > 12) || (__GLIBC__ > 2)
Lucky user
#endif
#endif
#ifdef __CYGWIN__
#include <cygwin/version.h>
- #if CYGWIN_VERSION_DLL_MAJOR >= 1007
+ #if CYGWIN_VERSION_DLL_COMBINED > CYGWIN_VERSION_DLL_MAKE_COMBINED (1007, 7)
Lucky user
#endif
#endif
],
- [gl_cv_func_memmem_works=yes],
- [gl_cv_func_memmem_works="guessing no"])
+ [gl_cv_func_memmem_works_fast=yes],
+ [gl_cv_func_memmem_works_fast="guessing no"])
])
])
- if test "$gl_cv_func_memmem_works" != yes; then
+ if test "$gl_cv_func_memmem_works_fast" != yes; then
REPLACE_MEMMEM=1
AC_LIBOBJ([memmem])
fi
-# minmax.m4 serial 3
-dnl Copyright (C) 2005, 2009, 2010 Free Software Foundation, Inc.
+# minmax.m4 serial 4
+dnl Copyright (C) 2005, 2009-2010 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_PREREQ([2.52])
+AC_PREREQ([2.53])
AC_DEFUN([gl_MINMAX],
[
m4_pushdef([HEADER], AS_TR_CPP([$1]))
AC_CACHE_CHECK([whether <$1> defines MIN and MAX],
[gl_cv_minmax_in_]header,
- [AC_TRY_COMPILE([#include <$1>
-int x = MIN (42, 17);], [],
+ [AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[#include <$1>
+ int x = MIN (42, 17);]],
+ [[]])],
[gl_cv_minmax_in_]header[=yes],
[gl_cv_minmax_in_]header[=no])])
if test $gl_cv_minmax_in_[]header = yes; then
-# serial 15
+# serial 16
dnl Copyright (C) 2002-2003, 2005-2007, 2009-2010 Free Software Foundation,
dnl Inc.
dnl This file is free software; the Free Software Foundation
dnl From Jim Meyering.
-# Redefine AC_FUNC_MKTIME, to fix a bug in Autoconf 2.61a and earlier.
-# This redefinition can be removed once a new version of Autoconf is assumed.
-# The redefinition is taken from
-# <http://cvs.sv.gnu.org/viewcvs/*checkout*/autoconf/autoconf/lib/autoconf/functions.m4?rev=1.119>.
+# Redefine AC_FUNC_MKTIME, because it is no longer maintained in Autoconf.
# AC_FUNC_MKTIME
# --------------
AC_DEFUN([AC_FUNC_MKTIME],
touch conftest.tmp
ln -s conftest.tmp conftest.lnk
fi
- AC_TRY_RUN([
+ AC_RUN_IFELSE(
+ [AC_LANG_SOURCE([[
#include <fcntl.h>
#if HAVE_UNISTD_H
# include <unistd.h>
if (open ("conftest.lnk/", O_RDONLY) != -1) return 2;
#endif
return open ("conftest.sl/", O_CREAT, 0600) >= 0;
-}], [gl_cv_func_open_slash=yes], [gl_cv_func_open_slash=no],
+}]])],
+ [gl_cv_func_open_slash=yes],
+ [gl_cv_func_open_slash=no],
[
changequote(,)dnl
case "$host_os" in
--- /dev/null
+# parse-datetime.m4 serial 18
+dnl Copyright (C) 2002-2006, 2008-2010 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+dnl Define HAVE_COMPOUND_LITERALS if the C compiler supports compound literals
+dnl as in ISO C99.
+dnl Note that compound literals such as (struct s) { 3, 4 } can be used for
+dnl initialization of stack-allocated variables, but are not constant
+dnl expressions and therefore cannot be used as initializer for global or
+dnl static variables (even though gcc supports this in pre-C99 mode).
+AC_DEFUN([gl_C_COMPOUND_LITERALS],
+[
+ AC_CACHE_CHECK([for compound literals], [gl_cv_compound_literals],
+ [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[struct s { int i, j; };]],
+ [[struct s t = (struct s) { 3, 4 };
+ if (t.i != 0) return 0;]])],
+ gl_cv_compound_literals=yes,
+ gl_cv_compound_literals=no)])
+ if test $gl_cv_compound_literals = yes; then
+ AC_DEFINE([HAVE_COMPOUND_LITERALS], [1],
+ [Define if you have compound literals.])
+ fi
+])
+
+AC_DEFUN([gl_PARSE_DATETIME],
+[
+ dnl Prerequisites of lib/parse-datetime.h.
+ AC_REQUIRE([AM_STDBOOL_H])
+ AC_REQUIRE([gl_TIMESPEC])
+
+ dnl Prerequisites of lib/parse-datetime.y.
+ AC_REQUIRE([gl_BISON])
+ AC_REQUIRE([gl_C_COMPOUND_LITERALS])
+ AC_STRUCT_TIMEZONE
+ AC_REQUIRE([gl_CLOCK_TIME])
+ AC_REQUIRE([gl_TM_GMTOFF])
+ AC_COMPILE_IFELSE(
+ [AC_LANG_SOURCE([[
+#include <time.h> /* for time_t */
+#include <limits.h> /* for CHAR_BIT, LONG_MIN, LONG_MAX */
+#define TYPE_MINIMUM(t) \
+ ((t) ((t) 0 < (t) -1 ? (t) 0 : ~ (t) 0 << (sizeof (t) * CHAR_BIT - 1)))
+#define TYPE_MAXIMUM(t) \
+ ((t) ((t) 0 < (t) -1 ? (t) -1 : ~ (~ (t) 0 << (sizeof (t) * CHAR_BIT - 1))))
+typedef int verify_min[2 * (LONG_MIN <= TYPE_MINIMUM (time_t)) - 1];
+typedef int verify_max[2 * (TYPE_MAXIMUM (time_t) <= LONG_MAX) - 1];
+ ]])],
+ [AC_DEFINE([TIME_T_FITS_IN_LONG_INT], [1],
+ [Define to 1 if all 'time_t' values fit in a 'long int'.])
+ ])
+])
-# poll.m4 serial 9
+# poll.m4 serial 11
dnl Copyright (c) 2003, 2005, 2006, 2007, 2009, 2010 Free Software Foundation,
dnl Inc.
dnl This file is free software; the Free Software Foundation
AC_DEFUN([gl_FUNC_POLL],
[
- AC_CHECK_HEADERS([poll.h])
+ AC_REQUIRE([gl_POLL_H])
if test "$ac_cv_header_poll_h" = no; then
+ ac_cv_func_poll=no
gl_cv_func_poll=no
else
AC_CHECK_FUNC([poll],
#endif
], [gl_cv_func_poll=no], [gl_cv_func_poll=yes])])])
fi
- if test $gl_cv_func_poll = yes; then
- AC_DEFINE([HAVE_POLL], [1],
- [Define to 1 if you have the 'poll' function and it works.])
- POLL_H=
- else
+ if test $gl_cv_func_poll != yes; then
+ AC_CHECK_FUNC([poll], [ac_cv_func_poll=yes], [ac_cv_func_poll=no])
+ if test $ac_cv_func_poll = no; then
+ HAVE_POLL=0
+ else
+ REPLACE_POLL=1
+ fi
+ fi
+ if test $HAVE_POLL = 0 || test $REPLACE_POLL = 1; then
+ gl_REPLACE_POLL_H
AC_LIBOBJ([poll])
- AC_DEFINE([poll], [rpl_poll],
- [Define to poll if the replacement function should be used.])
gl_PREREQ_POLL
- POLL_H=poll.h
+ else
+ AC_DEFINE([HAVE_POLL], [1],
+ [Define to 1 if you have the 'poll' function and it works.])
fi
- AC_SUBST([POLL_H])
])
# Prerequisites of lib/poll.c.
--- /dev/null
+# poll_h.m4 serial 1
+dnl Copyright (C) 2010 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+dnl Written by Bruno Haible.
+
+AC_DEFUN([gl_POLL_H],
+[
+ dnl Use AC_REQUIRE here, so that the default behavior below is expanded
+ dnl once only, before all statements that occur in other macros.
+ AC_REQUIRE([gl_POLL_H_DEFAULTS])
+
+ AC_CHECK_HEADERS_ONCE([poll.h])
+ if test $ac_cv_header_poll_h = yes; then
+ HAVE_POLL_H=1
+ else
+ HAVE_POLL_H=0
+ gl_REPLACE_POLL_H
+ fi
+ AC_SUBST([HAVE_POLL_H])
+
+ dnl <poll.h> is always overridden, because of GNULIB_POSIXCHECK.
+ gl_CHECK_NEXT_HEADERS([poll.h])
+
+ dnl Check for declarations of anything we want to poison if the
+ dnl corresponding gnulib module is not in use.
+ gl_WARN_ON_USE_PREPARE([[#include <poll.h>]],
+ [poll])
+])
+
+dnl Unconditionally enables the replacement of <poll.h>.
+AC_DEFUN([gl_REPLACE_POLL_H],
+[
+ dnl This is a no-op, because <poll.h> is always overridden.
+ :
+])
+
+AC_DEFUN([gl_POLL_MODULE_INDICATOR],
+[
+ dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
+ AC_REQUIRE([gl_POLL_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_POLL_H_DEFAULTS],
+[
+ GNULIB_POLL=0; AC_SUBST([GNULIB_POLL])
+ dnl Assume proper GNU behavior unless another module says otherwise.
+ HAVE_POLL=1; AC_SUBST([HAVE_POLL])
+ REPLACE_POLL=0; AC_SUBST([REPLACE_POLL])
+])
-# printf-frexp.m4 serial 4
+# printf-frexp.m4 serial 5
dnl Copyright (C) 2007, 2009-2010 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
AC_CACHE_CHECK([whether ldexp can be used without linking with libm],
[gl_cv_func_ldexp_no_libm],
[
- AC_TRY_LINK([#include <math.h>
- double x;
- int y;],
- [return ldexp (x, y) < 1;],
+ AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[#include <math.h>
+ double x;
+ int y;]],
+ [[return ldexp (x, y) < 1;]])],
[gl_cv_func_ldexp_no_libm=yes],
[gl_cv_func_ldexp_no_libm=no])
])
-# printf-posix.m4 serial 5 (gettext-0.18)
+# printf-posix.m4 serial 6 (gettext-0.18.2)
dnl Copyright (C) 2003, 2007, 2009-2010 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
AC_CACHE_CHECK([whether printf() supports POSIX/XSI format strings],
gt_cv_func_printf_posix,
[
- AC_TRY_RUN([
+ AC_RUN_IFELSE(
+ [AC_LANG_SOURCE([[
#include <stdio.h>
#include <string.h>
/* The string "%2$d %1$d", with dollar characters protected from the shell's
{
sprintf (buf, format, 33, 55);
return (strcmp (buf, "55 33") != 0);
-}], gt_cv_func_printf_posix=yes, gt_cv_func_printf_posix=no,
- [
- AC_EGREP_CPP([notposix], [
+}]])],
+ [gt_cv_func_printf_posix=yes],
+ [gt_cv_func_printf_posix=no],
+ [
+ AC_EGREP_CPP([notposix], [
#if defined __NetBSD__ || defined __BEOS__ || defined _MSC_VER || defined __MINGW32__ || defined __CYGWIN__
notposix
#endif
- ],
- [gt_cv_func_printf_posix="guessing no"],
- [gt_cv_func_printf_posix="guessing yes"])
- ])
+ ],
+ [gt_cv_func_printf_posix="guessing no"],
+ [gt_cv_func_printf_posix="guessing yes"])
+ ])
])
case $gt_cv_func_printf_posix in
*yes)
AC_CACHE_CHECK([whether printf supports size specifiers as in C99],
[gl_cv_func_printf_sizes_c99],
[
- AC_TRY_RUN([
+ AC_RUN_IFELSE(
+ [AC_LANG_SOURCE([[
#include <stddef.h>
#include <stdio.h>
#include <string.h>
|| strcmp (buf, "1.5 33") != 0)
return 1;
return 0;
-}], [gl_cv_func_printf_sizes_c99=yes], [gl_cv_func_printf_sizes_c99=no],
- [
+}]])],
+ [gl_cv_func_printf_sizes_c99=yes],
+ [gl_cv_func_printf_sizes_c99=no],
+ [
changequote(,)dnl
- case "$host_os" in
- # Guess yes on glibc systems.
- *-gnu*) gl_cv_func_printf_sizes_c99="guessing yes";;
- # Guess yes on FreeBSD >= 5.
- freebsd[1-4]*) gl_cv_func_printf_sizes_c99="guessing no";;
- freebsd* | kfreebsd*) gl_cv_func_printf_sizes_c99="guessing yes";;
- # Guess yes on MacOS X >= 10.3.
- darwin[1-6].*) gl_cv_func_printf_sizes_c99="guessing no";;
- darwin*) gl_cv_func_printf_sizes_c99="guessing yes";;
- # Guess yes on OpenBSD >= 3.9.
- openbsd[1-2].* | openbsd3.[0-8] | openbsd3.[0-8].*)
- gl_cv_func_printf_sizes_c99="guessing no";;
- openbsd*) gl_cv_func_printf_sizes_c99="guessing yes";;
- # Guess yes on Solaris >= 2.10.
- solaris2.[0-9]*) gl_cv_func_printf_sizes_c99="guessing no";;
- solaris*) gl_cv_func_printf_sizes_c99="guessing yes";;
- # Guess yes on NetBSD >= 3.
- netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*)
- gl_cv_func_printf_sizes_c99="guessing no";;
- netbsd*) gl_cv_func_printf_sizes_c99="guessing yes";;
- # If we don't know, assume the worst.
- *) gl_cv_func_printf_sizes_c99="guessing no";;
- esac
+ case "$host_os" in
+ # Guess yes on glibc systems.
+ *-gnu*) gl_cv_func_printf_sizes_c99="guessing yes";;
+ # Guess yes on FreeBSD >= 5.
+ freebsd[1-4]*) gl_cv_func_printf_sizes_c99="guessing no";;
+ freebsd* | kfreebsd*) gl_cv_func_printf_sizes_c99="guessing yes";;
+ # Guess yes on MacOS X >= 10.3.
+ darwin[1-6].*) gl_cv_func_printf_sizes_c99="guessing no";;
+ darwin*) gl_cv_func_printf_sizes_c99="guessing yes";;
+ # Guess yes on OpenBSD >= 3.9.
+ openbsd[1-2].* | openbsd3.[0-8] | openbsd3.[0-8].*)
+ gl_cv_func_printf_sizes_c99="guessing no";;
+ openbsd*) gl_cv_func_printf_sizes_c99="guessing yes";;
+ # Guess yes on Solaris >= 2.10.
+ solaris2.[0-9]*) gl_cv_func_printf_sizes_c99="guessing no";;
+ solaris*) gl_cv_func_printf_sizes_c99="guessing yes";;
+ # Guess yes on NetBSD >= 3.
+ netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*)
+ gl_cv_func_printf_sizes_c99="guessing no";;
+ netbsd*) gl_cv_func_printf_sizes_c99="guessing yes";;
+ # If we don't know, assume the worst.
+ *) gl_cv_func_printf_sizes_c99="guessing no";;
+ esac
changequote([,])dnl
- ])
+ ])
])
])
AC_CACHE_CHECK([whether printf supports 'long double' arguments],
[gl_cv_func_printf_long_double],
[
- AC_TRY_RUN([
+ AC_RUN_IFELSE(
+ [AC_LANG_SOURCE([[
#include <stdio.h>
#include <string.h>
static char buf[10000];
|| strcmp (buf, "1.75 33") != 0)
return 1;
return 0;
-}], [gl_cv_func_printf_long_double=yes], [gl_cv_func_printf_long_double=no],
- [
+}]])],
+ [gl_cv_func_printf_long_double=yes],
+ [gl_cv_func_printf_long_double=no],
+ [
changequote(,)dnl
- case "$host_os" in
- beos*) gl_cv_func_printf_long_double="guessing no";;
- mingw* | pw*) gl_cv_func_printf_long_double="guessing no";;
- *) gl_cv_func_printf_long_double="guessing yes";;
- esac
+ case "$host_os" in
+ beos*) gl_cv_func_printf_long_double="guessing no";;
+ mingw* | pw*) gl_cv_func_printf_long_double="guessing no";;
+ *) gl_cv_func_printf_long_double="guessing yes";;
+ esac
changequote([,])dnl
- ])
+ ])
])
])
AC_CACHE_CHECK([whether printf supports infinite 'double' arguments],
[gl_cv_func_printf_infinite],
[
- AC_TRY_RUN([
+ AC_RUN_IFELSE(
+ [AC_LANG_SOURCE([[
#include <stdio.h>
#include <string.h>
static int
|| strcmp (buf, "-0") != 0)
return 1;
return 0;
-}], [gl_cv_func_printf_infinite=yes], [gl_cv_func_printf_infinite=no],
- [
+}]])],
+ [gl_cv_func_printf_infinite=yes],
+ [gl_cv_func_printf_infinite=no],
+ [
changequote(,)dnl
- case "$host_os" in
- # Guess yes on glibc systems.
- *-gnu*) gl_cv_func_printf_infinite="guessing yes";;
- # Guess yes on FreeBSD >= 6.
- freebsd[1-5]*) gl_cv_func_printf_infinite="guessing no";;
- freebsd* | kfreebsd*) gl_cv_func_printf_infinite="guessing yes";;
- # Guess yes on MacOS X >= 10.3.
- darwin[1-6].*) gl_cv_func_printf_infinite="guessing no";;
- darwin*) gl_cv_func_printf_infinite="guessing yes";;
- # Guess yes on HP-UX >= 11.
- hpux[7-9]* | hpux10*) gl_cv_func_printf_infinite="guessing no";;
- hpux*) gl_cv_func_printf_infinite="guessing yes";;
- # Guess yes on NetBSD >= 3.
- netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*)
- gl_cv_func_printf_infinite="guessing no";;
- netbsd*) gl_cv_func_printf_infinite="guessing yes";;
- # Guess yes on BeOS.
- beos*) gl_cv_func_printf_infinite="guessing yes";;
- # If we don't know, assume the worst.
- *) gl_cv_func_printf_infinite="guessing no";;
- esac
+ case "$host_os" in
+ # Guess yes on glibc systems.
+ *-gnu*) gl_cv_func_printf_infinite="guessing yes";;
+ # Guess yes on FreeBSD >= 6.
+ freebsd[1-5]*) gl_cv_func_printf_infinite="guessing no";;
+ freebsd* | kfreebsd*) gl_cv_func_printf_infinite="guessing yes";;
+ # Guess yes on MacOS X >= 10.3.
+ darwin[1-6].*) gl_cv_func_printf_infinite="guessing no";;
+ darwin*) gl_cv_func_printf_infinite="guessing yes";;
+ # Guess yes on HP-UX >= 11.
+ hpux[7-9]* | hpux10*) gl_cv_func_printf_infinite="guessing no";;
+ hpux*) gl_cv_func_printf_infinite="guessing yes";;
+ # Guess yes on NetBSD >= 3.
+ netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*)
+ gl_cv_func_printf_infinite="guessing no";;
+ netbsd*) gl_cv_func_printf_infinite="guessing yes";;
+ # Guess yes on BeOS.
+ beos*) gl_cv_func_printf_infinite="guessing yes";;
+ # If we don't know, assume the worst.
+ *) gl_cv_func_printf_infinite="guessing no";;
+ esac
changequote([,])dnl
- ])
+ ])
])
])
AC_CACHE_CHECK([whether printf supports infinite 'long double' arguments],
[gl_cv_func_printf_infinite_long_double],
[
- AC_TRY_RUN([
+ AC_RUN_IFELSE(
+ [AC_LANG_SOURCE([[
]GL_NOCRASH[
#include <float.h>
#include <stdio.h>
}
#endif
return 0;
-}],
- [gl_cv_func_printf_infinite_long_double=yes],
- [gl_cv_func_printf_infinite_long_double=no],
- [
+}]])],
+ [gl_cv_func_printf_infinite_long_double=yes],
+ [gl_cv_func_printf_infinite_long_double=no],
+ [
changequote(,)dnl
- case "$host_cpu" in
- # Guess no on ia64, x86_64, i386.
- ia64 | x86_64 | i*86) gl_cv_func_printf_infinite_long_double="guessing no";;
- *)
- case "$host_os" in
- # Guess yes on glibc systems.
- *-gnu*) gl_cv_func_printf_infinite_long_double="guessing yes";;
- # Guess yes on FreeBSD >= 6.
- freebsd[1-5]*) gl_cv_func_printf_infinite_long_double="guessing no";;
- freebsd* | kfreebsd*) gl_cv_func_printf_infinite_long_double="guessing yes";;
- # Guess yes on MacOS X >= 10.3.
- darwin[1-6].*) gl_cv_func_printf_infinite_long_double="guessing no";;
- darwin*) gl_cv_func_printf_infinite_long_double="guessing yes";;
- # Guess yes on HP-UX >= 11.
- hpux[7-9]* | hpux10*) gl_cv_func_printf_infinite_long_double="guessing no";;
- hpux*) gl_cv_func_printf_infinite_long_double="guessing yes";;
- # Guess yes on NetBSD >= 3.
- netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*)
- gl_cv_func_printf_infinite_long_double="guessing no";;
- netbsd*) gl_cv_func_printf_infinite_long_double="guessing yes";;
- # If we don't know, assume the worst.
- *) gl_cv_func_printf_infinite_long_double="guessing no";;
- esac
- ;;
- esac
+ case "$host_cpu" in
+ # Guess no on ia64, x86_64, i386.
+ ia64 | x86_64 | i*86) gl_cv_func_printf_infinite_long_double="guessing no";;
+ *)
+ case "$host_os" in
+ # Guess yes on glibc systems.
+ *-gnu*) gl_cv_func_printf_infinite_long_double="guessing yes";;
+ # Guess yes on FreeBSD >= 6.
+ freebsd[1-5]*) gl_cv_func_printf_infinite_long_double="guessing no";;
+ freebsd* | kfreebsd*) gl_cv_func_printf_infinite_long_double="guessing yes";;
+ # Guess yes on MacOS X >= 10.3.
+ darwin[1-6].*) gl_cv_func_printf_infinite_long_double="guessing no";;
+ darwin*) gl_cv_func_printf_infinite_long_double="guessing yes";;
+ # Guess yes on HP-UX >= 11.
+ hpux[7-9]* | hpux10*) gl_cv_func_printf_infinite_long_double="guessing no";;
+ hpux*) gl_cv_func_printf_infinite_long_double="guessing yes";;
+ # Guess yes on NetBSD >= 3.
+ netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*)
+ gl_cv_func_printf_infinite_long_double="guessing no";;
+ netbsd*) gl_cv_func_printf_infinite_long_double="guessing yes";;
+ # If we don't know, assume the worst.
+ *) gl_cv_func_printf_infinite_long_double="guessing no";;
+ esac
+ ;;
+ esac
changequote([,])dnl
- ])
+ ])
])
;;
*)
AC_CACHE_CHECK([whether printf supports the 'a' and 'A' directives],
[gl_cv_func_printf_directive_a],
[
- AC_TRY_RUN([
+ AC_RUN_IFELSE(
+ [AC_LANG_SOURCE([[
#include <stdio.h>
#include <string.h>
static char buf[100];
&& strcmp (buf, "0x8.0p-2") != 0))
return 1;
return 0;
-}], [gl_cv_func_printf_directive_a=yes], [gl_cv_func_printf_directive_a=no],
- [
- case "$host_os" in
- # Guess yes on glibc >= 2.5 systems.
- *-gnu*)
- AC_EGREP_CPP([BZ2908], [
- #include <features.h>
- #ifdef __GNU_LIBRARY__
- #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 5) || (__GLIBC__ > 2)
- BZ2908
- #endif
- #endif
- ],
- [gl_cv_func_printf_directive_a="guessing yes"],
- [gl_cv_func_printf_directive_a="guessing no"])
- ;;
- # If we don't know, assume the worst.
- *) gl_cv_func_printf_directive_a="guessing no";;
- esac
- ])
+}]])],
+ [gl_cv_func_printf_directive_a=yes],
+ [gl_cv_func_printf_directive_a=no],
+ [
+ case "$host_os" in
+ # Guess yes on glibc >= 2.5 systems.
+ *-gnu*)
+ AC_EGREP_CPP([BZ2908], [
+ #include <features.h>
+ #ifdef __GNU_LIBRARY__
+ #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 5) || (__GLIBC__ > 2)
+ BZ2908
+ #endif
+ #endif
+ ],
+ [gl_cv_func_printf_directive_a="guessing yes"],
+ [gl_cv_func_printf_directive_a="guessing no"])
+ ;;
+ # If we don't know, assume the worst.
+ *) gl_cv_func_printf_directive_a="guessing no";;
+ esac
+ ])
])
])
AC_CACHE_CHECK([whether printf supports the 'F' directive],
[gl_cv_func_printf_directive_f],
[
- AC_TRY_RUN([
+ AC_RUN_IFELSE(
+ [AC_LANG_SOURCE([[
#include <stdio.h>
#include <string.h>
static char buf[100];
|| strcmp (buf, "1234") != 0)
return 1;
return 0;
-}], [gl_cv_func_printf_directive_f=yes], [gl_cv_func_printf_directive_f=no],
- [
+}]])],
+ [gl_cv_func_printf_directive_f=yes],
+ [gl_cv_func_printf_directive_f=no],
+ [
changequote(,)dnl
- case "$host_os" in
- # Guess yes on glibc systems.
- *-gnu*) gl_cv_func_printf_directive_f="guessing yes";;
- # Guess yes on FreeBSD >= 6.
- freebsd[1-5]*) gl_cv_func_printf_directive_f="guessing no";;
- freebsd* | kfreebsd*) gl_cv_func_printf_directive_f="guessing yes";;
- # Guess yes on MacOS X >= 10.3.
- darwin[1-6].*) gl_cv_func_printf_directive_f="guessing no";;
- darwin*) gl_cv_func_printf_directive_f="guessing yes";;
- # Guess yes on Solaris >= 2.10.
- solaris2.[0-9]*) gl_cv_func_printf_directive_f="guessing no";;
- solaris*) gl_cv_func_printf_directive_f="guessing yes";;
- # If we don't know, assume the worst.
- *) gl_cv_func_printf_directive_f="guessing no";;
- esac
+ case "$host_os" in
+ # Guess yes on glibc systems.
+ *-gnu*) gl_cv_func_printf_directive_f="guessing yes";;
+ # Guess yes on FreeBSD >= 6.
+ freebsd[1-5]*) gl_cv_func_printf_directive_f="guessing no";;
+ freebsd* | kfreebsd*) gl_cv_func_printf_directive_f="guessing yes";;
+ # Guess yes on MacOS X >= 10.3.
+ darwin[1-6].*) gl_cv_func_printf_directive_f="guessing no";;
+ darwin*) gl_cv_func_printf_directive_f="guessing yes";;
+ # Guess yes on Solaris >= 2.10.
+ solaris2.[0-9]*) gl_cv_func_printf_directive_f="guessing no";;
+ solaris*) gl_cv_func_printf_directive_f="guessing yes";;
+ # If we don't know, assume the worst.
+ *) gl_cv_func_printf_directive_f="guessing no";;
+ esac
changequote([,])dnl
- ])
+ ])
])
])
AC_CACHE_CHECK([whether printf supports the 'n' directive],
[gl_cv_func_printf_directive_n],
[
- AC_TRY_RUN([
+ AC_RUN_IFELSE(
+ [AC_LANG_SOURCE([[
#include <stdio.h>
#include <string.h>
static char fmtstring[10];
|| count != 4)
return 1;
return 0;
-}], [gl_cv_func_printf_directive_n=yes], [gl_cv_func_printf_directive_n=no],
- [
+}]])],
+ [gl_cv_func_printf_directive_n=yes],
+ [gl_cv_func_printf_directive_n=no],
+ [
changequote(,)dnl
- case "$host_os" in
- *) gl_cv_func_printf_directive_n="guessing yes";;
- esac
+ case "$host_os" in
+ *) gl_cv_func_printf_directive_n="guessing yes";;
+ esac
changequote([,])dnl
- ])
+ ])
])
])
AC_CACHE_CHECK([whether printf supports the 'ls' directive],
[gl_cv_func_printf_directive_ls],
[
- AC_TRY_RUN([
+ AC_RUN_IFELSE(
+ [AC_LANG_SOURCE([[
/* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before
<wchar.h>.
BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be
return 1;
}
return 0;
-}], [gl_cv_func_printf_directive_ls=yes], [gl_cv_func_printf_directive_ls=no],
- [
+}]])],
+ [gl_cv_func_printf_directive_ls=yes],
+ [gl_cv_func_printf_directive_ls=no],
+ [
changequote(,)dnl
- case "$host_os" in
- openbsd*) gl_cv_func_printf_directive_ls="guessing no";;
- irix*) gl_cv_func_printf_directive_ls="guessing no";;
- solaris*) gl_cv_func_printf_directive_ls="guessing no";;
- cygwin*) gl_cv_func_printf_directive_ls="guessing no";;
- beos* | haiku*) gl_cv_func_printf_directive_ls="guessing no";;
- *) gl_cv_func_printf_directive_ls="guessing yes";;
- esac
+ case "$host_os" in
+ openbsd*) gl_cv_func_printf_directive_ls="guessing no";;
+ irix*) gl_cv_func_printf_directive_ls="guessing no";;
+ solaris*) gl_cv_func_printf_directive_ls="guessing no";;
+ cygwin*) gl_cv_func_printf_directive_ls="guessing no";;
+ beos* | haiku*) gl_cv_func_printf_directive_ls="guessing no";;
+ *) gl_cv_func_printf_directive_ls="guessing yes";;
+ esac
changequote([,])dnl
- ])
+ ])
])
])
AC_CACHE_CHECK([whether printf supports POSIX/XSI format strings with positions],
[gl_cv_func_printf_positions],
[
- AC_TRY_RUN([
+ AC_RUN_IFELSE(
+ [AC_LANG_SOURCE([[
#include <stdio.h>
#include <string.h>
/* The string "%2$d %1$d", with dollar characters protected from the shell's
{
sprintf (buf, format, 33, 55);
return (strcmp (buf, "55 33") != 0);
-}], [gl_cv_func_printf_positions=yes], [gl_cv_func_printf_positions=no],
- [
+}]])],
+ [gl_cv_func_printf_positions=yes],
+ [gl_cv_func_printf_positions=no],
+ [
changequote(,)dnl
- case "$host_os" in
- netbsd[1-3]* | netbsdelf[1-3]* | netbsdaout[1-3]* | netbsdcoff[1-3]*)
- gl_cv_func_printf_positions="guessing no";;
- beos*) gl_cv_func_printf_positions="guessing no";;
- mingw* | pw*) gl_cv_func_printf_positions="guessing no";;
- *) gl_cv_func_printf_positions="guessing yes";;
- esac
+ case "$host_os" in
+ netbsd[1-3]* | netbsdelf[1-3]* | netbsdaout[1-3]* | netbsdcoff[1-3]*)
+ gl_cv_func_printf_positions="guessing no";;
+ beos*) gl_cv_func_printf_positions="guessing no";;
+ mingw* | pw*) gl_cv_func_printf_positions="guessing no";;
+ *) gl_cv_func_printf_positions="guessing yes";;
+ esac
changequote([,])dnl
- ])
+ ])
])
])
AC_CACHE_CHECK([whether printf supports the grouping flag],
[gl_cv_func_printf_flag_grouping],
[
- AC_TRY_RUN([
+ AC_RUN_IFELSE(
+ [AC_LANG_SOURCE([[
#include <stdio.h>
#include <string.h>
static char buf[100];
|| buf[strlen (buf) - 1] != '9')
return 1;
return 0;
-}], [gl_cv_func_printf_flag_grouping=yes], [gl_cv_func_printf_flag_grouping=no],
- [
+}]])],
+ [gl_cv_func_printf_flag_grouping=yes],
+ [gl_cv_func_printf_flag_grouping=no],
+ [
changequote(,)dnl
- case "$host_os" in
- cygwin*) gl_cv_func_printf_flag_grouping="guessing no";;
- netbsd*) gl_cv_func_printf_flag_grouping="guessing no";;
- mingw* | pw*) gl_cv_func_printf_flag_grouping="guessing no";;
- *) gl_cv_func_printf_flag_grouping="guessing yes";;
- esac
+ case "$host_os" in
+ cygwin*) gl_cv_func_printf_flag_grouping="guessing no";;
+ netbsd*) gl_cv_func_printf_flag_grouping="guessing no";;
+ mingw* | pw*) gl_cv_func_printf_flag_grouping="guessing no";;
+ *) gl_cv_func_printf_flag_grouping="guessing yes";;
+ esac
changequote([,])dnl
- ])
+ ])
])
])
AC_CACHE_CHECK([whether printf supports the left-adjust flag correctly],
[gl_cv_func_printf_flag_leftadjust],
[
- AC_TRY_RUN([
+ AC_RUN_IFELSE(
+ [AC_LANG_SOURCE([[
#include <stdio.h>
#include <string.h>
static char buf[100];
|| strcmp (buf, "ab c") != 0)
return 1;
return 0;
-}],
+}]])],
[gl_cv_func_printf_flag_leftadjust=yes],
[gl_cv_func_printf_flag_leftadjust=no],
[
AC_CACHE_CHECK([whether printf supports the zero flag correctly],
[gl_cv_func_printf_flag_zero],
[
- AC_TRY_RUN([
+ AC_RUN_IFELSE(
+ [AC_LANG_SOURCE([[
#include <stdio.h>
#include <string.h>
static char buf[100];
&& strcmp (buf, " infinity") != 0))
return 1;
return 0;
-}], [gl_cv_func_printf_flag_zero=yes], [gl_cv_func_printf_flag_zero=no],
- [
+}]])],
+ [gl_cv_func_printf_flag_zero=yes],
+ [gl_cv_func_printf_flag_zero=no],
+ [
changequote(,)dnl
- case "$host_os" in
- # Guess yes on glibc systems.
- *-gnu*) gl_cv_func_printf_flag_zero="guessing yes";;
- # Guess yes on BeOS.
- beos*) gl_cv_func_printf_flag_zero="guessing yes";;
- # If we don't know, assume the worst.
- *) gl_cv_func_printf_flag_zero="guessing no";;
- esac
+ case "$host_os" in
+ # Guess yes on glibc systems.
+ *-gnu*) gl_cv_func_printf_flag_zero="guessing yes";;
+ # Guess yes on BeOS.
+ beos*) gl_cv_func_printf_flag_zero="guessing yes";;
+ # If we don't know, assume the worst.
+ *) gl_cv_func_printf_flag_zero="guessing no";;
+ esac
changequote([,])dnl
- ])
+ ])
])
])
AC_CACHE_CHECK([whether printf supports large precisions],
[gl_cv_func_printf_precision],
[
- AC_TRY_RUN([
+ AC_RUN_IFELSE(
+ [AC_LANG_SOURCE([[
#include <stdio.h>
#include <string.h>
static char buf[5000];
if (sprintf (buf, "%.4000d %d", 1, 33, 44) < 4000 + 3)
return 1;
return 0;
-}], [gl_cv_func_printf_precision=yes], [gl_cv_func_printf_precision=no],
- [
+}]])],
+ [gl_cv_func_printf_precision=yes],
+ [gl_cv_func_printf_precision=no],
+ [
changequote(,)dnl
- case "$host_os" in
- # Guess no only on native Win32 and BeOS systems.
- mingw* | pw*) gl_cv_func_printf_precision="guessing no" ;;
- beos*) gl_cv_func_printf_precision="guessing no" ;;
- *) gl_cv_func_printf_precision="guessing yes" ;;
- esac
+ case "$host_os" in
+ # Guess no only on native Win32 and BeOS systems.
+ mingw* | pw*) gl_cv_func_printf_precision="guessing no" ;;
+ beos*) gl_cv_func_printf_precision="guessing no" ;;
+ *) gl_cv_func_printf_precision="guessing yes" ;;
+ esac
changequote([,])dnl
- ])
+ ])
])
])
AC_CACHE_CHECK([whether snprintf truncates the result as in C99],
[gl_cv_func_snprintf_truncation_c99],
[
- AC_TRY_RUN([
+ AC_RUN_IFELSE(
+ [AC_LANG_SOURCE([[
#include <stdio.h>
#include <string.h>
static char buf[100];
if (memcmp (buf, "45\0DEF", 6) != 0)
return 1;
return 0;
-}], [gl_cv_func_snprintf_truncation_c99=yes], [gl_cv_func_snprintf_truncation_c99=no],
- [
+}]])],
+ [gl_cv_func_snprintf_truncation_c99=yes],
+ [gl_cv_func_snprintf_truncation_c99=no],
+ [
changequote(,)dnl
- case "$host_os" in
- # Guess yes on glibc systems.
- *-gnu*) gl_cv_func_snprintf_truncation_c99="guessing yes";;
- # Guess yes on FreeBSD >= 5.
- freebsd[1-4]*) gl_cv_func_snprintf_truncation_c99="guessing no";;
- freebsd* | kfreebsd*) gl_cv_func_snprintf_truncation_c99="guessing yes";;
- # Guess yes on MacOS X >= 10.3.
- darwin[1-6].*) gl_cv_func_snprintf_truncation_c99="guessing no";;
- darwin*) gl_cv_func_snprintf_truncation_c99="guessing yes";;
- # Guess yes on OpenBSD >= 3.9.
- openbsd[1-2].* | openbsd3.[0-8] | openbsd3.[0-8].*)
- gl_cv_func_snprintf_truncation_c99="guessing no";;
- openbsd*) gl_cv_func_snprintf_truncation_c99="guessing yes";;
- # Guess yes on Solaris >= 2.6.
- solaris2.[0-5]*) gl_cv_func_snprintf_truncation_c99="guessing no";;
- solaris*) gl_cv_func_snprintf_truncation_c99="guessing yes";;
- # Guess yes on AIX >= 4.
- aix[1-3]*) gl_cv_func_snprintf_truncation_c99="guessing no";;
- aix*) gl_cv_func_snprintf_truncation_c99="guessing yes";;
- # Guess yes on HP-UX >= 11.
- hpux[7-9]* | hpux10*) gl_cv_func_snprintf_truncation_c99="guessing no";;
- hpux*) gl_cv_func_snprintf_truncation_c99="guessing yes";;
- # Guess yes on IRIX >= 6.5.
- irix6.5) gl_cv_func_snprintf_truncation_c99="guessing yes";;
- # Guess yes on OSF/1 >= 5.
- osf[3-4]*) gl_cv_func_snprintf_truncation_c99="guessing no";;
- osf*) gl_cv_func_snprintf_truncation_c99="guessing yes";;
- # Guess yes on NetBSD >= 3.
- netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*)
- gl_cv_func_snprintf_truncation_c99="guessing no";;
- netbsd*) gl_cv_func_snprintf_truncation_c99="guessing yes";;
- # Guess yes on BeOS.
- beos*) gl_cv_func_snprintf_truncation_c99="guessing yes";;
- # If we don't know, assume the worst.
- *) gl_cv_func_snprintf_truncation_c99="guessing no";;
- esac
+ case "$host_os" in
+ # Guess yes on glibc systems.
+ *-gnu*) gl_cv_func_snprintf_truncation_c99="guessing yes";;
+ # Guess yes on FreeBSD >= 5.
+ freebsd[1-4]*) gl_cv_func_snprintf_truncation_c99="guessing no";;
+ freebsd* | kfreebsd*) gl_cv_func_snprintf_truncation_c99="guessing yes";;
+ # Guess yes on MacOS X >= 10.3.
+ darwin[1-6].*) gl_cv_func_snprintf_truncation_c99="guessing no";;
+ darwin*) gl_cv_func_snprintf_truncation_c99="guessing yes";;
+ # Guess yes on OpenBSD >= 3.9.
+ openbsd[1-2].* | openbsd3.[0-8] | openbsd3.[0-8].*)
+ gl_cv_func_snprintf_truncation_c99="guessing no";;
+ openbsd*) gl_cv_func_snprintf_truncation_c99="guessing yes";;
+ # Guess yes on Solaris >= 2.6.
+ solaris2.[0-5]*) gl_cv_func_snprintf_truncation_c99="guessing no";;
+ solaris*) gl_cv_func_snprintf_truncation_c99="guessing yes";;
+ # Guess yes on AIX >= 4.
+ aix[1-3]*) gl_cv_func_snprintf_truncation_c99="guessing no";;
+ aix*) gl_cv_func_snprintf_truncation_c99="guessing yes";;
+ # Guess yes on HP-UX >= 11.
+ hpux[7-9]* | hpux10*) gl_cv_func_snprintf_truncation_c99="guessing no";;
+ hpux*) gl_cv_func_snprintf_truncation_c99="guessing yes";;
+ # Guess yes on IRIX >= 6.5.
+ irix6.5) gl_cv_func_snprintf_truncation_c99="guessing yes";;
+ # Guess yes on OSF/1 >= 5.
+ osf[3-4]*) gl_cv_func_snprintf_truncation_c99="guessing no";;
+ osf*) gl_cv_func_snprintf_truncation_c99="guessing yes";;
+ # Guess yes on NetBSD >= 3.
+ netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*)
+ gl_cv_func_snprintf_truncation_c99="guessing no";;
+ netbsd*) gl_cv_func_snprintf_truncation_c99="guessing yes";;
+ # Guess yes on BeOS.
+ beos*) gl_cv_func_snprintf_truncation_c99="guessing yes";;
+ # If we don't know, assume the worst.
+ *) gl_cv_func_snprintf_truncation_c99="guessing no";;
+ esac
changequote([,])dnl
- ])
+ ])
])
])
AC_CACHE_CHECK([whether snprintf returns a byte count as in C99],
[gl_cv_func_snprintf_retval_c99],
[
- AC_TRY_RUN([
+ AC_RUN_IFELSE(
+ [AC_LANG_SOURCE([[
#include <stdio.h>
#include <string.h>
static char buf[100];
if (snprintf (buf, 3, "%d %d", 4567, 89) != 7)
return 1;
return 0;
-}], [gl_cv_func_snprintf_retval_c99=yes], [gl_cv_func_snprintf_retval_c99=no],
- [
+}]])],
+ [gl_cv_func_snprintf_retval_c99=yes],
+ [gl_cv_func_snprintf_retval_c99=no],
+ [
changequote(,)dnl
- case "$host_os" in
- # Guess yes on glibc systems.
- *-gnu*) gl_cv_func_snprintf_retval_c99="guessing yes";;
- # Guess yes on FreeBSD >= 5.
- freebsd[1-4]*) gl_cv_func_snprintf_retval_c99="guessing no";;
- freebsd* | kfreebsd*) gl_cv_func_snprintf_retval_c99="guessing yes";;
- # Guess yes on MacOS X >= 10.3.
- darwin[1-6].*) gl_cv_func_snprintf_retval_c99="guessing no";;
- darwin*) gl_cv_func_snprintf_retval_c99="guessing yes";;
- # Guess yes on OpenBSD >= 3.9.
- openbsd[1-2].* | openbsd3.[0-8] | openbsd3.[0-8].*)
- gl_cv_func_snprintf_retval_c99="guessing no";;
- openbsd*) gl_cv_func_snprintf_retval_c99="guessing yes";;
- # Guess yes on Solaris >= 2.6.
- solaris2.[0-5]*) gl_cv_func_snprintf_retval_c99="guessing no";;
- solaris*) gl_cv_func_snprintf_retval_c99="guessing yes";;
- # Guess yes on AIX >= 4.
- aix[1-3]*) gl_cv_func_snprintf_retval_c99="guessing no";;
- aix*) gl_cv_func_snprintf_retval_c99="guessing yes";;
- # Guess yes on NetBSD >= 3.
- netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*)
- gl_cv_func_snprintf_retval_c99="guessing no";;
- netbsd*) gl_cv_func_snprintf_retval_c99="guessing yes";;
- # Guess yes on BeOS.
- beos*) gl_cv_func_snprintf_retval_c99="guessing yes";;
- # If we don't know, assume the worst.
- *) gl_cv_func_snprintf_retval_c99="guessing no";;
- esac
+ case "$host_os" in
+ # Guess yes on glibc systems.
+ *-gnu*) gl_cv_func_snprintf_retval_c99="guessing yes";;
+ # Guess yes on FreeBSD >= 5.
+ freebsd[1-4]*) gl_cv_func_snprintf_retval_c99="guessing no";;
+ freebsd* | kfreebsd*) gl_cv_func_snprintf_retval_c99="guessing yes";;
+ # Guess yes on MacOS X >= 10.3.
+ darwin[1-6].*) gl_cv_func_snprintf_retval_c99="guessing no";;
+ darwin*) gl_cv_func_snprintf_retval_c99="guessing yes";;
+ # Guess yes on OpenBSD >= 3.9.
+ openbsd[1-2].* | openbsd3.[0-8] | openbsd3.[0-8].*)
+ gl_cv_func_snprintf_retval_c99="guessing no";;
+ openbsd*) gl_cv_func_snprintf_retval_c99="guessing yes";;
+ # Guess yes on Solaris >= 2.6.
+ solaris2.[0-5]*) gl_cv_func_snprintf_retval_c99="guessing no";;
+ solaris*) gl_cv_func_snprintf_retval_c99="guessing yes";;
+ # Guess yes on AIX >= 4.
+ aix[1-3]*) gl_cv_func_snprintf_retval_c99="guessing no";;
+ aix*) gl_cv_func_snprintf_retval_c99="guessing yes";;
+ # Guess yes on NetBSD >= 3.
+ netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*)
+ gl_cv_func_snprintf_retval_c99="guessing no";;
+ netbsd*) gl_cv_func_snprintf_retval_c99="guessing yes";;
+ # Guess yes on BeOS.
+ beos*) gl_cv_func_snprintf_retval_c99="guessing yes";;
+ # If we don't know, assume the worst.
+ *) gl_cv_func_snprintf_retval_c99="guessing no";;
+ esac
changequote([,])dnl
- ])
+ ])
])
])
AC_CACHE_CHECK([whether snprintf fully supports the 'n' directive],
[gl_cv_func_snprintf_directive_n],
[
- AC_TRY_RUN([
+ AC_RUN_IFELSE(
+ [AC_LANG_SOURCE([[
#include <stdio.h>
#include <string.h>
static char fmtstring[10];
if (count != 6)
return 1;
return 0;
-}], [gl_cv_func_snprintf_directive_n=yes], [gl_cv_func_snprintf_directive_n=no],
- [
+}]])],
+ [gl_cv_func_snprintf_directive_n=yes],
+ [gl_cv_func_snprintf_directive_n=no],
+ [
changequote(,)dnl
- case "$host_os" in
- # Guess yes on glibc systems.
- *-gnu*) gl_cv_func_snprintf_directive_n="guessing yes";;
- # Guess yes on FreeBSD >= 5.
- freebsd[1-4]*) gl_cv_func_snprintf_directive_n="guessing no";;
- freebsd* | kfreebsd*) gl_cv_func_snprintf_directive_n="guessing yes";;
- # Guess yes on MacOS X >= 10.3.
- darwin[1-6].*) gl_cv_func_snprintf_directive_n="guessing no";;
- darwin*) gl_cv_func_snprintf_directive_n="guessing yes";;
- # Guess yes on Solaris >= 2.6.
- solaris2.[0-5]*) gl_cv_func_snprintf_directive_n="guessing no";;
- solaris*) gl_cv_func_snprintf_directive_n="guessing yes";;
- # Guess yes on AIX >= 4.
- aix[1-3]*) gl_cv_func_snprintf_directive_n="guessing no";;
- aix*) gl_cv_func_snprintf_directive_n="guessing yes";;
- # Guess yes on IRIX >= 6.5.
- irix6.5) gl_cv_func_snprintf_directive_n="guessing yes";;
- # Guess yes on OSF/1 >= 5.
- osf[3-4]*) gl_cv_func_snprintf_directive_n="guessing no";;
- osf*) gl_cv_func_snprintf_directive_n="guessing yes";;
- # Guess yes on NetBSD >= 3.
- netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*)
- gl_cv_func_snprintf_directive_n="guessing no";;
- netbsd*) gl_cv_func_snprintf_directive_n="guessing yes";;
- # Guess yes on BeOS.
- beos*) gl_cv_func_snprintf_directive_n="guessing yes";;
- # If we don't know, assume the worst.
- *) gl_cv_func_snprintf_directive_n="guessing no";;
- esac
+ case "$host_os" in
+ # Guess yes on glibc systems.
+ *-gnu*) gl_cv_func_snprintf_directive_n="guessing yes";;
+ # Guess yes on FreeBSD >= 5.
+ freebsd[1-4]*) gl_cv_func_snprintf_directive_n="guessing no";;
+ freebsd* | kfreebsd*) gl_cv_func_snprintf_directive_n="guessing yes";;
+ # Guess yes on MacOS X >= 10.3.
+ darwin[1-6].*) gl_cv_func_snprintf_directive_n="guessing no";;
+ darwin*) gl_cv_func_snprintf_directive_n="guessing yes";;
+ # Guess yes on Solaris >= 2.6.
+ solaris2.[0-5]*) gl_cv_func_snprintf_directive_n="guessing no";;
+ solaris*) gl_cv_func_snprintf_directive_n="guessing yes";;
+ # Guess yes on AIX >= 4.
+ aix[1-3]*) gl_cv_func_snprintf_directive_n="guessing no";;
+ aix*) gl_cv_func_snprintf_directive_n="guessing yes";;
+ # Guess yes on IRIX >= 6.5.
+ irix6.5) gl_cv_func_snprintf_directive_n="guessing yes";;
+ # Guess yes on OSF/1 >= 5.
+ osf[3-4]*) gl_cv_func_snprintf_directive_n="guessing no";;
+ osf*) gl_cv_func_snprintf_directive_n="guessing yes";;
+ # Guess yes on NetBSD >= 3.
+ netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*)
+ gl_cv_func_snprintf_directive_n="guessing no";;
+ netbsd*) gl_cv_func_snprintf_directive_n="guessing yes";;
+ # Guess yes on BeOS.
+ beos*) gl_cv_func_snprintf_directive_n="guessing yes";;
+ # If we don't know, assume the worst.
+ *) gl_cv_func_snprintf_directive_n="guessing no";;
+ esac
changequote([,])dnl
- ])
+ ])
])
])
AC_CACHE_CHECK([whether snprintf respects a size of 1],
[gl_cv_func_snprintf_size1],
[
- AC_TRY_RUN([
+ AC_RUN_IFELSE(
+ [AC_LANG_SOURCE([[
#include <stdio.h>
int main()
{
static char buf[8] = { 'D', 'E', 'A', 'D', 'B', 'E', 'E', 'F' };
snprintf (buf, 1, "%d", 12345);
return buf[1] != 'E';
-}],
- [gl_cv_func_snprintf_size1=yes],
- [gl_cv_func_snprintf_size1=no],
- [gl_cv_func_snprintf_size1="guessing yes"])
+}]])],
+ [gl_cv_func_snprintf_size1=yes],
+ [gl_cv_func_snprintf_size1=no],
+ [gl_cv_func_snprintf_size1="guessing yes"])
])
])
AC_CACHE_CHECK([whether vsnprintf respects a zero size as in C99],
[gl_cv_func_vsnprintf_zerosize_c99],
[
- AC_TRY_RUN([
+ AC_RUN_IFELSE(
+ [AC_LANG_SOURCE([[
#include <stdarg.h>
#include <stdio.h>
static int my_snprintf (char *buf, int size, const char *format, ...)
static char buf[8] = { 'D', 'E', 'A', 'D', 'B', 'E', 'E', 'F' };
my_snprintf (buf, 0, "%d", 12345);
return buf[0] != 'D';
-}],
- [gl_cv_func_vsnprintf_zerosize_c99=yes],
- [gl_cv_func_vsnprintf_zerosize_c99=no],
- [
+}]])],
+ [gl_cv_func_vsnprintf_zerosize_c99=yes],
+ [gl_cv_func_vsnprintf_zerosize_c99=no],
+ [
changequote(,)dnl
- case "$host_os" in
- # Guess yes on glibc systems.
- *-gnu*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";;
- # Guess yes on FreeBSD >= 5.
- freebsd[1-4]*) gl_cv_func_vsnprintf_zerosize_c99="guessing no";;
- freebsd* | kfreebsd*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";;
- # Guess yes on MacOS X >= 10.3.
- darwin[1-6].*) gl_cv_func_vsnprintf_zerosize_c99="guessing no";;
- darwin*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";;
- # Guess yes on Cygwin.
- cygwin*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";;
- # Guess yes on Solaris >= 2.6.
- solaris2.[0-5]*) gl_cv_func_vsnprintf_zerosize_c99="guessing no";;
- solaris*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";;
- # Guess yes on AIX >= 4.
- aix[1-3]*) gl_cv_func_vsnprintf_zerosize_c99="guessing no";;
- aix*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";;
- # Guess yes on IRIX >= 6.5.
- irix6.5) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";;
- # Guess yes on NetBSD >= 3.
- netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*)
- gl_cv_func_vsnprintf_zerosize_c99="guessing no";;
- netbsd*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";;
- # Guess yes on BeOS.
- beos*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";;
- # Guess yes on mingw.
- mingw* | pw*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";;
- # If we don't know, assume the worst.
- *) gl_cv_func_vsnprintf_zerosize_c99="guessing no";;
- esac
+ case "$host_os" in
+ # Guess yes on glibc systems.
+ *-gnu*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";;
+ # Guess yes on FreeBSD >= 5.
+ freebsd[1-4]*) gl_cv_func_vsnprintf_zerosize_c99="guessing no";;
+ freebsd* | kfreebsd*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";;
+ # Guess yes on MacOS X >= 10.3.
+ darwin[1-6].*) gl_cv_func_vsnprintf_zerosize_c99="guessing no";;
+ darwin*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";;
+ # Guess yes on Cygwin.
+ cygwin*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";;
+ # Guess yes on Solaris >= 2.6.
+ solaris2.[0-5]*) gl_cv_func_vsnprintf_zerosize_c99="guessing no";;
+ solaris*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";;
+ # Guess yes on AIX >= 4.
+ aix[1-3]*) gl_cv_func_vsnprintf_zerosize_c99="guessing no";;
+ aix*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";;
+ # Guess yes on IRIX >= 6.5.
+ irix6.5) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";;
+ # Guess yes on NetBSD >= 3.
+ netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*)
+ gl_cv_func_vsnprintf_zerosize_c99="guessing no";;
+ netbsd*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";;
+ # Guess yes on BeOS.
+ beos*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";;
+ # Guess yes on mingw.
+ mingw* | pw*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";;
+ # If we don't know, assume the worst.
+ *) gl_cv_func_vsnprintf_zerosize_c99="guessing no";;
+ esac
changequote([,])dnl
- ])
+ ])
])
])
-# progtest.m4 serial 6 (gettext-0.18)
+# progtest.m4 serial 7 (gettext-0.18.2)
dnl Copyright (C) 1996-2003, 2005, 2008-2010 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
# Prepare PATH_SEPARATOR.
# The user is always right.
if test "${PATH_SEPARATOR+set}" != set; then
- echo "#! /bin/sh" >conf$$.sh
- echo "exit 0" >>conf$$.sh
- chmod +x conf$$.sh
- if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
- PATH_SEPARATOR=';'
- else
- PATH_SEPARATOR=:
- fi
- rm -f conf$$.sh
+ # Determine PATH_SEPARATOR by trying to find /bin/sh in a PATH which
+ # contains only /bin. Note that ksh looks also at the FPATH variable,
+ # so we have to set that as well for the test.
+ PATH_SEPARATOR=:
+ (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \
+ && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \
+ || PATH_SEPARATOR=';'
+ }
fi
# Find out how to test for executable files. Don't use a zero-byte file,
dnl with or without modifications, as long as this notice is preserved.
AC_DEFUN([gl_PTHREAD_CHECK],
- [AC_CHECK_HEADERS_ONCE([pthread.h])
+[
+ AC_REQUIRE([gl_PTHREAD_DEFAULTS])
+ AC_CHECK_HEADERS_ONCE([pthread.h])
+ gl_CHECK_NEXT_HEADERS([pthread.h])
+ if test $ac_cv_header_pthread_h = yes; then
+ HAVE_PTHREAD_H=1
+ else
+ HAVE_PTHREAD_H=0
+ fi
+
+ AC_CHECK_TYPES([pthread_t, pthread_spinlock_t], [], [],
+ [AC_INCLUDES_DEFAULT[
+ #if HAVE_PTHREAD_H
+ #include <pthread.h>
+ #endif]])
+ if test $ac_cv_type_pthread_t != yes; then
+ HAVE_PTHREAD_T=0
+ fi
+ if test $ac_cv_type_pthread_spinlock_t != yes; then
+ HAVE_PTHREAD_SPINLOCK_T=0
+ fi
+
+ if test $ac_cv_header_pthread_h != yes ||
+ test $ac_cv_type_pthread_t != yes ||
+ test $ac_cv_type_pthread_spinlock_t != yes; then
+ PTHREAD_H='pthread.h'
+ fi
LIB_PTHREAD=
- PTHREAD_H=
- if test "$ac_cv_header_pthread_h" = yes; then
+ if test $ac_cv_header_pthread_h = yes; then
gl_saved_libs=$LIBS
AC_SEARCH_LIBS([pthread_create], [pthread],
[if test "$ac_cv_search_pthread_create" != "none required"; then
LIB_PTHREAD="$ac_cv_search_pthread_create"
fi])
LIBS="$gl_saved_libs"
- else
- AC_CHECK_TYPES([pthread_t])
- PTHREAD_H='pthread.h'
fi
-
AC_SUBST([LIB_PTHREAD])
- AC_SUBST([PTHREAD_H])
AC_REQUIRE([AC_C_INLINE])
AC_REQUIRE([AC_C_RESTRICT])
])
+
+AC_DEFUN([gl_PTHREAD_DEFAULTS],
+[
+ dnl Assume proper GNU behavior unless another module says otherwise.
+ HAVE_PTHREAD_H=1; AC_SUBST([HAVE_PTHREAD_H])
+ HAVE_PTHREAD_T=1; AC_SUBST([HAVE_PTHREAD_T])
+ HAVE_PTHREAD_SPINLOCK_T=1; AC_SUBST([HAVE_PTHREAD_SPINLOCK_T])
+ PTHREAD_H=''; AC_SUBST([PTHREAD_H])
+])
-# pty.m4 serial 7
+# pty.m4 serial 9
dnl Copyright (C) 2010 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 We assume that forkpty exists (possibly in libc, possibly in libutil)
dnl if and only if it is declared.
AC_CHECK_DECLS([forkpty],,, [[
+/* <sys/types.h> is a prerequisite of <libutil.h> on FreeBSD 8.0. */
+#include <sys/types.h>
#if HAVE_PTY_H
# include <pty.h>
#endif
[gl_cv_func_forkpty_const],
[AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([[
+/* <sys/types.h> is a prerequisite of <libutil.h> on FreeBSD 8.0. */
+#include <sys/types.h>
#if HAVE_PTY_H
# include <pty.h>
#endif
dnl We assume that openpty exists (possibly in libc, possibly in libutil)
dnl if and only if it is declared.
AC_CHECK_DECLS([openpty],,, [[
+/* <sys/types.h> is a prerequisite of <libutil.h> on FreeBSD 8.0. */
+#include <sys/types.h>
#if HAVE_PTY_H
# include <pty.h>
#endif
[gl_cv_func_openpty_const],
[AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([[
+/* <sys/types.h> is a prerequisite of <libutil.h> on FreeBSD 8.0. */
+#include <sys/types.h>
#if HAVE_PTY_H
# include <pty.h>
#endif
[
AC_REQUIRE([gl_PTY_LIB])
- AC_CHECK_FUNCS_ONCE([login_tty])
+ gl_saved_libs="$LIBS"
+ LIBS="$LIBS $PTY_LIB"
+ AC_CHECK_FUNCS([login_tty])
+ LIBS="$gl_saved_LIBS"
if test $ac_cv_func_login_tty = no; then
AC_LIBOBJ([login_tty])
fi
-# pty_h.m4 serial 9
+# pty_h.m4 serial 10
dnl Copyright (C) 2009, 2010 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 Check for declarations of anything we want to poison if the
dnl corresponding gnulib module is not in use.
gl_WARN_ON_USE_PREPARE([[
+/* <sys/types.h> is a prerequisite of <libutil.h> on FreeBSD 8.0. */
+#include <sys/types.h>
#if HAVE_PTY_H
# include <pty.h>
#endif
-# readutmp.m4 serial 16
+# readutmp.m4 serial 17
dnl Copyright (C) 2002-2010 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
AC_REQUIRE([AC_C_INLINE])
AC_CHECK_FUNCS_ONCE([utmpname utmpxname])
AC_CHECK_DECLS([getutent],,,[
+/* <sys/types.h> is a prerequisite of <utmp.h> on FreeBSD 8.0, OpenBSD 4.6. */
+#include <sys/types.h>
#ifdef HAVE_UTMP_H
# include <utmp.h>
#endif
])
utmp_includes="\
-$ac_includes_default
+AC_INCLUDES_DEFAULT
#ifdef HAVE_UTMPX_H
# include <utmpx.h>
#endif
-# realloc.m4 serial 10
+# realloc.m4 serial 11
dnl Copyright (C) 2007, 2009, 2010 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
dnl _AC_FUNC_REALLOC_IF is defined in Autoconf.
_AC_FUNC_REALLOC_IF(
- [AC_DEFINE([HAVE_REALLOC], [1],
+ [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], [0])
+ [AC_DEFINE([HAVE_REALLOC_GNU], [0])
gl_REPLACE_REALLOC
])
])# gl_FUNC_REALLOC_GNU
if (! REG_STARTEND)
return 1;
- /* Reject hosts whose regoff_t values are too narrow.
- These include glibc 2.3.5 on hosts with 64-bit ptrdiff_t
- and 32-bit int. */
+#if 0
+ /* It would be nice to reject hosts whose regoff_t values are too
+ narrow (including glibc on hosts with 64-bit ptrdiff_t and
+ 32-bit int), but we should wait until glibc implements this
+ feature. Otherwise, support for equivalence classes and
+ multibyte collation symbols would always be broken except
+ when compiling --without-included-regex. */
if (sizeof (regoff_t) < sizeof (ptrdiff_t)
|| sizeof (regoff_t) < sizeof (ssize_t))
return 1;
+#endif
return 0;]])],
[gl_cv_func_re_compile_pattern_working=yes],
-# serial 1 -*- Autoconf -*-
+# serial 2 -*- Autoconf -*-
# Copyright (C) 2006-2007, 2009-2010 Free Software Foundation, Inc.
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
AC_DEFUN([gl_HEADERS_SELINUX_CONTEXT_H],
[
- AC_CHECK_HEADERS([selinux/context.h],
- [SELINUX_CONTEXT_H=],
- [SELINUX_CONTEXT_H=selinux/context.h])
+ AC_REQUIRE([gl_LIBSELINUX])
+ if test "$with_selinux" != no; then
+ AC_CHECK_HEADERS([selinux/context.h],
+ [SELINUX_CONTEXT_H=],
+ [SELINUX_CONTEXT_H=selinux/context.h])
+ else
+ SELINUX_CONTEXT_H=selinux/context.h
+ fi
AC_SUBST([SELINUX_CONTEXT_H])
])
-# serial 3 -*- Autoconf -*-
+# serial 4 -*- Autoconf -*-
# Copyright (C) 2006-2007, 2009-2010 Free Software Foundation, Inc.
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
AC_DEFUN([gl_HEADERS_SELINUX_SELINUX_H],
[
AC_REQUIRE([gl_LIBSELINUX])
- AC_CHECK_HEADERS([selinux/selinux.h])
-
- if test "$ac_cv_header_selinux_selinux_h" = yes; then
- # We do have <selinux/selinux.h>, so do compile getfilecon.c
- # and arrange to use its wrappers.
- AC_LIBOBJ([getfilecon])
- gl_CHECK_NEXT_HEADERS([selinux/selinux.h])
- AC_DEFINE([getfilecon], [rpl_getfilecon],
- [Always use our getfilecon wrapper.])
- AC_DEFINE([lgetfilecon], [rpl_lgetfilecon],
- [Always use our lgetfilecon wrapper.])
- AC_DEFINE([fgetfilecon], [rpl_fgetfilecon],
- [Always use our fgetfilecon wrapper.])
- fi
+ if test "$with_selinux" != no; then
+ AC_CHECK_HEADERS([selinux/selinux.h])
+
+ if test "$ac_cv_header_selinux_selinux_h" = yes; then
+ # We do have <selinux/selinux.h>, so do compile getfilecon.c
+ # and arrange to use its wrappers.
+ AC_LIBOBJ([getfilecon])
+ gl_CHECK_NEXT_HEADERS([selinux/selinux.h])
+ AC_DEFINE([getfilecon], [rpl_getfilecon],
+ [Always use our getfilecon wrapper.])
+ AC_DEFINE([lgetfilecon], [rpl_lgetfilecon],
+ [Always use our lgetfilecon wrapper.])
+ AC_DEFINE([fgetfilecon], [rpl_fgetfilecon],
+ [Always use our fgetfilecon wrapper.])
+ fi
- case "$ac_cv_search_setfilecon:$ac_cv_header_selinux_selinux_h" in
- no:*) # already warned
- ;;
- *:no)
- AC_MSG_WARN([libselinux was found but selinux/selinux.h is missing.])
- AC_MSG_WARN([AC_PACKAGE_NAME will be compiled without SELinux support.])
- esac
+ case "$ac_cv_search_setfilecon:$ac_cv_header_selinux_selinux_h" in
+ no:*) # already warned
+ ;;
+ *:no)
+ AC_MSG_WARN([libselinux was found but selinux/selinux.h is missing.])
+ AC_MSG_WARN([AC_PACKAGE_NAME will be compiled without SELinux support.])
+ esac
+ else
+ # Do as if <selinux/selinux.h> does not exist, even if
+ # AC_CHECK_HEADERS_ONCE has already determined that it exists.
+ AC_DEFINE([HAVE_SELINUX_SELINUX_H], [0])
+ fi
])
AC_DEFUN([gl_LIBSELINUX],
[
AC_REQUIRE([AC_CANONICAL_HOST])
AC_REQUIRE([AC_CANONICAL_BUILD])
+
+ AC_ARG_WITH([selinux],
+ AS_HELP_STRING([--without-selinux], [do not use SELinux, even on systems with SELinux]),
+ [], [with_selinux=maybe])
+
LIB_SELINUX=
- gl_save_LIBS=$LIBS
- AC_SEARCH_LIBS([setfilecon], [selinux],
- [test "$ac_cv_search_setfilecon" = "none required" ||
- LIB_SELINUX=$ac_cv_search_setfilecon])
+ if test "$with_selinux" != no; then
+ gl_save_LIBS=$LIBS
+ AC_SEARCH_LIBS([setfilecon], [selinux],
+ [test "$ac_cv_search_setfilecon" = "none required" ||
+ LIB_SELINUX=$ac_cv_search_setfilecon])
+ LIBS=$gl_save_LIBS
+ fi
AC_SUBST([LIB_SELINUX])
- LIBS=$gl_save_LIBS
# Warn if SELinux is found but libselinux is absent;
if test "$ac_cv_search_setfilecon" = no &&
-# servent.m4 serial 1
-dnl Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc.
+# servent.m4 serial 2
+dnl Copyright (C) 2008, 2010 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.
[gl_cv_w32_getservbyname=no
gl_save_LIBS="$LIBS"
LIBS="$LIBS -lws2_32"
- AC_TRY_LINK([
+ AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[
#ifdef HAVE_WINSOCK2_H
#include <winsock2.h>
#endif
#include <stddef.h>
-], [getservbyname(NULL,NULL);], [gl_cv_w32_getservbyname=yes])
+ ]],
+ [[getservbyname(NULL,NULL);]])],
+ [gl_cv_w32_getservbyname=yes])
LIBS="$gl_save_LIBS"
])
if test "$gl_cv_w32_getservbyname" = "yes"; then
-# setenv.m4 serial 16
+# setenv.m4 serial 18
dnl Copyright (C) 2001-2004, 2006-2010 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
else
dnl Some BSDs return void, failing to do error checking.
AC_CACHE_CHECK([for unsetenv() return type], [gt_cv_func_unsetenv_ret],
- [AC_TRY_COMPILE([#include <stdlib.h>
+ [AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[
+#include <stdlib.h>
extern
#ifdef __cplusplus
"C"
#else
int unsetenv();
#endif
-], , gt_cv_func_unsetenv_ret='int', gt_cv_func_unsetenv_ret='void')])
+ ]],
+ [[]])],
+ [gt_cv_func_unsetenv_ret='int'],
+ [gt_cv_func_unsetenv_ret='void'])])
if test $gt_cv_func_unsetenv_ret = 'void'; then
AC_DEFINE([VOID_UNSETENV], [1], [Define to 1 if unsetenv returns void
instead of int.])
fi
dnl Solaris 10 unsetenv does not remove all copies of a name.
- AC_CACHE_CHECK([whether unsetenv works on duplicates],
+ dnl OpenBSD 4.7 unsetenv("") does not fail.
+ AC_CACHE_CHECK([whether unsetenv obeys POSIX],
[gl_cv_func_unsetenv_works],
[AC_RUN_IFELSE([AC_LANG_PROGRAM([[
#include <stdlib.h>
+ #include <errno.h>
]], [[
char entry[] = "b=2";
if (putenv ((char *) "a=1")) return 1;
entry[0] = 'a';
unsetenv ("a");
if (getenv ("a")) return 3;
+ if (!unsetenv ("") || errno != EINVAL) return 4;
]])],
[gl_cv_func_unsetenv_works=yes], [gl_cv_func_unsetenv_works=no],
[gl_cv_func_unsetenv_works="guessing no"])])
-# signbit.m4 serial 6
+# signbit.m4 serial 7
dnl Copyright (C) 2007-2010 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
AC_REQUIRE([gl_MATH_H_DEFAULTS])
AC_CACHE_CHECK([for signbit macro], [gl_cv_func_signbit],
[
- AC_TRY_RUN([
+ AC_RUN_IFELSE(
+ [AC_LANG_SOURCE([[
#include <math.h>
/* If signbit is defined as a function, don't use it, since calling it for
'float' or 'long double' arguments would involve conversions.
#endif
#include <string.h>
]gl_SIGNBIT_TEST_PROGRAM
-, [gl_cv_func_signbit=yes], [gl_cv_func_signbit=no],
+])],
+ [gl_cv_func_signbit=yes],
+ [gl_cv_func_signbit=no],
[gl_cv_func_signbit="guessing no"])
])
dnl GCC 4.0 and newer provides three built-ins for signbit.
dnl libc.
AC_CACHE_CHECK([for signbit compiler built-ins], [gl_cv_func_signbit_gcc],
[
- AC_TRY_RUN([
+ AC_RUN_IFELSE(
+ [AC_LANG_SOURCE([[
#if __GNUC__ >= 4
# define signbit(x) \
(sizeof (x) == sizeof (long double) ? __builtin_signbitl (x) : \
#endif
#include <string.h>
]gl_SIGNBIT_TEST_PROGRAM
-, [gl_cv_func_signbit_gcc=yes], [gl_cv_func_signbit_gcc=no],
+])],
+ [gl_cv_func_signbit_gcc=yes],
+ [gl_cv_func_signbit_gcc=no],
[gl_cv_func_signbit_gcc="guessing no"])
])
dnl Use the compiler built-ins whenever possible, because they are more
AC_CACHE_CHECK([whether copysignf can be used without linking with libm],
[gl_cv_func_copysignf_no_libm],
[
- AC_TRY_LINK([#include <math.h>
- float x, y;],
- [return copysignf (x, y) < 0;],
+ AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[#include <math.h>
+ float x, y;]],
+ [[return copysignf (x, y) < 0;]])],
[gl_cv_func_copysignf_no_libm=yes],
[gl_cv_func_copysignf_no_libm=no])
])
AC_CACHE_CHECK([whether copysign can be used without linking with libm],
[gl_cv_func_copysign_no_libm],
[
- AC_TRY_LINK([#include <math.h>
- double x, y;],
- [return copysign (x, y) < 0;],
+ AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[#include <math.h>
+ double x, y;]],
+ [[return copysign (x, y) < 0;]])],
[gl_cv_func_copysign_no_libm=yes],
[gl_cv_func_copysign_no_libm=no])
])
AC_CACHE_CHECK([whether copysignl can be used without linking with libm],
[gl_cv_func_copysignl_no_libm],
[
- AC_TRY_LINK([#include <math.h>
- long double x, y;],
- [return copysignl (x, y) < 0;],
+ AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[#include <math.h>
+ long double x, y;]],
+ [[return copysignl (x, y) < 0;]])],
[gl_cv_func_copysignl_no_libm=yes],
[gl_cv_func_copysignl_no_libm=no])
])
AC_CACHE_CHECK([where to find the sign bit in a '$1'],
[$2],
[
- AC_TRY_RUN([
+ AC_RUN_IFELSE(
+ [AC_LANG_SOURCE([[
#include <stddef.h>
#include <stdio.h>
#define NWORDS \
fprintf (fp, "word %d bit %d", (int) k, (int) i);
return (fclose (fp) != 0);
}
- ],
+ ]])],
[$2=`cat conftest.out`],
[$2="unknown"],
[
-# sinl.m4 serial 2
+# sinl.m4 serial 3
dnl Copyright (C) 2010 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
AC_CACHE_CHECK([whether sinl() can be used without linking with libm],
[gl_cv_func_sinl_no_libm],
[
- AC_TRY_LINK([#ifndef __NO_MATH_INLINES
- # define __NO_MATH_INLINES 1 /* for glibc */
- #endif
- #include <math.h>
- long double x;],
- [return sinl (x) > 0.4;],
+ AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[#ifndef __NO_MATH_INLINES
+ # define __NO_MATH_INLINES 1 /* for glibc */
+ #endif
+ #include <math.h>
+ long double x;]],
+ [[return sinl (x) > 0.4;]])],
[gl_cv_func_sinl_no_libm=yes],
[gl_cv_func_sinl_no_libm=no])
])
[
save_LIBS="$LIBS"
LIBS="$LIBS -lm"
- AC_TRY_LINK([#ifndef __NO_MATH_INLINES
- # define __NO_MATH_INLINES 1 /* for glibc */
- #endif
- #include <math.h>
- long double x;],
- [return sinl (x) > 0.4;],
+ AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[#ifndef __NO_MATH_INLINES
+ # define __NO_MATH_INLINES 1 /* for glibc */
+ #endif
+ #include <math.h>
+ long double x;]],
+ [[return sinl (x) > 0.4;]])],
[gl_cv_func_sinl_in_libm=yes],
[gl_cv_func_sinl_in_libm=no])
LIBS="$save_LIBS"
-# size_max.m4 serial 9
+# size_max.m4 serial 10
dnl Copyright (C) 2003, 2005-2006, 2008-2010 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
if test $fits_in_uint = 1; then
dnl Even though SIZE_MAX fits in an unsigned int, it must be of type
dnl 'unsigned long' if the type 'size_t' is the same as 'unsigned long'.
- AC_TRY_COMPILE([#include <stddef.h>
- extern size_t foo;
- extern unsigned long foo;
- ], [], [fits_in_uint=0])
+ AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[#include <stddef.h>
+ extern size_t foo;
+ extern unsigned long foo;
+ ]],
+ [[]])],
+ [fits_in_uint=0])
fi
dnl We cannot use 'expr' to simplify this expression, because 'expr'
dnl works only with 'long' integers in the host environment, while we
--- /dev/null
+# socketlib.m4 serial 1
+dnl Copyright (C) 2008-2010 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+dnl gl_SOCKETLIB
+dnl Determines the library to use for socket functions.
+dnl Sets and AC_SUBSTs LIBSOCKET.
+
+AC_DEFUN([gl_SOCKETLIB],
+[
+ gl_PREREQ_SYS_H_WINSOCK2 dnl for HAVE_WINSOCK2_H
+ LIBSOCKET=
+ if test $HAVE_WINSOCK2_H = 1; then
+ dnl Native Windows API (not Cygwin).
+ AC_CACHE_CHECK([if we need to call WSAStartup in winsock2.h and -lws2_32],
+ [gl_cv_func_wsastartup], [
+ gl_save_LIBS="$LIBS"
+ LIBS="$LIBS -lws2_32"
+ AC_LINK_IFELSE([AC_LANG_PROGRAM([[
+#ifdef HAVE_WINSOCK2_H
+# include <winsock2.h>
+#endif]], [[
+ WORD wVersionRequested = MAKEWORD(1, 1);
+ WSADATA wsaData;
+ int err = WSAStartup(wVersionRequested, &wsaData);
+ WSACleanup ();]])],
+ gl_cv_func_wsastartup=yes, gl_cv_func_wsastartup=no)
+ LIBS="$gl_save_LIBS"
+ ])
+ if test "$gl_cv_func_wsastartup" = "yes"; then
+ AC_DEFINE([WINDOWS_SOCKETS], [1], [Define if WSAStartup is needed.])
+ LIBSOCKET='-lws2_32'
+ fi
+ else
+ dnl Unix API.
+ dnl Solaris has most socket functions in libsocket.
+ dnl Haiku has most socket functions in libnetwork.
+ dnl BeOS has most socket functions in libnet.
+ AC_CACHE_CHECK([for library containing setsockopt], [gl_cv_lib_socket], [
+ gl_cv_lib_socket=
+ AC_LINK_IFELSE([AC_LANG_PROGRAM([[extern
+#ifdef __cplusplus
+"C"
+#endif
+char setsockopt();]], [[setsockopt();]])],
+ [],
+ [gl_save_LIBS="$LIBS"
+ LIBS="$gl_save_LIBS -lsocket"
+ AC_LINK_IFELSE([AC_LANG_PROGRAM([[extern
+#ifdef __cplusplus
+"C"
+#endif
+char setsockopt();]], [[setsockopt();]])],
+ [gl_cv_lib_socket="-lsocket"])
+ if test -z "$gl_cv_lib_socket"; then
+ LIBS="$gl_save_LIBS -lnetwork"
+ AC_LINK_IFELSE([AC_LANG_PROGRAM([[extern
+#ifdef __cplusplus
+"C"
+#endif
+char setsockopt();]], [[setsockopt();]])],
+ [gl_cv_lib_socket="-lnetwork"])
+ if test -z "$gl_cv_lib_socket"; then
+ LIBS="$gl_save_LIBS -lnet"
+ AC_LINK_IFELSE([AC_LANG_PROGRAM([[extern
+#ifdef __cplusplus
+"C"
+#endif
+char setsockopt();]], [[setsockopt();]])],
+ [gl_cv_lib_socket="-lnet"])
+ fi
+ fi
+ LIBS="$gl_save_LIBS"
+ ])
+ if test -z "$gl_cv_lib_socket"; then
+ gl_cv_lib_socket="none needed"
+ fi
+ ])
+ if test "$gl_cv_lib_socket" != "none needed"; then
+ LIBSOCKET="$gl_cv_lib_socket"
+ fi
+ fi
+ AC_SUBST([LIBSOCKET])
+])
-# sockets.m4 serial 6
+# sockets.m4 serial 7
dnl Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
AC_DEFUN([gl_SOCKETS],
[
AC_REQUIRE([AC_C_INLINE])
-
- gl_PREREQ_SYS_H_WINSOCK2 dnl for HAVE_WINSOCK2_H
- LIBSOCKET=
- if test $HAVE_WINSOCK2_H = 1; then
- dnl Native Windows API (not Cygwin).
- AC_CACHE_CHECK([if we need to call WSAStartup in winsock2.h and -lws2_32],
- [gl_cv_func_wsastartup], [
- gl_save_LIBS="$LIBS"
- LIBS="$LIBS -lws2_32"
- AC_LINK_IFELSE([AC_LANG_PROGRAM([[
-#ifdef HAVE_WINSOCK2_H
-# include <winsock2.h>
-#endif]], [[
- WORD wVersionRequested = MAKEWORD(1, 1);
- WSADATA wsaData;
- int err = WSAStartup(wVersionRequested, &wsaData);
- WSACleanup ();]])],
- gl_cv_func_wsastartup=yes, gl_cv_func_wsastartup=no)
- LIBS="$gl_save_LIBS"
- ])
- if test "$gl_cv_func_wsastartup" = "yes"; then
- AC_DEFINE([WINDOWS_SOCKETS], [1], [Define if WSAStartup is needed.])
- LIBSOCKET='-lws2_32'
- fi
- else
- dnl Unix API.
- dnl Solaris has most socket functions in libsocket.
- dnl Haiku has most socket functions in libnetwork.
- dnl BeOS has most socket functions in libnet.
- AC_CACHE_CHECK([for library containing setsockopt], [gl_cv_lib_socket], [
- gl_cv_lib_socket=
- AC_LINK_IFELSE([AC_LANG_PROGRAM([[extern
-#ifdef __cplusplus
-"C"
-#endif
-char setsockopt();]], [[setsockopt();]])],
- [],
- [gl_save_LIBS="$LIBS"
- LIBS="$gl_save_LIBS -lsocket"
- AC_LINK_IFELSE([AC_LANG_PROGRAM([[extern
-#ifdef __cplusplus
-"C"
-#endif
-char setsockopt();]], [[setsockopt();]])],
- [gl_cv_lib_socket="-lsocket"])
- if test -z "$gl_cv_lib_socket"; then
- LIBS="$gl_save_LIBS -lnetwork"
- AC_LINK_IFELSE([AC_LANG_PROGRAM([[extern
-#ifdef __cplusplus
-"C"
-#endif
-char setsockopt();]], [[setsockopt();]])],
- [gl_cv_lib_socket="-lnetwork"])
- if test -z "$gl_cv_lib_socket"; then
- LIBS="$gl_save_LIBS -lnet"
- AC_LINK_IFELSE([AC_LANG_PROGRAM([[extern
-#ifdef __cplusplus
-"C"
-#endif
-char setsockopt();]], [[setsockopt();]])],
- [gl_cv_lib_socket="-lnet"])
- fi
- fi
- LIBS="$gl_save_LIBS"
- ])
- if test -z "$gl_cv_lib_socket"; then
- gl_cv_lib_socket="none needed"
- fi
- ])
- if test "$gl_cv_lib_socket" != "none needed"; then
- LIBSOCKET="$gl_cv_lib_socket"
- fi
- fi
- AC_SUBST([LIBSOCKET])
+ AC_REQUIRE([gl_SOCKETLIB])
gl_PREREQ_SOCKETS
])
-# sqrtl.m4 serial 2
+# sqrtl.m4 serial 3
dnl Copyright (C) 2010 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
AC_CACHE_CHECK([whether sqrtl() can be used without linking with libm],
[gl_cv_func_sqrtl_no_libm],
[
- AC_TRY_LINK([#ifndef __NO_MATH_INLINES
- # define __NO_MATH_INLINES 1 /* for glibc */
- #endif
- #include <math.h>
- long double x;],
- [return sqrtl (x) > 0.4;],
+ AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[#ifndef __NO_MATH_INLINES
+ # define __NO_MATH_INLINES 1 /* for glibc */
+ #endif
+ #include <math.h>
+ long double x;]],
+ [[return sqrtl (x) > 0.4;]])],
[gl_cv_func_sqrtl_no_libm=yes],
[gl_cv_func_sqrtl_no_libm=no])
])
[
save_LIBS="$LIBS"
LIBS="$LIBS -lm"
- AC_TRY_LINK([#ifndef __NO_MATH_INLINES
- # define __NO_MATH_INLINES 1 /* for glibc */
- #endif
- #include <math.h>
- long double x;],
- [return sqrtl (x) > 0.4;],
+ AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[#ifndef __NO_MATH_INLINES
+ # define __NO_MATH_INLINES 1 /* for glibc */
+ #endif
+ #include <math.h>
+ long double x;]],
+ [[return sqrtl (x) > 0.4;]])],
[gl_cv_func_sqrtl_in_libm=yes],
[gl_cv_func_sqrtl_in_libm=no])
LIBS="$save_LIBS"
-# ssize_t.m4 serial 4 (gettext-0.15)
-dnl Copyright (C) 2001-2003, 2006, 2009-2010 Free Software Foundation, Inc.
+# ssize_t.m4 serial 5 (gettext-0.18.2)
+dnl Copyright (C) 2001-2003, 2006, 2010 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([gt_TYPE_SSIZE_T],
[
AC_CACHE_CHECK([for ssize_t], [gt_cv_ssize_t],
- [AC_TRY_COMPILE([#include <sys/types.h>],
- [int x = sizeof (ssize_t *) + sizeof (ssize_t);
- return !x;],
+ [AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[#include <sys/types.h>]],
+ [[int x = sizeof (ssize_t *) + sizeof (ssize_t);
+ return !x;]])],
[gt_cv_ssize_t=yes], [gt_cv_ssize_t=no])])
if test $gt_cv_ssize_t = no; then
AC_DEFINE([ssize_t], [int],
-# stdarg.m4 serial 3
+# stdarg.m4 serial 4
dnl Copyright (C) 2006, 2008-2010 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
NEXT_STDARG_H='<stdarg.h>'; AC_SUBST([NEXT_STDARG_H])
AC_MSG_CHECKING([for va_copy])
AC_CACHE_VAL([gl_cv_func_va_copy], [
- AC_TRY_COMPILE([#include <stdarg.h>], [
+ AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[#include <stdarg.h>]],
+ [[
#ifndef va_copy
void (*func) (va_list, va_list) = va_copy;
#endif
-],
- [gl_cv_func_va_copy=yes], [gl_cv_func_va_copy=no])])
+ ]])],
+ [gl_cv_func_va_copy=yes],
+ [gl_cv_func_va_copy=no])])
AC_MSG_RESULT([$gl_cv_func_va_copy])
if test $gl_cv_func_va_copy = no; then
dnl Provide a substitute.
dnl Provide a substitute in <config.h>, either __va_copy or as a simple
dnl assignment.
gl_CACHE_VAL_SILENT([gl_cv_func___va_copy], [
- AC_TRY_COMPILE([#include <stdarg.h>], [
+ AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[#include <stdarg.h>]],
+ [[
#ifndef __va_copy
error, bail out
#endif
-],
- [gl_cv_func___va_copy=yes], [gl_cv_func___va_copy=no])])
+ ]])],
+ [gl_cv_func___va_copy=yes],
+ [gl_cv_func___va_copy=no])])
if test $gl_cv_func___va_copy = yes; then
AC_DEFINE([va_copy], [__va_copy],
[Define as a macro for copying va_list variables.])
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
-#serial 2
+#serial 3
# Prepare for substituting <stdbool.h> if it is not supported.
AC_DEFUN([AC_HEADER_STDBOOL],
[AC_CACHE_CHECK([for stdbool.h that conforms to C99],
[ac_cv_header_stdbool_h],
- [AC_TRY_COMPILE(
- [
- #include <stdbool.h>
- #ifndef bool
- "error: bool is not defined"
- #endif
- #ifndef false
- "error: false is not defined"
- #endif
- #if false
- "error: false is not 0"
- #endif
- #ifndef true
- "error: true is not defined"
- #endif
- #if true != 1
- "error: true is not 1"
- #endif
- #ifndef __bool_true_false_are_defined
- "error: __bool_true_false_are_defined is not defined"
- #endif
+ [AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[
+ #include <stdbool.h>
+ #ifndef bool
+ "error: bool is not defined"
+ #endif
+ #ifndef false
+ "error: false is not defined"
+ #endif
+ #if false
+ "error: false is not 0"
+ #endif
+ #ifndef true
+ "error: true is not defined"
+ #endif
+ #if true != 1
+ "error: true is not 1"
+ #endif
+ #ifndef __bool_true_false_are_defined
+ "error: __bool_true_false_are_defined is not defined"
+ #endif
- struct s { _Bool s: 1; _Bool t; } s;
+ struct s { _Bool s: 1; _Bool t; } s;
- char a[true == 1 ? 1 : -1];
- char b[false == 0 ? 1 : -1];
- char c[__bool_true_false_are_defined == 1 ? 1 : -1];
- char d[(bool) 0.5 == true ? 1 : -1];
- /* See body of main program for 'e'. */
- char f[(_Bool) 0.0 == false ? 1 : -1];
- char g[true];
- char h[sizeof (_Bool)];
- char i[sizeof s.t];
- enum { j = false, k = true, l = false * true, m = true * 256 };
- /* The following fails for
- HP aC++/ANSI C B3910B A.05.55 [Dec 04 2003]. */
- _Bool n[m];
- char o[sizeof n == m * sizeof n[0] ? 1 : -1];
- char p[-1 - (_Bool) 0 < 0 && -1 - (bool) 0 < 0 ? 1 : -1];
- /* Catch a bug in an HP-UX C compiler. See
- http://gcc.gnu.org/ml/gcc-patches/2003-12/msg02303.html
- http://lists.gnu.org/archive/html/bug-coreutils/2005-11/msg00161.html
- */
- _Bool q = true;
- _Bool *pq = &q;
- ],
- [
- bool e = &s;
- *pq |= q;
- *pq |= ! q;
- /* Refer to every declared value, to avoid compiler optimizations. */
- return (!a + !b + !c + !d + !e + !f + !g + !h + !i + !!j + !k + !!l
- + !m + !n + !o + !p + !q + !pq);
- ],
+ char a[true == 1 ? 1 : -1];
+ char b[false == 0 ? 1 : -1];
+ char c[__bool_true_false_are_defined == 1 ? 1 : -1];
+ char d[(bool) 0.5 == true ? 1 : -1];
+ /* See body of main program for 'e'. */
+ char f[(_Bool) 0.0 == false ? 1 : -1];
+ char g[true];
+ char h[sizeof (_Bool)];
+ char i[sizeof s.t];
+ enum { j = false, k = true, l = false * true, m = true * 256 };
+ /* The following fails for
+ HP aC++/ANSI C B3910B A.05.55 [Dec 04 2003]. */
+ _Bool n[m];
+ char o[sizeof n == m * sizeof n[0] ? 1 : -1];
+ char p[-1 - (_Bool) 0 < 0 && -1 - (bool) 0 < 0 ? 1 : -1];
+ /* Catch a bug in an HP-UX C compiler. See
+ http://gcc.gnu.org/ml/gcc-patches/2003-12/msg02303.html
+ http://lists.gnu.org/archive/html/bug-coreutils/2005-11/msg00161.html
+ */
+ _Bool q = true;
+ _Bool *pq = &q;
+ ]],
+ [[
+ bool e = &s;
+ *pq |= q;
+ *pq |= ! q;
+ /* Refer to every declared value, to avoid compiler optimizations. */
+ return (!a + !b + !c + !d + !e + !f + !g + !h + !i + !!j + !k + !!l
+ + !m + !n + !o + !p + !q + !pq);
+ ]])],
[ac_cv_header_stdbool_h=yes],
[ac_cv_header_stdbool_h=no])])
AC_CHECK_TYPES([_Bool])
-# stdint_h.m4 serial 8
+# stdint_h.m4 serial 9
dnl Copyright (C) 1997-2004, 2006, 2008-2010 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
AC_DEFUN([gl_AC_HEADER_STDINT_H],
[
AC_CACHE_CHECK([for stdint.h], [gl_cv_header_stdint_h],
- [AC_TRY_COMPILE(
- [#include <sys/types.h>
-#include <stdint.h>],
- [uintmax_t i = (uintmax_t) -1; return !i;],
- [gl_cv_header_stdint_h=yes],
- [gl_cv_header_stdint_h=no])])
+ [AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[#include <sys/types.h>
+ #include <stdint.h>]],
+ [[uintmax_t i = (uintmax_t) -1; return !i;]])],
+ [gl_cv_header_stdint_h=yes],
+ [gl_cv_header_stdint_h=no])])
if test $gl_cv_header_stdint_h = yes; then
AC_DEFINE_UNQUOTED([HAVE_STDINT_H_WITH_UINTMAX], [1],
[Define if <stdint.h> exists, doesn't clash with <sys/types.h>,
-# stdlib_h.m4 serial 30
+# stdlib_h.m4 serial 31
dnl Copyright (C) 2007-2010 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
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])
dnl Assume proper GNU behavior unless another module says otherwise.
AC_CHECK_FUNCS_ONCE([stpncpy])
if test $ac_cv_func_stpncpy = yes; then
AC_CACHE_CHECK([for working stpncpy], [gl_cv_func_stpncpy], [
- AC_TRY_RUN([
+ AC_RUN_IFELSE(
+ [AC_LANG_SOURCE([[
#include <stdlib.h>
#include <string.h> /* for strcpy */
/* The stpncpy prototype is missing in <string.h> on AIX 4. */
if (stpncpy (dest, src, 7) != dest + 5) exit(1);
exit(0);
}
-], [gl_cv_func_stpncpy=yes], [gl_cv_func_stpncpy=no],
+]])],
+ [gl_cv_func_stpncpy=yes],
+ [gl_cv_func_stpncpy=no],
[AC_EGREP_CPP([Thanks for using GNU], [
#include <features.h>
#ifdef __GNU_LIBRARY__
-# strcasestr.m4 serial 13
+# strcasestr.m4 serial 16
dnl Copyright (C) 2005, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
else
if test "$gl_cv_func_memchr_works" != yes; then
REPLACE_STRCASESTR=1
+ else
+ dnl Detect http://sourceware.org/bugzilla/show_bug.cgi?id=12092.
+ AC_CACHE_CHECK([whether strcasestr works],
+ [gl_cv_func_strcasestr_works_always],
+ [AC_RUN_IFELSE([AC_LANG_PROGRAM([[
+#include <string.h> /* for strcasestr */
+#define P "_EF_BF_BD"
+#define HAYSTACK "F_BD_CE_BD" P P P P "_C3_88_20" P P P "_C3_A7_20" P
+#define NEEDLE P P P P P
+]], [[return !!strcasestr (HAYSTACK, NEEDLE);
+ ]])],
+ [gl_cv_func_strcasestr_works_always=yes],
+ [gl_cv_func_strcasestr_works_always=no],
+ [dnl glibc 2.12 and cygwin 1.7.7 have a known bug. Assume that it
+ dnl works on all other platforms, even if it is not linear.
+ AC_EGREP_CPP([Lucky user],
+ [
+#ifdef __GNU_LIBRARY__
+ #include <features.h>
+ #if (__GLIBC__ == 2 && __GLIBC_MINOR__ > 12) || (__GLIBC__ > 2)
+ Lucky user
+ #endif
+#elif defined __CYGWIN__
+ #include <cygwin/version.h>
+ #if CYGWIN_VERSION_DLL_COMBINED > CYGWIN_VERSION_DLL_MAKE_COMBINED (1007, 7)
+ Lucky user
+ #endif
+#else
+ Lucky user
+#endif
+ ],
+ [gl_cv_func_strcasestr_works_always=yes],
+ [gl_cv_func_strcasestr_works_always="guessing no"])
+ ])
+ ])
+ if test "$gl_cv_func_strcasestr_works_always" != yes; then
+ REPLACE_STRCASESTR=1
+ AC_LIBOBJ([strcasestr])
+ fi
fi
fi
if test $HAVE_STRCASESTR = 0 || test $REPLACE_STRCASESTR = 1; then
[gl_cv_func_strcasestr_linear],
[AC_RUN_IFELSE([AC_LANG_PROGRAM([[
#include <signal.h> /* for signal */
-#include <string.h> /* for memmem */
+#include <string.h> /* for strcasestr */
#include <stdlib.h> /* for malloc */
#include <unistd.h> /* for alarm */
+static void quit (int sig) { exit (sig + 128); }
]], [[size_t m = 1000000;
char *haystack = (char *) malloc (2 * m + 2);
char *needle = (char *) malloc (m + 2);
void *result = 0;
/* Failure to compile this test due to missing alarm is okay,
since all such platforms (mingw) also lack strcasestr. */
- signal (SIGALRM, SIG_DFL);
+ signal (SIGALRM, quit);
alarm (5);
/* Check for quadratic performance. */
if (haystack && needle)
}
return !result;]])],
[gl_cv_func_strcasestr_linear=yes], [gl_cv_func_strcasestr_linear=no],
- [dnl Only glibc >= 2.9 and cygwin >= 1.7.0 are known to have a
+ [dnl Only glibc > 2.12 and cygwin > 1.7.7 are known to have a
dnl strcasestr that works in linear time.
AC_EGREP_CPP([Lucky user],
[
#include <features.h>
#ifdef __GNU_LIBRARY__
- #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 9) || (__GLIBC__ > 2)
+ #if (__GLIBC__ == 2 && __GLIBC_MINOR__ > 12) || (__GLIBC__ > 2)
Lucky user
#endif
#endif
#ifdef __CYGWIN__
#include <cygwin/version.h>
- #if CYGWIN_VERSION_DLL_MAJOR >= 1007
+ #if CYGWIN_VERSION_DLL_COMBINED > CYGWIN_VERSION_DLL_MAKE_COMBINED (1007, 7)
Lucky user
#endif
#endif
-# strsignal.m4 serial 3
+# strsignal.m4 serial 4
dnl Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
[AC_RUN_IFELSE(
[AC_LANG_PROGRAM(
[[#include <string.h>
+#include <unistd.h> /* NetBSD 5.0 declares it in wrong header. */
]],
[[char *s = strsignal (-1);
return !(s != (char *) 0 && s != (char *) -1);]])],
-# strstr.m4 serial 7
+# strstr.m4 serial 10
dnl Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
if test "$gl_cv_func_memchr_works" != yes; then
REPLACE_STRSTR=1
AC_LIBOBJ([strstr])
+ else
+ dnl Detect http://sourceware.org/bugzilla/show_bug.cgi?id=12092.
+ AC_CACHE_CHECK([whether strstr works],
+ [gl_cv_func_strstr_works_always],
+ [AC_RUN_IFELSE([AC_LANG_PROGRAM([[
+#include <string.h> /* for strstr */
+#define P "_EF_BF_BD"
+#define HAYSTACK "F_BD_CE_BD" P P P P "_C3_88_20" P P P "_C3_A7_20" P
+#define NEEDLE P P P P P
+]], [[return !!strstr (HAYSTACK, NEEDLE);
+ ]])],
+ [gl_cv_func_strstr_works_always=yes],
+ [gl_cv_func_strstr_works_always=no],
+ [dnl glibc 2.12 and cygwin 1.7.7 have a known bug. Assume that it
+ dnl works on all other platforms, even if it is not linear.
+ AC_EGREP_CPP([Lucky user],
+ [
+#ifdef __GNU_LIBRARY__
+ #include <features.h>
+ #if (__GLIBC__ == 2 && __GLIBC_MINOR__ > 12) || (__GLIBC__ > 2)
+ Lucky user
+ #endif
+#elif defined __CYGWIN__
+ #include <cygwin/version.h>
+ #if CYGWIN_VERSION_DLL_COMBINED > CYGWIN_VERSION_DLL_MAKE_COMBINED (1007, 7)
+ Lucky user
+ #endif
+#else
+ Lucky user
+#endif
+ ],
+ [gl_cv_func_strstr_works_always=yes],
+ [gl_cv_func_strstr_works_always="guessing no"])
+ ])
+ ])
+ if test "$gl_cv_func_strstr_works_always" != yes; then
+ REPLACE_STRSTR=1
+ AC_LIBOBJ([strstr])
+ fi
fi
]) # gl_FUNC_STRSTR_SIMPLE
[gl_cv_func_strstr_linear],
[AC_RUN_IFELSE([AC_LANG_PROGRAM([[
#include <signal.h> /* for signal */
-#include <string.h> /* for memmem */
+#include <string.h> /* for strstr */
#include <stdlib.h> /* for malloc */
#include <unistd.h> /* for alarm */
+static void quit (int sig) { exit (sig + 128); }
]], [[size_t m = 1000000;
char *haystack = (char *) malloc (2 * m + 2);
char *needle = (char *) malloc (m + 2);
void *result = 0;
/* Failure to compile this test due to missing alarm is okay,
since all such platforms (mingw) also have quadratic strstr. */
- signal (SIGALRM, SIG_DFL);
+ signal (SIGALRM, quit);
alarm (5);
/* Check for quadratic performance. */
if (haystack && needle)
}
return !result;]])],
[gl_cv_func_strstr_linear=yes], [gl_cv_func_strstr_linear=no],
- [dnl Only glibc >= 2.9 and cygwin >= 1.7.0 are known to have a
- dnl strstr that works in linear time.
+ [dnl Only glibc > 2.12 and cygwin > 1.7.7 are known to have a
+ dnl bug-free strstr that works in linear time.
AC_EGREP_CPP([Lucky user],
[
#include <features.h>
#ifdef __GNU_LIBRARY__
- #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 9) || (__GLIBC__ > 2)
+ #if (__GLIBC__ == 2 && __GLIBC_MINOR__ > 12) || (__GLIBC__ > 2)
Lucky user
#endif
#endif
#ifdef __CYGWIN__
#include <cygwin/version.h>
- #if CYGWIN_VERSION_DLL_MAJOR >= 1007
+ #if CYGWIN_VERSION_DLL_COMBINED > CYGWIN_VERSION_DLL_MAKE_COMBINED (1007, 7)
Lucky user
#endif
#endif
-# sys_wait_h.m4 serial 4
+# sys_wait_h.m4 serial 5
dnl Copyright (C) 2008-2010 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 <sys/wait.h> is always overridden, because of GNULIB_POSIXCHECK.
gl_CHECK_NEXT_HEADERS([sys/wait.h])
+
+ dnl Check for declarations of anything we want to poison if the
+ dnl corresponding gnulib module is not in use.
+ gl_WARN_ON_USE_PREPARE([[#include <sys/wait.h>]],
+ [waitpid])
])
AC_DEFUN([gl_SYS_WAIT_MODULE_INDICATOR],
dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
AC_REQUIRE([gl_SYS_WAIT_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_SYS_WAIT_H_DEFAULTS],
[
+ GNULIB_WAITPID=0; AC_SUBST([GNULIB_WAITPID])
dnl Assume proper GNU behavior unless another module says otherwise.
])
-# tanl.m4 serial 2
+# tanl.m4 serial 3
dnl Copyright (C) 2010 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
AC_CACHE_CHECK([whether tanl() can be used without linking with libm],
[gl_cv_func_tanl_no_libm],
[
- AC_TRY_LINK([#ifndef __NO_MATH_INLINES
- # define __NO_MATH_INLINES 1 /* for glibc */
- #endif
- #include <math.h>
- long double x;],
- [return tanl (x) > 0.4;],
+ AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[#ifndef __NO_MATH_INLINES
+ # define __NO_MATH_INLINES 1 /* for glibc */
+ #endif
+ #include <math.h>
+ long double x;]],
+ [[return tanl (x) > 0.4;]])],
[gl_cv_func_tanl_no_libm=yes],
[gl_cv_func_tanl_no_libm=no])
])
[
save_LIBS="$LIBS"
LIBS="$LIBS -lm"
- AC_TRY_LINK([#ifndef __NO_MATH_INLINES
- # define __NO_MATH_INLINES 1 /* for glibc */
- #endif
- #include <math.h>
- long double x;],
- [return tanl (x) > 0.4;],
+ AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[#ifndef __NO_MATH_INLINES
+ # define __NO_MATH_INLINES 1 /* for glibc */
+ #endif
+ #include <math.h>
+ long double x;]],
+ [[return tanl (x) > 0.4;]])],
[gl_cv_func_tanl_in_libm=yes],
[gl_cv_func_tanl_in_libm=no])
LIBS="$save_LIBS"
--- /dev/null
+# tcgetsid.m4 serial 1
+dnl Copyright (C) 2010 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+AC_DEFUN([gl_FUNC_TCGETSID],
+[
+ AC_REQUIRE([gl_TERMIOS_H_DEFAULTS])
+
+ dnl Persuade glibc <termios.h> to declare tcgetsid().
+ AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
+
+ AC_CHECK_FUNCS([tcgetsid])
+ if test $ac_cv_func_tcgetsid = no; then
+ HAVE_TCGETSID=0
+ AC_LIBOBJ([tcgetsid])
+ gl_PREREQ_TCGETSID
+ fi
+])
+
+# Prerequisites of lib/tcgetsid.c.
+AC_DEFUN([gl_PREREQ_TCGETSID], [
+ :
+])
--- /dev/null
+# termios_h.m4 serial 1
+dnl Copyright (C) 2010 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_TERMIOS_H],
+[
+ dnl Use AC_REQUIRE here, so that the default behavior below is expanded
+ dnl once only, before all statements that occur in other macros.
+ AC_REQUIRE([gl_TERMIOS_H_DEFAULTS])
+
+ gl_CHECK_NEXT_HEADERS([termios.h])
+
+ AC_CHECK_HEADERS_ONCE([termios.h])
+ if test $ac_cv_header_termios_h != yes; then
+ HAVE_TERMIOS_H=0
+ 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 C89.
+ gl_WARN_ON_USE_PREPARE([[#include <termios.h>]],
+ [tcgetsid])
+])
+
+AC_DEFUN([gl_TERMIOS_MODULE_INDICATOR],
+[
+ dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
+ AC_REQUIRE([gl_TERMIOS_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_TERMIOS_H_DEFAULTS],
+[
+ GNULIB_TCGETSID=0; AC_SUBST([GNULIB_TCGETSID])
+ dnl Assume proper GNU behavior unless another module says otherwise.
+ HAVE_TCGETSID=1; AC_SUBST([HAVE_TCGETSID])
+ HAVE_TERMIOS_H=1; AC_SUBST([HAVE_TERMIOS_H])
+])
-# threadlib.m4 serial 5 (gettext-0.18)
+# threadlib.m4 serial 8 (gettext-0.18.2)
dnl Copyright (C) 2005-2010 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 gl_THREADLIB
dnl ------------
dnl Tests for a multithreading library to be used.
+dnl If the configure.ac contains a definition of the gl_THREADLIB_DEFAULT_NO
+dnl (it must be placed before the invocation of gl_THREADLIB_EARLY!), then the
+dnl default is 'no', otherwise it is system dependent. In both cases, the user
+dnl can change the choice through the options --enable-threads=choice or
+dnl --disable-threads.
dnl Defines at most one of the macros USE_POSIX_THREADS, USE_SOLARIS_THREADS,
dnl USE_PTH_THREADS, USE_WIN32_THREADS
dnl Sets the variables LIBTHREAD and LTLIBTHREAD to the linker options for use
[AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])],
[AC_REQUIRE([AC_GNU_SOURCE])])
dnl Check for multithreading.
- m4_divert_text([DEFAULTS], [gl_use_threads_default=])
+ m4_ifdef([gl_THREADLIB_DEFAULT_NO],
+ [m4_divert_text([DEFAULTS], [gl_use_threads_default=no])],
+ [m4_divert_text([DEFAULTS], [gl_use_threads_default=])])
AC_ARG_ENABLE([threads],
-AC_HELP_STRING([--enable-threads={posix|solaris|pth|win32}], [specify multithreading API])
-AC_HELP_STRING([--disable-threads], [build without multithread safety]),
+AC_HELP_STRING([--enable-threads={posix|solaris|pth|win32}], [specify multithreading API])m4_ifdef([gl_THREADLIB_DEFAULT_NO], [], [
+AC_HELP_STRING([--disable-threads], [build without multithread safety])]),
[gl_use_threads=$enableval],
[if test -n "$gl_use_threads_default"; then
gl_use_threads="$gl_use_threads_default"
# groks <pthread.h>. cc also understands the flag -pthread, but
# we don't use it because 1. gcc-2.95 doesn't understand -pthread,
# 2. putting a flag into CPPFLAGS that has an effect on the linker
- # causes the AC_TRY_LINK test below to succeed unexpectedly,
+ # causes the AC_LINK_IFELSE test below to succeed unexpectedly,
# leading to wrong values of LIBTHREAD and LTLIBTHREAD.
CPPFLAGS="$CPPFLAGS -D_REENTRANT"
;;
[gl_cv_have_weak],
[gl_cv_have_weak=no
dnl First, test whether the compiler accepts it syntactically.
- AC_TRY_LINK([extern void xyzzy ();
-#pragma weak xyzzy], [xyzzy();], [gl_cv_have_weak=maybe])
+ AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[extern void xyzzy ();
+#pragma weak xyzzy]],
+ [[xyzzy();]])],
+ [gl_cv_have_weak=maybe])
if test $gl_cv_have_weak = maybe; then
dnl Second, test whether it actually works. On Cygwin 1.7.2, with
dnl gcc 4.3, symbols declared weak always evaluate to the address 0.
- AC_TRY_RUN([
+ AC_RUN_IFELSE(
+ [AC_LANG_SOURCE([[
#include <stdio.h>
#pragma weak fputs
int main ()
{
return (fputs == NULL);
-}], [gl_cv_have_weak=yes], [gl_cv_have_weak=no],
+}]])],
+ [gl_cv_have_weak=yes],
+ [gl_cv_have_weak=no],
[dnl When cross-compiling, assume that only ELF platforms support
dnl weak symbols.
AC_EGREP_CPP([Extensible Linking Format],
# Test whether both pthread_mutex_lock and pthread_mutexattr_init exist
# in libc. IRIX 6.5 has the first one in both libc and libpthread, but
# the second one only in libpthread, and lock.c needs it.
- AC_TRY_LINK([#include <pthread.h>],
- [pthread_mutex_lock((pthread_mutex_t*)0);
- pthread_mutexattr_init((pthread_mutexattr_t*)0);],
+ AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[#include <pthread.h>]],
+ [[pthread_mutex_lock((pthread_mutex_t*)0);
+ pthread_mutexattr_init((pthread_mutexattr_t*)0);]])],
[gl_have_pthread=yes])
# Test for libpthread by looking for pthread_kill. (Not pthread_self,
# since it is defined as a macro on OSF/1.)
gl_have_solaristhread=
gl_save_LIBS="$LIBS"
LIBS="$LIBS -lthread"
- AC_TRY_LINK([#include <thread.h>
-#include <synch.h>],
- [thr_self();],
+ AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[
+#include <thread.h>
+#include <synch.h>
+ ]],
+ [[thr_self();]])],
[gl_have_solaristhread=yes])
LIBS="$gl_save_LIBS"
if test -n "$gl_have_solaristhread"; then
AC_LIB_LINKFLAGS([pth])
gl_have_pth=
gl_save_LIBS="$LIBS"
- LIBS="$LIBS -lpth"
- AC_TRY_LINK([#include <pth.h>], [pth_self();], [gl_have_pth=yes])
+ LIBS="$LIBS $LIBPTH"
+ AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM([[#include <pth.h>]], [[pth_self();]])],
+ [gl_have_pth=yes])
LIBS="$gl_save_LIBS"
if test -n "$gl_have_pth"; then
gl_threads_api=pth
-# trunc.m4 serial 3
+# trunc.m4 serial 4
dnl Copyright (C) 2007, 2010 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
if test "$ac_cv_have_decl_trunc" = yes; then
dnl Test whether trunc() can be used without libm.
TRUNC_LIBM=?
- AC_TRY_LINK([
- #ifndef __NO_MATH_INLINES
- # define __NO_MATH_INLINES 1 /* for glibc */
- #endif
- #include <math.h>
- double x;],
- [x = trunc(x);],
+ AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[#ifndef __NO_MATH_INLINES
+ # define __NO_MATH_INLINES 1 /* for glibc */
+ #endif
+ #include <math.h>
+ double x;]],
+ [[x = trunc(x);]])],
[TRUNC_LIBM=])
if test "$TRUNC_LIBM" = "?"; then
save_LIBS="$LIBS"
LIBS="$LIBS -lm"
- AC_TRY_LINK([
- #ifndef __NO_MATH_INLINES
- # define __NO_MATH_INLINES 1 /* for glibc */
- #endif
- #include <math.h>
- double x;],
- [x = trunc(x);],
+ AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[#ifndef __NO_MATH_INLINES
+ # define __NO_MATH_INLINES 1 /* for glibc */
+ #endif
+ #include <math.h>
+ double x;]],
+ [[x = trunc(x);]])],
[TRUNC_LIBM="-lm"])
LIBS="$save_LIBS"
fi
-# truncf.m4 serial 2
+# truncf.m4 serial 3
dnl Copyright (C) 2007, 2010 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
if test "$ac_cv_have_decl_truncf" = yes; then
dnl Test whether truncf() can be used without libm.
TRUNCF_LIBM=?
- AC_TRY_LINK([
- #ifndef __NO_MATH_INLINES
- # define __NO_MATH_INLINES 1 /* for glibc */
- #endif
- #include <math.h>
- float x;],
- [x = truncf(x);],
+ AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[#ifndef __NO_MATH_INLINES
+ # define __NO_MATH_INLINES 1 /* for glibc */
+ #endif
+ #include <math.h>
+ float x;]],
+ [[x = truncf(x);]])],
[TRUNCF_LIBM=])
if test "$TRUNCF_LIBM" = "?"; then
save_LIBS="$LIBS"
LIBS="$LIBS -lm"
- AC_TRY_LINK([
- #ifndef __NO_MATH_INLINES
- # define __NO_MATH_INLINES 1 /* for glibc */
- #endif
- #include <math.h>
- float x;],
- [x = truncf(x);],
+ AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[#ifndef __NO_MATH_INLINES
+ # define __NO_MATH_INLINES 1 /* for glibc */
+ #endif
+ #include <math.h>
+ float x;]],
+ [[x = truncf(x);]])],
[TRUNCF_LIBM="-lm"])
LIBS="$save_LIBS"
fi
if test "$ac_cv_have_decl_truncl" = yes; then
dnl Test whether truncl() can be used without libm.
TRUNCL_LIBM=?
- AC_TRY_LINK([
- #ifndef __NO_MATH_INLINES
- # define __NO_MATH_INLINES 1 /* for glibc */
- #endif
- #include <math.h>
- long double x;],
- [x = truncl(x);],
+ AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[#ifndef __NO_MATH_INLINES
+ # define __NO_MATH_INLINES 1 /* for glibc */
+ #endif
+ #include <math.h>
+ long double x;]],
+ [[x = truncl(x);]])],
[TRUNCL_LIBM=])
if test "$TRUNCL_LIBM" = "?"; then
save_LIBS="$LIBS"
LIBS="$LIBS -lm"
- AC_TRY_LINK([
- #ifndef __NO_MATH_INLINES
- # define __NO_MATH_INLINES 1 /* for glibc */
- #endif
- #include <math.h>
- long double x;],
- [x = truncl(x);],
+ AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[#ifndef __NO_MATH_INLINES
+ # define __NO_MATH_INLINES 1 /* for glibc */
+ #endif
+ #include <math.h>
+ long double x;]],
+ [[x = truncl(x);]])],
[TRUNCL_LIBM="-lm"])
LIBS="$save_LIBS"
fi
LIBS="$LIBS $TRUNCL_LIBM"
AC_CACHE_CHECK([whether truncl works], [gl_cv_func_truncl_works],
[
- AC_TRY_RUN([
+ AC_RUN_IFELSE(
+ [AC_LANG_SOURCE([[
#include <math.h>
long double x;
int main()
{
x = truncl (0.0L);
return 0;
-}], [gl_cv_func_truncl_works=yes], [gl_cv_func_truncl_works=no],
+}]])],
+ [gl_cv_func_truncl_works=yes],
+ [gl_cv_func_truncl_works=no],
[case "$host_os" in
osf4*) gl_cv_func_truncl_works="guessing no";;
*) gl_cv_func_truncl_works="guessing yes";;
-# ttyname_r.m4 serial 3
+# ttyname_r.m4 serial 4
dnl Copyright (C) 2010 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
*) gl_cv_func_ttyname_r_works="guessing yes" ;;
esac
changequote([,])dnl
- AC_TRY_RUN([
+ AC_RUN_IFELSE(
+ [AC_LANG_SOURCE([[
#include <fcntl.h>
#include <unistd.h>
int
if (ttyname_r (fd, buf, sizeof (buf)) != 0)
return 1;
return 0;
-}], [gl_cv_func_ttyname_r_works=yes], [:], [:])
+}]])],
+ [gl_cv_func_ttyname_r_works=yes],
+ [:],
+ [:])
])
case "$gl_cv_func_ttyname_r_works" in
*yes) ;;
-# visibility.m4 serial 3 (gettext-0.18)
-dnl Copyright (C) 2005, 2008-2010 Free Software Foundation, Inc.
+# visibility.m4 serial 4 (gettext-0.18.2)
+dnl Copyright (C) 2005, 2008, 2010 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_CACHE_VAL([gl_cv_cc_vis_werror], [
gl_save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -Werror"
- AC_TRY_COMPILE([], [],
+ AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM([[]], [[]])],
[gl_cv_cc_vis_werror=yes],
[gl_cv_cc_vis_werror=no])
CFLAGS="$gl_save_CFLAGS"])
if test $gl_cv_cc_vis_werror = yes; then
CFLAGS="$CFLAGS -Werror"
fi
- AC_TRY_COMPILE(
- [extern __attribute__((__visibility__("hidden"))) int hiddenvar;
- extern __attribute__((__visibility__("default"))) int exportedvar;
- extern __attribute__((__visibility__("hidden"))) int hiddenfunc (void);
- extern __attribute__((__visibility__("default"))) int exportedfunc (void);
- void dummyfunc (void) {}],
- [],
+ AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[extern __attribute__((__visibility__("hidden"))) int hiddenvar;
+ extern __attribute__((__visibility__("default"))) int exportedvar;
+ extern __attribute__((__visibility__("hidden"))) int hiddenfunc (void);
+ extern __attribute__((__visibility__("default"))) int exportedfunc (void);
+ void dummyfunc (void) {}
+ ]],
+ [[]])],
[gl_cv_cc_visibility=yes],
[gl_cv_cc_visibility=no])
CFLAGS="$gl_save_CFLAGS"])
--- /dev/null
+# waitpid.m4 serial 1
+dnl Copyright (C) 2010 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+AC_DEFUN([gl_FUNC_WAITPID],
+[
+ AC_REQUIRE([AC_CANONICAL_HOST])
+ case $host_os in
+ mingw*)
+ AC_LIBOBJ([waitpid])
+ ;;
+ esac
+])
-# wchar_t.m4 serial 3 (gettext-0.18)
+# wchar_t.m4 serial 4 (gettext-0.18.2)
dnl Copyright (C) 2002-2003, 2008-2010 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
AC_DEFUN([gt_TYPE_WCHAR_T],
[
AC_CACHE_CHECK([for wchar_t], [gt_cv_c_wchar_t],
- [AC_TRY_COMPILE([#include <stddef.h>
- wchar_t foo = (wchar_t)'\0';], ,
- [gt_cv_c_wchar_t=yes], [gt_cv_c_wchar_t=no])])
+ [AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[#include <stddef.h>
+ wchar_t foo = (wchar_t)'\0';]],
+ [[]])],
+ [gt_cv_c_wchar_t=yes],
+ [gt_cv_c_wchar_t=no])])
if test $gt_cv_c_wchar_t = yes; then
AC_DEFINE([HAVE_WCHAR_T], [1], [Define if you have the 'wchar_t' type.])
fi
-# wcrtomb.m4 serial 5
+# wcrtomb.m4 serial 6
dnl Copyright (C) 2008-2010 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
esac
changequote([,])dnl
if test $LOCALE_FR != none || test $LOCALE_FR_UTF8 != none || test $LOCALE_JA != none || test $LOCALE_ZH_CN != none; then
- AC_TRY_RUN([
+ AC_RUN_IFELSE(
+ [AC_LANG_SOURCE([[
#include <locale.h>
#include <stdio.h>
#include <string.h>
return 1;
}
return 0;
-}],
+}]])],
[gl_cv_func_wcrtomb_retval=yes],
[gl_cv_func_wcrtomb_retval=no],
[:])
-# wcsrtombs.m4 serial 5
+# wcsrtombs.m4 serial 6
dnl Copyright (C) 2008-2010 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
esac
changequote([,])dnl
if test $LOCALE_FR != none; then
- AC_TRY_RUN([
+ AC_RUN_IFELSE(
+ [AC_LANG_SOURCE([[
#include <locale.h>
#include <stdlib.h>
#include <wchar.h>
}
}
return 0;
-}],
+}]])],
[gl_cv_func_wcsrtombs_termination=yes],
[gl_cv_func_wcsrtombs_termination=no],
[:])
esac
changequote([,])dnl
if test $LOCALE_FR != none; then
- AC_TRY_RUN([
+ AC_RUN_IFELSE(
+ [AC_LANG_SOURCE([[
#include <locale.h>
#include <stdlib.h>
#include <wchar.h>
}
}
return 0;
-}],
+}]])],
[gl_cv_func_wcsrtombs_null=yes],
[gl_cv_func_wcsrtombs_null=no],
[:])
-# wctob.m4 serial 5
+# wctob.m4 serial 6
dnl Copyright (C) 2008-2010 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
changequote([,])dnl
case "$host_os" in
cygwin*)
- AC_TRY_RUN([
+ AC_RUN_IFELSE(
+ [AC_LANG_SOURCE([[
#include <locale.h>
#include <wchar.h>
if (global != 0x12345678)
return 2;
return 0;
-}], [:], [gl_cv_func_wctob_works=no], [:])
+}]])],
+ [:],
+ [gl_cv_func_wctob_works=no],
+ [:])
;;
esac
if test "$gl_cv_func_wctob_works" != no && test $LOCALE_FR != none; then
- AC_TRY_RUN([
+ AC_RUN_IFELSE(
+ [AC_LANG_SOURCE([[
#include <locale.h>
#include <string.h>
#include <wchar.h>
return 1;
}
return 0;
-}],
+}]])],
[gl_cv_func_wctob_works=yes],
[gl_cv_func_wctob_works=no],
[:])
-# wctype_h.m4 serial 6
+# wctype_h.m4 serial 8
dnl A placeholder for ISO C99 <wctype.h>, for platforms that lack it.
fi
AC_SUBST([HAVE_ISWCNTRL])
AC_CHECK_FUNCS_ONCE([iswblank])
+ AC_CHECK_DECLS_ONCE([iswblank])
if test $ac_cv_func_iswblank = yes; then
HAVE_ISWBLANK=1
+ REPLACE_ISWBLANK=0
else
HAVE_ISWBLANK=0
+ if test $ac_cv_have_decl_iswblank = yes; then
+ REPLACE_ISWBLANK=1
+ else
+ REPLACE_ISWBLANK=0
+ fi
fi
AC_SUBST([HAVE_ISWBLANK])
+ AC_SUBST([REPLACE_ISWBLANK])
+
AC_CHECK_HEADERS_ONCE([wctype.h])
AC_REQUIRE([AC_C_INLINE])
AC_CACHE_CHECK([whether wcwidth works reasonably in UTF-8 locales],
[gl_cv_func_wcwidth_works],
[
- AC_TRY_RUN([
+ AC_RUN_IFELSE(
+ [AC_LANG_SOURCE([[
#include <locale.h>
/* AIX 3.2.5 declares wcwidth in <string.h>. */
#include <string.h>
if (wcwidth (0x0301) > 0 || wcwidth (0x200B) > 0)
return 1;
return 0;
-}], [gl_cv_func_wcwidth_works=yes], [gl_cv_func_wcwidth_works=no],
+}]])],
+ [gl_cv_func_wcwidth_works=yes],
+ [gl_cv_func_wcwidth_works=no],
[
changequote(,)dnl
case "$host_os" in
-# wint_t.m4 serial 4 (gettext-0.18)
+# wint_t.m4 serial 5 (gettext-0.18.2)
dnl Copyright (C) 2003, 2007-2010 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
AC_DEFUN([gt_TYPE_WINT_T],
[
AC_CACHE_CHECK([for wint_t], [gt_cv_c_wint_t],
- [AC_TRY_COMPILE([
+ [AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[
/* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before
<wchar.h>.
BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be included
#include <stdio.h>
#include <time.h>
#include <wchar.h>
- wint_t foo = (wchar_t)'\0';], ,
- [gt_cv_c_wint_t=yes], [gt_cv_c_wint_t=no])])
+ wint_t foo = (wchar_t)'\0';]],
+ [[]])],
+ [gt_cv_c_wint_t=yes],
+ [gt_cv_c_wint_t=no])])
if test $gt_cv_c_wint_t = yes; then
AC_DEFINE([HAVE_WINT_T], [1], [Define if you have the 'wint_t' type.])
fi
getopt-gnu
strchrnul
sysexits
-malloc
+malloc-gnu
mempcpy
strndup
strcase
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
sed -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_ARPA_INET_H''@|$(NEXT_ARPA_INET_H)|g' \
-e 's|@''HAVE_ARPA_INET_H''@|$(HAVE_ARPA_INET_H)|g' \
-e 's|@''GNULIB_INET_NTOP''@|$(GNULIB_INET_NTOP)|g' \
Description:
calloc() function that is glibc compatible.
+Status:
+obsolete
+
+Notice:
+This module is obsolete. Use the module 'calloc-gnu' instead.
+
Files:
-lib/calloc.c
-m4/calloc.m4
Depends-on:
-calloc-posix
+calloc-gnu
configure.ac:
-gl_FUNC_CALLOC_GNU
Makefile.am:
--- /dev/null
+Description:
+calloc() function that is glibc compatible.
+
+Files:
+lib/calloc.c
+m4/calloc.m4
+
+Depends-on:
+calloc-posix
+
+configure.ac:
+gl_FUNC_CALLOC_GNU
+gl_MODULE_INDICATOR([calloc-gnu])
+
+Makefile.am:
+
+Include:
+<stdlib.h>
+
+License:
+GPL
+
+Maintainer:
+Jim Meyering
--- /dev/null
+Files:
+tests/test-calloc-gnu.c
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-calloc-gnu
+check_PROGRAMS += test-calloc-gnu
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
-e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
+ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
-e 's|@''NEXT_CTYPE_H''@|$(NEXT_CTYPE_H)|g' \
-e 's/@''GNULIB_ISBLANK''@/$(GNULIB_ISBLANK)/g' \
-e 's/@''HAVE_ISBLANK''@/$(HAVE_ISBLANK)/g' \
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
-e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
+ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
-e 's|@''NEXT_DIRENT_H''@|$(NEXT_DIRENT_H)|g' \
-e 's|@''GNULIB_DIRFD''@|$(GNULIB_DIRFD)|g' \
-e 's|@''GNULIB_FDOPENDIR''@|$(GNULIB_FDOPENDIR)|g' \
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
sed -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' \
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
-e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
+ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
-e 's|@''NEXT_FCNTL_H''@|$(NEXT_FCNTL_H)|g' \
-e 's|@''GNULIB_FCNTL''@|$(GNULIB_FCNTL)|g' \
-e 's|@''GNULIB_OPEN''@|$(GNULIB_OPEN)|g' \
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
sed -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_FLOAT_H''@|$(NEXT_FLOAT_H)|g' \
< $(srcdir)/float.in.h; \
} > $@-t && \
d-ino
d-type
dirent-safer
-dirfd
fchdir
fcntl-h
fcntl-safer
strdup
servent
hostent
+sockets
configure.ac:
gl_GETADDRINFO
Depends-on:
mempcpy
d-ino
-dirfd
extensions
memmove
openat
Description:
Convert a date/time string to linear time.
+Status:
+obsolete
+
+Notice:
+This module is obsolete. Use the module 'parse-datetime' instead.
+
Files:
doc/getdate.texi
lib/getdate.h
-lib/getdate.y
-m4/bison.m4
-m4/tm_gmtoff.m4
-m4/getdate.m4
Depends-on:
-c-ctype
-stdbool
-gettime
-intprops
-mktime
-setenv
-unsetenv
-time
-verify
-xalloc
+parse-datetime
configure.ac:
-gl_GETDATE
Makefile.am:
-# This rule overrides the Automake generated .y.c rule, to ensure that the
-# getdate.c file gets generated in the source directory, not in the build
-# directory.
-getdate.c: getdate.y
- $(AM_V_GEN)$(SHELL) $(YLWRAP) $(srcdir)/getdate.y \
- y.tab.c getdate.c \
- y.tab.h getdate.h \
- y.output getdate.output \
- -- $(YACC) $(YFLAGS) $(AM_YFLAGS) && \
- mv getdate.c getdate.c-t && \
- mv getdate.c-t $(srcdir)/getdate.c
-lib_SOURCES += getdate.y
-BUILT_SOURCES += getdate.c
-MOSTLYCLEANFILES += getdate.c-t
-MAINTAINERCLEANFILES += getdate.c
-EXTRA_DIST += getdate.c
Include:
-"getdate.h"
License:
GPL
+++ /dev/null
-Files:
-tests/test-getdate.c
-tests/macros.h
-
-Depends-on:
-progname
-setenv
-
-configure.ac:
-
-Makefile.am:
-TESTS += test-getdate
-check_PROGRAMS += test-getdate
-test_getdate_LDADD = $(LDADD) @LIBINTL@ $(LIB_CLOCK_GETTIME)
sed -e 's|@''HAVE_GETOPT_H''@|$(HAVE_GETOPT_H)|g' \
-e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
-e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
+ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
-e 's|@''NEXT_GETOPT_H''@|$(NEXT_GETOPT_H)|g' \
-e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
< $(srcdir)/getopt.in.h; \
stdlib
extensions
pt_chown
+waitpid
configmake
configure.ac:
--- /dev/null
+Description:
+Determine canonical name of CPU and C ABI.
+
+Files:
+m4/host-cpu-c-abi.m4
+
+Depends-on:
+
+configure.ac:
+gl_HOST_CPU_C_ABI
+
+Makefile.am:
+
+Include:
+
+License:
+unlimited
+
+Maintainer:
+Bruno Haible, Sam Steingold
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
-e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
+ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
-e 's|@''NEXT_ICONV_H''@|$(NEXT_ICONV_H)|g' \
-e 's|@''ICONV_CONST''@|$(ICONV_CONST)|g' \
-e 's|@''REPLACE_ICONV''@|$(REPLACE_ICONV)|g' \
sed -e 's/@''HAVE_INTTYPES_H''@/$(HAVE_INTTYPES_H)/g' \
-e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
-e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
+ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
-e 's|@''NEXT_INTTYPES_H''@|$(NEXT_INTTYPES_H)|g' \
-e 's/@''PRI_MACROS_BROKEN''@/$(PRI_MACROS_BROKEN)/g' \
-e 's/@''APPLE_UNIVERSAL_BUILD''@/$(APPLE_UNIVERSAL_BUILD)/g' \
<math.h>
License:
-GPL
+LGPL
Maintainer:
Ben Pfaff
<math.h>
License:
-GPL
+LGPL
Maintainer:
Ben Pfaff
sed -e 's|@''HAVE_LANGINFO_H''@|$(HAVE_LANGINFO_H)|g' \
-e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
-e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
+ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
-e 's|@''NEXT_LANGINFO_H''@|$(NEXT_LANGINFO_H)|g' \
-e 's|@''GNULIB_NL_LANGINFO''@|$(GNULIB_NL_LANGINFO)|g' \
-e 's|@''HAVE_LANGINFO_CODESET''@|$(HAVE_LANGINFO_CODESET)|g' \
+ -e 's|@''HAVE_LANGINFO_T_FMT_AMPM''@|$(HAVE_LANGINFO_T_FMT_AMPM)|g' \
-e 's|@''HAVE_LANGINFO_ERA''@|$(HAVE_LANGINFO_ERA)|g' \
+ -e 's|@''HAVE_LANGINFO_YESEXPR''@|$(HAVE_LANGINFO_YESEXPR)|g' \
-e 's|@''HAVE_NL_LANGINFO''@|$(HAVE_NL_LANGINFO)|g' \
-e 's|@''REPLACE_NL_LANGINFO''@|$(REPLACE_NL_LANGINFO)|g' \
-e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
-e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
+ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
-e 's|@''NEXT_LOCALE_H''@|$(NEXT_LOCALE_H)|g' \
-e 's|@''GNULIB_DUPLOCALE''@|$(GNULIB_DUPLOCALE)|g' \
-e 's|@''HAVE_DUPLOCALE''@|$(HAVE_DUPLOCALE)|g' \
Depends-on:
pty
+sys_ioctl
configure.ac:
gl_FUNC_LOGIN_TTY
Depends-on:
openpty
+tcgetsid
configure.ac:
otherwise when this module occurs as a tests-related module, it will
have side effects on the compilation of the main modules in lib/.
+Status:
+obsolete
+
+Notice:
+This module is obsolete. Use the module 'malloc-gnu' instead.
+
Files:
-lib/malloc.c
Depends-on:
-malloc-posix
+malloc-gnu
configure.ac:
-gl_FUNC_MALLOC_GNU
-AC_DEFINE([GNULIB_MALLOC_GNU], 1, [Define to indicate the 'malloc' module.])
Makefile.am:
--- /dev/null
+Description:
+malloc() function that is glibc compatible.
+
+Comment:
+This module should not be used as a dependency from a test module,
+otherwise when this module occurs as a tests-related module, it will
+have side effects on the compilation of the main modules in lib/.
+
+Files:
+lib/malloc.c
+
+Depends-on:
+malloc-posix
+
+configure.ac:
+gl_FUNC_MALLOC_GNU
+gl_MODULE_INDICATOR([malloc-gnu])
+
+Makefile.am:
+
+Include:
+<stdlib.h>
+
+License:
+LGPLv2+
+
+Maintainer:
+Jim Meyering
--- /dev/null
+Files:
+tests/test-malloc-gnu.c
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-malloc-gnu
+check_PROGRAMS += test-malloc-gnu
Depends-on:
alloca-opt
+verify
configure.ac:
gl_MALLOCA
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
sed -e 's|@''INCLUDE_NEXT_AS_FIRST_DIRECTIVE''@|$(INCLUDE_NEXT_AS_FIRST_DIRECTIVE)|g' \
-e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
+ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
-e 's|@''NEXT_AS_FIRST_DIRECTIVE_MATH_H''@|$(NEXT_AS_FIRST_DIRECTIVE_MATH_H)|g' \
-e 's|@''GNULIB_ACOSL''@|$(GNULIB_ACOSL)|g' \
-e 's|@''GNULIB_ASINL''@|$(GNULIB_ASINL)|g' \
--- /dev/null
+Files:
+tests/test-memcasecmp.c
+tests/zerosize-ptr.h
+tests/macros.h
+m4/mmap-anon.m4
+
+Depends-on:
+extensions
+getpagesize
+
+configure.ac:
+gl_FUNC_MMAP_ANON
+AC_CHECK_HEADERS_ONCE([sys/mman.h])
+AC_CHECK_FUNCS_ONCE([mprotect])
+
+Makefile.am:
+TESTS += test-memcasecmp
+check_PROGRAMS += test-memcasecmp
tests/zerosize-ptr.h
tests/signature.h
tests/macros.h
+m4/mmap-anon.m4
Depends-on:
+extensions
+getpagesize
configure.ac:
+dnl Check for prerequisites for memory fence checks.
+gl_FUNC_MMAP_ANON
+AC_CHECK_HEADERS_ONCE([sys/mman.h])
+AC_CHECK_FUNCS_ONCE([mprotect])
Makefile.am:
TESTS += test-memchr
--- /dev/null
+Files:
+tests/test-memcoll.c
+tests/macros.h
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-memcoll
+check_PROGRAMS += test-memcoll
Depends-on:
getgroups
getugroups
-realloc
+realloc-gnu
xalloc
configure.ac:
--- /dev/null
+Files:
+tests/test-net_if.c
+tests/signature.h
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-net_if
+check_PROGRAMS += test-net_if
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
sed -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_NETDB_H''@|$(NEXT_NETDB_H)|g' \
-e 's|@''HAVE_NETDB_H''@|$(HAVE_NETDB_H)|g' \
-e 's|@''GNULIB_GETADDRINFO''@|$(GNULIB_GETADDRINFO)|g' \
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
sed -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_NETINET_IN_H''@|$(NEXT_NETINET_IN_H)|g' \
-e 's|@''HAVE_NETINET_IN_H''@|$(HAVE_NETINET_IN_H)|g' \
< $(srcdir)/netinet_in.in.h; \
Depends-on:
configure.ac:
-gl_MATHFUNC([nextafter], [double], [(double)])
+gl_MATHFUNC([nextafter], [double], [(double, double)])
Makefile.am:
--- /dev/null
+Description:
+Convert a date/time string to linear time.
+
+Files:
+doc/parse-datetime.texi
+lib/parse-datetime.h
+lib/parse-datetime.y
+m4/bison.m4
+m4/tm_gmtoff.m4
+m4/parse-datetime.m4
+
+Depends-on:
+c-ctype
+stdbool
+gettime
+intprops
+mktime
+setenv
+unsetenv
+time
+verify
+xalloc
+
+configure.ac:
+gl_PARSE_DATETIME
+
+Makefile.am:
+# This rule overrides the Automake generated .y.c rule, to ensure that the
+# parse-datetime.c file gets generated in the source directory, not in the
+# build directory.
+parse-datetime.c: parse-datetime.y
+ $(AM_V_GEN)$(SHELL) $(YLWRAP) $(srcdir)/parse-datetime.y \
+ y.tab.c parse-datetime.c \
+ y.tab.h parse-datetime.h \
+ y.output parse-datetime.output \
+ -- $(YACC) $(YFLAGS) $(AM_YFLAGS) && \
+ mv parse-datetime.c parse-datetime.c-t && \
+ mv parse-datetime.c-t $(srcdir)/parse-datetime.c
+lib_SOURCES += parse-datetime.y
+BUILT_SOURCES += parse-datetime.c
+MOSTLYCLEANFILES += parse-datetime.c-t
+MAINTAINERCLEANFILES += parse-datetime.c
+EXTRA_DIST += parse-datetime.c
+
+Include:
+"parse-datetime.h"
+
+License:
+GPL
+
+Maintainer:
+Paul Eggert
--- /dev/null
+Files:
+tests/test-parse-datetime.c
+tests/macros.h
+
+Depends-on:
+progname
+setenv
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-parse-datetime
+check_PROGRAMS += test-parse-datetime
+test_parse_datetime_LDADD = $(LDADD) @LIBINTL@ $(LIB_CLOCK_GETTIME)
Files:
lib/poll.c
-lib/poll.in.h
m4/poll.m4
Depends-on:
+poll-h
alloca
select
sys_select
configure.ac:
gl_FUNC_POLL
+gl_POLL_MODULE_INDICATOR([poll])
Makefile.am:
-BUILT_SOURCES += $(POLL_H)
-
-# We need the following in order to create <poll.h> when the system
-# doesn't have one.
-poll.h: poll.in.h
- $(AM_V_GEN)rm -f $@-t $@ && \
- { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
- cat $(srcdir)/poll.in.h; \
- } > $@-t && \
- mv -f $@-t $@
-MOSTLYCLEANFILES += poll.h poll.h-t
Include:
<poll.h>
--- /dev/null
+Description:
+A POSIX-like <poll.h>.
+
+Files:
+lib/poll.in.h
+m4/poll_h.m4
+
+Depends-on:
+c++defs
+extensions
+include_next
+warn-on-use
+
+configure.ac:
+gl_POLL_H
+
+Makefile.am:
+BUILT_SOURCES += poll.h
+
+# We need the following in order to create <poll.h> when the system
+# doesn't have one.
+poll.h: poll.in.h $(CXXDEFS_H) $(WARN_ON_USE_H)
+ $(AM_V_GEN)rm -f $@-t $@ && \
+ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
+ sed -e 's|@''HAVE_POLL_H''@|$(HAVE_POLL_H)|g' \
+ -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
+ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
+ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
+ -e 's|@''NEXT_POLL_H''@|$(NEXT_POLL_H)|g' \
+ -e 's|@''GNULIB_POLL''@|$(GNULIB_POLL)|g' \
+ -e 's|@''HAVE_POLL''@|$(HAVE_POLL)|g' \
+ -e 's|@''REPLACE_POLL''@|$(REPLACE_POLL)|g' \
+ -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \
+ -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
+ < $(srcdir)/poll.in.h; \
+ } > $@-t && \
+ mv -f $@-t $@
+MOSTLYCLEANFILES += poll.h poll.h-t
+
+Include:
+<poll.h>
+
+License:
+LGPLv2+
+
+Maintainer:
+Paolo Bonzini, Bruno Haible
--- /dev/null
+Files:
+tests/test-poll-h-c++.cc
+tests/signature.h
+
+Status:
+c++-test
+
+Depends-on:
+ansi-c++-opt
+
+configure.ac:
+
+Makefile.am:
+if ANSICXX
+TESTS += test-poll-h-c++
+check_PROGRAMS += test-poll-h-c++
+test_poll_h_c___SOURCES = test-poll-h-c++.cc
+test_poll_h_c___LDADD = $(LDADD) @LIBSOCKET@
+endif
--- /dev/null
+Files:
+tests/test-poll-h.c
+
+Depends-on:
+poll-h-c++-tests
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-poll-h
+check_PROGRAMS += test-poll-h
# We need the following in order to create <pthread.h> when the system
# doesn't have one that works with the given compiler.
pthread.h: pthread.in.h
- $(AM_V_GEN)ln -f $(srcdir)/pthread.in.h $@ \
- || cp $(srcdir)/pthread.in.h $@
-MOSTLYCLEANFILES += pthread.h
+ $(AM_V_GEN)rm -f $@-t $@ && \
+ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
+ sed -e 's|@''HAVE_PTHREAD_H''@|$(HAVE_PTHREAD_H)|g' \
+ -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
+ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
+ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
+ -e 's|@''NEXT_PTHREAD_H''@|$(NEXT_PTHREAD_H)|g' \
+ -e 's|@''HAVE_PTHREAD_T''@|$(HAVE_PTHREAD_T)|g' \
+ -e 's|@''HAVE_PTHREAD_SPINLOCK_T''@|$(HAVE_PTHREAD_SPINLOCK_T)|g' \
+ < $(srcdir)/pthread.in.h; \
+ } > $@-t && \
+ mv $@-t $@
+MOSTLYCLEANFILES += pthread.h pthread.h-t
Include:
<pthread.h>
sed -e 's|@''HAVE_PTY_H''@|$(HAVE_PTY_H)|g' \
-e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
-e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
+ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
-e 's|@''NEXT_PTY_H''@|$(NEXT_PTY_H)|g' \
-e 's|@''GNULIB_FORKPTY''@|$(GNULIB_FORKPTY)|g' \
-e 's|@''GNULIB_OPENPTY''@|$(GNULIB_OPENPTY)|g' \
Files:
tests/test-rawmemchr.c
+tests/zerosize-ptr.h
tests/signature.h
tests/macros.h
+m4/mmap-anon.m4
Depends-on:
+extensions
+getpagesize
configure.ac:
+dnl Check for prerequisites for memory fence checks.
+gl_FUNC_MMAP_ANON
+AC_CHECK_HEADERS_ONCE([sys/mman.h])
+AC_CHECK_FUNCS_ONCE([mprotect])
Makefile.am:
TESTS += test-rawmemchr
m4/read-file.m4
Depends-on:
+ftello
+malloc-posix
realloc-posix
+stdint
+sys_stat
configure.ac:
gl_FUNC_READ_FILE
otherwise when this module occurs as a tests-related module, it will
have side effects on the compilation of the main modules in lib/.
+Status:
+obsolete
+
+Notice:
+This module is obsolete. Use the module 'realloc-gnu' instead.
+
Files:
-lib/realloc.c
Depends-on:
-realloc-posix
+realloc-gnu
configure.ac:
-gl_FUNC_REALLOC_GNU
-AC_DEFINE([GNULIB_REALLOC_GNU], 1, [Define to indicate the 'realloc' module.])
Makefile.am:
--- /dev/null
+Description:
+realloc() function that is glibc compatible.
+
+Comment:
+This module should not be used as a dependency from a test module,
+otherwise when this module occurs as a tests-related module, it will
+have side effects on the compilation of the main modules in lib/.
+
+Files:
+lib/realloc.c
+
+Depends-on:
+realloc-posix
+
+configure.ac:
+gl_FUNC_REALLOC_GNU
+gl_MODULE_INDICATOR([realloc-gnu])
+
+Makefile.am:
+
+Include:
+<stdlib.h>
+
+License:
+LGPLv2+
+
+Maintainer:
+Jim Meyering
--- /dev/null
+Files:
+tests/test-realloc-gnu.c
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-realloc-gnu
+check_PROGRAMS += test-realloc-gnu
extensions
gettext-h
localcharset
-malloc
+malloc-gnu
memcmp
memmove
mbrtowc
--- /dev/null
+Description:
+Construct a regular expression from a literal string.
+
+Files:
+lib/regex-quote.h
+lib/regex-quote.c
+
+Depends-on:
+xalloc
+mbuiter
+
+configure.ac:
+
+Makefile.am:
+lib_SOURCES += regex-quote.c
+
+Include:
+"regex-quote.h"
+
+License:
+GPL
+
+Maintainer:
+Bruno Haible
--- /dev/null
+Files:
+tests/test-regex-quote.c
+tests/macros.h
+
+Depends-on:
+regex
+xalloc
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-regex-quote
+check_PROGRAMS += test-regex-quote
environ
intprops
string
+verify
configure.ac:
gl_FUNC_READLINK_SEPARATE
sed -e 's|@''HAVE_SCHED_H''@|$(HAVE_SCHED_H)|g' \
-e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
-e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
+ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
-e 's|@''NEXT_SCHED_H''@|$(NEXT_SCHED_H)|g' \
-e 's|@''HAVE_STRUCT_SCHED_PARAM''@|$(HAVE_STRUCT_SCHED_PARAM)|g' \
< $(srcdir)/sched.in.h; \
sed -e 's|@''HAVE_SEARCH_H''@|$(HAVE_SEARCH_H)|g' \
-e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
-e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
+ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
-e 's|@''NEXT_SEARCH_H''@|$(NEXT_SEARCH_H)|g' \
-e 's|@''GNULIB_TSEARCH''@|$(GNULIB_TSEARCH)|g' \
-e 's|@''HAVE_TSEARCH''@|$(HAVE_TSEARCH)|g' \
Files:
+tests/macros.h
tests/signature.h
tests/test-select.c
tests/test-select-fd.c
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
sed -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_SELINUX_SELINUX_H''@|$(NEXT_SELINUX_SELINUX_H)|g' \
-e '/definition of _GL_UNUSED_PARAMETER/r $(UNUSED_PARAMETER_H)' \
< $(srcdir)/se-selinux.in.h; \
<stdlib.h>
License:
-LGPL
+LGPLv2+
Maintainer:
Bruno Haible
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
sed -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_SIGNAL_H''@|$(NEXT_SIGNAL_H)|g' \
-e 's|@''GNULIB_SIGNAL_H_SIGPIPE''@|$(GNULIB_SIGNAL_H_SIGPIPE)|g' \
-e 's|@''GNULIB_SIGPROCMASK''@|$(GNULIB_SIGPROCMASK)|g' \
--- /dev/null
+Description:
+Access to socket primitives.
+
+Files:
+m4/socketlib.m4
+m4/sys_socket_h.m4
+
+Depends-on:
+
+configure.ac:
+gl_SOCKETLIB
+
+Makefile.am:
+
+Include:
+
+Link:
+$(LIBSOCKET)
+
+License:
+LGPLv2+
+
+Maintainer:
+Simon Josefsson
m4/sockets.m4
Depends-on:
+socketlib
sys_socket
close-hook
sed -e 's|@''HAVE_SPAWN_H''@|$(HAVE_SPAWN_H)|g' \
-e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
-e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
+ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
-e 's|@''NEXT_SPAWN_H''@|$(NEXT_SPAWN_H)|g' \
-e 's|@''GNULIB_POSIX_SPAWN''@|$(GNULIB_POSIX_SPAWN)|g' \
-e 's|@''GNULIB_POSIX_SPAWNP''@|$(GNULIB_POSIX_SPAWNP)|g' \
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
-e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
+ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
-e 's|@''NEXT_STDARG_H''@|$(NEXT_STDARG_H)|g' \
< $(srcdir)/stdarg.in.h; \
} > $@-t && \
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
-e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
+ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
-e 's|@''NEXT_STDDEF_H''@|$(NEXT_STDDEF_H)|g' \
-e 's|@''HAVE_WCHAR_T''@|$(HAVE_WCHAR_T)|g' \
-e 's|@''REPLACE_NULL''@|$(REPLACE_NULL)|g' \
sed -e 's/@''HAVE_STDINT_H''@/$(HAVE_STDINT_H)/g' \
-e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
-e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
+ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
-e 's|@''NEXT_STDINT_H''@|$(NEXT_STDINT_H)|g' \
-e 's/@''HAVE_SYS_TYPES_H''@/$(HAVE_SYS_TYPES_H)/g' \
-e 's/@''HAVE_INTTYPES_H''@/$(HAVE_INTTYPES_H)/g' \
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
sed -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' \
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
sed -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_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|@''HAVE__EXIT''@|$(HAVE__EXIT)|g' \
Files:
tests/test-stdlib.c
+tests/test-sys_wait.h
Depends-on:
verify
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
-e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
+ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
-e 's|@''NEXT_STRING_H''@|$(NEXT_STRING_H)|g' \
-e 's|@''GNULIB_MBSLEN''@|$(GNULIB_MBSLEN)|g' \
-e 's|@''GNULIB_MBSNLEN''@|$(GNULIB_MBSNLEN)|g' \
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
sed -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_STRINGS_H''@|$(NEXT_STRINGS_H)|g' \
-e 's|@''HAVE_STRCASECMP''@|$(HAVE_STRCASECMP)|g' \
-e 's|@''HAVE_DECL_STRNCASECMP''@|$(HAVE_DECL_STRNCASECMP)|g' \
--- /dev/null
+Files:
+tests/test-strnlen.c
+tests/zerosize-ptr.h
+tests/signature.h
+tests/macros.h
+m4/mmap-anon.m4
+
+Depends-on:
+extensions
+getpagesize
+
+configure.ac:
+dnl Check for prerequisites for memory fence checks.
+gl_FUNC_MMAP_ANON
+AC_CHECK_HEADERS_ONCE([sys/mman.h])
+AC_CHECK_FUNCS_ONCE([mprotect])
+
+Makefile.am:
+TESTS += test-strnlen
+check_PROGRAMS += test-strnlen
sed -e 's/@''HAVE_SYS_FILE_H''@/$(HAVE_SYS_FILE_H)/g' \
-e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
-e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
+ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
-e 's|@''NEXT_SYS_FILE_H''@|$(NEXT_SYS_FILE_H)|g' \
-e 's/@''HAVE_FLOCK''@/$(HAVE_FLOCK)/g' \
-e 's/@''GNULIB_FLOCK''@/$(GNULIB_FLOCK)/g' \
sed -e 's|@''HAVE_SYS_IOCTL_H''@|$(HAVE_SYS_IOCTL_H)|g' \
-e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
-e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
+ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
-e 's|@''NEXT_SYS_IOCTL_H''@|$(NEXT_SYS_IOCTL_H)|g' \
-e 's|@''GNULIB_IOCTL''@|$(GNULIB_IOCTL)|g' \
-e 's|@''SYS_IOCTL_H_HAVE_WINSOCK2_H''@|$(SYS_IOCTL_H_HAVE_WINSOCK2_H)|g' \
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
-e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
+ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
-e 's|@''NEXT_SYS_SELECT_H''@|$(NEXT_SYS_SELECT_H)|g' \
-e 's|@''HAVE_SYS_SELECT_H''@|$(HAVE_SYS_SELECT_H)|g' \
-e 's|@''GNULIB_SELECT''@|$(GNULIB_SELECT)|g' \
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
-e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
+ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
-e 's|@''NEXT_SYS_SOCKET_H''@|$(NEXT_SYS_SOCKET_H)|g' \
-e 's|@''HAVE_SYS_SOCKET_H''@|$(HAVE_SYS_SOCKET_H)|g' \
-e 's|@''GNULIB_CLOSE''@|$(GNULIB_CLOSE)|g' \
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
-e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
+ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
-e 's|@''NEXT_SYS_STAT_H''@|$(NEXT_SYS_STAT_H)|g' \
-e 's|@''GNULIB_FCHMODAT''@|$(GNULIB_FCHMODAT)|g' \
-e 's|@''GNULIB_FSTATAT''@|$(GNULIB_FSTATAT)|g' \
sed -e 's/@''HAVE_SYS_TIME_H''@/$(HAVE_SYS_TIME_H)/g' \
-e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
-e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
+ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
-e 's|@''NEXT_SYS_TIME_H''@|$(NEXT_SYS_TIME_H)|g' \
-e 's/@''GNULIB_GETTIMEOFDAY''@/$(GNULIB_GETTIMEOFDAY)/g' \
-e 's/@''HAVE_GETTIMEOFDAY''@/$(HAVE_GETTIMEOFDAY)/g' \
sed -e 's/@''HAVE_SYS_TIMES_H''@/$(HAVE_SYS_TIMES_H)/g' \
-e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
-e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
+ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
-e 's|@''NEXT_SYS_TIMES_H''@|$(NEXT_SYS_TIMES_H)|g' \
-e 's|@''GNULIB_TIMES''@|$(GNULIB_TIMES)|g' \
-e 's|@''HAVE_STRUCT_TMS''@|$(HAVE_STRUCT_TMS)|g' \
sed -e 's/@''HAVE_SYS_UTSNAME_H''@/$(HAVE_SYS_UTSNAME_H)/g' \
-e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
-e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
+ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
-e 's|@''NEXT_SYS_UTSNAME_H''@|$(NEXT_SYS_UTSNAME_H)|g' \
-e 's|@''GNULIB_UNAME''@|$(GNULIB_UNAME)|g' \
-e 's|@''HAVE_STRUCT_UTSNAME''@|$(HAVE_STRUCT_UTSNAME)|g' \
m4/sys_wait_h.m4
Depends-on:
+c++defs
include_next
+warn-on-use
configure.ac:
gl_SYS_WAIT_H
# We need the following in order to create <sys/wait.h> when the system
# has one that is incomplete.
-sys/wait.h: sys_wait.in.h
+sys/wait.h: sys_wait.in.h $(CXXDEFS_H) $(WARN_ON_USE_H)
$(AM_V_at)$(MKDIR_P) sys
$(AM_V_GEN)rm -f $@-t $@ && \
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
-e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
+ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
-e 's|@''NEXT_SYS_WAIT_H''@|$(NEXT_SYS_WAIT_H)|g' \
+ -e 's|@''GNULIB_WAITPID''@|$(GNULIB_WAITPID)|g' \
+ -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \
+ -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
< $(srcdir)/sys_wait.in.h; \
} > $@-t && \
mv $@-t $@
--- /dev/null
+Files:
+tests/test-sys_wait-c++.cc
+tests/signature.h
+
+Status:
+c++-test
+
+Depends-on:
+ansi-c++-opt
+
+configure.ac:
+
+Makefile.am:
+if ANSICXX
+TESTS += test-sys_wait-c++
+check_PROGRAMS += test-sys_wait-c++
+test_sys_wait_c___SOURCES = test-sys_wait-c++.cc
+endif
Files:
tests/test-sys_wait.c
+tests/test-sys_wait.h
Depends-on:
+sys_wait-c++-tests
configure.ac:
sed -e 's|@''HAVE_SYSEXITS_H''@|$(HAVE_SYSEXITS_H)|g' \
-e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
-e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
+ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
-e 's|@''NEXT_SYSEXITS_H''@|$(NEXT_SYSEXITS_H)|g' \
< $(srcdir)/sysexits.in.h; \
} > $@-t && \
--- /dev/null
+Description:
+system() function: execute a shell command
+
+Files:
+
+Depends-on:
+stdlib
+sys_wait
+
+configure.ac:
+gl_STDLIB_MODULE_INDICATOR([system-posix])
+
+Makefile.am:
+
+Include:
+<stdlib.h>
+
+License:
+LGPL
+
+Maintainer:
+Bruno Haible
--- /dev/null
+Description:
+tcgetsid() function: Determine the session ID of the controlling terminal of
+the current process.
+
+Files:
+lib/tcgetsid.c
+m4/tcgetsid.m4
+
+Depends-on:
+termios
+extensions
+sys_ioctl
+
+configure.ac:
+gl_FUNC_TCGETSID
+gl_TERMIOS_MODULE_INDICATOR([tcgetsid])
+
+Makefile.am:
+
+Include:
+<termios.h>
+
+License:
+LGPL
+
+Maintainer:
+Bruno Haible
--- /dev/null
+Description:
+A <termios.h> that works around platform issues.
+
+Files:
+lib/termios.in.h
+m4/termios_h.m4
+
+Depends-on:
+include_next
+c++defs
+warn-on-use
+
+configure.ac:
+gl_TERMIOS_H
+
+Makefile.am:
+BUILT_SOURCES += termios.h
+
+# We need the following in order to create <termios.h> when the system
+# version does not have all declarations.
+termios.h: termios.in.h $(CXXDEFS_H) $(WARN_ON_USE_H)
+ $(AM_V_GEN)rm -f $@-t $@ && \
+ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
+ sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
+ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
+ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
+ -e 's|@''NEXT_TERMIOS_H''@|$(NEXT_TERMIOS_H)|g' \
+ -e 's|@''GNULIB_TCGETSID''@|$(GNULIB_TCGETSID)|g' \
+ -e 's|@''HAVE_TCGETSID''@|$(HAVE_TCGETSID)|g' \
+ -e 's|@''HAVE_TERMIOS_H''@|$(HAVE_TERMIOS_H)|g' \
+ -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \
+ -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
+ < $(srcdir)/termios.in.h; \
+ } > $@-t && \
+ mv $@-t $@
+MOSTLYCLEANFILES += termios.h termios.h-t
+
+Include:
+<termios.h>
+
+License:
+LGPLv2+
+
+Maintainer:
+Bruno Haible
--- /dev/null
+Files:
+tests/test-termios-c++.cc
+tests/signature.h
+
+Status:
+c++-test
+
+Depends-on:
+ansi-c++-opt
+
+configure.ac:
+
+Makefile.am:
+if ANSICXX
+TESTS += test-termios-c++
+check_PROGRAMS += test-termios-c++
+test_termios_c___SOURCES = test-termios-c++.cc
+endif
--- /dev/null
+Files:
+tests/test-termios.c
+
+Depends-on:
+termios-c++-tests
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-termios
+check_PROGRAMS += test-termios
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
-e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
+ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
-e 's|@''NEXT_TIME_H''@|$(NEXT_TIME_H)|g' \
-e 's|@''GNULIB_MKTIME''@|$(GNULIB_MKTIME)|g' \
-e 's|@''GNULIB_NANOSLEEP''@|$(GNULIB_NANOSLEEP)|g' \
configure.ac:
TEST_TSEARCH_LIBM=
-AC_TRY_LINK([
- #ifndef __NO_MATH_INLINES
- # define __NO_MATH_INLINES 1 /* for glibc */
- #endif
- #include <math.h>
- double x;],
- [x = log (x);], , [TEST_TSEARCH_LIBM=-lm])
+AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[#ifndef __NO_MATH_INLINES
+ # define __NO_MATH_INLINES 1 /* for glibc */
+ #endif
+ #include <math.h>
+ double x;]],
+ [[x = log (x);]])],
+ [],
+ [TEST_TSEARCH_LIBM=-lm])
AC_SUBST([TEST_TSEARCH_LIBM])
AC_CHECK_FUNCS_ONCE([initstate])
sed -e 's|@''HAVE_UNISTD_H''@|$(HAVE_UNISTD_H)|g' \
-e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
-e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
+ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
-e 's|@''NEXT_UNISTD_H''@|$(NEXT_UNISTD_H)|g' \
-e 's|@''GNULIB_CHOWN''@|$(GNULIB_CHOWN)|g' \
-e 's|@''GNULIB_CLOSE''@|$(GNULIB_CLOSE)|g' \
errno
memchr
multiarch
+verify
configure.ac:
gl_PREREQ_VASNPRINTF_WITH_EXTRAS
errno
memchr
multiarch
+verify
configure.ac:
gl_PREREQ_VASNPRINTF_WITH_EXTRAS
errno
memchr
multiarch
+verify
configure.ac:
gl_PREREQ_VASNPRINTF_WITH_EXTRAS
errno
memchr
multiarch
+verify
configure.ac:
gl_PREREQ_VASNPRINTF_WITH_EXTRAS
errno
memchr
multiarch
+verify
configure.ac:
gl_PREREQ_VASNPRINTF_WITH_EXTRAS
errno
memchr
multiarch
+verify
configure.ac:
gl_PREREQ_VASNPRINTF_WITH_EXTRAS
errno
memchr
multiarch
+verify
configure.ac:
gl_PREREQ_VASNPRINTF_WITH_EXTRAS
Makefile.am:
TESTS += test-update-copyright.sh
-TESTS_ENVIRONMENT += PATH='$(abs_aux_dir)'$(PATH_SEPARATOR)"$$PATH"
+TESTS_ENVIRONMENT += abs_aux_dir='$(abs_aux_dir)'
xsize
errno
memchr
+verify
configure.ac:
gl_FUNC_VASNPRINTF
Makefile.am:
TESTS += test-vc-list-files-git.sh
TESTS += test-vc-list-files-cvs.sh
-TESTS_ENVIRONMENT += PATH='$(abs_aux_dir)'$(PATH_SEPARATOR)"$$PATH"
+TESTS_ENVIRONMENT += abs_aux_dir='$(abs_aux_dir)'
sys_wait
unistd
atexit
+waitpid
configure.ac:
gl_WAIT_PROCESS
--- /dev/null
+Description:
+waitpid() function: wait for process state change
+
+Files:
+lib/waitpid.c
+m4/waitpid.m4
+
+Depends-on:
+sys_wait
+
+configure.ac:
+gl_FUNC_WAITPID
+gl_SYS_WAIT_MODULE_INDICATOR([waitpid])
+
+Makefile.am:
+
+Include:
+<sys/wait.h>
+
+License:
+LGPLv2+
+
+Maintainer:
+Bruno Haible
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
sed -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_WCHAR_H''@|$(NEXT_WCHAR_H)|g' \
-e 's|@''HAVE_WCHAR_H''@|$(HAVE_WCHAR_H)|g' \
-e 's|@''GNULIB_BTOWC''@|$(GNULIB_BTOWC)|g' \
sed -e 's/@''HAVE_WCTYPE_H''@/$(HAVE_WCTYPE_H)/g' \
-e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
-e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
+ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
-e 's|@''NEXT_WCTYPE_H''@|$(NEXT_WCTYPE_H)|g' \
-e 's/@''HAVE_ISWBLANK''@/$(HAVE_ISWBLANK)/g' \
-e 's/@''HAVE_ISWCNTRL''@/$(HAVE_ISWCNTRL)/g' \
-e 's/@''HAVE_WINT_T''@/$(HAVE_WINT_T)/g' \
+ -e 's/@''REPLACE_ISWBLANK''@/$(REPLACE_ISWBLANK)/g' \
-e 's/@''REPLACE_ISWCNTRL''@/$(REPLACE_ISWCNTRL)/g' \
-e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \
-e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
# explicit canonicalization command when $PATH contains no empty fields.
self_abspathname=
if test "${PATH_SEPARATOR+set}" != set; then
- func_tmpdir
- { echo "#! /bin/sh"; echo "exit 0"; } > "$tmp"/conf.sh
- chmod +x "$tmp"/conf.sh
- if (PATH="/nonexistent;$tmp"; conf.sh) >/dev/null 2>&1; then
- PATH_SEPARATOR=';'
- else
- PATH_SEPARATOR=:
- fi
- rm -rf "$tmp"
+ # Determine PATH_SEPARATOR by trying to find /bin/sh in a PATH which
+ # contains only /bin. Note that ksh looks also at the FPATH variable,
+ # so we have to set that as well for the test.
+ PATH_SEPARATOR=:
+ (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \
+ && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \
+ || PATH_SEPARATOR=';'
+ }
fi
if test "$PATH_SEPARATOR" = ";"; then
# On Windows, programs are searched in "." before $PATH.
skip_() { warn_ "$ME_: skipped test: $@"; Exit 77; }
framework_failure_() { warn_ "$ME_: set-up failure: $@"; Exit 99; }
+# Sanitize this shell to POSIX mode, if possible.
+DUALCASE=1; export DUALCASE
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+ emulate sh
+ NULLCMD=:
+ alias -g '${1+"$@"}'='"$@"'
+ setopt NO_GLOB_SUBST
+else
+ case `(set -o) 2>/dev/null` in
+ *posix*) set -o posix ;;
+ esac
+fi
+
# We require $(...) support unconditionally.
# We require a few additional shell features only when $EXEEXT is nonempty,
# in order to support automatic $EXEEXT emulation:
# shells until we find one that passes. If one is found, re-exec it.
# If no acceptable shell is found, skip the current test.
#
+# The "...set -x; P=1 true 2>err..." test is to disqualify any shell that
+# emits "P=1" into err, as /bin/sh from SunOS 5.11 and OpenBSD 4.7 do.
+#
# Use "9" to indicate success (rather than 0), in case some shell acts
# like Solaris 10's /bin/sh but exits successfully instead of with status 2.
+# Eval this code in a subshell to determine a shell's suitability.
+# 10 - passes all tests; ok to use
+# 9 - ok, but enabling "set -x" corrupts application stderr; prefer higher score
+# ? - not ok
gl_shell_test_script_='
test $(echo y) = y || exit 1
-test -z "$EXEEXT" && exit 9
+score_=10
+if test "$VERBOSE" = yes; then
+ test -n "$( (exec 3>&1; set -x; P=1 true 2>&3) 2> /dev/null)" && score_=9
+fi
+test -z "$EXEEXT" && exit $score_
shopt -s expand_aliases
alias a-b="echo zoo"
v=abx
test ${v%x} = ab \
&& test ${v#a} = bx \
&& test $(a-b) = zoo \
- && exit 9
+ && exit $score_
'
if test "x$1" = "x--no-reexec"; then
shift
else
- # 'eval'ing the above code makes Solaris 10's /bin/sh exit with $? set to 2.
- # It does not evaluate any of the code after the "unexpected" `('. Thus,
- # we must run it in a subshell.
- ( eval "$gl_shell_test_script_" ) > /dev/null 2>&1
- if test $? = 9; then
- : # The current shell is adequate. No re-exec required.
- else
- # Search for a shell that meets our requirements.
- for re_shell_ in "${CONFIG_SHELL:-no_shell}" /bin/sh bash dash zsh pdksh fail
- do
- test "$re_shell_" = no_shell && continue
- test "$re_shell_" = fail && skip_ failed to find an adequate shell
+ # Assume a working shell. Export to subshells (setup_ needs this).
+ gl_set_x_corrupts_stderr_=false
+ export gl_set_x_corrupts_stderr_
+
+ # Record the first marginally acceptable shell.
+ marginal_=
+
+ # Search for a shell that meets our requirements.
+ for re_shell_ in __current__ "${CONFIG_SHELL:-no_shell}" \
+ /bin/sh bash dash zsh pdksh fail
+ do
+ test "$re_shell_" = no_shell && continue
+
+ # If we've made it all the way to the sentinel, "fail" without
+ # finding even a marginal shell, skip this test.
+ if test "$re_shell_" = fail; then
+ test -z "$marginal_" && skip_ failed to find an adequate shell
+ re_shell_=$marginal_
+ break
+ fi
+
+ # When testing the current shell, simply "eval" the test code.
+ # Otherwise, run it via $re_shell_ -c ...
+ if test "$re_shell_" = __current__; then
+ # 'eval'ing this code makes Solaris 10's /bin/sh exit with
+ # $? set to 2. It does not evaluate any of the code after the
+ # "unexpected" first `('. Thus, we must run it in a subshell.
+ ( eval "$gl_shell_test_script_" ) > /dev/null 2>&1
+ else
"$re_shell_" -c "$gl_shell_test_script_" 2>/dev/null
- if test $? = 9; then
- # Found an acceptable shell.
- exec "$re_shell_" "$0" --no-reexec "$@"
- echo "$ME_: exec failed" 1>&2
- exit 127
- fi
- done
+ fi
+
+ st_=$?
+
+ # $re_shell_ works just fine. Use it.
+ test $st_ = 10 && break
+
+ # If this is our first marginally acceptable shell, remember it.
+ if test "$st_:$marginal_" = 9: ; then
+ marginal_="$re_shell_"
+ gl_set_x_corrupts_stderr_=true
+ fi
+ done
+
+ if test "$re_shell_" != __current__; then
+ # Found a usable shell. Preserve -v and -x.
+ case $- in
+ *v*x* | *x*v*) opts_=-vx ;;
+ *v*) opts_=-v ;;
+ *x*) opts_=-x ;;
+ *) opts_= ;;
+ esac
+ exec "$re_shell_" $opts_ "$0" --no-reexec "$@"
+ echo "$ME_: exec failed" 1>&2
+ exit 127
fi
fi
feb_result_=
feb_sp_=
for feb_file_ in $feb_dir_/*.exe; do
+ # If there was no *.exe file, or there existed a file named "*.exe" that
+ # was deleted between the above glob expansion and the existence test
+ # below, just skip it.
+ test "x$feb_file_" = "x$feb_dir_/*.exe" && test ! -f "$feb_file_" \
+ && continue
case $feb_file_ in
*[!-a-zA-Z/0-9_.+]*) feb_fail_=1; break;;
*) # Remove leading file name components as well as the .exe suffix.
# For each file name of the form PROG.exe, create an alias named
# PROG that simply invokes PROG.exe, then return 0. If any selected
# file name or the directory name, $1, contains an unexpected character,
-# define no function and return 1.
+# define no alias and return 1.
create_exe_shims_()
{
case $EXEEXT in
setup_()
{
- test "$VERBOSE" = yes && set -x
+ if test "$VERBOSE" = yes; then
+ # Test whether set -x may cause the selected shell to corrupt an
+ # application's stderr. Many do, including zsh-4.3.10 and the /bin/sh
+ # from SunOS 5.11, OpenBSD 4.7 and Irix 5.x and 6.5.
+ # If enabling verbose output this way would cause trouble, simply
+ # issue a warning and refrain.
+ if $gl_set_x_corrupts_stderr_; then
+ warn_ "using SHELL=$SHELL with 'set -x' corrupts stderr"
+ else
+ set -x
+ fi
+ fi
initial_cwd_=$PWD
ASSERT (result == input + 11);
}
+ /* Check that a long periodic needle does not cause false positives. */
+ {
+ const char input[] = ("F_BD_CE_BD_EF_BF_BD_EF_BF_BD_EF_BF_BD_EF_BF_BD"
+ "_C3_88_20_EF_BF_BD_EF_BF_BD_EF_BF_BD"
+ "_C3_A7_20_EF_BF_BD");
+ const char need[] = "_EF_BF_BD_EF_BF_BD_EF_BF_BD_EF_BF_BD_EF_BF_BD";
+ const char *result = c_strcasestr (input, need);
+ ASSERT (result == NULL);
+ }
+ {
+ const char input[] = ("F_BD_CE_BD_EF_BF_BD_EF_BF_BD_EF_BF_BD_EF_BF_BD"
+ "_C3_88_20_EF_BF_BD_EF_BF_BD_EF_BF_BD"
+ "_C3_A7_20_EF_BF_BD_DA_B5_C2_A6_20"
+ "_EF_BF_BD_EF_BF_BD_EF_BF_BD_EF_BF_BD_EF_BF_BD");
+ const char need[] = "_EF_BF_BD_EF_BF_BD_EF_BF_BD_EF_BF_BD_EF_BF_BD";
+ const char *result = c_strcasestr (input, need);
+ ASSERT (result == input + 115);
+ }
+
/* Check that a very long haystack is handled quickly if the needle is
short and occurs near the beginning. */
{
--- /dev/null
+/* Test of calloc function.
+ Copyright (C) 2010 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/>. */
+
+#include <config.h>
+
+#include <stdlib.h>
+
+int
+main ()
+{
+ /* Check that calloc (0, 0) is not a NULL pointer. */
+ if (calloc (0, 0) == NULL)
+ return 1;
+
+ /* Check that calloc fails when requested to allocate a block of memory
+ larger than SIZE_MAX bytes. */
+ if (calloc ((size_t) -1 / 8 + 1, 8) != NULL)
+ return 1;
+
+ return 0;
+}
acl_flavor=hpux
else
if (getacl tmpfile0 >/dev/null) 2>/dev/null; then
- # Tru64.
- acl_flavor=osf1
+ # Tru64, NonStop Kernel.
+ if (getacl -m tmpfile0 >/dev/null) 2>/dev/null; then
+ # Tru64.
+ acl_flavor=osf1
+ else
+ # NonStop Kernel.
+ acl_flavor=nsk
+ fi
else
if (aclget tmpfile0 >/dev/null) 2>/dev/null; then
# AIX.
cmp tmpaclout1 tmpaclout2 > /dev/null
}
;;
- osf1)
+ osf1 | nsk)
func_test_same_acls ()
{
getacl "$1" | sed -e "s/$1/FILENAME/g" > tmpaclout1
;;
+ nsk)
+
+ # Set an ACL for a user.
+ setacl -m user:$auid:1 tmpfile0
+
+ func_test_copy tmpfile0 tmpfile2
+
+ # Set an ACL for a group.
+ setacl -m group:$agid:4 tmpfile0
+
+ func_test_copy tmpfile0 tmpfile3
+
+ # Set an ACL for other.
+ setacl -m other:4 tmpfile0
+
+ func_test_copy tmpfile0 tmpfile4
+
+ # Remove the ACL for the user.
+ setacl -d user:$auid tmpfile0
+
+ func_test_copy tmpfile0 tmpfile5
+
+ # Remove the ACL for the group.
+ setacl -d group:$agid tmpfile0
+
+ func_test_copy tmpfile0 tmpfile6
+
+ # Delete all optional ACLs.
+ setacl -m user:$auid:1 tmpfile0
+ setacl -s user::6,group::0,class:7,other:0 tmpfile0
+
+ func_test_copy tmpfile0 tmpfile8
+
+ # Copy ACLs from a file that has no ACLs.
+ echo > tmpfile9
+ chmod a+x tmpfile9
+ getacl tmpfile9 > tmpaclout0
+ setacl -f tmpaclout0 tmpfile0
+ rm -f tmpfile9
+
+ func_test_copy tmpfile0 tmpfile9
+
+ ;;
+
aix)
# Set an ACL for a user.
acl_flavor=hpux
else
if (getacl tmpfile0 >/dev/null) 2>/dev/null; then
- # Tru64.
- acl_flavor=osf1
+ # Tru64, NonStop Kernel.
+ if (getacl -m tmpfile0 >/dev/null) 2>/dev/null; then
+ # Tru64.
+ acl_flavor=osf1
+ else
+ # NonStop Kernel.
+ acl_flavor=nsk
+ fi
else
if (aclget tmpfile0 >/dev/null) 2>/dev/null; then
# AIX.
cmp tmpaclout1 tmpaclout2 > /dev/null
}
;;
- osf1)
+ osf1 | nsk)
func_test_same_acls ()
{
getacl "$1" | sed -e "s/$1/FILENAME/g" > tmpaclout1
;;
+ nsk)
+
+ # Set an ACL for a user.
+ setacl -m user:$auid:1 tmpfile0
+
+ func_test_copy tmpfile0 tmpfile2
+
+ # Set an ACL for a group.
+ setacl -m group:$agid:4 tmpfile0
+
+ func_test_copy tmpfile0 tmpfile3
+
+ # Set an ACL for other.
+ setacl -m other:4 tmpfile0
+
+ func_test_copy tmpfile0 tmpfile4
+
+ # Remove the ACL for the user.
+ setacl -d user:$auid tmpfile0
+
+ func_test_copy tmpfile0 tmpfile5
+
+ # Remove the ACL for the group.
+ setacl -d group:$agid tmpfile0
+
+ func_test_copy tmpfile0 tmpfile6
+
+ # Delete all optional ACLs.
+ setacl -m user:$auid:1 tmpfile0
+ setacl -s user::6,group::0,class:7,other:0 tmpfile0
+
+ func_test_copy tmpfile0 tmpfile8
+
+ # Copy ACLs from a file that has no ACLs.
+ echo > tmpfile9
+ chmod a+x tmpfile9
+ getacl tmpfile9 > tmpaclout0
+ setacl -f tmpaclout0 tmpfile0
+ rm -f tmpfile9
+
+ func_test_copy tmpfile0 tmpfile9
+
+ ;;
+
aix)
# Set an ACL for a user.
# define setmode(f,m) zero ()
static int zero (void) { return 0; }
#endif
-#ifndef O_CLOEXEC
-# define O_CLOEXEC 0
-#endif
/* This test intentionally closes stderr. So, we arrange to have fd 10
(outside the range of interesting fd's during the test) set up to
{
int use_cloexec;
-#if defined O_CLOEXEC
+#if O_CLOEXEC
for (use_cloexec = 0; use_cloexec <= 1; use_cloexec++)
#else
use_cloexec = 0;
char buffer[1];
o_flags = 0;
-#if defined O_CLOEXEC
+#if O_CLOEXEC
if (use_cloexec)
o_flags |= O_CLOEXEC;
#endif
#include "binary-io.h"
#include "macros.h"
-/* Use O_CLOEXEC if available, but test works without it. */
-#ifndef O_CLOEXEC
-# define O_CLOEXEC 0
-#endif
-
#if !O_BINARY
# define setmode(f,m) zero ()
static int zero (void) { return 0; }
static int
do_futimens (int fd, struct timespec const times[2])
{
- return fdutimensat (dfd, NULL, fd, times);
+ return fdutimensat (fd, dfd, NULL, times, 0);
}
/* Test the use of file descriptors alongside a name. */
if (fd < 0)
fd = openat (dfd, name, O_RDONLY);
errno = 0;
- result = fdutimensat (dfd, name, fd, times);
+ result = fdutimensat (fd, dfd, name, times, 0);
+ ASSERT (fdutimensat (fd, dfd, name, times, AT_SYMLINK_NOFOLLOW) == result);
if (0 <= fd)
{
int saved_errno = errno;
return lutimensat (dfd, name, times);
}
+/* Wrap fdutimensat to behave like lutimens. */
+static int
+do_lutimens1 (const char *name, struct timespec const times[2])
+{
+ return fdutimensat (-1, dfd, name, times, AT_SYMLINK_NOFOLLOW);
+}
+
/* Wrap fdutimensat to behave like utimens. */
static int
do_utimens (const char *name, struct timespec const times[2])
{
- return fdutimensat (dfd, name, -1, times);
+ return fdutimensat (-1, dfd, name, times, 0);
}
int
result3 = test_lutimens (do_lutimens, (result1 + result2) == 0);
/* We expect 0/0, 0/77, or 77/77, but not 77/0. */
ASSERT (result1 <= result3);
+ ASSERT (test_lutimens (do_lutimens1, (result1 + result2) == 0) == result3);
dfd = open (".", O_RDONLY);
ASSERT (0 <= dfd);
ASSERT (test_utimens (do_utimens, false) == result1);
ASSERT (test_utimens (do_fdutimens, false) == result1);
ASSERT (test_futimens (do_futimens, false) == result2);
ASSERT (test_lutimens (do_lutimens, false) == result3);
+ ASSERT (test_lutimens (do_lutimens1, false) == result3);
/* Directory relative tests. */
ASSERT (mkdir (BASE "dir", 0700) == 0);
fd = creat ("file", 0600);
ASSERT (0 <= fd);
errno = 0;
- ASSERT (fdutimensat (fd, ".", AT_FDCWD, NULL) == -1);
+ ASSERT (fdutimensat (AT_FDCWD, fd, ".", NULL, 0) == -1);
ASSERT (errno == ENOTDIR);
{
struct timespec ts[2] = { { Y2K, 0 }, { Y2K, 0 } };
struct stat st;
- ASSERT (fdutimensat (dfd, BASE "dir/file", fd, ts) == 0);
+ ASSERT (fdutimensat (fd, dfd, BASE "dir/file", ts, 0) == 0);
ASSERT (stat ("file", &st) == 0);
ASSERT (st.st_atime == Y2K);
ASSERT (get_stat_atime_ns (&st) == 0);
ASSERT (close (fd) == 0);
ASSERT (close (dfd) == 0);
errno = 0;
- ASSERT (fdutimensat (dfd, ".", -1, NULL) == -1);
+ ASSERT (fdutimensat (-1, dfd, ".", NULL, 0) == -1);
ASSERT (errno == EBADF);
/* Cleanup. */
acl_flavor=hpux
else
if (getacl tmpfile0 >/dev/null) 2>/dev/null; then
- # Tru64.
- acl_flavor=osf1
+ # Tru64, NonStop Kernel.
+ if (getacl -m tmpfile0 >/dev/null) 2>/dev/null; then
+ # Tru64.
+ acl_flavor=osf1
+ else
+ # NonStop Kernel.
+ acl_flavor=nsk
+ fi
else
if (aclget tmpfile0 >/dev/null) 2>/dev/null; then
# AIX.
fi
;;
+ nsk)
+
+ # Set an ACL for a user.
+ setacl -m user:$auid:1 tmpfile0
+
+ func_test_has_acl tmpfile0 yes
+
+ # Remove the ACL for the user.
+ setacl -d user:$auid tmpfile0
+
+ func_test_has_acl tmpfile0 no
+
+ ;;
+
aix)
# Set an ACL for a user.
#include "test-utimens-common.h"
-/* This file is designed to test both gl_futimens(a,NULL,b) and
+/* This file is designed to test both fdutimens(a,NULL,b) and
futimens(a,b). FUNC is the function to test. Assumes that BASE
and ASSERT are already defined. If PRINT, warn before skipping
tests with status 77. */
errno = 0;
ASSERT (func (AT_FDCWD, NULL) == -1);
ASSERT (errno == EBADF);
+ errno = 0;
+ ASSERT (func (-1, NULL) == -1);
+ ASSERT (errno == EBADF);
{
struct timespec ts[2] = { { Y2K, UTIME_BOGUS_POS }, { Y2K, 0 } };
errno = 0;
int main (void)
{
-#if _WIN32
- {
- WORD requested;
- WSADATA data;
- int err;
-
- requested = MAKEWORD (1, 1);
- err = WSAStartup (requested, &data);
- if (err != 0)
- return 1;
-
- if (data.wVersion < requested)
- {
- WSACleanup ();
- return 2;
- }
- }
-#endif
-
return simple (HOST1, SERV1)
+ simple (HOST2, SERV2)
+ simple (HOST3, SERV3)
+++ /dev/null
-/* Test of getdate() function.
- Copyright (C) 2008, 2009, 2010 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, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
-
-/* Written by Simon Josefsson <simon@josefsson.org>, 2008. */
-
-#include <config.h>
-
-#include "getdate.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "progname.h"
-#include "macros.h"
-
-#ifdef DEBUG
-#define LOG(str, now, res) \
- printf ("string `%s' diff %d %d\n", \
- str, res.tv_sec - now.tv_sec, res.tv_nsec - now.tv_nsec);
-#else
-#define LOG(str, now, res) (void) 0
-#endif
-
-static const char* const day_table[] =
-{
- "SUNDAY",
- "MONDAY",
- "TUESDAY",
- "WEDNESDAY",
- "THURSDAY",
- "FRIDAY",
- "SATURDAY",
- NULL
-};
-
-int
-main (int argc _GL_UNUSED, char **argv)
-{
- struct timespec result;
- struct timespec result2;
- struct timespec now;
- const char *p;
- int i;
-
- set_program_name (argv[0]);
-
- now.tv_sec = 4711;
- now.tv_nsec = 1267;
- p = "now";
- ASSERT (get_date (&result, p, &now));
- LOG (p, now, result);
- ASSERT (now.tv_sec == result.tv_sec && now.tv_nsec == result.tv_nsec);
-
- now.tv_sec = 4711;
- now.tv_nsec = 1267;
- p = "tomorrow";
- ASSERT (get_date (&result, p, &now));
- LOG (p, now, result);
- ASSERT (now.tv_sec + 24 * 60 * 60 == result.tv_sec
- && now.tv_nsec == result.tv_nsec);
-
- now.tv_sec = 4711;
- now.tv_nsec = 1267;
- p = "yesterday";
- ASSERT (get_date (&result, p, &now));
- LOG (p, now, result);
- ASSERT (now.tv_sec - 24 * 60 * 60 == result.tv_sec
- && now.tv_nsec == result.tv_nsec);
-
- now.tv_sec = 4711;
- now.tv_nsec = 1267;
- p = "4 hours";
- ASSERT (get_date (&result, p, &now));
- LOG (p, now, result);
- ASSERT (now.tv_sec + 4 * 60 * 60 == result.tv_sec
- && now.tv_nsec == result.tv_nsec);
-
- /* test if timezone is not being ignored for day offset */
- now.tv_sec = 4711;
- now.tv_nsec = 1267;
- p = "UTC+400 +24 hours";
- ASSERT (get_date (&result, p, &now));
- LOG (p, now, result);
- p = "UTC+400 +1 day";
- ASSERT (get_date (&result2, p, &now));
- LOG (p, now, result2);
- ASSERT (result.tv_sec == result2.tv_sec
- && result.tv_nsec == result2.tv_nsec);
-
- /* test if several time zones formats are handled same way */
- now.tv_sec = 4711;
- now.tv_nsec = 1267;
- p = "UTC+14:00";
- ASSERT (get_date (&result, p, &now));
- LOG (p, now, result);
- p = "UTC+14";
- ASSERT (get_date (&result2, p, &now));
- LOG (p, now, result2);
- ASSERT (result.tv_sec == result2.tv_sec
- && result.tv_nsec == result2.tv_nsec);
- p = "UTC+1400";
- ASSERT (get_date (&result2, p, &now));
- LOG (p, now, result2);
- ASSERT (result.tv_sec == result2.tv_sec
- && result.tv_nsec == result2.tv_nsec);
-
- now.tv_sec = 4711;
- now.tv_nsec = 1267;
- p = "UTC-14:00";
- ASSERT (get_date (&result, p, &now));
- LOG (p, now, result);
- p = "UTC-14";
- ASSERT (get_date (&result2, p, &now));
- LOG (p, now, result2);
- ASSERT (result.tv_sec == result2.tv_sec
- && result.tv_nsec == result2.tv_nsec);
- p = "UTC-1400";
- ASSERT (get_date (&result2, p, &now));
- LOG (p, now, result2);
- ASSERT (result.tv_sec == result2.tv_sec
- && result.tv_nsec == result2.tv_nsec);
-
- now.tv_sec = 4711;
- now.tv_nsec = 1267;
- p = "UTC+0:15";
- ASSERT (get_date (&result, p, &now));
- LOG (p, now, result);
- p = "UTC+0015";
- ASSERT (get_date (&result2, p, &now));
- LOG (p, now, result2);
- ASSERT (result.tv_sec == result2.tv_sec
- && result.tv_nsec == result2.tv_nsec);
-
- now.tv_sec = 4711;
- now.tv_nsec = 1267;
- p = "UTC-1:30";
- ASSERT (get_date (&result, p, &now));
- LOG (p, now, result);
- p = "UTC-130";
- ASSERT (get_date (&result2, p, &now));
- LOG (p, now, result2);
- ASSERT (result.tv_sec == result2.tv_sec
- && result.tv_nsec == result2.tv_nsec);
-
-
- /* TZ out of range should cause get_date failure */
- now.tv_sec = 4711;
- now.tv_nsec = 1267;
- p = "UTC+25:00";
- ASSERT (!get_date (&result, p, &now));
-
- /* Check for several invalid countable dayshifts */
- now.tv_sec = 4711;
- now.tv_nsec = 1267;
- p = "UTC+4:00 +40 yesterday";
- ASSERT (!get_date (&result, p, &now));
- p = "UTC+4:00 next yesterday";
- ASSERT (!get_date (&result, p, &now));
- p = "UTC+4:00 tomorrow ago";
- ASSERT (!get_date (&result, p, &now));
- p = "UTC+4:00 40 now ago";
- ASSERT (!get_date (&result, p, &now));
- p = "UTC+4:00 last tomorrow";
- ASSERT (!get_date (&result, p, &now));
- p = "UTC+4:00 -4 today";
- ASSERT (!get_date (&result, p, &now));
-
- /* And check correct usage of dayshifts */
- now.tv_sec = 4711;
- now.tv_nsec = 1267;
- p = "UTC+400 tomorrow";
- ASSERT (get_date (&result, p, &now));
- LOG (p, now, result);
- p = "UTC+400 +1 day";
- ASSERT (get_date (&result2, p, &now));
- LOG (p, now, result2);
- ASSERT (result.tv_sec == result2.tv_sec
- && result.tv_nsec == result2.tv_nsec);
- now.tv_sec = 4711;
- now.tv_nsec = 1267;
- p = "UTC+400 yesterday";
- ASSERT (get_date (&result, p, &now));
- LOG (p, now, result);
- p = "UTC+400 1 day ago";
- ASSERT (get_date (&result2, p, &now));
- LOG (p, now, result2);
- ASSERT (result.tv_sec == result2.tv_sec
- && result.tv_nsec == result2.tv_nsec);
- now.tv_sec = 4711;
- now.tv_nsec = 1267;
- p = "UTC+400 now";
- ASSERT (get_date (&result, p, &now));
- LOG (p, now, result);
- p = "UTC+400 +0 minutes"; /* silly, but simple "UTC+400" is different*/
- ASSERT (get_date (&result2, p, &now));
- LOG (p, now, result2);
- ASSERT (result.tv_sec == result2.tv_sec
- && result.tv_nsec == result2.tv_nsec);
-
- /* Check that some "next Monday", "last Wednesday", etc. are correct. */
- setenv ("TZ", "UTC0", 1);
- for (i = 0; day_table[i]; i++)
- {
- unsigned int thur2 = 7 * 24 * 3600; /* 2nd thursday */
- char tmp[32];
- sprintf (tmp, "NEXT %s", day_table[i]);
- now.tv_sec = thur2 + 4711;
- now.tv_nsec = 1267;
- ASSERT (get_date (&result, tmp, &now));
- LOG (tmp, now, result);
- ASSERT (result.tv_nsec == 0);
- ASSERT (result.tv_sec == thur2 + (i == 4 ? 7 : (i + 3) % 7) * 24 * 3600);
-
- sprintf (tmp, "LAST %s", day_table[i]);
- now.tv_sec = thur2 + 4711;
- now.tv_nsec = 1267;
- ASSERT (get_date (&result, tmp, &now));
- LOG (tmp, now, result);
- ASSERT (result.tv_nsec == 0);
- ASSERT (result.tv_sec == thur2 + ((i + 3) % 7 - 7) * 24 * 3600);
- }
-
- p = "THURSDAY UTC+00"; /* The epoch was on Thursday. */
- now.tv_sec = 0;
- now.tv_nsec = 0;
- ASSERT (get_date (&result, p, &now));
- LOG (p, now, result);
- ASSERT (result.tv_sec == now.tv_sec
- && result.tv_nsec == now.tv_nsec);
-
- p = "FRIDAY UTC+00";
- now.tv_sec = 0;
- now.tv_nsec = 0;
- ASSERT (get_date (&result, p, &now));
- LOG (p, now, result);
- ASSERT (result.tv_sec == 24 * 3600
- && result.tv_nsec == now.tv_nsec);
-
- return 0;
-}
int
main (void)
{
- char buf[2];
+ size_t b_size = 2;
+ char *b = malloc (b_size);
+ ASSERT (b);
/* Ideally we would rely on the snprintf-posix module, in which case
this guard would not be required, but due to limitations in gnulib's
implementation (see modules/snprintf-posix), we cannot. */
- if (snprintf (buf, sizeof buf, "%ju", (uintmax_t) 3) == 1
- && buf[0] == '3' && buf[1] == '\0')
+ if (snprintf (b, b_size, "%ju", (uintmax_t) 3) == 1
+ && b[0] == '3' && b[1] == '\0')
{
CK (int, inttostr);
CK (unsigned int, uinttostr);
/* Specification. */
extern int login_tty (int);
+#include <errno.h>
#include <pty.h>
#include <stdio.h>
+#include <stdlib.h>
+#include <termios.h>
+#include <unistd.h>
int
main ()
}
}
+ /* From here on, we cannot use stderr for error messages any more.
+ If a test fails, just abort. */
+
+ /* Check that fd = 0, 1, 2 are now open to the controlling terminal for the
+ current process and that it is a session of its own. */
+ {
+ int fd;
+ for (fd = 0; fd < 3; fd++)
+ if (!(tcgetpgrp (fd) == getpid ()))
+ abort ();
+ for (fd = 0; fd < 3; fd++)
+ {
+ int sid = tcgetsid (fd);
+ if (!(sid == -1 ? errno == ENOSYS : sid == getpid ()))
+ abort ();
+ }
+ }
+
return 0;
}
--- /dev/null
+/* Test of malloc function.
+ Copyright (C) 2010 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/>. */
+
+#include <config.h>
+
+#include <stdlib.h>
+
+int
+main ()
+{
+ /* Check that malloc (0) is not a NULL pointer. */
+ if (malloc (0) == NULL)
+ return 1;
+
+ return 0;
+}
{
void *ptr = malloca (n);
freea (ptr);
- ptr = safe_alloca (n);
+ safe_alloca (n);
}
void (*func) (int) = do_allocation;
ASSERT (my_casecmp ("para", 4, "paragraph", 9) < 0);
ASSERT (my_casecmp ("paragraph", 9, "para", 4) > 0);
+
+ /* Embedded NULs. */
+ ASSERT (my_casecmp ("1\0", 2, "2\0", 2) < 0);
+ ASSERT (my_casecmp ("2\0", 2, "1\0", 2) > 0);
+ ASSERT (my_casecmp ("x\0""1", 3, "x\0""2", 3) < 0);
+ ASSERT (my_casecmp ("x\0""2", 3, "x\0""1", 3) > 0);
}
static void
--- /dev/null
+/*
+ * Copyright (C) 2008-2010 Free Software Foundation, Inc.
+ * Written by Simon Josefsson and Bruno Haible
+ *
+ * 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/>. */
+
+#include <config.h>
+
+#include "memcasecmp.h"
+
+#include <string.h>
+
+#include "zerosize-ptr.h"
+#include "macros.h"
+
+int
+main (void)
+{
+ /* Test equal / not equal distinction. */
+ ASSERT (memcasecmp (zerosize_ptr (), zerosize_ptr (), 0) == 0);
+ ASSERT (memcasecmp ("foo", "foobar", 2) == 0);
+ ASSERT (memcasecmp ("foo", "foobar", 3) == 0);
+ ASSERT (memcasecmp ("foo", "foobar", 4) != 0);
+ ASSERT (memcasecmp ("foo", "bar", 1) != 0);
+ ASSERT (memcasecmp ("foo", "bar", 3) != 0);
+
+ /* Test less / equal / greater distinction. */
+ ASSERT (memcasecmp ("foo", "moo", 4) < 0);
+ ASSERT (memcasecmp ("moo", "foo", 4) > 0);
+ ASSERT (memcasecmp ("oomph", "oops", 3) < 0);
+ ASSERT (memcasecmp ("oops", "oomph", 3) > 0);
+ ASSERT (memcasecmp ("foo", "foobar", 4) < 0);
+ ASSERT (memcasecmp ("foobar", "foo", 4) > 0);
+
+ /* Test embedded NULs. */
+ ASSERT (memcasecmp ("1\0", "2\0", 2) < 0);
+ ASSERT (memcasecmp ("2\0", "1\0", 2) > 0);
+ ASSERT (memcasecmp ("x\0""1", "x\0""2", 3) < 0);
+ ASSERT (memcasecmp ("x\0""2", "x\0""1", 3) > 0);
+
+ /* The Next x86 OpenStep bug shows up only when comparing 16 bytes
+ or more and with at least one buffer not starting on a 4-byte boundary.
+ William Lewis provided this test program. */
+ {
+ char foo[21];
+ char bar[21];
+ int i;
+ for (i = 0; i < 4; i++)
+ {
+ char *a = foo + i;
+ char *b = bar + i;
+ strcpy (a, "--------01111111");
+ strcpy (b, "--------10000000");
+ ASSERT (memcasecmp (a, b, 16) < 0);
+ }
+ }
+
+ return 0;
+}
ASSERT (MEMCHR (input + 1, 'a', n - 1) == input + n - 1);
ASSERT (MEMCHR (input + 1, 'e', n - 1) == input + n - 2);
+ ASSERT (MEMCHR (input + 1, 0x789abc00 | 'e', n - 1) == input + n - 2);
ASSERT (MEMCHR (input, 'f', n) == NULL);
ASSERT (MEMCHR (input, '\0', n) == NULL);
/* Check that memchr() does not read past the first occurrence of the
byte being searched. See the Austin Group's clarification
- <http://www.opengroup.org/austin/docs/austin_454.txt>. */
+ <http://www.opengroup.org/austin/docs/austin_454.txt>.
+ Test both '\0' and something else, since some implementations
+ special-case searching for NUL.
+ */
{
char *page_boundary = (char *) zerosize_ptr ();
+ /* Too small, and we miss cache line boundary tests; too large,
+ and the test takes cubically longer to complete. */
+ int limit = 257;
if (page_boundary != NULL)
{
- for (n = 1; n <= 500; n++)
+ for (n = 1; n <= limit; n++)
{
char *mem = page_boundary - n;
memset (mem, 'X', n);
ASSERT (MEMCHR (mem, 'U', n) == NULL);
+ ASSERT (MEMCHR (mem, 0, n) == NULL);
{
size_t i;
+ size_t k;
for (i = 0; i < n; i++)
{
mem[i] = 'U';
- ASSERT (MEMCHR (mem, 'U', 4000) == mem + i);
+ for (k = i + 1; k < n + limit; k++)
+ ASSERT (MEMCHR (mem, 'U', k) == mem + i);
+ mem[i] = 0;
+ for (k = i + 1; k < n + limit; k++)
+ ASSERT (MEMCHR (mem, 0, k) == mem + i);
mem[i] = 'X';
}
}
--- /dev/null
+/*
+ * Copyright (C) 2008-2010 Free Software Foundation, Inc.
+ * Written by Simon Josefsson and Bruno Haible
+ *
+ * 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/>. */
+
+#include <config.h>
+
+#include "memcoll.h"
+
+#include <string.h>
+
+#include "macros.h"
+
+int
+main (void)
+{
+ /* Test equal / not equal distinction. */
+ ASSERT (memcoll0 ("", 1, "", 1) == 0);
+ ASSERT (memcoll0 ("fo", 3, "fo", 3) == 0);
+ ASSERT (memcoll0 ("foo", 4, "foo", 4) == 0);
+ ASSERT (memcoll0 ("foo\0", 5, "foob", 5) != 0);
+ ASSERT (memcoll0 ("f", 2, "b", 2) != 0);
+ ASSERT (memcoll0 ("foo", 4, "bar", 4) != 0);
+
+ /* Test less / equal / greater distinction. */
+ ASSERT (memcoll0 ("foo\0", 5, "moo\0", 5) < 0);
+ ASSERT (memcoll0 ("moo\0", 5, "foo\0", 5) > 0);
+ ASSERT (memcoll0 ("oom", 4, "oop", 4) < 0);
+ ASSERT (memcoll0 ("oop", 4, "oom", 4) > 0);
+ ASSERT (memcoll0 ("foo\0", 5, "foob", 5) < 0);
+ ASSERT (memcoll0 ("foob", 5, "foo\0", 5) > 0);
+
+ /* Test embedded NULs. */
+ ASSERT (memcoll0 ("1\0", 3, "2\0", 3) < 0);
+ ASSERT (memcoll0 ("2\0", 3, "1\0", 3) > 0);
+ ASSERT (memcoll0 ("x\0""1", 4, "x\0""2", 4) < 0);
+ ASSERT (memcoll0 ("x\0""2", 4, "x\0""1", 4) > 0);
+
+ return 0;
+}
ASSERT (result == input);
}
+ /* Check that a long periodic needle does not cause false positives. */
+ {
+ const char input[] = ("F_BD_CE_BD_EF_BF_BD_EF_BF_BD_EF_BF_BD_EF_BF_BD"
+ "_C3_88_20_EF_BF_BD_EF_BF_BD_EF_BF_BD"
+ "_C3_A7_20_EF_BF_BD");
+ const char need[] = "_EF_BF_BD_EF_BF_BD_EF_BF_BD_EF_BF_BD_EF_BF_BD";
+ const char *result = memmem (input, strlen (input), need, strlen (need));
+ ASSERT (result == NULL);
+ }
+ {
+ const char input[] = ("F_BD_CE_BD_EF_BF_BD_EF_BF_BD_EF_BF_BD_EF_BF_BD"
+ "_C3_88_20_EF_BF_BD_EF_BF_BD_EF_BF_BD"
+ "_C3_A7_20_EF_BF_BD_DA_B5_C2_A6_20"
+ "_EF_BF_BD_EF_BF_BD_EF_BF_BD_EF_BF_BD_EF_BF_BD");
+ const char need[] = "_EF_BF_BD_EF_BF_BD_EF_BF_BD_EF_BF_BD_EF_BF_BD";
+ const char *result = memmem (input, strlen (input), need, strlen (need));
+ ASSERT (result == input + 115);
+ }
+
/* Check that a very long haystack is handled quickly if the needle is
short and occurs near the beginning. */
{
--- /dev/null
+/* Test of <net/if.h> functions.
+ Copyright (C) 2010 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 Simon Josefsson <simon@josefsson.org>, 2010. */
+
+#include <config.h>
+
+#include <net/if.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (if_freenameindex, void, (struct if_nameindex *));
+SIGNATURE_CHECK (if_indextoname, char *, (unsigned int, char *));
+SIGNATURE_CHECK (if_nameindex, struct if_nameindex *, (void));
+SIGNATURE_CHECK (if_nametoindex, unsigned int, (const char *));
+
+#include <stddef.h> /* NULL */
+#include <stdio.h> /* fprintf */
+
+int
+main (int argc, char *argv[])
+{
+ struct if_nameindex *ifnp, *p;
+
+ p = ifnp = if_nameindex ();
+ if (ifnp == NULL)
+ {
+ fputs ("if_nameindex returned NULL\n", stderr);
+ return 1;
+ }
+
+ while (p->if_index)
+ {
+ unsigned int idx;
+ char buf[IF_NAMESIZE];
+ char *q;
+
+ if (argc > 1)
+ printf ("index %d name %s\n", p->if_index, p->if_name);
+
+ idx = if_nametoindex (p->if_name);
+ if (idx != p->if_index)
+ {
+ fprintf (stderr, "if_nametoindex (%s) = %d != %d\n",
+ p->if_name, idx, p->if_index);
+ return 1;
+ }
+
+ q = if_indextoname (p->if_index, buf);
+ if (q == NULL)
+ {
+ fprintf (stderr, "if_indextoname (%d) returned NULL\n", p->if_index);
+ return 1;
+ }
+ if (q != buf)
+ {
+ fprintf (stderr, "if_indextoname (%d) buffer mismatch?\n",
+ p->if_index);
+ return 1;
+ }
+ if (strcmp (p->if_name, q) != 0)
+ {
+ fprintf (stderr, "if_indextoname (%s) = %s ?!\n", p->if_name, q);
+ return 1;
+ }
+
+ p++;
+ }
+
+ if_freenameindex (ifnp);
+
+ return 0;
+}
/* nl_langinfo items of the LC_MONETARY category */
{
const char *currency = nl_langinfo (CRNCYSTR);
- ASSERT (strlen (currency) >= (pass > 0 ? 1 : 0));
+ ASSERT (strlen (currency) >= 0);
+#if !defined __NetBSD__
+ if (pass > 0)
+ ASSERT (strlen (currency) >= 1);
+#endif
}
/* nl_langinfo items of the LC_MESSAGES category */
ASSERT (strlen (nl_langinfo (YESEXPR)) > 0);
--- /dev/null
+/* Test of parse_datetime() function.
+ Copyright (C) 2008, 2009, 2010 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, write to the Free Software Foundation,
+ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+/* Written by Simon Josefsson <simon@josefsson.org>, 2008. */
+
+#include <config.h>
+
+#include "parse-datetime.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "progname.h"
+#include "macros.h"
+
+#ifdef DEBUG
+#define LOG(str, now, res) \
+ printf ("string `%s' diff %d %d\n", \
+ str, res.tv_sec - now.tv_sec, res.tv_nsec - now.tv_nsec);
+#else
+#define LOG(str, now, res) (void) 0
+#endif
+
+static const char* const day_table[] =
+{
+ "SUNDAY",
+ "MONDAY",
+ "TUESDAY",
+ "WEDNESDAY",
+ "THURSDAY",
+ "FRIDAY",
+ "SATURDAY",
+ NULL
+};
+
+int
+main (int argc _GL_UNUSED, char **argv)
+{
+ struct timespec result;
+ struct timespec result2;
+ struct timespec now;
+ const char *p;
+ int i;
+
+ set_program_name (argv[0]);
+
+ now.tv_sec = 4711;
+ now.tv_nsec = 1267;
+ p = "now";
+ ASSERT (parse_datetime (&result, p, &now));
+ LOG (p, now, result);
+ ASSERT (now.tv_sec == result.tv_sec && now.tv_nsec == result.tv_nsec);
+
+ now.tv_sec = 4711;
+ now.tv_nsec = 1267;
+ p = "tomorrow";
+ ASSERT (parse_datetime (&result, p, &now));
+ LOG (p, now, result);
+ ASSERT (now.tv_sec + 24 * 60 * 60 == result.tv_sec
+ && now.tv_nsec == result.tv_nsec);
+
+ now.tv_sec = 4711;
+ now.tv_nsec = 1267;
+ p = "yesterday";
+ ASSERT (parse_datetime (&result, p, &now));
+ LOG (p, now, result);
+ ASSERT (now.tv_sec - 24 * 60 * 60 == result.tv_sec
+ && now.tv_nsec == result.tv_nsec);
+
+ now.tv_sec = 4711;
+ now.tv_nsec = 1267;
+ p = "4 hours";
+ ASSERT (parse_datetime (&result, p, &now));
+ LOG (p, now, result);
+ ASSERT (now.tv_sec + 4 * 60 * 60 == result.tv_sec
+ && now.tv_nsec == result.tv_nsec);
+
+ /* test if timezone is not being ignored for day offset */
+ now.tv_sec = 4711;
+ now.tv_nsec = 1267;
+ p = "UTC+400 +24 hours";
+ ASSERT (parse_datetime (&result, p, &now));
+ LOG (p, now, result);
+ p = "UTC+400 +1 day";
+ ASSERT (parse_datetime (&result2, p, &now));
+ LOG (p, now, result2);
+ ASSERT (result.tv_sec == result2.tv_sec
+ && result.tv_nsec == result2.tv_nsec);
+
+ /* test if several time zones formats are handled same way */
+ now.tv_sec = 4711;
+ now.tv_nsec = 1267;
+ p = "UTC+14:00";
+ ASSERT (parse_datetime (&result, p, &now));
+ LOG (p, now, result);
+ p = "UTC+14";
+ ASSERT (parse_datetime (&result2, p, &now));
+ LOG (p, now, result2);
+ ASSERT (result.tv_sec == result2.tv_sec
+ && result.tv_nsec == result2.tv_nsec);
+ p = "UTC+1400";
+ ASSERT (parse_datetime (&result2, p, &now));
+ LOG (p, now, result2);
+ ASSERT (result.tv_sec == result2.tv_sec
+ && result.tv_nsec == result2.tv_nsec);
+
+ now.tv_sec = 4711;
+ now.tv_nsec = 1267;
+ p = "UTC-14:00";
+ ASSERT (parse_datetime (&result, p, &now));
+ LOG (p, now, result);
+ p = "UTC-14";
+ ASSERT (parse_datetime (&result2, p, &now));
+ LOG (p, now, result2);
+ ASSERT (result.tv_sec == result2.tv_sec
+ && result.tv_nsec == result2.tv_nsec);
+ p = "UTC-1400";
+ ASSERT (parse_datetime (&result2, p, &now));
+ LOG (p, now, result2);
+ ASSERT (result.tv_sec == result2.tv_sec
+ && result.tv_nsec == result2.tv_nsec);
+
+ now.tv_sec = 4711;
+ now.tv_nsec = 1267;
+ p = "UTC+0:15";
+ ASSERT (parse_datetime (&result, p, &now));
+ LOG (p, now, result);
+ p = "UTC+0015";
+ ASSERT (parse_datetime (&result2, p, &now));
+ LOG (p, now, result2);
+ ASSERT (result.tv_sec == result2.tv_sec
+ && result.tv_nsec == result2.tv_nsec);
+
+ now.tv_sec = 4711;
+ now.tv_nsec = 1267;
+ p = "UTC-1:30";
+ ASSERT (parse_datetime (&result, p, &now));
+ LOG (p, now, result);
+ p = "UTC-130";
+ ASSERT (parse_datetime (&result2, p, &now));
+ LOG (p, now, result2);
+ ASSERT (result.tv_sec == result2.tv_sec
+ && result.tv_nsec == result2.tv_nsec);
+
+
+ /* TZ out of range should cause parse_datetime failure */
+ now.tv_sec = 4711;
+ now.tv_nsec = 1267;
+ p = "UTC+25:00";
+ ASSERT (!parse_datetime (&result, p, &now));
+
+ /* Check for several invalid countable dayshifts */
+ now.tv_sec = 4711;
+ now.tv_nsec = 1267;
+ p = "UTC+4:00 +40 yesterday";
+ ASSERT (!parse_datetime (&result, p, &now));
+ p = "UTC+4:00 next yesterday";
+ ASSERT (!parse_datetime (&result, p, &now));
+ p = "UTC+4:00 tomorrow ago";
+ ASSERT (!parse_datetime (&result, p, &now));
+ p = "UTC+4:00 40 now ago";
+ ASSERT (!parse_datetime (&result, p, &now));
+ p = "UTC+4:00 last tomorrow";
+ ASSERT (!parse_datetime (&result, p, &now));
+ p = "UTC+4:00 -4 today";
+ ASSERT (!parse_datetime (&result, p, &now));
+
+ /* And check correct usage of dayshifts */
+ now.tv_sec = 4711;
+ now.tv_nsec = 1267;
+ p = "UTC+400 tomorrow";
+ ASSERT (parse_datetime (&result, p, &now));
+ LOG (p, now, result);
+ p = "UTC+400 +1 day";
+ ASSERT (parse_datetime (&result2, p, &now));
+ LOG (p, now, result2);
+ ASSERT (result.tv_sec == result2.tv_sec
+ && result.tv_nsec == result2.tv_nsec);
+ now.tv_sec = 4711;
+ now.tv_nsec = 1267;
+ p = "UTC+400 yesterday";
+ ASSERT (parse_datetime (&result, p, &now));
+ LOG (p, now, result);
+ p = "UTC+400 1 day ago";
+ ASSERT (parse_datetime (&result2, p, &now));
+ LOG (p, now, result2);
+ ASSERT (result.tv_sec == result2.tv_sec
+ && result.tv_nsec == result2.tv_nsec);
+ now.tv_sec = 4711;
+ now.tv_nsec = 1267;
+ p = "UTC+400 now";
+ ASSERT (parse_datetime (&result, p, &now));
+ LOG (p, now, result);
+ p = "UTC+400 +0 minutes"; /* silly, but simple "UTC+400" is different*/
+ ASSERT (parse_datetime (&result2, p, &now));
+ LOG (p, now, result2);
+ ASSERT (result.tv_sec == result2.tv_sec
+ && result.tv_nsec == result2.tv_nsec);
+
+ /* Check that some "next Monday", "last Wednesday", etc. are correct. */
+ setenv ("TZ", "UTC0", 1);
+ for (i = 0; day_table[i]; i++)
+ {
+ unsigned int thur2 = 7 * 24 * 3600; /* 2nd thursday */
+ char tmp[32];
+ sprintf (tmp, "NEXT %s", day_table[i]);
+ now.tv_sec = thur2 + 4711;
+ now.tv_nsec = 1267;
+ ASSERT (parse_datetime (&result, tmp, &now));
+ LOG (tmp, now, result);
+ ASSERT (result.tv_nsec == 0);
+ ASSERT (result.tv_sec == thur2 + (i == 4 ? 7 : (i + 3) % 7) * 24 * 3600);
+
+ sprintf (tmp, "LAST %s", day_table[i]);
+ now.tv_sec = thur2 + 4711;
+ now.tv_nsec = 1267;
+ ASSERT (parse_datetime (&result, tmp, &now));
+ LOG (tmp, now, result);
+ ASSERT (result.tv_nsec == 0);
+ ASSERT (result.tv_sec == thur2 + ((i + 3) % 7 - 7) * 24 * 3600);
+ }
+
+ p = "THURSDAY UTC+00"; /* The epoch was on Thursday. */
+ now.tv_sec = 0;
+ now.tv_nsec = 0;
+ ASSERT (parse_datetime (&result, p, &now));
+ LOG (p, now, result);
+ ASSERT (result.tv_sec == now.tv_sec
+ && result.tv_nsec == now.tv_nsec);
+
+ p = "FRIDAY UTC+00";
+ now.tv_sec = 0;
+ now.tv_nsec = 0;
+ ASSERT (parse_datetime (&result, p, &now));
+ LOG (p, now, result);
+ ASSERT (result.tv_sec == 24 * 3600
+ && result.tv_nsec == now.tv_nsec);
+
+ return 0;
+}
#include "macros.h"
-/* Pipe a text file through 'tr a-z A-Z', which converts ASCII characters from
- lower case to upper case. */
+/* Pipe a text file through 'tr "[a-z]" "[A-Z]"', which converts ASCII
+ characters from lower case to upper case. */
struct locals
{
l.nread = 0;
argv[0] = tr_program;
- argv[1] = "a-z";
- argv[2] = "A-Z";
+ argv[1] = "[a-z]";
+ argv[2] = "[A-Z]";
argv[3] = NULL;
f = pipe_filter_gi_create ("tr", tr_program, argv, false, true,
#include "macros.h"
-/* Pipe a text file through 'tr a-z A-Z', which converts ASCII characters from
- lower case to upper case. */
+/* Pipe a text file through 'tr "[a-z]" "[A-Z]"', which converts ASCII
+ characters from lower case to upper case. */
struct locals
{
l.nread = 0;
argv[0] = tr_program;
- argv[1] = "a-z";
- argv[2] = "A-Z";
+ argv[1] = "[a-z]";
+ argv[2] = "[A-Z]";
argv[3] = NULL;
result = pipe_filter_ii_execute ("tr", tr_program, argv, false, true,
#else
use_nonblocking = 0;
#endif
-#if defined O_CLOEXEC
+#if O_CLOEXEC
for (use_cloexec = 0; use_cloexec <= 1; use_cloexec++)
#else
use_cloexec = 0;
if (use_nonblocking)
o_flags |= O_NONBLOCK;
#endif
-#if defined O_CLOEXEC
+#if O_CLOEXEC
if (use_cloexec)
o_flags |= O_CLOEXEC;
#endif
--- /dev/null
+/* Test of <poll.h> substitute in C++ mode.
+ Copyright (C) 2010 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 Bruno Haible <bruno@clisp.org>, 2010. */
+
+#define GNULIB_NAMESPACE gnulib
+#include <config.h>
+
+#include <poll.h>
+
+#include "signature.h"
+
+
+#if GNULIB_TEST_POLL
+SIGNATURE_CHECK (GNULIB_NAMESPACE::poll, int, (struct pollfd *, nfds_t, int));
+#endif
+
+
+int
+main ()
+{
+}
--- /dev/null
+/* Test of <poll.h> substitute.
+ Copyright (C) 2010 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 Bruno Haible, 2010. */
+
+#include <config.h>
+
+#include <poll.h>
+
+/* Check that the nfds_t type is defined. */
+nfds_t a;
+
+/* Check that the various POLL* macros are defined. */
+int b = POLLIN | POLLPRI | POLLOUT | POLLERR | POLLHUP | POLLNVAL
+ | POLLRDNORM | POLLRDBAND | POLLWRNORM | POLLWRBAND;
+
+int
+main (void)
+{
+ return 0;
+}
#include <config.h>
+/* Specification. */
#include <poll.h>
#include "signature.h"
#include <stdlib.h>
+#include "zerosize-ptr.h"
#include "macros.h"
/* Calculating void * + int is not portable, so this wrapper converts
ASSERT (RAWMEMCHR (input + 1, 'a') == input + n - 1);
ASSERT (RAWMEMCHR (input + 1, 'e') == input + n - 2);
+ ASSERT (RAWMEMCHR (input + 1, 0x789abc00 | 'e') == input + n - 2);
ASSERT (RAWMEMCHR (input, '\0') == input + n);
}
}
+ /* Ensure that no unaligned oversized reads occur. */
+ {
+ char *page_boundary = (char *) zerosize_ptr ();
+ size_t i;
+
+ if (!page_boundary)
+ page_boundary = input + 4096;
+ memset (page_boundary - 512, '1', 511);
+ page_boundary[-1] = '2';
+ for (i = 1; i <= 512; i++)
+ ASSERT (RAWMEMCHR (page_boundary - i, (i * 0x01010100) | '2')
+ == page_boundary - 1);
+ }
+
free (input);
return 0;
err = 1;
}
- /* Assume FILE1 is a regular file or a symlink to a regular file. */
- if (len != statbuf.st_size)
+ if (S_ISREG (statbuf.st_mode))
{
- fprintf (stderr, "Read %ld from %s...\n", (unsigned long) len, FILE1);
- err = 1;
+ /* FILE1 is a regular file or a symlink to a regular file. */
+ if (len != statbuf.st_size)
+ {
+ fprintf (stderr, "Read %ld from %s...\n", (unsigned long) len, FILE1);
+ err = 1;
+ }
+ }
+ else
+ {
+ /* Assume FILE1 is not empty. */
+ if (len == 0)
+ {
+ fprintf (stderr, "Read nothing from %s\n", FILE1);
+ err = 1;
+ }
}
free (out);
}
--- /dev/null
+/* Test of realloc function.
+ Copyright (C) 2010 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/>. */
+
+#include <config.h>
+
+#include <stdlib.h>
+
+int
+main ()
+{
+ /* Check that realloc (NULL, 0) is not a NULL pointer. */
+ if (realloc (NULL, 0) == NULL)
+ return 1;
+
+ return 0;
+}
--- /dev/null
+/* Test of constructing a regular expression from a literal string.
+ Copyright (C) 2010 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 Bruno Haible <bruno@clisp.org>, 2010. */
+
+#include <config.h>
+
+#include "regex-quote.h"
+
+#include <string.h>
+
+#include "regex.h"
+#include "xalloc.h"
+#include "macros.h"
+
+static void
+check (const char *literal, int cflags, const char *expected)
+{
+ char *result;
+ size_t length;
+
+ result = regex_quote (literal, cflags);
+ ASSERT (strcmp (result, expected) == 0);
+ length = regex_quote_length (literal, cflags);
+ ASSERT (length == strlen (result));
+ free (result);
+
+ result = (char *) xmalloc (1 + length + 1 + 1);
+ result[0] = '^';
+ strcpy (regex_quote_copy (result + 1, literal, cflags), "$");
+ {
+ regex_t regex;
+ regmatch_t match[1];
+
+ ASSERT (regcomp (®ex, result, cflags) == 0);
+
+ ASSERT (regexec (®ex, literal, 1, match, 0) == 0);
+ ASSERT (match[0].rm_so == 0);
+ ASSERT (match[0].rm_eo == strlen (literal));
+ regfree (®ex);
+ }
+ free (result);
+}
+
+static void
+test_bre (void)
+{
+ check ("aBc", 0, "aBc");
+ check ("(foo[$HOME])", 0, "(foo\\[\\$HOME\\])");
+}
+
+static void
+test_ere (void)
+{
+ check ("aBc", REG_EXTENDED, "aBc");
+ check ("(foo[$HOME])", REG_EXTENDED, "\\(foo\\[\\$HOME\\]\\)");
+}
+
+int
+main ()
+{
+ test_bre ();
+ test_ere ();
+ return 0;
+}
#include <string.h>
#include <sys/stat.h>
-#if HAVE_ACL_GET_FILE || HAVE_ACL || HAVE_ACLX_GET || HAVE_STATACL
+#if HAVE_ACL_GET_FILE || HAVE_FACL || HAVE_ACLX_GET || HAVE_STATACL || HAVE_ACLSORT
# include <sys/types.h>
# include <sys/acl.h>
#endif
}
}
}
-#elif HAVE_ACL && defined GETACL /* Solaris, Cygwin, not HP-UX */
+#elif HAVE_FACL && defined GETACL /* Solaris, Cygwin, not HP-UX */
int count1;
int count2;
file1, file2);
return 1;
}
+#elif HAVE_ACLSORT /* NonStop Kernel */
+ int count1;
+ int count2;
+
+ count1 = acl ((char *) file1, ACL_CNT, NACLENTRIES, NULL);
+ count2 = acl ((char *) file2, ACL_CNT, NACLENTRIES, NULL);
+
+ if (count1 < 0)
+ {
+ fprintf (stderr, "error accessing the ACLs of file %s\n", file1);
+ fflush (stderr);
+ abort ();
+ }
+ if (count2 < 0)
+ {
+ fprintf (stderr, "error accessing the ACLs of file %s\n", file2);
+ fflush (stderr);
+ abort ();
+ }
+ if (count1 != count2)
+ {
+ fprintf (stderr, "files %s and %s have different number of ACLs: %d and %d\n",
+ file1, file2, count1, count2);
+ return 1;
+ }
+ else if (count1 > 0)
+ {
+ struct acl *entries1 = XNMALLOC (count1, struct acl);
+ struct acl *entries2 = XNMALLOC (count2, struct acl);
+ int i;
+
+ if (acl ((char *) file1, ACL_GET, count1, entries1) < count1)
+ {
+ fprintf (stderr, "error retrieving the ACLs of file %s\n", file1);
+ fflush (stderr);
+ abort ();
+ }
+ if (acl ((char *) file2, ACL_GET, count2, entries2) < count1)
+ {
+ fprintf (stderr, "error retrieving the ACLs of file %s\n", file2);
+ fflush (stderr);
+ abort ();
+ }
+ for (i = 0; i < count1; i++)
+ {
+ if (entries1[i].a_type != entries2[i].a_type)
+ {
+ fprintf (stderr, "files %s and %s: different ACL entry #%d: different types %d and %d\n",
+ file1, file2, i, entries1[i].a_type, entries2[i].a_type);
+ return 1;
+ }
+ if (entries1[i].a_id != entries2[i].a_id)
+ {
+ fprintf (stderr, "files %s and %s: different ACL entry #%d: different ids %d and %d\n",
+ file1, file2, i, (int)entries1[i].a_id, (int)entries2[i].a_id);
+ return 1;
+ }
+ if (entries1[i].a_perm != entries2[i].a_perm)
+ {
+ fprintf (stderr, "files %s and %s: different ACL entry #%d: different permissions %03o and %03o\n",
+ file1, file2, i, (unsigned int) entries1[i].a_perm, (unsigned int) entries2[i].a_perm);
+ return 1;
+ }
+ }
+ }
#endif
}
#include <sys/ioctl.h>
#include <errno.h>
+#include "macros.h"
+
enum { SEL_IN = 1, SEL_OUT = 2, SEL_EXC = 4 };
#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
addrlen = sizeof (ia);
c2 = accept (s, (struct sockaddr *) &ia, &addrlen);
- close (s);
- close (c1);
- close (c2);
+ ASSERT (close (s) == 0);
+ ASSERT (close (c1) == 0);
+ ASSERT (close (c2) == 0);
}
{
addrlen = sizeof (ia);
c = accept (s, (struct sockaddr *) &ia, &addrlen);
- close (s);
- write (c, "foo", 3);
- read (c, buf, 3);
+ ASSERT (close (s) == 0);
+ ASSERT (write (c, "foo", 3) == 3);
+ ASSERT (read (c, buf, 3) == 3);
shutdown (c, SHUT_RD);
- close (c);
+ ASSERT (close (c) == 0);
exit (0);
}
else
{
- close (s);
+ ASSERT (close (s) == 0);
c = connect_to_socket (true);
if (do_select_nowait (c, SEL_OUT) != SEL_OUT)
failed ("cannot write after blocking connect");
- write (c, "foo", 3);
+ ASSERT (write (c, "foo", 3) == 3);
wait (&pid);
if (do_select_wait (c, SEL_IN) != SEL_IN)
failed ("cannot read data left in the socket by closed process");
- read (c, buf, 3);
- write (c, "foo", 3);
- close (c);
+ ASSERT (read (c, buf, 3) == 3);
+ ASSERT (write (c, "foo", 3) == 3);
+ ASSERT (close (c) == 0);
}
#endif
}
if (do_select_nowait (wd, SEL_IN | SEL_OUT | SEL_EXC) != SEL_OUT)
failed ("expecting writability before writing");
- write (wd, "foo", 3);
+ ASSERT (write (wd, "foo", 3) == 3);
if (do_select_wait (rd, SEL_IN) != SEL_IN)
failed ("expecting readability after writing");
if (do_select_nowait (rd, SEL_IN) != SEL_IN)
failed ("expecting readability after writing");
- read (rd, buf, 3);
+ ASSERT (read (rd, buf, 3) == 3);
}
int c1 = connect_to_socket (false);
int c2 = accept (s, (struct sockaddr *) &ia, &addrlen);
- close (s);
+ ASSERT (close (s) == 0);
test_pair (c1, c2);
- close (c1);
- write (c2, "foo", 3);
- close (c2);
+ ASSERT (close (c1) == 0);
+ ASSERT (write (c2, "foo", 3) == 3);
+ ASSERT (close (c2) == 0);
}
{
int fd[2];
- pipe (fd);
+ ASSERT (pipe (fd) == 0);
test_pair (fd[0], fd[1]);
- close (fd[0]);
- close (fd[1]);
+ ASSERT (close (fd[0]) == 0);
+ ASSERT (close (fd[1]) == 0);
}
acl_flavor=hpux
else
if (getacl tmpfile0 >/dev/null) 2>/dev/null; then
- # Tru64.
- acl_flavor=osf1
+ # Tru64, NonStop Kernel.
+ if (getacl -m tmpfile0 >/dev/null) 2>/dev/null; then
+ # Tru64.
+ acl_flavor=osf1
+ else
+ # NonStop Kernel.
+ acl_flavor=nsk
+ fi
else
if (aclget tmpfile0 >/dev/null) 2>/dev/null; then
# AIX.
osf1)
setacl -u user:$auid:1 tmpfile0
;;
+ nsk)
+ setacl -m user:$auid:1 tmpfile0
+ ;;
aix)
{ aclget tmpfile0 | sed -e 's/disabled$/enabled/'; echo " permit --x u:$auid"; } | aclput tmpfile0
;;
#include "verify.h"
-int exitcode;
+/* Check that EXIT_SUCCESS is 0, per POSIX. */
+static int exitcode = EXIT_SUCCESS;
+#if EXIT_SUCCESS
+"oops"
+#endif
+
+/* Check for GNU value (not guaranteed by POSIX, but is guaranteed by
+ gnulib). */
+#if EXIT_FAILURE != 1
+"oops"
+#endif
/* Check that NULL can be passed through varargs as a pointer type,
per POSIX 2008. */
verify (sizeof NULL == sizeof (void *));
+#if GNULIB_TEST_SYSTEM_POSIX
+# include "test-sys_wait.h"
+#else
+# define test_sys_wait_macros() 0
+#endif
+
int
main (void)
{
- /* Check that some macros are defined and different integer constants. */
- switch (exitcode)
- {
- case EXIT_SUCCESS:
- case EXIT_FAILURE:
- break;
- }
-
- return 0;
+ if (test_sys_wait_macros ())
+ return 1;
+
+ return exitcode;
}
ASSERT (result == input + 11);
}
+ /* Check that a long periodic needle does not cause false positives. */
+ {
+ const char input[] = ("F_BD_CE_BD_EF_BF_BD_EF_BF_BD_EF_BF_BD_EF_BF_BD"
+ "_C3_88_20_EF_BF_BD_EF_BF_BD_EF_BF_BD"
+ "_C3_A7_20_EF_BF_BD");
+ const char need[] = "_EF_BF_BD_EF_BF_BD_EF_BF_BD_EF_BF_BD_EF_BF_BD";
+ const char *result = strcasestr (input, need);
+ ASSERT (result == NULL);
+ }
+ {
+ const char input[] = ("F_BD_CE_BD_EF_BF_BD_EF_BF_BD_EF_BF_BD_EF_BF_BD"
+ "_C3_88_20_EF_BF_BD_EF_BF_BD_EF_BF_BD"
+ "_C3_A7_20_EF_BF_BD_DA_B5_C2_A6_20"
+ "_EF_BF_BD_EF_BF_BD_EF_BF_BD_EF_BF_BD_EF_BF_BD");
+ const char need[] = "_EF_BF_BD_EF_BF_BD_EF_BF_BD_EF_BF_BD_EF_BF_BD";
+ const char *result = strcasestr (input, need);
+ ASSERT (result == input + 115);
+ }
+
/* Check that a very long haystack is handled quickly if the needle is
short and occurs near the beginning. */
{
--- /dev/null
+/*
+ * Copyright (C) 2010 Free Software Foundation, Inc.
+ * Written by Eric Blake
+ *
+ * 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/>. */
+
+#include <config.h>
+
+#include <string.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (strnlen, size_t, (char const *, size_t));
+
+#include <stdlib.h>
+
+#include "zerosize-ptr.h"
+#include "macros.h"
+
+int
+main (void)
+{
+ size_t i;
+ char *page_boundary = (char *) zerosize_ptr ();
+ if (!page_boundary)
+ {
+ page_boundary = malloc (0x1000);
+ ASSERT (page_boundary);
+ page_boundary += 0x1000;
+ }
+
+ /* Basic behavior tests. */
+ ASSERT (strnlen ("a", 0) == 0);
+ ASSERT (strnlen ("a", 1) == 1);
+ ASSERT (strnlen ("a", 2) == 1);
+ ASSERT (strnlen ("", 0x100000) == 0);
+
+ /* Memory fence and alignment testing. */
+ for (i = 0; i < 512; i++)
+ {
+ char *start = page_boundary - i;
+ size_t j = i;
+ memset (start, 'x', i);
+ do
+ {
+ if (i != j)
+ {
+ start[j] = 0;
+ ASSERT (strnlen (start, i + j) == j);
+ }
+ ASSERT (strnlen (start, i) == j);
+ ASSERT (strnlen (start, j) == j);
+ }
+ while (j--);
+ }
+
+ return 0;
+}
ASSERT (result == input + 11);
}
+ /* Check that a long periodic needle does not cause false positives. */
+ {
+ const char input[] = ("F_BD_CE_BD_EF_BF_BD_EF_BF_BD_EF_BF_BD_EF_BF_BD"
+ "_C3_88_20_EF_BF_BD_EF_BF_BD_EF_BF_BD"
+ "_C3_A7_20_EF_BF_BD");
+ const char need[] = "_EF_BF_BD_EF_BF_BD_EF_BF_BD_EF_BF_BD_EF_BF_BD";
+ const char *result = strstr (input, need);
+ ASSERT (result == NULL);
+ }
+ {
+ const char input[] = ("F_BD_CE_BD_EF_BF_BD_EF_BF_BD_EF_BF_BD_EF_BF_BD"
+ "_C3_88_20_EF_BF_BD_EF_BF_BD_EF_BF_BD"
+ "_C3_A7_20_EF_BF_BD_DA_B5_C2_A6_20"
+ "_EF_BF_BD_EF_BF_BD_EF_BF_BD_EF_BF_BD_EF_BF_BD");
+ const char need[] = "_EF_BF_BD_EF_BF_BD_EF_BF_BD_EF_BF_BD_EF_BF_BD";
+ const char *result = strstr (input, need);
+ ASSERT (result == input + 115);
+ }
+
/* Check that a very long haystack is handled quickly if the needle is
short and occurs near the beginning. */
{
ASSERT (ptr == input + 10);
ASSERT (errno == ERANGE);
}
+ {
+ const char input[] = "1E 1000000";
+ char *ptr;
+ double result;
+ errno = 0;
+ result = strtod (input, &ptr);
+ ASSERT (result == 1.0); /* HP-UX 11.11, IRIX 6.5, OSF/1 4.0 */
+ ASSERT (ptr == input + 1); /* HP-UX 11.11, IRIX 6.5 */
+ ASSERT (errno == 0);
+ }
+ {
+ const char input[] = "0x1P 1000000";
+ char *ptr;
+ double result;
+ errno = 0;
+ result = strtod (input, &ptr);
+ ASSERT (result == 1.0); /* NetBSD 3.0, OpenBSD 4.0, AIX 7.1, HP-UX 11.11, IRIX 6.5, OSF/1 5.1, Solaris 10, mingw */
+ ASSERT (ptr == input + 3); /* NetBSD 3.0, OpenBSD 4.0, AIX 7.1, HP-UX 11.11, IRIX 6.5, OSF/1 5.1, Solaris 10, mingw */
+ ASSERT (errno == 0);
+ }
/* Infinity. */
{
ASSERT (ptr == input + 6); /* NetBSD 3.0, OpenBSD 4.0, AIX 5.1, HP-UX 11.11, IRIX 6.5, OSF/1 5.1, Solaris 10, mingw */
ASSERT (errno == 0);
}
+ {
+ const char input[] = "0x1p 2";
+ char *ptr;
+ double result;
+ errno = 0;
+ result = strtod (input, &ptr);
+ ASSERT (result == 1.0); /* NetBSD 3.0, OpenBSD 4.0, AIX 7.1, HP-UX 11.11, IRIX 6.5, OSF/1 5.1, Solaris 10, mingw */
+ ASSERT (ptr == input + 3); /* NetBSD 3.0, OpenBSD 4.0, AIX 7.1, HP-UX 11.11, IRIX 6.5, OSF/1 5.1, Solaris 10, mingw */
+ ASSERT (errno == 0);
+ }
/* Large buffers. */
{
int
main (void)
{
- char buf[80];
int result;
/* Remove any leftovers from a previous partial run. */
--- /dev/null
+/* Test of <sys/wait.h> substitute in C++ mode.
+ Copyright (C) 2010 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 Bruno Haible <bruno@clisp.org>, 2010. */
+
+#define GNULIB_NAMESPACE gnulib
+#include <config.h>
+
+#include <sys/wait.h>
+
+#include "signature.h"
+
+
+#if GNULIB_TEST_WAITPID
+SIGNATURE_CHECK (GNULIB_NAMESPACE::waitpid, pid_t, (pid_t, int *, int));
+#endif
+
+
+int
+main ()
+{
+}
/* Check for existence of required types. */
static pid_t a;
+#include "test-sys_wait.h"
+
int
main (void)
{
- return a;
+ if (test_sys_wait_macros ())
+ return 1;
+
+ switch (0)
+ {
+#if 0
+ /* Gnulib doesn't guarantee these, yet. */
+ case WCONTINUED:
+ case WEXITED:
+ case WNOWAIT:
+ case WSTOPPED:
+#endif
+ break;
+ }
+
+ return a ? 1 : 0;
}
--- /dev/null
+/* Test of macros shared between <sys/wait.h> and <stdlib.h>.
+ Copyright (C) 2010 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 Eric Blake <ebb9@byu.net>, 2010. */
+
+static int
+test_sys_wait_macros (void)
+{
+ /* Check subset of <sys/wait.h> macros that must be visible here.
+ Note that some of these macros are only portable when operating
+ on an lvalue. */
+ int i;
+ for (i = 0; i < 0x8000; i = (i ? i << 1 : 1))
+ {
+ /* POSIX requires that for all valid process statuses, that
+ exactly one of these three macros is true. But not all
+ possible 16-bit values map to valid process status.
+ Traditionally, 8 of the bits are for WIFEXITED, 7 of the bits
+ to tell between WIFSIGNALED and WIFSTOPPED, and either 0x80
+ or 0x8000 to flag that core was also dumped. Since we don't
+ know which byte is WIFEXITED, we skip the both possible bits
+ that can signal core dump. */
+ if (i == 0x80)
+ continue;
+ if (!!WIFSIGNALED (i) + !!WIFEXITED (i) + !!WIFSTOPPED (i) != 1)
+ return 1;
+ }
+ i = WEXITSTATUS (i) + WSTOPSIG (i) + WTERMSIG (i);
+
+ switch (i)
+ {
+#if 0
+ /* Gnulib doesn't guarantee these, yet. */
+ case WNOHANG:
+ case WUNTRACED:
+#endif
+ break;
+ }
+ return 0;
+}
--- /dev/null
+/* Test of <termios.h> substitute in C++ mode.
+ Copyright (C) 2010 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 Bruno Haible <bruno@clisp.org>, 2010. */
+
+#define GNULIB_NAMESPACE gnulib
+#include <config.h>
+
+#include <termios.h>
+
+#include "signature.h"
+
+
+#if GNULIB_TEST_TCGETSID
+SIGNATURE_CHECK (GNULIB_NAMESPACE::tcgetsid, pid_t, (int));
+#endif
+
+
+int
+main ()
+{
+}
--- /dev/null
+/* Test of <termios.h> substitute.
+ Copyright (C) 2010 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 Bruno Haible <bruno@clisp.org>, 2010. */
+
+#include <config.h>
+
+#include <termios.h>
+
+int
+main (void)
+{
+ return 0;
+}
compare() { cmp "$@"; }
fi
+# Ensure the update-copyright program gets found.
+PATH=$abs_aux_dir:$PATH
+
TMP_BASE=update-copyright.test
trap 'rm -f $TMP_BASE*' 0 1 2 3 15
exit 77
}
+# Skip this test if Perl is too old. FIXME: 5.8.0 is just a guess.
+# We have a report that 5.6.1 is inadequate and that 5.8.0 works.
+perl -e 'require 5.8.0' || {
+ echo '$0: skipping this test; Perl version is too old' 1>&2
+ exit 77
+}
+
# Do not let a different envvar setting perturb results.
UPDATE_COPYRIGHT_MAX_LINE_LENGTH=72
export UPDATE_COPYRIGHT_MAX_LINE_LENGTH
#include "test-lutimens.h"
#include "test-utimens.h"
-/* Wrap gl_futimens to behave like futimens. */
+/* Wrap fdutimens to behave like futimens. */
static int
do_futimens (int fd, struct timespec const times[2])
{
- return gl_futimens (fd, NULL, times);
+ return fdutimens (fd, NULL, times);
}
/* Test the use of file descriptors alongside a name. */
if (fd < 0)
fd = open (name, O_RDONLY);
errno = 0;
- result = fdutimens (name, fd, times);
+ result = fdutimens (fd, name, times);
if (0 <= fd)
{
int saved_errno = errno;
# along with this program. If not, see <http://www.gnu.org/licenses/>. */
: ${srcdir=.}
-. "$srcdir/init.sh"; path_prepend_ .
+. "$srcdir/init.sh"; path_prepend_ "$abs_aux_dir" .
tmpdir=vc-cvs
repo=`pwd`/$tmpdir/repo
# along with this program. If not, see <http://www.gnu.org/licenses/>. */
: ${srcdir=.}
-. "$srcdir/init.sh"; path_prepend_ .
+. "$srcdir/init.sh"; path_prepend_ "$abs_aux_dir" .
tmpdir=vc-git-$$
GIT_DIR= GIT_WORK_TREE=; unset GIT_DIR GIT_WORK_TREE
}
}
+#if 0
+ /* This check is disabled, because uN_strchr() is allowed to read past the
+ first occurrence of the byte being searched. In fact, u8_strchr() does
+ so, on i586 glibc systems: u8_strchr calls strchr, which in
+ glibc/sysdeps/i386/i586/strchr.S loads the second word before the
+ handling of the first word has been completed. */
/* Check that uN_strchr() does not read past the first occurrence of the
byte being searched. */
{
}
}
}
+#endif
free (input);
}
$(shell test -f $(srcdir)/$(_build-aux)/git-version-gen && echo yes)
ifeq ($(_have-git-version-gen)0,yes$(MAKELEVEL))
_is-dist-target ?= $(filter-out %clean, \
- $(filter maintainer-% dist% alpha beta major,$(MAKECMDGOALS)))
+ $(filter maintainer-% dist% alpha beta stable,$(MAKECMDGOALS)))
_is-install-target ?= $(filter-out %check, $(filter install%,$(MAKECMDGOALS)))
ifneq (,$(_is-dist-target)$(_is-install-target))
_curr-ver := $(shell cd $(srcdir) \
@or=$(gl_header_upper_case_or_); \
re="HAVE_($$or)_H"; \
prohibit='\<'"$$re"'\>' \
- halt='do not test the above HAVE_<header>_H symbol(s);\n'\
-' with the corresponding gnulib module, they are always true' \
+ halt=$$(printf '%s\n' \
+ 'do not test the above HAVE_<header>_H symbol(s);' \
+ ' with the corresponding gnulib module, they are always true') \
$(_sc_search_regexp)
# ==================================================================
test "$$fail" && exit 1 || : ; \
fi
-v_etc_file = lib/version-etc.c
+v_etc_file = $(gnulib_dir)/lib/version-etc.c
sample-test = tests/sample-test
texi = doc/$(PACKAGE).texi
# Make sure that the copyright date in $(v_etc_file) is up to date.
sc_vulnerable_makefile_CVE-2009-4029:
@prohibit='perm -777 -exec chmod a\+rwx|chmod 777 \$$\(distdir\)' \
in_files=$$(find $(srcdir) -name Makefile.in) \
- halt='the above files are vulnerable; beware of running\n'\
-'"make dist*" rules, and upgrade to fixed automake\n'\
-'see http://bugzilla.redhat.com/542609 for details' \
+ halt=$$(printf '%s\n' \
+ 'the above files are vulnerable; beware of running' \
+ ' "make dist*" rules, and upgrade to fixed automake' \
+ ' see http://bugzilla.redhat.com/542609 for details') \
$(_sc_search_regexp)
vc-diff-check: