+2015-01-31 Andreas Gruenbacher <agruen@gnu.org>
+
+ Upate NEWS
+
+ Fix indentation heuristic for context diffs
+ Diffs can be indented by a variable number of spaces, tabs, or X characters.
+ Make sure that intuit_diff_type() only accepts context diffs where the first
+ and second line are indented identically, or else another_hunk() will fail.
+ * src/pch.c (intuit_diff_type): Remember the indentation of the last line. Only
+ recognize context diff hunks with the same amount of indentation on the first
+ and second line.
+ * tests/garbage: New test case.
+ * tests/Makefile.am (TESTS): Add test case.
+
+2015-01-31 Quentin Casasnovas <quentin.casasnovas@oracle.com>
+
+ patch: git-diff mode: do not change permissions if there isn't an explicit mode change.
+
+ tests: add a test case for unwanted mode changes.
+
+ test-lib.sh: factorize require_* functions
+ Since the code is identical when just checking if a utility is present on
+ the system or not, we can factorize it.
+
+2015-01-31 Andreas Gruenbacher <agruen@gnu.org>
+
+ Add test case for patch behind symlink
+ * tests/symlinks: Add a test case where the patch file itself is in a path that
+ follows a symbolic link; we want to continue allowing that.
+
+2015-01-31 Tim Waugh <twaugh@redhat.com>
+
+ Allow arbitrary symlink targets again
+ * src/util.c (symlink_target_is_valid): Remove.
+ (move_file): Remove symlink target checking.
+ * tests/symlinks: Update test case.
+
+2015-01-31 Andreas Gruenbacher <agruen@gnu.org>
+
+ Update list of gnulib modules used
+ * bootstrap.conf (gnulib_modules): Remove lchmod, lstat, mkdir, readlink,
+ rename, mkdir, symlink, unlink, utimens. Add fchownat, fchmodat, fstatat,
+ mkdirat, openat, readlinkat, renameat, symlinkat, unlinkat, utimensat.
+ * src/util.h: Don't include <utimens.h> anymore.
+
+ Use symlink-safe system call replacements
+ Use the symlink-safe replacements for system calls in many places throughout
+ the code: In some places this makes patch safe against path traversal attacks;
+ in other places, it saves the kernel from having to re-traverse the pathnames.
+ * src/inp.c (plan_b): Use safe_open() + fdopen() instead of fopen().
+ * src/util.c (copy_attr): Document why we are safe here.
+ (create_backup): Use safe_open() instead of creat().
+
+2015-01-31 Tim Waugh <twaugh@redhat.com>
+
+ Add symlink-safe system call replacements
+ Add wrappers around system calls that traverse relative pathnames without
+ following symlinks. Written by Tim Waugh <twaugh@redhat.com> and Andreas
+ Gruenbacher <agruenba@redhat.com>.
+ * src/safe.h: Declare functions here.
+ * src/safe.c: Implement safe_* system call replacements that do not follow
+ symlinks along pathnames. Pathname components are resolved with openat().
+ Lookup results are cached to keep the overhead reasonably low.
+ * tests/deep-directories: New path traversal cache test.
+ * src/Makefile.am (patch_SOURCES): Add safe.[ch].
+ * tests/Makefile.am (TESTS): Add new test.
+
+2015-01-31 Andreas Gruenbacher <agruen@gnu.org>
+
+ build: update gnulib submodule to latest
+
+2015-01-31 Tim Waugh <twaugh@redhat.com>
+
+ Avoid closing file descriptor twice
+ * src/patch.c (main): Make sure we don't close() outfd after passing it on to
+ fdopen(): the file descriptor might have been reused in the meantime.
+
+2015-01-29 Andreas Gruenbacher <agruen@gnu.org>
+
+ Remove unused variable
+ * src/pch.c (name_is_valid): Remove unused variable.
+
2015-01-22 Andreas Gruenbacher <agruen@gnu.org>
Fix the fix for CVE-2015-1196
# It is necessary if you want to build targets usually of interest
# only to the maintainer.
-# Copyright (C) 2001, 2003, 2006-2014 Free Software Foundation, Inc.
+# Copyright (C) 2001, 2003, 2006-2015 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
Installation Instructions
*************************
-Copyright (C) 1994-1996, 1999-2002, 2004-2013 Free Software Foundation,
-Inc.
+ Copyright (C) 1994-1996, 1999-2002, 2004-2015 Free Software
+Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
Basic Installation
==================
- Briefly, the shell command `./configure && make && make install'
+ Briefly, the shell command './configure && make && make install'
should configure, build, and install this package. The following
-more-detailed instructions are generic; see the `README' file for
+more-detailed instructions are generic; see the 'README' file for
instructions specific to this package. Some packages provide this
-`INSTALL' file but do not implement all of the features documented
+'INSTALL' file but do not implement all of the features documented
below. The lack of an optional feature in a given package is not
necessarily a bug. More recommendations for GNU packages can be found
in *note Makefile Conventions: (standards)Makefile Conventions.
- The `configure' shell script attempts to guess correct values for
+ The 'configure' shell script attempts to guess correct values for
various system-dependent variables used during compilation. It uses
-those values to create a `Makefile' in each directory of the package.
-It may also create one or more `.h' files containing system-dependent
-definitions. Finally, it creates a shell script `config.status' that
+those values to create a 'Makefile' in each directory of the package.
+It may also create one or more '.h' files containing system-dependent
+definitions. Finally, it creates a shell script 'config.status' that
you can run in the future to recreate the current configuration, and a
-file `config.log' containing compiler output (useful mainly for
-debugging `configure').
+file 'config.log' containing compiler output (useful mainly for
+debugging 'configure').
- It can also use an optional file (typically called `config.cache'
-and enabled with `--cache-file=config.cache' or simply `-C') that saves
-the results of its tests to speed up reconfiguring. Caching is
-disabled by default to prevent problems with accidental use of stale
-cache files.
+ It can also use an optional file (typically called 'config.cache' and
+enabled with '--cache-file=config.cache' or simply '-C') that saves the
+results of its tests to speed up reconfiguring. Caching is disabled by
+default to prevent problems with accidental use of stale cache files.
If you need to do unusual things to compile the package, please try
-to figure out how `configure' could check whether to do them, and mail
-diffs or instructions to the address given in the `README' so they can
+to figure out how 'configure' could check whether to do them, and mail
+diffs or instructions to the address given in the 'README' so they can
be considered for the next release. If you are using the cache, and at
-some point `config.cache' contains results you don't want to keep, you
+some point 'config.cache' contains results you don't want to keep, you
may remove or edit it.
- The file `configure.ac' (or `configure.in') is used to create
-`configure' by a program called `autoconf'. You need `configure.ac' if
-you want to change it or regenerate `configure' using a newer version
-of `autoconf'.
+ The file 'configure.ac' (or 'configure.in') is used to create
+'configure' by a program called 'autoconf'. You need 'configure.ac' if
+you want to change it or regenerate 'configure' using a newer version of
+'autoconf'.
The simplest way to compile this package is:
- 1. `cd' to the directory containing the package's source code and type
- `./configure' to configure the package for your system.
+ 1. 'cd' to the directory containing the package's source code and type
+ './configure' to configure the package for your system.
- Running `configure' might take a while. While running, it prints
+ Running 'configure' might take a while. While running, it prints
some messages telling which features it is checking for.
- 2. Type `make' to compile the package.
+ 2. Type 'make' to compile the package.
- 3. Optionally, type `make check' to run any self-tests that come with
+ 3. Optionally, type 'make check' to run any self-tests that come with
the package, generally using the just-built uninstalled binaries.
- 4. Type `make install' to install the programs and any data files and
+ 4. Type 'make install' to install the programs and any data files and
documentation. When installing into a prefix owned by root, it is
recommended that the package be configured and built as a regular
- user, and only the `make install' phase executed with root
+ user, and only the 'make install' phase executed with root
privileges.
- 5. Optionally, type `make installcheck' to repeat any self-tests, but
+ 5. Optionally, type 'make installcheck' to repeat any self-tests, but
this time using the binaries in their final installed location.
This target does not install anything. Running this target as a
- regular user, particularly if the prior `make install' required
+ regular user, particularly if the prior 'make install' required
root privileges, verifies that the installation completed
correctly.
6. You can remove the program binaries and object files from the
- source code directory by typing `make clean'. To also remove the
- files that `configure' created (so you can compile the package for
- a different kind of computer), type `make distclean'. There is
- also a `make maintainer-clean' target, but that is intended mainly
+ source code directory by typing 'make clean'. To also remove the
+ files that 'configure' created (so you can compile the package for
+ a different kind of computer), type 'make distclean'. There is
+ also a 'make maintainer-clean' target, but that is intended mainly
for the package's developers. If you use it, you may have to get
all sorts of other programs in order to regenerate files that came
with the distribution.
- 7. Often, you can also type `make uninstall' to remove the installed
+ 7. Often, you can also type 'make uninstall' to remove the installed
files again. In practice, not all packages have tested that
uninstallation works correctly, even though it is required by the
GNU Coding Standards.
- 8. Some packages, particularly those that use Automake, provide `make
+ 8. Some packages, particularly those that use Automake, provide 'make
distcheck', which can by used by developers to test that all other
- targets like `make install' and `make uninstall' work correctly.
+ targets like 'make install' and 'make uninstall' work correctly.
This target is generally not run by end users.
Compilers and Options
=====================
Some systems require unusual options for compilation or linking that
-the `configure' script does not know about. Run `./configure --help'
+the 'configure' script does not know about. Run './configure --help'
for details on some of the pertinent environment variables.
- You can give `configure' initial values for configuration parameters
-by setting variables in the command line or in the environment. Here
-is an example:
+ You can give 'configure' initial values for configuration parameters
+by setting variables in the command line or in the environment. Here is
+an example:
./configure CC=c99 CFLAGS=-g LIBS=-lposix
You can compile the package for more than one kind of computer at the
same time, by placing the object files for each architecture in their
-own directory. To do this, you can use GNU `make'. `cd' to the
+own directory. To do this, you can use GNU 'make'. 'cd' to the
directory where you want the object files and executables to go and run
-the `configure' script. `configure' automatically checks for the
-source code in the directory that `configure' is in and in `..'. This
-is known as a "VPATH" build.
+the 'configure' script. 'configure' automatically checks for the source
+code in the directory that 'configure' is in and in '..'. This is known
+as a "VPATH" build.
- With a non-GNU `make', it is safer to compile the package for one
+ With a non-GNU 'make', it is safer to compile the package for one
architecture at a time in the source code directory. After you have
-installed the package for one architecture, use `make distclean' before
+installed the package for one architecture, use 'make distclean' before
reconfiguring for another architecture.
On MacOS X 10.5 and later systems, you can create libraries and
executables that work on multiple system types--known as "fat" or
-"universal" binaries--by specifying multiple `-arch' options to the
-compiler but only a single `-arch' option to the preprocessor. Like
+"universal" binaries--by specifying multiple '-arch' options to the
+compiler but only a single '-arch' option to the preprocessor. Like
this:
./configure CC="gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64" \
This is not guaranteed to produce working output in all cases, you
may have to build one architecture at a time and combine the results
-using the `lipo' tool if you have problems.
+using the 'lipo' tool if you have problems.
Installation Names
==================
- By default, `make install' installs the package's commands under
-`/usr/local/bin', include files under `/usr/local/include', etc. You
-can specify an installation prefix other than `/usr/local' by giving
-`configure' the option `--prefix=PREFIX', where PREFIX must be an
+ By default, 'make install' installs the package's commands under
+'/usr/local/bin', include files under '/usr/local/include', etc. You
+can specify an installation prefix other than '/usr/local' by giving
+'configure' the option '--prefix=PREFIX', where PREFIX must be an
absolute file name.
You can specify separate installation prefixes for
architecture-specific files and architecture-independent files. If you
-pass the option `--exec-prefix=PREFIX' to `configure', the package uses
+pass the option '--exec-prefix=PREFIX' to 'configure', the package uses
PREFIX as the prefix for installing programs and libraries.
Documentation and other data files still use the regular prefix.
In addition, if you use an unusual directory layout you can give
-options like `--bindir=DIR' to specify different values for particular
-kinds of files. Run `configure --help' for a list of the directories
-you can set and what kinds of files go in them. In general, the
-default for these options is expressed in terms of `${prefix}', so that
-specifying just `--prefix' will affect all of the other directory
+options like '--bindir=DIR' to specify different values for particular
+kinds of files. Run 'configure --help' for a list of the directories
+you can set and what kinds of files go in them. In general, the default
+for these options is expressed in terms of '${prefix}', so that
+specifying just '--prefix' will affect all of the other directory
specifications that were not explicitly provided.
The most portable way to affect installation locations is to pass the
-correct locations to `configure'; however, many packages provide one or
+correct locations to 'configure'; however, many packages provide one or
both of the following shortcuts of passing variable assignments to the
-`make install' command line to change installation locations without
+'make install' command line to change installation locations without
having to reconfigure or recompile.
The first method involves providing an override variable for each
-affected directory. For example, `make install
+affected directory. For example, 'make install
prefix=/alternate/directory' will choose an alternate location for all
directory configuration variables that were expressed in terms of
-`${prefix}'. Any directories that were specified during `configure',
-but not in terms of `${prefix}', must each be overridden at install
-time for the entire installation to be relocated. The approach of
-makefile variable overrides for each directory variable is required by
-the GNU Coding Standards, and ideally causes no recompilation.
-However, some platforms have known limitations with the semantics of
-shared libraries that end up requiring recompilation when using this
-method, particularly noticeable in packages that use GNU Libtool.
-
- The second method involves providing the `DESTDIR' variable. For
-example, `make install DESTDIR=/alternate/directory' will prepend
-`/alternate/directory' before all installation names. The approach of
-`DESTDIR' overrides is not required by the GNU Coding Standards, and
+'${prefix}'. Any directories that were specified during 'configure',
+but not in terms of '${prefix}', must each be overridden at install time
+for the entire installation to be relocated. The approach of makefile
+variable overrides for each directory variable is required by the GNU
+Coding Standards, and ideally causes no recompilation. However, some
+platforms have known limitations with the semantics of shared libraries
+that end up requiring recompilation when using this method, particularly
+noticeable in packages that use GNU Libtool.
+
+ The second method involves providing the 'DESTDIR' variable. For
+example, 'make install DESTDIR=/alternate/directory' will prepend
+'/alternate/directory' before all installation names. The approach of
+'DESTDIR' overrides is not required by the GNU Coding Standards, and
does not work on platforms that have drive letters. On the other hand,
it does better at avoiding recompilation issues, and works well even
-when some directory options were not specified in terms of `${prefix}'
-at `configure' time.
+when some directory options were not specified in terms of '${prefix}'
+at 'configure' time.
Optional Features
=================
If the package supports it, you can cause programs to be installed
-with an extra prefix or suffix on their names by giving `configure' the
-option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
-
- Some packages pay attention to `--enable-FEATURE' options to
-`configure', where FEATURE indicates an optional part of the package.
-They may also pay attention to `--with-PACKAGE' options, where PACKAGE
-is something like `gnu-as' or `x' (for the X Window System). The
-`README' should mention any `--enable-' and `--with-' options that the
+with an extra prefix or suffix on their names by giving 'configure' the
+option '--program-prefix=PREFIX' or '--program-suffix=SUFFIX'.
+
+ Some packages pay attention to '--enable-FEATURE' options to
+'configure', where FEATURE indicates an optional part of the package.
+They may also pay attention to '--with-PACKAGE' options, where PACKAGE
+is something like 'gnu-as' or 'x' (for the X Window System). The
+'README' should mention any '--enable-' and '--with-' options that the
package recognizes.
- For packages that use the X Window System, `configure' can usually
+ For packages that use the X Window System, 'configure' can usually
find the X include and library files automatically, but if it doesn't,
-you can use the `configure' options `--x-includes=DIR' and
-`--x-libraries=DIR' to specify their locations.
+you can use the 'configure' options '--x-includes=DIR' and
+'--x-libraries=DIR' to specify their locations.
Some packages offer the ability to configure how verbose the
-execution of `make' will be. For these packages, running `./configure
+execution of 'make' will be. For these packages, running './configure
--enable-silent-rules' sets the default to minimal output, which can be
-overridden with `make V=1'; while running `./configure
+overridden with 'make V=1'; while running './configure
--disable-silent-rules' sets the default to verbose, which can be
-overridden with `make V=0'.
+overridden with 'make V=0'.
Particular systems
==================
- On HP-UX, the default C compiler is not ANSI C compatible. If GNU
-CC is not installed, it is recommended to use the following options in
+ On HP-UX, the default C compiler is not ANSI C compatible. If GNU CC
+is not installed, it is recommended to use the following options in
order to use an ANSI C compiler:
./configure CC="cc -Ae -D_XOPEN_SOURCE=500"
and if that doesn't work, install pre-built binaries of GCC for HP-UX.
- HP-UX `make' updates targets which have the same time stamps as
-their prerequisites, which makes it generally unusable when shipped
-generated files such as `configure' are involved. Use GNU `make'
-instead.
+ HP-UX 'make' updates targets which have the same time stamps as their
+prerequisites, which makes it generally unusable when shipped generated
+files such as 'configure' are involved. Use GNU 'make' instead.
On OSF/1 a.k.a. Tru64, some versions of the default C compiler cannot
-parse its `<wchar.h>' header file. The option `-nodtk' can be used as
-a workaround. If GNU CC is not installed, it is therefore recommended
-to try
+parse its '<wchar.h>' header file. The option '-nodtk' can be used as a
+workaround. If GNU CC is not installed, it is therefore recommended to
+try
./configure CC="cc"
./configure CC="cc -nodtk"
- On Solaris, don't put `/usr/ucb' early in your `PATH'. This
+ On Solaris, don't put '/usr/ucb' early in your 'PATH'. This
directory contains several dysfunctional programs; working variants of
-these programs are available in `/usr/bin'. So, if you need `/usr/ucb'
-in your `PATH', put it _after_ `/usr/bin'.
+these programs are available in '/usr/bin'. So, if you need '/usr/ucb'
+in your 'PATH', put it _after_ '/usr/bin'.
- On Haiku, software installed for all users goes in `/boot/common',
-not `/usr/local'. It is recommended to use the following options:
+ On Haiku, software installed for all users goes in '/boot/common',
+not '/usr/local'. It is recommended to use the following options:
./configure --prefix=/boot/common
Specifying the System Type
==========================
- There may be some features `configure' cannot figure out
+ There may be some features 'configure' cannot figure out
automatically, but needs to determine by the type of machine the package
will run on. Usually, assuming the package is built to be run on the
-_same_ architectures, `configure' can figure that out, but if it prints
+_same_ architectures, 'configure' can figure that out, but if it prints
a message saying it cannot guess the machine type, give it the
-`--build=TYPE' option. TYPE can either be a short name for the system
-type, such as `sun4', or a canonical name which has the form:
+'--build=TYPE' option. TYPE can either be a short name for the system
+type, such as 'sun4', or a canonical name which has the form:
CPU-COMPANY-SYSTEM
OS
KERNEL-OS
- See the file `config.sub' for the possible values of each field. If
-`config.sub' isn't included in this package, then this package doesn't
+ See the file 'config.sub' for the possible values of each field. If
+'config.sub' isn't included in this package, then this package doesn't
need to know the machine type.
If you are _building_ compiler tools for cross-compiling, you should
-use the option `--target=TYPE' to select the type of system they will
+use the option '--target=TYPE' to select the type of system they will
produce code for.
If you want to _use_ a cross compiler, that generates code for a
platform different from the build platform, you should specify the
"host" platform (i.e., that on which the generated programs will
-eventually be run) with `--host=TYPE'.
+eventually be run) with '--host=TYPE'.
Sharing Defaults
================
- If you want to set default values for `configure' scripts to share,
-you can create a site shell script called `config.site' that gives
-default values for variables like `CC', `cache_file', and `prefix'.
-`configure' looks for `PREFIX/share/config.site' if it exists, then
-`PREFIX/etc/config.site' if it exists. Or, you can set the
-`CONFIG_SITE' environment variable to the location of the site script.
-A warning: not all `configure' scripts look for a site script.
+ If you want to set default values for 'configure' scripts to share,
+you can create a site shell script called 'config.site' that gives
+default values for variables like 'CC', 'cache_file', and 'prefix'.
+'configure' looks for 'PREFIX/share/config.site' if it exists, then
+'PREFIX/etc/config.site' if it exists. Or, you can set the
+'CONFIG_SITE' environment variable to the location of the site script.
+A warning: not all 'configure' scripts look for a site script.
Defining Variables
==================
Variables not defined in a site shell script can be set in the
-environment passed to `configure'. However, some packages may run
+environment passed to 'configure'. However, some packages may run
configure again during the build, and the customized values of these
variables may be lost. In order to avoid this problem, you should set
-them in the `configure' command line, using `VAR=value'. For example:
+them in the 'configure' command line, using 'VAR=value'. For example:
./configure CC=/usr/local2/bin/gcc
-causes the specified `gcc' to be used as the C compiler (unless it is
+causes the specified 'gcc' to be used as the C compiler (unless it is
overridden in the site shell script).
-Unfortunately, this technique does not work for `CONFIG_SHELL' due to
-an Autoconf limitation. Until the limitation is lifted, you can use
-this workaround:
+Unfortunately, this technique does not work for 'CONFIG_SHELL' due to an
+Autoconf limitation. Until the limitation is lifted, you can use this
+workaround:
CONFIG_SHELL=/bin/bash ./configure CONFIG_SHELL=/bin/bash
-`configure' Invocation
+'configure' Invocation
======================
- `configure' recognizes the following options to control how it
+ 'configure' recognizes the following options to control how it
operates.
-`--help'
-`-h'
- Print a summary of all of the options to `configure', and exit.
+'--help'
+'-h'
+ Print a summary of all of the options to 'configure', and exit.
-`--help=short'
-`--help=recursive'
+'--help=short'
+'--help=recursive'
Print a summary of the options unique to this package's
- `configure', and exit. The `short' variant lists options used
- only in the top level, while the `recursive' variant lists options
- also present in any nested packages.
+ 'configure', and exit. The 'short' variant lists options used only
+ in the top level, while the 'recursive' variant lists options also
+ present in any nested packages.
-`--version'
-`-V'
- Print the version of Autoconf used to generate the `configure'
+'--version'
+'-V'
+ Print the version of Autoconf used to generate the 'configure'
script, and exit.
-`--cache-file=FILE'
+'--cache-file=FILE'
Enable the cache: use and save the results of the tests in FILE,
- traditionally `config.cache'. FILE defaults to `/dev/null' to
+ traditionally 'config.cache'. FILE defaults to '/dev/null' to
disable caching.
-`--config-cache'
-`-C'
- Alias for `--cache-file=config.cache'.
+'--config-cache'
+'-C'
+ Alias for '--cache-file=config.cache'.
-`--quiet'
-`--silent'
-`-q'
+'--quiet'
+'--silent'
+'-q'
Do not print messages saying which checks are being made. To
- suppress all normal output, redirect it to `/dev/null' (any error
+ suppress all normal output, redirect it to '/dev/null' (any error
messages will still be shown).
-`--srcdir=DIR'
+'--srcdir=DIR'
Look for the package's source code in directory DIR. Usually
- `configure' can determine that directory automatically.
+ 'configure' can determine that directory automatically.
-`--prefix=DIR'
- Use DIR as the installation prefix. *note Installation Names::
- for more details, including other options available for fine-tuning
- the installation locations.
+'--prefix=DIR'
+ Use DIR as the installation prefix. *note Installation Names:: for
+ more details, including other options available for fine-tuning the
+ installation locations.
-`--no-create'
-`-n'
+'--no-create'
+'-n'
Run the configure checks, but stop before creating any output
files.
-`configure' also accepts some other, not widely useful, options. Run
-`configure --help' for more details.
+'configure' also accepts some other, not widely useful, options. Run
+'configure --help' for more details.
DIST_COMMON = INSTALL NEWS README AUTHORS ChangeLog \
$(srcdir)/Makefile.in $(srcdir)/Makefile.am \
$(top_srcdir)/configure $(am__configure_deps) \
- $(srcdir)/config.hin $(dist_man1_MANS) COPYING \
+ $(srcdir)/config.hin $(dist_man1_MANS) COPYING TODO \
build-aux/ar-lib build-aux/compile build-aux/config.guess \
build-aux/config.sub build-aux/depcomp build-aux/install-sh \
build-aux/mdate-sh build-aux/missing build-aux/texinfo.tex \
$(top_srcdir)/m4/absolute-header.m4 $(top_srcdir)/m4/alloca.m4 \
$(top_srcdir)/m4/backupfile.m4 $(top_srcdir)/m4/bison.m4 \
$(top_srcdir)/m4/canonicalize.m4 \
+ $(top_srcdir)/m4/chdir-long.m4 $(top_srcdir)/m4/chown.m4 \
$(top_srcdir)/m4/clock_time.m4 $(top_srcdir)/m4/close.m4 \
$(top_srcdir)/m4/closedir.m4 $(top_srcdir)/m4/codeset.m4 \
$(top_srcdir)/m4/configmake.m4 $(top_srcdir)/m4/d-ino.m4 \
$(top_srcdir)/m4/eealloc.m4 $(top_srcdir)/m4/environ.m4 \
$(top_srcdir)/m4/errno_h.m4 $(top_srcdir)/m4/error.m4 \
$(top_srcdir)/m4/exponentd.m4 $(top_srcdir)/m4/extensions.m4 \
- $(top_srcdir)/m4/extern-inline.m4 $(top_srcdir)/m4/fcntl-o.m4 \
- $(top_srcdir)/m4/fcntl.m4 $(top_srcdir)/m4/fcntl_h.m4 \
+ $(top_srcdir)/m4/extern-inline.m4 $(top_srcdir)/m4/fchdir.m4 \
+ $(top_srcdir)/m4/fchmodat.m4 $(top_srcdir)/m4/fchownat.m4 \
+ $(top_srcdir)/m4/fcntl-o.m4 $(top_srcdir)/m4/fcntl.m4 \
+ $(top_srcdir)/m4/fcntl_h.m4 $(top_srcdir)/m4/filenamecat.m4 \
$(top_srcdir)/m4/float_h.m4 $(top_srcdir)/m4/fstat.m4 \
+ $(top_srcdir)/m4/fstatat.m4 $(top_srcdir)/m4/getcwd.m4 \
$(top_srcdir)/m4/getdtablesize.m4 $(top_srcdir)/m4/getopt.m4 \
$(top_srcdir)/m4/gettime.m4 $(top_srcdir)/m4/gettimeofday.m4 \
$(top_srcdir)/m4/glibc21.m4 $(top_srcdir)/m4/gnulib-common.m4 \
$(top_srcdir)/m4/gnulib-comp.m4 \
$(top_srcdir)/m4/include_next.m4 $(top_srcdir)/m4/intmax_t.m4 \
$(top_srcdir)/m4/inttypes_h.m4 $(top_srcdir)/m4/largefile.m4 \
- $(top_srcdir)/m4/lchmod.m4 $(top_srcdir)/m4/localcharset.m4 \
+ $(top_srcdir)/m4/lchown.m4 $(top_srcdir)/m4/localcharset.m4 \
$(top_srcdir)/m4/locale-fr.m4 $(top_srcdir)/m4/locale-ja.m4 \
$(top_srcdir)/m4/locale-zh.m4 $(top_srcdir)/m4/longlong.m4 \
$(top_srcdir)/m4/lstat.m4 $(top_srcdir)/m4/malloc.m4 \
$(top_srcdir)/m4/malloca.m4 $(top_srcdir)/m4/manywarnings.m4 \
$(top_srcdir)/m4/mbrtowc.m4 $(top_srcdir)/m4/mbsinit.m4 \
$(top_srcdir)/m4/mbstate_t.m4 $(top_srcdir)/m4/memchr.m4 \
+ $(top_srcdir)/m4/mempcpy.m4 $(top_srcdir)/m4/memrchr.m4 \
$(top_srcdir)/m4/minmax.m4 $(top_srcdir)/m4/mkdir.m4 \
- $(top_srcdir)/m4/mktime.m4 $(top_srcdir)/m4/mmap-anon.m4 \
+ $(top_srcdir)/m4/mkdirat.m4 $(top_srcdir)/m4/mktime.m4 \
+ $(top_srcdir)/m4/mmap-anon.m4 $(top_srcdir)/m4/mode_t.m4 \
$(top_srcdir)/m4/msvc-inval.m4 \
$(top_srcdir)/m4/msvc-nothrow.m4 $(top_srcdir)/m4/multiarch.m4 \
$(top_srcdir)/m4/nocrash.m4 $(top_srcdir)/m4/off_t.m4 \
+ $(top_srcdir)/m4/open.m4 $(top_srcdir)/m4/openat.m4 \
$(top_srcdir)/m4/opendir.m4 $(top_srcdir)/m4/parse-datetime.m4 \
$(top_srcdir)/m4/pathmax.m4 $(top_srcdir)/m4/printf.m4 \
$(top_srcdir)/m4/quote.m4 $(top_srcdir)/m4/quotearg.m4 \
$(top_srcdir)/m4/raise.m4 $(top_srcdir)/m4/readdir.m4 \
- $(top_srcdir)/m4/readlink.m4 $(top_srcdir)/m4/realloc.m4 \
- $(top_srcdir)/m4/rename.m4 $(top_srcdir)/m4/rmdir.m4 \
+ $(top_srcdir)/m4/readlink.m4 $(top_srcdir)/m4/readlinkat.m4 \
+ $(top_srcdir)/m4/realloc.m4 $(top_srcdir)/m4/rename.m4 \
+ $(top_srcdir)/m4/renameat.m4 $(top_srcdir)/m4/rmdir.m4 \
$(top_srcdir)/m4/safe-read.m4 $(top_srcdir)/m4/safe-write.m4 \
- $(top_srcdir)/m4/secure_getenv.m4 $(top_srcdir)/m4/setenv.m4 \
- $(top_srcdir)/m4/setmode.m4 $(top_srcdir)/m4/signal_h.m4 \
- $(top_srcdir)/m4/size_max.m4 $(top_srcdir)/m4/ssize_t.m4 \
- $(top_srcdir)/m4/stat-time.m4 $(top_srcdir)/m4/stat.m4 \
- $(top_srcdir)/m4/stdarg.m4 $(top_srcdir)/m4/stdbool.m4 \
- $(top_srcdir)/m4/stddef_h.m4 $(top_srcdir)/m4/stdint.m4 \
- $(top_srcdir)/m4/stdint_h.m4 $(top_srcdir)/m4/stdio_h.m4 \
- $(top_srcdir)/m4/stdlib_h.m4 $(top_srcdir)/m4/strerror.m4 \
+ $(top_srcdir)/m4/save-cwd.m4 $(top_srcdir)/m4/secure_getenv.m4 \
+ $(top_srcdir)/m4/setenv.m4 $(top_srcdir)/m4/setmode.m4 \
+ $(top_srcdir)/m4/signal_h.m4 $(top_srcdir)/m4/size_max.m4 \
+ $(top_srcdir)/m4/ssize_t.m4 $(top_srcdir)/m4/stat-time.m4 \
+ $(top_srcdir)/m4/stat.m4 $(top_srcdir)/m4/stdarg.m4 \
+ $(top_srcdir)/m4/stdbool.m4 $(top_srcdir)/m4/stddef_h.m4 \
+ $(top_srcdir)/m4/stdint.m4 $(top_srcdir)/m4/stdint_h.m4 \
+ $(top_srcdir)/m4/stdio_h.m4 $(top_srcdir)/m4/stdlib_h.m4 \
+ $(top_srcdir)/m4/strdup.m4 $(top_srcdir)/m4/strerror.m4 \
$(top_srcdir)/m4/string_h.m4 $(top_srcdir)/m4/strndup.m4 \
$(top_srcdir)/m4/strnlen.m4 $(top_srcdir)/m4/symlink.m4 \
- $(top_srcdir)/m4/sys_socket_h.m4 \
+ $(top_srcdir)/m4/symlinkat.m4 $(top_srcdir)/m4/sys_socket_h.m4 \
$(top_srcdir)/m4/sys_stat_h.m4 $(top_srcdir)/m4/sys_time_h.m4 \
$(top_srcdir)/m4/sys_types_h.m4 $(top_srcdir)/m4/tempname.m4 \
$(top_srcdir)/m4/time_h.m4 $(top_srcdir)/m4/time_r.m4 \
$(top_srcdir)/m4/timespec.m4 $(top_srcdir)/m4/tm_gmtoff.m4 \
$(top_srcdir)/m4/unistd-safer.m4 $(top_srcdir)/m4/unistd_h.m4 \
- $(top_srcdir)/m4/unlink.m4 $(top_srcdir)/m4/utimbuf.m4 \
- $(top_srcdir)/m4/utimens.m4 $(top_srcdir)/m4/utimes.m4 \
+ $(top_srcdir)/m4/unlink.m4 $(top_srcdir)/m4/unlinkat.m4 \
+ $(top_srcdir)/m4/utimbuf.m4 $(top_srcdir)/m4/utimens.m4 \
+ $(top_srcdir)/m4/utimensat.m4 $(top_srcdir)/m4/utimes.m4 \
$(top_srcdir)/m4/vasnprintf.m4 $(top_srcdir)/m4/vasprintf.m4 \
$(top_srcdir)/m4/warn-on-use.m4 $(top_srcdir)/m4/warnings.m4 \
$(top_srcdir)/m4/wchar_h.m4 $(top_srcdir)/m4/wchar_t.m4 \
HAVE_LINKAT = @HAVE_LINKAT@
HAVE_LONG_LONG_INT = @HAVE_LONG_LONG_INT@
HAVE_LSTAT = @HAVE_LSTAT@
+HAVE_MAX_ALIGN_T = @HAVE_MAX_ALIGN_T@
HAVE_MBRLEN = @HAVE_MBRLEN@
HAVE_MBRTOWC = @HAVE_MBRTOWC@
HAVE_MBSINIT = @HAVE_MBSINIT@
SYS_TIME_H_DEFINES_STRUCT_TIMESPEC = @SYS_TIME_H_DEFINES_STRUCT_TIMESPEC@
TIME_H_DEFINES_STRUCT_TIMESPEC = @TIME_H_DEFINES_STRUCT_TIMESPEC@
UNDEFINE_STRTOK_R = @UNDEFINE_STRTOK_R@
+UNISTD_H_DEFINES_STRUCT_TIMESPEC = @UNISTD_H_DEFINES_STRUCT_TIMESPEC@
UNISTD_H_HAVE_WINSOCK2_H = @UNISTD_H_HAVE_WINSOCK2_H@
UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS = @UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS@
VERSION = @VERSION@
+Changes until version 2.7.4:
+
* When a file isn't being deleted because the file contents don't match the
patch, the resulting message is now "Not deleting file ... as content
differs from patch" instead of "File ... is not empty after patch; not
deleting".
* Function names in hunks (from diff -p) are now preserved in reject files.
-* With git-style patches, symlinks that point outside the working directory
- will no longer be created (CVE-2015-1196).
+* Patch no longer follows symbolic links to input and output files. This
+ ensures that symbolic links created by git-style patches cannot cause
+ patch to write outside the working directory (CVE-2015-1196).
+* Various fixes.
Changes in version 2.7.1:
--- /dev/null
+* Add instrumentation code for the path traversal functions !!!
+
+access() !!!
+Apply the mode fix!
+Alpha release ?!
+Announcement ...
+
+* Fix Savannah patches.
+* Reduce the number of unnecessary syscalls: for example, stat is often called
+ repeatedly.
+* Call makedirs() before creating files inside the directory; with the dirfd
+ cache, this causes no extra syscalls anymore.
m4_include([m4/backupfile.m4])
m4_include([m4/bison.m4])
m4_include([m4/canonicalize.m4])
+m4_include([m4/chdir-long.m4])
+m4_include([m4/chown.m4])
m4_include([m4/clock_time.m4])
m4_include([m4/close.m4])
m4_include([m4/closedir.m4])
m4_include([m4/exponentd.m4])
m4_include([m4/extensions.m4])
m4_include([m4/extern-inline.m4])
+m4_include([m4/fchdir.m4])
+m4_include([m4/fchmodat.m4])
+m4_include([m4/fchownat.m4])
m4_include([m4/fcntl-o.m4])
m4_include([m4/fcntl.m4])
m4_include([m4/fcntl_h.m4])
+m4_include([m4/filenamecat.m4])
m4_include([m4/float_h.m4])
m4_include([m4/fstat.m4])
+m4_include([m4/fstatat.m4])
+m4_include([m4/getcwd.m4])
m4_include([m4/getdtablesize.m4])
m4_include([m4/getopt.m4])
m4_include([m4/gettime.m4])
m4_include([m4/intmax_t.m4])
m4_include([m4/inttypes_h.m4])
m4_include([m4/largefile.m4])
-m4_include([m4/lchmod.m4])
+m4_include([m4/lchown.m4])
m4_include([m4/localcharset.m4])
m4_include([m4/locale-fr.m4])
m4_include([m4/locale-ja.m4])
m4_include([m4/mbsinit.m4])
m4_include([m4/mbstate_t.m4])
m4_include([m4/memchr.m4])
+m4_include([m4/mempcpy.m4])
+m4_include([m4/memrchr.m4])
m4_include([m4/minmax.m4])
m4_include([m4/mkdir.m4])
+m4_include([m4/mkdirat.m4])
m4_include([m4/mktime.m4])
m4_include([m4/mmap-anon.m4])
+m4_include([m4/mode_t.m4])
m4_include([m4/msvc-inval.m4])
m4_include([m4/msvc-nothrow.m4])
m4_include([m4/multiarch.m4])
m4_include([m4/nocrash.m4])
m4_include([m4/off_t.m4])
+m4_include([m4/open.m4])
+m4_include([m4/openat.m4])
m4_include([m4/opendir.m4])
m4_include([m4/parse-datetime.m4])
m4_include([m4/pathmax.m4])
m4_include([m4/raise.m4])
m4_include([m4/readdir.m4])
m4_include([m4/readlink.m4])
+m4_include([m4/readlinkat.m4])
m4_include([m4/realloc.m4])
m4_include([m4/rename.m4])
+m4_include([m4/renameat.m4])
m4_include([m4/rmdir.m4])
m4_include([m4/safe-read.m4])
m4_include([m4/safe-write.m4])
+m4_include([m4/save-cwd.m4])
m4_include([m4/secure_getenv.m4])
m4_include([m4/setenv.m4])
m4_include([m4/setmode.m4])
m4_include([m4/stdint_h.m4])
m4_include([m4/stdio_h.m4])
m4_include([m4/stdlib_h.m4])
+m4_include([m4/strdup.m4])
m4_include([m4/strerror.m4])
m4_include([m4/string_h.m4])
m4_include([m4/strndup.m4])
m4_include([m4/strnlen.m4])
m4_include([m4/symlink.m4])
+m4_include([m4/symlinkat.m4])
m4_include([m4/sys_socket_h.m4])
m4_include([m4/sys_stat_h.m4])
m4_include([m4/sys_time_h.m4])
m4_include([m4/unistd-safer.m4])
m4_include([m4/unistd_h.m4])
m4_include([m4/unlink.m4])
+m4_include([m4/unlinkat.m4])
m4_include([m4/utimbuf.m4])
m4_include([m4/utimens.m4])
+m4_include([m4/utimensat.m4])
m4_include([m4/utimes.m4])
m4_include([m4/vasnprintf.m4])
m4_include([m4/vasprintf.m4])
#! /bin/sh
# Attempt to guess a canonical system name.
-# Copyright 1992-2014 Free Software Foundation, Inc.
+# Copyright 1992-2015 Free Software Foundation, Inc.
-timestamp='2014-11-04'
+timestamp='2015-01-01'
# 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
GNU config.guess ($timestamp)
Originally written by Per Bothner.
-Copyright 1992-2014 Free Software Foundation, Inc.
+Copyright 1992-2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
#! /bin/sh
# Configuration validation subroutine script.
-# Copyright 1992-2014 Free Software Foundation, Inc.
+# Copyright 1992-2015 Free Software Foundation, Inc.
-timestamp='2014-09-26'
+timestamp='2015-01-01'
# 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
version="\
GNU config.sub ($timestamp)
-Copyright 1992-2014 Free Software Foundation, Inc.
+Copyright 1992-2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
| c4x | c8051 | clipper \
| d10v | d30v | dlx | dsp16xx \
| epiphany \
- | fido | fr30 | frv \
+ | fido | fr30 | frv | ft32 \
| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
| hexagon \
| i370 | i860 | i960 | ia64 \
| tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \
| ubicom32 \
| v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \
+ | visium \
| we32k \
| x86 | xc16x | xstormy16 | xtensa \
| z8k | z80)
| ubicom32-* \
| v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \
| vax-* \
+ | visium-* \
| we32k-* \
| x86-* | x86_64-* | xc16x-* | xps100-* \
| xstormy16-* | xtensa*-* \
scriptversion=2013-05-30.07; # UTC
-# Copyright (C) 1999-2013 Free Software Foundation, Inc.
+# Copyright (C) 1999-2015 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
#!/bin/sh
# Print a version string.
-scriptversion=2014-06-19.19; # UTC
+scriptversion=2014-12-02.19; # UTC
-# Copyright (C) 2007-2014 Free Software Foundation, Inc.
+# Copyright (C) 2007-2015 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
fi
# Omit the trailing newline, so that m4_esyscmd can use the result directly.
-echo "$v" | tr -d "$nl"
+printf %s "$v"
# Local variables:
# eval: (add-hook 'write-file-hooks 'time-stamp)
# If you change this file with Emacs, please let the write hook
# do its job. Otherwise, update this string manually.
-# Copyright (C) 2008-2014 Free Software Foundation, Inc.
+# Copyright (C) 2008-2015 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
scriptversion=2010-08-21.06; # UTC
-# Copyright (C) 1995-2013 Free Software Foundation, Inc.
+# Copyright (C) 1995-2015 Free Software Foundation, Inc.
# written by Ulrich Drepper <drepper@gnu.ai.mit.edu>, June 1995
#
# This program is free software; you can redistribute it and/or modify
/* A C macro for declaring that specific arguments must not be NULL.
- Copyright (C) 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2009-2015 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
/* C++ compatible function declaration macros.
- Copyright (C) 2010-2014 Free Software Foundation, Inc.
+ Copyright (C) 2010-2015 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
/* A C macro for emitting warnings if a function is used.
- Copyright (C) 2010-2014 Free Software Foundation, Inc.
+ Copyright (C) 2010-2015 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
% Load plain if necessary, i.e., if running under initex.
\expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi
%
-\def\texinfoversion{2014-11-14.07}
+\def\texinfoversion{2015-01-30.16}
%
% Copyright 1985, 1986, 1988, 1990, 1991, 1992, 1993, 1994, 1995,
% 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
-% 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Free Software Foundation, Inc.
+% 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015
+% Free Software Foundation, Inc.
%
% This texinfo.tex file is free software: you can redistribute it and/or
% modify it under the terms of the GNU General Public License as
\let\ptexraggedright=\raggedright
\let\ptexrbrace=\}
\let\ptexslash=\/
+\let\ptexsp=\sp
\let\ptexstar=\*
+\let\ptexsup=\sup
\let\ptext=\t
\let\ptextop=\top
{\catcode`\'=\active \global\let\ptexquoteright'}% active in plain's math mode
\endgroup
}
-
% In order for the font changes to affect most math symbols and letters,
-% we have to define the \textfont of the standard families. Since
-% texinfo doesn't allow for producing subscripts and superscripts except
-% in the main text, we don't bother to reset \scriptfont and
-% \scriptscriptfont (which would also require loading a lot more fonts).
+% we have to define the \textfont of the standard families. We don't
+% bother to reset \scriptfont and \scriptscriptfont; awaiting user need.
%
\def\resetmathfonts{%
\textfont0=\tenrm \textfont1=\teni \textfont2=\tensy
% \tenSTYLE to set the current font.
%
% Each font-changing command also sets the names \lsize (one size lower)
-% and \lllsize (three sizes lower). These relative commands are used in
-% the LaTeX logo and acronyms.
+% and \lllsize (three sizes lower). These relative commands are used
+% in, e.g., the LaTeX logo and acronyms.
%
% This all needs generalizing, badly.
%
\let\v=\check
\let\~=\tilde
\let\dotaccent=\dot
+ % have to provide another name for sup operator
+ \let\mathopsup=\sup
$\finishmath
}
\def\finishmath#1{#1$\endgroup} % Close the group opened by \tex.
}
}
+% for @sub and @sup, if in math mode, just do a normal sub/superscript.
+% If in text, use math to place as sub/superscript, but switch
+% into text mode, with smaller fonts. This is a different font than the
+% one used for real math sub/superscripts (8pt vs. 7pt), but let's not
+% fix it (significant additions to font machinery) until someone notices.
+%
+\def\sub{\ifmmode \expandafter\sb \else \expandafter\finishsub\fi}
+\def\finishsub#1{$\sb{\hbox{\selectfonts\lllsize #1}}$}%
+%
+\def\sup{\ifmmode \expandafter\ptexsp \else \expandafter\finishsup\fi}
+\def\finishsup#1{$\ptexsp{\hbox{\selectfonts\lllsize #1}}$}%
+
% ctrl is no longer a Texinfo command, but leave this definition for fun.
\def\ctrl #1{{\tt \rawbackslash \hat}#1}
% other math active characters (just in case), to plain's definitions.
\mathactive
%
+ % Inverse of the list at the beginning of the file.
\let\b=\ptexb
\let\bullet=\ptexbullet
\let\c=\ptexc
\let\+=\tabalign
\let\}=\ptexrbrace
\let\/=\ptexslash
+ \let\sp=\ptexsp
\let\*=\ptexstar
+ %\let\sup=\ptexsup % do not redefine, we want @sup to work in math mode
\let\t=\ptext
\expandafter \let\csname top\endcsname=\ptextop % we've made it outer
\let\frenchspacing=\plainfrenchspacing
%
% \anythingelse will almost certainly be an error of some kind.
-
% \mbodybackslash is the definition of \ in @macro bodies.
% It maps \foo\ => \csname macarg.foo\endcsname => #N
% where N is the macro parameter number.
% the catcode regime underwhich the body was input).
%
% If you compile with TeX (not eTeX), and you have macros with 10 or more
-% arguments, you need that no macro has more than 256 arguments, otherwise an
-% error is produced.
+% arguments, no macro can have more than 256 arguments (else error).
\def\parsemargdef#1;{%
\paramno=0\def\paramlist{}%
\let\hash\relax
\catcode\count255=#1\relax
\advance\count255 by 1
\repeat
+
}
% @documentencoding sets the definition of non-ASCII characters
\utfeightchardefs
%
\else
- \message{Unknown document encoding #1, ignoring.}%
+ \message{Ignoring unknown document encoding: #1.}%
%
\fi % utfeight
\fi % latnine
\fi % ascii
}
+% emacs-page
% A message to be logged when using a character that isn't available
% the default font encoding (OT1).
%
-\def\missingcharmsg#1{\message{Character missing in OT1 encoding: #1.}}
+\def\missingcharmsg#1{\message{Character missing, sorry: #1.}}
% Take account of \c (plain) vs. \, (Texinfo) difference.
\def\cedilla#1{\ifx\c\ptexc\c{#1}\else\,{#1}\fi}
\gdef^^b4{\'{}}
\gdef^^b5{$\mu$}
\gdef^^b6{\P}
- %
- \gdef^^b7{$^.$}
+ \gdef^^b7{\ifmmode\cdot\else $\cdot$\fi}
\gdef^^b8{\cedilla\ }
\gdef^^b9{$^1$}
\gdef^^ba{\ordm}
- %
\gdef^^bb{\guillemetright}
\gdef^^bc{$1\over4$}
\gdef^^bd{$1\over2$}
\UTFviiiLoop
\endgroup
+\def\globallet{\global\let} % save some \expandafter's below
+
+% @U{xxxx} to produce U+xxxx, if we support it.
+\def\U#1{%
+ \expandafter\ifx\csname uni:#1\endcsname \relax
+ \errhelp = \EMsimple
+ \errmessage{Unicode character U+#1 not supported, sorry}%
+ \else
+ \csname uni:#1\endcsname
+ \fi
+}
+
\begingroup
\catcode`\"=12
\catcode`\<=12
\catcode`\;=12
\catcode`\!=12
\catcode`\~=13
-
\gdef\DeclareUnicodeCharacter#1#2{%
\countUTFz = "#1\relax
%\wlog{\space\space defining Unicode char U+#1 (decimal \the\countUTFz)}%
\expandafter\expandafter\expandafter\expandafter
\expandafter\expandafter\expandafter
\gdef\UTFviiiTmp{#2}%
+ %
+ \expandafter\ifx\csname uni:#1\endcsname \relax \else
+ \errmessage{Internal error, already defined: #1}%
+ \fi
+ %
+ % define an additional control sequence for this code point.
+ \expandafter\globallet\csname uni:#1\endcsname \UTFviiiTmp
\endgroup}
\gdef\parseXMLCharref{%
\uppercase{\gdef\UTFviiiTmp{#2#3#4}}}
\endgroup
+% https://en.wikipedia.org/wiki/Plane_(Unicode)#Basic_M
+% U+0000..U+007F = https://en.wikipedia.org/wiki/Basic_Latin_(Unicode_block)
+% U+0080..U+00FF = https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)
+% U+0100..U+017F = https://en.wikipedia.org/wiki/Latin_Extended-A
+% U+0180..U+024F = https://en.wikipedia.org/wiki/Latin_Extended-B
+%
+% Many of our renditions are less than wonderful, and all the missing
+% characters are available somewhere. Loading the necessary fonts
+% awaits user request. We can't truly support Unicode without
+% reimplementing everything that's been done in LaTeX for many years,
+% plus probably using luatex or xetex, and who knows what else.
+% We won't be doing that here in this simple file. But we can try to at
+% least make most of the characters not bomb out.
+%
\def\utfeightchardefs{%
\DeclareUnicodeCharacter{00A0}{\tie}
\DeclareUnicodeCharacter{00A1}{\exclamdown}
\DeclareUnicodeCharacter{00A3}{\pounds}
+ \DeclareUnicodeCharacter{00A7}{\S}
\DeclareUnicodeCharacter{00A8}{\"{ }}
\DeclareUnicodeCharacter{00A9}{\copyright}
\DeclareUnicodeCharacter{00AA}{\ordf}
\DeclareUnicodeCharacter{00AB}{\guillemetleft}
+ \DeclareUnicodeCharacter{00AC}{\ifmmode\lnot\else $\lnot$\fi}
\DeclareUnicodeCharacter{00AD}{\-}
\DeclareUnicodeCharacter{00AE}{\registeredsymbol}
\DeclareUnicodeCharacter{00AF}{\={ }}
\DeclareUnicodeCharacter{00B0}{\ringaccent{ }}
+ \DeclareUnicodeCharacter{00B1}{\ifmmode\pm\else $\pm$\fi}
+ \DeclareUnicodeCharacter{00B2}{$^2$}
+ \DeclareUnicodeCharacter{00B3}{$^3$}
\DeclareUnicodeCharacter{00B4}{\'{ }}
+ \DeclareUnicodeCharacter{00B5}{$\mu$}
+ \DeclareUnicodeCharacter{00B6}{\P}
+ \DeclareUnicodeCharacter{00B7}{\ifmmode\cdot\else $\cdot$\fi}
\DeclareUnicodeCharacter{00B8}{\cedilla{ }}
+ \DeclareUnicodeCharacter{00B9}{$^1$}
\DeclareUnicodeCharacter{00BA}{\ordm}
\DeclareUnicodeCharacter{00BB}{\guillemetright}
+ \DeclareUnicodeCharacter{00BC}{$1\over4$}
+ \DeclareUnicodeCharacter{00BD}{$1\over2$}
+ \DeclareUnicodeCharacter{00BE}{$3\over4$}
\DeclareUnicodeCharacter{00BF}{\questiondown}
\DeclareUnicodeCharacter{00C0}{\`A}
\DeclareUnicodeCharacter{00D4}{\^O}
\DeclareUnicodeCharacter{00D5}{\~O}
\DeclareUnicodeCharacter{00D6}{\"O}
+ \DeclareUnicodeCharacter{00D7}{\ifmmode\times\else $\times$\fi}
\DeclareUnicodeCharacter{00D8}{\O}
\DeclareUnicodeCharacter{00D9}{\`U}
\DeclareUnicodeCharacter{00DA}{\'U}
\DeclareUnicodeCharacter{00F4}{\^o}
\DeclareUnicodeCharacter{00F5}{\~o}
\DeclareUnicodeCharacter{00F6}{\"o}
+ \DeclareUnicodeCharacter{00F7}{\ifmmode\div\else $\div$\fi}
\DeclareUnicodeCharacter{00F8}{\o}
\DeclareUnicodeCharacter{00F9}{\`u}
\DeclareUnicodeCharacter{00FA}{\'u}
\DeclareUnicodeCharacter{0107}{\'c}
\DeclareUnicodeCharacter{0108}{\^C}
\DeclareUnicodeCharacter{0109}{\^c}
- \DeclareUnicodeCharacter{0118}{\ogonek{E}}
- \DeclareUnicodeCharacter{0119}{\ogonek{e}}
\DeclareUnicodeCharacter{010A}{\dotaccent{C}}
\DeclareUnicodeCharacter{010B}{\dotaccent{c}}
\DeclareUnicodeCharacter{010C}{\v{C}}
\DeclareUnicodeCharacter{010D}{\v{c}}
\DeclareUnicodeCharacter{010E}{\v{D}}
+ \DeclareUnicodeCharacter{010F}{d'}
+ \DeclareUnicodeCharacter{0110}{\DH}
+ \DeclareUnicodeCharacter{0111}{\dh}
\DeclareUnicodeCharacter{0112}{\=E}
\DeclareUnicodeCharacter{0113}{\=e}
\DeclareUnicodeCharacter{0114}{\u{E}}
\DeclareUnicodeCharacter{0115}{\u{e}}
\DeclareUnicodeCharacter{0116}{\dotaccent{E}}
\DeclareUnicodeCharacter{0117}{\dotaccent{e}}
+ \DeclareUnicodeCharacter{0118}{\ogonek{E}}
+ \DeclareUnicodeCharacter{0119}{\ogonek{e}}
\DeclareUnicodeCharacter{011A}{\v{E}}
\DeclareUnicodeCharacter{011B}{\v{e}}
\DeclareUnicodeCharacter{011C}{\^G}
\DeclareUnicodeCharacter{0120}{\dotaccent{G}}
\DeclareUnicodeCharacter{0121}{\dotaccent{g}}
+ \DeclareUnicodeCharacter{0122}{\cedilla{G}}
+ \DeclareUnicodeCharacter{0123}{\cedilla{g}}
\DeclareUnicodeCharacter{0124}{\^H}
\DeclareUnicodeCharacter{0125}{\^h}
+ \DeclareUnicodeCharacter{0126}{\missingcharmsg{H WITH STROKE}}
+ \DeclareUnicodeCharacter{0127}{\missingcharmsg{h WITH STROKE}}
\DeclareUnicodeCharacter{0128}{\~I}
\DeclareUnicodeCharacter{0129}{\~{\dotless{i}}}
\DeclareUnicodeCharacter{012A}{\=I}
\DeclareUnicodeCharacter{012B}{\={\dotless{i}}}
\DeclareUnicodeCharacter{012C}{\u{I}}
\DeclareUnicodeCharacter{012D}{\u{\dotless{i}}}
+ \DeclareUnicodeCharacter{012E}{\ogonek{I}}
+ \DeclareUnicodeCharacter{012F}{\ogonek{i}}
\DeclareUnicodeCharacter{0130}{\dotaccent{I}}
\DeclareUnicodeCharacter{0131}{\dotless{i}}
\DeclareUnicodeCharacter{0133}{ij}
\DeclareUnicodeCharacter{0134}{\^J}
\DeclareUnicodeCharacter{0135}{\^{\dotless{j}}}
+ \DeclareUnicodeCharacter{0136}{\cedilla{K}}
+ \DeclareUnicodeCharacter{0137}{\cedilla{k}}
+ \DeclareUnicodeCharacter{0138}{\ifmmode\kappa\else $\kappa$\fi}
\DeclareUnicodeCharacter{0139}{\'L}
\DeclareUnicodeCharacter{013A}{\'l}
+ \DeclareUnicodeCharacter{013B}{\cedilla{L}}
+ \DeclareUnicodeCharacter{013C}{\cedilla{l}}
+ \DeclareUnicodeCharacter{013D}{L'}% should kern
+ \DeclareUnicodeCharacter{013E}{l'}% should kern
+ \DeclareUnicodeCharacter{013F}{L\U{00B7}}
+ \DeclareUnicodeCharacter{0140}{l\U{00B7}}
\DeclareUnicodeCharacter{0141}{\L}
\DeclareUnicodeCharacter{0142}{\l}
\DeclareUnicodeCharacter{0143}{\'N}
\DeclareUnicodeCharacter{0144}{\'n}
+ \DeclareUnicodeCharacter{0145}{\cedilla{N}}
+ \DeclareUnicodeCharacter{0146}{\cedilla{n}}
\DeclareUnicodeCharacter{0147}{\v{N}}
\DeclareUnicodeCharacter{0148}{\v{n}}
+ \DeclareUnicodeCharacter{0149}{'n}
+ \DeclareUnicodeCharacter{014A}{\missingcharmsg{ENG}}
+ \DeclareUnicodeCharacter{014B}{\missingcharmsg{eng}}
\DeclareUnicodeCharacter{014C}{\=O}
\DeclareUnicodeCharacter{014D}{\=o}
\DeclareUnicodeCharacter{014E}{\u{O}}
\DeclareUnicodeCharacter{0153}{\oe}
\DeclareUnicodeCharacter{0154}{\'R}
\DeclareUnicodeCharacter{0155}{\'r}
+ \DeclareUnicodeCharacter{0156}{\cedilla{R}}
+ \DeclareUnicodeCharacter{0157}{\cedilla{r}}
\DeclareUnicodeCharacter{0158}{\v{R}}
\DeclareUnicodeCharacter{0159}{\v{r}}
\DeclareUnicodeCharacter{015A}{\'S}
\DeclareUnicodeCharacter{0160}{\v{S}}
\DeclareUnicodeCharacter{0161}{\v{s}}
- \DeclareUnicodeCharacter{0162}{\cedilla{t}}
- \DeclareUnicodeCharacter{0163}{\cedilla{T}}
+ \DeclareUnicodeCharacter{0162}{\cedilla{T}}
+ \DeclareUnicodeCharacter{0163}{\cedilla{t}}
\DeclareUnicodeCharacter{0164}{\v{T}}
-
+ \DeclareUnicodeCharacter{0165}{\v{t}}
+ \DeclareUnicodeCharacter{0166}{\missingcharmsg{H WITH STROKE}}
+ \DeclareUnicodeCharacter{0167}{\missingcharmsg{h WITH STROKE}}
\DeclareUnicodeCharacter{0168}{\~U}
\DeclareUnicodeCharacter{0169}{\~u}
\DeclareUnicodeCharacter{016A}{\=U}
\DeclareUnicodeCharacter{0170}{\H{U}}
\DeclareUnicodeCharacter{0171}{\H{u}}
+ \DeclareUnicodeCharacter{0172}{\ogonek{U}}
+ \DeclareUnicodeCharacter{0173}{\ogonek{u}}
\DeclareUnicodeCharacter{0174}{\^W}
\DeclareUnicodeCharacter{0175}{\^w}
\DeclareUnicodeCharacter{0176}{\^Y}
\DeclareUnicodeCharacter{017C}{\dotaccent{z}}
\DeclareUnicodeCharacter{017D}{\v{Z}}
\DeclareUnicodeCharacter{017E}{\v{z}}
+ \DeclareUnicodeCharacter{017F}{\missingcharmsg{LONG S}}
\DeclareUnicodeCharacter{01C4}{D\v{Z}}
\DeclareUnicodeCharacter{01C5}{D\v{z}}
\relax
}
+% define all the unicode characters we know about, for the sake of @U.
+\utfeightchardefs
+
% Make non-ASCII characters printable again for compatibility with
% existing Texinfo documents that may use them, even without declaring a
% document encoding.
@c Local variables:
@c eval: (add-hook 'write-file-hooks 'time-stamp)
-@c page-delimiter: "^\\\\message"
+@c page-delimiter: "^\\\\message\\|emacs-page"
@c time-stamp-start: "def\\\\texinfoversion{"
@c time-stamp-format: "%:y-%02m-%02d.%02H"
@c time-stamp-end: "}"
if 0;
# Update an FSF copyright year list to include the current year.
-my $VERSION = '2013-01-03.09:41'; # UTC
+my $VERSION = '2015-01-15.20:53'; # UTC
-# Copyright (C) 2009-2014 Free Software Foundation, Inc.
+# Copyright (C) 2009-2015 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
use warnings;
my $copyright_re = 'Copyright';
-my $circle_c_re = '(?:\([cC]\)|@copyright{}|©)';
+my $circle_c_re = '(?:\([cC]\)|@copyright{}|\\\\\(co|©)';
my $holder = $ENV{UPDATE_COPYRIGHT_HOLDER};
$holder ||= 'Free Software Foundation, Inc.';
my $prefix_max = 5;
# If you change this file with Emacs, please let the write hook
# do its job. Otherwise, update this string manually.
-# Copyright (C) 2008-2014 Free Software Foundation, Inc.
+# Copyright (C) 2008-2015 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
# Print a version string.
scriptversion=2011-05-16.22; # UTC
-# Copyright (C) 2006-2014 Free Software Foundation, Inc.
+# Copyright (C) 2006-2015 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
/* Define to the number of bits in type 'wint_t'. */
#undef BITSIZEOF_WINT_T
+/* Define to 1 if chown fails to change ctime when at least one argument was
+ not -1. */
+#undef CHOWN_CHANGE_TIME_BUG
+
+/* Define if chown is not POSIX compliant regarding IDs of -1. */
+#undef CHOWN_FAILS_TO_HONOR_ID_OF_NEGATIVE_ONE
+
+/* Define if chown modifies symlinks. */
+#undef CHOWN_MODIFIES_SYMLINK
+
+/* Define to 1 if chown mishandles trailing slash. */
+#undef CHOWN_TRAILING_SLASH_BUG
+
/* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP
systems. This function is required for `alloca.c' support on those systems.
*/
/* Name of editor program. */
#undef EDITOR_PROGRAM
+/* Define to 1 if your platform has fchownat, but it does not reject an empty
+ file name. */
+#undef FCHOWNAT_EMPTY_FILENAME_BUG
+
+/* Define to 1 if your platform has fchownat, but it cannot perform lchown
+ tasks. */
+#undef FCHOWNAT_NOFOLLOW_BUG
+
/* Define this to 1 if F_DUPFD behavior does not match POSIX */
#undef FCNTL_DUPFD_BUGGY
whether the gnulib module dirname shall be considered present. */
#undef GNULIB_DIRNAME
+/* Define to a C preprocessor expression that evaluates to 1 or 0, depending
+ whether the gnulib module fchmodat shall be considered present. */
+#undef GNULIB_FCHMODAT
+
+/* Define to a C preprocessor expression that evaluates to 1 or 0, depending
+ whether the gnulib module fchownat shall be considered present. */
+#undef GNULIB_FCHOWNAT
+
/* Define to a C preprocessor expression that evaluates to 1 or 0, depending
whether the gnulib module fscanf shall be considered present. */
#undef GNULIB_FSCANF
whether the gnulib module malloc-gnu shall be considered present. */
#undef GNULIB_MALLOC_GNU
+/* Define to a C preprocessor expression that evaluates to 1 or 0, depending
+ whether the gnulib module openat shall be considered present. */
+#undef GNULIB_OPENAT
+
/* enable some gnulib portability checks */
#undef GNULIB_PORTCHECK
+/* Define to 1 if printf and friends should be labeled with attribute
+ "__gnu_printf__" instead of "__printf__" */
+#undef GNULIB_PRINTF_ATTRIBUTE_FLAVOR_GNU
+
/* Define to a C preprocessor expression that evaluates to 1 or 0, depending
whether the gnulib module realloc-gnu shall be considered present. */
#undef GNULIB_REALLOC_GNU
whether the gnulib module scanf shall be considered present. */
#undef GNULIB_SCANF
+/* Define to a C preprocessor expression that evaluates to 1 or 0, depending
+ whether the gnulib module statat shall be considered present. */
+#undef GNULIB_STATAT
+
/* Define to a C preprocessor expression that evaluates to 1 or 0, depending
whether the gnulib module strerror shall be considered present. */
#undef GNULIB_STRERROR
/* Define to 1 when the gnulib module chdir should be tested. */
#undef GNULIB_TEST_CHDIR
+/* Define to 1 when the gnulib module chown should be tested. */
+#undef GNULIB_TEST_CHOWN
+
+/* Define to 1 when the gnulib module cloexec should be tested. */
+#undef GNULIB_TEST_CLOEXEC
+
/* Define to 1 when the gnulib module close should be tested. */
#undef GNULIB_TEST_CLOSE
/* Define to 1 when the gnulib module environ should be tested. */
#undef GNULIB_TEST_ENVIRON
+/* Define to 1 when the gnulib module fchdir should be tested. */
+#undef GNULIB_TEST_FCHDIR
+
+/* Define to 1 when the gnulib module fchmodat should be tested. */
+#undef GNULIB_TEST_FCHMODAT
+
+/* Define to 1 when the gnulib module fchownat should be tested. */
+#undef GNULIB_TEST_FCHOWNAT
+
/* Define to 1 when the gnulib module fcntl should be tested. */
#undef GNULIB_TEST_FCNTL
/* Define to 1 when the gnulib module fstat should be tested. */
#undef GNULIB_TEST_FSTAT
+/* Define to 1 when the gnulib module fstatat should be tested. */
+#undef GNULIB_TEST_FSTATAT
+
+/* Define to 1 when the gnulib module getcwd should be tested. */
+#undef GNULIB_TEST_GETCWD
+
/* Define to 1 when the gnulib module getdtablesize should be tested. */
#undef GNULIB_TEST_GETDTABLESIZE
/* Define to 1 when the gnulib module gettimeofday should be tested. */
#undef GNULIB_TEST_GETTIMEOFDAY
-/* Define to 1 when the gnulib module lchmod should be tested. */
-#undef GNULIB_TEST_LCHMOD
+/* Define to 1 when the gnulib module lchown should be tested. */
+#undef GNULIB_TEST_LCHOWN
/* Define to 1 when the gnulib module lstat should be tested. */
#undef GNULIB_TEST_LSTAT
/* Define to 1 when the gnulib module memchr should be tested. */
#undef GNULIB_TEST_MEMCHR
+/* Define to 1 when the gnulib module mempcpy should be tested. */
+#undef GNULIB_TEST_MEMPCPY
+
+/* Define to 1 when the gnulib module memrchr should be tested. */
+#undef GNULIB_TEST_MEMRCHR
+
+/* Define to 1 when the gnulib module mkdirat should be tested. */
+#undef GNULIB_TEST_MKDIRAT
+
/* Define to 1 when the gnulib module mktime should be tested. */
#undef GNULIB_TEST_MKTIME
+/* Define to 1 when the gnulib module open should be tested. */
+#undef GNULIB_TEST_OPEN
+
+/* Define to 1 when the gnulib module openat should be tested. */
+#undef GNULIB_TEST_OPENAT
+
/* Define to 1 when the gnulib module opendir should be tested. */
#undef GNULIB_TEST_OPENDIR
/* Define to 1 when the gnulib module readlink should be tested. */
#undef GNULIB_TEST_READLINK
+/* Define to 1 when the gnulib module readlinkat should be tested. */
+#undef GNULIB_TEST_READLINKAT
+
/* Define to 1 when the gnulib module realloc-posix should be tested. */
#undef GNULIB_TEST_REALLOC_POSIX
/* Define to 1 when the gnulib module rename should be tested. */
#undef GNULIB_TEST_RENAME
+/* Define to 1 when the gnulib module renameat should be tested. */
+#undef GNULIB_TEST_RENAMEAT
+
/* Define to 1 when the gnulib module rmdir should be tested. */
#undef GNULIB_TEST_RMDIR
/* Define to 1 when the gnulib module stat should be tested. */
#undef GNULIB_TEST_STAT
+/* Define to 1 when the gnulib module strdup should be tested. */
+#undef GNULIB_TEST_STRDUP
+
/* Define to 1 when the gnulib module strerror should be tested. */
#undef GNULIB_TEST_STRERROR
/* Define to 1 when the gnulib module symlink should be tested. */
#undef GNULIB_TEST_SYMLINK
+/* Define to 1 when the gnulib module symlinkat should be tested. */
+#undef GNULIB_TEST_SYMLINKAT
+
/* Define to 1 when the gnulib module time_r should be tested. */
#undef GNULIB_TEST_TIME_R
/* Define to 1 when the gnulib module unlink should be tested. */
#undef GNULIB_TEST_UNLINK
+/* Define to 1 when the gnulib module unlinkat should be tested. */
+#undef GNULIB_TEST_UNLINKAT
+
/* Define to 1 when the gnulib module unsetenv should be tested. */
#undef GNULIB_TEST_UNSETENV
+/* Define to 1 when the gnulib module utimensat should be tested. */
+#undef GNULIB_TEST_UTIMENSAT
+
/* Define to 1 when the gnulib module vasprintf should be tested. */
#undef GNULIB_TEST_VASPRINTF
/* Define to 1 if you have the `canonicalize_file_name' function. */
#undef HAVE_CANONICALIZE_FILE_NAME
+/* Define to 1 if you have the `chown' function. */
+#undef HAVE_CHOWN
+
/* Define to 1 if you have the `clock_gettime' function. */
#undef HAVE_CLOCK_GETTIME
*/
#undef HAVE_DECL_DIRFD
+/* Define to 1 if you have the declaration of `fchdir', and to 0 if you don't.
+ */
+#undef HAVE_DECL_FCHDIR
+
/* Define to 1 if you have the declaration of `getc_unlocked', and to 0 if you
don't. */
#undef HAVE_DECL_GETC_UNLOCKED
don't. */
#undef HAVE_DECL_MBSINIT
+/* Define to 1 if you have the declaration of `memrchr', and to 0 if you
+ don't. */
+#undef HAVE_DECL_MEMRCHR
+
/* Define to 1 if you have the declaration of `program_invocation_name', and
to 0 if you don't. */
#undef HAVE_DECL_PROGRAM_INVOCATION_NAME
*/
#undef HAVE_DECL_SETENV
+/* Define to 1 if you have the declaration of `strdup', and to 0 if you don't.
+ */
+#undef HAVE_DECL_STRDUP
+
/* Define to 1 if you have the declaration of `strerror_r', and to 0 if you
don't. */
#undef HAVE_DECL_STRERROR_R
/* Define if you have the declaration of environ. */
#undef HAVE_ENVIRON_DECL
+/* Define to 1 if you have the `fchdir' function. */
+#undef HAVE_FCHDIR
+
+/* Define to 1 if you have the `fchmodat' function. */
+#undef HAVE_FCHMODAT
+
+/* Define to 1 if you have the `fchown' function. */
+#undef HAVE_FCHOWN
+
/* Define to 1 if you have the `fcntl' function. */
#undef HAVE_FCNTL
/* Define to 1 if you have the <features.h> header file. */
#undef HAVE_FEATURES_H
+/* Define to 1 if you have the `fstatat' function. */
+#undef HAVE_FSTATAT
+
/* Define to 1 if you have the `futimens' function. */
#undef HAVE_FUTIMENS
/* Define to 1 if you have the `lchmod' function. */
#undef HAVE_LCHMOD
+/* Define to 1 if you have the `lchown' function. */
+#undef HAVE_LCHOWN
+
/* Define to 1 if you have the `link' function. */
#undef HAVE_LINK
/* Define to 1 if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H
+/* Define to 1 if you have the `mempcpy' function. */
+#undef HAVE_MEMPCPY
+
+/* Define to 1 if you have the `memrchr' function. */
+#undef HAVE_MEMRCHR
+
/* Define to 1 if <limits.h> defines the MIN and MAX macros. */
#undef HAVE_MINMAX_IN_LIMITS_H
/* Define to 1 if <sys/param.h> defines the MIN and MAX macros. */
#undef HAVE_MINMAX_IN_SYS_PARAM_H
+/* Define to 1 if you have the `mkdirat' function. */
+#undef HAVE_MKDIRAT
+
/* Define to 1 if you have the `mprotect' function. */
#undef HAVE_MPROTECT
/* Define to 1 if you have the `nanotime' function. */
#undef HAVE_NANOTIME
+/* Define to 1 if you have the `openat' function. */
+#undef HAVE_OPENAT
+
/* Define to 1 if you have the `opendir' function. */
#undef HAVE_OPENDIR
/* Define to 1 if you have the `readlink' function. */
#undef HAVE_READLINK
+/* Define to 1 if you have the `readlinkat' function. */
+#undef HAVE_READLINKAT
+
/* Define to 1 if your system has a GNU libc compatible 'realloc' function,
and to 0 otherwise. */
#undef HAVE_REALLOC_GNU
/* Define to 1 if you have the `realpath' function. */
#undef HAVE_REALPATH
+/* Define to 1 if you have the `renameat' function. */
+#undef HAVE_RENAMEAT
+
/* Define to 1 if you have the <search.h> header file. */
#undef HAVE_SEARCH_H
/* Define to 1 if you have the <stdlib.h> header file. */
#undef HAVE_STDLIB_H
+/* Define to 1 if you have the `strdup' function. */
+#undef HAVE_STRDUP
+
/* Define to 1 if you have the `strerror_r' function. */
#undef HAVE_STRERROR_R
/* Define to 1 if you have the `symlink' function. */
#undef HAVE_SYMLINK
+/* Define to 1 if you have the `symlinkat' function. */
+#undef HAVE_SYMLINKAT
+
/* Define to 1 if you have the <sys/bitypes.h> header file. */
#undef HAVE_SYS_BITYPES_H
/* Define to 1 if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
+/* Define to 1 if you have the `unlinkat' function. */
+#undef HAVE_UNLINKAT
+
/* Define to 1 if you have the `unsetenv' function. */
#undef HAVE_UNSETENV
/* Define if you have the 'wint_t' type. */
#undef HAVE_WINT_T
+/* Define to 1 if fstatat (..., 0) works. For example, it does not work in AIX
+ 7.1. */
+#undef HAVE_WORKING_FSTATAT_ZERO_FLAG
+
/* Define to 1 if O_NOATIME works. */
#undef HAVE_WORKING_O_NOATIME
/* Define if the mbrtowc function returns a wrong return value. */
#undef MBRTOWC_RETVAL_BUG
+/* Define to 1 if open() fails to recognize a trailing slash. */
+#undef OPEN_TRAILING_SLASH_BUG
+
/* Name of package */
#undef PACKAGE
/* Define to the version of this package. */
#undef PACKAGE_VERSION
+/* Define to the type that is the result of default argument promotions of
+ type mode_t. */
+#undef PROMOTED_MODE_T
+
/* Define to l, ll, u, ul, ull, etc., as suitable for constants of type
'ptrdiff_t'. */
#undef PTRDIFF_T_SUFFIX
such as on Solaris 9 or cygwin 1.5. */
#undef RENAME_TRAILING_SLASH_SOURCE_BUG
+/* Define to 1 if gnulib's fchdir() replacement is used. */
+#undef REPLACE_FCHDIR
+
/* Define to 1 if stat needs help when passed a directory name with a trailing
slash */
#undef REPLACE_FUNC_STAT_DIR
slash */
#undef REPLACE_FUNC_STAT_FILE
+/* Define to 1 if open() should work around the inability to open a directory.
+ */
+#undef REPLACE_OPEN_DIRECTORY
+
/* Define to 1 if strerror(0) does not return a message implying success. */
#undef REPLACE_STRERROR_0
#ifndef _GNU_SOURCE
# undef _GNU_SOURCE
#endif
+/* Use GNU style printf and scanf. */
+#ifndef __USE_MINGW_ANSI_STDIO
+# undef __USE_MINGW_ANSI_STDIO
+#endif
/* Enable threading extensions on Solaris. */
#ifndef _POSIX_PTHREAD_SEMANTICS
# undef _POSIX_PTHREAD_SEMANTICS
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for GNU patch 2.7.3.
+# Generated by GNU Autoconf 2.69 for GNU patch 2.7.4.
#
# Report bugs to <bug-patch@gnu.org>.
#
# Identity of this package.
PACKAGE_NAME='GNU patch'
PACKAGE_TARNAME='patch'
-PACKAGE_VERSION='2.7.3'
-PACKAGE_STRING='GNU patch 2.7.3'
+PACKAGE_VERSION='2.7.4'
+PACKAGE_STRING='GNU patch 2.7.4'
PACKAGE_BUGREPORT='bug-patch@gnu.org'
PACKAGE_URL='http://www.gnu.org/software/patch/'
HAVE_UNISTD_H
NEXT_AS_FIRST_DIRECTIVE_UNISTD_H
NEXT_UNISTD_H
+UNISTD_H_DEFINES_STRUCT_TIMESPEC
PTHREAD_H_DEFINES_STRUCT_TIMESPEC
SYS_TIME_H_DEFINES_STRUCT_TIMESPEC
TIME_H_DEFINES_STRUCT_TIMESPEC
GL_GENERATE_STDDEF_H_TRUE
STDDEF_H
HAVE_WCHAR_T
+HAVE_MAX_ALIGN_T
REPLACE_NULL
GL_GENERATE_STDARG_H_FALSE
GL_GENERATE_STDARG_H_TRUE
WINDOWS_64_BIT_ST_SIZE
NEXT_AS_FIRST_DIRECTIVE_SYS_STAT_H
NEXT_SYS_STAT_H
+REPLACE_ITOLD
+GL_GENERATE_FLOAT_H_FALSE
+GL_GENERATE_FLOAT_H_TRUE
+FLOAT_H
+NEXT_AS_FIRST_DIRECTIVE_FLOAT_H
+NEXT_FLOAT_H
+NEXT_AS_FIRST_DIRECTIVE_FCNTL_H
+NEXT_FCNTL_H
+REPLACE_OPENAT
+REPLACE_OPEN
+REPLACE_FCNTL
+HAVE_OPENAT
+HAVE_FCNTL
+GNULIB_OPENAT
+GNULIB_OPEN
+GNULIB_NONBLOCKING
+GNULIB_FCNTL
REPLACE_UTIMENSAT
REPLACE_STAT
REPLACE_MKNOD
GNULIB_FSTATAT
GNULIB_FSTAT
GNULIB_FCHMODAT
-REPLACE_ITOLD
-GL_GENERATE_FLOAT_H_FALSE
-GL_GENERATE_FLOAT_H_TRUE
-FLOAT_H
-NEXT_AS_FIRST_DIRECTIVE_FLOAT_H
-NEXT_FLOAT_H
-NEXT_AS_FIRST_DIRECTIVE_FCNTL_H
-NEXT_FCNTL_H
-REPLACE_OPENAT
-REPLACE_OPEN
-REPLACE_FCNTL
-HAVE_OPENAT
-HAVE_FCNTL
-GNULIB_OPENAT
-GNULIB_OPEN
-GNULIB_NONBLOCKING
-GNULIB_FCNTL
EOVERFLOW_VALUE
EOVERFLOW_HIDDEN
ENOLINK_VALUE
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures GNU patch 2.7.3 to adapt to many kinds of systems.
+\`configure' configures GNU patch 2.7.4 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of GNU patch 2.7.3:";;
+ short | recursive ) echo "Configuration of GNU patch 2.7.4:";;
esac
cat <<\_ACEOF
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-GNU patch configure 2.7.3
+GNU patch configure 2.7.4
generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by GNU patch $as_me 2.7.3, which was
+It was created by GNU patch $as_me 2.7.4, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
as_fn_append ac_func_list " readlink"
as_fn_append ac_func_list " realpath"
as_fn_append ac_header_list " sys/param.h"
+as_fn_append ac_header_list " unistd.h"
+as_fn_append ac_func_list " chown"
+as_fn_append ac_func_list " fchown"
as_fn_append ac_func_list " _set_invalid_parameter_handler"
as_fn_append ac_header_list " sys/socket.h"
+as_fn_append ac_func_list " fchdir"
as_fn_append ac_header_list " dirent.h"
as_fn_append ac_func_list " fdopendir"
as_fn_append ac_func_list " getdtablesize"
-as_fn_append ac_header_list " unistd.h"
+as_fn_append ac_func_list " fchmodat"
+as_fn_append ac_func_list " lchmod"
as_fn_append ac_func_list " fcntl"
as_fn_append ac_func_list " symlink"
+as_fn_append ac_func_list " mempcpy"
as_fn_append ac_header_list " sys/stat.h"
+as_fn_append ac_func_list " fstatat"
gl_getopt_required=GNU
as_fn_append ac_header_list " getopt.h"
as_fn_append ac_func_list " gettimeofday"
as_fn_append ac_func_list " nanotime"
as_fn_append ac_header_list " sys/time.h"
-as_fn_append ac_func_list " lchmod"
as_fn_append ac_func_list " lstat"
as_fn_append ac_func_list " mbsinit"
as_fn_append ac_func_list " mbrtowc"
as_fn_append ac_header_list " sys/mman.h"
as_fn_append ac_func_list " mprotect"
+as_fn_append ac_func_list " mkdirat"
+as_fn_append ac_func_list " openat"
+as_fn_append ac_func_list " readlinkat"
as_fn_append ac_func_list " link"
+as_fn_append ac_func_list " renameat"
as_fn_append ac_func_list " secure_getenv"
as_fn_append ac_func_list " setenv"
as_fn_append ac_header_list " wchar.h"
as_fn_append ac_header_list " stdint.h"
+as_fn_append ac_func_list " strdup"
as_fn_append ac_func_list " strndup"
+as_fn_append ac_func_list " symlinkat"
as_fn_append ac_func_list " localtime_r"
as_fn_append ac_func_list " pipe"
+as_fn_append ac_func_list " unlinkat"
as_fn_append ac_header_list " utime.h"
as_fn_append ac_func_list " futimes"
as_fn_append ac_func_list " futimesat"
# Define the identity of the package.
PACKAGE='patch'
- VERSION='2.7.3'
+ VERSION='2.7.4'
cat >>confdefs.h <<_ACEOF
$as_echo "#define _GNU_SOURCE 1" >>confdefs.h
+ $as_echo "#define __USE_MINGW_ANSI_STDIO 1" >>confdefs.h
+
$as_echo "#define _POSIX_PTHREAD_SEMANTICS 1" >>confdefs.h
$as_echo "#define _TANDEM_SOURCE 1" >>confdefs.h
# Code from module absolute-header:
# Code from module alloca-opt:
# Code from module argmatch:
+ # Code from module assure:
+ # Code from module at-internal:
# Code from module backupfile:
# Code from module bitrotate:
# Code from module c-ctype:
# Code from module c-strcaseeq:
# Code from module canonicalize-lgpl:
# Code from module chdir:
+ # Code from module chdir-long:
+ # Code from module chown:
# Code from module clock-time:
+ # Code from module cloexec:
# Code from module close:
# Code from module closedir:
# Code from module configmake:
# Code from module extensions:
# Code from module extern-inline:
+ # Code from module fchdir:
+ # Code from module fchmodat:
+ # Code from module fchownat:
# Code from module fcntl:
# Code from module fcntl-h:
# Code from module fd-hook:
# Code from module filename:
+ # Code from module filenamecat-lgpl:
# Code from module float:
# Code from module fstat:
+ # Code from module fstatat:
# Code from module full-write:
+ # Code from module getcwd-lgpl:
# Code from module getdate:
# Code from module getdtablesize:
# Code from module getopt-gnu:
# Code from module intprops:
# Code from module largefile:
- # Code from module lchmod:
+ # Code from module lchown:
# Code from module linked-list:
# Code from module list:
# Code from module localcharset:
# Code from module mbrtowc:
# Code from module mbsinit:
# Code from module memchr:
+ # Code from module mempcpy:
+ # Code from module memrchr:
# Code from module minmax:
# Code from module mkdir:
+ # Code from module mkdirat:
# Code from module mktime:
# Code from module msvc-inval:
# Code from module msvc-nothrow:
# Code from module multiarch:
# Code from module nocrash:
+ # Code from module open:
+ # Code from module openat:
+ # Code from module openat-die:
+ # Code from module openat-h:
# Code from module opendir:
# Code from module parse-datetime:
# Code from module pathmax:
# Code from module raise:
# Code from module readdir:
# Code from module readlink:
+ # Code from module readlinkat:
# Code from module realloc:
# Code from module realloc-gnu:
# Code from module realloc-posix:
# Code from module rename:
+ # Code from module renameat:
# Code from module rmdir:
# Code from module safe-write:
# Code from module same-inode:
+ # Code from module save-cwd:
# Code from module secure_getenv:
# Code from module setenv:
# Code from module signal:
# Code from module ssize_t:
# Code from module stat:
# Code from module stat-time:
+ # Code from module statat:
# Code from module stdarg:
# Code from module stdint:
# Code from module stdio:
# Code from module stdlib:
+ # Code from module strdup-posix:
# Code from module streq:
# Code from module strerror:
# Code from module strerror-override:
# Code from module strndup:
# Code from module strnlen:
# Code from module symlink:
+ # Code from module symlinkat:
# Code from module sys_stat:
# Code from module sys_time:
# Code from module sys_types:
# Code from module unistd:
# Code from module unistd-safer:
# Code from module unlink:
+ # Code from module unlinkat:
# Code from module unsetenv:
# Code from module update-copyright:
# Code from module useless-if-before-free:
# Code from module utimens:
+ # Code from module utimensat:
# Code from module vasnprintf:
# Code from module vasprintf:
# Code from module vc-list-files:
- if test $ac_cv_func__set_invalid_parameter_handler = yes; then
- HAVE_MSVC_INVALID_PARAMETER_HANDLER=1
-$as_echo "#define HAVE_MSVC_INVALID_PARAMETER_HANDLER 1" >>confdefs.h
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for uid_t in sys/types.h" >&5
+$as_echo_n "checking for uid_t in sys/types.h... " >&6; }
+if ${ac_cv_type_uid_t+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <sys/types.h>
- else
- HAVE_MSVC_INVALID_PARAMETER_HANDLER=0
- fi
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ $EGREP "uid_t" >/dev/null 2>&1; then :
+ ac_cv_type_uid_t=yes
+else
+ ac_cv_type_uid_t=no
+fi
+rm -f conftest*
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_type_uid_t" >&5
+$as_echo "$ac_cv_type_uid_t" >&6; }
+if test $ac_cv_type_uid_t = no; then
+$as_echo "#define uid_t int" >>confdefs.h
+$as_echo "#define gid_t int" >>confdefs.h
+fi
- GNULIB_OPENDIR=0;
- GNULIB_READDIR=0;
- GNULIB_REWINDDIR=0;
- GNULIB_CLOSEDIR=0;
- GNULIB_DIRFD=0;
- GNULIB_FDOPENDIR=0;
- GNULIB_SCANDIR=0;
- GNULIB_ALPHASORT=0;
- HAVE_OPENDIR=1;
- HAVE_READDIR=1;
- HAVE_REWINDDIR=1;
- HAVE_CLOSEDIR=1;
- HAVE_DECL_DIRFD=1;
- HAVE_DECL_FDOPENDIR=1;
- HAVE_FDOPENDIR=1;
- HAVE_SCANDIR=1;
- HAVE_ALPHASORT=1;
- REPLACE_OPENDIR=0;
- REPLACE_CLOSEDIR=0;
- REPLACE_DIRFD=0;
- REPLACE_FDOPENDIR=0;
+ for ac_header in unistd.h
+do :
+ ac_fn_c_check_header_mongrel "$LINENO" "unistd.h" "ac_cv_header_unistd_h" "$ac_includes_default"
+if test "x$ac_cv_header_unistd_h" = xyes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_UNISTD_H 1
+_ACEOF
+fi
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the preprocessor supports include_next" >&5
-$as_echo_n "checking whether the preprocessor supports include_next... " >&6; }
-if ${gl_cv_have_include_next+:} false; then :
+done
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working chown" >&5
+$as_echo_n "checking for working chown... " >&6; }
+if ${ac_cv_func_chown_works+:} false; then :
$as_echo_n "(cached) " >&6
else
- rm -rf conftestd1a conftestd1b conftestd2
- mkdir conftestd1a conftestd1b conftestd2
- cat <<EOF > conftestd1a/conftest.h
-#define DEFINED_IN_CONFTESTD1
-#include_next <conftest.h>
-#ifdef DEFINED_IN_CONFTESTD2
-int foo;
-#else
-#error "include_next doesn't work"
-#endif
-EOF
- cat <<EOF > conftestd1b/conftest.h
-#define DEFINED_IN_CONFTESTD1
-#include <stdio.h>
-#include_next <conftest.h>
-#ifdef DEFINED_IN_CONFTESTD2
-int foo;
-#else
-#error "include_next doesn't work"
-#endif
-EOF
- cat <<EOF > conftestd2/conftest.h
-#ifndef DEFINED_IN_CONFTESTD1
-#error "include_next test doesn't work"
-#endif
-#define DEFINED_IN_CONFTESTD2
-EOF
- gl_save_CPPFLAGS="$CPPFLAGS"
- CPPFLAGS="$gl_save_CPPFLAGS -Iconftestd1b -Iconftestd2"
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-#include <conftest.h>
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
- gl_cv_have_include_next=yes
+ if test "$cross_compiling" = yes; then :
+ case "$host_os" in # ((
+ # Guess yes on glibc systems.
+ *-gnu*) ac_cv_func_chown_works=yes ;;
+ # If we don't know, assume the worst.
+ *) ac_cv_func_chown_works=no ;;
+ esac
+
else
- CPPFLAGS="$gl_save_CPPFLAGS -Iconftestd1a -Iconftestd2"
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
-#include <conftest.h>
+$ac_includes_default
+ #include <fcntl.h>
+
+int
+main ()
+{
+
+ char *f = "conftest.chown";
+ struct stat before, after;
+
+ if (creat (f, 0600) < 0)
+ return 1;
+ if (stat (f, &before) < 0)
+ return 1;
+ if (chown (f, (uid_t) -1, (gid_t) -1) == -1)
+ return 1;
+ if (stat (f, &after) < 0)
+ return 1;
+ return ! (before.st_uid == after.st_uid && before.st_gid == after.st_gid);
+
+ ;
+ return 0;
+}
+
_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
- gl_cv_have_include_next=buggy
+if ac_fn_c_try_run "$LINENO"; then :
+ ac_cv_func_chown_works=yes
else
- gl_cv_have_include_next=no
+ ac_cv_func_chown_works=no
fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+ conftest.$ac_objext conftest.beam conftest.$ac_ext
fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
- CPPFLAGS="$gl_save_CPPFLAGS"
- rm -rf conftestd1a conftestd1b conftestd2
+
+ rm -f conftest.chown
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_have_include_next" >&5
-$as_echo "$gl_cv_have_include_next" >&6; }
- PRAGMA_SYSTEM_HEADER=
- if test $gl_cv_have_include_next = yes; then
- INCLUDE_NEXT=include_next
- INCLUDE_NEXT_AS_FIRST_DIRECTIVE=include_next
- if test -n "$GCC"; then
- PRAGMA_SYSTEM_HEADER='#pragma GCC system_header'
- fi
- else
- if test $gl_cv_have_include_next = buggy; then
- INCLUDE_NEXT=include
- INCLUDE_NEXT_AS_FIRST_DIRECTIVE=include_next
- else
- INCLUDE_NEXT=include
- INCLUDE_NEXT_AS_FIRST_DIRECTIVE=include
- fi
- fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_chown_works" >&5
+$as_echo "$ac_cv_func_chown_works" >&6; }
+ if test $ac_cv_func_chown_works = yes; then
+$as_echo "#define HAVE_CHOWN 1" >>confdefs.h
+ fi
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether system header files limit the line length" >&5
-$as_echo_n "checking whether system header files limit the line length... " >&6; }
-if ${gl_cv_pragma_columns+:} false; then :
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether chown dereferences symlinks" >&5
+$as_echo_n "checking whether chown dereferences symlinks... " >&6; }
+if ${gl_cv_func_chown_follows_symlink+:} false; then :
$as_echo_n "(cached) " >&6
else
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+
+ if test "$cross_compiling" = yes; then :
+ gl_cv_func_chown_follows_symlink=yes
+
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
-#ifdef __TANDEM
-choke me
-#endif
+#include <unistd.h>
+#include <stdlib.h>
+#include <errno.h>
+
+ int
+ main ()
+ {
+ int result = 0;
+ char const *dangling_symlink = "conftest.dangle";
+
+ unlink (dangling_symlink);
+ if (symlink ("conftest.no-such", dangling_symlink))
+ abort ();
+
+ /* Exit successfully on a conforming system,
+ i.e., where chown must fail with ENOENT. */
+ if (chown (dangling_symlink, getuid (), getgid ()) == 0)
+ result |= 1;
+ if (errno != ENOENT)
+ result |= 2;
+ return result;
+ }
_ACEOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
- $EGREP "choke me" >/dev/null 2>&1; then :
- gl_cv_pragma_columns=yes
+if ac_fn_c_try_run "$LINENO"; then :
+ gl_cv_func_chown_follows_symlink=yes
else
- gl_cv_pragma_columns=no
+ gl_cv_func_chown_follows_symlink=no
fi
-rm -f conftest*
-
-
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+ conftest.$ac_objext conftest.beam conftest.$ac_ext
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_pragma_columns" >&5
-$as_echo "$gl_cv_pragma_columns" >&6; }
- if test $gl_cv_pragma_columns = yes; then
- PRAGMA_COLUMNS="#pragma COLUMNS 10000"
- else
- PRAGMA_COLUMNS=
- fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_chown_follows_symlink" >&5
+$as_echo "$gl_cv_func_chown_follows_symlink" >&6; }
+ if test $gl_cv_func_chown_follows_symlink = no; then
+$as_echo "#define CHOWN_MODIFIES_SYMLINK 1" >>confdefs.h
+ fi
+ if test $ac_cv_func_chown = no; then
+ HAVE_CHOWN=0
+ else
+ if test $gl_cv_func_chown_follows_symlink = no; then
+ REPLACE_CHOWN=1
+ fi
+ if test $ac_cv_func_chown_works = no; then
+$as_echo "#define CHOWN_FAILS_TO_HONOR_ID_OF_NEGATIVE_ONE 1" >>confdefs.h
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking if environ is properly declared" >&5
-$as_echo_n "checking if environ is properly declared... " >&6; }
- if ${gt_cv_var_environ_declaration+:} false; then :
+ REPLACE_CHOWN=1
+ fi
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether chown honors trailing slash" >&5
+$as_echo_n "checking whether chown honors trailing slash... " >&6; }
+if ${gl_cv_func_chown_slash_works+:} false; then :
$as_echo_n "(cached) " >&6
else
+ touch conftest.file && rm -f conftest.link
+ if test "$cross_compiling" = yes; then :
+ case "$host_os" in
+ # Guess yes on glibc systems.
+ *-gnu*) gl_cv_func_chown_slash_works="guessing yes" ;;
+ # If we don't know, assume the worst.
+ *) gl_cv_func_chown_slash_works="guessing no" ;;
+ esac
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
-#if HAVE_UNISTD_H
- #include <unistd.h>
- #endif
- /* mingw, BeOS, Haiku declare environ in <stdlib.h>, not in <unistd.h>. */
- #include <stdlib.h>
- extern struct { int foo; } environ;
+#include <unistd.h>
+#include <stdlib.h>
+#include <errno.h>
+
int
main ()
{
-environ.foo = 1;
+ if (symlink ("conftest.file", "conftest.link")) return 1;
+ if (chown ("conftest.link/", getuid (), getgid ()) == 0) return 2;
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+ gl_cv_func_chown_slash_works=yes
+else
+ gl_cv_func_chown_slash_works=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+ conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+ rm -f conftest.link conftest.file
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_chown_slash_works" >&5
+$as_echo "$gl_cv_func_chown_slash_works" >&6; }
+ case "$gl_cv_func_chown_slash_works" in
+ *yes) ;;
+ *)
+
+$as_echo "#define CHOWN_TRAILING_SLASH_BUG 1" >>confdefs.h
+
+ REPLACE_CHOWN=1
+ ;;
+ esac
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether chown always updates ctime" >&5
+$as_echo_n "checking whether chown always updates ctime... " >&6; }
+if ${gl_cv_func_chown_ctime_works+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test "$cross_compiling" = yes; then :
+ case "$host_os" in
+ # Guess yes on glibc systems.
+ *-gnu*) gl_cv_func_chown_ctime_works="guessing yes" ;;
+ # If we don't know, assume the worst.
+ *) gl_cv_func_chown_ctime_works="guessing no" ;;
+ esac
+
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+#include <unistd.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <sys/stat.h>
+
+int
+main ()
+{
+ struct stat st1, st2;
+ if (close (creat ("conftest.file", 0600))) return 1;
+ if (stat ("conftest.file", &st1)) return 2;
+ sleep (1);
+ if (chown ("conftest.file", st1.st_uid, st1.st_gid)) return 3;
+ if (stat ("conftest.file", &st2)) return 4;
+ if (st2.st_ctime <= st1.st_ctime) return 5;
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+ gl_cv_func_chown_ctime_works=yes
+else
+ gl_cv_func_chown_ctime_works=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+ conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+ rm -f conftest.file
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_chown_ctime_works" >&5
+$as_echo "$gl_cv_func_chown_ctime_works" >&6; }
+ case "$gl_cv_func_chown_ctime_works" in
+ *yes) ;;
+ *)
+
+$as_echo "#define CHOWN_CHANGE_TIME_BUG 1" >>confdefs.h
+
+ REPLACE_CHOWN=1
+ ;;
+ esac
+ fi
+
+
+
+
+
+ if test $ac_cv_func__set_invalid_parameter_handler = yes; then
+ HAVE_MSVC_INVALID_PARAMETER_HANDLER=1
+
+$as_echo "#define HAVE_MSVC_INVALID_PARAMETER_HANDLER 1" >>confdefs.h
+
+ else
+ HAVE_MSVC_INVALID_PARAMETER_HANDLER=0
+ fi
+
+
+
+
+
+
+
+ GNULIB_OPENDIR=0;
+ GNULIB_READDIR=0;
+ GNULIB_REWINDDIR=0;
+ GNULIB_CLOSEDIR=0;
+ GNULIB_DIRFD=0;
+ GNULIB_FDOPENDIR=0;
+ GNULIB_SCANDIR=0;
+ GNULIB_ALPHASORT=0;
+ HAVE_OPENDIR=1;
+ HAVE_READDIR=1;
+ HAVE_REWINDDIR=1;
+ HAVE_CLOSEDIR=1;
+ HAVE_DECL_DIRFD=1;
+ HAVE_DECL_FDOPENDIR=1;
+ HAVE_FDOPENDIR=1;
+ HAVE_SCANDIR=1;
+ HAVE_ALPHASORT=1;
+ REPLACE_OPENDIR=0;
+ REPLACE_CLOSEDIR=0;
+ REPLACE_DIRFD=0;
+ REPLACE_FDOPENDIR=0;
+
+
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the preprocessor supports include_next" >&5
+$as_echo_n "checking whether the preprocessor supports include_next... " >&6; }
+if ${gl_cv_have_include_next+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ rm -rf conftestd1a conftestd1b conftestd2
+ mkdir conftestd1a conftestd1b conftestd2
+ cat <<EOF > conftestd1a/conftest.h
+#define DEFINED_IN_CONFTESTD1
+#include_next <conftest.h>
+#ifdef DEFINED_IN_CONFTESTD2
+int foo;
+#else
+#error "include_next doesn't work"
+#endif
+EOF
+ cat <<EOF > conftestd1b/conftest.h
+#define DEFINED_IN_CONFTESTD1
+#include <stdio.h>
+#include_next <conftest.h>
+#ifdef DEFINED_IN_CONFTESTD2
+int foo;
+#else
+#error "include_next doesn't work"
+#endif
+EOF
+ cat <<EOF > conftestd2/conftest.h
+#ifndef DEFINED_IN_CONFTESTD1
+#error "include_next test doesn't work"
+#endif
+#define DEFINED_IN_CONFTESTD2
+EOF
+ gl_save_CPPFLAGS="$CPPFLAGS"
+ CPPFLAGS="$gl_save_CPPFLAGS -Iconftestd1b -Iconftestd2"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <conftest.h>
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ gl_cv_have_include_next=yes
+else
+ CPPFLAGS="$gl_save_CPPFLAGS -Iconftestd1a -Iconftestd2"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <conftest.h>
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ gl_cv_have_include_next=buggy
+else
+ gl_cv_have_include_next=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ CPPFLAGS="$gl_save_CPPFLAGS"
+ rm -rf conftestd1a conftestd1b conftestd2
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_have_include_next" >&5
+$as_echo "$gl_cv_have_include_next" >&6; }
+ PRAGMA_SYSTEM_HEADER=
+ if test $gl_cv_have_include_next = yes; then
+ INCLUDE_NEXT=include_next
+ INCLUDE_NEXT_AS_FIRST_DIRECTIVE=include_next
+ if test -n "$GCC"; then
+ PRAGMA_SYSTEM_HEADER='#pragma GCC system_header'
+ fi
+ else
+ if test $gl_cv_have_include_next = buggy; then
+ INCLUDE_NEXT=include
+ INCLUDE_NEXT_AS_FIRST_DIRECTIVE=include_next
+ else
+ INCLUDE_NEXT=include
+ INCLUDE_NEXT_AS_FIRST_DIRECTIVE=include
+ fi
+ fi
+
+
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether system header files limit the line length" >&5
+$as_echo_n "checking whether system header files limit the line length... " >&6; }
+if ${gl_cv_pragma_columns+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+#ifdef __TANDEM
+choke me
+#endif
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ $EGREP "choke me" >/dev/null 2>&1; then :
+ gl_cv_pragma_columns=yes
+else
+ gl_cv_pragma_columns=no
+fi
+rm -f conftest*
+
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_pragma_columns" >&5
+$as_echo "$gl_cv_pragma_columns" >&6; }
+ if test $gl_cv_pragma_columns = yes; then
+ PRAGMA_COLUMNS="#pragma COLUMNS 10000"
+ else
+ PRAGMA_COLUMNS=
+ fi
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking if environ is properly declared" >&5
+$as_echo_n "checking if environ is properly declared... " >&6; }
+ if ${gt_cv_var_environ_declaration+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#if HAVE_UNISTD_H
+ #include <unistd.h>
+ #endif
+ /* mingw, BeOS, Haiku declare environ in <stdlib.h>, not in <unistd.h>. */
+ #include <stdlib.h>
+
+ extern struct { int foo; } environ;
+int
+main ()
+{
+environ.foo = 1;
;
return 0;
}
+ac_fn_c_check_decl "$LINENO" "fchdir" "ac_cv_have_decl_fchdir" "$ac_includes_default"
+if test "x$ac_cv_have_decl_fchdir" = xyes; then :
+ ac_have_decl=1
+else
+ ac_have_decl=0
+fi
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_FCHDIR $ac_have_decl
+_ACEOF
+
+
+ GNULIB_FCHMODAT=0;
+ GNULIB_FSTAT=0;
+ GNULIB_FSTATAT=0;
+ GNULIB_FUTIMENS=0;
+ GNULIB_LCHMOD=0;
+ GNULIB_LSTAT=0;
+ GNULIB_MKDIRAT=0;
+ GNULIB_MKFIFO=0;
+ GNULIB_MKFIFOAT=0;
+ GNULIB_MKNOD=0;
+ GNULIB_MKNODAT=0;
+ GNULIB_STAT=0;
+ GNULIB_UTIMENSAT=0;
+ HAVE_FCHMODAT=1;
+ HAVE_FSTATAT=1;
+ HAVE_FUTIMENS=1;
+ HAVE_LCHMOD=1;
+ HAVE_LSTAT=1;
+ HAVE_MKDIRAT=1;
+ HAVE_MKFIFO=1;
+ HAVE_MKFIFOAT=1;
+ HAVE_MKNOD=1;
+ HAVE_MKNODAT=1;
+ HAVE_UTIMENSAT=1;
+ REPLACE_FSTAT=0;
+ REPLACE_FSTATAT=0;
+ REPLACE_FUTIMENS=0;
+ REPLACE_LSTAT=0;
+ REPLACE_MKDIR=0;
+ REPLACE_MKFIFO=0;
+ REPLACE_MKNOD=0;
+ REPLACE_STAT=0;
+ REPLACE_UTIMENSAT=0;
+
+
+
+
+
GNULIB_FCNTL=0;
GNULIB_NONBLOCKING=0;
fi
- GNULIB_FCHMODAT=0;
- GNULIB_FSTAT=0;
- GNULIB_FSTATAT=0;
- GNULIB_FUTIMENS=0;
- GNULIB_LCHMOD=0;
- GNULIB_LSTAT=0;
- GNULIB_MKDIRAT=0;
- GNULIB_MKFIFO=0;
- GNULIB_MKFIFOAT=0;
- GNULIB_MKNOD=0;
- GNULIB_MKNODAT=0;
- GNULIB_STAT=0;
- GNULIB_UTIMENSAT=0;
- HAVE_FCHMODAT=1;
- HAVE_FSTATAT=1;
- HAVE_FUTIMENS=1;
- HAVE_LCHMOD=1;
- HAVE_LSTAT=1;
- HAVE_MKDIRAT=1;
- HAVE_MKFIFO=1;
- HAVE_MKFIFOAT=1;
- HAVE_MKNOD=1;
- HAVE_MKNODAT=1;
- HAVE_UTIMENSAT=1;
- REPLACE_FSTAT=0;
- REPLACE_FSTATAT=0;
- REPLACE_FUTIMENS=0;
- REPLACE_LSTAT=0;
- REPLACE_MKDIR=0;
- REPLACE_MKFIFO=0;
- REPLACE_MKNOD=0;
- REPLACE_STAT=0;
- REPLACE_UTIMENSAT=0;
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether stat file-mode macros are broken" >&5
$as_echo_n "checking whether stat file-mode macros are broken... " >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether lstat correctly handles trailing slash" >&5
+$as_echo_n "checking whether lstat correctly handles trailing slash... " >&6; }
+if ${gl_cv_func_lstat_dereferences_slashed_symlink+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ rm -f conftest.sym conftest.file
+ echo >conftest.file
+ if test "$as_ln_s" = "ln -s" && ln -s conftest.file conftest.sym; then
+ if test "$cross_compiling" = yes; then :
+ case "$host_os" in
+ # Guess yes on glibc systems.
+ *-gnu*) gl_cv_func_lstat_dereferences_slashed_symlink="guessing yes" ;;
+ # If we don't know, assume the worst.
+ *) gl_cv_func_lstat_dereferences_slashed_symlink="guessing no" ;;
+ esac
+
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+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;
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+ gl_cv_func_lstat_dereferences_slashed_symlink=yes
+else
+ gl_cv_func_lstat_dereferences_slashed_symlink=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+ conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+ else
+ # If the 'ln -s' command failed, then we probably don't even
+ # have an lstat function.
+ gl_cv_func_lstat_dereferences_slashed_symlink="guessing no"
+ fi
+ rm -f conftest.sym conftest.file
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_lstat_dereferences_slashed_symlink" >&5
+$as_echo "$gl_cv_func_lstat_dereferences_slashed_symlink" >&6; }
+ case "$gl_cv_func_lstat_dereferences_slashed_symlink" in
+ *yes)
+
+cat >>confdefs.h <<_ACEOF
+#define LSTAT_FOLLOWS_SLASHED_SYMLINK 1
+_ACEOF
+
+ ;;
+ esac
+
+
+
+
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether getcwd (NULL, 0) allocates memory for result" >&5
+$as_echo_n "checking whether getcwd (NULL, 0) allocates memory for result... " >&6; }
+if ${gl_cv_func_getcwd_null+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test "$cross_compiling" = yes; then :
+ case "$host_os" in
+ # Guess yes on glibc systems.
+ *-gnu*) gl_cv_func_getcwd_null="guessing yes";;
+ # Guess yes on Cygwin.
+ cygwin*) gl_cv_func_getcwd_null="guessing yes";;
+ # If we don't know, assume the worst.
+ *) gl_cv_func_getcwd_null="guessing no";;
+ esac
+
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+# if HAVE_UNISTD_H
+# include <unistd.h>
+# else /* on Windows with MSVC */
+# include <direct.h>
+# endif
+# ifndef getcwd
+ char *getcwd ();
+# endif
+
+int
+main ()
+{
+
+#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
+/* mingw cwd does not start with '/', but getcwd does allocate.
+ However, mingw fails to honor non-zero size. */
+#else
+ if (chdir ("/") != 0)
+ return 1;
+ else
+ {
+ char *f = getcwd (NULL, 0);
+ if (! f)
+ return 2;
+ if (f[0] != '/')
+ return 3;
+ if (f[1] != '\0')
+ return 4;
+ return 0;
+ }
+#endif
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+ gl_cv_func_getcwd_null=yes
+else
+ gl_cv_func_getcwd_null=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+ conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_getcwd_null" >&5
+$as_echo "$gl_cv_func_getcwd_null" >&6; }
+
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for getcwd with POSIX signature" >&5
+$as_echo_n "checking for getcwd with POSIX signature... " >&6; }
+if ${gl_cv_func_getcwd_posix_signature+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <unistd.h>
+int
+main ()
+{
+extern
+ #ifdef __cplusplus
+ "C"
+ #endif
+ char *getcwd (char *, size_t);
+
+ ;
+ return 0;
+}
+
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ gl_cv_func_getcwd_posix_signature=yes
+else
+ gl_cv_func_getcwd_posix_signature=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_getcwd_posix_signature" >&5
+$as_echo "$gl_cv_func_getcwd_posix_signature" >&6; }
+
+
-
-
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for nl_langinfo and CODESET" >&5
$as_echo_n "checking for nl_langinfo and CODESET... " >&6; }
if ${am_cv_langinfo_codeset+:} false; then :
-
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether lstat correctly handles trailing slash" >&5
-$as_echo_n "checking whether lstat correctly handles trailing slash... " >&6; }
-if ${gl_cv_func_lstat_dereferences_slashed_symlink+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- rm -f conftest.sym conftest.file
- echo >conftest.file
- if test "$as_ln_s" = "ln -s" && ln -s conftest.file conftest.sym; then
- if test "$cross_compiling" = yes; then :
- case "$host_os" in
- # Guess yes on glibc systems.
- *-gnu*) gl_cv_func_lstat_dereferences_slashed_symlink="guessing yes" ;;
- # If we don't know, assume the worst.
- *) gl_cv_func_lstat_dereferences_slashed_symlink="guessing no" ;;
- esac
-
-else
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-$ac_includes_default
-int
-main ()
-{
-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;
-
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_run "$LINENO"; then :
- gl_cv_func_lstat_dereferences_slashed_symlink=yes
-else
- gl_cv_func_lstat_dereferences_slashed_symlink=no
-fi
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
- conftest.$ac_objext conftest.beam conftest.$ac_ext
-fi
-
- else
- # If the 'ln -s' command failed, then we probably don't even
- # have an lstat function.
- gl_cv_func_lstat_dereferences_slashed_symlink="guessing no"
- fi
- rm -f conftest.sym conftest.file
-
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_lstat_dereferences_slashed_symlink" >&5
-$as_echo "$gl_cv_func_lstat_dereferences_slashed_symlink" >&6; }
- case "$gl_cv_func_lstat_dereferences_slashed_symlink" in
- *yes)
-
-cat >>confdefs.h <<_ACEOF
-#define LSTAT_FOLLOWS_SLASHED_SYMLINK 1
-_ACEOF
-
- ;;
- esac
-
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a sed that does not truncate output" >&5
$as_echo_n "checking for a sed that does not truncate output... " >&6; }
if ${ac_cv_path_SED+:} false; then :
fi
fi
+ac_fn_c_check_decl "$LINENO" "memrchr" "ac_cv_have_decl_memrchr" "$ac_includes_default"
+if test "x$ac_cv_have_decl_memrchr" = xyes; then :
+ ac_have_decl=1
+else
+ ac_have_decl=0
+fi
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_MEMRCHR $ac_have_decl
+_ACEOF
+
+
+
GNULIB_MKTIME=0;
GNULIB_NANOSLEEP=0;
GNULIB_STRPTIME=0;
fi
+
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for promoted mode_t type" >&5
+$as_echo_n "checking for promoted mode_t type... " >&6; }
+if ${gl_cv_promoted_mode_t+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <sys/types.h>
+int
+main ()
+{
+typedef int array[2 * (sizeof (mode_t) < sizeof (int)) - 1];
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ gl_cv_promoted_mode_t='int'
+else
+ gl_cv_promoted_mode_t='mode_t'
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_promoted_mode_t" >&5
+$as_echo "$gl_cv_promoted_mode_t" >&6; }
+
+cat >>confdefs.h <<_ACEOF
+#define PROMOTED_MODE_T $gl_cv_promoted_mode_t
+_ACEOF
+
+
+
+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for stdbool.h that conforms to C99" >&5
$as_echo_n "checking for stdbool.h that conforms to C99... " >&6; }
if ${ac_cv_header_stdbool_h+:} false; then :
REPLACE_RAISE=0;
+
+
GNULIB_DPRINTF=0;
GNULIB_FCLOSE=0;
GNULIB_FDOPEN=0;
+
+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ssize_t" >&5
$as_echo_n "checking for ssize_t... " >&6; }
if ${gt_cv_ssize_t+:} false; then :
HAVE_SIGSET_T=0
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for uid_t in sys/types.h" >&5
-$as_echo_n "checking for uid_t in sys/types.h... " >&6; }
-if ${ac_cv_type_uid_t+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-#include <sys/types.h>
-
-_ACEOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
- $EGREP "uid_t" >/dev/null 2>&1; then :
- ac_cv_type_uid_t=yes
-else
- ac_cv_type_uid_t=no
-fi
-rm -f conftest*
-
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_type_uid_t" >&5
-$as_echo "$ac_cv_type_uid_t" >&6; }
-if test $ac_cv_type_uid_t = no; then
-
-$as_echo "#define uid_t int" >>confdefs.h
-
-
-$as_echo "#define gid_t int" >>confdefs.h
-
-fi
-
REPLACE_NULL=0;
+ HAVE_MAX_ALIGN_T=1;
HAVE_WCHAR_T=1;
+
+ac_fn_c_check_decl "$LINENO" "strdup" "ac_cv_have_decl_strdup" "$ac_includes_default"
+if test "x$ac_cv_have_decl_strdup" = xyes; then :
+ ac_have_decl=1
+else
+ ac_have_decl=0
+fi
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_STRDUP $ac_have_decl
+_ACEOF
+
+
REPLACE_STRERROR_0=0
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether strerror(0) succeeds" >&5
$as_echo_n "checking whether strerror(0) succeeds... " >&6; }
+
+
if test $gl_cv_have_include_next = yes; then
gl_cv_next_sys_types_h='<'sys/types.h'>'
TIME_H_DEFINES_STRUCT_TIMESPEC=0
SYS_TIME_H_DEFINES_STRUCT_TIMESPEC=0
PTHREAD_H_DEFINES_STRUCT_TIMESPEC=0
+ UNISTD_H_DEFINES_STRUCT_TIMESPEC=0
if test $gl_cv_sys_struct_timespec_in_time_h = yes; then
TIME_H_DEFINES_STRUCT_TIMESPEC=1
else
$as_echo "$gl_cv_sys_struct_timespec_in_pthread_h" >&6; }
if test $gl_cv_sys_struct_timespec_in_pthread_h = yes; then
PTHREAD_H_DEFINES_STRUCT_TIMESPEC=1
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for struct timespec in <unistd.h>" >&5
+$as_echo_n "checking for struct timespec in <unistd.h>... " >&6; }
+if ${gl_cv_sys_struct_timespec_in_unistd_h+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <unistd.h>
+
+int
+main ()
+{
+static struct timespec x; x.tv_sec = x.tv_nsec;
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ gl_cv_sys_struct_timespec_in_unistd_h=yes
+else
+ gl_cv_sys_struct_timespec_in_unistd_h=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_sys_struct_timespec_in_unistd_h" >&5
+$as_echo "$gl_cv_sys_struct_timespec_in_unistd_h" >&6; }
+ if test $gl_cv_sys_struct_timespec_in_unistd_h = yes; then
+ UNISTD_H_DEFINES_STRUCT_TIMESPEC=1
+ fi
fi
fi
fi
+
if test $gl_cv_have_include_next = yes; then
gl_cv_next_time_h='<'time.h'>'
else
+
+
ac_fn_c_check_decl "$LINENO" "unsetenv" "ac_cv_have_decl_unsetenv" "$ac_includes_default"
if test "x$ac_cv_have_decl_unsetenv" = xyes; then :
ac_have_decl=1
+ gl_LIBOBJS="$gl_LIBOBJS openat-proc.$ac_objext"
+
+
+
+
+
+
+
+
+
if test $ac_cv_func_canonicalize_file_name = no; then
HAVE_CANONICALIZE_FILE_NAME=0
if test $ac_cv_func_realpath = no; then
fi
-cat >>confdefs.h <<_ACEOF
-#define GNULIB_CANONICALIZE_LGPL 1
-_ACEOF
+cat >>confdefs.h <<_ACEOF
+#define GNULIB_CANONICALIZE_LGPL 1
+_ACEOF
+
+
+
+
+
+
+
+ GNULIB_CANONICALIZE_FILE_NAME=1
+
+
+
+
+
+$as_echo "#define GNULIB_TEST_CANONICALIZE_FILE_NAME 1" >>confdefs.h
+
+
+
+
+
+
+
+
+ GNULIB_REALPATH=1
+
+
+
+
+
+$as_echo "#define GNULIB_TEST_REALPATH 1" >>confdefs.h
+
+
+
+
+
+
+
+
+ GNULIB_CHDIR=1
+
+
+
+
+
+$as_echo "#define GNULIB_TEST_CHDIR 1" >>confdefs.h
+
+
+
+
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether this system has an arbitrary file name length limit" >&5
+$as_echo_n "checking whether this system has an arbitrary file name length limit... " >&6; }
+if ${gl_cv_have_arbitrary_file_name_length_limit+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Arrange to define PATH_MAX, like "pathmax.h" does. */
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+#include <limits.h>
+#if defined HAVE_SYS_PARAM_H && !defined PATH_MAX && !defined MAXPATHLEN
+# include <sys/param.h>
+#endif
+#if !defined PATH_MAX && defined MAXPATHLEN
+# define PATH_MAX MAXPATHLEN
+#endif
+#ifdef __hpux
+# undef PATH_MAX
+# define PATH_MAX 1024
+#endif
+#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
+# undef PATH_MAX
+# define PATH_MAX 260
+#endif
+
+#ifdef PATH_MAX
+have_arbitrary_file_name_length_limit
+#endif
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ $EGREP "have_arbitrary_file_name_length_limit" >/dev/null 2>&1; then :
+ gl_cv_have_arbitrary_file_name_length_limit=yes
+else
+ gl_cv_have_arbitrary_file_name_length_limit=no
+fi
+rm -f conftest*
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_have_arbitrary_file_name_length_limit" >&5
+$as_echo "$gl_cv_have_arbitrary_file_name_length_limit" >&6; }
+
+ if test $gl_cv_have_arbitrary_file_name_length_limit = yes; then
- GNULIB_CANONICALIZE_FILE_NAME=1
+ gl_LIBOBJS="$gl_LIBOBJS chdir-long.$ac_objext"
+ :
+ fi
+ if test $HAVE_CHOWN = 0 || test $REPLACE_CHOWN = 1; then
-$as_echo "#define GNULIB_TEST_CANONICALIZE_FILE_NAME 1" >>confdefs.h
+ gl_LIBOBJS="$gl_LIBOBJS chown.$ac_objext"
+ fi
+ if test $REPLACE_CHOWN = 1 && test $ac_cv_func_fchown = no; then
- GNULIB_REALPATH=1
-$as_echo "#define GNULIB_TEST_REALPATH 1" >>confdefs.h
+ gl_LIBOBJS="$gl_LIBOBJS fchown-stub.$ac_objext"
+ fi
- GNULIB_CHDIR=1
+ GNULIB_CHOWN=1
-$as_echo "#define GNULIB_TEST_CHDIR 1" >>confdefs.h
+$as_echo "#define GNULIB_TEST_CHOWN 1" >>confdefs.h
+$as_echo "#define GNULIB_TEST_CLOEXEC 1" >>confdefs.h
+
+
+
+
if test $HAVE_MSVC_INVALID_PARAMETER_HANDLER = 1; then
REPLACE_CLOSE=1
fi
+ if test $REPLACE_CLOSE = 0; then
+
+
+
+ if test $ac_cv_func_fchdir = no; then
+ HAVE_FCHDIR=0
+ fi
+
+ if test $HAVE_FCHDIR = 0; then
+ REPLACE_CLOSE=1
+ fi
+ fi
+
if test $REPLACE_CLOSE = 1; then
fi
+
+
+ if test $ac_cv_func_fchdir = no; then
+ HAVE_FCHDIR=0
+ fi
+
+ if test $HAVE_FCHDIR = 0; then
+ if test $HAVE_CLOSEDIR = 1; then
+ REPLACE_CLOSEDIR=1
+ fi
+ fi
+
+
if test $HAVE_CLOSEDIR = 0 || test $REPLACE_CLOSEDIR = 1; then
fi
+
+
+ if test $ac_cv_func_fchdir = no; then
+ HAVE_FCHDIR=0
+ fi
+
+ if test $HAVE_FCHDIR = 0; then
+ if test $HAVE_DUP2 = 1; then
+ REPLACE_DUP2=1
+ fi
+ fi
+
+
if test $HAVE_DUP2 = 0 || test $REPLACE_DUP2 = 1; then
- :
+ :
+
+ fi
+
+
+
+
+
+
+
+ if test $ac_cv_have_decl_fchdir = no; then
+ HAVE_DECL_FCHDIR=0
+ fi
+
+
+ if test $HAVE_FCHDIR = 0; then
+
+
+
+
+
+
+
+
+ gl_LIBOBJS="$gl_LIBOBJS fchdir.$ac_objext"
+
+ :
+
+$as_echo "#define REPLACE_FCHDIR 1" >>confdefs.h
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether open can visit directories" >&5
+$as_echo_n "checking whether open can visit directories... " >&6; }
+if ${gl_cv_func_open_directory_works+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test "$cross_compiling" = yes; then :
+ case "$host_os" in
+ # Guess yes on glibc systems.
+ *-gnu*) gl_cv_func_open_directory_works="guessing yes" ;;
+ # If we don't know, assume the worst.
+ *) gl_cv_func_open_directory_works="guessing no" ;;
+ esac
+
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <fcntl.h>
+
+int
+main ()
+{
+return open(".", O_RDONLY) < 0;
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+ gl_cv_func_open_directory_works=yes
+else
+ gl_cv_func_open_directory_works=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+ conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_open_directory_works" >&5
+$as_echo "$gl_cv_func_open_directory_works" >&6; }
+ case "$gl_cv_func_open_directory_works" in
+ *yes) ;;
+ *)
+
+$as_echo "#define REPLACE_OPEN_DIRECTORY 1" >>confdefs.h
+
+ ;;
+ esac
+ fi
+
+
+
+
+
+
+ GNULIB_FCHDIR=1
+
+
+
+
+
+$as_echo "#define GNULIB_TEST_FCHDIR 1" >>confdefs.h
+
+
+
+
+
+
+
+ if test $ac_cv_func_fchmodat != yes; then
+ HAVE_FCHMODAT=0
+ fi
+
+ if test $HAVE_FCHMODAT = 0; then
+
+
+
+
+
+
+
+
+ gl_LIBOBJS="$gl_LIBOBJS fchmodat.$ac_objext"
+
+ fi
+
+
+cat >>confdefs.h <<_ACEOF
+#define GNULIB_FCHMODAT 1
+_ACEOF
+
+
+
+
+
+
+ GNULIB_FCHMODAT=1
+
+
+
+
+
+$as_echo "#define GNULIB_TEST_FCHMODAT 1" >>confdefs.h
+
+
+
+
+
+
+
+ ac_fn_c_check_func "$LINENO" "fchownat" "ac_cv_func_fchownat"
+if test "x$ac_cv_func_fchownat" = xyes; then :
+
+
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether fchownat works with AT_SYMLINK_NOFOLLOW" >&5
+$as_echo_n "checking whether fchownat works with AT_SYMLINK_NOFOLLOW... " >&6; }
+if ${gl_cv_func_fchownat_nofollow_works+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+
+ gl_dangle=conftest.dangle
+ # Remove any remnants of a previous test.
+ rm -f $gl_dangle
+ # Arrange for deletion of the temporary file this test creates.
+ ac_clean_files="$ac_clean_files $gl_dangle"
+ ln -s conftest.no-such $gl_dangle
+ if test "$cross_compiling" = yes; then :
+ gl_cv_func_fchownat_nofollow_works=no
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+#include <fcntl.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <sys/types.h>
+int
+main ()
+{
+ return (fchownat (AT_FDCWD, "$gl_dangle", -1, getgid (),
+ AT_SYMLINK_NOFOLLOW) != 0
+ && errno == ENOENT);
+}
+
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+ gl_cv_func_fchownat_nofollow_works=yes
+else
+ gl_cv_func_fchownat_nofollow_works=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+ conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_fchownat_nofollow_works" >&5
+$as_echo "$gl_cv_func_fchownat_nofollow_works" >&6; }
+ if test $gl_cv_func_fchownat_nofollow_works = no; then :
+ REPLACE_FCHOWNAT=1
+
+$as_echo "#define FCHOWNAT_NOFOLLOW_BUG 1" >>confdefs.h
+
+
+fi
+
+
+
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether fchownat works with an empty file name" >&5
+$as_echo_n "checking whether fchownat works with an empty file name... " >&6; }
+if ${gl_cv_func_fchownat_empty_filename_works+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test "$cross_compiling" = yes; then :
+ gl_cv_func_fchownat_empty_filename_works="guessing no"
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <unistd.h>
+ #include <fcntl.h>
+
+int
+main ()
+{
+int fd;
+ int ret;
+ if (mkdir ("conftestdir", 0700) < 0)
+ return 2;
+ fd = open ("conftestdir", O_RDONLY);
+ if (fd < 0)
+ return 3;
+ ret = fchownat (fd, "", -1, -1, 0);
+ close (fd);
+ rmdir ("conftestdir");
+ return ret == 0;
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+ gl_cv_func_fchownat_empty_filename_works=yes
+else
+ gl_cv_func_fchownat_empty_filename_works=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+ conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_fchownat_empty_filename_works" >&5
+$as_echo "$gl_cv_func_fchownat_empty_filename_works" >&6; }
+ if test "$gl_cv_func_fchownat_empty_filename_works" != yes; then :
+ REPLACE_FCHOWNAT=1
+
+$as_echo "#define FCHOWNAT_EMPTY_FILENAME_BUG 1" >>confdefs.h
+
+
+fi
+
+ if test $REPLACE_CHOWN = 1; then
+ REPLACE_FCHOWNAT=1
+ fi
+else
+ HAVE_FCHOWNAT=0
+fi
+
+
+ if test $HAVE_FCHOWNAT = 0 || test $REPLACE_FCHOWNAT = 1; then
+
+
+
+
+
+
+
+
+ gl_LIBOBJS="$gl_LIBOBJS fchownat.$ac_objext"
+
+ fi
+
+
+cat >>confdefs.h <<_ACEOF
+#define GNULIB_FCHOWNAT 1
+_ACEOF
+
+
+
+
+
+
+ GNULIB_FCHOWNAT=1
+
+
+
+
+
+$as_echo "#define GNULIB_TEST_FCHOWNAT 1" >>confdefs.h
- fi
fi
+
+
+ if test $ac_cv_func_fchdir = no; then
+ HAVE_FCHDIR=0
+ fi
+
+ if test $HAVE_FCHDIR = 0; then
+
+
+
+ if test $ac_cv_func_fcntl = no; then
+ HAVE_FCNTL=0
+ else
+ REPLACE_FCNTL=1
+ fi
+
+ fi
+
+
if test $HAVE_FCNTL = 0 || test $REPLACE_FCNTL = 1; then
+
+
+
FLOAT_H=
REPLACE_FLOAT_LDBL=0
case "$host_os" in
+
+
+ if test $ac_cv_func_fchdir = no; then
+ HAVE_FCHDIR=0
+ fi
+
+ if test $HAVE_FCHDIR = 0; then
+ case "$gl_cv_func_open_directory_works" in
+ *yes) ;;
+ *)
+ REPLACE_FSTAT=1
+ ;;
+ esac
+ fi
+
+
if test $REPLACE_FSTAT = 1; then
+
+
+ if test $ac_cv_func_fstatat = no; then
+ HAVE_FSTATAT=0
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether fstatat (..., 0) works" >&5
+$as_echo_n "checking whether fstatat (..., 0) works... " >&6; }
+if ${gl_cv_func_fstatat_zero_flag+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test "$cross_compiling" = yes; then :
+ case "$host_os" in
+ aix*) gl_cv_func_fstatat_zero_flag="guessing no";;
+ *) gl_cv_func_fstatat_zero_flag="guessing yes";;
+ esac
+
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+ #include <fcntl.h>
+ #include <sys/stat.h>
+ int
+ main (void)
+ {
+ struct stat a;
+ return fstatat (AT_FDCWD, ".", &a, 0) != 0;
+ }
+
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+ gl_cv_func_fstatat_zero_flag=yes
+else
+ gl_cv_func_fstatat_zero_flag=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+ conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_fstatat_zero_flag" >&5
+$as_echo "$gl_cv_func_fstatat_zero_flag" >&6; }
+
+ case $gl_cv_func_fstatat_zero_flag+$gl_cv_func_lstat_dereferences_slashed_symlink in
+ *yes+*yes) ;;
+ *) REPLACE_FSTATAT=1
+ case $gl_cv_func_fstatat_zero_flag in
+ *yes)
+
+$as_echo "#define HAVE_WORKING_FSTATAT_ZERO_FLAG 1" >>confdefs.h
+
+ ;;
+ esac
+ ;;
+ esac
+ fi
+
+ if test $HAVE_FSTATAT = 0 || test $REPLACE_FSTATAT = 1; then
+
+
+
+
+
+
+
+
+ gl_LIBOBJS="$gl_LIBOBJS fstatat.$ac_objext"
+
+ fi
+
+
+
+
+
+ GNULIB_FSTATAT=1
+
+
+
+
+
+$as_echo "#define GNULIB_TEST_FSTATAT 1" >>confdefs.h
+
+
+
+
+
+
+
+
+ case $gl_cv_func_getcwd_null,$gl_cv_func_getcwd_posix_signature in
+ *yes,yes) ;;
+ *)
+ REPLACE_GETCWD=1
+ ;;
+ esac
+
+ if test $REPLACE_GETCWD = 1; then
+
+
+
+
+
+
+
+
+ gl_LIBOBJS="$gl_LIBOBJS getcwd-lgpl.$ac_objext"
+
+ fi
+
+
+
+
+
+ GNULIB_GETCWD=1
+
+
+
+
+
+$as_echo "#define GNULIB_TEST_GETCWD 1" >>confdefs.h
+
+
+
+
+
+
+
if test $ac_cv_func_getdtablesize = yes; then
# Cygwin 1.7.25 automatically increases the RLIMIT_NOFILE soft limit
# up to an unchangeable hard limit; all other platforms correctly
+ for ac_func in lchown
+do :
+ ac_fn_c_check_func "$LINENO" "lchown" "ac_cv_func_lchown"
+if test "x$ac_cv_func_lchown" = xyes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_LCHOWN 1
+_ACEOF
+fi
+done
- if test $ac_cv_func_lchmod = no; then
- HAVE_LCHMOD=0
+ if test $ac_cv_func_lchown = no; then
+ HAVE_LCHOWN=0
+ else
+ case "$gl_cv_func_chown_slash_works" in
+ *yes) ;;
+ *)
+ REPLACE_LCHOWN=1
+ ;;
+ esac
+ case "$gl_cv_func_chown_ctime_works" in
+ *yes) ;;
+ *)
+ REPLACE_LCHOWN=1
+ ;;
+ esac
fi
+ if test $HAVE_LCHOWN = 0 || test $REPLACE_LCHOWN = 1; then
+
+
+
+
+
+ gl_LIBOBJS="$gl_LIBOBJS lchown.$ac_objext"
+
+ fi
+
+
- GNULIB_LCHMOD=1
+ GNULIB_LCHOWN=1
-$as_echo "#define GNULIB_TEST_LCHMOD 1" >>confdefs.h
+
+$as_echo "#define GNULIB_TEST_LCHOWN 1" >>confdefs.h
+
+ for ac_func in mempcpy
+do :
+ ac_fn_c_check_func "$LINENO" "mempcpy" "ac_cv_func_mempcpy"
+if test "x$ac_cv_func_mempcpy" = xyes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_MEMPCPY 1
+_ACEOF
+
+fi
+done
+
+ if test $ac_cv_func_mempcpy = no; then
+ HAVE_MEMPCPY=0
+ fi
+
+ if test $HAVE_MEMPCPY = 0; then
+
+
+
+
+
+
+
+
+ gl_LIBOBJS="$gl_LIBOBJS mempcpy.$ac_objext"
+
+
+ :
+
+ fi
+
+
+
+
+
+ GNULIB_MEMPCPY=1
+
+
+
+
+
+$as_echo "#define GNULIB_TEST_MEMPCPY 1" >>confdefs.h
+
+
+
+
+
+
+
+
+ if test $ac_cv_have_decl_memrchr = no; then
+ HAVE_DECL_MEMRCHR=0
+ fi
+
+ for ac_func in memrchr
+do :
+ ac_fn_c_check_func "$LINENO" "memrchr" "ac_cv_func_memrchr"
+if test "x$ac_cv_func_memrchr" = xyes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_MEMRCHR 1
+_ACEOF
+
+fi
+done
+
+
+ if test $ac_cv_func_memrchr = no; then
+
+
+
+
+
+
+
+
+ gl_LIBOBJS="$gl_LIBOBJS memrchr.$ac_objext"
+
+ :
+ fi
+
+
+
+
+
+ GNULIB_MEMRCHR=1
+
+
+
+
+
+$as_echo "#define GNULIB_TEST_MEMRCHR 1" >>confdefs.h
+
+
+
+
+
+
+
+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether mkdir handles trailing slash" >&5
$as_echo_n "checking whether mkdir handles trailing slash... " >&6; }
if ${gl_cv_func_mkdir_trailing_slash_works+:} false; then :
conftest.$ac_objext conftest.beam conftest.$ac_ext
fi
- rm -rf conftest.dir
+ rm -rf conftest.dir
+
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_mkdir_trailing_dot_works" >&5
+$as_echo "$gl_cv_func_mkdir_trailing_dot_works" >&6; }
+ case "$gl_cv_func_mkdir_trailing_dot_works" in
+ *yes) ;;
+ *)
+ REPLACE_MKDIR=1
+
+$as_echo "#define FUNC_MKDIR_DOT_BUG 1" >>confdefs.h
+
+ ;;
+ esac
+
+ if test $REPLACE_MKDIR = 1; then
+
+
+
+
+
+
+
+
+ gl_LIBOBJS="$gl_LIBOBJS mkdir.$ac_objext"
+
+ fi
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_mkdir_trailing_dot_works" >&5
-$as_echo "$gl_cv_func_mkdir_trailing_dot_works" >&6; }
- case "$gl_cv_func_mkdir_trailing_dot_works" in
- *yes) ;;
- *)
- REPLACE_MKDIR=1
-$as_echo "#define FUNC_MKDIR_DOT_BUG 1" >>confdefs.h
- ;;
- esac
+ if test $ac_cv_func_mkdirat != yes; then
+ HAVE_MKDIRAT=0
+ fi
- if test $REPLACE_MKDIR = 1; then
+ if test $HAVE_MKDIRAT = 0; then
- gl_LIBOBJS="$gl_LIBOBJS mkdir.$ac_objext"
+ gl_LIBOBJS="$gl_LIBOBJS mkdirat.$ac_objext"
+
+
+
fi
+ GNULIB_MKDIRAT=1
+
+
+
+
+
+$as_echo "#define GNULIB_TEST_MKDIRAT 1" >>confdefs.h
+
+
+
+
+
+
+
+
if test $APPLE_UNIVERSAL_BUILD = 1; then
# A universal build on Apple Mac OS X platforms.
+ case "$host_os" in
+ mingw* | pw*)
+ REPLACE_OPEN=1
+ ;;
+ *)
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether open recognizes a trailing slash" >&5
+$as_echo_n "checking whether open recognizes a trailing slash... " >&6; }
+if ${gl_cv_func_open_slash+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ # Assume that if we have lstat, we can also check symlinks.
+ if test $ac_cv_func_lstat = yes; then
+ touch conftest.tmp
+ ln -s conftest.tmp conftest.lnk
+ fi
+ if test "$cross_compiling" = yes; then :
+
+ case "$host_os" in
+ freebsd* | aix* | hpux* | solaris2.[0-9] | solaris2.[0-9].*)
+ gl_cv_func_open_slash="guessing no" ;;
+ *)
+ gl_cv_func_open_slash="guessing yes" ;;
+ esac
+
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+#include <fcntl.h>
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+int main ()
+{
+ int result = 0;
+#if HAVE_LSTAT
+ if (open ("conftest.lnk/", O_RDONLY) != -1)
+ result |= 1;
+#endif
+ if (open ("conftest.sl/", O_CREAT, 0600) >= 0)
+ result |= 2;
+ return result;
+}
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+ gl_cv_func_open_slash=yes
+else
+ gl_cv_func_open_slash=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+ conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+ rm -f conftest.sl conftest.tmp conftest.lnk
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_open_slash" >&5
+$as_echo "$gl_cv_func_open_slash" >&6; }
+ case "$gl_cv_func_open_slash" in
+ *no)
+
+$as_echo "#define OPEN_TRAILING_SLASH_BUG 1" >>confdefs.h
+
+ REPLACE_OPEN=1
+ ;;
+ esac
+ ;;
+ esac
+
+ if test $REPLACE_OPEN = 0; then
+
+
+
+ if test $ac_cv_func_fchdir = no; then
+ HAVE_FCHDIR=0
+ fi
+
+ if test $HAVE_FCHDIR = 0; then
+ REPLACE_OPEN=1
+ fi
+ fi
+
+
+
+ if test $REPLACE_OPEN = 1; then
+
+
+
+
+
+
+
+
+ gl_LIBOBJS="$gl_LIBOBJS open.$ac_objext"
+
+
+
+ :
+
+ fi
+
+
+
+
+
+ GNULIB_OPEN=1
+
+
+
+
+
+$as_echo "#define GNULIB_TEST_OPEN 1" >>confdefs.h
+
+
+
+
+
+
+
+
+ case $ac_cv_func_openat+$gl_cv_func_lstat_dereferences_slashed_symlink in
+ yes+*yes)
+ ;;
+ yes+*)
+ # Solaris 9 has *at functions, but uniformly mishandles trailing
+ # slash in all of them.
+ REPLACE_OPENAT=1
+ ;;
+ *)
+ HAVE_OPENAT=0
+ ;;
+ esac
+
+ if test $HAVE_OPENAT = 0 || test $REPLACE_OPENAT = 1; then
+
+
+
+
+
+
+
+
+ gl_LIBOBJS="$gl_LIBOBJS openat.$ac_objext"
+
+
+
+ :
+
+ fi
+
+
+cat >>confdefs.h <<_ACEOF
+#define GNULIB_OPENAT 1
+_ACEOF
+
+
+
+
+
+
+ GNULIB_OPENAT=1
+
+
+
+
+
+$as_echo "#define GNULIB_TEST_OPENAT 1" >>confdefs.h
+
+
+
+
+
for ac_func in opendir
do :
fi
+
+
+ if test $ac_cv_func_fchdir = no; then
+ HAVE_FCHDIR=0
+ fi
+
+ if test $HAVE_FCHDIR = 0; then
+ if test $HAVE_OPENDIR = 1; then
+ REPLACE_OPENDIR=1
+ fi
+ fi
+
+
if test $HAVE_OPENDIR = 0 || test $REPLACE_OPENDIR = 1; then
+
+ if test $ac_cv_func_readlinkat = no; then
+ HAVE_READLINKAT=0
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether readlinkat signature is correct" >&5
+$as_echo_n "checking whether readlinkat signature is correct... " >&6; }
+if ${gl_cv_decl_readlinkat_works+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <unistd.h>
+ /* Check whether original declaration has correct type. */
+ ssize_t readlinkat (int, char const *, char *, size_t);
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ gl_cv_decl_readlinkat_works=yes
+else
+ gl_cv_decl_readlinkat_works=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_decl_readlinkat_works" >&5
+$as_echo "$gl_cv_decl_readlinkat_works" >&6; }
+ if test "$gl_cv_decl_readlink_works" != yes; then
+ REPLACE_READLINKAT=1
+ fi
+ fi
+
+ if test $HAVE_READLINKAT = 0 || test $REPLACE_READLINKAT = 1; then
+
+
+
+
+
+
+
+
+ gl_LIBOBJS="$gl_LIBOBJS readlinkat.$ac_objext"
+
+ fi
+
+
+
+
+
+ GNULIB_READLINKAT=1
+
+
+
+
+
+$as_echo "#define GNULIB_TEST_READLINKAT 1" >>confdefs.h
+
+
+
+
+
+
for ac_header in stdlib.h
do :
ac_fn_c_check_header_mongrel "$LINENO" "stdlib.h" "ac_cv_header_stdlib_h" "$ac_includes_default"
- GNULIB_RENAME=1
+ GNULIB_RENAME=1
+
+
+
+
+
+$as_echo "#define GNULIB_TEST_RENAME 1" >>confdefs.h
+
+
+
+
+
+
+
+
+
+ if test $ac_cv_func_renameat = no; then
+ HAVE_RENAMEAT=0
+ elif test $REPLACE_RENAME = 1; then
+ REPLACE_RENAMEAT=1
+ fi
+
+ if test $HAVE_RENAMEAT = 0 || test $REPLACE_RENAMEAT = 1; then
+
+
+
+
+
+
+
+
+ gl_LIBOBJS="$gl_LIBOBJS renameat.$ac_objext"
+
+ fi
+ if test $HAVE_RENAMEAT = 0; then
+
+
+
+
+
+
+
+
+ gl_LIBOBJS="$gl_LIBOBJS at-func2.$ac_objext"
+
+ fi
+
+
+
+
+
+ GNULIB_RENAMEAT=1
-$as_echo "#define GNULIB_TEST_RENAME 1" >>confdefs.h
+$as_echo "#define GNULIB_TEST_RENAMEAT 1" >>confdefs.h
+
+
+
if test $ac_cv_func_secure_getenv = no; then
HAVE_SECURE_GETENV=0
fi
+
+cat >>confdefs.h <<_ACEOF
+#define GNULIB_STATAT 1
+_ACEOF
+
+
STDARG_H=''
NEXT_STDARG_H='<stdarg.h>'
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for va_copy" >&5
STDDEF_H=
+ ac_fn_c_check_type "$LINENO" "max_align_t" "ac_cv_type_max_align_t" "#include <stddef.h>
+
+"
+if test "x$ac_cv_type_max_align_t" = xyes; then :
+
+else
+ HAVE_MAX_ALIGN_T=0; STDDEF_H=stddef.h
+fi
+
if test $gt_cv_c_wchar_t = no; then
HAVE_WCHAR_T=0
STDDEF_H=stddef.h
+
+
if test $gl_cv_have_include_next = yes; then
gl_cv_next_stdio_h='<'stdio.h'>'
else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether inttypes macros match system or gnu printf" >&5
+$as_echo_n "checking whether inttypes macros match system or gnu printf... " >&6; }
+if ${gl_cv_func_printf_attribute_flavor+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#define __STDC_FORMAT_MACROS 1
+ #include <stdio.h>
+ #include <inttypes.h>
+ findme PRIdMAX findme
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ $EGREP "findme .(ll|j)d. findme" >/dev/null 2>&1; then :
+ gl_cv_func_printf_attribute_flavor=gnu
+else
+ gl_cv_func_printf_attribute_flavor=system
+fi
+rm -f conftest*
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_printf_attribute_flavor" >&5
+$as_echo "$gl_cv_func_printf_attribute_flavor" >&6; }
+ if test "$gl_cv_func_printf_attribute_flavor" = gnu; then
+
+$as_echo "#define GNULIB_PRINTF_ATTRIBUTE_FLAVOR_GNU 1" >>confdefs.h
+
+ fi
+
GNULIB_FSCANF=1
+ if test $ac_cv_func_strdup = yes; then
+ if test $gl_cv_func_malloc_posix != yes; then
+ REPLACE_STRDUP=1
+ fi
+ fi
+
+ if test $ac_cv_have_decl_strdup = no; then
+ HAVE_DECL_STRDUP=0
+ fi
+
+ if test $ac_cv_func_strdup = no || test $REPLACE_STRDUP = 1; then
+
+
+
+
+
+
+
+
+ gl_LIBOBJS="$gl_LIBOBJS strdup.$ac_objext"
+
+ :
+ fi
+
+
+
+
+
+ GNULIB_STRDUP=1
+
+
+
+
+
+$as_echo "#define GNULIB_TEST_STRDUP 1" >>confdefs.h
+
+
+
+
+
+
+
if test "$ERRNO_H:$REPLACE_STRERROR_0" = :0; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for working strerror function" >&5
+ if test $ac_cv_func_symlinkat = no; then
+ HAVE_SYMLINKAT=0
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether symlinkat handles trailing slash correctly" >&5
+$as_echo_n "checking whether symlinkat handles trailing slash correctly... " >&6; }
+if ${gl_cv_func_symlinkat_works+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test "$cross_compiling" = yes; then :
+ case "$host_os" in
+ # Guess yes on glibc systems.
+ *-gnu*) gl_cv_func_symlinkat_works="guessing yes" ;;
+ # If we don't know, assume the worst.
+ *) gl_cv_func_symlinkat_works="guessing no" ;;
+ esac
+
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <fcntl.h>
+ #include <unistd.h>
+
+int
+main ()
+{
+int result = 0;
+ if (!symlinkat ("a", AT_FDCWD, "conftest.link/"))
+ result |= 1;
+ if (symlinkat ("conftest.f", AT_FDCWD, "conftest.lnk2"))
+ result |= 2;
+ else if (!symlinkat ("a", AT_FDCWD, "conftest.lnk2/"))
+ result |= 4;
+ return result;
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+ gl_cv_func_symlinkat_works=yes
+else
+ gl_cv_func_symlinkat_works=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+ conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+ rm -f conftest.f conftest.link conftest.lnk2
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_symlinkat_works" >&5
+$as_echo "$gl_cv_func_symlinkat_works" >&6; }
+ case "$gl_cv_func_symlinkat_works" in
+ *yes) ;;
+ *)
+ REPLACE_SYMLINKAT=1
+ ;;
+ esac
+ fi
+
+ if test $HAVE_SYMLINKAT = 0 || test $REPLACE_SYMLINKAT = 1; then
+
+
+
+
+
+
+
+
+ gl_LIBOBJS="$gl_LIBOBJS symlinkat.$ac_objext"
+
+ fi
+
+
+
+
+
+ GNULIB_SYMLINKAT=1
+
+
+
+
+
+$as_echo "#define GNULIB_TEST_SYMLINKAT 1" >>confdefs.h
+
+
+
+
+
+
+
+
+
+
+
+ if test $ac_cv_func_unlinkat = no; then
+ HAVE_UNLINKAT=0
+ else
+ case "$gl_cv_func_lstat_dereferences_slashed_symlink" in
+ *no)
+ # Solaris 9 has *at functions, but uniformly mishandles trailing
+ # slash in all of them.
+ REPLACE_UNLINKAT=1
+ ;;
+ *)
+ # GNU/Hurd has unlinkat, but it has the same bug as unlink.
+ if test $REPLACE_UNLINK = 1; then
+ REPLACE_UNLINKAT=1
+ fi
+ ;;
+ esac
+ fi
+
+ if test $HAVE_UNLINKAT = 0 || test $REPLACE_UNLINKAT = 1; then
+
+
+
+
+
+
+
+
+ gl_LIBOBJS="$gl_LIBOBJS unlinkat.$ac_objext"
+
+ fi
+
+
+
+
+
+ GNULIB_UNLINKAT=1
+
+
+
+
+
+$as_echo "#define GNULIB_TEST_UNLINKAT 1" >>confdefs.h
+
+
+
+
+
+
if test $ac_cv_have_decl_unsetenv = no; then
HAVE_DECL_UNSETENV=0
fi
+
+
+ if test $ac_cv_func_utimensat = no; then
+ HAVE_UTIMENSAT=0
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether utimensat works" >&5
+$as_echo_n "checking whether utimensat works... " >&6; }
+if ${gl_cv_func_utimensat_works+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test "$cross_compiling" = yes; then :
+ gl_cv_func_utimensat_works="guessing no"
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+#include <fcntl.h>
+#include <sys/stat.h>
+#include <unistd.h>
+
+int
+main ()
+{
+int result = 0;
+ const char *f = "conftest.file";
+ if (close (creat (f, 0600)))
+ return 1;
+ /* Test whether the AT_SYMLINK_NOFOLLOW flag is supported. */
+ {
+ if (utimensat (AT_FDCWD, f, NULL, AT_SYMLINK_NOFOLLOW))
+ result |= 2;
+ }
+ /* Test whether UTIME_NOW and UTIME_OMIT work. */
+ {
+ struct timespec ts[2] = { { 1, UTIME_OMIT }, { 1, UTIME_NOW } };
+ if (utimensat (AT_FDCWD, f, ts, 0))
+ result |= 4;
+ }
+ sleep (1);
+ {
+ struct timespec ts[2] = { { 1, UTIME_NOW }, { 1, UTIME_OMIT } };
+ struct stat st;
+ if (utimensat (AT_FDCWD, f, ts, 0))
+ result |= 8;
+ if (stat (f, &st))
+ result |= 16;
+ else if (st.st_ctime < st.st_atime)
+ result |= 32;
+ }
+ return result;
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+#ifdef __linux__
+/* The Linux kernel added utimensat in 2.6.22, but has bugs with UTIME_OMIT
+ in several file systems as recently as 2.6.32. Always replace utimensat
+ to support older kernels. */
+choke me
+#endif
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ gl_cv_func_utimensat_works=yes
+else
+ gl_cv_func_utimensat_works="needs runtime check"
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+else
+ gl_cv_func_utimensat_works=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+ conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_utimensat_works" >&5
+$as_echo "$gl_cv_func_utimensat_works" >&6; }
+ if test "$gl_cv_func_utimensat_works" != yes; then
+ REPLACE_UTIMENSAT=1
+ fi
+ fi
+
+ if test $HAVE_UTIMENSAT = 0 || test $REPLACE_UTIMENSAT = 1; then
+
+
+
+
+
+
+
+
+ gl_LIBOBJS="$gl_LIBOBJS utimensat.$ac_objext"
+
+ fi
+
+
+
+
+
+ GNULIB_UTIMENSAT=1
+
+
+
+
+
+$as_echo "#define GNULIB_TEST_UTIMENSAT 1" >>confdefs.h
+
+
+
+
+
if test $ac_cv_func_vasnprintf = no; then
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
-This file was extended by GNU patch $as_me 2.7.3, which was
+This file was extended by GNU patch $as_me 2.7.4, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
-GNU patch config.status 2.7.3
+GNU patch config.status 2.7.4
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"
@SET_MAKE@
-# Copyright (C) 2002-2014 Free Software Foundation, Inc.
+# Copyright (C) 2002-2015 Free Software Foundation, Inc.
#
# 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
# the same distribution terms as the rest of that program.
#
# Generated by gnulib-tool.
-# Reproduce by: gnulib-tool --import --dir=. --local-dir=gl --lib=libpatch --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --makefile-name=gnulib.mk --no-conditional-dependencies --no-libtool --macro-prefix=gl argmatch backupfile clock-time diffseq dirname dup2 errno exitfail extensions fcntl-h full-write getdate getopt-gnu gettime git-version-gen gitlog-to-changelog hash ignore-value intprops largefile lchmod linked-list lstat maintainer-makefile malloc manywarnings memchr minmax mkdir progname quotearg readlink realloc rename rmdir setenv signal ssize_t stat-time stdbool stdlib symlink sys_stat tempname time unistd unlink update-copyright utimens verror xalloc xlist xmemdup0
+# Reproduce by: gnulib-tool --import --dir=. --local-dir=gl --lib=libpatch --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --makefile-name=gnulib.mk --no-conditional-dependencies --no-libtool --macro-prefix=gl argmatch backupfile clock-time diffseq dirname dup2 errno exitfail extensions fchmodat fchownat fcntl-h fstatat full-write getdate getopt-gnu gettime git-version-gen gitlog-to-changelog hash ignore-value intprops largefile linked-list maintainer-makefile malloc manywarnings memchr minmax mkdirat openat progname quotearg readlinkat realloc renameat setenv signal ssize_t stat-time stdbool stdlib symlinkat sys_stat tempname time unistd unlinkat update-copyright utimensat verror xalloc xlist xmemdup0
VPATH = @srcdir@
am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
$(top_srcdir)/m4/absolute-header.m4 $(top_srcdir)/m4/alloca.m4 \
$(top_srcdir)/m4/backupfile.m4 $(top_srcdir)/m4/bison.m4 \
$(top_srcdir)/m4/canonicalize.m4 \
+ $(top_srcdir)/m4/chdir-long.m4 $(top_srcdir)/m4/chown.m4 \
$(top_srcdir)/m4/clock_time.m4 $(top_srcdir)/m4/close.m4 \
$(top_srcdir)/m4/closedir.m4 $(top_srcdir)/m4/codeset.m4 \
$(top_srcdir)/m4/configmake.m4 $(top_srcdir)/m4/d-ino.m4 \
$(top_srcdir)/m4/eealloc.m4 $(top_srcdir)/m4/environ.m4 \
$(top_srcdir)/m4/errno_h.m4 $(top_srcdir)/m4/error.m4 \
$(top_srcdir)/m4/exponentd.m4 $(top_srcdir)/m4/extensions.m4 \
- $(top_srcdir)/m4/extern-inline.m4 $(top_srcdir)/m4/fcntl-o.m4 \
- $(top_srcdir)/m4/fcntl.m4 $(top_srcdir)/m4/fcntl_h.m4 \
+ $(top_srcdir)/m4/extern-inline.m4 $(top_srcdir)/m4/fchdir.m4 \
+ $(top_srcdir)/m4/fchmodat.m4 $(top_srcdir)/m4/fchownat.m4 \
+ $(top_srcdir)/m4/fcntl-o.m4 $(top_srcdir)/m4/fcntl.m4 \
+ $(top_srcdir)/m4/fcntl_h.m4 $(top_srcdir)/m4/filenamecat.m4 \
$(top_srcdir)/m4/float_h.m4 $(top_srcdir)/m4/fstat.m4 \
+ $(top_srcdir)/m4/fstatat.m4 $(top_srcdir)/m4/getcwd.m4 \
$(top_srcdir)/m4/getdtablesize.m4 $(top_srcdir)/m4/getopt.m4 \
$(top_srcdir)/m4/gettime.m4 $(top_srcdir)/m4/gettimeofday.m4 \
$(top_srcdir)/m4/glibc21.m4 $(top_srcdir)/m4/gnulib-common.m4 \
$(top_srcdir)/m4/gnulib-comp.m4 \
$(top_srcdir)/m4/include_next.m4 $(top_srcdir)/m4/intmax_t.m4 \
$(top_srcdir)/m4/inttypes_h.m4 $(top_srcdir)/m4/largefile.m4 \
- $(top_srcdir)/m4/lchmod.m4 $(top_srcdir)/m4/localcharset.m4 \
+ $(top_srcdir)/m4/lchown.m4 $(top_srcdir)/m4/localcharset.m4 \
$(top_srcdir)/m4/locale-fr.m4 $(top_srcdir)/m4/locale-ja.m4 \
$(top_srcdir)/m4/locale-zh.m4 $(top_srcdir)/m4/longlong.m4 \
$(top_srcdir)/m4/lstat.m4 $(top_srcdir)/m4/malloc.m4 \
$(top_srcdir)/m4/malloca.m4 $(top_srcdir)/m4/manywarnings.m4 \
$(top_srcdir)/m4/mbrtowc.m4 $(top_srcdir)/m4/mbsinit.m4 \
$(top_srcdir)/m4/mbstate_t.m4 $(top_srcdir)/m4/memchr.m4 \
+ $(top_srcdir)/m4/mempcpy.m4 $(top_srcdir)/m4/memrchr.m4 \
$(top_srcdir)/m4/minmax.m4 $(top_srcdir)/m4/mkdir.m4 \
- $(top_srcdir)/m4/mktime.m4 $(top_srcdir)/m4/mmap-anon.m4 \
+ $(top_srcdir)/m4/mkdirat.m4 $(top_srcdir)/m4/mktime.m4 \
+ $(top_srcdir)/m4/mmap-anon.m4 $(top_srcdir)/m4/mode_t.m4 \
$(top_srcdir)/m4/msvc-inval.m4 \
$(top_srcdir)/m4/msvc-nothrow.m4 $(top_srcdir)/m4/multiarch.m4 \
$(top_srcdir)/m4/nocrash.m4 $(top_srcdir)/m4/off_t.m4 \
+ $(top_srcdir)/m4/open.m4 $(top_srcdir)/m4/openat.m4 \
$(top_srcdir)/m4/opendir.m4 $(top_srcdir)/m4/parse-datetime.m4 \
$(top_srcdir)/m4/pathmax.m4 $(top_srcdir)/m4/printf.m4 \
$(top_srcdir)/m4/quote.m4 $(top_srcdir)/m4/quotearg.m4 \
$(top_srcdir)/m4/raise.m4 $(top_srcdir)/m4/readdir.m4 \
- $(top_srcdir)/m4/readlink.m4 $(top_srcdir)/m4/realloc.m4 \
- $(top_srcdir)/m4/rename.m4 $(top_srcdir)/m4/rmdir.m4 \
+ $(top_srcdir)/m4/readlink.m4 $(top_srcdir)/m4/readlinkat.m4 \
+ $(top_srcdir)/m4/realloc.m4 $(top_srcdir)/m4/rename.m4 \
+ $(top_srcdir)/m4/renameat.m4 $(top_srcdir)/m4/rmdir.m4 \
$(top_srcdir)/m4/safe-read.m4 $(top_srcdir)/m4/safe-write.m4 \
- $(top_srcdir)/m4/secure_getenv.m4 $(top_srcdir)/m4/setenv.m4 \
- $(top_srcdir)/m4/setmode.m4 $(top_srcdir)/m4/signal_h.m4 \
- $(top_srcdir)/m4/size_max.m4 $(top_srcdir)/m4/ssize_t.m4 \
- $(top_srcdir)/m4/stat-time.m4 $(top_srcdir)/m4/stat.m4 \
- $(top_srcdir)/m4/stdarg.m4 $(top_srcdir)/m4/stdbool.m4 \
- $(top_srcdir)/m4/stddef_h.m4 $(top_srcdir)/m4/stdint.m4 \
- $(top_srcdir)/m4/stdint_h.m4 $(top_srcdir)/m4/stdio_h.m4 \
- $(top_srcdir)/m4/stdlib_h.m4 $(top_srcdir)/m4/strerror.m4 \
+ $(top_srcdir)/m4/save-cwd.m4 $(top_srcdir)/m4/secure_getenv.m4 \
+ $(top_srcdir)/m4/setenv.m4 $(top_srcdir)/m4/setmode.m4 \
+ $(top_srcdir)/m4/signal_h.m4 $(top_srcdir)/m4/size_max.m4 \
+ $(top_srcdir)/m4/ssize_t.m4 $(top_srcdir)/m4/stat-time.m4 \
+ $(top_srcdir)/m4/stat.m4 $(top_srcdir)/m4/stdarg.m4 \
+ $(top_srcdir)/m4/stdbool.m4 $(top_srcdir)/m4/stddef_h.m4 \
+ $(top_srcdir)/m4/stdint.m4 $(top_srcdir)/m4/stdint_h.m4 \
+ $(top_srcdir)/m4/stdio_h.m4 $(top_srcdir)/m4/stdlib_h.m4 \
+ $(top_srcdir)/m4/strdup.m4 $(top_srcdir)/m4/strerror.m4 \
$(top_srcdir)/m4/string_h.m4 $(top_srcdir)/m4/strndup.m4 \
$(top_srcdir)/m4/strnlen.m4 $(top_srcdir)/m4/symlink.m4 \
- $(top_srcdir)/m4/sys_socket_h.m4 \
+ $(top_srcdir)/m4/symlinkat.m4 $(top_srcdir)/m4/sys_socket_h.m4 \
$(top_srcdir)/m4/sys_stat_h.m4 $(top_srcdir)/m4/sys_time_h.m4 \
$(top_srcdir)/m4/sys_types_h.m4 $(top_srcdir)/m4/tempname.m4 \
$(top_srcdir)/m4/time_h.m4 $(top_srcdir)/m4/time_r.m4 \
$(top_srcdir)/m4/timespec.m4 $(top_srcdir)/m4/tm_gmtoff.m4 \
$(top_srcdir)/m4/unistd-safer.m4 $(top_srcdir)/m4/unistd_h.m4 \
- $(top_srcdir)/m4/unlink.m4 $(top_srcdir)/m4/utimbuf.m4 \
- $(top_srcdir)/m4/utimens.m4 $(top_srcdir)/m4/utimes.m4 \
+ $(top_srcdir)/m4/unlink.m4 $(top_srcdir)/m4/unlinkat.m4 \
+ $(top_srcdir)/m4/utimbuf.m4 $(top_srcdir)/m4/utimens.m4 \
+ $(top_srcdir)/m4/utimensat.m4 $(top_srcdir)/m4/utimes.m4 \
$(top_srcdir)/m4/vasnprintf.m4 $(top_srcdir)/m4/vasprintf.m4 \
$(top_srcdir)/m4/warn-on-use.m4 $(top_srcdir)/m4/warnings.m4 \
$(top_srcdir)/m4/wchar_h.m4 $(top_srcdir)/m4/wchar_t.m4 \
am__DEPENDENCIES_1 =
am_libpatch_a_OBJECTS = argmatch.$(OBJEXT) backupfile.$(OBJEXT) \
bitrotate.$(OBJEXT) c-ctype.$(OBJEXT) c-strcasecmp.$(OBJEXT) \
- c-strncasecmp.$(OBJEXT) opendir-safer.$(OBJEXT) \
- dirname.$(OBJEXT) basename.$(OBJEXT) dirname-lgpl.$(OBJEXT) \
- basename-lgpl.$(OBJEXT) stripslash.$(OBJEXT) \
- exitfail.$(OBJEXT) fd-hook.$(OBJEXT) full-write.$(OBJEXT) \
- gettime.$(OBJEXT) hash.$(OBJEXT) gl_linked_list.$(OBJEXT) \
- gl_list.$(OBJEXT) localcharset.$(OBJEXT) malloca.$(OBJEXT) \
+ c-strncasecmp.$(OBJEXT) cloexec.$(OBJEXT) \
+ opendir-safer.$(OBJEXT) dirname.$(OBJEXT) basename.$(OBJEXT) \
+ dirname-lgpl.$(OBJEXT) basename-lgpl.$(OBJEXT) \
+ stripslash.$(OBJEXT) exitfail.$(OBJEXT) chmodat.$(OBJEXT) \
+ chownat.$(OBJEXT) fd-hook.$(OBJEXT) filenamecat-lgpl.$(OBJEXT) \
+ full-write.$(OBJEXT) gettime.$(OBJEXT) hash.$(OBJEXT) \
+ gl_linked_list.$(OBJEXT) gl_list.$(OBJEXT) \
+ localcharset.$(OBJEXT) malloca.$(OBJEXT) openat-die.$(OBJEXT) \
parse-datetime.$(OBJEXT) progname.$(OBJEXT) quotearg.$(OBJEXT) \
- safe-write.$(OBJEXT) stat-time.$(OBJEXT) tempname.$(OBJEXT) \
- timespec.$(OBJEXT) unistd.$(OBJEXT) dup-safer.$(OBJEXT) \
- fd-safer.$(OBJEXT) pipe-safer.$(OBJEXT) utimens.$(OBJEXT) \
- verror.$(OBJEXT) wctype-h.$(OBJEXT) xmalloc.$(OBJEXT) \
- xalloc-die.$(OBJEXT) gl_xlist.$(OBJEXT) xsize.$(OBJEXT) \
- xstrndup.$(OBJEXT) xvasprintf.$(OBJEXT) xasprintf.$(OBJEXT)
+ safe-write.$(OBJEXT) save-cwd.$(OBJEXT) stat-time.$(OBJEXT) \
+ statat.$(OBJEXT) tempname.$(OBJEXT) timespec.$(OBJEXT) \
+ unistd.$(OBJEXT) dup-safer.$(OBJEXT) fd-safer.$(OBJEXT) \
+ pipe-safer.$(OBJEXT) utimens.$(OBJEXT) verror.$(OBJEXT) \
+ wctype-h.$(OBJEXT) xmalloc.$(OBJEXT) xalloc-die.$(OBJEXT) \
+ gl_xlist.$(OBJEXT) xsize.$(OBJEXT) xstrndup.$(OBJEXT) \
+ xvasprintf.$(OBJEXT) xasprintf.$(OBJEXT)
libpatch_a_OBJECTS = $(am_libpatch_a_OBJECTS)
AM_V_P = $(am__v_P_@AM_V@)
am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
HAVE_LINKAT = @HAVE_LINKAT@
HAVE_LONG_LONG_INT = @HAVE_LONG_LONG_INT@
HAVE_LSTAT = @HAVE_LSTAT@
+HAVE_MAX_ALIGN_T = @HAVE_MAX_ALIGN_T@
HAVE_MBRLEN = @HAVE_MBRLEN@
HAVE_MBRTOWC = @HAVE_MBRTOWC@
HAVE_MBSINIT = @HAVE_MBSINIT@
SYS_TIME_H_DEFINES_STRUCT_TIMESPEC = @SYS_TIME_H_DEFINES_STRUCT_TIMESPEC@
TIME_H_DEFINES_STRUCT_TIMESPEC = @TIME_H_DEFINES_STRUCT_TIMESPEC@
UNDEFINE_STRTOK_R = @UNDEFINE_STRTOK_R@
+UNISTD_H_DEFINES_STRUCT_TIMESPEC = @UNISTD_H_DEFINES_STRUCT_TIMESPEC@
UNISTD_H_HAVE_WINSOCK2_H = @UNISTD_H_HAVE_WINSOCK2_H@
UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS = @UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS@
VERSION = @VERSION@
sys/types.h time.h unistd.h wchar.h wctype.h
CLEANFILES = configmake.h configmake.h-t charset.alias ref-add.sed \
ref-del.sed
-EXTRA_DIST = alloca.in.h argmatch.h backupfile.h c-strcaseeq.h \
- canonicalize-lgpl.c close.c closedir.c dirent-private.h \
- dirent.in.h dirent--.h dirent-safer.h dirfd.c stripslash.c \
- dirname.h dosname.h dup2.c errno.in.h error.c error.h \
- exitfail.h fcntl.c fcntl.in.h fd-hook.h filename.h float.c \
- float.in.h itold.c fstat.c getdate.h getdtablesize.c getopt.c \
- getopt.in.h getopt1.c getopt_int.h gettimeofday.c \
+EXTRA_DIST = alloca.in.h argmatch.h assure.h openat-priv.h \
+ openat-proc.c backupfile.h c-strcaseeq.h canonicalize-lgpl.c \
+ chdir-long.c chdir-long.h chown.c fchown-stub.c cloexec.h \
+ close.c closedir.c dirent-private.h dirent.in.h dirent--.h \
+ dirent-safer.h dirfd.c stripslash.c dirname.h dosname.h dup2.c \
+ errno.in.h error.c error.h exitfail.h fchdir.c at-func.c \
+ fchmodat.c at-func.c fchownat.c fcntl.c fcntl.in.h fd-hook.h \
+ filename.h filenamecat.h float.c float.in.h itold.c fstat.c \
+ at-func.c fstatat.c getcwd-lgpl.c getdate.h getdtablesize.c \
+ getopt.c getopt.in.h getopt1.c getopt_int.h gettimeofday.c \
$(top_srcdir)/build-aux/git-version-gen \
$(top_srcdir)/build-aux/gitlog-to-changelog \
$(top_srcdir)/GNUmakefile hash.h ignore-value.h intprops.h \
- config.charset ref-add.sin ref-del.sin lstat.c \
+ lchown.c config.charset ref-add.sin ref-del.sin lstat.c \
$(top_srcdir)/maint.mk malloc.c malloc.c malloca.h \
malloca.valgrind mbrtowc.c mbsinit.c memchr.c memchr.valgrind \
- mkdir.c mktime-internal.h mktime.c msvc-inval.c msvc-inval.h \
- msvc-nothrow.c msvc-nothrow.h dirent-private.h opendir.c \
- parse-datetime.c parse-datetime.h pathmax.h quote.h quote.h \
- quotearg.h raise.c dirent-private.h readdir.c readlink.c \
- realloc.c realloc.c rename.c rmdir.c safe-read.c safe-write.h \
- same-inode.h secure_getenv.c setenv.c signal.in.h \
- $(top_srcdir)/build-aux/snippet/_Noreturn.h \
+ mempcpy.c memrchr.c mkdir.c at-func.c mkdirat.c \
+ mktime-internal.h mktime.c msvc-inval.c msvc-inval.h \
+ msvc-nothrow.c msvc-nothrow.h open.c openat.c openat.h \
+ dirent-private.h opendir.c parse-datetime.c parse-datetime.h \
+ pathmax.h quote.h quote.h quotearg.h raise.c dirent-private.h \
+ readdir.c readlink.c at-func.c readlinkat.c realloc.c \
+ realloc.c rename.c at-func2.c renameat.c rmdir.c safe-read.c \
+ safe-write.h same-inode.h save-cwd.h secure_getenv.c setenv.c \
+ signal.in.h $(top_srcdir)/build-aux/snippet/_Noreturn.h \
$(top_srcdir)/build-aux/snippet/arg-nonnull.h \
$(top_srcdir)/build-aux/snippet/c++defs.h \
$(top_srcdir)/build-aux/snippet/warn-on-use.h stat.c \
stat-time.h stdarg.in.h stdbool.in.h stddef.in.h stdint.in.h \
- stdio.in.h stdlib.in.h streq.h strerror.c strerror-override.c \
- strerror-override.h string.in.h strndup.c strnlen.c symlink.c \
- sys_stat.in.h sys_time.in.h sys_types.in.h tempname.h \
- time.in.h time_r.c timespec.h unistd.in.h unistd--.h \
- unistd-safer.h unlink.c unsetenv.c \
+ stdio.in.h stdlib.in.h strdup.c streq.h strerror.c \
+ strerror-override.c strerror-override.h string.in.h strndup.c \
+ strnlen.c symlink.c at-func.c symlinkat.c sys_stat.in.h \
+ sys_time.in.h sys_types.in.h tempname.h time.in.h time_r.c \
+ timespec.h unistd.in.h unistd--.h unistd-safer.h unlink.c \
+ at-func.c unlinkat.c unsetenv.c \
$(top_srcdir)/build-aux/update-copyright \
$(top_srcdir)/build-aux/useless-if-before-free utimens.h \
- asnprintf.c float+.h printf-args.c printf-args.h \
- printf-parse.c printf-parse.h vasnprintf.c vasnprintf.h \
- asprintf.c vasprintf.c $(top_srcdir)/build-aux/vc-list-files \
- verify.h wchar.in.h wctype.in.h write.c xalloc.h \
- xalloc-oversized.h xmemdup0.c xmemdup0.h xalloc.h
+ at-func.c utimensat.c asnprintf.c float+.h printf-args.c \
+ printf-args.h printf-parse.c printf-parse.h vasnprintf.c \
+ vasnprintf.h asprintf.c vasprintf.c \
+ $(top_srcdir)/build-aux/vc-list-files verify.h wchar.in.h \
+ wctype.in.h write.c xalloc.h xalloc-oversized.h xmemdup0.c \
+ xmemdup0.h xalloc.h
MAINTAINERCLEANFILES = parse-datetime.c
MOSTLYCLEANDIRS = sys
MOSTLYCLEANFILES = core *.stackdump alloca.h alloca.h-t dirent.h \
noinst_LIBRARIES = libpatch.a
libpatch_a_SOURCES = argmatch.c backupfile.c bitrotate.h bitrotate.c \
c-ctype.h c-ctype.c c-strcase.h c-strcasecmp.c c-strncasecmp.c \
- diffseq.h opendir-safer.c dirname.c basename.c dirname-lgpl.c \
- basename-lgpl.c stripslash.c exitfail.c fd-hook.c full-write.h \
+ cloexec.c diffseq.h opendir-safer.c dirname.c basename.c \
+ dirname-lgpl.c basename-lgpl.c stripslash.c exitfail.c \
+ chmodat.c chownat.c fd-hook.c filenamecat-lgpl.c full-write.h \
full-write.c gettext.h gettime.c hash.c gl_linked_list.h \
gl_linked_list.c gl_anylinked_list1.h gl_anylinked_list2.h \
gl_list.h gl_list.c localcharset.h localcharset.c malloca.c \
- minmax.h parse-datetime.y progname.h progname.c quotearg.c \
- safe-write.c size_max.h stat-time.c tempname.c timespec.c \
- unistd.c dup-safer.c fd-safer.c pipe-safer.c utimens.c \
- verror.h verror.c wctype-h.c xmalloc.c xalloc-die.c gl_xlist.h \
- gl_xlist.c xsize.h xsize.c xstrndup.h xstrndup.c xvasprintf.h \
- xvasprintf.c xasprintf.c
+ minmax.h openat-die.c parse-datetime.y progname.h progname.c \
+ quotearg.c safe-write.c save-cwd.c size_max.h stat-time.c \
+ statat.c tempname.c timespec.c unistd.c dup-safer.c fd-safer.c \
+ pipe-safer.c utimens.c verror.h verror.c wctype-h.c xmalloc.c \
+ xalloc-die.c gl_xlist.h gl_xlist.c xsize.h xsize.c xstrndup.h \
+ xstrndup.c xvasprintf.h xvasprintf.c xasprintf.c
libpatch_a_LIBADD = $(gl_LIBOBJS)
libpatch_a_DEPENDENCIES = $(gl_LIBOBJS)
-EXTRA_libpatch_a_SOURCES = canonicalize-lgpl.c close.c closedir.c \
- dirfd.c stripslash.c dup2.c error.c fcntl.c float.c itold.c \
- fstat.c getdtablesize.c getopt.c getopt1.c gettimeofday.c \
- lstat.c malloc.c malloc.c mbrtowc.c mbsinit.c memchr.c mkdir.c \
- mktime.c msvc-inval.c msvc-nothrow.c opendir.c raise.c \
- readdir.c readlink.c realloc.c realloc.c rename.c rmdir.c \
- safe-read.c secure_getenv.c setenv.c stat.c strerror.c \
- strerror-override.c strndup.c strnlen.c symlink.c time_r.c \
- unlink.c unsetenv.c asnprintf.c printf-args.c printf-parse.c \
- vasnprintf.c asprintf.c vasprintf.c write.c xmemdup0.c
+EXTRA_libpatch_a_SOURCES = openat-proc.c canonicalize-lgpl.c \
+ chdir-long.c chown.c fchown-stub.c close.c closedir.c dirfd.c \
+ stripslash.c dup2.c error.c fchdir.c at-func.c fchmodat.c \
+ at-func.c fchownat.c fcntl.c float.c itold.c fstat.c at-func.c \
+ fstatat.c getcwd-lgpl.c getdtablesize.c getopt.c getopt1.c \
+ gettimeofday.c lchown.c lstat.c malloc.c malloc.c mbrtowc.c \
+ mbsinit.c memchr.c mempcpy.c memrchr.c mkdir.c at-func.c \
+ mkdirat.c mktime.c msvc-inval.c msvc-nothrow.c open.c openat.c \
+ opendir.c raise.c readdir.c readlink.c at-func.c readlinkat.c \
+ realloc.c realloc.c rename.c at-func2.c renameat.c rmdir.c \
+ safe-read.c secure_getenv.c setenv.c stat.c strdup.c \
+ strerror.c strerror-override.c strndup.c strnlen.c symlink.c \
+ at-func.c symlinkat.c time_r.c unlink.c at-func.c unlinkat.c \
+ unsetenv.c at-func.c utimensat.c asnprintf.c printf-args.c \
+ printf-parse.c vasnprintf.c asprintf.c vasprintf.c write.c \
+ xmemdup0.c
# Use this preprocessor expression to decide whether #include_next works.
# Do not rely on a 'configure'-time test for this, since the expression
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/argmatch.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/asnprintf.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/asprintf.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/at-func.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/at-func2.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/backupfile.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/basename-lgpl.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/basename.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/c-strcasecmp.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/c-strncasecmp.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/canonicalize-lgpl.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/chdir-long.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/chmodat.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/chown.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/chownat.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cloexec.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/close.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/closedir.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dirfd.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dup2.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/error.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/exitfail.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fchdir.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fchmodat.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fchown-stub.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fchownat.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fcntl.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fd-hook.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fd-safer.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/filenamecat-lgpl.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/float.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fstat.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fstatat.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/full-write.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getcwd-lgpl.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getdtablesize.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getopt.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getopt1.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gl_xlist.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hash.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/itold.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lchown.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/localcharset.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lstat.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/malloc.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mbrtowc.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mbsinit.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/memchr.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mempcpy.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/memrchr.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mkdir.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mkdirat.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mktime.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/msvc-inval.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/msvc-nothrow.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/open.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/openat-die.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/openat-proc.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/openat.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/opendir-safer.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/opendir.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/parse-datetime.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/raise.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/readdir.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/readlink.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/readlinkat.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/realloc.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rename.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/renameat.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rmdir.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/safe-read.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/safe-write.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/save-cwd.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/secure_getenv.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/setenv.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stat-time.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stat.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/statat.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strdup.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strerror-override.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strerror.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stripslash.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strndup.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strnlen.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/symlink.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/symlinkat.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tempname.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/time_r.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/timespec.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/unistd.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/unlink.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/unlinkat.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/unsetenv.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/utimens.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/utimensat.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vasnprintf.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vasprintf.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/verror.Po@am__quote@
@GL_GENERATE_STDDEF_H_TRUE@ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
@GL_GENERATE_STDDEF_H_TRUE@ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
@GL_GENERATE_STDDEF_H_TRUE@ -e 's|@''NEXT_STDDEF_H''@|$(NEXT_STDDEF_H)|g' \
+@GL_GENERATE_STDDEF_H_TRUE@ -e 's|@''HAVE_MAX_ALIGN_T''@|$(HAVE_MAX_ALIGN_T)|g' \
@GL_GENERATE_STDDEF_H_TRUE@ -e 's|@''HAVE_WCHAR_T''@|$(HAVE_WCHAR_T)|g' \
@GL_GENERATE_STDDEF_H_TRUE@ -e 's|@''REPLACE_NULL''@|$(REPLACE_NULL)|g' \
@GL_GENERATE_STDDEF_H_TRUE@ < $(srcdir)/stddef.in.h; \
-e 's|@''PTHREAD_H_DEFINES_STRUCT_TIMESPEC''@|$(PTHREAD_H_DEFINES_STRUCT_TIMESPEC)|g' \
-e 's|@''SYS_TIME_H_DEFINES_STRUCT_TIMESPEC''@|$(SYS_TIME_H_DEFINES_STRUCT_TIMESPEC)|g' \
-e 's|@''TIME_H_DEFINES_STRUCT_TIMESPEC''@|$(TIME_H_DEFINES_STRUCT_TIMESPEC)|g' \
+ -e 's|@''UNISTD_H_DEFINES_STRUCT_TIMESPEC''@|$(UNISTD_H_DEFINES_STRUCT_TIMESPEC)|g' \
-e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \
-e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
-e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
/* Memory allocation on the stack.
- Copyright (C) 1995, 1999, 2001-2004, 2006-2014 Free Software Foundation,
+ Copyright (C) 1995, 1999, 2001-2004, 2006-2015 Free Software Foundation,
Inc.
This program is free software; you can redistribute it and/or modify it
/* argmatch.c -- find a match for a string in an array
- Copyright (C) 1990, 1998-1999, 2001-2007, 2009-2014 Free Software
+ Copyright (C) 1990, 1998-1999, 2001-2007, 2009-2015 Free Software
Foundation, Inc.
This program is free software: you can redistribute it and/or modify
/* argmatch.h -- definitions and prototypes for argmatch.c
- Copyright (C) 1990, 1998-1999, 2001-2002, 2004-2005, 2009-2014 Free Software
+ Copyright (C) 1990, 1998-1999, 2001-2002, 2004-2005, 2009-2015 Free Software
Foundation, Inc.
This program is free software: you can redistribute it and/or modify
/* Formatted output to strings.
- Copyright (C) 1999, 2002, 2006, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002, 2006, 2009-2015 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
/* Formatted output to strings.
- Copyright (C) 1999, 2002, 2006-2007, 2009-2014 Free Software Foundation,
+ Copyright (C) 1999, 2002, 2006-2007, 2009-2015 Free Software Foundation,
Inc.
This program is free software; you can redistribute it and/or modify
--- /dev/null
+/* Run-time assert-like macros.
+
+ Copyright (C) 2014-2015 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 Paul Eggert. */
+
+#ifndef _GL_ASSURE_H
+#define _GL_ASSURE_H
+
+#include <assert.h>
+
+/* Check E's value at runtime, and report an error and abort if not.
+ However, do nothng if NDEBUG is defined.
+
+ Unlike standard 'assert', this macro always compiles E even when NDEBUG
+ is defined, so as to catch typos and avoid some GCC warnings. */
+
+#ifdef NDEBUG
+# define assure(E) ((void) (0 && (E)))
+#else
+# define assure(E) assert (E)
+#endif
+
+#endif
--- /dev/null
+/* Define at-style functions like fstatat, unlinkat, fchownat, etc.
+ Copyright (C) 2006, 2009-2015 Free Software Foundation, Inc.
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+/* written by Jim Meyering */
+
+#include "dosname.h" /* solely for definition of IS_ABSOLUTE_FILE_NAME */
+
+#ifdef GNULIB_SUPPORT_ONLY_AT_FDCWD
+# include <errno.h>
+# ifndef ENOTSUP
+# define ENOTSUP EINVAL
+# endif
+#else
+# include "openat.h"
+# include "openat-priv.h"
+# include "save-cwd.h"
+#endif
+
+#ifdef AT_FUNC_USE_F1_COND
+# define CALL_FUNC(F) \
+ (flag == AT_FUNC_USE_F1_COND \
+ ? AT_FUNC_F1 (F AT_FUNC_POST_FILE_ARGS) \
+ : AT_FUNC_F2 (F AT_FUNC_POST_FILE_ARGS))
+# define VALIDATE_FLAG(F) \
+ if (flag & ~AT_FUNC_USE_F1_COND) \
+ { \
+ errno = EINVAL; \
+ return FUNC_FAIL; \
+ }
+#else
+# define CALL_FUNC(F) (AT_FUNC_F1 (F AT_FUNC_POST_FILE_ARGS))
+# define VALIDATE_FLAG(F) /* empty */
+#endif
+
+#ifdef AT_FUNC_RESULT
+# define FUNC_RESULT AT_FUNC_RESULT
+#else
+# define FUNC_RESULT int
+#endif
+
+#ifdef AT_FUNC_FAIL
+# define FUNC_FAIL AT_FUNC_FAIL
+#else
+# define FUNC_FAIL -1
+#endif
+
+/* Call AT_FUNC_F1 to operate on FILE, which is in the directory
+ open on descriptor FD. If AT_FUNC_USE_F1_COND is defined to a value,
+ AT_FUNC_POST_FILE_PARAM_DECLS must include a parameter named flag;
+ call AT_FUNC_F2 if FLAG is 0 or fail if FLAG contains more bits than
+ AT_FUNC_USE_F1_COND. Return int and fail with -1 unless AT_FUNC_RESULT
+ or AT_FUNC_FAIL are defined. If possible, do it without changing the
+ working directory. Otherwise, resort to using save_cwd/fchdir,
+ then AT_FUNC_F?/restore_cwd. If either the save_cwd or the restore_cwd
+ fails, then give a diagnostic and exit nonzero. */
+FUNC_RESULT
+AT_FUNC_NAME (int fd, char const *file AT_FUNC_POST_FILE_PARAM_DECLS)
+{
+ VALIDATE_FLAG (flag);
+
+ if (fd == AT_FDCWD || IS_ABSOLUTE_FILE_NAME (file))
+ return CALL_FUNC (file);
+
+#ifdef GNULIB_SUPPORT_ONLY_AT_FDCWD
+ errno = ENOTSUP;
+ return FUNC_FAIL;
+#else
+ {
+ /* Be careful to choose names unlikely to conflict with
+ AT_FUNC_POST_FILE_PARAM_DECLS. */
+ struct saved_cwd saved_cwd;
+ int saved_errno;
+ FUNC_RESULT err;
+
+ {
+ char proc_buf[OPENAT_BUFFER_SIZE];
+ char *proc_file = openat_proc_name (proc_buf, fd, file);
+ if (proc_file)
+ {
+ FUNC_RESULT proc_result = CALL_FUNC (proc_file);
+ int proc_errno = errno;
+ if (proc_file != proc_buf)
+ free (proc_file);
+ /* If the syscall succeeds, or if it fails with an unexpected
+ errno value, then return right away. Otherwise, fall through
+ and resort to using save_cwd/restore_cwd. */
+ if (FUNC_FAIL != proc_result)
+ return proc_result;
+ if (! EXPECTED_ERRNO (proc_errno))
+ {
+ errno = proc_errno;
+ return proc_result;
+ }
+ }
+ }
+
+ if (save_cwd (&saved_cwd) != 0)
+ openat_save_fail (errno);
+ if (0 <= fd && fd == saved_cwd.desc)
+ {
+ /* If saving the working directory collides with the user's
+ requested fd, then the user's fd must have been closed to
+ begin with. */
+ free_cwd (&saved_cwd);
+ errno = EBADF;
+ return FUNC_FAIL;
+ }
+
+ if (fchdir (fd) != 0)
+ {
+ saved_errno = errno;
+ free_cwd (&saved_cwd);
+ errno = saved_errno;
+ return FUNC_FAIL;
+ }
+
+ err = CALL_FUNC (file);
+ saved_errno = (err == FUNC_FAIL ? errno : 0);
+
+ if (restore_cwd (&saved_cwd) != 0)
+ openat_restore_fail (errno);
+
+ free_cwd (&saved_cwd);
+
+ if (saved_errno)
+ errno = saved_errno;
+ return err;
+ }
+#endif
+}
+#undef CALL_FUNC
+#undef FUNC_RESULT
+#undef FUNC_FAIL
--- /dev/null
+/* Define 2-FD at-style functions like linkat or renameat.
+ Copyright (C) 2006, 2009-2015 Free Software Foundation, Inc.
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+/* written by Jim Meyering and Eric Blake */
+
+#include <config.h>
+
+#include "openat-priv.h"
+
+#include <errno.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include "dosname.h" /* solely for definition of IS_ABSOLUTE_FILE_NAME */
+#include "filenamecat.h"
+#include "openat.h"
+#include "same-inode.h"
+#include "save-cwd.h"
+
+/* Call FUNC to operate on a pair of files, where FILE1 is relative to FD1,
+ and FILE2 is relative to FD2. If possible, do it without changing the
+ working directory. Otherwise, resort to using save_cwd/fchdir,
+ FUNC, restore_cwd (up to two times). If either the save_cwd or the
+ restore_cwd fails, then give a diagnostic and exit nonzero. */
+int
+at_func2 (int fd1, char const *file1,
+ int fd2, char const *file2,
+ int (*func) (char const *file1, char const *file2))
+{
+ struct saved_cwd saved_cwd;
+ int saved_errno;
+ int err;
+ char *file1_alt;
+ char *file2_alt;
+ struct stat st1;
+ struct stat st2;
+
+ /* There are 16 possible scenarios, based on whether an fd is
+ AT_FDCWD or real, and whether a file is absolute or relative:
+
+ fd1 file1 fd2 file2 action
+ 0 cwd abs cwd abs direct call
+ 1 cwd abs cwd rel direct call
+ 2 cwd abs fd abs direct call
+ 3 cwd abs fd rel chdir to fd2
+ 4 cwd rel cwd abs direct call
+ 5 cwd rel cwd rel direct call
+ 6 cwd rel fd abs direct call
+ 7 cwd rel fd rel convert file1 to abs, then case 3
+ 8 fd abs cwd abs direct call
+ 9 fd abs cwd rel direct call
+ 10 fd abs fd abs direct call
+ 11 fd abs fd rel chdir to fd2
+ 12 fd rel cwd abs chdir to fd1
+ 13 fd rel cwd rel convert file2 to abs, then case 12
+ 14 fd rel fd abs chdir to fd1
+ 15a fd1 rel fd1 rel chdir to fd1
+ 15b fd1 rel fd2 rel chdir to fd1, then case 7
+
+ Try some optimizations to reduce fd to AT_FDCWD, or to at least
+ avoid converting an absolute name or doing a double chdir. */
+
+ if ((fd1 == AT_FDCWD || IS_ABSOLUTE_FILE_NAME (file1))
+ && (fd2 == AT_FDCWD || IS_ABSOLUTE_FILE_NAME (file2)))
+ return func (file1, file2); /* Case 0-2, 4-6, 8-10. */
+
+ /* If /proc/self/fd works, we don't need any stat or chdir. */
+ {
+ char proc_buf1[OPENAT_BUFFER_SIZE];
+ char *proc_file1 = ((fd1 == AT_FDCWD || IS_ABSOLUTE_FILE_NAME (file1))
+ ? (char *) file1
+ : openat_proc_name (proc_buf1, fd1, file1));
+ if (proc_file1)
+ {
+ char proc_buf2[OPENAT_BUFFER_SIZE];
+ char *proc_file2 = ((fd2 == AT_FDCWD || IS_ABSOLUTE_FILE_NAME (file2))
+ ? (char *) file2
+ : openat_proc_name (proc_buf2, fd2, file2));
+ if (proc_file2)
+ {
+ int proc_result = func (proc_file1, proc_file2);
+ int proc_errno = errno;
+ if (proc_file1 != proc_buf1 && proc_file1 != file1)
+ free (proc_file1);
+ if (proc_file2 != proc_buf2 && proc_file2 != file2)
+ free (proc_file2);
+ /* If the syscall succeeds, or if it fails with an unexpected
+ errno value, then return right away. Otherwise, fall through
+ and resort to using save_cwd/restore_cwd. */
+ if (0 <= proc_result)
+ return proc_result;
+ if (! EXPECTED_ERRNO (proc_errno))
+ {
+ errno = proc_errno;
+ return proc_result;
+ }
+ }
+ else if (proc_file1 != proc_buf1 && proc_file1 != file1)
+ free (proc_file1);
+ }
+ }
+
+ /* Cases 3, 7, 11-15 remain. Time to normalize directory fds, if
+ possible. */
+ if (IS_ABSOLUTE_FILE_NAME (file1))
+ fd1 = AT_FDCWD; /* Case 11 reduced to 3. */
+ else if (IS_ABSOLUTE_FILE_NAME (file2))
+ fd2 = AT_FDCWD; /* Case 14 reduced to 12. */
+
+ /* Cases 3, 7, 12, 13, 15 remain. */
+
+ if (fd1 == AT_FDCWD) /* Cases 3, 7. */
+ {
+ if (stat (".", &st1) == -1 || fstat (fd2, &st2) == -1)
+ return -1;
+ if (!S_ISDIR (st2.st_mode))
+ {
+ errno = ENOTDIR;
+ return -1;
+ }
+ if (SAME_INODE (st1, st2)) /* Reduced to cases 1, 5. */
+ return func (file1, file2);
+ }
+ else if (fd2 == AT_FDCWD) /* Cases 12, 13. */
+ {
+ if (stat (".", &st2) == -1 || fstat (fd1, &st1) == -1)
+ return -1;
+ if (!S_ISDIR (st1.st_mode))
+ {
+ errno = ENOTDIR;
+ return -1;
+ }
+ if (SAME_INODE (st1, st2)) /* Reduced to cases 4, 5. */
+ return func (file1, file2);
+ }
+ else if (fd1 != fd2) /* Case 15b. */
+ {
+ if (fstat (fd1, &st1) == -1 || fstat (fd2, &st2) == -1)
+ return -1;
+ if (!S_ISDIR (st1.st_mode) || !S_ISDIR (st2.st_mode))
+ {
+ errno = ENOTDIR;
+ return -1;
+ }
+ if (SAME_INODE (st1, st2)) /* Reduced to case 15a. */
+ {
+ fd2 = fd1;
+ if (stat (".", &st1) == 0 && SAME_INODE (st1, st2))
+ return func (file1, file2); /* Further reduced to case 5. */
+ }
+ }
+ else /* Case 15a. */
+ {
+ if (fstat (fd1, &st1) == -1)
+ return -1;
+ if (!S_ISDIR (st1.st_mode))
+ {
+ errno = ENOTDIR;
+ return -1;
+ }
+ if (stat (".", &st2) == 0 && SAME_INODE (st1, st2))
+ return func (file1, file2); /* Reduced to case 5. */
+ }
+
+ /* Cases 3, 7, 12, 13, 15a, 15b remain. With all reductions in
+ place, it is time to start changing directories. */
+
+ if (save_cwd (&saved_cwd) != 0)
+ openat_save_fail (errno);
+
+ if (fd1 != AT_FDCWD && fd2 != AT_FDCWD && fd1 != fd2) /* Case 15b. */
+ {
+ if (fchdir (fd1) != 0)
+ {
+ saved_errno = errno;
+ free_cwd (&saved_cwd);
+ errno = saved_errno;
+ return -1;
+ }
+ fd1 = AT_FDCWD; /* Reduced to case 7. */
+ }
+
+ /* Cases 3, 7, 12, 13, 15a remain. Convert one relative name to
+ absolute, if necessary. */
+
+ file1_alt = (char *) file1;
+ file2_alt = (char *) file2;
+
+ if (fd1 == AT_FDCWD && !IS_ABSOLUTE_FILE_NAME (file1)) /* Case 7. */
+ {
+ /* It would be nicer to use:
+ file1_alt = file_name_concat (xgetcwd (), file1, NULL);
+ but libraries should not call xalloc_die. */
+ char *cwd = getcwd (NULL, 0);
+ if (!cwd)
+ {
+ saved_errno = errno;
+ free_cwd (&saved_cwd);
+ errno = saved_errno;
+ return -1;
+ }
+ file1_alt = mfile_name_concat (cwd, file1, NULL);
+ if (!file1_alt)
+ {
+ saved_errno = errno;
+ free (cwd);
+ free_cwd (&saved_cwd);
+ errno = saved_errno;
+ return -1;
+ }
+ free (cwd); /* Reduced to case 3. */
+ }
+ else if (fd2 == AT_FDCWD && !IS_ABSOLUTE_FILE_NAME (file2)) /* Case 13. */
+ {
+ char *cwd = getcwd (NULL, 0);
+ if (!cwd)
+ {
+ saved_errno = errno;
+ free_cwd (&saved_cwd);
+ errno = saved_errno;
+ return -1;
+ }
+ file2_alt = mfile_name_concat (cwd, file2, NULL);
+ if (!file2_alt)
+ {
+ saved_errno = errno;
+ free (cwd);
+ free_cwd (&saved_cwd);
+ errno = saved_errno;
+ return -1;
+ }
+ free (cwd); /* Reduced to case 12. */
+ }
+
+ /* Cases 3, 12, 15a remain. Change to the correct directory. */
+ if (fchdir (fd1 == AT_FDCWD ? fd2 : fd1) != 0)
+ {
+ saved_errno = errno;
+ free_cwd (&saved_cwd);
+ if (file1 != file1_alt)
+ free (file1_alt);
+ else if (file2 != file2_alt)
+ free (file2_alt);
+ errno = saved_errno;
+ return -1;
+ }
+
+ /* Finally safe to perform the user's function, then clean up. */
+
+ err = func (file1_alt, file2_alt);
+ saved_errno = (err < 0 ? errno : 0);
+
+ if (file1 != file1_alt)
+ free (file1_alt);
+ else if (file2 != file2_alt)
+ free (file2_alt);
+
+ if (restore_cwd (&saved_cwd) != 0)
+ openat_restore_fail (errno);
+
+ free_cwd (&saved_cwd);
+
+ if (saved_errno)
+ errno = saved_errno;
+ return err;
+}
+#undef CALL_FUNC
+#undef FUNC_RESULT
/* backupfile.c -- make Emacs style backup file names
- Copyright (C) 1990-2006, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 1990-2006, 2009-2015 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
/* backupfile.h -- declarations for making Emacs style backup file names
- Copyright (C) 1990-1992, 1997-1999, 2003-2004, 2009-2014 Free Software
+ Copyright (C) 1990-1992, 1997-1999, 2003-2004, 2009-2015 Free Software
Foundation, Inc.
This program is free software: you can redistribute it and/or modify
/* basename.c -- return the last element in a file name
- Copyright (C) 1990, 1998-2001, 2003-2006, 2009-2014 Free Software
+ Copyright (C) 1990, 1998-2001, 2003-2006, 2009-2015 Free Software
Foundation, Inc.
This program is free software: you can redistribute it and/or modify
/* basename.c -- return the last element in a file name
- Copyright (C) 1990, 1998-2001, 2003-2006, 2009-2014 Free Software
+ Copyright (C) 1990, 1998-2001, 2003-2006, 2009-2015 Free Software
Foundation, Inc.
This program is free software: you can redistribute it and/or modify
/* bitrotate.h - Rotate bits in integers
- Copyright (C) 2008-2014 Free Software Foundation, Inc.
+ Copyright (C) 2008-2015 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
/* Character handling in C locale.
- Copyright 2000-2003, 2006, 2009-2014 Free Software Foundation, Inc.
+ Copyright 2000-2003, 2006, 2009-2015 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
<ctype.h> functions' behaviour depends on the current locale set via
setlocale.
- Copyright (C) 2000-2003, 2006, 2008-2014 Free Software Foundation, Inc.
+ Copyright (C) 2000-2003, 2006, 2008-2015 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
/* Case-insensitive string comparison functions in C locale.
- Copyright (C) 1995-1996, 2001, 2003, 2005, 2009-2014 Free Software
+ Copyright (C) 1995-1996, 2001, 2003, 2005, 2009-2015 Free Software
Foundation, Inc.
This program is free software; you can redistribute it and/or modify
/* c-strcasecmp.c -- case insensitive string comparator in C locale
- Copyright (C) 1998-1999, 2005-2006, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 1998-1999, 2005-2006, 2009-2015 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
/* Optimized case-insensitive string comparison in C locale.
- Copyright (C) 2001-2002, 2007, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2001-2002, 2007, 2009-2015 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
/* c-strncasecmp.c -- case insensitive string comparator in C locale
- Copyright (C) 1998-1999, 2005-2006, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 1998-1999, 2005-2006, 2009-2015 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
/* Return the canonical absolute name of a given file.
- Copyright (C) 1996-2014 Free Software Foundation, Inc.
+ Copyright (C) 1996-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
This program is free software: you can redistribute it and/or modify
--- /dev/null
+/* provide a chdir function that tries not to fail due to ENAMETOOLONG
+ Copyright (C) 2004-2015 Free Software Foundation, Inc.
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+/* written by Jim Meyering */
+
+#include <config.h>
+
+#include "chdir-long.h"
+
+#include <errno.h>
+#include <fcntl.h>
+#include <stdlib.h>
+#include <stdbool.h>
+#include <string.h>
+#include <stdio.h>
+
+#include "assure.h"
+
+#ifndef PATH_MAX
+# error "compile this file only if your system defines PATH_MAX"
+#endif
+
+/* The results of openat() in this file are not leaked to any
+ single-threaded code that could use stdio.
+ FIXME - if the kernel ever adds support for multi-thread safety for
+ avoiding standard fds, then we should use openat_safer. */
+
+struct cd_buf
+{
+ int fd;
+};
+
+static void
+cdb_init (struct cd_buf *cdb)
+{
+ cdb->fd = AT_FDCWD;
+}
+
+static int
+cdb_fchdir (struct cd_buf const *cdb)
+{
+ return fchdir (cdb->fd);
+}
+
+static void
+cdb_free (struct cd_buf const *cdb)
+{
+ if (0 <= cdb->fd)
+ {
+ bool close_fail = close (cdb->fd);
+ assure (! close_fail);
+ }
+}
+
+/* Given a file descriptor of an open directory (or AT_FDCWD), CDB->fd,
+ try to open the CDB->fd-relative directory, DIR. If the open succeeds,
+ update CDB->fd with the resulting descriptor, close the incoming file
+ descriptor, and return zero. Upon failure, return -1 and set errno. */
+static int
+cdb_advance_fd (struct cd_buf *cdb, char const *dir)
+{
+ int new_fd = openat (cdb->fd, dir,
+ O_SEARCH | O_DIRECTORY | O_NOCTTY | O_NONBLOCK);
+ if (new_fd < 0)
+ return -1;
+
+ cdb_free (cdb);
+ cdb->fd = new_fd;
+
+ return 0;
+}
+
+/* Return a pointer to the first non-slash in S. */
+static char * _GL_ATTRIBUTE_PURE
+find_non_slash (char const *s)
+{
+ size_t n_slash = strspn (s, "/");
+ return (char *) s + n_slash;
+}
+
+/* This is a function much like chdir, but without the PATH_MAX limitation
+ on the length of the directory name. A significant difference is that
+ it must be able to modify (albeit only temporarily) the directory
+ name. It handles an arbitrarily long directory name by operating
+ on manageable portions of the name. On systems without the openat
+ syscall, this means changing the working directory to more and more
+ "distant" points along the long directory name and then restoring
+ the working directory. If any of those attempts to save or restore
+ the working directory fails, this function exits nonzero.
+
+ Note that this function may still fail with errno == ENAMETOOLONG, but
+ only if the specified directory name contains a component that is long
+ enough to provoke such a failure all by itself (e.g. if the component
+ has length PATH_MAX or greater on systems that define PATH_MAX). */
+
+int
+chdir_long (char *dir)
+{
+ int e = chdir (dir);
+ if (e == 0 || errno != ENAMETOOLONG)
+ return e;
+
+ {
+ size_t len = strlen (dir);
+ char *dir_end = dir + len;
+ struct cd_buf cdb;
+ size_t n_leading_slash;
+
+ cdb_init (&cdb);
+
+ /* If DIR is the empty string, then the chdir above
+ must have failed and set errno to ENOENT. */
+ assure (0 < len);
+ assure (PATH_MAX <= len);
+
+ /* Count leading slashes. */
+ n_leading_slash = strspn (dir, "/");
+
+ /* Handle any leading slashes as well as any name that matches
+ the regular expression, m!^//hostname[/]*! . Handling this
+ prefix separately usually results in a single additional
+ cdb_advance_fd call, but it's worthwhile, since it makes the
+ code in the following loop cleaner. */
+ if (n_leading_slash == 2)
+ {
+ int err;
+ /* Find next slash.
+ We already know that dir[2] is neither a slash nor '\0'. */
+ char *slash = memchr (dir + 3, '/', dir_end - (dir + 3));
+ if (slash == NULL)
+ {
+ errno = ENAMETOOLONG;
+ return -1;
+ }
+ *slash = '\0';
+ err = cdb_advance_fd (&cdb, dir);
+ *slash = '/';
+ if (err != 0)
+ goto Fail;
+ dir = find_non_slash (slash + 1);
+ }
+ else if (n_leading_slash)
+ {
+ if (cdb_advance_fd (&cdb, "/") != 0)
+ goto Fail;
+ dir += n_leading_slash;
+ }
+
+ assure (*dir != '/');
+ assure (dir <= dir_end);
+
+ while (PATH_MAX <= dir_end - dir)
+ {
+ int err;
+ /* Find a slash that is PATH_MAX or fewer bytes away from dir.
+ I.e. see if there is a slash that will give us a name of
+ length PATH_MAX-1 or less. */
+ char *slash = memrchr (dir, '/', PATH_MAX);
+ if (slash == NULL)
+ {
+ errno = ENAMETOOLONG;
+ return -1;
+ }
+
+ *slash = '\0';
+ assure (slash - dir < PATH_MAX);
+ err = cdb_advance_fd (&cdb, dir);
+ *slash = '/';
+ if (err != 0)
+ goto Fail;
+
+ dir = find_non_slash (slash + 1);
+ }
+
+ if (dir < dir_end)
+ {
+ if (cdb_advance_fd (&cdb, dir) != 0)
+ goto Fail;
+ }
+
+ if (cdb_fchdir (&cdb) != 0)
+ goto Fail;
+
+ cdb_free (&cdb);
+ return 0;
+
+ Fail:
+ {
+ int saved_errno = errno;
+ cdb_free (&cdb);
+ errno = saved_errno;
+ return -1;
+ }
+ }
+}
+
+#if TEST_CHDIR
+
+# include "closeout.h"
+# include "error.h"
+
+char *program_name;
+
+int
+main (int argc, char *argv[])
+{
+ char *line = NULL;
+ size_t n = 0;
+ int len;
+
+ program_name = argv[0];
+ atexit (close_stdout);
+
+ len = getline (&line, &n, stdin);
+ if (len < 0)
+ {
+ int saved_errno = errno;
+ if (feof (stdin))
+ exit (0);
+
+ error (EXIT_FAILURE, saved_errno,
+ "reading standard input");
+ }
+ else if (len == 0)
+ exit (0);
+
+ if (line[len-1] == '\n')
+ line[len-1] = '\0';
+
+ if (chdir_long (line) != 0)
+ error (EXIT_FAILURE, errno,
+ "chdir_long failed: %s", line);
+
+ if (argc <= 1)
+ {
+ /* Using 'pwd' here makes sense only if it is a robust implementation,
+ like the one in coreutils after the 2004-04-19 changes. */
+ char const *cmd = "pwd";
+ execlp (cmd, (char *) NULL);
+ error (EXIT_FAILURE, errno, "%s", cmd);
+ }
+
+ fclose (stdin);
+ fclose (stderr);
+
+ exit (EXIT_SUCCESS);
+}
+#endif
+
+/*
+Local Variables:
+compile-command: "gcc -DTEST_CHDIR=1 -g -O -W -Wall chdir-long.c libcoreutils.a"
+End:
+*/
--- /dev/null
+/* provide a chdir function that tries not to fail due to ENAMETOOLONG
+ Copyright (C) 2004-2005, 2009-2015 Free Software Foundation, Inc.
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+/* Written by Jim Meyering. */
+
+#include <unistd.h>
+#include <limits.h>
+
+#include "pathmax.h"
+
+/* On systems without PATH_MAX, presume that chdir accepts
+ arbitrarily long directory names. */
+#ifndef PATH_MAX
+# define chdir_long(Dir) chdir (Dir)
+#else
+int chdir_long (char *dir);
+#endif
--- /dev/null
+#include <config.h>
+#define FCHMODAT_INLINE _GL_EXTERN_INLINE
+#include "openat.h"
--- /dev/null
+/* provide consistent interface to chown for systems that don't interpret
+ an ID of -1 as meaning "don't change the corresponding ID".
+
+ Copyright (C) 1997, 2004-2007, 2009-2015 Free Software Foundation, Inc.
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+/* written by Jim Meyering */
+
+#include <config.h>
+
+/* Specification. */
+#include <unistd.h>
+
+#include <errno.h>
+#include <fcntl.h>
+#include <stdbool.h>
+#include <string.h>
+#include <sys/stat.h>
+
+#if !HAVE_CHOWN
+
+/* Simple stub that always fails with ENOSYS, for mingw. */
+int
+chown (const char *file _GL_UNUSED, uid_t uid _GL_UNUSED,
+ gid_t gid _GL_UNUSED)
+{
+ errno = ENOSYS;
+ return -1;
+}
+
+#else /* HAVE_CHOWN */
+
+/* Below we refer to the system's chown(). */
+# undef chown
+
+/* Provide a more-closely POSIX-conforming version of chown on
+ systems with one or both of the following problems:
+ - chown doesn't treat an ID of -1 as meaning
+ "don't change the corresponding ID".
+ - chown doesn't dereference symlinks. */
+
+int
+rpl_chown (const char *file, uid_t uid, gid_t gid)
+{
+ struct stat st;
+ bool stat_valid = false;
+ int result;
+
+# if CHOWN_CHANGE_TIME_BUG
+ if (gid != (gid_t) -1 || uid != (uid_t) -1)
+ {
+ if (stat (file, &st))
+ return -1;
+ stat_valid = true;
+ }
+# endif
+
+# if CHOWN_FAILS_TO_HONOR_ID_OF_NEGATIVE_ONE
+ if (gid == (gid_t) -1 || uid == (uid_t) -1)
+ {
+ /* Stat file to get id(s) that should remain unchanged. */
+ if (!stat_valid && stat (file, &st))
+ return -1;
+ if (gid == (gid_t) -1)
+ gid = st.st_gid;
+ if (uid == (uid_t) -1)
+ uid = st.st_uid;
+ }
+# endif
+
+# if CHOWN_MODIFIES_SYMLINK
+ {
+ /* Handle the case in which the system-supplied chown function
+ does *not* follow symlinks. Instead, it changes permissions
+ on the symlink itself. To work around that, we open the
+ file (but this can fail due to lack of read or write permission) and
+ use fchown on the resulting descriptor. */
+ int open_flags = O_NONBLOCK | O_NOCTTY;
+ int fd = open (file, O_RDONLY | open_flags);
+ if (0 <= fd
+ || (errno == EACCES
+ && 0 <= (fd = open (file, O_WRONLY | open_flags))))
+ {
+ int saved_errno;
+ bool fchown_socket_failure;
+
+ result = fchown (fd, uid, gid);
+ saved_errno = errno;
+
+ /* POSIX says fchown can fail with errno == EINVAL on sockets
+ and pipes, so fall back on chown in that case. */
+ fchown_socket_failure =
+ (result != 0 && saved_errno == EINVAL
+ && fstat (fd, &st) == 0
+ && (S_ISFIFO (st.st_mode) || S_ISSOCK (st.st_mode)));
+
+ close (fd);
+
+ if (! fchown_socket_failure)
+ {
+ errno = saved_errno;
+ return result;
+ }
+ }
+ else if (errno != EACCES)
+ return -1;
+ }
+# endif
+
+# if CHOWN_TRAILING_SLASH_BUG
+ if (!stat_valid)
+ {
+ size_t len = strlen (file);
+ if (len && file[len - 1] == '/' && stat (file, &st))
+ return -1;
+ }
+# endif
+
+ result = chown (file, uid, gid);
+
+# if CHOWN_CHANGE_TIME_BUG
+ if (result == 0 && stat_valid
+ && (uid == st.st_uid || uid == (uid_t) -1)
+ && (gid == st.st_gid || gid == (gid_t) -1))
+ {
+ /* No change in ownership, but at least one argument was not -1,
+ so we are required to update ctime. Since chown succeeded,
+ we assume that chmod will do likewise. Fortunately, on all
+ known systems where a 'no-op' chown skips the ctime update, a
+ 'no-op' chmod still does the trick. */
+ result = chmod (file, st.st_mode & (S_IRWXU | S_IRWXG | S_IRWXO
+ | S_ISUID | S_ISGID | S_ISVTX));
+ }
+# endif
+
+ return result;
+}
+
+#endif /* HAVE_CHOWN */
--- /dev/null
+#include <config.h>
+#define FCHOWNAT_INLINE _GL_EXTERN_INLINE
+#include "openat.h"
--- /dev/null
+/* closexec.c - set or clear the close-on-exec descriptor flag
+
+ Copyright (C) 1991, 2004-2006, 2009-2015 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/>.
+
+ The code is taken from glibc/manual/llio.texi */
+
+#include <config.h>
+
+#include "cloexec.h"
+
+#include <errno.h>
+#include <fcntl.h>
+#include <unistd.h>
+
+/* Set the 'FD_CLOEXEC' flag of DESC if VALUE is true,
+ or clear the flag if VALUE is false.
+ Return 0 on success, or -1 on error with 'errno' set.
+
+ Note that on MingW, this function does NOT protect DESC from being
+ inherited into spawned children. Instead, either use dup_cloexec
+ followed by closing the original DESC, or use interfaces such as
+ open or pipe2 that accept flags like O_CLOEXEC to create DESC
+ non-inheritable in the first place. */
+
+int
+set_cloexec_flag (int desc, bool value)
+{
+#ifdef F_SETFD
+
+ int flags = fcntl (desc, F_GETFD, 0);
+
+ if (0 <= flags)
+ {
+ int newflags = (value ? flags | FD_CLOEXEC : flags & ~FD_CLOEXEC);
+
+ if (flags == newflags
+ || fcntl (desc, F_SETFD, newflags) != -1)
+ return 0;
+ }
+
+ return -1;
+
+#else /* !F_SETFD */
+
+ /* Use dup2 to reject invalid file descriptors; the cloexec flag
+ will be unaffected. */
+ if (desc < 0)
+ {
+ errno = EBADF;
+ return -1;
+ }
+ if (dup2 (desc, desc) < 0)
+ /* errno is EBADF here. */
+ return -1;
+
+ /* There is nothing we can do on this kind of platform. Punt. */
+ return 0;
+#endif /* !F_SETFD */
+}
+
+
+/* Duplicates a file handle FD, while marking the copy to be closed
+ prior to exec or spawn. Returns -1 and sets errno if FD could not
+ be duplicated. */
+
+int
+dup_cloexec (int fd)
+{
+ return fcntl (fd, F_DUPFD_CLOEXEC, 0);
+}
--- /dev/null
+/* closexec.c - set or clear the close-on-exec descriptor flag
+
+ Copyright (C) 2004, 2009-2015 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>
+
+/* Set the 'FD_CLOEXEC' flag of DESC if VALUE is true,
+ or clear the flag if VALUE is false.
+ Return 0 on success, or -1 on error with 'errno' set.
+
+ Note that on MingW, this function does NOT protect DESC from being
+ inherited into spawned children. Instead, either use dup_cloexec
+ followed by closing the original DESC, or use interfaces such as
+ open or pipe2 that accept flags like O_CLOEXEC to create DESC
+ non-inheritable in the first place. */
+
+int set_cloexec_flag (int desc, bool value);
+
+/* Duplicates a file handle FD, while marking the copy to be closed
+ prior to exec or spawn. Returns -1 and sets errno if FD could not
+ be duplicated. */
+
+int dup_cloexec (int fd);
/* close replacement.
- Copyright (C) 2008-2014 Free Software Foundation, Inc.
+ Copyright (C) 2008-2015 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
/* Stop reading the entries of a directory.
- Copyright (C) 2006-2014 Free Software Foundation, Inc.
+ Copyright (C) 2006-2015 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
#! /bin/sh
# Output a system dependent table of character encoding aliases.
#
-# Copyright (C) 2000-2004, 2006-2014 Free Software Foundation, Inc.
+# Copyright (C) 2000-2004, 2006-2015 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
#echo "sun_eu_greek ?" # what is this?
echo "UTF-8 UTF-8"
;;
- freebsd* | os2*)
+ freebsd*)
# FreeBSD 4.2 doesn't have nl_langinfo(CODESET); therefore
# localcharset.c falls back to using the full locale name
# from the environment variables.
- # Likewise for OS/2. OS/2 has XFree86 just like FreeBSD. Just
- # reuse FreeBSD's locale data for OS/2.
echo "C ASCII"
echo "US-ASCII ASCII"
for l in la_LN lt_LN; do
/* Analyze differences between two vectors.
- Copyright (C) 1988-1989, 1992-1995, 2001-2004, 2006-2014 Free Software
+ Copyright (C) 1988-1989, 1992-1995, 2001-2004, 2006-2015 Free Software
Foundation, Inc.
This program is free software: you can redistribute it and/or modify
/* Like dirent.h, but redefine some names to avoid glitches.
- Copyright (C) 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2009-2015 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
/* Private details of the DIR type.
- Copyright (C) 2011-2014 Free Software Foundation, Inc.
+ Copyright (C) 2011-2015 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
/* Invoke dirent-like functions, but avoid some glitches.
- Copyright (C) 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2009-2015 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
/* A GNU-like <dirent.h>.
- Copyright (C) 2006-2014 Free Software Foundation, Inc.
+ Copyright (C) 2006-2015 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
/* dirfd.c -- return the file descriptor associated with an open DIR*
- Copyright (C) 2001, 2006, 2008-2014 Free Software Foundation, Inc.
+ Copyright (C) 2001, 2006, 2008-2015 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
/* dirname.c -- return all but the last element in a file name
- Copyright (C) 1990, 1998, 2000-2001, 2003-2006, 2009-2014 Free Software
+ Copyright (C) 1990, 1998, 2000-2001, 2003-2006, 2009-2015 Free Software
Foundation, Inc.
This program is free software: you can redistribute it and/or modify
/* dirname.c -- return all but the last element in a file name
- Copyright (C) 1990, 1998, 2000-2001, 2003-2006, 2009-2014 Free Software
+ Copyright (C) 1990, 1998, 2000-2001, 2003-2006, 2009-2015 Free Software
Foundation, Inc.
This program is free software: you can redistribute it and/or modify
/* Take file names apart into directory and base names.
- Copyright (C) 1998, 2001, 2003-2006, 2009-2014 Free Software Foundation,
+ Copyright (C) 1998, 2001, 2003-2006, 2009-2015 Free Software Foundation,
Inc.
This program is free software: you can redistribute it and/or modify
/* File names on MS-DOS/Windows systems.
- Copyright (C) 2000-2001, 2004-2006, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2000-2001, 2004-2006, 2009-2015 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
/* Invoke dup, but avoid some glitches.
- Copyright (C) 2001, 2004-2006, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2001, 2004-2006, 2009-2015 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
/* Duplicate an open file descriptor to a specified file descriptor.
- Copyright (C) 1999, 2004-2007, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2004-2007, 2009-2015 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
/* A POSIX-like <errno.h>.
- Copyright (C) 2008-2014 Free Software Foundation, Inc.
+ Copyright (C) 2008-2015 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
/* Error handler for noninteractive utilities
- Copyright (C) 1990-1998, 2000-2007, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 1990-1998, 2000-2007, 2009-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
This program is free software: you can redistribute it and/or modify
/* Declaration for error-reporting function
- Copyright (C) 1995-1997, 2003, 2006, 2008-2014 Free Software Foundation,
+ Copyright (C) 1995-1997, 2003, 2006, 2008-2015 Free Software Foundation,
Inc.
This file is part of the GNU C Library.
/* Failure exit status
- Copyright (C) 2002-2003, 2005-2007, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2002-2003, 2005-2007, 2009-2015 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
/* Failure exit status
- Copyright (C) 2002, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2009-2015 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
--- /dev/null
+/* fchdir replacement.
+ Copyright (C) 2006-2015 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>
+
+/* Specification. */
+#include <unistd.h>
+
+#include <dirent.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <stdbool.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+
+#include "assure.h"
+#include "dosname.h"
+#include "filenamecat.h"
+
+#ifndef REPLACE_OPEN_DIRECTORY
+# define REPLACE_OPEN_DIRECTORY 0
+#endif
+
+/* This replacement assumes that a directory is not renamed while opened
+ through a file descriptor.
+
+ FIXME: On mingw, this would be possible to enforce if we were to
+ also open a HANDLE to each directory currently visited by a file
+ descriptor, since mingw refuses to rename any in-use file system
+ object. */
+
+/* Array of file descriptors opened. If REPLACE_OPEN_DIRECTORY or if it points
+ to a directory, it stores info about this directory. */
+typedef struct
+{
+ char *name; /* Absolute name of the directory, or NULL. */
+ /* FIXME - add a DIR* member to make dirfd possible on mingw? */
+} dir_info_t;
+static dir_info_t *dirs;
+static size_t dirs_allocated;
+
+/* Try to ensure dirs has enough room for a slot at index fd; free any
+ contents already in that slot. Return false and set errno to
+ ENOMEM on allocation failure. */
+static bool
+ensure_dirs_slot (size_t fd)
+{
+ if (fd < dirs_allocated)
+ free (dirs[fd].name);
+ else
+ {
+ size_t new_allocated;
+ dir_info_t *new_dirs;
+
+ new_allocated = 2 * dirs_allocated + 1;
+ if (new_allocated <= fd)
+ new_allocated = fd + 1;
+ new_dirs =
+ (dirs != NULL
+ ? (dir_info_t *) realloc (dirs, new_allocated * sizeof *dirs)
+ : (dir_info_t *) malloc (new_allocated * sizeof *dirs));
+ if (new_dirs == NULL)
+ return false;
+ memset (new_dirs + dirs_allocated, 0,
+ (new_allocated - dirs_allocated) * sizeof *dirs);
+ dirs = new_dirs;
+ dirs_allocated = new_allocated;
+ }
+ return true;
+}
+
+/* Return an absolute name of DIR in malloc'd storage. */
+static char *
+get_name (char const *dir)
+{
+ char *cwd;
+ char *result;
+ int saved_errno;
+
+ if (IS_ABSOLUTE_FILE_NAME (dir))
+ return strdup (dir);
+
+ /* We often encounter "."; treat it as a special case. */
+ cwd = getcwd (NULL, 0);
+ if (!cwd || (dir[0] == '.' && dir[1] == '\0'))
+ return cwd;
+
+ result = mfile_name_concat (cwd, dir, NULL);
+ saved_errno = errno;
+ free (cwd);
+ errno = saved_errno;
+ return result;
+}
+
+/* Hook into the gnulib replacements for open() and close() to keep track
+ of the open file descriptors. */
+
+/* Close FD, cleaning up any fd to name mapping if fd was visiting a
+ directory. */
+void
+_gl_unregister_fd (int fd)
+{
+ if (fd >= 0 && fd < dirs_allocated)
+ {
+ free (dirs[fd].name);
+ dirs[fd].name = NULL;
+ }
+}
+
+/* Mark FD as visiting FILENAME. FD must be non-negative, and refer
+ to an open file descriptor. If REPLACE_OPEN_DIRECTORY is non-zero,
+ this should only be called if FD is visiting a directory. Close FD
+ and return -1 if there is insufficient memory to track the
+ directory name; otherwise return FD. */
+int
+_gl_register_fd (int fd, const char *filename)
+{
+ struct stat statbuf;
+
+ assure (0 <= fd);
+ if (REPLACE_OPEN_DIRECTORY
+ || (fstat (fd, &statbuf) == 0 && S_ISDIR (statbuf.st_mode)))
+ {
+ if (!ensure_dirs_slot (fd)
+ || (dirs[fd].name = get_name (filename)) == NULL)
+ {
+ int saved_errno = errno;
+ close (fd);
+ errno = saved_errno;
+ return -1;
+ }
+ }
+ return fd;
+}
+
+/* Mark NEWFD as a duplicate of OLDFD; useful from dup, dup2, dup3,
+ and fcntl. Both arguments must be valid and distinct file
+ descriptors. Close NEWFD and return -1 if OLDFD is tracking a
+ directory, but there is insufficient memory to track the same
+ directory in NEWFD; otherwise return NEWFD. */
+int
+_gl_register_dup (int oldfd, int newfd)
+{
+ assure (0 <= oldfd && 0 <= newfd && oldfd != newfd);
+ if (oldfd < dirs_allocated && dirs[oldfd].name)
+ {
+ /* Duplicated a directory; must ensure newfd is allocated. */
+ if (!ensure_dirs_slot (newfd)
+ || (dirs[newfd].name = strdup (dirs[oldfd].name)) == NULL)
+ {
+ int saved_errno = errno;
+ close (newfd);
+ errno = saved_errno;
+ newfd = -1;
+ }
+ }
+ else if (newfd < dirs_allocated)
+ {
+ /* Duplicated a non-directory; ensure newfd is cleared. */
+ free (dirs[newfd].name);
+ dirs[newfd].name = NULL;
+ }
+ return newfd;
+}
+
+/* If FD is currently visiting a directory, then return the name of
+ that directory. Otherwise, return NULL and set errno. */
+const char *
+_gl_directory_name (int fd)
+{
+ if (0 <= fd && fd < dirs_allocated && dirs[fd].name != NULL)
+ return dirs[fd].name;
+ /* At this point, fd is either invalid, or open but not a directory.
+ If dup2 fails, errno is correctly EBADF. */
+ if (0 <= fd)
+ {
+ if (dup2 (fd, fd) == fd)
+ errno = ENOTDIR;
+ }
+ else
+ errno = EBADF;
+ return NULL;
+}
+
+
+/* Implement fchdir() in terms of chdir(). */
+
+int
+fchdir (int fd)
+{
+ const char *name = _gl_directory_name (fd);
+ return name ? chdir (name) : -1;
+}
--- /dev/null
+/* Change the protections of file relative to an open directory.
+ Copyright (C) 2006, 2009-2015 Free Software Foundation, Inc.
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+/* written by Jim Meyering */
+
+#include <config.h>
+
+#include <sys/stat.h>
+
+#include <errno.h>
+
+#ifndef HAVE_LCHMOD
+/* Use a different name, to avoid conflicting with any
+ system-supplied declaration. */
+# undef lchmod
+# define lchmod lchmod_rpl
+static int
+lchmod (char const *f _GL_UNUSED, mode_t m _GL_UNUSED)
+{
+ errno = ENOSYS;
+ return -1;
+}
+#endif
+
+/* Solaris 10 has no function like this.
+ Invoke chmod or lchmod on file, FILE, using mode MODE, in the directory
+ open on descriptor FD. If possible, do it without changing the
+ working directory. Otherwise, resort to using save_cwd/fchdir,
+ then (chmod|lchmod)/restore_cwd. If either the save_cwd or the
+ restore_cwd fails, then give a diagnostic and exit nonzero.
+ Note that an attempt to use a FLAG value of AT_SYMLINK_NOFOLLOW
+ on a system without lchmod support causes this function to fail. */
+
+#define AT_FUNC_NAME fchmodat
+#define AT_FUNC_F1 lchmod
+#define AT_FUNC_F2 chmod
+#define AT_FUNC_USE_F1_COND AT_SYMLINK_NOFOLLOW
+#define AT_FUNC_POST_FILE_PARAM_DECLS , mode_t mode, int flag
+#define AT_FUNC_POST_FILE_ARGS , mode
+#include "at-func.c"
--- /dev/null
+#include <config.h>
+
+#include <sys/types.h>
+#include <errno.h>
+
+/* A trivial substitute for 'fchown'.
+
+ DJGPP 2.03 and earlier (and perhaps later) don't have 'fchown',
+ so we pretend no-one has permission for this operation. */
+
+int
+fchown (int fd, uid_t uid, gid_t gid)
+{
+ errno = EPERM;
+ return -1;
+}
--- /dev/null
+/* This function serves as replacement for a missing fchownat function,
+ as well as a work around for the fchownat bug in glibc-2.4:
+ <http://lists.ubuntu.com/archives/ubuntu-users/2006-September/093218.html>
+ when the buggy fchownat-with-AT_SYMLINK_NOFOLLOW operates on a symlink, it
+ mistakenly affects the symlink referent, rather than the symlink itself.
+
+ Copyright (C) 2006-2007, 2009-2015 Free Software Foundation, Inc.
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+/* written by Jim Meyering */
+
+#include <config.h>
+
+#include <unistd.h>
+
+#include <errno.h>
+#include <string.h>
+
+#include "openat.h"
+
+#if !HAVE_FCHOWNAT
+
+/* Replacement for Solaris' function by the same name.
+ Invoke chown or lchown on file, FILE, using OWNER and GROUP, in the
+ directory open on descriptor FD. If FLAG is AT_SYMLINK_NOFOLLOW, then
+ use lchown, otherwise, use chown. If possible, do it without changing
+ the working directory. Otherwise, resort to using save_cwd/fchdir,
+ then (chown|lchown)/restore_cwd. If either the save_cwd or the
+ restore_cwd fails, then give a diagnostic and exit nonzero. */
+
+# define AT_FUNC_NAME fchownat
+# define AT_FUNC_F1 lchown
+# define AT_FUNC_F2 chown
+# define AT_FUNC_USE_F1_COND AT_SYMLINK_NOFOLLOW
+# define AT_FUNC_POST_FILE_PARAM_DECLS , uid_t owner, gid_t group, int flag
+# define AT_FUNC_POST_FILE_ARGS , owner, group
+# include "at-func.c"
+# undef AT_FUNC_NAME
+# undef AT_FUNC_F1
+# undef AT_FUNC_F2
+# undef AT_FUNC_USE_F1_COND
+# undef AT_FUNC_POST_FILE_PARAM_DECLS
+# undef AT_FUNC_POST_FILE_ARGS
+
+#else /* HAVE_FCHOWNAT */
+
+# undef fchownat
+
+# if FCHOWNAT_NOFOLLOW_BUG
+
+/* Failure to handle AT_SYMLINK_NOFOLLOW requires the /proc/self/fd or
+ fchdir workaround to call lchown for lchownat, but there is no need
+ to penalize chownat. */
+static int
+local_lchownat (int fd, char const *file, uid_t owner, gid_t group);
+
+# define AT_FUNC_NAME local_lchownat
+# define AT_FUNC_F1 lchown
+# define AT_FUNC_POST_FILE_PARAM_DECLS , uid_t owner, gid_t group
+# define AT_FUNC_POST_FILE_ARGS , owner, group
+# include "at-func.c"
+# undef AT_FUNC_NAME
+# undef AT_FUNC_F1
+# undef AT_FUNC_POST_FILE_PARAM_DECLS
+# undef AT_FUNC_POST_FILE_ARGS
+
+# endif
+
+/* Work around bugs with trailing slash, using the same workarounds as
+ chown and lchown. */
+
+int
+rpl_fchownat (int fd, char const *file, uid_t owner, gid_t group, int flag)
+{
+# if FCHOWNAT_NOFOLLOW_BUG
+ if (flag == AT_SYMLINK_NOFOLLOW)
+ return local_lchownat (fd, file, owner, group);
+# endif
+# if FCHOWNAT_EMPTY_FILENAME_BUG
+ if (file[0] == '\0')
+ {
+ errno = ENOENT;
+ return -1;
+ }
+# endif
+# if CHOWN_TRAILING_SLASH_BUG
+ {
+ size_t len = strlen (file);
+ struct stat st;
+ if (len && file[len - 1] == '/')
+ {
+ if (statat (fd, file, &st))
+ return -1;
+ if (flag == AT_SYMLINK_NOFOLLOW)
+ return fchownat (fd, file, owner, group, 0);
+ }
+ }
+# endif
+ return fchownat (fd, file, owner, group, flag);
+}
+
+#endif /* HAVE_FCHOWNAT */
/* Provide file descriptor control.
- Copyright (C) 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2009-2015 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
/* Like <fcntl.h>, but with non-working flags defined to 0.
- Copyright (C) 2006-2014 Free Software Foundation, Inc.
+ Copyright (C) 2006-2015 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
/* Hook for making making file descriptor functions close(), ioctl() extensible.
- Copyright (C) 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2009-2015 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2009.
This program is free software: you can redistribute it and/or modify it
/* Hook for making making file descriptor functions close(), ioctl() extensible.
- Copyright (C) 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2009-2015 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
/* Return a safer copy of a file descriptor.
- Copyright (C) 2005-2006, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2005-2006, 2009-2015 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
/* Basic filename support macros.
- Copyright (C) 2001-2004, 2007-2014 Free Software Foundation, Inc.
+ Copyright (C) 2001-2004, 2007-2015 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
--- /dev/null
+/* Concatenate two arbitrary file names.
+
+ Copyright (C) 1996-2007, 2009-2015 Free Software Foundation, Inc.
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+/* Written by Jim Meyering. */
+
+#include <config.h>
+
+/* Specification. */
+#include "filenamecat.h"
+
+#include <stdlib.h>
+#include <string.h>
+
+#include "dirname.h"
+
+#if ! HAVE_MEMPCPY && ! defined mempcpy
+# define mempcpy(D, S, N) ((void *) ((char *) memcpy (D, S, N) + (N)))
+#endif
+
+/* Return the longest suffix of F that is a relative file name.
+ If it has no such suffix, return the empty string. */
+
+static char const * _GL_ATTRIBUTE_PURE
+longest_relative_suffix (char const *f)
+{
+ for (f += FILE_SYSTEM_PREFIX_LEN (f); ISSLASH (*f); f++)
+ continue;
+ return f;
+}
+
+/* Concatenate two file name components, DIR and ABASE, in
+ newly-allocated storage and return the result.
+ The resulting file name F is such that the commands "ls F" and "(cd
+ DIR; ls BASE)" refer to the same file, where BASE is ABASE with any
+ file system prefixes and leading separators removed.
+ Arrange for a directory separator if necessary between DIR and BASE
+ in the result, removing any redundant separators.
+ In any case, if BASE_IN_RESULT is non-NULL, set
+ *BASE_IN_RESULT to point to the copy of ABASE in the returned
+ concatenation. However, if ABASE begins with more than one slash,
+ set *BASE_IN_RESULT to point to the sole corresponding slash that
+ is copied into the result buffer.
+
+ Return NULL if malloc fails. */
+
+char *
+mfile_name_concat (char const *dir, char const *abase, char **base_in_result)
+{
+ char const *dirbase = last_component (dir);
+ size_t dirbaselen = base_len (dirbase);
+ size_t dirlen = dirbase - dir + dirbaselen;
+ size_t needs_separator = (dirbaselen && ! ISSLASH (dirbase[dirbaselen - 1]));
+
+ char const *base = longest_relative_suffix (abase);
+ size_t baselen = strlen (base);
+
+ char *p_concat = malloc (dirlen + needs_separator + baselen + 1);
+ char *p;
+
+ if (p_concat == NULL)
+ return NULL;
+
+ p = mempcpy (p_concat, dir, dirlen);
+ *p = DIRECTORY_SEPARATOR;
+ p += needs_separator;
+
+ if (base_in_result)
+ *base_in_result = p - IS_ABSOLUTE_FILE_NAME (abase);
+
+ p = mempcpy (p, base, baselen);
+ *p = '\0';
+
+ return p_concat;
+}
--- /dev/null
+/* Concatenate two arbitrary file names.
+
+ Copyright (C) 1996-1997, 2003, 2005, 2007, 2009-2015 Free Software
+ Foundation, Inc.
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+/* Written by Jim Meyering. */
+
+#if GNULIB_FILENAMECAT
+char *file_name_concat (char const *dir, char const *base,
+ char **base_in_result);
+#endif
+
+char *mfile_name_concat (char const *dir, char const *base,
+ char **base_in_result);
/* Supplemental information about the floating-point formats.
- Copyright (C) 2007, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2007, 2009-2015 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2007.
This program is free software; you can redistribute it and/or modify
/* Auxiliary definitions for <float.h>.
- Copyright (C) 2011-2014 Free Software Foundation, Inc.
+ Copyright (C) 2011-2015 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2011.
This program is free software: you can redistribute it and/or modify
/* A correct <float.h>.
- Copyright (C) 2007-2014 Free Software Foundation, Inc.
+ Copyright (C) 2007-2015 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
/* fstat() replacement.
- Copyright (C) 2011-2014 Free Software Foundation, Inc.
+ Copyright (C) 2011-2015 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
--- /dev/null
+/* Work around an fstatat bug on Solaris 9.
+
+ Copyright (C) 2006, 2009-2015 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 Paul Eggert and Jim Meyering. */
+
+/* If the user's config.h happens to include <sys/stat.h>, let it include only
+ the system's <sys/stat.h> here, so that orig_fstatat doesn't recurse to
+ rpl_fstatat. */
+#define __need_system_sys_stat_h
+#include <config.h>
+
+/* Get the original definition of fstatat. It might be defined as a macro. */
+#include <sys/types.h>
+#include <sys/stat.h>
+#undef __need_system_sys_stat_h
+
+#if HAVE_FSTATAT
+static int
+orig_fstatat (int fd, char const *filename, struct stat *buf, int flags)
+{
+ return fstatat (fd, filename, buf, flags);
+}
+#endif
+
+/* Write "sys/stat.h" here, not <sys/stat.h>, otherwise OSF/1 5.1 DTK cc
+ eliminates this include because of the preliminary #include <sys/stat.h>
+ above. */
+#include "sys/stat.h"
+
+#include <errno.h>
+#include <fcntl.h>
+#include <string.h>
+
+#if HAVE_FSTATAT && HAVE_WORKING_FSTATAT_ZERO_FLAG
+
+# ifndef LSTAT_FOLLOWS_SLASHED_SYMLINK
+# define LSTAT_FOLLOWS_SLASHED_SYMLINK 0
+# endif
+
+/* fstatat should always follow symbolic links that end in /, but on
+ Solaris 9 it doesn't if AT_SYMLINK_NOFOLLOW is specified.
+ Likewise, trailing slash on a non-directory should be an error.
+ These are the same problems that lstat.c and stat.c address, so
+ solve it in a similar way.
+
+ AIX 7.1 fstatat (AT_FDCWD, ..., 0) always fails, which is a bug.
+ Work around this bug if FSTATAT_AT_FDCWD_0_BROKEN is nonzero. */
+
+int
+rpl_fstatat (int fd, char const *file, struct stat *st, int flag)
+{
+ int result = orig_fstatat (fd, file, st, flag);
+ size_t len;
+
+ if (LSTAT_FOLLOWS_SLASHED_SYMLINK || result != 0)
+ return result;
+ len = strlen (file);
+ if (flag & AT_SYMLINK_NOFOLLOW)
+ {
+ /* Fix lstat behavior. */
+ if (file[len - 1] != '/' || S_ISDIR (st->st_mode))
+ return 0;
+ if (!S_ISLNK (st->st_mode))
+ {
+ errno = ENOTDIR;
+ return -1;
+ }
+ result = orig_fstatat (fd, file, st, flag & ~AT_SYMLINK_NOFOLLOW);
+ }
+ /* Fix stat behavior. */
+ if (result == 0 && !S_ISDIR (st->st_mode) && file[len - 1] == '/')
+ {
+ errno = ENOTDIR;
+ return -1;
+ }
+ return result;
+}
+
+#else /* ! (HAVE_FSTATAT && HAVE_WORKING_FSTATAT_ZERO_FLAG) */
+
+/* On mingw, the gnulib <sys/stat.h> defines 'stat' as a function-like
+ macro; but using it in AT_FUNC_F2 causes compilation failure
+ because the preprocessor sees a use of a macro that requires two
+ arguments but is only given one. Hence, we need an inline
+ forwarder to get past the preprocessor. */
+static int
+stat_func (char const *name, struct stat *st)
+{
+ return stat (name, st);
+}
+
+/* Likewise, if there is no native 'lstat', then the gnulib
+ <sys/stat.h> defined it as stat, which also needs adjustment. */
+# if !HAVE_LSTAT
+# undef lstat
+# define lstat stat_func
+# endif
+
+/* Replacement for Solaris' function by the same name.
+ <http://www.google.com/search?q=fstatat+site:docs.sun.com>
+ First, try to simulate it via l?stat ("/proc/self/fd/FD/FILE").
+ Failing that, simulate it via save_cwd/fchdir/(stat|lstat)/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' fstatat. */
+
+# define AT_FUNC_NAME fstatat
+# define AT_FUNC_F1 lstat
+# define AT_FUNC_F2 stat_func
+# define AT_FUNC_USE_F1_COND AT_SYMLINK_NOFOLLOW
+# define AT_FUNC_POST_FILE_PARAM_DECLS , struct stat *st, int flag
+# define AT_FUNC_POST_FILE_ARGS , st
+# include "at-func.c"
+# undef AT_FUNC_NAME
+# undef AT_FUNC_F1
+# undef AT_FUNC_F2
+# undef AT_FUNC_USE_F1_COND
+# undef AT_FUNC_POST_FILE_PARAM_DECLS
+# undef AT_FUNC_POST_FILE_ARGS
+
+#endif /* !HAVE_FSTATAT */
/* An interface to read and write that retries (if necessary) until complete.
- Copyright (C) 1993-1994, 1997-2006, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 1993-1994, 1997-2006, 2009-2015 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
/* An interface to write() that writes all it is asked to write.
- Copyright (C) 2002-2003, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2002-2003, 2009-2015 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
--- /dev/null
+/* Copyright (C) 2011-2015 Free Software Foundation, Inc.
+ This file is part of gnulib.
+
+ 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 <unistd.h>
+
+#include <errno.h>
+#include <stdlib.h>
+#include <string.h>
+
+#if GNULIB_GETCWD
+/* Favor GPL getcwd.c if both getcwd and getcwd-lgpl modules are in use. */
+typedef int dummy;
+#else
+
+/* Get the name of the current working directory, and put it in SIZE
+ bytes of BUF. Returns NULL if the directory couldn't be determined
+ (perhaps because the absolute name was longer than PATH_MAX, or
+ because of missing read/search permissions on parent directories)
+ or SIZE was too small. If successful, returns BUF. If BUF is
+ NULL, an array is allocated with 'malloc'; the array is SIZE bytes
+ long, unless SIZE == 0, in which case it is as big as
+ necessary. */
+
+# undef getcwd
+char *
+rpl_getcwd (char *buf, size_t size)
+{
+ char *ptr;
+ char *result;
+
+ /* Handle single size operations. */
+ if (buf)
+ {
+ if (!size)
+ {
+ errno = EINVAL;
+ return NULL;
+ }
+ return getcwd (buf, size);
+ }
+
+ if (size)
+ {
+ buf = malloc (size);
+ if (!buf)
+ {
+ errno = ENOMEM;
+ return NULL;
+ }
+ result = getcwd (buf, size);
+ if (!result)
+ {
+ int saved_errno = errno;
+ free (buf);
+ errno = saved_errno;
+ }
+ return result;
+ }
+
+ /* Flexible sizing requested. Avoid over-allocation for the common
+ case of a name that fits within a 4k page, minus some space for
+ local variables, to be sure we don't skip over a guard page. */
+ {
+ char tmp[4032];
+ size = sizeof tmp;
+ ptr = getcwd (tmp, size);
+ if (ptr)
+ {
+ result = strdup (ptr);
+ if (!result)
+ errno = ENOMEM;
+ return result;
+ }
+ if (errno != ERANGE)
+ return NULL;
+ }
+
+ /* My what a large directory name we have. */
+ do
+ {
+ size <<= 1;
+ ptr = realloc (buf, size);
+ if (ptr == NULL)
+ {
+ free (buf);
+ errno = ENOMEM;
+ return NULL;
+ }
+ buf = ptr;
+ result = getcwd (buf, size);
+ }
+ while (!result && errno == ERANGE);
+
+ if (!result)
+ {
+ int saved_errno = errno;
+ free (buf);
+ errno = saved_errno;
+ }
+ else
+ {
+ /* Trim to fit, if possible. */
+ result = realloc (buf, strlen (buf) + 1);
+ if (!result)
+ result = buf;
+ }
+ return result;
+}
+
+#endif
/* getdtablesize() function for platforms that don't have it.
- Copyright (C) 2008-2014 Free Software Foundation, Inc.
+ Copyright (C) 2008-2015 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2008.
This program is free software: you can redistribute it and/or modify
NOTE: getopt is part of the C library, so if you don't know what
"Keep this file name-space clean" means, talk to drepper@gnu.org
before changing it!
- Copyright (C) 1987-1996, 1998-2004, 2006, 2008-2014 Free Software
+ Copyright (C) 1987-1996, 1998-2004, 2006, 2008-2015 Free Software
Foundation, Inc.
This file is part of the GNU C Library.
/* Declarations for getopt.
- Copyright (C) 1989-1994, 1996-1999, 2001, 2003-2007, 2009-2014 Free Software
+ Copyright (C) 1989-1994, 1996-1999, 2001, 2003-2007, 2009-2015 Free Software
Foundation, Inc.
This file is part of the GNU C Library.
/* getopt_long and getopt_long_only entry points for GNU getopt.
- Copyright (C) 1987-1994, 1996-1998, 2004, 2006, 2009-2014 Free Software
+ Copyright (C) 1987-1994, 1996-1998, 2004, 2006, 2009-2015 Free Software
Foundation, Inc.
This file is part of the GNU C Library.
/* Internal declarations for getopt.
- Copyright (C) 1989-1994, 1996-1999, 2001, 2003-2004, 2009-2014 Free Software
+ Copyright (C) 1989-1994, 1996-1999, 2001, 2003-2004, 2009-2015 Free Software
Foundation, Inc.
This file is part of the GNU C Library.
/* Convenience header for conditional use of GNU <libintl.h>.
- Copyright (C) 1995-1998, 2000-2002, 2004-2006, 2009-2014 Free Software
+ Copyright (C) 1995-1998, 2000-2002, 2004-2006, 2009-2015 Free Software
Foundation, Inc.
This program is free software; you can redistribute it and/or modify
/* gettime -- get the system clock
- Copyright (C) 2002, 2004-2007, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2004-2007, 2009-2015 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
/* Provide gettimeofday for systems that don't have it or for which it's broken.
- Copyright (C) 2001-2003, 2005-2007, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2001-2003, 2005-2007, 2009-2015 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
/* Sequential list data type implemented by a linked list.
- Copyright (C) 2006, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2006, 2009-2015 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2006.
This program is free software: you can redistribute it and/or modify
/* Sequential list data type implemented by a linked list.
- Copyright (C) 2006-2014 Free Software Foundation, Inc.
+ Copyright (C) 2006-2015 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2006.
This program is free software: you can redistribute it and/or modify
/* Sequential list data type implemented by a linked list.
- Copyright (C) 2006, 2008-2014 Free Software Foundation, Inc.
+ Copyright (C) 2006, 2008-2015 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2006.
This program is free software: you can redistribute it and/or modify
/* Sequential list data type implemented by a linked list.
- Copyright (C) 2006, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2006, 2009-2015 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2006.
This program is free software: you can redistribute it and/or modify
/* Abstract sequential list data type.
- Copyright (C) 2006-2014 Free Software Foundation, Inc.
+ Copyright (C) 2006-2015 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2006.
This program is free software: you can redistribute it and/or modify
/* Abstract sequential list data type, with out-of-memory checking.
- Copyright (C) 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2009-2015 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2009.
This program is free software: you can redistribute it and/or modify
## DO NOT EDIT! GENERATED AUTOMATICALLY!
## Process this file with automake to produce Makefile.in.
-# Copyright (C) 2002-2014 Free Software Foundation, Inc.
+# Copyright (C) 2002-2015 Free Software Foundation, Inc.
#
# 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
# the same distribution terms as the rest of that program.
#
# Generated by gnulib-tool.
-# Reproduce by: gnulib-tool --import --dir=. --local-dir=gl --lib=libpatch --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --makefile-name=gnulib.mk --no-conditional-dependencies --no-libtool --macro-prefix=gl argmatch backupfile clock-time diffseq dirname dup2 errno exitfail extensions fcntl-h full-write getdate getopt-gnu gettime git-version-gen gitlog-to-changelog hash ignore-value intprops largefile lchmod linked-list lstat maintainer-makefile malloc manywarnings memchr minmax mkdir progname quotearg readlink realloc rename rmdir setenv signal ssize_t stat-time stdbool stdlib symlink sys_stat tempname time unistd unlink update-copyright utimens verror xalloc xlist xmemdup0
+# Reproduce by: gnulib-tool --import --dir=. --local-dir=gl --lib=libpatch --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --makefile-name=gnulib.mk --no-conditional-dependencies --no-libtool --macro-prefix=gl argmatch backupfile clock-time diffseq dirname dup2 errno exitfail extensions fchmodat fchownat fcntl-h fstatat full-write getdate getopt-gnu gettime git-version-gen gitlog-to-changelog hash ignore-value intprops largefile linked-list maintainer-makefile malloc manywarnings memchr minmax mkdirat openat progname quotearg readlinkat realloc renameat setenv signal ssize_t stat-time stdbool stdlib symlinkat sys_stat tempname time unistd unlinkat update-copyright utimensat verror xalloc xlist xmemdup0
MOSTLYCLEANFILES += core *.stackdump
## end gnulib module argmatch
+## begin gnulib module assure
+
+
+EXTRA_DIST += assure.h
+
+## end gnulib module assure
+
+## begin gnulib module at-internal
+
+
+EXTRA_DIST += openat-priv.h openat-proc.c
+
+EXTRA_libpatch_a_SOURCES += openat-proc.c
+
+## end gnulib module at-internal
+
## begin gnulib module backupfile
libpatch_a_SOURCES += backupfile.c
## end gnulib module canonicalize-lgpl
+## begin gnulib module chdir-long
+
+
+EXTRA_DIST += chdir-long.c chdir-long.h
+
+EXTRA_libpatch_a_SOURCES += chdir-long.c
+
+## end gnulib module chdir-long
+
+## begin gnulib module chown
+
+
+EXTRA_DIST += chown.c fchown-stub.c
+
+EXTRA_libpatch_a_SOURCES += chown.c fchown-stub.c
+
+## end gnulib module chown
+
+## begin gnulib module cloexec
+
+libpatch_a_SOURCES += cloexec.c
+
+EXTRA_DIST += cloexec.h
+
+## end gnulib module cloexec
+
## begin gnulib module close
## end gnulib module exitfail
+## begin gnulib module fchdir
+
+
+EXTRA_DIST += fchdir.c
+
+EXTRA_libpatch_a_SOURCES += fchdir.c
+
+## end gnulib module fchdir
+
+## begin gnulib module fchmodat
+
+libpatch_a_SOURCES += chmodat.c
+
+EXTRA_DIST += at-func.c fchmodat.c
+
+EXTRA_libpatch_a_SOURCES += at-func.c fchmodat.c
+
+## end gnulib module fchmodat
+
+## begin gnulib module fchownat
+
+libpatch_a_SOURCES += chownat.c
+
+EXTRA_DIST += at-func.c fchownat.c
+
+EXTRA_libpatch_a_SOURCES += at-func.c fchownat.c
+
+## end gnulib module fchownat
+
## begin gnulib module fcntl
## end gnulib module filename
+## begin gnulib module filenamecat-lgpl
+
+libpatch_a_SOURCES += filenamecat-lgpl.c
+
+EXTRA_DIST += filenamecat.h
+
+## end gnulib module filenamecat-lgpl
+
## begin gnulib module float
BUILT_SOURCES += $(FLOAT_H)
## end gnulib module fstat
+## begin gnulib module fstatat
+
+
+EXTRA_DIST += at-func.c fstatat.c
+
+EXTRA_libpatch_a_SOURCES += at-func.c fstatat.c
+
+## end gnulib module fstatat
+
## begin gnulib module full-write
libpatch_a_SOURCES += full-write.h full-write.c
## end gnulib module full-write
+## begin gnulib module getcwd-lgpl
+
+
+EXTRA_DIST += getcwd-lgpl.c
+
+EXTRA_libpatch_a_SOURCES += getcwd-lgpl.c
+
+## end gnulib module getcwd-lgpl
+
## begin gnulib module getdate
## end gnulib module intprops
+## begin gnulib module lchown
+
+
+EXTRA_DIST += lchown.c
+
+EXTRA_libpatch_a_SOURCES += lchown.c
+
+## end gnulib module lchown
+
## begin gnulib module linked-list
libpatch_a_SOURCES += gl_linked_list.h gl_linked_list.c gl_anylinked_list1.h gl_anylinked_list2.h
## end gnulib module memchr
+## begin gnulib module mempcpy
+
+
+EXTRA_DIST += mempcpy.c
+
+EXTRA_libpatch_a_SOURCES += mempcpy.c
+
+## end gnulib module mempcpy
+
+## begin gnulib module memrchr
+
+
+EXTRA_DIST += memrchr.c
+
+EXTRA_libpatch_a_SOURCES += memrchr.c
+
+## end gnulib module memrchr
+
## begin gnulib module minmax
libpatch_a_SOURCES += minmax.h
## end gnulib module mkdir
+## begin gnulib module mkdirat
+
+
+EXTRA_DIST += at-func.c mkdirat.c
+
+EXTRA_libpatch_a_SOURCES += at-func.c mkdirat.c
+
+## end gnulib module mkdirat
+
## begin gnulib module mktime
## end gnulib module msvc-nothrow
+## begin gnulib module open
+
+
+EXTRA_DIST += open.c
+
+EXTRA_libpatch_a_SOURCES += open.c
+
+## end gnulib module open
+
+## begin gnulib module openat
+
+
+EXTRA_DIST += openat.c
+
+EXTRA_libpatch_a_SOURCES += openat.c
+
+## end gnulib module openat
+
+## begin gnulib module openat-die
+
+libpatch_a_SOURCES += openat-die.c
+
+## end gnulib module openat-die
+
+## begin gnulib module openat-h
+
+
+EXTRA_DIST += openat.h
+
+## end gnulib module openat-h
+
## begin gnulib module opendir
## end gnulib module readlink
+## begin gnulib module readlinkat
+
+
+EXTRA_DIST += at-func.c readlinkat.c
+
+EXTRA_libpatch_a_SOURCES += at-func.c readlinkat.c
+
+## end gnulib module readlinkat
+
## begin gnulib module realloc-gnu
## end gnulib module rename
+## begin gnulib module renameat
+
+
+EXTRA_DIST += at-func2.c renameat.c
+
+EXTRA_libpatch_a_SOURCES += at-func2.c renameat.c
+
+## end gnulib module renameat
+
## begin gnulib module rmdir
## end gnulib module same-inode
+## begin gnulib module save-cwd
+
+libpatch_a_SOURCES += save-cwd.c
+
+EXTRA_DIST += save-cwd.h
+
+## end gnulib module save-cwd
+
## begin gnulib module secure_getenv
## end gnulib module stat-time
+## begin gnulib module statat
+
+libpatch_a_SOURCES += statat.c
+
+## end gnulib module statat
+
## begin gnulib module stdarg
BUILT_SOURCES += $(STDARG_H)
-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_MAX_ALIGN_T''@|$(HAVE_MAX_ALIGN_T)|g' \
-e 's|@''HAVE_WCHAR_T''@|$(HAVE_WCHAR_T)|g' \
-e 's|@''REPLACE_NULL''@|$(REPLACE_NULL)|g' \
< $(srcdir)/stddef.in.h; \
## end gnulib module stdlib
+## begin gnulib module strdup-posix
+
+
+EXTRA_DIST += strdup.c
+
+EXTRA_libpatch_a_SOURCES += strdup.c
+
+## end gnulib module strdup-posix
+
## begin gnulib module streq
## end gnulib module symlink
+## begin gnulib module symlinkat
+
+
+EXTRA_DIST += at-func.c symlinkat.c
+
+EXTRA_libpatch_a_SOURCES += at-func.c symlinkat.c
+
+## end gnulib module symlinkat
+
## begin gnulib module sys_stat
BUILT_SOURCES += sys/stat.h
-e 's|@''PTHREAD_H_DEFINES_STRUCT_TIMESPEC''@|$(PTHREAD_H_DEFINES_STRUCT_TIMESPEC)|g' \
-e 's|@''SYS_TIME_H_DEFINES_STRUCT_TIMESPEC''@|$(SYS_TIME_H_DEFINES_STRUCT_TIMESPEC)|g' \
-e 's|@''TIME_H_DEFINES_STRUCT_TIMESPEC''@|$(TIME_H_DEFINES_STRUCT_TIMESPEC)|g' \
+ -e 's|@''UNISTD_H_DEFINES_STRUCT_TIMESPEC''@|$(UNISTD_H_DEFINES_STRUCT_TIMESPEC)|g' \
-e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \
-e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
-e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
## end gnulib module unlink
+## begin gnulib module unlinkat
+
+
+EXTRA_DIST += at-func.c unlinkat.c
+
+EXTRA_libpatch_a_SOURCES += at-func.c unlinkat.c
+
+## end gnulib module unlinkat
+
## begin gnulib module unsetenv
## end gnulib module utimens
+## begin gnulib module utimensat
+
+
+EXTRA_DIST += at-func.c utimensat.c
+
+EXTRA_libpatch_a_SOURCES += at-func.c utimensat.c
+
+## end gnulib module utimensat
+
## begin gnulib module vasnprintf
/* hash - hashing table processing.
- Copyright (C) 1998-2004, 2006-2007, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 1998-2004, 2006-2007, 2009-2015 Free Software Foundation, Inc.
Written by Jim Meyering, 1992.
/* hash - hashing table processing.
- Copyright (C) 1998-1999, 2001, 2003, 2009-2014 Free Software Foundation,
+ Copyright (C) 1998-1999, 2001, 2003, 2009-2015 Free Software Foundation,
Inc.
Written by Jim Meyering <meyering@ascend.com>, 1998.
/* ignore a function return without a compiler warning
- Copyright (C) 2008-2014 Free Software Foundation, Inc.
+ Copyright (C) 2008-2015 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
/* intprops.h -- properties of integer types
- Copyright (C) 2001-2005, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2001-2005, 2009-2015 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
/* Replacement for 'int' to 'long double' conversion routine.
- Copyright (C) 2011-2014 Free Software Foundation, Inc.
+ Copyright (C) 2011-2015 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2011.
This program is free software: you can redistribute it and/or modify
--- /dev/null
+/* Provide a stub lchown function for systems that lack it.
+
+ Copyright (C) 1998-1999, 2002, 2004, 2006-2007, 2009-2015 Free Software
+ Foundation, Inc.
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+/* written by Jim Meyering */
+
+#include <config.h>
+
+#include <unistd.h>
+
+#include <errno.h>
+#include <stdbool.h>
+#include <string.h>
+#include <sys/stat.h>
+
+#if !HAVE_LCHOWN
+
+/* If the system chown does not follow symlinks, we don't want it
+ replaced by gnulib's chown, which does follow symlinks. */
+# if CHOWN_MODIFIES_SYMLINK
+# undef chown
+# endif
+
+/* Work just like chown, except when FILE is a symbolic link.
+ In that case, set errno to EOPNOTSUPP and return -1.
+ But if autoconf tests determined that chown modifies
+ symlinks, then just call chown. */
+
+int
+lchown (const char *file, uid_t uid, gid_t gid)
+{
+# if HAVE_CHOWN
+# if ! CHOWN_MODIFIES_SYMLINK
+ struct stat stats;
+
+ if (lstat (file, &stats) == 0 && S_ISLNK (stats.st_mode))
+ {
+ errno = EOPNOTSUPP;
+ return -1;
+ }
+# endif
+
+ return chown (file, uid, gid);
+
+# else /* !HAVE_CHOWN */
+ errno = ENOSYS;
+ return -1;
+# endif
+}
+
+#else /* HAVE_LCHOWN */
+
+# undef lchown
+
+/* Work around trailing slash bugs in lchown. */
+int
+rpl_lchown (const char *file, uid_t uid, gid_t gid)
+{
+ bool stat_valid = false;
+ int result;
+
+# if CHOWN_CHANGE_TIME_BUG
+ struct stat st;
+
+ if (gid != (gid_t) -1 || uid != (uid_t) -1)
+ {
+ if (lstat (file, &st))
+ return -1;
+ stat_valid = true;
+ if (!S_ISLNK (st.st_mode))
+ return chown (file, uid, gid);
+ }
+# endif
+
+# if CHOWN_TRAILING_SLASH_BUG
+ if (!stat_valid)
+ {
+ size_t len = strlen (file);
+ if (len && file[len - 1] == '/')
+ return chown (file, uid, gid);
+ }
+# endif
+
+ result = lchown (file, uid, gid);
+
+# if CHOWN_CHANGE_TIME_BUG && HAVE_LCHMOD
+ if (result == 0 && stat_valid
+ && (uid == st.st_uid || uid == (uid_t) -1)
+ && (gid == st.st_gid || gid == (gid_t) -1))
+ {
+ /* No change in ownership, but at least one argument was not -1,
+ so we are required to update ctime. Since lchown succeeded,
+ we assume that lchmod will do likewise. But if the system
+ lacks lchmod and lutimes, we are out of luck. Oh well. */
+ result = lchmod (file, st.st_mode & (S_IRWXU | S_IRWXG | S_IRWXO
+ | S_ISUID | S_ISGID | S_ISVTX));
+ }
+# endif
+
+ return result;
+}
+
+#endif /* HAVE_LCHOWN */
/* Determine a canonical name for the current locale's character encoding.
- Copyright (C) 2000-2006, 2008-2014 Free Software Foundation, Inc.
+ Copyright (C) 2000-2006, 2008-2015 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
cp = charset_aliases;
if (cp == NULL)
{
-#if !(defined DARWIN7 || defined VMS || defined WINDOWS_NATIVE || defined __CYGWIN__)
+#if !(defined DARWIN7 || defined VMS || defined WINDOWS_NATIVE || defined __CYGWIN__ || defined OS2)
const char *dir;
const char *base = "charset.alias";
char *file_name;
"CP54936" "\0" "GB18030" "\0"
"CP65001" "\0" "UTF-8" "\0";
# endif
+# if defined OS2
+ /* To avoid the troubles of installing a separate file in the same
+ directory as the DLL and of retrieving the DLL's directory at
+ runtime, simply inline the aliases here. */
+
+ /* The list of encodings is taken from "List of OS/2 Codepages"
+ by Alex Taylor:
+ <http://altsan.org/os2/toolkits/uls/index.html#codepages>.
+ See also "IBM Globalization - Code page identifiers":
+ <http://www-01.ibm.com/software/globalization/cp/cp_cpgid.html>. */
+ cp = "CP813" "\0" "ISO-8859-7" "\0"
+ "CP878" "\0" "KOI8-R" "\0"
+ "CP819" "\0" "ISO-8859-1" "\0"
+ "CP912" "\0" "ISO-8859-2" "\0"
+ "CP913" "\0" "ISO-8859-3" "\0"
+ "CP914" "\0" "ISO-8859-4" "\0"
+ "CP915" "\0" "ISO-8859-5" "\0"
+ "CP916" "\0" "ISO-8859-8" "\0"
+ "CP920" "\0" "ISO-8859-9" "\0"
+ "CP921" "\0" "ISO-8859-13" "\0"
+ "CP923" "\0" "ISO-8859-15" "\0"
+ "CP954" "\0" "EUC-JP" "\0"
+ "CP964" "\0" "EUC-TW" "\0"
+ "CP970" "\0" "EUC-KR" "\0"
+ "CP1089" "\0" "ISO-8859-6" "\0"
+ "CP1208" "\0" "UTF-8" "\0"
+ "CP1381" "\0" "GB2312" "\0"
+ "CP1386" "\0" "GBK" "\0"
+ "CP3372" "\0" "EUC-JP" "\0";
+# endif
#endif
charset_aliases = cp;
ULONG cp[3];
ULONG cplen;
+ codeset = NULL;
+
/* Allow user to override the codeset, as set in the operating system,
with standard language environment variables. */
locale = getenv ("LC_ALL");
}
}
- /* Resolve through the charset.alias file. */
- codeset = locale;
+ /* For the POSIX locale, don't use the system's codepage. */
+ if (strcmp (locale, "C") == 0 || strcmp (locale, "POSIX") == 0)
+ codeset = "";
}
- else
+
+ if (codeset == NULL)
{
/* OS/2 has a function returning the locale's codepage as a number. */
if (DosQueryCp (sizeof (cp), cp, &cplen))
/* Determine a canonical name for the current locale's character encoding.
- Copyright (C) 2000-2003, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2000-2003, 2009-2015 Free Software Foundation, Inc.
This file is part of the GNU CHARSET Library.
This program is free software; you can redistribute it and/or modify
/* Work around a bug of lstat on some systems
- Copyright (C) 1997-2006, 2008-2014 Free Software Foundation, Inc.
+ Copyright (C) 1997-2006, 2008-2015 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
/* malloc() function that is glibc compatible.
- Copyright (C) 1997-1998, 2006-2007, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 1997-1998, 2006-2007, 2009-2015 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
/* Safe automatic memory allocation.
- Copyright (C) 2003, 2006-2007, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2006-2007, 2009-2015 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2003.
This program is free software; you can redistribute it and/or modify
/* Safe automatic memory allocation.
- Copyright (C) 2003-2007, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2003-2007, 2009-2015 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2003.
This program is free software; you can redistribute it and/or modify
/* Convert multibyte character to wide character.
- Copyright (C) 1999-2002, 2005-2014 Free Software Foundation, Inc.
+ Copyright (C) 1999-2002, 2005-2015 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2008.
This program is free software: you can redistribute it and/or modify
/* Test for initial conversion state.
- Copyright (C) 2008-2014 Free Software Foundation, Inc.
+ Copyright (C) 2008-2015 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2008.
This program is free software: you can redistribute it and/or modify
-/* Copyright (C) 1991, 1993, 1996-1997, 1999-2000, 2003-2004, 2006, 2008-2014
+/* Copyright (C) 1991, 1993, 1996-1997, 1999-2000, 2003-2004, 2006, 2008-2015
Free Software Foundation, Inc.
Based on strlen implementation by Torbjorn Granlund (tege@sics.se),
--- /dev/null
+/* Copy memory area and return pointer after last written byte.
+ Copyright (C) 2003, 2007, 2009-2015 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3, or (at your option)
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>. */
+
+#include <config.h>
+
+/* Specification. */
+#include <string.h>
+
+/* Copy N bytes of SRC to DEST, return pointer to bytes after the
+ last written byte. */
+void *
+mempcpy (void *dest, const void *src, size_t n)
+{
+ return (char *) memcpy (dest, src, n) + n;
+}
--- /dev/null
+/* memrchr -- find the last occurrence of a byte in a memory block
+
+ Copyright (C) 1991, 1993, 1996-1997, 1999-2000, 2003-2015 Free Software
+ Foundation, Inc.
+
+ Based on strlen implementation by Torbjorn Granlund (tege@sics.se),
+ with help from Dan Sahlin (dan@sics.se) and
+ commentary by Jim Blandy (jimb@ai.mit.edu);
+ adaptation to memchr suggested by Dick Karpinski (dick@cca.ucsf.edu),
+ and implemented by Roland McGrath (roland@ai.mit.edu).
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+#if defined _LIBC
+# include <memcopy.h>
+#else
+# include <config.h>
+# define reg_char char
+#endif
+
+#include <string.h>
+#include <limits.h>
+
+#undef __memrchr
+#ifdef _LIBC
+# undef memrchr
+#endif
+
+#ifndef weak_alias
+# define __memrchr memrchr
+#endif
+
+/* Search no more than N bytes of S for C. */
+void *
+__memrchr (void const *s, int c_in, size_t n)
+{
+ /* On 32-bit hardware, choosing longword to be a 32-bit unsigned
+ long instead of a 64-bit uintmax_t tends to give better
+ performance. On 64-bit hardware, unsigned long is generally 64
+ bits already. Change this typedef to experiment with
+ performance. */
+ typedef unsigned long int longword;
+
+ const unsigned char *char_ptr;
+ const longword *longword_ptr;
+ longword repeated_one;
+ longword repeated_c;
+ unsigned reg_char c;
+
+ c = (unsigned char) c_in;
+
+ /* Handle the last few bytes by reading one byte at a time.
+ Do this until CHAR_PTR is aligned on a longword boundary. */
+ for (char_ptr = (const unsigned char *) s + n;
+ n > 0 && (size_t) char_ptr % sizeof (longword) != 0;
+ --n)
+ if (*--char_ptr == c)
+ return (void *) char_ptr;
+
+ longword_ptr = (const longword *) char_ptr;
+
+ /* All these elucidatory comments refer to 4-byte longwords,
+ but the theory applies equally well to any size longwords. */
+
+ /* Compute auxiliary longword values:
+ repeated_one is a value which has a 1 in every byte.
+ repeated_c has c in every byte. */
+ repeated_one = 0x01010101;
+ repeated_c = c | (c << 8);
+ repeated_c |= repeated_c << 16;
+ if (0xffffffffU < (longword) -1)
+ {
+ repeated_one |= repeated_one << 31 << 1;
+ repeated_c |= repeated_c << 31 << 1;
+ if (8 < sizeof (longword))
+ {
+ size_t i;
+
+ for (i = 64; i < sizeof (longword) * 8; i *= 2)
+ {
+ repeated_one |= repeated_one << i;
+ repeated_c |= repeated_c << i;
+ }
+ }
+ }
+
+ /* Instead of the traditional loop which tests each byte, we will test a
+ longword at a time. The tricky part is testing if *any of the four*
+ bytes in the longword in question are equal to c. We first use an xor
+ with repeated_c. This reduces the task to testing whether *any of the
+ four* bytes in longword1 is zero.
+
+ We compute tmp =
+ ((longword1 - repeated_one) & ~longword1) & (repeated_one << 7).
+ That is, we perform the following operations:
+ 1. Subtract repeated_one.
+ 2. & ~longword1.
+ 3. & a mask consisting of 0x80 in every byte.
+ Consider what happens in each byte:
+ - If a byte of longword1 is zero, step 1 and 2 transform it into 0xff,
+ and step 3 transforms it into 0x80. A carry can also be propagated
+ to more significant bytes.
+ - If a byte of longword1 is nonzero, let its lowest 1 bit be at
+ position k (0 <= k <= 7); so the lowest k bits are 0. After step 1,
+ the byte ends in a single bit of value 0 and k bits of value 1.
+ After step 2, the result is just k bits of value 1: 2^k - 1. After
+ step 3, the result is 0. And no carry is produced.
+ So, if longword1 has only non-zero bytes, tmp is zero.
+ Whereas if longword1 has a zero byte, call j the position of the least
+ significant zero byte. Then the result has a zero at positions 0, ...,
+ j-1 and a 0x80 at position j. We cannot predict the result at the more
+ significant bytes (positions j+1..3), but it does not matter since we
+ already have a non-zero bit at position 8*j+7.
+
+ So, the test whether any byte in longword1 is zero is equivalent to
+ testing whether tmp is nonzero. */
+
+ while (n >= sizeof (longword))
+ {
+ longword longword1 = *--longword_ptr ^ repeated_c;
+
+ if ((((longword1 - repeated_one) & ~longword1)
+ & (repeated_one << 7)) != 0)
+ {
+ longword_ptr++;
+ break;
+ }
+ n -= sizeof (longword);
+ }
+
+ char_ptr = (const unsigned char *) longword_ptr;
+
+ /* At this point, we know that either n < sizeof (longword), or one of the
+ sizeof (longword) bytes starting at char_ptr is == c. On little-endian
+ machines, we could determine the first such byte without any further
+ memory accesses, just by looking at the tmp result from the last loop
+ iteration. But this does not work on big-endian machines. Choose code
+ that works in both cases. */
+
+ while (n-- > 0)
+ {
+ if (*--char_ptr == c)
+ return (void *) char_ptr;
+ }
+
+ return NULL;
+}
+#ifdef weak_alias
+weak_alias (__memrchr, memrchr)
+#endif
/* MIN, MAX macros.
- Copyright (C) 1995, 1998, 2001, 2003, 2005, 2009-2014 Free Software
+ Copyright (C) 1995, 1998, 2001, 2003, 2005, 2009-2015 Free Software
Foundation, Inc.
This program is free software; you can redistribute it and/or modify
/* On some systems, mkdir ("foo/", 0700) fails because of the trailing
slash. On those systems, this wrapper removes the trailing slash.
- Copyright (C) 2001, 2003, 2006, 2008-2014 Free Software Foundation, Inc.
+ Copyright (C) 2001, 2003, 2006, 2008-2015 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
--- /dev/null
+/* fd-relative mkdir
+ Copyright (C) 2005-2006, 2009-2015 Free Software Foundation, Inc.
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+/* written by Jim Meyering */
+
+#include <config.h>
+
+#include <unistd.h>
+
+/* Solaris 10 has no function like this.
+ Create a subdirectory, FILE, with mode MODE, in the directory
+ open on descriptor FD. If possible, do it without changing the
+ working directory. Otherwise, resort to using save_cwd/fchdir,
+ then mkdir/restore_cwd. If either the save_cwd or the restore_cwd
+ fails, then give a diagnostic and exit nonzero. */
+
+#define AT_FUNC_NAME mkdirat
+#define AT_FUNC_F1 mkdir
+#define AT_FUNC_POST_FILE_PARAM_DECLS , mode_t mode
+#define AT_FUNC_POST_FILE_ARGS , mode
+#include "at-func.c"
/* Convert a 'struct tm' to a time_t value.
- Copyright (C) 1993-2014 Free Software Foundation, Inc.
+ Copyright (C) 1993-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Paul Eggert <eggert@twinsun.com>.
/* Invalid parameter handler for MSVC runtime libraries.
- Copyright (C) 2011-2014 Free Software Foundation, Inc.
+ Copyright (C) 2011-2015 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
/* Invalid parameter handler for MSVC runtime libraries.
- Copyright (C) 2011-2014 Free Software Foundation, Inc.
+ Copyright (C) 2011-2015 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
/* Wrappers that don't throw invalid parameter notifications
with MSVC runtime libraries.
- Copyright (C) 2011-2014 Free Software Foundation, Inc.
+ Copyright (C) 2011-2015 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
/* Wrappers that don't throw invalid parameter notifications
with MSVC runtime libraries.
- Copyright (C) 2011-2014 Free Software Foundation, Inc.
+ Copyright (C) 2011-2015 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
--- /dev/null
+/* Open a descriptor to a file.
+ Copyright (C) 2007-2015 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>, 2007. */
+
+/* If the user's config.h happens to include <fcntl.h>, let it include only
+ the system's <fcntl.h> here, so that orig_open doesn't recurse to
+ rpl_open. */
+#define __need_system_fcntl_h
+#include <config.h>
+
+/* Get the original definition of open. It might be defined as a macro. */
+#include <fcntl.h>
+#include <sys/types.h>
+#undef __need_system_fcntl_h
+
+static int
+orig_open (const char *filename, int flags, mode_t mode)
+{
+ return open (filename, flags, mode);
+}
+
+/* Specification. */
+/* Write "fcntl.h" here, not <fcntl.h>, otherwise OSF/1 5.1 DTK cc eliminates
+ this include because of the preliminary #include <fcntl.h> above. */
+#include "fcntl.h"
+
+#include <errno.h>
+#include <stdarg.h>
+#include <string.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
+
+#ifndef REPLACE_OPEN_DIRECTORY
+# define REPLACE_OPEN_DIRECTORY 0
+#endif
+
+int
+open (const char *filename, int flags, ...)
+{
+ mode_t mode;
+ int fd;
+
+ mode = 0;
+ if (flags & O_CREAT)
+ {
+ va_list arg;
+ va_start (arg, flags);
+
+ /* We have to use PROMOTED_MODE_T instead of mode_t, otherwise GCC 4
+ creates crashing code when 'mode_t' is smaller than 'int'. */
+ mode = va_arg (arg, PROMOTED_MODE_T);
+
+ va_end (arg);
+ }
+
+#if GNULIB_defined_O_NONBLOCK
+ /* The only known platform that lacks O_NONBLOCK is mingw, but it
+ also lacks named pipes and Unix sockets, which are the only two
+ file types that require non-blocking handling in open().
+ Therefore, it is safe to ignore O_NONBLOCK here. It is handy
+ that mingw also lacks openat(), so that is also covered here. */
+ flags &= ~O_NONBLOCK;
+#endif
+
+#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
+ if (strcmp (filename, "/dev/null") == 0)
+ filename = "NUL";
+#endif
+
+#if OPEN_TRAILING_SLASH_BUG
+ /* If the filename ends in a slash and one of O_CREAT, O_WRONLY, O_RDWR
+ is specified, then fail.
+ Rationale: POSIX <http://www.opengroup.org/susv3/basedefs/xbd_chap04.html>
+ says that
+ "A pathname that contains at least one non-slash character and that
+ ends with one or more trailing slashes shall be resolved as if a
+ single dot character ( '.' ) were appended to the pathname."
+ and
+ "The special filename dot shall refer to the directory specified by
+ its predecessor."
+ If the named file already exists as a directory, then
+ - if O_CREAT is specified, open() must fail because of the semantics
+ of O_CREAT,
+ - if O_WRONLY or O_RDWR is specified, open() must fail because POSIX
+ <http://www.opengroup.org/susv3/functions/open.html> says that it
+ fails with errno = EISDIR in this case.
+ If the named file does not exist or does not name a directory, then
+ - if O_CREAT is specified, open() must fail since open() cannot create
+ directories,
+ - if O_WRONLY or O_RDWR is specified, open() must fail because the
+ file does not contain a '.' directory. */
+ if (flags & (O_CREAT | O_WRONLY | O_RDWR))
+ {
+ size_t len = strlen (filename);
+ if (len > 0 && filename[len - 1] == '/')
+ {
+ errno = EISDIR;
+ return -1;
+ }
+ }
+#endif
+
+ fd = orig_open (filename, flags, mode);
+
+#if REPLACE_FCHDIR
+ /* Implementing fchdir and fdopendir requires the ability to open a
+ directory file descriptor. If open doesn't support that (as on
+ mingw), we use a dummy file that behaves the same as directories
+ on Linux (ie. always reports EOF on attempts to read()), and
+ 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
+ || (O_SEARCH != O_RDONLY && (flags & O_ACCMODE) == O_SEARCH)))
+ {
+ struct stat statbuf;
+ if (stat (filename, &statbuf) == 0 && S_ISDIR (statbuf.st_mode))
+ {
+ /* Maximum recursion depth of 1. */
+ fd = open ("/dev/null", flags, mode);
+ if (0 <= fd)
+ fd = _gl_register_fd (fd, filename);
+ }
+ else
+ errno = EACCES;
+ }
+#endif
+
+#if OPEN_TRAILING_SLASH_BUG
+ /* If the filename ends in a slash and fd does not refer to a directory,
+ then fail.
+ Rationale: POSIX <http://www.opengroup.org/susv3/basedefs/xbd_chap04.html>
+ says that
+ "A pathname that contains at least one non-slash character and that
+ ends with one or more trailing slashes shall be resolved as if a
+ single dot character ( '.' ) were appended to the pathname."
+ and
+ "The special filename dot shall refer to the directory specified by
+ its predecessor."
+ If the named file without the slash is not a directory, open() must fail
+ with ENOTDIR. */
+ if (fd >= 0)
+ {
+ /* We know len is positive, since open did not fail with ENOENT. */
+ size_t len = strlen (filename);
+ if (filename[len - 1] == '/')
+ {
+ struct stat statbuf;
+
+ if (fstat (fd, &statbuf) >= 0 && !S_ISDIR (statbuf.st_mode))
+ {
+ close (fd);
+ errno = ENOTDIR;
+ return -1;
+ }
+ }
+ }
+#endif
+
+#if REPLACE_FCHDIR
+ if (!REPLACE_OPEN_DIRECTORY && 0 <= fd)
+ fd = _gl_register_fd (fd, filename);
+#endif
+
+ return fd;
+}
--- /dev/null
+/* Report a save- or restore-cwd failure in our openat replacement and then exit.
+
+ Copyright (C) 2005-2006, 2008-2015 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 "openat.h"
+
+#include <stdlib.h>
+
+#ifndef GNULIB_LIBPOSIX
+# include "error.h"
+#endif
+
+#include "exitfail.h"
+
+#include "gettext.h"
+#define _(msgid) gettext (msgid)
+
+_Noreturn void
+openat_save_fail (int errnum)
+{
+#ifndef GNULIB_LIBPOSIX
+ error (exit_failure, errnum,
+ _("unable to record current working directory"));
+#endif
+ /* _Noreturn cannot be applied to error, since it returns
+ when its first argument is 0. To help compilers understand that this
+ function does not return, call abort. Also, the abort is a
+ safety feature if exit_failure is 0 (which shouldn't happen). */
+ abort ();
+}
+
+
+/* Exit with an error about failure to restore the working directory
+ during an openat emulation. The caller must ensure that fd 2 is
+ not a just-opened fd, even when openat_safer is not in use. */
+
+_Noreturn void
+openat_restore_fail (int errnum)
+{
+#ifndef GNULIB_LIBPOSIX
+ error (exit_failure, errnum,
+ _("failed to return to initial working directory"));
+#endif
+
+ /* As above. */
+ abort ();
+}
--- /dev/null
+/* Internals for openat-like functions.
+
+ Copyright (C) 2005-2006, 2009-2015 Free Software Foundation, Inc.
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+/* written by Jim Meyering */
+
+#ifndef _GL_HEADER_OPENAT_PRIV
+#define _GL_HEADER_OPENAT_PRIV
+
+#include <errno.h>
+#include <limits.h>
+#include <stdlib.h>
+
+/* Maximum number of bytes that it is safe to allocate as a single
+ array on the stack, and that is known as a compile-time constant.
+ The assumption is that we'll touch the array very quickly, or a
+ temporary very near the array, provoking an out-of-memory trap. On
+ some operating systems, there is only one guard page for the stack,
+ and a page size can be as small as 4096 bytes. Subtract 64 in the
+ hope that this will let the compiler touch a nearby temporary and
+ provoke a trap. */
+#define SAFER_ALLOCA_MAX (4096 - 64)
+
+#define SAFER_ALLOCA(m) ((m) < SAFER_ALLOCA_MAX ? (m) : SAFER_ALLOCA_MAX)
+
+#if defined PATH_MAX
+# define OPENAT_BUFFER_SIZE SAFER_ALLOCA (PATH_MAX)
+#elif defined _XOPEN_PATH_MAX
+# define OPENAT_BUFFER_SIZE SAFER_ALLOCA (_XOPEN_PATH_MAX)
+#else
+# define OPENAT_BUFFER_SIZE SAFER_ALLOCA (1024)
+#endif
+
+char *openat_proc_name (char buf[OPENAT_BUFFER_SIZE], int fd, char const *file);
+
+/* Trying to access a BUILD_PROC_NAME file will fail on systems without
+ /proc support, and even on systems *with* ProcFS support. Return
+ nonzero if the failure may be legitimate, e.g., because /proc is not
+ readable, or the particular .../fd/N directory is not present. */
+#define EXPECTED_ERRNO(Errno) \
+ ((Errno) == ENOTDIR || (Errno) == ENOENT \
+ || (Errno) == EPERM || (Errno) == EACCES \
+ || (Errno) == ENOSYS /* Solaris 8 */ \
+ || (Errno) == EOPNOTSUPP /* FreeBSD */)
+
+/* Wrapper function shared among linkat and renameat. */
+int at_func2 (int fd1, char const *file1,
+ int fd2, char const *file2,
+ int (*func) (char const *file1, char const *file2));
+
+#endif /* _GL_HEADER_OPENAT_PRIV */
--- /dev/null
+/* Create /proc/self/fd-related names for subfiles of open directories.
+
+ Copyright (C) 2006, 2009-2015 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 Paul Eggert. */
+
+#include <config.h>
+
+#include "openat-priv.h"
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include "intprops.h"
+
+#define PROC_SELF_FD_FORMAT "/proc/self/fd/%d/%s"
+
+#define PROC_SELF_FD_NAME_SIZE_BOUND(len) \
+ (sizeof PROC_SELF_FD_FORMAT - sizeof "%d%s" \
+ + INT_STRLEN_BOUND (int) + (len) + 1)
+
+
+/* Set BUF to the expansion of PROC_SELF_FD_FORMAT, using FD and FILE
+ respectively for %d and %s. If successful, return BUF if the
+ result fits in BUF, dynamically allocated memory otherwise. But
+ return NULL if /proc is not reliable, either because the operating
+ system support is lacking or because memory is low. */
+char *
+openat_proc_name (char buf[OPENAT_BUFFER_SIZE], int fd, char const *file)
+{
+ static int proc_status = 0;
+
+ /* Make sure the caller gets ENOENT when appropriate. */
+ if (!*file)
+ {
+ buf[0] = '\0';
+ return buf;
+ }
+
+ if (! proc_status)
+ {
+ /* Set PROC_STATUS to a positive value if /proc/self/fd is
+ reliable, and a negative value otherwise. Solaris 10
+ /proc/self/fd mishandles "..", and any file name might expand
+ to ".." after symbolic link expansion, so avoid /proc/self/fd
+ if it mishandles "..". Solaris 10 has openat, but this
+ problem is exhibited on code that built on Solaris 8 and
+ running on Solaris 10. */
+
+ int proc_self_fd = open ("/proc/self/fd",
+ O_SEARCH | O_DIRECTORY | O_NOCTTY | O_NONBLOCK);
+ if (proc_self_fd < 0)
+ proc_status = -1;
+ else
+ {
+ /* Detect whether /proc/self/fd/%i/../fd exists, where %i is the
+ number of a file descriptor open on /proc/self/fd. On Linux,
+ that name resolves to /proc/self/fd, which was opened above.
+ However, on Solaris, it may resolve to /proc/self/fd/fd, which
+ cannot exist, since all names in /proc/self/fd are numeric. */
+ char dotdot_buf[PROC_SELF_FD_NAME_SIZE_BOUND (sizeof "../fd" - 1)];
+ sprintf (dotdot_buf, PROC_SELF_FD_FORMAT, proc_self_fd, "../fd");
+ proc_status = access (dotdot_buf, F_OK) ? -1 : 1;
+ close (proc_self_fd);
+ }
+ }
+
+ if (proc_status < 0)
+ return NULL;
+ else
+ {
+ size_t bufsize = PROC_SELF_FD_NAME_SIZE_BOUND (strlen (file));
+ char *result = buf;
+ if (OPENAT_BUFFER_SIZE < bufsize)
+ {
+ result = malloc (bufsize);
+ if (! result)
+ return NULL;
+ }
+ sprintf (result, PROC_SELF_FD_FORMAT, fd, file);
+ return result;
+ }
+}
--- /dev/null
+/* provide a replacement openat function
+ Copyright (C) 2004-2015 Free Software Foundation, Inc.
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+/* written by Jim Meyering */
+
+/* If the user's config.h happens to include <fcntl.h>, let it include only
+ the system's <fcntl.h> here, so that orig_openat doesn't recurse to
+ rpl_openat. */
+#define __need_system_fcntl_h
+#include <config.h>
+
+/* Get the original definition of open. It might be defined as a macro. */
+#include <fcntl.h>
+#include <sys/types.h>
+#undef __need_system_fcntl_h
+
+#if HAVE_OPENAT
+static int
+orig_openat (int fd, char const *filename, int flags, mode_t mode)
+{
+ return openat (fd, filename, flags, mode);
+}
+#endif
+
+/* Write "fcntl.h" here, not <fcntl.h>, otherwise OSF/1 5.1 DTK cc eliminates
+ this include because of the preliminary #include <fcntl.h> above. */
+#include "fcntl.h"
+
+#include "openat.h"
+
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stddef.h>
+#include <string.h>
+#include <sys/stat.h>
+#include <errno.h>
+
+#if HAVE_OPENAT
+
+/* Like openat, but work around Solaris 9 bugs with trailing slash. */
+int
+rpl_openat (int dfd, char const *filename, int flags, ...)
+{
+ mode_t mode;
+ int fd;
+
+ mode = 0;
+ if (flags & O_CREAT)
+ {
+ va_list arg;
+ va_start (arg, flags);
+
+ /* We have to use PROMOTED_MODE_T instead of mode_t, otherwise GCC 4
+ creates crashing code when 'mode_t' is smaller than 'int'. */
+ mode = va_arg (arg, PROMOTED_MODE_T);
+
+ va_end (arg);
+ }
+
+# if OPEN_TRAILING_SLASH_BUG
+ /* If the filename ends in a slash and one of O_CREAT, O_WRONLY, O_RDWR
+ is specified, then fail.
+ Rationale: POSIX <http://www.opengroup.org/susv3/basedefs/xbd_chap04.html>
+ says that
+ "A pathname that contains at least one non-slash character and that
+ ends with one or more trailing slashes shall be resolved as if a
+ single dot character ( '.' ) were appended to the pathname."
+ and
+ "The special filename dot shall refer to the directory specified by
+ its predecessor."
+ If the named file already exists as a directory, then
+ - if O_CREAT is specified, open() must fail because of the semantics
+ of O_CREAT,
+ - if O_WRONLY or O_RDWR is specified, open() must fail because POSIX
+ <http://www.opengroup.org/susv3/functions/open.html> says that it
+ fails with errno = EISDIR in this case.
+ If the named file does not exist or does not name a directory, then
+ - if O_CREAT is specified, open() must fail since open() cannot create
+ directories,
+ - if O_WRONLY or O_RDWR is specified, open() must fail because the
+ file does not contain a '.' directory. */
+ if (flags & (O_CREAT | O_WRONLY | O_RDWR))
+ {
+ size_t len = strlen (filename);
+ if (len > 0 && filename[len - 1] == '/')
+ {
+ errno = EISDIR;
+ return -1;
+ }
+ }
+# endif
+
+ fd = orig_openat (dfd, filename, flags, mode);
+
+# if OPEN_TRAILING_SLASH_BUG
+ /* If the filename ends in a slash and fd does not refer to a directory,
+ then fail.
+ Rationale: POSIX <http://www.opengroup.org/susv3/basedefs/xbd_chap04.html>
+ says that
+ "A pathname that contains at least one non-slash character and that
+ ends with one or more trailing slashes shall be resolved as if a
+ single dot character ( '.' ) were appended to the pathname."
+ and
+ "The special filename dot shall refer to the directory specified by
+ its predecessor."
+ If the named file without the slash is not a directory, open() must fail
+ with ENOTDIR. */
+ if (fd >= 0)
+ {
+ /* We know len is positive, since open did not fail with ENOENT. */
+ size_t len = strlen (filename);
+ if (filename[len - 1] == '/')
+ {
+ struct stat statbuf;
+
+ if (fstat (fd, &statbuf) >= 0 && !S_ISDIR (statbuf.st_mode))
+ {
+ close (fd);
+ errno = ENOTDIR;
+ return -1;
+ }
+ }
+ }
+# endif
+
+ return fd;
+}
+
+#else /* !HAVE_OPENAT */
+
+# include "dosname.h" /* solely for definition of IS_ABSOLUTE_FILE_NAME */
+# include "openat-priv.h"
+# include "save-cwd.h"
+
+/* Replacement for Solaris' openat function.
+ <http://www.google.com/search?q=openat+site:docs.sun.com>
+ First, try to simulate it via open ("/proc/self/fd/FD/FILE").
+ Failing that, simulate it by doing save_cwd/fchdir/open/restore_cwd.
+ If either the save_cwd or the restore_cwd fails (relatively unlikely),
+ then give a diagnostic and exit nonzero.
+ Otherwise, upon failure, set errno and return -1, as openat does.
+ Upon successful completion, return a file descriptor. */
+int
+openat (int fd, char const *file, int flags, ...)
+{
+ mode_t mode = 0;
+
+ if (flags & O_CREAT)
+ {
+ va_list arg;
+ va_start (arg, flags);
+
+ /* We have to use PROMOTED_MODE_T instead of mode_t, otherwise GCC 4
+ creates crashing code when 'mode_t' is smaller than 'int'. */
+ mode = va_arg (arg, PROMOTED_MODE_T);
+
+ va_end (arg);
+ }
+
+ return openat_permissive (fd, file, flags, mode, NULL);
+}
+
+/* Like openat (FD, FILE, FLAGS, MODE), but if CWD_ERRNO is
+ nonnull, set *CWD_ERRNO to an errno value if unable to save
+ or restore the initial working directory. This is needed only
+ the first time remove.c's remove_dir opens a command-line
+ directory argument.
+
+ If a previous attempt to restore the current working directory
+ failed, then we must not even try to access a '.'-relative name.
+ It is the caller's responsibility not to call this function
+ in that case. */
+
+int
+openat_permissive (int fd, char const *file, int flags, mode_t mode,
+ int *cwd_errno)
+{
+ struct saved_cwd saved_cwd;
+ int saved_errno;
+ int err;
+ bool save_ok;
+
+ if (fd == AT_FDCWD || IS_ABSOLUTE_FILE_NAME (file))
+ return open (file, flags, mode);
+
+ {
+ char buf[OPENAT_BUFFER_SIZE];
+ char *proc_file = openat_proc_name (buf, fd, file);
+ if (proc_file)
+ {
+ int open_result = open (proc_file, flags, mode);
+ int open_errno = errno;
+ if (proc_file != buf)
+ free (proc_file);
+ /* If the syscall succeeds, or if it fails with an unexpected
+ errno value, then return right away. Otherwise, fall through
+ and resort to using save_cwd/restore_cwd. */
+ if (0 <= open_result || ! EXPECTED_ERRNO (open_errno))
+ {
+ errno = open_errno;
+ return open_result;
+ }
+ }
+ }
+
+ save_ok = (save_cwd (&saved_cwd) == 0);
+ if (! save_ok)
+ {
+ if (! cwd_errno)
+ openat_save_fail (errno);
+ *cwd_errno = errno;
+ }
+ if (0 <= fd && fd == saved_cwd.desc)
+ {
+ /* If saving the working directory collides with the user's
+ requested fd, then the user's fd must have been closed to
+ begin with. */
+ free_cwd (&saved_cwd);
+ errno = EBADF;
+ return -1;
+ }
+
+ err = fchdir (fd);
+ saved_errno = errno;
+
+ if (! err)
+ {
+ err = open (file, flags, mode);
+ saved_errno = errno;
+ if (save_ok && restore_cwd (&saved_cwd) != 0)
+ {
+ if (! cwd_errno)
+ {
+ /* Don't write a message to just-created fd 2. */
+ saved_errno = errno;
+ if (err == STDERR_FILENO)
+ close (err);
+ openat_restore_fail (saved_errno);
+ }
+ *cwd_errno = errno;
+ }
+ }
+
+ free_cwd (&saved_cwd);
+ errno = saved_errno;
+ return err;
+}
+
+/* Return true if our openat implementation must resort to
+ using save_cwd and restore_cwd. */
+bool
+openat_needs_fchdir (void)
+{
+ bool needs_fchdir = true;
+ int fd = open ("/", O_SEARCH);
+
+ if (0 <= fd)
+ {
+ char buf[OPENAT_BUFFER_SIZE];
+ char *proc_file = openat_proc_name (buf, fd, ".");
+ if (proc_file)
+ {
+ needs_fchdir = false;
+ if (proc_file != buf)
+ free (proc_file);
+ }
+ close (fd);
+ }
+
+ return needs_fchdir;
+}
+
+#endif /* !HAVE_OPENAT */
--- /dev/null
+/* provide a replacement openat function
+ Copyright (C) 2004-2006, 2008-2015 Free Software Foundation, Inc.
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+/* written by Jim Meyering */
+
+#ifndef _GL_HEADER_OPENAT
+#define _GL_HEADER_OPENAT
+
+#include <fcntl.h>
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
+#include <stdbool.h>
+
+#ifndef _GL_INLINE_HEADER_BEGIN
+ #error "Please include config.h first."
+#endif
+_GL_INLINE_HEADER_BEGIN
+
+#if !HAVE_OPENAT
+
+int openat_permissive (int fd, char const *file, int flags, mode_t mode,
+ int *cwd_errno);
+bool openat_needs_fchdir (void);
+
+#else
+
+# define openat_permissive(Fd, File, Flags, Mode, Cwd_errno) \
+ openat (Fd, File, Flags, Mode)
+# define openat_needs_fchdir() false
+
+#endif
+
+_Noreturn void openat_restore_fail (int);
+_Noreturn void openat_save_fail (int);
+
+/* Using these function names makes application code
+ slightly more readable than it would be with
+ fchownat (..., 0) or fchownat (..., AT_SYMLINK_NOFOLLOW). */
+
+#if GNULIB_FCHOWNAT
+
+# ifndef FCHOWNAT_INLINE
+# define FCHOWNAT_INLINE _GL_INLINE
+# endif
+
+FCHOWNAT_INLINE int
+chownat (int fd, char const *file, uid_t owner, gid_t group)
+{
+ return fchownat (fd, file, owner, group, 0);
+}
+
+FCHOWNAT_INLINE int
+lchownat (int fd, char const *file, uid_t owner, gid_t group)
+{
+ return fchownat (fd, file, owner, group, AT_SYMLINK_NOFOLLOW);
+}
+
+#endif
+
+#if GNULIB_FCHMODAT
+
+# ifndef FCHMODAT_INLINE
+# define FCHMODAT_INLINE _GL_INLINE
+# endif
+
+FCHMODAT_INLINE int
+chmodat (int fd, char const *file, mode_t mode)
+{
+ return fchmodat (fd, file, mode, 0);
+}
+
+FCHMODAT_INLINE int
+lchmodat (int fd, char const *file, mode_t mode)
+{
+ return fchmodat (fd, file, mode, AT_SYMLINK_NOFOLLOW);
+}
+
+#endif
+
+#if GNULIB_STATAT
+
+# ifndef STATAT_INLINE
+# define STATAT_INLINE _GL_INLINE
+# endif
+
+STATAT_INLINE int
+statat (int fd, char const *name, struct stat *st)
+{
+ return fstatat (fd, name, st, 0);
+}
+
+STATAT_INLINE int
+lstatat (int fd, char const *name, struct stat *st)
+{
+ return fstatat (fd, name, st, AT_SYMLINK_NOFOLLOW);
+}
+
+#endif
+
+/* 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. Likewise,
+ wrappers are not provided for accessat or euidaccessat, so as to
+ avoid dragging in -lgen on some platforms. */
+
+_GL_INLINE_HEADER_END
+
+#endif /* _GL_HEADER_OPENAT */
/* Invoke opendir, but avoid some glitches.
- Copyright (C) 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2009-2015 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
/* Start reading the entries of a directory.
- Copyright (C) 2006-2014 Free Software Foundation, Inc.
+ Copyright (C) 2006-2015 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
-/* A Bison parser, made by GNU Bison 2.7. */
+/* A Bison parser, made by GNU Bison 3.0.2. */
/* Bison implementation for Yacc-like parsers in C
-
- Copyright (C) 1984, 1989-1990, 2000-2012 Free Software Foundation, Inc.
-
+
+ Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc.
+
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
-
+
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
-
+
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
special exception, which will cause the skeleton and the resulting
Bison output files to be licensed under the GNU General Public
License without this special exception.
-
+
This special exception was added by the Free Software Foundation in
version 2.2 of Bison. */
#define YYBISON 1
/* Bison version. */
-#define YYBISON_VERSION "2.7"
+#define YYBISON_VERSION "3.0.2"
/* Skeleton name. */
#define YYSKELETON_NAME "yacc.c"
/* Copy the first part of user declarations. */
-/* Line 371 of yacc.c */
-#line 1 "./parse-datetime.y"
+#line 1 "./parse-datetime.y" /* yacc.c:339 */
/* Parse a string into an internal time stamp.
- Copyright (C) 1999-2000, 2002-2014 Free Software Foundation, Inc.
+ Copyright (C) 1999-2000, 2002-2015 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
}
-/* Line 371 of yacc.c */
-#line 354 "parse-datetime.c"
+#line 352 "parse-datetime.c" /* yacc.c:339 */
-# ifndef YY_NULL
+# ifndef YY_NULLPTR
# if defined __cplusplus && 201103L <= __cplusplus
-# define YY_NULL nullptr
+# define YY_NULLPTR nullptr
# else
-# define YY_NULL 0
+# define YY_NULLPTR 0
# endif
# endif
#endif
-/* Enabling traces. */
+/* Debug traces. */
#ifndef YYDEBUG
# define YYDEBUG 0
#endif
extern int yydebug;
#endif
-/* Tokens. */
+/* Token type. */
#ifndef YYTOKENTYPE
# define YYTOKENTYPE
- /* Put the tokens into the symbol table, so that GDB and other debuggers
- know about them. */
- enum yytokentype {
- tAGO = 258,
- tDST = 259,
- tYEAR_UNIT = 260,
- tMONTH_UNIT = 261,
- tHOUR_UNIT = 262,
- tMINUTE_UNIT = 263,
- tSEC_UNIT = 264,
- tDAY_UNIT = 265,
- tDAY_SHIFT = 266,
- tDAY = 267,
- tDAYZONE = 268,
- tLOCAL_ZONE = 269,
- tMERIDIAN = 270,
- tMONTH = 271,
- tORDINAL = 272,
- tZONE = 273,
- tSNUMBER = 274,
- tUNUMBER = 275,
- tSDECIMAL_NUMBER = 276,
- tUDECIMAL_NUMBER = 277
- };
+ enum yytokentype
+ {
+ tAGO = 258,
+ tDST = 259,
+ tYEAR_UNIT = 260,
+ tMONTH_UNIT = 261,
+ tHOUR_UNIT = 262,
+ tMINUTE_UNIT = 263,
+ tSEC_UNIT = 264,
+ tDAY_UNIT = 265,
+ tDAY_SHIFT = 266,
+ tDAY = 267,
+ tDAYZONE = 268,
+ tLOCAL_ZONE = 269,
+ tMERIDIAN = 270,
+ tMONTH = 271,
+ tORDINAL = 272,
+ tZONE = 273,
+ tSNUMBER = 274,
+ tUNUMBER = 275,
+ tSDECIMAL_NUMBER = 276,
+ tUDECIMAL_NUMBER = 277
+ };
#endif
/* Tokens. */
#define tAGO 258
#define tSDECIMAL_NUMBER 276
#define tUDECIMAL_NUMBER 277
-
-
+/* Value type. */
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
-typedef union YYSTYPE
+typedef union YYSTYPE YYSTYPE;
+union YYSTYPE
{
-/* Line 387 of yacc.c */
-#line 297 "./parse-datetime.y"
+#line 297 "./parse-datetime.y" /* yacc.c:355 */
long int intval;
textint textintval;
struct timespec timespec;
relative_time rel;
-
-/* Line 387 of yacc.c */
-#line 446 "parse-datetime.c"
-} YYSTYPE;
+#line 440 "parse-datetime.c" /* yacc.c:355 */
+};
# define YYSTYPE_IS_TRIVIAL 1
-# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
#endif
-#ifdef YYPARSE_PARAM
-#if defined __STDC__ || defined __cplusplus
-int yyparse (void *YYPARSE_PARAM);
-#else
-int yyparse ();
-#endif
-#else /* ! YYPARSE_PARAM */
-#if defined __STDC__ || defined __cplusplus
+
int yyparse (parser_control *pc);
-#else
-int yyparse ();
-#endif
-#endif /* ! YYPARSE_PARAM */
/* Copy the second part of user declarations. */
-/* Line 390 of yacc.c */
-#line 473 "parse-datetime.c"
+#line 454 "parse-datetime.c" /* yacc.c:358 */
#ifdef short
# undef short
#ifdef YYTYPE_INT8
typedef YYTYPE_INT8 yytype_int8;
-#elif (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
-typedef signed char yytype_int8;
#else
-typedef short int yytype_int8;
+typedef signed char yytype_int8;
#endif
#ifdef YYTYPE_UINT16
# define YYSIZE_T __SIZE_TYPE__
# elif defined size_t
# define YYSIZE_T size_t
-# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
+# elif ! defined YYSIZE_T
# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
# define YYSIZE_T size_t
# else
# endif
#endif
+#ifndef YY_ATTRIBUTE
+# if (defined __GNUC__ \
+ && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \
+ || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C
+# define YY_ATTRIBUTE(Spec) __attribute__(Spec)
+# else
+# define YY_ATTRIBUTE(Spec) /* empty */
+# endif
+#endif
+
+#ifndef YY_ATTRIBUTE_PURE
+# define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__))
+#endif
+
+#ifndef YY_ATTRIBUTE_UNUSED
+# define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__))
+#endif
+
+#if !defined _Noreturn \
+ && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112)
+# if defined _MSC_VER && 1200 <= _MSC_VER
+# define _Noreturn __declspec (noreturn)
+# else
+# define _Noreturn YY_ATTRIBUTE ((__noreturn__))
+# endif
+#endif
+
/* Suppress unused-variable warnings by "using" E. */
#if ! defined lint || defined __GNUC__
# define YYUSE(E) ((void) (E))
# define YYUSE(E) /* empty */
#endif
-/* Identity function, used to suppress warnings about constant conditions. */
-#ifndef lint
-# define YYID(N) (N)
-#else
-#if (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
-static int
-YYID (int yyi)
+#if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
+/* Suppress an incorrect diagnostic about yylval being uninitialized. */
+# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
+ _Pragma ("GCC diagnostic push") \
+ _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\
+ _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
+# define YY_IGNORE_MAYBE_UNINITIALIZED_END \
+ _Pragma ("GCC diagnostic pop")
#else
-static int
-YYID (yyi)
- int yyi;
+# define YY_INITIAL_VALUE(Value) Value
#endif
-{
- return yyi;
-}
+#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
+# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
+# define YY_IGNORE_MAYBE_UNINITIALIZED_END
+#endif
+#ifndef YY_INITIAL_VALUE
+# define YY_INITIAL_VALUE(Value) /* Nothing. */
#endif
+
#if ! defined yyoverflow || YYERROR_VERBOSE
/* The parser invokes alloca or malloc; define the necessary symbols. */
# define alloca _alloca
# else
# define YYSTACK_ALLOC alloca
-# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
+# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS
# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
/* Use EXIT_SUCCESS as a witness for stdlib.h. */
# ifndef EXIT_SUCCESS
# endif
# ifdef YYSTACK_ALLOC
- /* Pacify GCC's `empty if-body' warning. */
-# define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
+ /* Pacify GCC's 'empty if-body' warning. */
+# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
# ifndef YYSTACK_ALLOC_MAXIMUM
/* The OS might guarantee only one guard page at the bottom of the stack,
and a page size can be as small as 4096 bytes. So we cannot safely
# endif
# if (defined __cplusplus && ! defined EXIT_SUCCESS \
&& ! ((defined YYMALLOC || defined malloc) \
- && (defined YYFREE || defined free)))
+ && (defined YYFREE || defined free)))
# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
# ifndef EXIT_SUCCESS
# define EXIT_SUCCESS 0
# endif
# ifndef YYMALLOC
# define YYMALLOC malloc
-# if ! defined malloc && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
+# if ! defined malloc && ! defined EXIT_SUCCESS
void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
# endif
# endif
# ifndef YYFREE
# define YYFREE free
-# if ! defined free && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
+# if ! defined free && ! defined EXIT_SUCCESS
void free (void *); /* INFRINGES ON USER NAME SPACE */
# endif
# endif
#if (! defined yyoverflow \
&& (! defined __cplusplus \
- || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
+ || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
/* A type that is properly aligned for any stack member. */
union yyalloc
elements in the stack, and YYPTR gives the new location of the
stack. Advance YYPTR to a properly aligned location for the next
stack. */
-# define YYSTACK_RELOCATE(Stack_alloc, Stack) \
- do \
- { \
- YYSIZE_T yynewbytes; \
- YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
- Stack = &yyptr->Stack_alloc; \
- yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
- yyptr += yynewbytes / sizeof (*yyptr); \
- } \
- while (YYID (0))
+# define YYSTACK_RELOCATE(Stack_alloc, Stack) \
+ do \
+ { \
+ YYSIZE_T yynewbytes; \
+ YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
+ Stack = &yyptr->Stack_alloc; \
+ yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
+ yyptr += yynewbytes / sizeof (*yyptr); \
+ } \
+ while (0)
#endif
for (yyi = 0; yyi < (Count); yyi++) \
(Dst)[yyi] = (Src)[yyi]; \
} \
- while (YYID (0))
+ while (0)
# endif
# endif
#endif /* !YYCOPY_NEEDED */
#define YYNNTS 26
/* YYNRULES -- Number of rules. */
#define YYNRULES 91
-/* YYNRULES -- Number of states. */
+/* YYNSTATES -- Number of states. */
#define YYNSTATES 114
-/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
+/* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned
+ by yylex, with out-of-bounds checking. */
#define YYUNDEFTOK 2
#define YYMAXUTOK 277
-#define YYTRANSLATE(YYX) \
+#define YYTRANSLATE(YYX) \
((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
-/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
+/* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
+ as returned by yylex, without out-of-bounds checking. */
static const yytype_uint8 yytranslate[] =
{
0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
};
#if YYDEBUG
-/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
- YYRHS. */
-static const yytype_uint8 yyprhs[] =
-{
- 0, 0, 3, 5, 7, 10, 11, 14, 16, 18,
- 20, 22, 24, 26, 28, 30, 32, 34, 38, 41,
- 46, 53, 55, 58, 63, 70, 71, 73, 76, 78,
- 81, 83, 85, 88, 91, 95, 97, 100, 102, 105,
- 108, 111, 115, 121, 125, 129, 132, 137, 140, 144,
- 146, 150, 153, 155, 157, 160, 163, 165, 168, 171,
- 173, 176, 179, 181, 184, 187, 189, 192, 195, 197,
- 200, 203, 206, 209, 211, 213, 216, 219, 222, 225,
- 228, 231, 233, 235, 237, 239, 241, 243, 245, 247,
- 250, 251
-};
-
-/* YYRHS -- A `-1'-separated list of the rules' RHS. */
-static const yytype_int8 yyrhs[] =
-{
- 29, 0, -1, 30, -1, 31, -1, 23, 48, -1,
- -1, 31, 32, -1, 33, -1, 35, -1, 39, -1,
- 40, -1, 42, -1, 41, -1, 44, -1, 51, -1,
- 52, -1, 34, -1, 43, 24, 36, -1, 20, 15,
- -1, 20, 25, 20, 15, -1, 20, 25, 20, 25,
- 50, 15, -1, 36, -1, 20, 38, -1, 20, 25,
- 20, 37, -1, 20, 25, 20, 25, 50, 37, -1,
- -1, 38, -1, 19, 53, -1, 14, -1, 14, 4,
- -1, 18, -1, 24, -1, 18, 46, -1, 24, 46,
- -1, 18, 19, 53, -1, 13, -1, 18, 4, -1,
- 12, -1, 12, 26, -1, 17, 12, -1, 20, 12,
- -1, 20, 27, 20, -1, 20, 27, 20, 27, 20,
- -1, 20, 16, 19, -1, 16, 19, 19, -1, 16,
- 20, -1, 16, 20, 26, 20, -1, 20, 16, -1,
- 20, 16, 20, -1, 43, -1, 20, 19, 19, -1,
- 45, 3, -1, 45, -1, 47, -1, 17, 5, -1,
- 20, 5, -1, 5, -1, 17, 6, -1, 20, 6,
- -1, 6, -1, 17, 10, -1, 20, 10, -1, 10,
- -1, 17, 7, -1, 20, 7, -1, 7, -1, 17,
- 8, -1, 20, 8, -1, 8, -1, 17, 9, -1,
- 20, 9, -1, 21, 9, -1, 22, 9, -1, 9,
- -1, 46, -1, 19, 5, -1, 19, 6, -1, 19,
- 10, -1, 19, 7, -1, 19, 8, -1, 19, 9,
- -1, 11, -1, 49, -1, 50, -1, 21, -1, 19,
- -1, 22, -1, 20, -1, 20, -1, 20, 46, -1,
- -1, 25, 20, -1
-};
-
-/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
+ /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
static const yytype_uint16 yyrline[] =
{
0, 324, 324, 325, 329, 336, 338, 342, 344, 346,
"iso_8601_time", "o_zone_offset", "zone_offset", "local_zone", "zone",
"day", "date", "iso_8601_date", "rel", "relunit", "relunit_snumber",
"dayshift", "seconds", "signed_seconds", "unsigned_seconds", "number",
- "hybrid", "o_colon_minutes", YY_NULL
+ "hybrid", "o_colon_minutes", YY_NULLPTR
};
#endif
# ifdef YYPRINT
-/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
- token YYLEX-NUM. */
+/* YYTOKNUM[NUM] -- (External) token number corresponding to the
+ (internal) symbol number NUM (which must be that of a token). */
static const yytype_uint16 yytoknum[] =
{
0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
};
# endif
-/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
-static const yytype_uint8 yyr1[] =
-{
- 0, 28, 29, 29, 30, 31, 31, 32, 32, 32,
- 32, 32, 32, 32, 32, 32, 33, 34, 35, 35,
- 35, 35, 36, 36, 36, 37, 37, 38, 39, 39,
- 40, 40, 40, 40, 40, 40, 40, 41, 41, 41,
- 41, 42, 42, 42, 42, 42, 42, 42, 42, 42,
- 43, 44, 44, 44, 45, 45, 45, 45, 45, 45,
- 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
- 45, 45, 45, 45, 45, 46, 46, 46, 46, 46,
- 46, 47, 48, 48, 49, 49, 50, 50, 51, 52,
- 53, 53
-};
+#define YYPACT_NINF -93
-/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
-static const yytype_uint8 yyr2[] =
-{
- 0, 2, 1, 1, 2, 0, 2, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 3, 2, 4,
- 6, 1, 2, 4, 6, 0, 1, 2, 1, 2,
- 1, 1, 2, 2, 3, 1, 2, 1, 2, 2,
- 2, 3, 5, 3, 3, 2, 4, 2, 3, 1,
- 3, 2, 1, 1, 2, 2, 1, 2, 2, 1,
- 2, 2, 1, 2, 2, 1, 2, 2, 1, 2,
- 2, 2, 2, 1, 1, 2, 2, 2, 2, 2,
- 2, 1, 1, 1, 1, 1, 1, 1, 1, 2,
- 0, 2
-};
+#define yypact_value_is_default(Yystate) \
+ (!!((Yystate) == (-93)))
-/* YYDEFACT[STATE-NAME] -- Default reduction number in state STATE-NUM.
- Performed when YYTABLE doesn't specify something else to do. Zero
- means the default is an error. */
-static const yytype_uint8 yydefact[] =
-{
- 5, 0, 0, 2, 3, 85, 87, 84, 86, 4,
- 82, 83, 1, 56, 59, 65, 68, 73, 62, 81,
- 37, 35, 28, 0, 0, 30, 0, 88, 0, 0,
- 31, 6, 7, 16, 8, 21, 9, 10, 12, 11,
- 49, 13, 52, 74, 53, 14, 15, 38, 29, 0,
- 45, 54, 57, 63, 66, 69, 60, 39, 36, 90,
- 32, 75, 76, 78, 79, 80, 77, 55, 58, 64,
- 67, 70, 61, 40, 18, 47, 90, 0, 0, 22,
- 89, 71, 72, 33, 0, 51, 44, 0, 0, 34,
- 43, 48, 50, 27, 25, 41, 0, 17, 46, 91,
- 19, 90, 0, 23, 26, 0, 0, 25, 42, 25,
- 20, 24, 0, 25
-};
+#define YYTABLE_NINF -1
-/* YYDEFGOTO[NTERM-NUM]. */
-static const yytype_int8 yydefgoto[] =
-{
- -1, 2, 3, 4, 31, 32, 33, 34, 35, 103,
- 104, 36, 37, 38, 39, 40, 41, 42, 43, 44,
- 9, 10, 11, 45, 46, 93
-};
+#define yytable_value_is_error(Yytable_value) \
+ 0
-/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
- STATE-NUM. */
-#define YYPACT_NINF -93
+ /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
+ STATE-NUM. */
static const yytype_int8 yypact[] =
{
38, 27, 77, -93, 46, -93, -93, -93, -93, -93,
-93, -93, 69, 91
};
-/* YYPGOTO[NTERM-NUM]. */
+ /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
+ Performed when YYTABLE does not specify something else to do. Zero
+ means the default is an error. */
+static const yytype_uint8 yydefact[] =
+{
+ 5, 0, 0, 2, 3, 85, 87, 84, 86, 4,
+ 82, 83, 1, 56, 59, 65, 68, 73, 62, 81,
+ 37, 35, 28, 0, 0, 30, 0, 88, 0, 0,
+ 31, 6, 7, 16, 8, 21, 9, 10, 12, 11,
+ 49, 13, 52, 74, 53, 14, 15, 38, 29, 0,
+ 45, 54, 57, 63, 66, 69, 60, 39, 36, 90,
+ 32, 75, 76, 78, 79, 80, 77, 55, 58, 64,
+ 67, 70, 61, 40, 18, 47, 90, 0, 0, 22,
+ 89, 71, 72, 33, 0, 51, 44, 0, 0, 34,
+ 43, 48, 50, 27, 25, 41, 0, 17, 46, 91,
+ 19, 90, 0, 23, 26, 0, 0, 25, 42, 25,
+ 20, 24, 0, 25
+};
+
+ /* YYPGOTO[NTERM-NUM]. */
static const yytype_int8 yypgoto[] =
{
-93, -93, -93, -93, -93, -93, -93, -93, 20, -68,
-93, -93, -92, -93, -93, 43
};
-/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
- positive, shift that token. If negative, reduce the rule which
- number is the opposite. If YYTABLE_NINF, syntax error. */
-#define YYTABLE_NINF -1
+ /* YYDEFGOTO[NTERM-NUM]. */
+static const yytype_int8 yydefgoto[] =
+{
+ -1, 2, 3, 4, 31, 32, 33, 34, 35, 103,
+ 104, 36, 37, 38, 39, 40, 41, 42, 43, 44,
+ 9, 10, 11, 45, 46, 93
+};
+
+ /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
+ positive, shift that token. If negative, reduce the rule whose
+ number is the opposite. If YYTABLE_NINF, syntax error. */
static const yytype_uint8 yytable[] =
{
79, 67, 68, 69, 70, 71, 72, 58, 73, 100,
101, 0, 88
};
-#define yypact_value_is_default(Yystate) \
- (!!((Yystate) == (-93)))
-
-#define yytable_value_is_error(Yytable_value) \
- YYID (0)
-
static const yytype_int8 yycheck[] =
{
27, 5, 6, 7, 8, 9, 10, 4, 12, 15,
19, -1, 25
};
-/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
- symbol of state STATE-NUM. */
+ /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
+ symbol of state STATE-NUM. */
static const yytype_uint8 yystos[] =
{
0, 23, 29, 30, 31, 19, 20, 21, 22, 48,
15, 37, 25, 50
};
-#define yyerrok (yyerrstatus = 0)
-#define yyclearin (yychar = YYEMPTY)
-#define YYEMPTY (-2)
-#define YYEOF 0
-
-#define YYACCEPT goto yyacceptlab
-#define YYABORT goto yyabortlab
-#define YYERROR goto yyerrorlab
-
-
-/* Like YYERROR except do call yyerror. This remains here temporarily
- to ease the transition to the new meaning of YYERROR, for GCC.
- Once GCC version 2 has supplanted version 1, this can go. However,
- YYFAIL appears to be in use. Nevertheless, it is formally deprecated
- in Bison 2.4.2's NEWS entry, where a plan to phase it out is
- discussed. */
-
-#define YYFAIL goto yyerrlab
-#if defined YYFAIL
- /* This is here to suppress warnings from the GCC cpp's
- -Wunused-macros. Normally we don't worry about that warning, but
- some users do, and we want to make it easy for users to remove
- YYFAIL uses, which will produce warnings from Bison 2.5. */
-#endif
+ /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
+static const yytype_uint8 yyr1[] =
+{
+ 0, 28, 29, 29, 30, 31, 31, 32, 32, 32,
+ 32, 32, 32, 32, 32, 32, 33, 34, 35, 35,
+ 35, 35, 36, 36, 36, 37, 37, 38, 39, 39,
+ 40, 40, 40, 40, 40, 40, 40, 41, 41, 41,
+ 41, 42, 42, 42, 42, 42, 42, 42, 42, 42,
+ 43, 44, 44, 44, 45, 45, 45, 45, 45, 45,
+ 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
+ 45, 45, 45, 45, 45, 46, 46, 46, 46, 46,
+ 46, 47, 48, 48, 49, 49, 50, 50, 51, 52,
+ 53, 53
+};
+
+ /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */
+static const yytype_uint8 yyr2[] =
+{
+ 0, 2, 1, 1, 2, 0, 2, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 3, 2, 4,
+ 6, 1, 2, 4, 6, 0, 1, 2, 1, 2,
+ 1, 1, 2, 2, 3, 1, 2, 1, 2, 2,
+ 2, 3, 5, 3, 3, 2, 4, 2, 3, 1,
+ 3, 2, 1, 1, 2, 2, 1, 2, 2, 1,
+ 2, 2, 1, 2, 2, 1, 2, 2, 1, 2,
+ 2, 2, 2, 1, 1, 2, 2, 2, 2, 2,
+ 2, 1, 1, 1, 1, 1, 1, 1, 1, 2,
+ 0, 2
+};
+
+
+#define yyerrok (yyerrstatus = 0)
+#define yyclearin (yychar = YYEMPTY)
+#define YYEMPTY (-2)
+#define YYEOF 0
+
+#define YYACCEPT goto yyacceptlab
+#define YYABORT goto yyabortlab
+#define YYERROR goto yyerrorlab
+
#define YYRECOVERING() (!!yyerrstatus)
else \
{ \
yyerror (pc, YY_("syntax error: cannot back up")); \
- YYERROR; \
- } \
-while (YYID (0))
+ YYERROR; \
+ } \
+while (0)
/* Error token number */
-#define YYTERROR 1
-#define YYERRCODE 256
+#define YYTERROR 1
+#define YYERRCODE 256
-/* This macro is provided for backward compatibility. */
-#ifndef YY_LOCATION_PRINT
-# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
-#endif
-
-
-/* YYLEX -- calling `yylex' with the right arguments. */
-#ifdef YYLEX_PARAM
-# define YYLEX yylex (&yylval, YYLEX_PARAM)
-#else
-# define YYLEX yylex (&yylval, pc)
-#endif
/* Enable debugging if requested. */
#if YYDEBUG
# define YYFPRINTF fprintf
# endif
-# define YYDPRINTF(Args) \
-do { \
- if (yydebug) \
- YYFPRINTF Args; \
-} while (YYID (0))
+# define YYDPRINTF(Args) \
+do { \
+ if (yydebug) \
+ YYFPRINTF Args; \
+} while (0)
-# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
-do { \
- if (yydebug) \
- { \
- YYFPRINTF (stderr, "%s ", Title); \
- yy_symbol_print (stderr, \
- Type, Value, pc); \
- YYFPRINTF (stderr, "\n"); \
- } \
-} while (YYID (0))
+/* This macro is provided for backward compatibility. */
+#ifndef YY_LOCATION_PRINT
+# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
+#endif
-/*--------------------------------.
-| Print this symbol on YYOUTPUT. |
-`--------------------------------*/
+# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
+do { \
+ if (yydebug) \
+ { \
+ YYFPRINTF (stderr, "%s ", Title); \
+ yy_symbol_print (stderr, \
+ Type, Value, pc); \
+ YYFPRINTF (stderr, "\n"); \
+ } \
+} while (0)
+
+
+/*----------------------------------------.
+| Print this symbol's value on YYOUTPUT. |
+`----------------------------------------*/
-/*ARGSUSED*/
-#if (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
static void
yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, parser_control *pc)
-#else
-static void
-yy_symbol_value_print (yyoutput, yytype, yyvaluep, pc)
- FILE *yyoutput;
- int yytype;
- YYSTYPE const * const yyvaluep;
- parser_control *pc;
-#endif
{
FILE *yyo = yyoutput;
YYUSE (yyo);
+ YYUSE (pc);
if (!yyvaluep)
return;
- YYUSE (pc);
# ifdef YYPRINT
if (yytype < YYNTOKENS)
YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
-# else
- YYUSE (yyoutput);
# endif
- switch (yytype)
- {
- default:
- break;
- }
+ YYUSE (yytype);
}
| Print this symbol on YYOUTPUT. |
`--------------------------------*/
-#if (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
static void
yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, parser_control *pc)
-#else
-static void
-yy_symbol_print (yyoutput, yytype, yyvaluep, pc)
- FILE *yyoutput;
- int yytype;
- YYSTYPE const * const yyvaluep;
- parser_control *pc;
-#endif
{
- if (yytype < YYNTOKENS)
- YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
- else
- YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
+ YYFPRINTF (yyoutput, "%s %s (",
+ yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]);
yy_symbol_value_print (yyoutput, yytype, yyvaluep, pc);
YYFPRINTF (yyoutput, ")");
| TOP (included). |
`------------------------------------------------------------------*/
-#if (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
static void
yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
-#else
-static void
-yy_stack_print (yybottom, yytop)
- yytype_int16 *yybottom;
- yytype_int16 *yytop;
-#endif
{
YYFPRINTF (stderr, "Stack now");
for (; yybottom <= yytop; yybottom++)
YYFPRINTF (stderr, "\n");
}
-# define YY_STACK_PRINT(Bottom, Top) \
-do { \
- if (yydebug) \
- yy_stack_print ((Bottom), (Top)); \
-} while (YYID (0))
+# define YY_STACK_PRINT(Bottom, Top) \
+do { \
+ if (yydebug) \
+ yy_stack_print ((Bottom), (Top)); \
+} while (0)
/*------------------------------------------------.
| Report that the YYRULE is going to be reduced. |
`------------------------------------------------*/
-#if (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
static void
-yy_reduce_print (YYSTYPE *yyvsp, int yyrule, parser_control *pc)
-#else
-static void
-yy_reduce_print (yyvsp, yyrule, pc)
- YYSTYPE *yyvsp;
- int yyrule;
- parser_control *pc;
-#endif
+yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, int yyrule, parser_control *pc)
{
+ unsigned long int yylno = yyrline[yyrule];
int yynrhs = yyr2[yyrule];
int yyi;
- unsigned long int yylno = yyrline[yyrule];
YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
- yyrule - 1, yylno);
+ yyrule - 1, yylno);
/* The symbols being reduced. */
for (yyi = 0; yyi < yynrhs; yyi++)
{
YYFPRINTF (stderr, " $%d = ", yyi + 1);
- yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
- &(yyvsp[(yyi + 1) - (yynrhs)])
- , pc);
+ yy_symbol_print (stderr,
+ yystos[yyssp[yyi + 1 - yynrhs]],
+ &(yyvsp[(yyi + 1) - (yynrhs)])
+ , pc);
YYFPRINTF (stderr, "\n");
}
}
-# define YY_REDUCE_PRINT(Rule) \
-do { \
- if (yydebug) \
- yy_reduce_print (yyvsp, Rule, pc); \
-} while (YYID (0))
+# define YY_REDUCE_PRINT(Rule) \
+do { \
+ if (yydebug) \
+ yy_reduce_print (yyssp, yyvsp, Rule, pc); \
+} while (0)
/* Nonzero means print parse trace. It is left uninitialized so that
multiple parsers can coexist. */
/* YYINITDEPTH -- initial size of the parser's stacks. */
-#ifndef YYINITDEPTH
+#ifndef YYINITDEPTH
# define YYINITDEPTH 200
#endif
# define yystrlen strlen
# else
/* Return the length of YYSTR. */
-#if (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
static YYSIZE_T
yystrlen (const char *yystr)
-#else
-static YYSIZE_T
-yystrlen (yystr)
- const char *yystr;
-#endif
{
YYSIZE_T yylen;
for (yylen = 0; yystr[yylen]; yylen++)
# else
/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
YYDEST. */
-#if (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
static char *
yystpcpy (char *yydest, const char *yysrc)
-#else
-static char *
-yystpcpy (yydest, yysrc)
- char *yydest;
- const char *yysrc;
-#endif
{
char *yyd = yydest;
const char *yys = yysrc;
char const *yyp = yystr;
for (;;)
- switch (*++yyp)
- {
- case '\'':
- case ',':
- goto do_not_strip_quotes;
-
- case '\\':
- if (*++yyp != '\\')
- goto do_not_strip_quotes;
- /* Fall through. */
- default:
- if (yyres)
- yyres[yyn] = *yyp;
- yyn++;
- break;
-
- case '"':
- if (yyres)
- yyres[yyn] = '\0';
- return yyn;
- }
+ switch (*++yyp)
+ {
+ case '\'':
+ case ',':
+ goto do_not_strip_quotes;
+
+ case '\\':
+ if (*++yyp != '\\')
+ goto do_not_strip_quotes;
+ /* Fall through. */
+ default:
+ if (yyres)
+ yyres[yyn] = *yyp;
+ yyn++;
+ break;
+
+ case '"':
+ if (yyres)
+ yyres[yyn] = '\0';
+ return yyn;
+ }
do_not_strip_quotes: ;
}
yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
yytype_int16 *yyssp, int yytoken)
{
- YYSIZE_T yysize0 = yytnamerr (YY_NULL, yytname[yytoken]);
+ YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]);
YYSIZE_T yysize = yysize0;
enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
/* Internationalized format string. */
- const char *yyformat = YY_NULL;
+ const char *yyformat = YY_NULLPTR;
/* Arguments of yyformat. */
char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
/* Number of reported tokens (one for the "unexpected", one per
int yycount = 0;
/* There are many possibilities here to consider:
- - Assume YYFAIL is not used. It's too flawed to consider. See
- <http://lists.gnu.org/archive/html/bison-patches/2009-12/msg00024.html>
- for details. YYERROR is fine as it does not invoke this
- function.
- If this state is a consistent state with a default action, then
the only way this function was invoked is if the default action
is an error action. In that case, don't check for expected
}
yyarg[yycount++] = yytname[yyx];
{
- YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULL, yytname[yyx]);
+ YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]);
if (! (yysize <= yysize1
&& yysize1 <= YYSTACK_ALLOC_MAXIMUM))
return 2;
| Release the memory associated to this symbol. |
`-----------------------------------------------*/
-/*ARGSUSED*/
-#if (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
static void
yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, parser_control *pc)
-#else
-static void
-yydestruct (yymsg, yytype, yyvaluep, pc)
- const char *yymsg;
- int yytype;
- YYSTYPE *yyvaluep;
- parser_control *pc;
-#endif
{
YYUSE (yyvaluep);
YYUSE (pc);
-
if (!yymsg)
yymsg = "Deleting";
YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
- switch (yytype)
- {
-
- default:
- break;
- }
+ YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
+ YYUSE (yytype);
+ YY_IGNORE_MAYBE_UNINITIALIZED_END
}
| yyparse. |
`----------*/
-#ifdef YYPARSE_PARAM
-#if (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
-int
-yyparse (void *YYPARSE_PARAM)
-#else
-int
-yyparse (YYPARSE_PARAM)
- void *YYPARSE_PARAM;
-#endif
-#else /* ! YYPARSE_PARAM */
-#if (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
int
yyparse (parser_control *pc)
-#else
-int
-yyparse (pc)
- parser_control *pc;
-#endif
-#endif
{
/* The lookahead symbol. */
int yychar;
-#if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
-/* Suppress an incorrect diagnostic about yylval being uninitialized. */
-# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
- _Pragma ("GCC diagnostic push") \
- _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\
- _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
-# define YY_IGNORE_MAYBE_UNINITIALIZED_END \
- _Pragma ("GCC diagnostic pop")
-#else
+/* The semantic value of the lookahead symbol. */
/* Default value used for initialization, for pacifying older GCCs
or non-GCC compilers. */
-static YYSTYPE yyval_default;
-# define YY_INITIAL_VALUE(Value) = Value
-#endif
-#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
-# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
-# define YY_IGNORE_MAYBE_UNINITIALIZED_END
-#endif
-#ifndef YY_INITIAL_VALUE
-# define YY_INITIAL_VALUE(Value) /* Nothing. */
-#endif
-
-/* The semantic value of the lookahead symbol. */
-YYSTYPE yylval YY_INITIAL_VALUE(yyval_default);
+YY_INITIAL_VALUE (static YYSTYPE yyval_default;)
+YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default);
/* Number of syntax errors so far. */
int yynerrs;
int yyerrstatus;
/* The stacks and their tools:
- `yyss': related to states.
- `yyvs': related to semantic values.
+ 'yyss': related to states.
+ 'yyvs': related to semantic values.
Refer to the stacks through separate pointers, to allow yyoverflow
to reallocate them elsewhere. */
#ifdef yyoverflow
{
- /* Give user a chance to reallocate the stack. Use copies of
- these so that the &'s don't force the real ones into
- memory. */
- YYSTYPE *yyvs1 = yyvs;
- yytype_int16 *yyss1 = yyss;
-
- /* Each stack pointer address is followed by the size of the
- data in use in that stack, in bytes. This used to be a
- conditional around just the two extra args, but that might
- be undefined if yyoverflow is a macro. */
- yyoverflow (YY_("memory exhausted"),
- &yyss1, yysize * sizeof (*yyssp),
- &yyvs1, yysize * sizeof (*yyvsp),
- &yystacksize);
-
- yyss = yyss1;
- yyvs = yyvs1;
+ /* Give user a chance to reallocate the stack. Use copies of
+ these so that the &'s don't force the real ones into
+ memory. */
+ YYSTYPE *yyvs1 = yyvs;
+ yytype_int16 *yyss1 = yyss;
+
+ /* Each stack pointer address is followed by the size of the
+ data in use in that stack, in bytes. This used to be a
+ conditional around just the two extra args, but that might
+ be undefined if yyoverflow is a macro. */
+ yyoverflow (YY_("memory exhausted"),
+ &yyss1, yysize * sizeof (*yyssp),
+ &yyvs1, yysize * sizeof (*yyvsp),
+ &yystacksize);
+
+ yyss = yyss1;
+ yyvs = yyvs1;
}
#else /* no yyoverflow */
# ifndef YYSTACK_RELOCATE
# else
/* Extend the stack our own way. */
if (YYMAXDEPTH <= yystacksize)
- goto yyexhaustedlab;
+ goto yyexhaustedlab;
yystacksize *= 2;
if (YYMAXDEPTH < yystacksize)
- yystacksize = YYMAXDEPTH;
+ yystacksize = YYMAXDEPTH;
{
- yytype_int16 *yyss1 = yyss;
- union yyalloc *yyptr =
- (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
- if (! yyptr)
- goto yyexhaustedlab;
- YYSTACK_RELOCATE (yyss_alloc, yyss);
- YYSTACK_RELOCATE (yyvs_alloc, yyvs);
+ yytype_int16 *yyss1 = yyss;
+ union yyalloc *yyptr =
+ (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
+ if (! yyptr)
+ goto yyexhaustedlab;
+ YYSTACK_RELOCATE (yyss_alloc, yyss);
+ YYSTACK_RELOCATE (yyvs_alloc, yyvs);
# undef YYSTACK_RELOCATE
- if (yyss1 != yyssa)
- YYSTACK_FREE (yyss1);
+ if (yyss1 != yyssa)
+ YYSTACK_FREE (yyss1);
}
# endif
#endif /* no yyoverflow */
yyvsp = yyvs + yysize - 1;
YYDPRINTF ((stderr, "Stack size increased to %lu\n",
- (unsigned long int) yystacksize));
+ (unsigned long int) yystacksize));
if (yyss + yystacksize - 1 <= yyssp)
- YYABORT;
+ YYABORT;
}
YYDPRINTF ((stderr, "Entering state %d\n", yystate));
if (yychar == YYEMPTY)
{
YYDPRINTF ((stderr, "Reading a token: "));
- yychar = YYLEX;
+ yychar = yylex (&yylval, pc);
}
if (yychar <= YYEOF)
yylen = yyr2[yyn];
/* If YYLEN is nonzero, implement the default value of the action:
- `$$ = $1'.
+ '$$ = $1'.
Otherwise, the following line sets YYVAL to garbage.
This behavior is undocumented and Bison
switch (yyn)
{
case 4:
-/* Line 1792 of yacc.c */
-#line 330 "./parse-datetime.y"
+#line 330 "./parse-datetime.y" /* yacc.c:1646 */
{
- pc->seconds = (yyvsp[(2) - (2)].timespec);
+ pc->seconds = (yyvsp[0].timespec);
pc->timespec_seen = true;
}
+#line 1626 "parse-datetime.c" /* yacc.c:1646 */
break;
case 7:
-/* Line 1792 of yacc.c */
-#line 343 "./parse-datetime.y"
+#line 343 "./parse-datetime.y" /* yacc.c:1646 */
{ pc->times_seen++; pc->dates_seen++; }
+#line 1632 "parse-datetime.c" /* yacc.c:1646 */
break;
case 8:
-/* Line 1792 of yacc.c */
-#line 345 "./parse-datetime.y"
+#line 345 "./parse-datetime.y" /* yacc.c:1646 */
{ pc->times_seen++; }
+#line 1638 "parse-datetime.c" /* yacc.c:1646 */
break;
case 9:
-/* Line 1792 of yacc.c */
-#line 347 "./parse-datetime.y"
+#line 347 "./parse-datetime.y" /* yacc.c:1646 */
{ pc->local_zones_seen++; }
+#line 1644 "parse-datetime.c" /* yacc.c:1646 */
break;
case 10:
-/* Line 1792 of yacc.c */
-#line 349 "./parse-datetime.y"
+#line 349 "./parse-datetime.y" /* yacc.c:1646 */
{ pc->zones_seen++; }
+#line 1650 "parse-datetime.c" /* yacc.c:1646 */
break;
case 11:
-/* Line 1792 of yacc.c */
-#line 351 "./parse-datetime.y"
+#line 351 "./parse-datetime.y" /* yacc.c:1646 */
{ pc->dates_seen++; }
+#line 1656 "parse-datetime.c" /* yacc.c:1646 */
break;
case 12:
-/* Line 1792 of yacc.c */
-#line 353 "./parse-datetime.y"
+#line 353 "./parse-datetime.y" /* yacc.c:1646 */
{ pc->days_seen++; }
+#line 1662 "parse-datetime.c" /* yacc.c:1646 */
break;
case 18:
-/* Line 1792 of yacc.c */
-#line 369 "./parse-datetime.y"
+#line 369 "./parse-datetime.y" /* yacc.c:1646 */
{
- set_hhmmss (pc, (yyvsp[(1) - (2)].textintval).value, 0, 0, 0);
- pc->meridian = (yyvsp[(2) - (2)].intval);
+ set_hhmmss (pc, (yyvsp[-1].textintval).value, 0, 0, 0);
+ pc->meridian = (yyvsp[0].intval);
}
+#line 1671 "parse-datetime.c" /* yacc.c:1646 */
break;
case 19:
-/* Line 1792 of yacc.c */
-#line 374 "./parse-datetime.y"
+#line 374 "./parse-datetime.y" /* yacc.c:1646 */
{
- set_hhmmss (pc, (yyvsp[(1) - (4)].textintval).value, (yyvsp[(3) - (4)].textintval).value, 0, 0);
- pc->meridian = (yyvsp[(4) - (4)].intval);
+ set_hhmmss (pc, (yyvsp[-3].textintval).value, (yyvsp[-1].textintval).value, 0, 0);
+ pc->meridian = (yyvsp[0].intval);
}
+#line 1680 "parse-datetime.c" /* yacc.c:1646 */
break;
case 20:
-/* Line 1792 of yacc.c */
-#line 379 "./parse-datetime.y"
+#line 379 "./parse-datetime.y" /* yacc.c:1646 */
{
- set_hhmmss (pc, (yyvsp[(1) - (6)].textintval).value, (yyvsp[(3) - (6)].textintval).value, (yyvsp[(5) - (6)].timespec).tv_sec, (yyvsp[(5) - (6)].timespec).tv_nsec);
- pc->meridian = (yyvsp[(6) - (6)].intval);
+ set_hhmmss (pc, (yyvsp[-5].textintval).value, (yyvsp[-3].textintval).value, (yyvsp[-1].timespec).tv_sec, (yyvsp[-1].timespec).tv_nsec);
+ pc->meridian = (yyvsp[0].intval);
}
+#line 1689 "parse-datetime.c" /* yacc.c:1646 */
break;
case 22:
-/* Line 1792 of yacc.c */
-#line 388 "./parse-datetime.y"
+#line 388 "./parse-datetime.y" /* yacc.c:1646 */
{
- set_hhmmss (pc, (yyvsp[(1) - (2)].textintval).value, 0, 0, 0);
+ set_hhmmss (pc, (yyvsp[-1].textintval).value, 0, 0, 0);
pc->meridian = MER24;
}
+#line 1698 "parse-datetime.c" /* yacc.c:1646 */
break;
case 23:
-/* Line 1792 of yacc.c */
-#line 393 "./parse-datetime.y"
+#line 393 "./parse-datetime.y" /* yacc.c:1646 */
{
- set_hhmmss (pc, (yyvsp[(1) - (4)].textintval).value, (yyvsp[(3) - (4)].textintval).value, 0, 0);
+ set_hhmmss (pc, (yyvsp[-3].textintval).value, (yyvsp[-1].textintval).value, 0, 0);
pc->meridian = MER24;
}
+#line 1707 "parse-datetime.c" /* yacc.c:1646 */
break;
case 24:
-/* Line 1792 of yacc.c */
-#line 398 "./parse-datetime.y"
+#line 398 "./parse-datetime.y" /* yacc.c:1646 */
{
- set_hhmmss (pc, (yyvsp[(1) - (6)].textintval).value, (yyvsp[(3) - (6)].textintval).value, (yyvsp[(5) - (6)].timespec).tv_sec, (yyvsp[(5) - (6)].timespec).tv_nsec);
+ set_hhmmss (pc, (yyvsp[-5].textintval).value, (yyvsp[-3].textintval).value, (yyvsp[-1].timespec).tv_sec, (yyvsp[-1].timespec).tv_nsec);
pc->meridian = MER24;
}
+#line 1716 "parse-datetime.c" /* yacc.c:1646 */
break;
case 27:
-/* Line 1792 of yacc.c */
-#line 411 "./parse-datetime.y"
+#line 411 "./parse-datetime.y" /* yacc.c:1646 */
{
pc->zones_seen++;
- pc->time_zone = time_zone_hhmm (pc, (yyvsp[(1) - (2)].textintval), (yyvsp[(2) - (2)].intval));
+ pc->time_zone = time_zone_hhmm (pc, (yyvsp[-1].textintval), (yyvsp[0].intval));
}
+#line 1725 "parse-datetime.c" /* yacc.c:1646 */
break;
case 28:
-/* Line 1792 of yacc.c */
-#line 419 "./parse-datetime.y"
+#line 419 "./parse-datetime.y" /* yacc.c:1646 */
{
- pc->local_isdst = (yyvsp[(1) - (1)].intval);
- pc->dsts_seen += (0 < (yyvsp[(1) - (1)].intval));
+ pc->local_isdst = (yyvsp[0].intval);
+ pc->dsts_seen += (0 < (yyvsp[0].intval));
}
+#line 1734 "parse-datetime.c" /* yacc.c:1646 */
break;
case 29:
-/* Line 1792 of yacc.c */
-#line 424 "./parse-datetime.y"
+#line 424 "./parse-datetime.y" /* yacc.c:1646 */
{
pc->local_isdst = 1;
- pc->dsts_seen += (0 < (yyvsp[(1) - (2)].intval)) + 1;
+ pc->dsts_seen += (0 < (yyvsp[-1].intval)) + 1;
}
+#line 1743 "parse-datetime.c" /* yacc.c:1646 */
break;
case 30:
-/* Line 1792 of yacc.c */
-#line 434 "./parse-datetime.y"
- { pc->time_zone = (yyvsp[(1) - (1)].intval); }
+#line 434 "./parse-datetime.y" /* yacc.c:1646 */
+ { pc->time_zone = (yyvsp[0].intval); }
+#line 1749 "parse-datetime.c" /* yacc.c:1646 */
break;
case 31:
-/* Line 1792 of yacc.c */
-#line 436 "./parse-datetime.y"
+#line 436 "./parse-datetime.y" /* yacc.c:1646 */
{ pc->time_zone = HOUR(7); }
+#line 1755 "parse-datetime.c" /* yacc.c:1646 */
break;
case 32:
-/* Line 1792 of yacc.c */
-#line 438 "./parse-datetime.y"
- { pc->time_zone = (yyvsp[(1) - (2)].intval);
- apply_relative_time (pc, (yyvsp[(2) - (2)].rel), 1); }
+#line 438 "./parse-datetime.y" /* yacc.c:1646 */
+ { pc->time_zone = (yyvsp[-1].intval);
+ apply_relative_time (pc, (yyvsp[0].rel), 1); }
+#line 1762 "parse-datetime.c" /* yacc.c:1646 */
break;
case 33:
-/* Line 1792 of yacc.c */
-#line 441 "./parse-datetime.y"
+#line 441 "./parse-datetime.y" /* yacc.c:1646 */
{ pc->time_zone = HOUR(7);
- apply_relative_time (pc, (yyvsp[(2) - (2)].rel), 1); }
+ apply_relative_time (pc, (yyvsp[0].rel), 1); }
+#line 1769 "parse-datetime.c" /* yacc.c:1646 */
break;
case 34:
-/* Line 1792 of yacc.c */
-#line 444 "./parse-datetime.y"
- { pc->time_zone = (yyvsp[(1) - (3)].intval) + time_zone_hhmm (pc, (yyvsp[(2) - (3)].textintval), (yyvsp[(3) - (3)].intval)); }
+#line 444 "./parse-datetime.y" /* yacc.c:1646 */
+ { pc->time_zone = (yyvsp[-2].intval) + time_zone_hhmm (pc, (yyvsp[-1].textintval), (yyvsp[0].intval)); }
+#line 1775 "parse-datetime.c" /* yacc.c:1646 */
break;
case 35:
-/* Line 1792 of yacc.c */
-#line 446 "./parse-datetime.y"
- { pc->time_zone = (yyvsp[(1) - (1)].intval) + 60; }
+#line 446 "./parse-datetime.y" /* yacc.c:1646 */
+ { pc->time_zone = (yyvsp[0].intval) + 60; }
+#line 1781 "parse-datetime.c" /* yacc.c:1646 */
break;
case 36:
-/* Line 1792 of yacc.c */
-#line 448 "./parse-datetime.y"
- { pc->time_zone = (yyvsp[(1) - (2)].intval) + 60; }
+#line 448 "./parse-datetime.y" /* yacc.c:1646 */
+ { pc->time_zone = (yyvsp[-1].intval) + 60; }
+#line 1787 "parse-datetime.c" /* yacc.c:1646 */
break;
case 37:
-/* Line 1792 of yacc.c */
-#line 453 "./parse-datetime.y"
+#line 453 "./parse-datetime.y" /* yacc.c:1646 */
{
pc->day_ordinal = 0;
- pc->day_number = (yyvsp[(1) - (1)].intval);
+ pc->day_number = (yyvsp[0].intval);
}
+#line 1796 "parse-datetime.c" /* yacc.c:1646 */
break;
case 38:
-/* Line 1792 of yacc.c */
-#line 458 "./parse-datetime.y"
+#line 458 "./parse-datetime.y" /* yacc.c:1646 */
{
pc->day_ordinal = 0;
- pc->day_number = (yyvsp[(1) - (2)].intval);
+ pc->day_number = (yyvsp[-1].intval);
}
+#line 1805 "parse-datetime.c" /* yacc.c:1646 */
break;
case 39:
-/* Line 1792 of yacc.c */
-#line 463 "./parse-datetime.y"
+#line 463 "./parse-datetime.y" /* yacc.c:1646 */
{
- pc->day_ordinal = (yyvsp[(1) - (2)].intval);
- pc->day_number = (yyvsp[(2) - (2)].intval);
+ pc->day_ordinal = (yyvsp[-1].intval);
+ pc->day_number = (yyvsp[0].intval);
}
+#line 1814 "parse-datetime.c" /* yacc.c:1646 */
break;
case 40:
-/* Line 1792 of yacc.c */
-#line 468 "./parse-datetime.y"
+#line 468 "./parse-datetime.y" /* yacc.c:1646 */
{
- pc->day_ordinal = (yyvsp[(1) - (2)].textintval).value;
- pc->day_number = (yyvsp[(2) - (2)].intval);
+ pc->day_ordinal = (yyvsp[-1].textintval).value;
+ pc->day_number = (yyvsp[0].intval);
}
+#line 1823 "parse-datetime.c" /* yacc.c:1646 */
break;
case 41:
-/* Line 1792 of yacc.c */
-#line 476 "./parse-datetime.y"
+#line 476 "./parse-datetime.y" /* yacc.c:1646 */
{
- pc->month = (yyvsp[(1) - (3)].textintval).value;
- pc->day = (yyvsp[(3) - (3)].textintval).value;
+ pc->month = (yyvsp[-2].textintval).value;
+ pc->day = (yyvsp[0].textintval).value;
}
+#line 1832 "parse-datetime.c" /* yacc.c:1646 */
break;
case 42:
-/* Line 1792 of yacc.c */
-#line 481 "./parse-datetime.y"
+#line 481 "./parse-datetime.y" /* yacc.c:1646 */
{
/* 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 <= (yyvsp[(1) - (5)].textintval).digits)
+ if (4 <= (yyvsp[-4].textintval).digits)
{
- pc->year = (yyvsp[(1) - (5)].textintval);
- pc->month = (yyvsp[(3) - (5)].textintval).value;
- pc->day = (yyvsp[(5) - (5)].textintval).value;
+ pc->year = (yyvsp[-4].textintval);
+ pc->month = (yyvsp[-2].textintval).value;
+ pc->day = (yyvsp[0].textintval).value;
}
else
{
- pc->month = (yyvsp[(1) - (5)].textintval).value;
- pc->day = (yyvsp[(3) - (5)].textintval).value;
- pc->year = (yyvsp[(5) - (5)].textintval);
+ pc->month = (yyvsp[-4].textintval).value;
+ pc->day = (yyvsp[-2].textintval).value;
+ pc->year = (yyvsp[0].textintval);
}
}
+#line 1856 "parse-datetime.c" /* yacc.c:1646 */
break;
case 43:
-/* Line 1792 of yacc.c */
-#line 501 "./parse-datetime.y"
+#line 501 "./parse-datetime.y" /* yacc.c:1646 */
{
/* e.g. 17-JUN-1992. */
- pc->day = (yyvsp[(1) - (3)].textintval).value;
- pc->month = (yyvsp[(2) - (3)].intval);
- pc->year.value = -(yyvsp[(3) - (3)].textintval).value;
- pc->year.digits = (yyvsp[(3) - (3)].textintval).digits;
+ pc->day = (yyvsp[-2].textintval).value;
+ pc->month = (yyvsp[-1].intval);
+ pc->year.value = -(yyvsp[0].textintval).value;
+ pc->year.digits = (yyvsp[0].textintval).digits;
}
+#line 1868 "parse-datetime.c" /* yacc.c:1646 */
break;
case 44:
-/* Line 1792 of yacc.c */
-#line 509 "./parse-datetime.y"
+#line 509 "./parse-datetime.y" /* yacc.c:1646 */
{
/* e.g. JUN-17-1992. */
- pc->month = (yyvsp[(1) - (3)].intval);
- pc->day = -(yyvsp[(2) - (3)].textintval).value;
- pc->year.value = -(yyvsp[(3) - (3)].textintval).value;
- pc->year.digits = (yyvsp[(3) - (3)].textintval).digits;
+ pc->month = (yyvsp[-2].intval);
+ pc->day = -(yyvsp[-1].textintval).value;
+ pc->year.value = -(yyvsp[0].textintval).value;
+ pc->year.digits = (yyvsp[0].textintval).digits;
}
+#line 1880 "parse-datetime.c" /* yacc.c:1646 */
break;
case 45:
-/* Line 1792 of yacc.c */
-#line 517 "./parse-datetime.y"
+#line 517 "./parse-datetime.y" /* yacc.c:1646 */
{
- pc->month = (yyvsp[(1) - (2)].intval);
- pc->day = (yyvsp[(2) - (2)].textintval).value;
+ pc->month = (yyvsp[-1].intval);
+ pc->day = (yyvsp[0].textintval).value;
}
+#line 1889 "parse-datetime.c" /* yacc.c:1646 */
break;
case 46:
-/* Line 1792 of yacc.c */
-#line 522 "./parse-datetime.y"
+#line 522 "./parse-datetime.y" /* yacc.c:1646 */
{
- pc->month = (yyvsp[(1) - (4)].intval);
- pc->day = (yyvsp[(2) - (4)].textintval).value;
- pc->year = (yyvsp[(4) - (4)].textintval);
+ pc->month = (yyvsp[-3].intval);
+ pc->day = (yyvsp[-2].textintval).value;
+ pc->year = (yyvsp[0].textintval);
}
+#line 1899 "parse-datetime.c" /* yacc.c:1646 */
break;
case 47:
-/* Line 1792 of yacc.c */
-#line 528 "./parse-datetime.y"
+#line 528 "./parse-datetime.y" /* yacc.c:1646 */
{
- pc->day = (yyvsp[(1) - (2)].textintval).value;
- pc->month = (yyvsp[(2) - (2)].intval);
+ pc->day = (yyvsp[-1].textintval).value;
+ pc->month = (yyvsp[0].intval);
}
+#line 1908 "parse-datetime.c" /* yacc.c:1646 */
break;
case 48:
-/* Line 1792 of yacc.c */
-#line 533 "./parse-datetime.y"
+#line 533 "./parse-datetime.y" /* yacc.c:1646 */
{
- pc->day = (yyvsp[(1) - (3)].textintval).value;
- pc->month = (yyvsp[(2) - (3)].intval);
- pc->year = (yyvsp[(3) - (3)].textintval);
+ pc->day = (yyvsp[-2].textintval).value;
+ pc->month = (yyvsp[-1].intval);
+ pc->year = (yyvsp[0].textintval);
}
+#line 1918 "parse-datetime.c" /* yacc.c:1646 */
break;
case 50:
-/* Line 1792 of yacc.c */
-#line 543 "./parse-datetime.y"
+#line 543 "./parse-datetime.y" /* yacc.c:1646 */
{
/* ISO 8601 format. YYYY-MM-DD. */
- pc->year = (yyvsp[(1) - (3)].textintval);
- pc->month = -(yyvsp[(2) - (3)].textintval).value;
- pc->day = -(yyvsp[(3) - (3)].textintval).value;
+ pc->year = (yyvsp[-2].textintval);
+ pc->month = -(yyvsp[-1].textintval).value;
+ pc->day = -(yyvsp[0].textintval).value;
}
+#line 1929 "parse-datetime.c" /* yacc.c:1646 */
break;
case 51:
-/* Line 1792 of yacc.c */
-#line 553 "./parse-datetime.y"
- { apply_relative_time (pc, (yyvsp[(1) - (2)].rel), (yyvsp[(2) - (2)].intval)); }
+#line 553 "./parse-datetime.y" /* yacc.c:1646 */
+ { apply_relative_time (pc, (yyvsp[-1].rel), (yyvsp[0].intval)); }
+#line 1935 "parse-datetime.c" /* yacc.c:1646 */
break;
case 52:
-/* Line 1792 of yacc.c */
-#line 555 "./parse-datetime.y"
- { apply_relative_time (pc, (yyvsp[(1) - (1)].rel), 1); }
+#line 555 "./parse-datetime.y" /* yacc.c:1646 */
+ { apply_relative_time (pc, (yyvsp[0].rel), 1); }
+#line 1941 "parse-datetime.c" /* yacc.c:1646 */
break;
case 53:
-/* Line 1792 of yacc.c */
-#line 557 "./parse-datetime.y"
- { apply_relative_time (pc, (yyvsp[(1) - (1)].rel), 1); }
+#line 557 "./parse-datetime.y" /* yacc.c:1646 */
+ { apply_relative_time (pc, (yyvsp[0].rel), 1); }
+#line 1947 "parse-datetime.c" /* yacc.c:1646 */
break;
case 54:
-/* Line 1792 of yacc.c */
-#line 562 "./parse-datetime.y"
- { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).year = (yyvsp[(1) - (2)].intval); }
+#line 562 "./parse-datetime.y" /* yacc.c:1646 */
+ { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).year = (yyvsp[-1].intval); }
+#line 1953 "parse-datetime.c" /* yacc.c:1646 */
break;
case 55:
-/* Line 1792 of yacc.c */
-#line 564 "./parse-datetime.y"
- { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).year = (yyvsp[(1) - (2)].textintval).value; }
+#line 564 "./parse-datetime.y" /* yacc.c:1646 */
+ { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).year = (yyvsp[-1].textintval).value; }
+#line 1959 "parse-datetime.c" /* yacc.c:1646 */
break;
case 56:
-/* Line 1792 of yacc.c */
-#line 566 "./parse-datetime.y"
+#line 566 "./parse-datetime.y" /* yacc.c:1646 */
{ (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).year = 1; }
+#line 1965 "parse-datetime.c" /* yacc.c:1646 */
break;
case 57:
-/* Line 1792 of yacc.c */
-#line 568 "./parse-datetime.y"
- { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).month = (yyvsp[(1) - (2)].intval); }
+#line 568 "./parse-datetime.y" /* yacc.c:1646 */
+ { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).month = (yyvsp[-1].intval); }
+#line 1971 "parse-datetime.c" /* yacc.c:1646 */
break;
case 58:
-/* Line 1792 of yacc.c */
-#line 570 "./parse-datetime.y"
- { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).month = (yyvsp[(1) - (2)].textintval).value; }
+#line 570 "./parse-datetime.y" /* yacc.c:1646 */
+ { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).month = (yyvsp[-1].textintval).value; }
+#line 1977 "parse-datetime.c" /* yacc.c:1646 */
break;
case 59:
-/* Line 1792 of yacc.c */
-#line 572 "./parse-datetime.y"
+#line 572 "./parse-datetime.y" /* yacc.c:1646 */
{ (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).month = 1; }
+#line 1983 "parse-datetime.c" /* yacc.c:1646 */
break;
case 60:
-/* Line 1792 of yacc.c */
-#line 574 "./parse-datetime.y"
- { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).day = (yyvsp[(1) - (2)].intval) * (yyvsp[(2) - (2)].intval); }
+#line 574 "./parse-datetime.y" /* yacc.c:1646 */
+ { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).day = (yyvsp[-1].intval) * (yyvsp[0].intval); }
+#line 1989 "parse-datetime.c" /* yacc.c:1646 */
break;
case 61:
-/* Line 1792 of yacc.c */
-#line 576 "./parse-datetime.y"
- { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).day = (yyvsp[(1) - (2)].textintval).value * (yyvsp[(2) - (2)].intval); }
+#line 576 "./parse-datetime.y" /* yacc.c:1646 */
+ { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).day = (yyvsp[-1].textintval).value * (yyvsp[0].intval); }
+#line 1995 "parse-datetime.c" /* yacc.c:1646 */
break;
case 62:
-/* Line 1792 of yacc.c */
-#line 578 "./parse-datetime.y"
- { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).day = (yyvsp[(1) - (1)].intval); }
+#line 578 "./parse-datetime.y" /* yacc.c:1646 */
+ { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).day = (yyvsp[0].intval); }
+#line 2001 "parse-datetime.c" /* yacc.c:1646 */
break;
case 63:
-/* Line 1792 of yacc.c */
-#line 580 "./parse-datetime.y"
- { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).hour = (yyvsp[(1) - (2)].intval); }
+#line 580 "./parse-datetime.y" /* yacc.c:1646 */
+ { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).hour = (yyvsp[-1].intval); }
+#line 2007 "parse-datetime.c" /* yacc.c:1646 */
break;
case 64:
-/* Line 1792 of yacc.c */
-#line 582 "./parse-datetime.y"
- { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).hour = (yyvsp[(1) - (2)].textintval).value; }
+#line 582 "./parse-datetime.y" /* yacc.c:1646 */
+ { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).hour = (yyvsp[-1].textintval).value; }
+#line 2013 "parse-datetime.c" /* yacc.c:1646 */
break;
case 65:
-/* Line 1792 of yacc.c */
-#line 584 "./parse-datetime.y"
+#line 584 "./parse-datetime.y" /* yacc.c:1646 */
{ (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).hour = 1; }
+#line 2019 "parse-datetime.c" /* yacc.c:1646 */
break;
case 66:
-/* Line 1792 of yacc.c */
-#line 586 "./parse-datetime.y"
- { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).minutes = (yyvsp[(1) - (2)].intval); }
+#line 586 "./parse-datetime.y" /* yacc.c:1646 */
+ { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).minutes = (yyvsp[-1].intval); }
+#line 2025 "parse-datetime.c" /* yacc.c:1646 */
break;
case 67:
-/* Line 1792 of yacc.c */
-#line 588 "./parse-datetime.y"
- { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).minutes = (yyvsp[(1) - (2)].textintval).value; }
+#line 588 "./parse-datetime.y" /* yacc.c:1646 */
+ { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).minutes = (yyvsp[-1].textintval).value; }
+#line 2031 "parse-datetime.c" /* yacc.c:1646 */
break;
case 68:
-/* Line 1792 of yacc.c */
-#line 590 "./parse-datetime.y"
+#line 590 "./parse-datetime.y" /* yacc.c:1646 */
{ (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).minutes = 1; }
+#line 2037 "parse-datetime.c" /* yacc.c:1646 */
break;
case 69:
-/* Line 1792 of yacc.c */
-#line 592 "./parse-datetime.y"
- { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).seconds = (yyvsp[(1) - (2)].intval); }
+#line 592 "./parse-datetime.y" /* yacc.c:1646 */
+ { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).seconds = (yyvsp[-1].intval); }
+#line 2043 "parse-datetime.c" /* yacc.c:1646 */
break;
case 70:
-/* Line 1792 of yacc.c */
-#line 594 "./parse-datetime.y"
- { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).seconds = (yyvsp[(1) - (2)].textintval).value; }
+#line 594 "./parse-datetime.y" /* yacc.c:1646 */
+ { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).seconds = (yyvsp[-1].textintval).value; }
+#line 2049 "parse-datetime.c" /* yacc.c:1646 */
break;
case 71:
-/* Line 1792 of yacc.c */
-#line 596 "./parse-datetime.y"
- { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).seconds = (yyvsp[(1) - (2)].timespec).tv_sec; (yyval.rel).ns = (yyvsp[(1) - (2)].timespec).tv_nsec; }
+#line 596 "./parse-datetime.y" /* yacc.c:1646 */
+ { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).seconds = (yyvsp[-1].timespec).tv_sec; (yyval.rel).ns = (yyvsp[-1].timespec).tv_nsec; }
+#line 2055 "parse-datetime.c" /* yacc.c:1646 */
break;
case 72:
-/* Line 1792 of yacc.c */
-#line 598 "./parse-datetime.y"
- { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).seconds = (yyvsp[(1) - (2)].timespec).tv_sec; (yyval.rel).ns = (yyvsp[(1) - (2)].timespec).tv_nsec; }
+#line 598 "./parse-datetime.y" /* yacc.c:1646 */
+ { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).seconds = (yyvsp[-1].timespec).tv_sec; (yyval.rel).ns = (yyvsp[-1].timespec).tv_nsec; }
+#line 2061 "parse-datetime.c" /* yacc.c:1646 */
break;
case 73:
-/* Line 1792 of yacc.c */
-#line 600 "./parse-datetime.y"
+#line 600 "./parse-datetime.y" /* yacc.c:1646 */
{ (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).seconds = 1; }
+#line 2067 "parse-datetime.c" /* yacc.c:1646 */
break;
case 75:
-/* Line 1792 of yacc.c */
-#line 606 "./parse-datetime.y"
- { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).year = (yyvsp[(1) - (2)].textintval).value; }
+#line 606 "./parse-datetime.y" /* yacc.c:1646 */
+ { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).year = (yyvsp[-1].textintval).value; }
+#line 2073 "parse-datetime.c" /* yacc.c:1646 */
break;
case 76:
-/* Line 1792 of yacc.c */
-#line 608 "./parse-datetime.y"
- { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).month = (yyvsp[(1) - (2)].textintval).value; }
+#line 608 "./parse-datetime.y" /* yacc.c:1646 */
+ { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).month = (yyvsp[-1].textintval).value; }
+#line 2079 "parse-datetime.c" /* yacc.c:1646 */
break;
case 77:
-/* Line 1792 of yacc.c */
-#line 610 "./parse-datetime.y"
- { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).day = (yyvsp[(1) - (2)].textintval).value * (yyvsp[(2) - (2)].intval); }
+#line 610 "./parse-datetime.y" /* yacc.c:1646 */
+ { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).day = (yyvsp[-1].textintval).value * (yyvsp[0].intval); }
+#line 2085 "parse-datetime.c" /* yacc.c:1646 */
break;
case 78:
-/* Line 1792 of yacc.c */
-#line 612 "./parse-datetime.y"
- { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).hour = (yyvsp[(1) - (2)].textintval).value; }
+#line 612 "./parse-datetime.y" /* yacc.c:1646 */
+ { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).hour = (yyvsp[-1].textintval).value; }
+#line 2091 "parse-datetime.c" /* yacc.c:1646 */
break;
case 79:
-/* Line 1792 of yacc.c */
-#line 614 "./parse-datetime.y"
- { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).minutes = (yyvsp[(1) - (2)].textintval).value; }
+#line 614 "./parse-datetime.y" /* yacc.c:1646 */
+ { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).minutes = (yyvsp[-1].textintval).value; }
+#line 2097 "parse-datetime.c" /* yacc.c:1646 */
break;
case 80:
-/* Line 1792 of yacc.c */
-#line 616 "./parse-datetime.y"
- { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).seconds = (yyvsp[(1) - (2)].textintval).value; }
+#line 616 "./parse-datetime.y" /* yacc.c:1646 */
+ { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).seconds = (yyvsp[-1].textintval).value; }
+#line 2103 "parse-datetime.c" /* yacc.c:1646 */
break;
case 81:
-/* Line 1792 of yacc.c */
-#line 621 "./parse-datetime.y"
- { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).day = (yyvsp[(1) - (1)].intval); }
+#line 621 "./parse-datetime.y" /* yacc.c:1646 */
+ { (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).day = (yyvsp[0].intval); }
+#line 2109 "parse-datetime.c" /* yacc.c:1646 */
break;
case 85:
-/* Line 1792 of yacc.c */
-#line 629 "./parse-datetime.y"
- { (yyval.timespec).tv_sec = (yyvsp[(1) - (1)].textintval).value; (yyval.timespec).tv_nsec = 0; }
+#line 629 "./parse-datetime.y" /* yacc.c:1646 */
+ { (yyval.timespec).tv_sec = (yyvsp[0].textintval).value; (yyval.timespec).tv_nsec = 0; }
+#line 2115 "parse-datetime.c" /* yacc.c:1646 */
break;
case 87:
-/* Line 1792 of yacc.c */
-#line 635 "./parse-datetime.y"
- { (yyval.timespec).tv_sec = (yyvsp[(1) - (1)].textintval).value; (yyval.timespec).tv_nsec = 0; }
+#line 635 "./parse-datetime.y" /* yacc.c:1646 */
+ { (yyval.timespec).tv_sec = (yyvsp[0].textintval).value; (yyval.timespec).tv_nsec = 0; }
+#line 2121 "parse-datetime.c" /* yacc.c:1646 */
break;
case 88:
-/* Line 1792 of yacc.c */
-#line 640 "./parse-datetime.y"
- { digits_to_date_time (pc, (yyvsp[(1) - (1)].textintval)); }
+#line 640 "./parse-datetime.y" /* yacc.c:1646 */
+ { digits_to_date_time (pc, (yyvsp[0].textintval)); }
+#line 2127 "parse-datetime.c" /* yacc.c:1646 */
break;
case 89:
-/* Line 1792 of yacc.c */
-#line 645 "./parse-datetime.y"
+#line 645 "./parse-datetime.y" /* yacc.c:1646 */
{
/* 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, (yyvsp[(1) - (2)].textintval));
- apply_relative_time (pc, (yyvsp[(2) - (2)].rel), 1);
+ digits_to_date_time (pc, (yyvsp[-1].textintval));
+ apply_relative_time (pc, (yyvsp[0].rel), 1);
}
+#line 2138 "parse-datetime.c" /* yacc.c:1646 */
break;
case 90:
-/* Line 1792 of yacc.c */
-#line 655 "./parse-datetime.y"
+#line 655 "./parse-datetime.y" /* yacc.c:1646 */
{ (yyval.intval) = -1; }
+#line 2144 "parse-datetime.c" /* yacc.c:1646 */
break;
case 91:
-/* Line 1792 of yacc.c */
-#line 657 "./parse-datetime.y"
- { (yyval.intval) = (yyvsp[(2) - (2)].textintval).value; }
+#line 657 "./parse-datetime.y" /* yacc.c:1646 */
+ { (yyval.intval) = (yyvsp[0].textintval).value; }
+#line 2150 "parse-datetime.c" /* yacc.c:1646 */
break;
-/* Line 1792 of yacc.c */
-#line 2332 "parse-datetime.c"
+#line 2154 "parse-datetime.c" /* yacc.c:1646 */
default: break;
}
/* User semantic actions sometimes alter yychar, and that requires
*++yyvsp = yyval;
- /* Now `shift' the result of the reduction. Determine what state
+ /* Now 'shift' the result of the reduction. Determine what state
that goes to, based on the state we popped back to and the rule
number reduced by. */
goto yynewstate;
-/*------------------------------------.
-| yyerrlab -- here on detecting error |
-`------------------------------------*/
+/*--------------------------------------.
+| yyerrlab -- here on detecting error. |
+`--------------------------------------*/
yyerrlab:
/* Make sure we have latest lookahead translation. See comments at
user semantic actions for why this is necessary. */
if (yyerrstatus == 3)
{
/* If just tried and failed to reuse lookahead token after an
- error, discard it. */
+ error, discard it. */
if (yychar <= YYEOF)
- {
- /* Return failure if at end of input. */
- if (yychar == YYEOF)
- YYABORT;
- }
+ {
+ /* Return failure if at end of input. */
+ if (yychar == YYEOF)
+ YYABORT;
+ }
else
- {
- yydestruct ("Error: discarding",
- yytoken, &yylval, pc);
- yychar = YYEMPTY;
- }
+ {
+ yydestruct ("Error: discarding",
+ yytoken, &yylval, pc);
+ yychar = YYEMPTY;
+ }
}
/* Else will try to reuse lookahead token after shifting the error
if (/*CONSTCOND*/ 0)
goto yyerrorlab;
- /* Do not reclaim the symbols of the rule which action triggered
+ /* Do not reclaim the symbols of the rule whose action triggered
this YYERROR. */
YYPOPSTACK (yylen);
yylen = 0;
| yyerrlab1 -- common code for both syntax error and YYERROR. |
`-------------------------------------------------------------*/
yyerrlab1:
- yyerrstatus = 3; /* Each real token shifted decrements this. */
+ yyerrstatus = 3; /* Each real token shifted decrements this. */
for (;;)
{
yyn = yypact[yystate];
if (!yypact_value_is_default (yyn))
- {
- yyn += YYTERROR;
- if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
- {
- yyn = yytable[yyn];
- if (0 < yyn)
- break;
- }
- }
+ {
+ yyn += YYTERROR;
+ if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
+ {
+ yyn = yytable[yyn];
+ if (0 < yyn)
+ break;
+ }
+ }
/* Pop the current state because it cannot handle the error token. */
if (yyssp == yyss)
- YYABORT;
+ YYABORT;
yydestruct ("Error: popping",
- yystos[yystate], yyvsp, pc);
+ yystos[yystate], yyvsp, pc);
YYPOPSTACK (1);
yystate = *yyssp;
YY_STACK_PRINT (yyss, yyssp);
yydestruct ("Cleanup: discarding lookahead",
yytoken, &yylval, pc);
}
- /* Do not reclaim the symbols of the rule which action triggered
+ /* Do not reclaim the symbols of the rule whose action triggered
this YYABORT or YYACCEPT. */
YYPOPSTACK (yylen);
YY_STACK_PRINT (yyss, yyssp);
while (yyssp != yyss)
{
yydestruct ("Cleanup: popping",
- yystos[*yyssp], yyvsp, pc);
+ yystos[*yyssp], yyvsp, pc);
YYPOPSTACK (1);
}
#ifndef yyoverflow
if (yymsg != yymsgbuf)
YYSTACK_FREE (yymsg);
#endif
- /* Make sure YYID is used. */
- return YYID (yyresult);
+ return yyresult;
}
-
-
-/* Line 2055 of yacc.c */
-#line 660 "./parse-datetime.y"
+#line 660 "./parse-datetime.y" /* yacc.c:1906 */
static table const meridian_table[] =
}
static int
-yylex (YYSTYPE *lvalp, parser_control *pc)
+yylex (union YYSTYPE *lvalp, parser_control *pc)
{
unsigned char c;
size_t count;
/* Parse a string into an internal time stamp.
- Copyright (C) 1995, 1997-1998, 2003-2004, 2007, 2009-2014 Free Software
+ Copyright (C) 1995, 1997-1998, 2003-2004, 2007, 2009-2015 Free Software
Foundation, Inc.
This program is free software: you can redistribute it and/or modify
%{
/* Parse a string into an internal time stamp.
- Copyright (C) 1999-2000, 2002-2014 Free Software Foundation, Inc.
+ Copyright (C) 1999-2000, 2002-2015 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
}
static int
-yylex (YYSTYPE *lvalp, parser_control *pc)
+yylex (union YYSTYPE *lvalp, parser_control *pc)
{
unsigned char c;
size_t count;
/* Define PATH_MAX somehow. Requires sys/types.h.
- Copyright (C) 1992, 1999, 2001, 2003, 2005, 2009-2014 Free Software
+ Copyright (C) 1992, 1999, 2001, 2003, 2005, 2009-2015 Free Software
Foundation, Inc.
This program is free software; you can redistribute it and/or modify
/* Invoke pipe, but avoid some glitches.
- Copyright (C) 2005-2006, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2005-2006, 2009-2015 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
/* Decomposed printf argument list.
- Copyright (C) 1999, 2002-2003, 2005-2007, 2009-2014 Free Software
+ Copyright (C) 1999, 2002-2003, 2005-2007, 2009-2015 Free Software
Foundation, Inc.
This program is free software; you can redistribute it and/or modify
/* Decomposed printf argument list.
- Copyright (C) 1999, 2002-2003, 2006-2007, 2011-2014 Free Software
+ Copyright (C) 1999, 2002-2003, 2006-2007, 2011-2015 Free Software
Foundation, Inc.
This program is free software; you can redistribute it and/or modify
/* Formatted output to strings.
- Copyright (C) 1999-2000, 2002-2003, 2006-2014 Free Software Foundation, Inc.
+ Copyright (C) 1999-2000, 2002-2003, 2006-2015 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
/* Parse printf format string.
- Copyright (C) 1999, 2002-2003, 2005, 2007, 2010-2014 Free Software
+ Copyright (C) 1999, 2002-2003, 2005, 2007, 2010-2015 Free Software
Foundation, Inc.
This program is free software; you can redistribute it and/or modify
/* Program name management.
- Copyright (C) 2001-2003, 2005-2014 Free Software Foundation, Inc.
+ Copyright (C) 2001-2003, 2005-2015 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2001.
This program is free software: you can redistribute it and/or modify
/* Program name management.
- Copyright (C) 2001-2004, 2006, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2001-2004, 2006, 2009-2015 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2001.
This program is free software: you can redistribute it and/or modify
/* quote.h - prototypes for quote.c
- Copyright (C) 1998-2001, 2003, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 1998-2001, 2003, 2009-2015 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
/* quotearg.c - quote arguments for output
- Copyright (C) 1998-2002, 2004-2014 Free Software Foundation, Inc.
+ Copyright (C) 1998-2002, 2004-2015 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
/* quotearg.h - quote arguments for output
- Copyright (C) 1998-2002, 2004, 2006, 2008-2014 Free Software Foundation,
+ Copyright (C) 1998-2002, 2004, 2006, 2008-2015 Free Software Foundation,
Inc.
This program is free software: you can redistribute it and/or modify
/* Provide a non-threads replacement for the POSIX raise function.
- Copyright (C) 2002-2003, 2005-2006, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2002-2003, 2005-2006, 2009-2015 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
/* Read the next entry of a directory.
- Copyright (C) 2011-2014 Free Software Foundation, Inc.
+ Copyright (C) 2011-2015 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
/* Stub for readlink().
- Copyright (C) 2003-2007, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2003-2007, 2009-2015 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
--- /dev/null
+/* Read a symlink relative to an open directory.
+ Copyright (C) 2009-2015 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 */
+
+#include <config.h>
+
+#include <unistd.h>
+
+#if HAVE_READLINKAT
+
+# undef readlinkat
+
+ssize_t
+rpl_readlinkat (int fd, char const *file, char *buf, size_t len)
+{
+ return readlinkat (fd, file, buf, len);
+}
+
+#else
+
+/* Gnulib provides a readlink stub for mingw; use it for distinction
+ between EINVAL and ENOENT, rather than always failing with ENOSYS. */
+
+/* POSIX 2008 says that unlike readlink, readlinkat returns 0 for
+ success instead of the buffer length. But this would render
+ readlinkat worthless since readlink does not guarantee a
+ NUL-terminated buffer. Assume this was a bug in POSIX. */
+
+/* Read the contents of symlink FILE into buffer BUF of size LEN, in the
+ directory open on descriptor FD. If possible, do it without changing
+ the working directory. Otherwise, resort to using save_cwd/fchdir,
+ then readlink/restore_cwd. If either the save_cwd or the restore_cwd
+ fails, then give a diagnostic and exit nonzero. */
+
+# define AT_FUNC_NAME readlinkat
+# define AT_FUNC_F1 readlink
+# define AT_FUNC_POST_FILE_PARAM_DECLS , char *buf, size_t len
+# define AT_FUNC_POST_FILE_ARGS , buf, len
+# define AT_FUNC_RESULT ssize_t
+# include "at-func.c"
+# undef AT_FUNC_NAME
+# undef AT_FUNC_F1
+# undef AT_FUNC_POST_FILE_PARAM_DECLS
+# undef AT_FUNC_POST_FILE_ARGS
+# undef AT_FUNC_RESULT
+
+#endif
/* realloc() function that is glibc compatible.
- Copyright (C) 1997, 2003-2004, 2006-2007, 2009-2014 Free Software
+ Copyright (C) 1997, 2003-2004, 2006-2007, 2009-2015 Free Software
Foundation, Inc.
This program is free software: you can redistribute it and/or modify
# Add this package to a list of references stored in a text file.
#
-# Copyright (C) 2000, 2009-2014 Free Software Foundation, Inc.
+# Copyright (C) 2000, 2009-2015 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
# Remove this package from a list of references stored in a text file.
#
-# Copyright (C) 2000, 2009-2014 Free Software Foundation, Inc.
+# Copyright (C) 2000, 2009-2015 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
/* Work around rename bugs in some systems.
- Copyright (C) 2001-2003, 2005-2006, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2001-2003, 2005-2006, 2009-2015 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
--- /dev/null
+/* Rename a file relative to open directories.
+ Copyright (C) 2009-2015 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 */
+
+#include <config.h>
+
+#include <stdio.h>
+
+#if HAVE_RENAMEAT
+
+# include <errno.h>
+# include <stdbool.h>
+# include <stdlib.h>
+# include <string.h>
+# include <sys/stat.h>
+
+# include "dirname.h"
+# include "openat.h"
+
+# undef renameat
+
+/* renameat does not honor trailing / on Solaris 10. Solve it in a
+ similar manner to rename. No need to worry about bugs not present
+ on Solaris, since all other systems either lack renameat or honor
+ trailing slash correctly. */
+
+int
+rpl_renameat (int fd1, char const *src, int fd2, char const *dst)
+{
+ size_t src_len = strlen (src);
+ size_t dst_len = strlen (dst);
+ char *src_temp = (char *) src;
+ char *dst_temp = (char *) dst;
+ bool src_slash;
+ bool dst_slash;
+ int ret_val = -1;
+ int rename_errno = ENOTDIR;
+ struct stat src_st;
+ struct stat dst_st;
+
+ /* Let strace see any ENOENT failure. */
+ if (!src_len || !dst_len)
+ return renameat (fd1, src, fd2, dst);
+
+ src_slash = src[src_len - 1] == '/';
+ dst_slash = dst[dst_len - 1] == '/';
+ if (!src_slash && !dst_slash)
+ return renameat (fd1, src, fd2, dst);
+
+ /* Presence of a trailing slash requires directory semantics. If
+ the source does not exist, or if the destination cannot be turned
+ into a directory, give up now. Otherwise, strip trailing slashes
+ before calling rename. */
+ if (lstatat (fd1, src, &src_st))
+ return -1;
+ if (lstatat (fd2, dst, &dst_st))
+ {
+ if (errno != ENOENT || !S_ISDIR (src_st.st_mode))
+ return -1;
+ }
+ else if (!S_ISDIR (dst_st.st_mode))
+ {
+ errno = ENOTDIR;
+ return -1;
+ }
+ else if (!S_ISDIR (src_st.st_mode))
+ {
+ errno = EISDIR;
+ return -1;
+ }
+
+# if RENAME_TRAILING_SLASH_SOURCE_BUG
+ /* See the lengthy comment in rename.c why Solaris 9 is forced to
+ GNU behavior, while Solaris 10 is left with POSIX behavior,
+ regarding symlinks with trailing slash. */
+ if (src_slash)
+ {
+ src_temp = strdup (src);
+ if (!src_temp)
+ {
+ /* Rather than rely on strdup-posix, we set errno ourselves. */
+ rename_errno = ENOMEM;
+ goto out;
+ }
+ strip_trailing_slashes (src_temp);
+ if (lstatat (fd1, src_temp, &src_st))
+ {
+ rename_errno = errno;
+ goto out;
+ }
+ if (S_ISLNK (src_st.st_mode))
+ goto out;
+ }
+ if (dst_slash)
+ {
+ dst_temp = strdup (dst);
+ if (!dst_temp)
+ {
+ rename_errno = ENOMEM;
+ goto out;
+ }
+ strip_trailing_slashes (dst_temp);
+ if (lstatat (fd2, dst_temp, &dst_st))
+ {
+ if (errno != ENOENT)
+ {
+ rename_errno = errno;
+ goto out;
+ }
+ }
+ else if (S_ISLNK (dst_st.st_mode))
+ goto out;
+ }
+# endif /* RENAME_TRAILING_SLASH_SOURCE_BUG */
+
+ ret_val = renameat (fd1, src_temp, fd2, dst_temp);
+ rename_errno = errno;
+ out:
+ if (src_temp != src)
+ free (src_temp);
+ if (dst_temp != dst)
+ free (dst_temp);
+ errno = rename_errno;
+ return ret_val;
+}
+
+#else /* !HAVE_RENAMEAT */
+
+# include "openat-priv.h"
+
+/* Rename FILE1, in the directory open on descriptor FD1, to FILE2, in
+ the directory open on descriptor FD2. If possible, do it without
+ changing the working directory. Otherwise, resort to using
+ save_cwd/fchdir, then rename/restore_cwd. If either the save_cwd or
+ the restore_cwd fails, then give a diagnostic and exit nonzero. */
+
+int
+renameat (int fd1, char const *file1, int fd2, char const *file2)
+{
+ return at_func2 (fd1, file1, fd2, file2, rename);
+}
+
+#endif /* !HAVE_RENAMEAT */
/* Work around rmdir bugs.
- Copyright (C) 1988, 1990, 1999, 2003-2006, 2009-2014 Free Software
+ Copyright (C) 1988, 1990, 1999, 2003-2006, 2009-2015 Free Software
Foundation, Inc.
This program is free software: you can redistribute it and/or modify
/* An interface to read and write that retries after interrupts.
- Copyright (C) 1993-1994, 1998, 2002-2006, 2009-2014 Free Software
+ Copyright (C) 1993-1994, 1998, 2002-2006, 2009-2015 Free Software
Foundation, Inc.
This program is free software: you can redistribute it and/or modify
/* An interface to write that retries after interrupts.
- Copyright (C) 2002, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2009-2015 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
/* An interface to write() that retries after interrupts.
- Copyright (C) 2002, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2009-2015 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
/* Determine whether two stat buffers refer to the same file.
- Copyright (C) 2006, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2006, 2009-2015 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
--- /dev/null
+/* save-cwd.c -- Save and restore current working directory.
+
+ Copyright (C) 1995, 1997-1998, 2003-2006, 2009-2015 Free Software
+ Foundation, Inc.
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+/* Written by Jim Meyering. */
+
+#include <config.h>
+
+#include "save-cwd.h"
+
+#include <errno.h>
+#include <fcntl.h>
+#include <stdbool.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "chdir-long.h"
+#include "unistd--.h"
+#include "cloexec.h"
+
+#if GNULIB_FCNTL_SAFER
+# include "fcntl--.h"
+#else
+# define GNULIB_FCNTL_SAFER 0
+#endif
+
+/* Record the location of the current working directory in CWD so that
+ the program may change to other directories and later use restore_cwd
+ to return to the recorded location. This function may allocate
+ space using malloc (via getcwd) or leave a file descriptor open;
+ use free_cwd to perform the necessary free or close. Upon failure,
+ no memory is allocated, any locally opened file descriptors are
+ closed; return non-zero -- in that case, free_cwd need not be
+ called, but doing so is ok. Otherwise, return zero.
+
+ The _raison d'etre_ for this interface is that the working directory
+ is sometimes inaccessible, and getcwd is not robust or as efficient.
+ So, we prefer to use the open/fchdir approach, but fall back on
+ getcwd if necessary. This module works for most cases with just
+ the getcwd-lgpl module, but to be truly robust, use the getcwd module.
+
+ Some systems lack fchdir altogether: e.g., OS/2, pre-2001 Cygwin,
+ SCO Xenix. Also, SunOS 4 and Irix 5.3 provide the function, yet it
+ doesn't work for partitions on which auditing is enabled. If
+ you're still using an obsolete system with these problems, please
+ send email to the maintainer of this code. */
+
+int
+save_cwd (struct saved_cwd *cwd)
+{
+ cwd->name = NULL;
+
+ cwd->desc = open (".", O_SEARCH);
+ if (!GNULIB_FCNTL_SAFER)
+ cwd->desc = fd_safer (cwd->desc);
+ if (cwd->desc < 0)
+ {
+ cwd->name = getcwd (NULL, 0);
+ return cwd->name ? 0 : -1;
+ }
+
+ set_cloexec_flag (cwd->desc, true);
+ return 0;
+}
+
+/* Change to recorded location, CWD, in directory hierarchy.
+ Upon failure, return -1 (errno is set by chdir or fchdir).
+ Upon success, return zero. */
+
+int
+restore_cwd (const struct saved_cwd *cwd)
+{
+ if (0 <= cwd->desc)
+ return fchdir (cwd->desc);
+ else
+ return chdir_long (cwd->name);
+}
+
+void
+free_cwd (struct saved_cwd *cwd)
+{
+ if (cwd->desc >= 0)
+ close (cwd->desc);
+ free (cwd->name);
+}
--- /dev/null
+/* Save and restore current working directory.
+
+ Copyright (C) 1995, 1997-1998, 2003, 2009-2015 Free Software Foundation,
+ Inc.
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+/* Written by Jim Meyering. */
+
+#ifndef SAVE_CWD_H
+# define SAVE_CWD_H 1
+
+struct saved_cwd
+ {
+ int desc;
+ char *name;
+ };
+
+int save_cwd (struct saved_cwd *cwd);
+int restore_cwd (const struct saved_cwd *cwd);
+void free_cwd (struct saved_cwd *cwd);
+
+#endif /* SAVE_CWD_H */
/* Look up an environment variable more securely.
- Copyright 2013-2014 Free Software Foundation, Inc.
+ Copyright 2013-2015 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
-/* Copyright (C) 1992, 1995-2003, 2005-2014 Free Software Foundation, Inc.
+/* Copyright (C) 1992, 1995-2003, 2005-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
This program is free software: you can redistribute it and/or modify
/* A GNU-like <signal.h>.
- Copyright (C) 2006-2014 Free Software Foundation, Inc.
+ Copyright (C) 2006-2015 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
/* size_max.h -- declare SIZE_MAX through system headers
- Copyright (C) 2005-2006, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2005-2006, 2009-2015 Free Software Foundation, Inc.
Written by Simon Josefsson.
This program is free software; you can redistribute it and/or modify
/* stat-related time functions.
- Copyright (C) 2005, 2007, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2005, 2007, 2009-2015 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
#endif
/* Return the nanosecond component of *ST's access time. */
-_GL_STAT_TIME_INLINE long int
+_GL_STAT_TIME_INLINE long int _GL_ATTRIBUTE_PURE
get_stat_atime_ns (struct stat const *st)
{
# if defined STAT_TIMESPEC
}
/* Return the nanosecond component of *ST's status change time. */
-_GL_STAT_TIME_INLINE long int
+_GL_STAT_TIME_INLINE long int _GL_ATTRIBUTE_PURE
get_stat_ctime_ns (struct stat const *st)
{
# if defined STAT_TIMESPEC
}
/* Return the nanosecond component of *ST's data modification time. */
-_GL_STAT_TIME_INLINE long int
+_GL_STAT_TIME_INLINE long int _GL_ATTRIBUTE_PURE
get_stat_mtime_ns (struct stat const *st)
{
# if defined STAT_TIMESPEC
}
/* Return the nanosecond component of *ST's birth time. */
-_GL_STAT_TIME_INLINE long int
+_GL_STAT_TIME_INLINE long int _GL_ATTRIBUTE_PURE
get_stat_birthtime_ns (struct stat const *st)
{
# if defined HAVE_STRUCT_STAT_ST_BIRTHTIMESPEC_TV_NSEC
}
/* Return *ST's access time. */
-_GL_STAT_TIME_INLINE struct timespec
+_GL_STAT_TIME_INLINE struct timespec _GL_ATTRIBUTE_PURE
get_stat_atime (struct stat const *st)
{
#ifdef STAT_TIMESPEC
}
/* Return *ST's status change time. */
-_GL_STAT_TIME_INLINE struct timespec
+_GL_STAT_TIME_INLINE struct timespec _GL_ATTRIBUTE_PURE
get_stat_ctime (struct stat const *st)
{
#ifdef STAT_TIMESPEC
}
/* Return *ST's data modification time. */
-_GL_STAT_TIME_INLINE struct timespec
+_GL_STAT_TIME_INLINE struct timespec _GL_ATTRIBUTE_PURE
get_stat_mtime (struct stat const *st)
{
#ifdef STAT_TIMESPEC
/* Return *ST's birth time, if available; otherwise return a value
with tv_sec and tv_nsec both equal to -1. */
-_GL_STAT_TIME_INLINE struct timespec
+_GL_STAT_TIME_INLINE struct timespec _GL_ATTRIBUTE_PURE
get_stat_birthtime (struct stat const *st)
{
struct timespec t;
/* Work around platform bugs in stat.
- Copyright (C) 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2009-2015 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
--- /dev/null
+#include <config.h>
+#define STATAT_INLINE _GL_EXTERN_INLINE
+#include "openat.h"
/* Substitute for and wrapper around <stdarg.h>.
- Copyright (C) 2008-2014 Free Software Foundation, Inc.
+ Copyright (C) 2008-2015 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
-/* Copyright (C) 2001-2003, 2006-2014 Free Software Foundation, Inc.
+/* Copyright (C) 2001-2003, 2006-2015 Free Software Foundation, Inc.
Written by Bruno Haible <haible@clisp.cons.org>, 2001.
This program is free software; you can redistribute it and/or modify
/* A substitute for POSIX 2008 <stddef.h>, for platforms that have issues.
- Copyright (C) 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2009-2015 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
# if !(defined _@GUARD_PREFIX@_STDDEF_H && defined _GL_STDDEF_WINT_T)
# ifdef __need_wint_t
-# undef _@GUARD_PREFIX@_STDDEF_H
# define _GL_STDDEF_WINT_T
# endif
# @INCLUDE_NEXT@ @NEXT_STDDEF_H@
# @INCLUDE_NEXT@ @NEXT_STDDEF_H@
-# ifndef _@GUARD_PREFIX@_STDDEF_H
-# define _@GUARD_PREFIX@_STDDEF_H
-
/* On NetBSD 5.0, the definition of NULL lacks proper parentheses. */
-#if @REPLACE_NULL@
-# undef NULL
-# ifdef __cplusplus
+# if (@REPLACE_NULL@ \
+ && (!defined _@GUARD_PREFIX@_STDDEF_H || defined _GL_STDDEF_WINT_T))
+# undef NULL
+# ifdef __cplusplus
/* ISO C++ says that the macro NULL must expand to an integer constant
expression, hence '((void *) 0)' is not allowed in C++. */
-# if __GNUG__ >= 3
+# if __GNUG__ >= 3
/* GNU C++ has a __null macro that behaves like an integer ('int' or
'long') but has the same size as a pointer. Use that, to avoid
warnings. */
-# define NULL __null
-# else
-# define NULL 0L
+# define NULL __null
+# else
+# define NULL 0L
+# endif
+# else
+# define NULL ((void *) 0)
+# endif
# endif
-# else
-# define NULL ((void *) 0)
-# endif
-#endif
+
+# ifndef _@GUARD_PREFIX@_STDDEF_H
+# define _@GUARD_PREFIX@_STDDEF_H
/* Some platforms lack wchar_t. */
#if !@HAVE_WCHAR_T@
# define wchar_t int
#endif
+/* Some platforms lack max_align_t. */
+#if !@HAVE_MAX_ALIGN_T@
+typedef union
+{
+ char *__p;
+ double __d;
+ long double __ld;
+ long int __i;
+} max_align_t;
+#endif
+
# endif /* _@GUARD_PREFIX@_STDDEF_H */
# endif /* _@GUARD_PREFIX@_STDDEF_H */
#endif /* __need_XXX */
-/* Copyright (C) 2001-2002, 2004-2014 Free Software Foundation, Inc.
+/* Copyright (C) 2001-2002, 2004-2015 Free Software Foundation, Inc.
Written by Paul Eggert, Bruno Haible, Sam Steingold, Peter Burwood.
This file is part of gnulib.
/* A GNU-like <stdio.h>.
- Copyright (C) 2004, 2007-2014 Free Software Foundation, Inc.
+ Copyright (C) 2004, 2007-2015 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
except that it indicates to GCC that the supported format string directives
are the ones of the system printf(), rather than the ones standardized by
ISO C99 and POSIX. */
-#define _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM(formatstring_parameter, first_argument) \
+#if GNULIB_PRINTF_ATTRIBUTE_FLAVOR_GNU
+# define _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM(formatstring_parameter, first_argument) \
+ _GL_ATTRIBUTE_FORMAT_PRINTF (formatstring_parameter, first_argument)
+#else
+# define _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM(formatstring_parameter, first_argument) \
_GL_ATTRIBUTE_FORMAT ((__printf__, formatstring_parameter, first_argument))
+#endif
/* _GL_ATTRIBUTE_FORMAT_SCANF
indicates to GCC that the function takes a format string and arguments,
/* A GNU-like <stdlib.h>.
- Copyright (C) 1995, 2001-2004, 2006-2014 Free Software Foundation, Inc.
+ Copyright (C) 1995, 2001-2004, 2006-2015 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
--- /dev/null
+/* Copyright (C) 1991, 1996-1998, 2002-2004, 2006-2007, 2009-2015 Free Software
+ Foundation, Inc.
+
+ This file is part of the GNU C Library.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3, or (at your option)
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with this program; if not, see <http://www.gnu.org/licenses/>. */
+
+#ifndef _LIBC
+# include <config.h>
+#endif
+
+/* Get specification. */
+#include <string.h>
+
+#include <stdlib.h>
+
+#undef __strdup
+#ifdef _LIBC
+# undef strdup
+#endif
+
+#ifndef weak_alias
+# define __strdup strdup
+#endif
+
+/* Duplicate S, returning an identical malloc'd string. */
+char *
+__strdup (const char *s)
+{
+ size_t len = strlen (s) + 1;
+ void *new = malloc (len);
+
+ if (new == NULL)
+ return NULL;
+
+ return (char *) memcpy (new, s, len);
+}
+#ifdef libc_hidden_def
+libc_hidden_def (__strdup)
+#endif
+#ifdef weak_alias
+weak_alias (__strdup, strdup)
+#endif
/* Optimized string comparison.
- Copyright (C) 2001-2002, 2007, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2001-2002, 2007, 2009-2015 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
/* strerror-override.c --- POSIX compatible system error routine
- Copyright (C) 2010-2014 Free Software Foundation, Inc.
+ Copyright (C) 2010-2015 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
/* strerror-override.h --- POSIX compatible system error routine
- Copyright (C) 2010-2014 Free Software Foundation, Inc.
+ Copyright (C) 2010-2015 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
/* strerror.c --- POSIX compatible system error routine
- Copyright (C) 2007-2014 Free Software Foundation, Inc.
+ Copyright (C) 2007-2015 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
/* A GNU-like <string.h>.
- Copyright (C) 1995-1996, 2001-2014 Free Software Foundation, Inc.
+ Copyright (C) 1995-1996, 2001-2015 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
/* stripslash.c -- remove redundant trailing slashes from a file name
- Copyright (C) 1990, 2001, 2003-2006, 2009-2014 Free Software Foundation,
+ Copyright (C) 1990, 2001, 2003-2006, 2009-2015 Free Software Foundation,
Inc.
This program is free software: you can redistribute it and/or modify
/* A replacement function, for systems that lack strndup.
- Copyright (C) 1996-1998, 2001-2003, 2005-2007, 2009-2014 Free Software
+ Copyright (C) 1996-1998, 2001-2003, 2005-2007, 2009-2015 Free Software
Foundation, Inc.
This program is free software; you can redistribute it and/or modify it
/* Find the length of STRING, but scan at most MAXLEN characters.
- Copyright (C) 2005-2007, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2005-2007, 2009-2015 Free Software Foundation, Inc.
Written by Simon Josefsson.
This program is free software; you can redistribute it and/or modify
/* Stub for symlink().
- Copyright (C) 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2009-2015 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
--- /dev/null
+/* Create a symlink relative to an open directory.
+ Copyright (C) 2009-2015 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 */
+
+#include <config.h>
+
+#include <unistd.h>
+#include <errno.h>
+
+#if HAVE_SYMLINKAT
+# undef symlinkat
+
+/* Create a symlink, but reject trailing slash. */
+int
+rpl_symlinkat (char const *contents, int fd, char const *name)
+{
+ size_t len = strlen (name);
+ if (len && name[len - 1] == '/')
+ {
+ struct stat st;
+ if (fstatat (fd, name, &st, 0) == 0)
+ errno = EEXIST;
+ return -1;
+ }
+ return symlinkat (contents, fd, name);
+}
+
+#elif !HAVE_SYMLINK
+/* Mingw lacks symlink, and it is more efficient to provide a trivial
+ wrapper than to go through at-func.c to call rpl_symlink. */
+
+int
+symlinkat (char const *path1 _GL_UNUSED, int fd _GL_UNUSED,
+ char const *path2 _GL_UNUSED)
+{
+ errno = ENOSYS;
+ return -1;
+}
+
+#else /* HAVE_SYMLINK */
+
+/* Our openat helper functions expect the directory parameter first,
+ not second. These shims make life easier. */
+
+/* Like symlink, but with arguments reversed. */
+static int
+symlink_reversed (char const *file, char const *contents)
+{
+ return symlink (contents, file);
+}
+
+/* Like symlinkat, but with arguments reversed. */
+
+static int
+symlinkat_reversed (int fd, char const *file, char const *contents);
+
+# define AT_FUNC_NAME symlinkat_reversed
+# define AT_FUNC_F1 symlink_reversed
+# define AT_FUNC_POST_FILE_PARAM_DECLS , char const *contents
+# define AT_FUNC_POST_FILE_ARGS , contents
+# include "at-func.c"
+# undef AT_FUNC_NAME
+# undef AT_FUNC_F1
+# undef AT_FUNC_POST_FILE_PARAM_DECLS
+# undef AT_FUNC_POST_FILE_ARGS
+
+/* Create a symlink FILE, in the directory open on descriptor FD,
+ holding CONTENTS. If possible, do it without changing the
+ working directory. Otherwise, resort to using save_cwd/fchdir,
+ then symlink/restore_cwd. If either the save_cwd or the restore_cwd
+ fails, then give a diagnostic and exit nonzero. */
+
+int
+symlinkat (char const *contents, int fd, char const *file)
+{
+ return symlinkat_reversed (fd, file, contents);
+}
+
+#endif /* HAVE_SYMLINK */
/* Provide a more complete sys/stat header file.
- Copyright (C) 2005-2014 Free Software Foundation, Inc.
+ Copyright (C) 2005-2015 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
/* Provide a more complete sys/time.h.
- Copyright (C) 2007-2014 Free Software Foundation, Inc.
+ Copyright (C) 2007-2015 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
/* Provide a more complete sys/types.h.
- Copyright (C) 2011-2014 Free Software Foundation, Inc.
+ Copyright (C) 2011-2015 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
/* tempname.c - generate the name of a temporary file.
- Copyright (C) 1991-2003, 2005-2007, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 1991-2003, 2005-2007, 2009-2015 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
/* Create a temporary file or directory.
- Copyright (C) 2006, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2006, 2009-2015 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
/* A more-standard <time.h>.
- Copyright (C) 2007-2014 Free Software Foundation, Inc.
+ Copyright (C) 2007-2015 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
# include <sys/time.h>
# elif @PTHREAD_H_DEFINES_STRUCT_TIMESPEC@
# include <pthread.h>
+# elif @UNISTD_H_DEFINES_STRUCT_TIMESPEC@
+# include <unistd.h>
# else
# ifdef __cplusplus
/* Reentrant time functions like localtime_r.
- Copyright (C) 2003, 2006-2007, 2010-2014 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2006-2007, 2010-2015 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
/* timespec -- System time interface
- Copyright (C) 2000, 2002, 2004-2005, 2007, 2009-2014 Free Software
+ Copyright (C) 2000, 2002, 2004-2005, 2007, 2009-2015 Free Software
Foundation, Inc.
This program is free software: you can redistribute it and/or modify
The (int) cast avoids a gcc -Wconversion warning. */
-_GL_TIMESPEC_INLINE int
+_GL_TIMESPEC_INLINE int _GL_ATTRIBUTE_PURE
timespec_cmp (struct timespec a, struct timespec b)
{
return (a.tv_sec < b.tv_sec ? -1
/* Return -1, 0, 1, depending on the sign of A. A.tv_nsec must be
nonnegative. */
-_GL_TIMESPEC_INLINE int
+_GL_TIMESPEC_INLINE int _GL_ATTRIBUTE_PURE
timespec_sign (struct timespec a)
{
return a.tv_sec < 0 ? -1 : a.tv_sec || a.tv_nsec;
/* Like unistd.h, but redefine some names to avoid glitches.
- Copyright (C) 2005, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2005, 2009-2015 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
/* Invoke unistd-like functions, but avoid some glitches.
- Copyright (C) 2001, 2003, 2005, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2001, 2003, 2005, 2009-2015 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
/* Substitute for and wrapper around <unistd.h>.
- Copyright (C) 2003-2014 Free Software Foundation, Inc.
+ Copyright (C) 2003-2015 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
"VARIABLE=VALUE", terminated with a NULL. */
# if defined __APPLE__ && defined __MACH__
# include <TargetConditionals.h>
-# if !defined TARGET_OS_IPHONE && !defined TARGET_IPHONE_SIMULATOR
+# if !TARGET_OS_IPHONE && !TARGET_IPHONE_SIMULATOR
# define _GL_USE_CRT_EXTERNS
# endif
# endif
/* Work around unlink bugs.
- Copyright (C) 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2009-2015 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
--- /dev/null
+/* Work around unlinkat bugs on Solaris 9 and Hurd.
+
+ Copyright (C) 2009-2015 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. */
+
+#include <config.h>
+
+#include <unistd.h>
+
+#include <errno.h>
+#include <fcntl.h>
+#include <string.h>
+#include <sys/stat.h>
+
+#include <stdlib.h>
+
+#include "dosname.h"
+#include "openat.h"
+
+#if HAVE_UNLINKAT
+
+# undef unlinkat
+
+/* unlinkat without AT_REMOVEDIR does not honor trailing / on Solaris
+ 9. Solve it in a similar manner to unlink. Hurd has the same
+ issue. */
+
+int
+rpl_unlinkat (int fd, char const *name, int flag)
+{
+ size_t len;
+ int result = 0;
+ /* rmdir behavior has no problems with trailing slash. */
+ if (flag & AT_REMOVEDIR)
+ return unlinkat (fd, name, flag);
+
+ len = strlen (name);
+ if (len && ISSLASH (name[len - 1]))
+ {
+ /* See the lengthy comment in unlink.c why we disobey the POSIX
+ rule of letting unlink("link-to-dir/") attempt to unlink a
+ directory. */
+ struct stat st;
+ result = lstatat (fd, name, &st);
+ if (result == 0)
+ {
+ /* Trailing NUL will overwrite the trailing slash. */
+ char *short_name = malloc (len);
+ if (!short_name)
+ {
+ errno = EPERM;
+ return -1;
+ }
+ memcpy (short_name, name, len);
+ while (len && ISSLASH (short_name[len - 1]))
+ short_name[--len] = '\0';
+ if (len && (lstatat (fd, short_name, &st) || S_ISLNK (st.st_mode)))
+ {
+ free (short_name);
+ errno = EPERM;
+ return -1;
+ }
+ free (short_name);
+ }
+ }
+ if (!result)
+ result = unlinkat (fd, name, flag);
+ return result;
+}
+
+#else /* !HAVE_UNLINKAT */
+
+/* Replacement for Solaris' function by the same name.
+ <http://www.google.com/search?q=unlinkat+site:docs.sun.com>
+ First, try to simulate it via (unlink|rmdir) ("/proc/self/fd/FD/FILE").
+ Failing that, simulate it via save_cwd/fchdir/(unlink|rmdir)/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' unlinkat. */
+
+# define AT_FUNC_NAME unlinkat
+# define AT_FUNC_F1 rmdir
+# define AT_FUNC_F2 unlink
+# define AT_FUNC_USE_F1_COND AT_REMOVEDIR
+# define AT_FUNC_POST_FILE_PARAM_DECLS , int flag
+# define AT_FUNC_POST_FILE_ARGS /* empty */
+# include "at-func.c"
+# undef AT_FUNC_NAME
+# undef AT_FUNC_F1
+# undef AT_FUNC_F2
+# undef AT_FUNC_USE_F1_COND
+# undef AT_FUNC_POST_FILE_PARAM_DECLS
+# undef AT_FUNC_POST_FILE_ARGS
+
+#endif /* !HAVE_UNLINKAT */
-/* Copyright (C) 1992, 1995-2002, 2005-2014 Free Software Foundation, Inc.
+/* Copyright (C) 1992, 1995-2002, 2005-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
This program is free software: you can redistribute it and/or modify
/* Set file access and modification times.
- Copyright (C) 2003-2014 Free Software Foundation, Inc.
+ Copyright (C) 2003-2015 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
#define _GL_UTIMENS_INLINE _GL_EXTERN_INLINE
#include "utimens.h"
-#include <assert.h>
#include <errno.h>
#include <fcntl.h>
#include <stdbool.h>
{
int result = 0;
int utime_omit_count = 0;
- assert (timespec);
if ((timespec[0].tv_nsec != UTIME_NOW
&& timespec[0].tv_nsec != UTIME_OMIT
&& ! (0 <= timespec[0].tv_nsec
/* Set file access and modification times.
- Copyright 2012-2014 Free Software Foundation, Inc.
+ Copyright 2012-2015 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
--- /dev/null
+/* Set the access and modification time of a file relative to directory fd.
+ Copyright (C) 2009-2015 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 */
+
+#include <config.h>
+
+#include <sys/stat.h>
+
+#include <errno.h>
+#include <fcntl.h>
+
+#include "stat-time.h"
+#include "timespec.h"
+#include "utimens.h"
+
+#if HAVE_UTIMENSAT
+
+# undef utimensat
+
+/* If we have a native utimensat, but are compiling this file, then
+ utimensat was defined to rpl_utimensat by our replacement
+ sys/stat.h. We assume the native version might fail with ENOSYS,
+ or succeed without properly affecting ctime (as is the case when
+ using newer glibc but older Linux kernel). In this scenario,
+ rpl_utimensat checks whether the native version is usable, and
+ local_utimensat provides the fallback manipulation. */
+
+static int local_utimensat (int, char const *, struct timespec const[2], int);
+# define AT_FUNC_NAME local_utimensat
+
+/* Like utimensat, but work around native bugs. */
+
+int
+rpl_utimensat (int fd, char const *file, struct timespec const times[2],
+ int flag)
+{
+# if defined __linux__ || defined __sun
+ struct timespec ts[2];
+# endif
+
+ /* See comments in utimens.c for details. */
+ static int utimensat_works_really; /* 0 = unknown, 1 = yes, -1 = no. */
+ if (0 <= utimensat_works_really)
+ {
+ int result;
+# if defined __linux__ || defined __sun
+ struct stat st;
+ /* As recently as Linux kernel 2.6.32 (Dec 2009), several file
+ systems (xfs, ntfs-3g) have bugs with a single UTIME_OMIT,
+ but work if both times are either explicitly specified or
+ UTIME_NOW. Work around it with a preparatory [l]stat prior
+ to calling utimensat; fortunately, there is not much timing
+ impact due to the extra syscall even on file systems where
+ UTIME_OMIT would have worked.
+
+ The same bug occurs in Solaris 11.1 (Apr 2013).
+
+ FIXME: Simplify this for Linux in 2016 and for Solaris in
+ 2024, when file system bugs are no longer common. */
+ if (times && (times[0].tv_nsec == UTIME_OMIT
+ || times[1].tv_nsec == UTIME_OMIT))
+ {
+ if (fstatat (fd, file, &st, flag))
+ return -1;
+ if (times[0].tv_nsec == UTIME_OMIT && times[1].tv_nsec == UTIME_OMIT)
+ return 0;
+ if (times[0].tv_nsec == UTIME_OMIT)
+ ts[0] = get_stat_atime (&st);
+ else
+ ts[0] = times[0];
+ if (times[1].tv_nsec == UTIME_OMIT)
+ ts[1] = get_stat_mtime (&st);
+ else
+ ts[1] = times[1];
+ times = ts;
+ }
+# ifdef __hppa__
+ /* Linux kernel 2.6.22.19 on hppa does not reject invalid tv_nsec
+ values. */
+ else if (times
+ && ((times[0].tv_nsec != UTIME_NOW
+ && ! (0 <= times[0].tv_nsec
+ && times[0].tv_nsec < TIMESPEC_RESOLUTION))
+ || (times[1].tv_nsec != UTIME_NOW
+ && ! (0 <= times[1].tv_nsec
+ && times[1].tv_nsec < TIMESPEC_RESOLUTION))))
+ {
+ errno = EINVAL;
+ return -1;
+ }
+# endif
+# endif
+ result = utimensat (fd, file, times, flag);
+ /* Linux kernel 2.6.25 has a bug where it returns EINVAL for
+ UTIME_NOW or UTIME_OMIT with non-zero tv_sec, which
+ local_utimensat works around. Meanwhile, EINVAL for a bad
+ flag is indeterminate whether the native utimensat works, but
+ local_utimensat will also reject it. */
+ if (result == -1 && errno == EINVAL && (flag & ~AT_SYMLINK_NOFOLLOW))
+ return result;
+ if (result == 0 || (errno != ENOSYS && errno != EINVAL))
+ {
+ utimensat_works_really = 1;
+ return result;
+ }
+ }
+ /* No point in trying openat/futimens, since on Linux, futimens is
+ implemented with the same syscall as utimensat. Only avoid the
+ native utimensat due to an ENOSYS failure; an EINVAL error was
+ data-dependent, and the next caller may pass valid data. */
+ if (0 <= utimensat_works_really && errno == ENOSYS)
+ utimensat_works_really = -1;
+ return local_utimensat (fd, file, times, flag);
+}
+
+#else /* !HAVE_UTIMENSAT */
+
+# define AT_FUNC_NAME utimensat
+
+#endif /* !HAVE_UTIMENSAT */
+
+/* Set the access and modification time stamps of FILE to be
+ TIMESPEC[0] and TIMESPEC[1], respectively; relative to directory
+ FD. If flag is AT_SYMLINK_NOFOLLOW, change the times of a symlink,
+ or fail with ENOSYS if not possible. If TIMESPEC is null, set the
+ time stamps to the current time. If possible, do it without
+ changing the working directory. Otherwise, resort to using
+ save_cwd/fchdir, then utimens/restore_cwd. If either the save_cwd
+ or the restore_cwd fails, then give a diagnostic and exit nonzero.
+ Return 0 on success, -1 (setting errno) on failure. */
+
+/* AT_FUNC_NAME is now utimensat or local_utimensat. */
+#define AT_FUNC_F1 lutimens
+#define AT_FUNC_F2 utimens
+#define AT_FUNC_USE_F1_COND AT_SYMLINK_NOFOLLOW
+#define AT_FUNC_POST_FILE_PARAM_DECLS , struct timespec const ts[2], int flag
+#define AT_FUNC_POST_FILE_ARGS , ts
+#include "at-func.c"
+#undef AT_FUNC_NAME
+#undef AT_FUNC_F1
+#undef AT_FUNC_F2
+#undef AT_FUNC_USE_F1_COND
+#undef AT_FUNC_POST_FILE_PARAM_DECLS
+#undef AT_FUNC_POST_FILE_ARGS
/* vsprintf with automatic memory allocation.
- Copyright (C) 1999, 2002-2014 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002-2015 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
/* SNPRINTF or sprintf failed. Save and use the errno
that it has set, if any. */
int saved_errno = errno;
+ if (saved_errno == 0)
+ {
+ if (dp->conversion == 'c' || dp->conversion == 's')
+ saved_errno = EILSEQ;
+ else
+ saved_errno = EINVAL;
+ }
if (!(result == resultbuf || result == NULL))
free (result);
if (buf_malloced != NULL)
free (buf_malloced);
CLEANUP ();
- errno =
- (saved_errno != 0
- ? saved_errno
- : (dp->conversion == 'c' || dp->conversion == 's'
- ? EILSEQ
- : EINVAL));
+
+ errno = saved_errno;
return NULL;
}
/* vsprintf with automatic memory allocation.
- Copyright (C) 2002-2004, 2007-2014 Free Software Foundation, Inc.
+ Copyright (C) 2002-2004, 2007-2015 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
/* Formatted output to strings.
- Copyright (C) 1999, 2002, 2006-2014 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002, 2006-2015 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
/* Compile-time assert-like macros.
- Copyright (C) 2005-2006, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2005-2006, 2009-2015 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
/* va_list error handler for noninteractive utilities
- Copyright (C) 2006-2007, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2006-2007, 2009-2015 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
/* Declaration for va_list error-reporting function
- Copyright (C) 2006-2007, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2006-2007, 2009-2015 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
/* A substitute for ISO C99 <wchar.h>, for platforms that have issues.
- Copyright (C) 2007-2014 Free Software Foundation, Inc.
+ Copyright (C) 2007-2015 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
/* A substitute for ISO C99 <wctype.h>, for platforms that lack it.
- Copyright (C) 2006-2014 Free Software Foundation, Inc.
+ Copyright (C) 2006-2015 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
/* POSIX compatible write() function.
- Copyright (C) 2008-2014 Free Software Foundation, Inc.
+ Copyright (C) 2008-2015 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2008.
This program is free software: you can redistribute it and/or modify
/* Report a memory allocation failure and exit.
- Copyright (C) 1997-2000, 2002-2004, 2006, 2009-2014 Free Software
+ Copyright (C) 1997-2000, 2002-2004, 2006, 2009-2015 Free Software
Foundation, Inc.
This program is free software: you can redistribute it and/or modify
/* xalloc-oversized.h -- memory allocation size checking
- Copyright (C) 1990-2000, 2003-2004, 2006-2014 Free Software Foundation, Inc.
+ Copyright (C) 1990-2000, 2003-2004, 2006-2015 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
/* xalloc.h -- malloc with out-of-memory checking
- Copyright (C) 1990-2000, 2003-2004, 2006-2014 Free Software Foundation, Inc.
+ Copyright (C) 1990-2000, 2003-2004, 2006-2015 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
/* vasprintf and asprintf with out-of-memory checking.
- Copyright (C) 1999, 2002-2004, 2006, 2009-2014 Free Software Foundation,
+ Copyright (C) 1999, 2002-2004, 2006, 2009-2015 Free Software Foundation,
Inc.
This program is free software: you can redistribute it and/or modify
/* xmalloc.c -- malloc with out of memory checking
- Copyright (C) 1990-2000, 2002-2006, 2008-2014 Free Software Foundation, Inc.
+ Copyright (C) 1990-2000, 2002-2006, 2008-2015 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
/* xmemdup0.c -- copy a block of arbitrary bytes, plus a trailing NUL
- Copyright (C) 2008-2014 Free Software Foundation, Inc.
+ Copyright (C) 2008-2015 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
/* xmemdup0.h -- copy a block of arbitrary bytes, plus a trailing NUL
- Copyright (C) 2008-2014 Free Software Foundation, Inc.
+ Copyright (C) 2008-2015 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
/* xsize.h -- Checked size_t computations.
- Copyright (C) 2003, 2008-2014 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2008-2015 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
/* Duplicate a bounded initial segment of a string, with out-of-memory
checking.
- Copyright (C) 2003, 2006-2007, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2006-2007, 2009-2015 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
/* Duplicate a bounded initial segment of a string, with out-of-memory
checking.
- Copyright (C) 2003, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2009-2015 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
/* vasprintf and asprintf with out-of-memory checking.
- Copyright (C) 1999, 2002-2004, 2006-2014 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002-2004, 2006-2015 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
/* vasprintf and asprintf with out-of-memory checking.
- Copyright (C) 2002-2004, 2006-2014 Free Software Foundation, Inc.
+ Copyright (C) 2002-2004, 2006-2015 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
# 00gnulib.m4 serial 3
-dnl Copyright (C) 2009-2014 Free Software Foundation, Inc.
+dnl Copyright (C) 2009-2015 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.
# absolute-header.m4 serial 16
-dnl Copyright (C) 2006-2014 Free Software Foundation, Inc.
+dnl Copyright (C) 2006-2015 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.
# alloca.m4 serial 14
-dnl Copyright (C) 2002-2004, 2006-2007, 2009-2014 Free Software Foundation,
+dnl Copyright (C) 2002-2004, 2006-2007, 2009-2015 Free Software Foundation,
dnl Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
# backupfile.m4 serial 14
-dnl Copyright (C) 2002-2006, 2009-2014 Free Software Foundation, Inc.
+dnl Copyright (C) 2002-2006, 2009-2015 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.
# serial 7
-# Copyright (C) 2002, 2005, 2009-2014 Free Software Foundation, Inc.
+# Copyright (C) 2002, 2005, 2009-2015 Free Software Foundation, Inc.
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# canonicalize.m4 serial 26
-dnl Copyright (C) 2003-2007, 2009-2014 Free Software Foundation, Inc.
+dnl Copyright (C) 2003-2007, 2009-2015 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
--- /dev/null
+#serial 15
+
+# Use Gnulib's robust chdir function.
+# It can handle arbitrarily long directory names, which means
+# that when it is given the name of an existing directory, it
+# never fails with ENAMETOOLONG.
+# Arrange to compile chdir-long.c only on systems that define PATH_MAX.
+
+dnl Copyright (C) 2004-2007, 2009-2015 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.
+
+# Written by Jim Meyering.
+
+AC_DEFUN([gl_FUNC_CHDIR_LONG],
+[
+ AC_REQUIRE([gl_PATHMAX_SNIPPET_PREREQ])
+ AC_CACHE_CHECK([whether this system has an arbitrary file name length limit],
+ gl_cv_have_arbitrary_file_name_length_limit,
+ [AC_EGREP_CPP([have_arbitrary_file_name_length_limit],
+ gl_PATHMAX_SNIPPET[
+#ifdef PATH_MAX
+have_arbitrary_file_name_length_limit
+#endif],
+ gl_cv_have_arbitrary_file_name_length_limit=yes,
+ gl_cv_have_arbitrary_file_name_length_limit=no)])
+])
+
+AC_DEFUN([gl_PREREQ_CHDIR_LONG], [:])
--- /dev/null
+# serial 27
+# Determine whether we need the chown wrapper.
+
+dnl Copyright (C) 1997-2001, 2003-2005, 2007, 2009-2015 Free Software
+dnl 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.
+
+# chown should accept arguments of -1 for uid and gid, and it should
+# dereference symlinks. If it doesn't, arrange to use the replacement
+# function.
+
+# From Jim Meyering.
+
+m4_version_prereq([2.70], [] ,[
+
+# This is taken from the following Autoconf patch:
+# http://git.savannah.gnu.org/gitweb/?p=autoconf.git;a=commitdiff;h=7fbb553727ed7e0e689a17594b58559ecf3ea6e9
+AC_DEFUN([AC_FUNC_CHOWN],
+[
+ AC_REQUIRE([AC_TYPE_UID_T])dnl
+ AC_REQUIRE([AC_CANONICAL_HOST])dnl for cross-compiles
+ AC_CHECK_HEADERS([unistd.h])
+ AC_CACHE_CHECK([for working chown],
+ [ac_cv_func_chown_works],
+ [AC_RUN_IFELSE(
+ [AC_LANG_PROGRAM(
+ [AC_INCLUDES_DEFAULT
+ [#include <fcntl.h>
+ ]],
+ [[
+ char *f = "conftest.chown";
+ struct stat before, after;
+
+ if (creat (f, 0600) < 0)
+ return 1;
+ if (stat (f, &before) < 0)
+ return 1;
+ if (chown (f, (uid_t) -1, (gid_t) -1) == -1)
+ return 1;
+ if (stat (f, &after) < 0)
+ return 1;
+ return ! (before.st_uid == after.st_uid && before.st_gid == after.st_gid);
+ ]])
+ ],
+ [ac_cv_func_chown_works=yes],
+ [ac_cv_func_chown_works=no],
+ [case "$host_os" in # ((
+ # Guess yes on glibc systems.
+ *-gnu*) ac_cv_func_chown_works=yes ;;
+ # If we don't know, assume the worst.
+ *) ac_cv_func_chown_works=no ;;
+ esac
+ ])
+ rm -f conftest.chown
+ ])
+ if test $ac_cv_func_chown_works = yes; then
+ AC_DEFINE([HAVE_CHOWN], [1],
+ [Define to 1 if your system has a working `chown' function.])
+ fi
+])# AC_FUNC_CHOWN
+
+])
+
+AC_DEFUN_ONCE([gl_FUNC_CHOWN],
+[
+ AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
+ AC_REQUIRE([AC_TYPE_UID_T])
+ AC_REQUIRE([AC_FUNC_CHOWN])
+ AC_REQUIRE([gl_FUNC_CHOWN_FOLLOWS_SYMLINK])
+ AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
+ AC_CHECK_FUNCS_ONCE([chown fchown])
+
+ dnl mingw lacks chown altogether.
+ if test $ac_cv_func_chown = no; then
+ HAVE_CHOWN=0
+ else
+ dnl Some old systems treated chown like lchown.
+ if test $gl_cv_func_chown_follows_symlink = no; then
+ REPLACE_CHOWN=1
+ fi
+
+ dnl Some old systems tried to use uid/gid -1 literally.
+ if test $ac_cv_func_chown_works = no; then
+ AC_DEFINE([CHOWN_FAILS_TO_HONOR_ID_OF_NEGATIVE_ONE], [1],
+ [Define if chown is not POSIX compliant regarding IDs of -1.])
+ REPLACE_CHOWN=1
+ fi
+
+ dnl Solaris 9 ignores trailing slash.
+ dnl FreeBSD 7.2 mishandles trailing slash on symlinks.
+ dnl Likewise for AIX 7.1.
+ AC_CACHE_CHECK([whether chown honors trailing slash],
+ [gl_cv_func_chown_slash_works],
+ [touch conftest.file && rm -f conftest.link
+ AC_RUN_IFELSE([AC_LANG_PROGRAM([[
+#include <unistd.h>
+#include <stdlib.h>
+#include <errno.h>
+]], [[ if (symlink ("conftest.file", "conftest.link")) return 1;
+ if (chown ("conftest.link/", getuid (), getgid ()) == 0) return 2;
+ ]])],
+ [gl_cv_func_chown_slash_works=yes],
+ [gl_cv_func_chown_slash_works=no],
+ [case "$host_os" in
+ # Guess yes on glibc systems.
+ *-gnu*) gl_cv_func_chown_slash_works="guessing yes" ;;
+ # If we don't know, assume the worst.
+ *) gl_cv_func_chown_slash_works="guessing no" ;;
+ esac
+ ])
+ rm -f conftest.link conftest.file])
+ case "$gl_cv_func_chown_slash_works" in
+ *yes) ;;
+ *)
+ AC_DEFINE([CHOWN_TRAILING_SLASH_BUG], [1],
+ [Define to 1 if chown mishandles trailing slash.])
+ REPLACE_CHOWN=1
+ ;;
+ esac
+
+ dnl OpenBSD fails to update ctime if ownership does not change.
+ AC_CACHE_CHECK([whether chown always updates ctime],
+ [gl_cv_func_chown_ctime_works],
+ [AC_RUN_IFELSE([AC_LANG_PROGRAM([[
+#include <unistd.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <sys/stat.h>
+]], [[ struct stat st1, st2;
+ if (close (creat ("conftest.file", 0600))) return 1;
+ if (stat ("conftest.file", &st1)) return 2;
+ sleep (1);
+ if (chown ("conftest.file", st1.st_uid, st1.st_gid)) return 3;
+ if (stat ("conftest.file", &st2)) return 4;
+ if (st2.st_ctime <= st1.st_ctime) return 5;
+ ]])],
+ [gl_cv_func_chown_ctime_works=yes],
+ [gl_cv_func_chown_ctime_works=no],
+ [case "$host_os" in
+ # Guess yes on glibc systems.
+ *-gnu*) gl_cv_func_chown_ctime_works="guessing yes" ;;
+ # If we don't know, assume the worst.
+ *) gl_cv_func_chown_ctime_works="guessing no" ;;
+ esac
+ ])
+ rm -f conftest.file])
+ case "$gl_cv_func_chown_ctime_works" in
+ *yes) ;;
+ *)
+ AC_DEFINE([CHOWN_CHANGE_TIME_BUG], [1], [Define to 1 if chown fails
+ to change ctime when at least one argument was not -1.])
+ REPLACE_CHOWN=1
+ ;;
+ esac
+ fi
+])
+
+# Determine whether chown follows symlinks (it should).
+AC_DEFUN_ONCE([gl_FUNC_CHOWN_FOLLOWS_SYMLINK],
+[
+ AC_CACHE_CHECK(
+ [whether chown dereferences symlinks],
+ [gl_cv_func_chown_follows_symlink],
+ [
+ AC_RUN_IFELSE([AC_LANG_SOURCE([[
+#include <unistd.h>
+#include <stdlib.h>
+#include <errno.h>
+
+ int
+ main ()
+ {
+ int result = 0;
+ char const *dangling_symlink = "conftest.dangle";
+
+ unlink (dangling_symlink);
+ if (symlink ("conftest.no-such", dangling_symlink))
+ abort ();
+
+ /* Exit successfully on a conforming system,
+ i.e., where chown must fail with ENOENT. */
+ if (chown (dangling_symlink, getuid (), getgid ()) == 0)
+ result |= 1;
+ if (errno != ENOENT)
+ result |= 2;
+ return result;
+ }
+ ]])],
+ [gl_cv_func_chown_follows_symlink=yes],
+ [gl_cv_func_chown_follows_symlink=no],
+ [gl_cv_func_chown_follows_symlink=yes]
+ )
+ ]
+ )
+
+ if test $gl_cv_func_chown_follows_symlink = no; then
+ AC_DEFINE([CHOWN_MODIFIES_SYMLINK], [1],
+ [Define if chown modifies symlinks.])
+ fi
+])
# clock_time.m4 serial 10
-dnl Copyright (C) 2002-2006, 2009-2014 Free Software Foundation, Inc.
+dnl Copyright (C) 2002-2006, 2009-2015 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.
# close.m4 serial 8
-dnl Copyright (C) 2008-2014 Free Software Foundation, Inc.
+dnl Copyright (C) 2008-2015 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.
# closedir.m4 serial 2
-dnl Copyright (C) 2011-2014 Free Software Foundation, Inc.
+dnl Copyright (C) 2011-2015 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.
# codeset.m4 serial 5 (gettext-0.18.2)
-dnl Copyright (C) 2000-2002, 2006, 2008-2014 Free Software Foundation, Inc.
+dnl Copyright (C) 2000-2002, 2006, 2008-2015 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.
# configmake.m4 serial 2
-dnl Copyright (C) 2010-2014 Free Software Foundation, Inc.
+dnl Copyright (C) 2010-2015 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 Check whether struct dirent has a member named d_ino.
dnl
-# Copyright (C) 1997, 1999-2001, 2003-2004, 2006-2007, 2009-2014 Free Software
+# Copyright (C) 1997, 1999-2001, 2003-2004, 2006-2007, 2009-2015 Free Software
# Foundation, Inc.
# This file is free software; the Free Software Foundation
#serial 2
-dnl Copyright (C) 2009-2014 Free Software Foundation, Inc.
+dnl Copyright (C) 2009-2015 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.
# dirent_h.m4 serial 16
-dnl Copyright (C) 2008-2014 Free Software Foundation, Inc.
+dnl Copyright (C) 2008-2015 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 Find out how to get the file descriptor associated with an open DIR*.
-# Copyright (C) 2001-2006, 2008-2014 Free Software Foundation, Inc.
+# Copyright (C) 2001-2006, 2008-2015 Free Software Foundation, Inc.
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
#serial 10 -*- autoconf -*-
-dnl Copyright (C) 2002-2006, 2009-2014 Free Software Foundation, Inc.
+dnl Copyright (C) 2002-2006, 2009-2015 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.
# double-slash-root.m4 serial 4 -*- Autoconf -*-
-dnl Copyright (C) 2006, 2008-2014 Free Software Foundation, Inc.
+dnl Copyright (C) 2006, 2008-2015 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.
#serial 20
-dnl Copyright (C) 2002, 2005, 2007, 2009-2014 Free Software Foundation, Inc.
+dnl Copyright (C) 2002, 2005, 2007, 2009-2015 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.
# eealloc.m4 serial 3
-dnl Copyright (C) 2003, 2009-2014 Free Software Foundation, Inc.
+dnl Copyright (C) 2003, 2009-2015 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.
# environ.m4 serial 6
-dnl Copyright (C) 2001-2004, 2006-2014 Free Software Foundation, Inc.
+dnl Copyright (C) 2001-2004, 2006-2015 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.
# errno_h.m4 serial 12
-dnl Copyright (C) 2004, 2006, 2008-2014 Free Software Foundation, Inc.
+dnl Copyright (C) 2004, 2006, 2008-2015 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.
#serial 14
-# Copyright (C) 1996-1998, 2001-2004, 2009-2014 Free Software Foundation, Inc.
+# Copyright (C) 1996-1998, 2001-2004, 2009-2015 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# exponentd.m4 serial 3
-dnl Copyright (C) 2007-2008, 2010-2014 Free Software Foundation, Inc.
+dnl Copyright (C) 2007-2008, 2010-2015 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.
# serial 13 -*- Autoconf -*-
# Enable extensions on systems that normally disable them.
-# Copyright (C) 2003, 2006-2014 Free Software Foundation, Inc.
+# Copyright (C) 2003, 2006-2015 Free Software Foundation, Inc.
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
#ifndef _GNU_SOURCE
# undef _GNU_SOURCE
#endif
+/* Use GNU style printf and scanf. */
+#ifndef __USE_MINGW_ANSI_STDIO
+# undef __USE_MINGW_ANSI_STDIO
+#endif
/* Enable threading extensions on Solaris. */
#ifndef _POSIX_PTHREAD_SEMANTICS
# undef _POSIX_PTHREAD_SEMANTICS
AC_DEFINE([_ALL_SOURCE])
AC_DEFINE([_DARWIN_C_SOURCE])
AC_DEFINE([_GNU_SOURCE])
+ AC_DEFINE([__USE_MINGW_ANSI_STDIO])
AC_DEFINE([_POSIX_PTHREAD_SEMANTICS])
AC_DEFINE([_TANDEM_SOURCE])
AC_CACHE_CHECK([whether _XOPEN_SOURCE should be defined],
dnl 'extern inline' a la ISO C99.
-dnl Copyright 2012-2014 Free Software Foundation, Inc.
+dnl Copyright 2012-2015 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.
--- /dev/null
+# fchdir.m4 serial 21
+dnl Copyright (C) 2006-2015 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_FCHDIR],
+[
+ AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
+ AC_REQUIRE([gl_DIRENT_H_DEFAULTS])
+ AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
+
+ AC_CHECK_DECLS_ONCE([fchdir])
+ if test $ac_cv_have_decl_fchdir = no; then
+ HAVE_DECL_FCHDIR=0
+ fi
+
+ AC_REQUIRE([gl_TEST_FCHDIR])
+ if test $HAVE_FCHDIR = 0; then
+ AC_LIBOBJ([fchdir])
+ gl_PREREQ_FCHDIR
+ AC_DEFINE([REPLACE_FCHDIR], [1],
+ [Define to 1 if gnulib's fchdir() replacement is used.])
+ dnl We must also replace anything that can manipulate a directory fd,
+ dnl to keep our bookkeeping up-to-date. We don't have to replace
+ dnl fstatat, since no platform has fstatat but lacks fchdir.
+ AC_CACHE_CHECK([whether open can visit directories],
+ [gl_cv_func_open_directory_works],
+ [AC_RUN_IFELSE([AC_LANG_PROGRAM([[#include <fcntl.h>
+]], [return open(".", O_RDONLY) < 0;])],
+ [gl_cv_func_open_directory_works=yes],
+ [gl_cv_func_open_directory_works=no],
+ [case "$host_os" in
+ # Guess yes on glibc systems.
+ *-gnu*) gl_cv_func_open_directory_works="guessing yes" ;;
+ # If we don't know, assume the worst.
+ *) gl_cv_func_open_directory_works="guessing no" ;;
+ esac
+ ])])
+ case "$gl_cv_func_open_directory_works" in
+ *yes) ;;
+ *)
+ AC_DEFINE([REPLACE_OPEN_DIRECTORY], [1], [Define to 1 if open() should
+work around the inability to open a directory.])
+ ;;
+ esac
+ fi
+])
+
+# Determine whether to use the overrides in lib/fchdir.c.
+AC_DEFUN([gl_TEST_FCHDIR],
+[
+ AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
+ AC_CHECK_FUNCS_ONCE([fchdir])
+ if test $ac_cv_func_fchdir = no; then
+ HAVE_FCHDIR=0
+ fi
+])
+
+# Prerequisites of lib/fchdir.c.
+AC_DEFUN([gl_PREREQ_FCHDIR], [:])
--- /dev/null
+# fchmodat.m4 serial 1
+dnl Copyright (C) 2004-2015 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.
+
+# Written by Jim Meyering.
+
+AC_DEFUN([gl_FUNC_FCHMODAT],
+[
+ AC_REQUIRE([gl_SYS_STAT_H_DEFAULTS])
+ AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
+ AC_CHECK_FUNCS_ONCE([fchmodat lchmod])
+ if test $ac_cv_func_fchmodat != yes; then
+ HAVE_FCHMODAT=0
+ fi
+])
--- /dev/null
+# fchownat.m4 serial 1
+dnl Copyright (C) 2004-2015 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.
+
+# Written by Jim Meyering.
+
+# If we have the fchownat function, and it has the bug (in glibc-2.4)
+# that it dereferences symlinks even with AT_SYMLINK_NOFOLLOW, then
+# use the replacement function.
+# Also if the fchownat function, like chown, has the trailing slash bug,
+# use the replacement function.
+# Also use the replacement function if fchownat is simply not available.
+AC_DEFUN([gl_FUNC_FCHOWNAT],
+[
+ AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
+ AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
+ AC_REQUIRE([gl_FUNC_CHOWN])
+ AC_CHECK_FUNC([fchownat],
+ [gl_FUNC_FCHOWNAT_DEREF_BUG(
+ [REPLACE_FCHOWNAT=1
+ AC_DEFINE([FCHOWNAT_NOFOLLOW_BUG], [1],
+ [Define to 1 if your platform has fchownat, but it cannot
+ perform lchown tasks.])
+ ])
+ gl_FUNC_FCHOWNAT_EMPTY_FILENAME_BUG(
+ [REPLACE_FCHOWNAT=1
+ AC_DEFINE([FCHOWNAT_EMPTY_FILENAME_BUG], [1],
+ [Define to 1 if your platform has fchownat, but it does
+ not reject an empty file name.])
+ ])
+ if test $REPLACE_CHOWN = 1; then
+ REPLACE_FCHOWNAT=1
+ fi],
+ [HAVE_FCHOWNAT=0])
+])
+
+# gl_FUNC_FCHOWNAT_DEREF_BUG([ACTION-IF-BUGGY[, ACTION-IF-NOT_BUGGY]])
+AC_DEFUN([gl_FUNC_FCHOWNAT_DEREF_BUG],
+[
+ dnl Persuade glibc's <unistd.h> to declare fchownat().
+ AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
+
+ AC_CACHE_CHECK([whether fchownat works with AT_SYMLINK_NOFOLLOW],
+ gl_cv_func_fchownat_nofollow_works,
+ [
+ gl_dangle=conftest.dangle
+ # Remove any remnants of a previous test.
+ rm -f $gl_dangle
+ # Arrange for deletion of the temporary file this test creates.
+ ac_clean_files="$ac_clean_files $gl_dangle"
+ ln -s conftest.no-such $gl_dangle
+ AC_RUN_IFELSE(
+ [AC_LANG_SOURCE(
+ [[
+#include <fcntl.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <sys/types.h>
+int
+main ()
+{
+ return (fchownat (AT_FDCWD, "$gl_dangle", -1, getgid (),
+ AT_SYMLINK_NOFOLLOW) != 0
+ && errno == ENOENT);
+}
+ ]])],
+ [gl_cv_func_fchownat_nofollow_works=yes],
+ [gl_cv_func_fchownat_nofollow_works=no],
+ [gl_cv_func_fchownat_nofollow_works=no],
+ )
+ ])
+ AS_IF([test $gl_cv_func_fchownat_nofollow_works = no], [$1], [$2])
+])
+
+# gl_FUNC_FCHOWNAT_EMPTY_FILENAME_BUG([ACTION-IF-BUGGY[, ACTION-IF-NOT_BUGGY]])
+AC_DEFUN([gl_FUNC_FCHOWNAT_EMPTY_FILENAME_BUG],
+[
+ dnl Persuade glibc's <unistd.h> to declare fchownat().
+ AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
+
+ AC_CACHE_CHECK([whether fchownat works with an empty file name],
+ [gl_cv_func_fchownat_empty_filename_works],
+ [AC_RUN_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[#include <unistd.h>
+ #include <fcntl.h>
+ ]],
+ [[int fd;
+ int ret;
+ if (mkdir ("conftestdir", 0700) < 0)
+ return 2;
+ fd = open ("conftestdir", O_RDONLY);
+ if (fd < 0)
+ return 3;
+ ret = fchownat (fd, "", -1, -1, 0);
+ close (fd);
+ rmdir ("conftestdir");
+ return ret == 0;
+ ]])],
+ [gl_cv_func_fchownat_empty_filename_works=yes],
+ [gl_cv_func_fchownat_empty_filename_works=no],
+ [gl_cv_func_fchownat_empty_filename_works="guessing no"])
+ ])
+ AS_IF([test "$gl_cv_func_fchownat_empty_filename_works" != yes], [$1], [$2])
+])
# fcntl-o.m4 serial 4
-dnl Copyright (C) 2006, 2009-2014 Free Software Foundation, Inc.
+dnl Copyright (C) 2006, 2009-2015 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.
# fcntl.m4 serial 5
-dnl Copyright (C) 2009-2014 Free Software Foundation, Inc.
+dnl Copyright (C) 2009-2015 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.
# serial 15
# Configure fcntl.h.
-dnl Copyright (C) 2006-2007, 2009-2014 Free Software Foundation, Inc.
+dnl Copyright (C) 2006-2007, 2009-2015 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.
--- /dev/null
+# filenamecat.m4 serial 11
+dnl Copyright (C) 2002-2006, 2009-2015 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_FILE_NAME_CONCAT],
+[
+ AC_REQUIRE([gl_FILE_NAME_CONCAT_LGPL])
+])
+
+AC_DEFUN([gl_FILE_NAME_CONCAT_LGPL],
+[
+ dnl Prerequisites of lib/filenamecat-lgpl.c.
+ AC_CHECK_FUNCS_ONCE([mempcpy])
+])
# float_h.m4 serial 9
-dnl Copyright (C) 2007, 2009-2014 Free Software Foundation, Inc.
+dnl Copyright (C) 2007, 2009-2015 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.
# fstat.m4 serial 4
-dnl Copyright (C) 2011-2014 Free Software Foundation, Inc.
+dnl Copyright (C) 2011-2015 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.
--- /dev/null
+# fstatat.m4 serial 3
+dnl Copyright (C) 2004-2015 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.
+
+# Written by Jim Meyering.
+
+# If we have the fstatat function, and it has the bug (in AIX 7.1)
+# that it does not fill in st_size correctly, use the replacement function.
+AC_DEFUN([gl_FUNC_FSTATAT],
+[
+ AC_REQUIRE([gl_SYS_STAT_H_DEFAULTS])
+ AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
+ AC_REQUIRE([gl_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK])
+ AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
+ AC_CHECK_FUNCS_ONCE([fstatat])
+
+ if test $ac_cv_func_fstatat = no; then
+ HAVE_FSTATAT=0
+ else
+ dnl Test for an AIX 7.1 bug; see
+ dnl <http://lists.gnu.org/archive/html/bug-tar/2011-09/msg00015.html>.
+ AC_CACHE_CHECK([whether fstatat (..., 0) works],
+ [gl_cv_func_fstatat_zero_flag],
+ [AC_RUN_IFELSE(
+ [AC_LANG_SOURCE(
+ [[
+ #include <fcntl.h>
+ #include <sys/stat.h>
+ int
+ main (void)
+ {
+ struct stat a;
+ return fstatat (AT_FDCWD, ".", &a, 0) != 0;
+ }
+ ]])],
+ [gl_cv_func_fstatat_zero_flag=yes],
+ [gl_cv_func_fstatat_zero_flag=no],
+ [case "$host_os" in
+ aix*) gl_cv_func_fstatat_zero_flag="guessing no";;
+ *) gl_cv_func_fstatat_zero_flag="guessing yes";;
+ esac
+ ])
+ ])
+
+ case $gl_cv_func_fstatat_zero_flag+$gl_cv_func_lstat_dereferences_slashed_symlink in
+ *yes+*yes) ;;
+ *) REPLACE_FSTATAT=1
+ case $gl_cv_func_fstatat_zero_flag in
+ *yes)
+ AC_DEFINE([HAVE_WORKING_FSTATAT_ZERO_FLAG], [1],
+ [Define to 1 if fstatat (..., 0) works.
+ For example, it does not work in AIX 7.1.])
+ ;;
+ esac
+ ;;
+ esac
+ fi
+])
--- /dev/null
+# getcwd.m4 - check for working getcwd that is compatible with glibc
+
+# Copyright (C) 2001, 2003-2007, 2009-2015 Free Software Foundation, Inc.
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# Written by Paul Eggert.
+# serial 12
+
+AC_DEFUN([gl_FUNC_GETCWD_NULL],
+ [
+ AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
+ AC_CHECK_HEADERS_ONCE([unistd.h])
+ AC_CACHE_CHECK([whether getcwd (NULL, 0) allocates memory for result],
+ [gl_cv_func_getcwd_null],
+ [AC_RUN_IFELSE([AC_LANG_PROGRAM([[
+# if HAVE_UNISTD_H
+# include <unistd.h>
+# else /* on Windows with MSVC */
+# include <direct.h>
+# endif
+# ifndef getcwd
+ char *getcwd ();
+# endif
+]], [[
+#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
+/* mingw cwd does not start with '/', but getcwd does allocate.
+ However, mingw fails to honor non-zero size. */
+#else
+ if (chdir ("/") != 0)
+ return 1;
+ else
+ {
+ char *f = getcwd (NULL, 0);
+ if (! f)
+ return 2;
+ if (f[0] != '/')
+ return 3;
+ if (f[1] != '\0')
+ return 4;
+ return 0;
+ }
+#endif
+ ]])],
+ [gl_cv_func_getcwd_null=yes],
+ [gl_cv_func_getcwd_null=no],
+ [[case "$host_os" in
+ # Guess yes on glibc systems.
+ *-gnu*) gl_cv_func_getcwd_null="guessing yes";;
+ # Guess yes on Cygwin.
+ cygwin*) gl_cv_func_getcwd_null="guessing yes";;
+ # If we don't know, assume the worst.
+ *) gl_cv_func_getcwd_null="guessing no";;
+ esac
+ ]])])
+])
+
+AC_DEFUN([gl_FUNC_GETCWD_SIGNATURE],
+[
+ AC_CACHE_CHECK([for getcwd with POSIX signature],
+ [gl_cv_func_getcwd_posix_signature],
+ [AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[#include <unistd.h>]],
+ [[extern
+ #ifdef __cplusplus
+ "C"
+ #endif
+ char *getcwd (char *, size_t);
+ ]])
+ ],
+ [gl_cv_func_getcwd_posix_signature=yes],
+ [gl_cv_func_getcwd_posix_signature=no])
+ ])
+])
+
+dnl Guarantee that getcwd will malloc with a NULL first argument. Assumes
+dnl that either the system getcwd is robust, or that calling code is okay
+dnl with spurious failures when run from a directory with an absolute name
+dnl larger than 4k bytes.
+dnl
+dnl Assumes that getcwd exists; if you are worried about obsolete
+dnl platforms that lacked getcwd(), then you need to use the GPL module.
+AC_DEFUN([gl_FUNC_GETCWD_LGPL],
+[
+ AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
+ AC_REQUIRE([gl_FUNC_GETCWD_NULL])
+ AC_REQUIRE([gl_FUNC_GETCWD_SIGNATURE])
+
+ case $gl_cv_func_getcwd_null,$gl_cv_func_getcwd_posix_signature in
+ *yes,yes) ;;
+ *)
+ dnl Minimal replacement lib/getcwd-lgpl.c.
+ REPLACE_GETCWD=1
+ ;;
+ esac
+])
+
+dnl Check for all known getcwd bugs; useful for a program likely to be
+dnl executed from an arbitrary location.
+AC_DEFUN([gl_FUNC_GETCWD],
+[
+ AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
+ AC_REQUIRE([gl_FUNC_GETCWD_NULL])
+ AC_REQUIRE([gl_FUNC_GETCWD_SIGNATURE])
+ AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
+
+ gl_abort_bug=no
+ case "$host_os" in
+ mingw*)
+ gl_cv_func_getcwd_path_max=yes
+ ;;
+ *)
+ gl_FUNC_GETCWD_PATH_MAX
+ case "$gl_cv_func_getcwd_null" in
+ *yes)
+ gl_FUNC_GETCWD_ABORT_BUG([gl_abort_bug=yes])
+ ;;
+ esac
+ ;;
+ esac
+ dnl Define HAVE_MINIMALLY_WORKING_GETCWD and HAVE_PARTLY_WORKING_GETCWD
+ dnl if appropriate.
+ case "$gl_cv_func_getcwd_path_max" in
+ "no"|"no, it has the AIX bug") ;;
+ *)
+ AC_DEFINE([HAVE_MINIMALLY_WORKING_GETCWD], [1],
+ [Define to 1 if getcwd minimally works, that is, its result can be
+ trusted when it succeeds.])
+ ;;
+ esac
+ case "$gl_cv_func_getcwd_path_max" in
+ "no, but it is partly working")
+ AC_DEFINE([HAVE_PARTLY_WORKING_GETCWD], [1],
+ [Define to 1 if getcwd works, except it sometimes fails when it
+ shouldn't, setting errno to ERANGE, ENAMETOOLONG, or ENOENT.])
+ ;;
+ "yes, but with shorter paths")
+ AC_DEFINE([HAVE_GETCWD_SHORTER], [1],
+ [Define to 1 if getcwd works, but with shorter paths
+ than is generally tested with the replacement.])
+ ;;
+ esac
+
+ if { case "$gl_cv_func_getcwd_null" in *yes) false;; *) true;; esac; } \
+ || test $gl_cv_func_getcwd_posix_signature != yes \
+ || { case "$gl_cv_func_getcwd_path_max" in *yes*) false;; *) true;; esac; } \
+ || test $gl_abort_bug = yes; then
+ REPLACE_GETCWD=1
+ fi
+])
+
+# Prerequisites of lib/getcwd.c, when full replacement is in effect.
+AC_DEFUN([gl_PREREQ_GETCWD],
+[
+ AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
+ AC_REQUIRE([gl_CHECK_TYPE_STRUCT_DIRENT_D_INO])
+ :
+])
# getdtablesize.m4 serial 5
-dnl Copyright (C) 2008-2014 Free Software Foundation, Inc.
+dnl Copyright (C) 2008-2015 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.
# getopt.m4 serial 44
-dnl Copyright (C) 2002-2006, 2008-2014 Free Software Foundation, Inc.
+dnl Copyright (C) 2002-2006, 2008-2015 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.
# gettime.m4 serial 8
-dnl Copyright (C) 2002, 2004-2006, 2009-2014 Free Software Foundation, Inc.
+dnl Copyright (C) 2002, 2004-2006, 2009-2015 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.
# serial 21
-# Copyright (C) 2001-2003, 2005, 2007, 2009-2014 Free Software Foundation, Inc.
+# Copyright (C) 2001-2003, 2005, 2007, 2009-2015 Free Software Foundation, Inc.
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# glibc21.m4 serial 5
-dnl Copyright (C) 2000-2002, 2004, 2008, 2010-2014 Free Software Foundation,
+dnl Copyright (C) 2000-2002, 2004, 2008, 2010-2015 Free Software Foundation,
dnl Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
# gnulib-common.m4 serial 36
-dnl Copyright (C) 2007-2014 Free Software Foundation, Inc.
+dnl Copyright (C) 2007-2015 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.
# DO NOT EDIT! GENERATED AUTOMATICALLY!
-# Copyright (C) 2002-2014 Free Software Foundation, Inc.
+# Copyright (C) 2002-2015 Free Software Foundation, Inc.
#
# 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
# Code from module absolute-header:
# Code from module alloca-opt:
# Code from module argmatch:
+ # Code from module assure:
+ # Code from module at-internal:
# Code from module backupfile:
# Code from module bitrotate:
# Code from module c-ctype:
# Code from module c-strcaseeq:
# Code from module canonicalize-lgpl:
# Code from module chdir:
+ # Code from module chdir-long:
+ # Code from module chown:
# Code from module clock-time:
+ # Code from module cloexec:
# Code from module close:
# Code from module closedir:
# Code from module configmake:
# Code from module extensions:
AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
# Code from module extern-inline:
+ # Code from module fchdir:
+ # Code from module fchmodat:
+ # Code from module fchownat:
# Code from module fcntl:
# Code from module fcntl-h:
# Code from module fd-hook:
# Code from module filename:
+ # Code from module filenamecat-lgpl:
# Code from module float:
# Code from module fstat:
+ # Code from module fstatat:
# Code from module full-write:
+ # Code from module getcwd-lgpl:
# Code from module getdate:
# Code from module getdtablesize:
# Code from module getopt-gnu:
# Code from module intprops:
# Code from module largefile:
AC_REQUIRE([AC_SYS_LARGEFILE])
- # Code from module lchmod:
+ # Code from module lchown:
# Code from module linked-list:
# Code from module list:
# Code from module localcharset:
# Code from module mbrtowc:
# Code from module mbsinit:
# Code from module memchr:
+ # Code from module mempcpy:
+ # Code from module memrchr:
# Code from module minmax:
# Code from module mkdir:
+ # Code from module mkdirat:
# Code from module mktime:
# Code from module msvc-inval:
# Code from module msvc-nothrow:
# Code from module multiarch:
# Code from module nocrash:
+ # Code from module open:
+ # Code from module openat:
+ # Code from module openat-die:
+ # Code from module openat-h:
# Code from module opendir:
# Code from module parse-datetime:
# Code from module pathmax:
# Code from module raise:
# Code from module readdir:
# Code from module readlink:
+ # Code from module readlinkat:
# Code from module realloc:
# Code from module realloc-gnu:
# Code from module realloc-posix:
# Code from module rename:
+ # Code from module renameat:
# Code from module rmdir:
# Code from module safe-write:
# Code from module same-inode:
+ # Code from module save-cwd:
# Code from module secure_getenv:
# Code from module setenv:
# Code from module signal:
# Code from module ssize_t:
# Code from module stat:
# Code from module stat-time:
+ # Code from module statat:
# Code from module stdarg:
dnl Some compilers (e.g., AIX 5.3 cc) need to be in c99 mode
dnl for the builtin va_copy to work. With Autoconf 2.60 or later,
# Code from module stdint:
# Code from module stdio:
# Code from module stdlib:
+ # Code from module strdup-posix:
# Code from module streq:
# Code from module strerror:
# Code from module strerror-override:
# Code from module strndup:
# Code from module strnlen:
# Code from module symlink:
+ # Code from module symlinkat:
# Code from module sys_stat:
# Code from module sys_time:
# Code from module sys_types:
# Code from module unistd:
# Code from module unistd-safer:
# Code from module unlink:
+ # Code from module unlinkat:
# Code from module unsetenv:
# Code from module update-copyright:
# Code from module useless-if-before-free:
# Code from module utimens:
+ # Code from module utimensat:
# Code from module vasnprintf:
# Code from module vasprintf:
# Code from module vc-list-files:
gl_COMMON
gl_source_base='lib'
gl_FUNC_ALLOCA
+ AC_LIBOBJ([openat-proc])
gl_BACKUPFILE
gl_CANONICALIZE_LGPL
if test $HAVE_CANONICALIZE_FILE_NAME = 0 || test $REPLACE_CANONICALIZE_FILE_NAME = 1; then
gl_STDLIB_MODULE_INDICATOR([canonicalize_file_name])
gl_STDLIB_MODULE_INDICATOR([realpath])
gl_UNISTD_MODULE_INDICATOR([chdir])
+ gl_FUNC_CHDIR_LONG
+ if test $gl_cv_have_arbitrary_file_name_length_limit = yes; then
+ AC_LIBOBJ([chdir-long])
+ gl_PREREQ_CHDIR_LONG
+ fi
+ gl_FUNC_CHOWN
+ if test $HAVE_CHOWN = 0 || test $REPLACE_CHOWN = 1; then
+ AC_LIBOBJ([chown])
+ fi
+ if test $REPLACE_CHOWN = 1 && test $ac_cv_func_fchown = no; then
+ AC_LIBOBJ([fchown-stub])
+ fi
+ gl_UNISTD_MODULE_INDICATOR([chown])
gl_CLOCK_TIME
+ gl_MODULE_INDICATOR_FOR_TESTS([cloexec])
gl_FUNC_CLOSE
if test $REPLACE_CLOSE = 1; then
AC_LIBOBJ([close])
[AM_][XGETTEXT_OPTION([--flag=error:3:c-format])
AM_][XGETTEXT_OPTION([--flag=error_at_line:5:c-format])])
AC_REQUIRE([gl_EXTERN_INLINE])
+ gl_FUNC_FCHDIR
+ gl_UNISTD_MODULE_INDICATOR([fchdir])
+ gl_FUNC_FCHMODAT
+ if test $HAVE_FCHMODAT = 0; then
+ AC_LIBOBJ([fchmodat])
+ fi
+ gl_MODULE_INDICATOR([fchmodat]) dnl for lib/openat.h
+ gl_SYS_STAT_MODULE_INDICATOR([fchmodat])
+ gl_FUNC_FCHOWNAT
+ if test $HAVE_FCHOWNAT = 0 || test $REPLACE_FCHOWNAT = 1; then
+ AC_LIBOBJ([fchownat])
+ fi
+ gl_MODULE_INDICATOR([fchownat]) dnl for lib/openat.h
+ gl_UNISTD_MODULE_INDICATOR([fchownat])
gl_FUNC_FCNTL
if test $HAVE_FCNTL = 0 || test $REPLACE_FCNTL = 1; then
AC_LIBOBJ([fcntl])
fi
gl_FCNTL_MODULE_INDICATOR([fcntl])
gl_FCNTL_H
+ gl_FILE_NAME_CONCAT_LGPL
gl_FLOAT_H
if test $REPLACE_FLOAT_LDBL = 1; then
AC_LIBOBJ([float])
gl_PREREQ_FSTAT
fi
gl_SYS_STAT_MODULE_INDICATOR([fstat])
+ gl_FUNC_FSTATAT
+ if test $HAVE_FSTATAT = 0 || test $REPLACE_FSTATAT = 1; then
+ AC_LIBOBJ([fstatat])
+ fi
+ gl_SYS_STAT_MODULE_INDICATOR([fstatat])
+ gl_FUNC_GETCWD_LGPL
+ if test $REPLACE_GETCWD = 1; then
+ AC_LIBOBJ([getcwd-lgpl])
+ fi
+ gl_UNISTD_MODULE_INDICATOR([getcwd])
gl_FUNC_GETDTABLESIZE
if test $HAVE_GETDTABLESIZE = 0 || test $REPLACE_GETDTABLESIZE = 1; then
AC_LIBOBJ([getdtablesize])
[AC_CONFIG_LINKS([$GNUmakefile:$GNUmakefile], [],
[GNUmakefile=$GNUmakefile])])
AC_REQUIRE([gl_LARGEFILE])
- gl_FUNC_LCHMOD
- gl_SYS_STAT_MODULE_INDICATOR([lchmod])
+ gl_FUNC_LCHOWN
+ if test $HAVE_LCHOWN = 0 || test $REPLACE_LCHOWN = 1; then
+ AC_LIBOBJ([lchown])
+ fi
+ gl_UNISTD_MODULE_INDICATOR([lchown])
gl_LOCALCHARSET
LOCALCHARSET_TESTS_ENVIRONMENT="CHARSETALIASDIR=\"\$(abs_top_builddir)/$gl_source_base\""
AC_SUBST([LOCALCHARSET_TESTS_ENVIRONMENT])
gl_PREREQ_MEMCHR
fi
gl_STRING_MODULE_INDICATOR([memchr])
+ gl_FUNC_MEMPCPY
+ if test $HAVE_MEMPCPY = 0; then
+ AC_LIBOBJ([mempcpy])
+ gl_PREREQ_MEMPCPY
+ fi
+ gl_STRING_MODULE_INDICATOR([mempcpy])
+ gl_FUNC_MEMRCHR
+ if test $ac_cv_func_memrchr = no; then
+ AC_LIBOBJ([memrchr])
+ gl_PREREQ_MEMRCHR
+ fi
+ gl_STRING_MODULE_INDICATOR([memrchr])
gl_MINMAX
gl_FUNC_MKDIR
if test $REPLACE_MKDIR = 1; then
AC_LIBOBJ([mkdir])
fi
+ gl_FUNC_MKDIRAT
+ if test $HAVE_MKDIRAT = 0; then
+ AC_LIBOBJ([mkdirat])
+ gl_PREREQ_MKDIRAT
+ fi
+ gl_SYS_STAT_MODULE_INDICATOR([mkdirat])
gl_FUNC_MKTIME
if test $REPLACE_MKTIME = 1; then
AC_LIBOBJ([mktime])
AC_LIBOBJ([msvc-nothrow])
fi
gl_MULTIARCH
+ gl_FUNC_OPEN
+ if test $REPLACE_OPEN = 1; then
+ AC_LIBOBJ([open])
+ gl_PREREQ_OPEN
+ fi
+ gl_FCNTL_MODULE_INDICATOR([open])
+ gl_FUNC_OPENAT
+ if test $HAVE_OPENAT = 0 || test $REPLACE_OPENAT = 1; then
+ AC_LIBOBJ([openat])
+ gl_PREREQ_OPENAT
+ fi
+ gl_MODULE_INDICATOR([openat]) dnl for lib/getcwd.c
+ gl_FCNTL_MODULE_INDICATOR([openat])
gl_FUNC_OPENDIR
if test $HAVE_OPENDIR = 0 || test $REPLACE_OPENDIR = 1; then
AC_LIBOBJ([opendir])
gl_PREREQ_READLINK
fi
gl_UNISTD_MODULE_INDICATOR([readlink])
+ gl_FUNC_READLINKAT
+ if test $HAVE_READLINKAT = 0 || test $REPLACE_READLINKAT = 1; then
+ AC_LIBOBJ([readlinkat])
+ fi
+ gl_UNISTD_MODULE_INDICATOR([readlinkat])
gl_FUNC_REALLOC_GNU
if test $REPLACE_REALLOC = 1; then
AC_LIBOBJ([realloc])
AC_LIBOBJ([rename])
fi
gl_STDIO_MODULE_INDICATOR([rename])
+ gl_FUNC_RENAMEAT
+ if test $HAVE_RENAMEAT = 0 || test $REPLACE_RENAMEAT = 1; then
+ AC_LIBOBJ([renameat])
+ fi
+ if test $HAVE_RENAMEAT = 0; then
+ AC_LIBOBJ([at-func2])
+ fi
+ gl_STDIO_MODULE_INDICATOR([renameat])
gl_FUNC_RMDIR
if test $REPLACE_RMDIR = 1; then
AC_LIBOBJ([rmdir])
fi
gl_UNISTD_MODULE_INDICATOR([rmdir])
gl_PREREQ_SAFE_WRITE
+ gl_SAVE_CWD
gl_FUNC_SECURE_GETENV
if test $HAVE_SECURE_GETENV = 0; then
AC_LIBOBJ([secure_getenv])
gl_SYS_STAT_MODULE_INDICATOR([stat])
gl_STAT_TIME
gl_STAT_BIRTHTIME
+ gl_MODULE_INDICATOR([statat]) dnl for lib/openat.h
gl_STDARG_H
AM_STDBOOL_H
gl_STDDEF_H
gl_STDINT_H
gl_STDIO_H
gl_STDLIB_H
+ gl_FUNC_STRDUP_POSIX
+ if test $ac_cv_func_strdup = no || test $REPLACE_STRDUP = 1; then
+ AC_LIBOBJ([strdup])
+ gl_PREREQ_STRDUP
+ fi
+ gl_STRING_MODULE_INDICATOR([strdup])
gl_FUNC_STRERROR
if test $REPLACE_STRERROR = 1; then
AC_LIBOBJ([strerror])
AC_LIBOBJ([symlink])
fi
gl_UNISTD_MODULE_INDICATOR([symlink])
+ gl_FUNC_SYMLINKAT
+ if test $HAVE_SYMLINKAT = 0 || test $REPLACE_SYMLINKAT = 1; then
+ AC_LIBOBJ([symlinkat])
+ fi
+ gl_UNISTD_MODULE_INDICATOR([symlinkat])
gl_HEADER_SYS_STAT_H
AC_PROG_MKDIR_P
gl_HEADER_SYS_TIME_H
AC_LIBOBJ([unlink])
fi
gl_UNISTD_MODULE_INDICATOR([unlink])
+ gl_FUNC_UNLINKAT
+ if test $HAVE_UNLINKAT = 0 || test $REPLACE_UNLINKAT = 1; then
+ AC_LIBOBJ([unlinkat])
+ fi
+ gl_UNISTD_MODULE_INDICATOR([unlinkat])
gl_FUNC_UNSETENV
if test $HAVE_UNSETENV = 0 || test $REPLACE_UNSETENV = 1; then
AC_LIBOBJ([unsetenv])
fi
gl_STDLIB_MODULE_INDICATOR([unsetenv])
gl_UTIMENS
+ gl_FUNC_UTIMENSAT
+ if test $HAVE_UTIMENSAT = 0 || test $REPLACE_UTIMENSAT = 1; then
+ AC_LIBOBJ([utimensat])
+ fi
+ gl_SYS_STAT_MODULE_INDICATOR([utimensat])
gl_FUNC_VASNPRINTF
gl_FUNC_VASPRINTF
gl_STDIO_MODULE_INDICATOR([vasprintf])
lib/argmatch.h
lib/asnprintf.c
lib/asprintf.c
+ lib/assure.h
+ lib/at-func.c
+ lib/at-func2.c
lib/backupfile.c
lib/backupfile.h
lib/basename-lgpl.c
lib/c-strcaseeq.h
lib/c-strncasecmp.c
lib/canonicalize-lgpl.c
+ lib/chdir-long.c
+ lib/chdir-long.h
+ lib/chmodat.c
+ lib/chown.c
+ lib/chownat.c
+ lib/cloexec.c
+ lib/cloexec.h
lib/close.c
lib/closedir.c
lib/config.charset
lib/error.h
lib/exitfail.c
lib/exitfail.h
+ lib/fchdir.c
+ lib/fchmodat.c
+ lib/fchown-stub.c
+ lib/fchownat.c
lib/fcntl.c
lib/fcntl.in.h
lib/fd-hook.c
lib/fd-hook.h
lib/fd-safer.c
lib/filename.h
+ lib/filenamecat-lgpl.c
+ lib/filenamecat.h
lib/float+.h
lib/float.c
lib/float.in.h
lib/fstat.c
+ lib/fstatat.c
lib/full-write.c
lib/full-write.h
+ lib/getcwd-lgpl.c
lib/getdate.h
lib/getdtablesize.c
lib/getopt.c
lib/ignore-value.h
lib/intprops.h
lib/itold.c
+ lib/lchown.c
lib/localcharset.c
lib/localcharset.h
lib/lstat.c
lib/mbsinit.c
lib/memchr.c
lib/memchr.valgrind
+ lib/mempcpy.c
+ lib/memrchr.c
lib/minmax.h
lib/mkdir.c
+ lib/mkdirat.c
lib/mktime-internal.h
lib/mktime.c
lib/msvc-inval.c
lib/msvc-inval.h
lib/msvc-nothrow.c
lib/msvc-nothrow.h
+ lib/open.c
+ lib/openat-die.c
+ lib/openat-priv.h
+ lib/openat-proc.c
+ lib/openat.c
+ lib/openat.h
lib/opendir-safer.c
lib/opendir.c
lib/parse-datetime.h
lib/raise.c
lib/readdir.c
lib/readlink.c
+ lib/readlinkat.c
lib/realloc.c
lib/ref-add.sin
lib/ref-del.sin
lib/rename.c
+ lib/renameat.c
lib/rmdir.c
lib/safe-read.c
lib/safe-write.c
lib/safe-write.h
lib/same-inode.h
+ lib/save-cwd.c
+ lib/save-cwd.h
lib/secure_getenv.c
lib/setenv.c
lib/signal.in.h
lib/stat-time.c
lib/stat-time.h
lib/stat.c
+ lib/statat.c
lib/stdarg.in.h
lib/stdbool.in.h
lib/stddef.in.h
lib/stdint.in.h
lib/stdio.in.h
lib/stdlib.in.h
+ lib/strdup.c
lib/streq.h
lib/strerror-override.c
lib/strerror-override.h
lib/strndup.c
lib/strnlen.c
lib/symlink.c
+ lib/symlinkat.c
lib/sys_stat.in.h
lib/sys_time.in.h
lib/sys_types.in.h
lib/unistd.c
lib/unistd.in.h
lib/unlink.c
+ lib/unlinkat.c
lib/unsetenv.c
lib/utimens.c
lib/utimens.h
+ lib/utimensat.c
lib/vasnprintf.c
lib/vasnprintf.h
lib/vasprintf.c
m4/backupfile.m4
m4/bison.m4
m4/canonicalize.m4
+ m4/chdir-long.m4
+ m4/chown.m4
m4/clock_time.m4
m4/close.m4
m4/closedir.m4
m4/exponentd.m4
m4/extensions.m4
m4/extern-inline.m4
+ m4/fchdir.m4
+ m4/fchmodat.m4
+ m4/fchownat.m4
m4/fcntl-o.m4
m4/fcntl.m4
m4/fcntl_h.m4
+ m4/filenamecat.m4
m4/float_h.m4
m4/fstat.m4
+ m4/fstatat.m4
+ m4/getcwd.m4
m4/getdtablesize.m4
m4/getopt.m4
m4/gettime.m4
m4/intmax_t.m4
m4/inttypes_h.m4
m4/largefile.m4
- m4/lchmod.m4
+ m4/lchown.m4
m4/localcharset.m4
m4/locale-fr.m4
m4/locale-ja.m4
m4/mbsinit.m4
m4/mbstate_t.m4
m4/memchr.m4
+ m4/mempcpy.m4
+ m4/memrchr.m4
m4/minmax.m4
m4/mkdir.m4
+ m4/mkdirat.m4
m4/mktime.m4
m4/mmap-anon.m4
+ m4/mode_t.m4
m4/msvc-inval.m4
m4/msvc-nothrow.m4
m4/multiarch.m4
m4/nocrash.m4
m4/off_t.m4
+ m4/open.m4
+ m4/openat.m4
m4/opendir.m4
m4/parse-datetime.m4
m4/pathmax.m4
m4/raise.m4
m4/readdir.m4
m4/readlink.m4
+ m4/readlinkat.m4
m4/realloc.m4
m4/rename.m4
+ m4/renameat.m4
m4/rmdir.m4
m4/safe-read.m4
m4/safe-write.m4
+ m4/save-cwd.m4
m4/secure_getenv.m4
m4/setenv.m4
m4/signal_h.m4
m4/stdint_h.m4
m4/stdio_h.m4
m4/stdlib_h.m4
+ m4/strdup.m4
m4/strerror.m4
m4/string_h.m4
m4/strndup.m4
m4/strnlen.m4
m4/symlink.m4
+ m4/symlinkat.m4
m4/sys_socket_h.m4
m4/sys_stat_h.m4
m4/sys_time_h.m4
m4/unistd-safer.m4
m4/unistd_h.m4
m4/unlink.m4
+ m4/unlinkat.m4
m4/utimbuf.m4
m4/utimens.m4
+ m4/utimensat.m4
m4/utimes.m4
m4/vasnprintf.m4
m4/vasprintf.m4
# include_next.m4 serial 23
-dnl Copyright (C) 2006-2014 Free Software Foundation, Inc.
+dnl Copyright (C) 2006-2015 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.
# intmax_t.m4 serial 8
-dnl Copyright (C) 1997-2004, 2006-2007, 2009-2014 Free Software Foundation,
+dnl Copyright (C) 1997-2004, 2006-2007, 2009-2015 Free Software Foundation,
dnl Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
# inttypes_h.m4 serial 10
-dnl Copyright (C) 1997-2004, 2006, 2008-2014 Free Software Foundation, Inc.
+dnl Copyright (C) 1997-2004, 2006, 2008-2015 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.
# Enable large files on systems where this is not the default.
-# Copyright 1992-1996, 1998-2014 Free Software Foundation, Inc.
+# Copyright 1992-1996, 1998-2015 Free Software Foundation, Inc.
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
+++ /dev/null
-#serial 3
-
-dnl Copyright (C) 2005-2006, 2008-2014 Free Software Foundation, Inc.
-dnl This file is free software; the Free Software Foundation
-dnl gives unlimited permission to copy and/or distribute it,
-dnl with or without modifications, as long as this notice is preserved.
-
-dnl From Paul Eggert.
-dnl Provide a replacement for lchmod on hosts that lack it.
-
-AC_DEFUN([gl_FUNC_LCHMOD],
-[
- AC_REQUIRE([gl_SYS_STAT_H_DEFAULTS])
-
- dnl Persuade glibc <sys/stat.h> to declare lchmod().
- AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
-
- AC_CHECK_FUNCS_ONCE([lchmod])
- if test $ac_cv_func_lchmod = no; then
- HAVE_LCHMOD=0
- fi
-])
--- /dev/null
+# serial 17
+# Determine whether we need the lchown wrapper.
+
+dnl Copyright (C) 1998, 2001, 2003-2007, 2009-2015 Free Software Foundation,
+dnl 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 Jim Meyering.
+dnl Provide lchown on systems that lack it, and work around bugs
+dnl on systems that have it.
+
+AC_DEFUN([gl_FUNC_LCHOWN],
+[
+ AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
+ AC_REQUIRE([gl_FUNC_CHOWN])
+ AC_CHECK_FUNCS_ONCE([lchmod])
+ AC_CHECK_FUNCS([lchown])
+ if test $ac_cv_func_lchown = no; then
+ HAVE_LCHOWN=0
+ else
+ dnl Trailing slash and ctime bugs in chown also occur in lchown.
+ case "$gl_cv_func_chown_slash_works" in
+ *yes) ;;
+ *)
+ REPLACE_LCHOWN=1
+ ;;
+ esac
+ case "$gl_cv_func_chown_ctime_works" in
+ *yes) ;;
+ *)
+ REPLACE_LCHOWN=1
+ ;;
+ esac
+ fi
+])
# localcharset.m4 serial 7
-dnl Copyright (C) 2002, 2004, 2006, 2009-2014 Free Software Foundation, Inc.
+dnl Copyright (C) 2002, 2004, 2006, 2009-2015 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.
# locale-fr.m4 serial 17
-dnl Copyright (C) 2003, 2005-2014 Free Software Foundation, Inc.
+dnl Copyright (C) 2003, 2005-2015 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.
# locale-ja.m4 serial 12
-dnl Copyright (C) 2003, 2005-2014 Free Software Foundation, Inc.
+dnl Copyright (C) 2003, 2005-2015 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.
# locale-zh.m4 serial 12
-dnl Copyright (C) 2003, 2005-2014 Free Software Foundation, Inc.
+dnl Copyright (C) 2003, 2005-2015 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.
# longlong.m4 serial 17
-dnl Copyright (C) 1999-2007, 2009-2014 Free Software Foundation, Inc.
+dnl Copyright (C) 1999-2007, 2009-2015 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.
# serial 26
-# Copyright (C) 1997-2001, 2003-2014 Free Software Foundation, Inc.
+# Copyright (C) 1997-2001, 2003-2015 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# malloc.m4 serial 14
-dnl Copyright (C) 2007, 2009-2014 Free Software Foundation, Inc.
+dnl Copyright (C) 2007, 2009-2015 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.
# malloca.m4 serial 1
-dnl Copyright (C) 2003-2004, 2006-2007, 2009-2014 Free Software Foundation,
+dnl Copyright (C) 2003-2004, 2006-2007, 2009-2015 Free Software Foundation,
dnl Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
# manywarnings.m4 serial 7
-dnl Copyright (C) 2008-2014 Free Software Foundation, Inc.
+dnl Copyright (C) 2008-2015 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.
# mbrtowc.m4 serial 26
-dnl Copyright (C) 2001-2002, 2004-2005, 2008-2014 Free Software Foundation,
+dnl Copyright (C) 2001-2002, 2004-2005, 2008-2015 Free Software Foundation,
dnl Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
# mbsinit.m4 serial 8
-dnl Copyright (C) 2008, 2010-2014 Free Software Foundation, Inc.
+dnl Copyright (C) 2008, 2010-2015 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.
# mbstate_t.m4 serial 13
-dnl Copyright (C) 2000-2002, 2008-2014 Free Software Foundation, Inc.
+dnl Copyright (C) 2000-2002, 2008-2015 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.
# memchr.m4 serial 12
-dnl Copyright (C) 2002-2004, 2009-2014 Free Software Foundation, Inc.
+dnl Copyright (C) 2002-2004, 2009-2015 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.
--- /dev/null
+# mempcpy.m4 serial 11
+dnl Copyright (C) 2003-2004, 2006-2007, 2009-2015 Free Software Foundation,
+dnl Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+AC_DEFUN([gl_FUNC_MEMPCPY],
+[
+ dnl Persuade glibc <string.h> to declare mempcpy().
+ AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
+
+ dnl The mempcpy() declaration in lib/string.in.h uses 'restrict'.
+ AC_REQUIRE([AC_C_RESTRICT])
+
+ AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS])
+ AC_CHECK_FUNCS([mempcpy])
+ if test $ac_cv_func_mempcpy = no; then
+ HAVE_MEMPCPY=0
+ fi
+])
+
+# Prerequisites of lib/mempcpy.c.
+AC_DEFUN([gl_PREREQ_MEMPCPY], [
+ :
+])
--- /dev/null
+# memrchr.m4 serial 10
+dnl Copyright (C) 2002-2003, 2005-2007, 2009-2015 Free Software Foundation,
+dnl 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_MEMRCHR],
+[
+ dnl Persuade glibc <string.h> to declare memrchr().
+ AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
+
+ AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS])
+ AC_CHECK_DECLS_ONCE([memrchr])
+ if test $ac_cv_have_decl_memrchr = no; then
+ HAVE_DECL_MEMRCHR=0
+ fi
+
+ AC_CHECK_FUNCS([memrchr])
+])
+
+# Prerequisites of lib/memrchr.c.
+AC_DEFUN([gl_PREREQ_MEMRCHR], [:])
# minmax.m4 serial 4
-dnl Copyright (C) 2005, 2009-2014 Free Software Foundation, Inc.
+dnl Copyright (C) 2005, 2009-2015 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.
# serial 11
-# Copyright (C) 2001, 2003-2004, 2006, 2008-2014 Free Software Foundation, Inc.
+# Copyright (C) 2001, 2003-2004, 2006, 2008-2015 Free Software Foundation, Inc.
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
--- /dev/null
+# mkdirat.m4 serial 1
+dnl Copyright (C) 2004-2015 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.
+
+# Written by Jim Meyering.
+
+AC_DEFUN([gl_FUNC_MKDIRAT],
+[
+ AC_REQUIRE([gl_SYS_STAT_H_DEFAULTS])
+ AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
+ AC_CHECK_FUNCS_ONCE([mkdirat])
+ if test $ac_cv_func_mkdirat != yes; then
+ HAVE_MKDIRAT=0
+ fi
+])
+
+# Prerequisite of mkdirat's declaration and of lib/mkdirat.c.
+AC_DEFUN([gl_PREREQ_MKDIRAT],
+[
+ AC_REQUIRE([AC_TYPE_MODE_T])
+])
# serial 25
-dnl Copyright (C) 2002-2003, 2005-2007, 2009-2014 Free Software Foundation,
+dnl Copyright (C) 2002-2003, 2005-2007, 2009-2015 Free Software Foundation,
dnl Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
# mmap-anon.m4 serial 10
-dnl Copyright (C) 2005, 2007, 2009-2014 Free Software Foundation, Inc.
+dnl Copyright (C) 2005, 2007, 2009-2015 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.
--- /dev/null
+# mode_t.m4 serial 2
+dnl Copyright (C) 2009-2015 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.
+
+# For using mode_t, it's sufficient to use AC_TYPE_MODE_T and
+# include <sys/types.h>.
+
+# Define PROMOTED_MODE_T to the type that is the result of "default argument
+# promotion" (ISO C 6.5.2.2.(6)) of the type mode_t.
+AC_DEFUN([gl_PROMOTED_TYPE_MODE_T],
+[
+ AC_REQUIRE([AC_TYPE_MODE_T])
+ AC_CACHE_CHECK([for promoted mode_t type], [gl_cv_promoted_mode_t], [
+ dnl Assume mode_t promotes to 'int' if and only if it is smaller than 'int',
+ dnl and to itself otherwise. This assumption is not guaranteed by the ISO C
+ dnl standard, but we don't know of any real-world counterexamples.
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>]],
+ [[typedef int array[2 * (sizeof (mode_t) < sizeof (int)) - 1];]])],
+ [gl_cv_promoted_mode_t='int'],
+ [gl_cv_promoted_mode_t='mode_t'])
+ ])
+ AC_DEFINE_UNQUOTED([PROMOTED_MODE_T], [$gl_cv_promoted_mode_t],
+ [Define to the type that is the result of default argument promotions of type mode_t.])
+])
# msvc-inval.m4 serial 1
-dnl Copyright (C) 2011-2014 Free Software Foundation, Inc.
+dnl Copyright (C) 2011-2015 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.
# msvc-nothrow.m4 serial 1
-dnl Copyright (C) 2011-2014 Free Software Foundation, Inc.
+dnl Copyright (C) 2011-2015 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.
# multiarch.m4 serial 7
-dnl Copyright (C) 2008-2014 Free Software Foundation, Inc.
+dnl Copyright (C) 2008-2015 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.
# nocrash.m4 serial 4
-dnl Copyright (C) 2005, 2009-2014 Free Software Foundation, Inc.
+dnl Copyright (C) 2005, 2009-2015 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.
# off_t.m4 serial 1
-dnl Copyright (C) 2012-2014 Free Software Foundation, Inc.
+dnl Copyright (C) 2012-2015 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.
--- /dev/null
+# open.m4 serial 14
+dnl Copyright (C) 2007-2015 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_OPEN],
+[
+ AC_REQUIRE([AC_CANONICAL_HOST])
+ case "$host_os" in
+ mingw* | pw*)
+ REPLACE_OPEN=1
+ ;;
+ *)
+ dnl open("foo/") should not create a file when the file name has a
+ dnl trailing slash. FreeBSD only has the problem on symlinks.
+ AC_CHECK_FUNCS_ONCE([lstat])
+ AC_CACHE_CHECK([whether open recognizes a trailing slash],
+ [gl_cv_func_open_slash],
+ [# Assume that if we have lstat, we can also check symlinks.
+ if test $ac_cv_func_lstat = yes; then
+ touch conftest.tmp
+ ln -s conftest.tmp conftest.lnk
+ fi
+ AC_RUN_IFELSE(
+ [AC_LANG_SOURCE([[
+#include <fcntl.h>
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+int main ()
+{
+ int result = 0;
+#if HAVE_LSTAT
+ if (open ("conftest.lnk/", O_RDONLY) != -1)
+ result |= 1;
+#endif
+ if (open ("conftest.sl/", O_CREAT, 0600) >= 0)
+ result |= 2;
+ return result;
+}]])],
+ [gl_cv_func_open_slash=yes],
+ [gl_cv_func_open_slash=no],
+ [
+changequote(,)dnl
+ case "$host_os" in
+ freebsd* | aix* | hpux* | solaris2.[0-9] | solaris2.[0-9].*)
+ gl_cv_func_open_slash="guessing no" ;;
+ *)
+ gl_cv_func_open_slash="guessing yes" ;;
+ esac
+changequote([,])dnl
+ ])
+ rm -f conftest.sl conftest.tmp conftest.lnk
+ ])
+ case "$gl_cv_func_open_slash" in
+ *no)
+ AC_DEFINE([OPEN_TRAILING_SLASH_BUG], [1],
+ [Define to 1 if open() fails to recognize a trailing slash.])
+ REPLACE_OPEN=1
+ ;;
+ esac
+ ;;
+ esac
+ dnl Replace open() for supporting the gnulib-defined fchdir() function,
+ dnl to keep fchdir's bookkeeping up-to-date.
+ m4_ifdef([gl_FUNC_FCHDIR], [
+ if test $REPLACE_OPEN = 0; then
+ gl_TEST_FCHDIR
+ if test $HAVE_FCHDIR = 0; then
+ REPLACE_OPEN=1
+ fi
+ fi
+ ])
+ dnl Replace open() for supporting the gnulib-defined O_NONBLOCK flag.
+ m4_ifdef([gl_NONBLOCKING_IO], [
+ if test $REPLACE_OPEN = 0; then
+ gl_NONBLOCKING_IO
+ if test $gl_cv_have_open_O_NONBLOCK != yes; then
+ REPLACE_OPEN=1
+ fi
+ fi
+ ])
+])
+
+# Prerequisites of lib/open.c.
+AC_DEFUN([gl_PREREQ_OPEN],
+[
+ AC_REQUIRE([gl_PROMOTED_TYPE_MODE_T])
+ :
+])
--- /dev/null
+# serial 45
+# See if we need to use our replacement for Solaris' openat et al functions.
+
+dnl Copyright (C) 2004-2015 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.
+
+# Written by Jim Meyering.
+
+AC_DEFUN([gl_FUNC_OPENAT],
+[
+ AC_REQUIRE([gl_FCNTL_H_DEFAULTS])
+ AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
+ AC_CHECK_FUNCS_ONCE([openat])
+ AC_REQUIRE([gl_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK])
+ case $ac_cv_func_openat+$gl_cv_func_lstat_dereferences_slashed_symlink in
+ yes+*yes)
+ ;;
+ yes+*)
+ # Solaris 9 has *at functions, but uniformly mishandles trailing
+ # slash in all of them.
+ REPLACE_OPENAT=1
+ ;;
+ *)
+ HAVE_OPENAT=0
+ ;;
+ esac
+])
+
+# Prerequisites of lib/openat.c.
+AC_DEFUN([gl_PREREQ_OPENAT],
+[
+ AC_REQUIRE([gl_PROMOTED_TYPE_MODE_T])
+ :
+])
# opendir.m4 serial 2
-dnl Copyright (C) 2011-2014 Free Software Foundation, Inc.
+dnl Copyright (C) 2011-2015 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.
# parse-datetime.m4 serial 21
-dnl Copyright (C) 2002-2006, 2008-2014 Free Software Foundation, Inc.
+dnl Copyright (C) 2002-2006, 2008-2015 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.
# pathmax.m4 serial 10
-dnl Copyright (C) 2002-2003, 2005-2006, 2009-2014 Free Software Foundation,
+dnl Copyright (C) 2002-2003, 2005-2006, 2009-2015 Free Software Foundation,
dnl Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
# printf.m4 serial 51
-dnl Copyright (C) 2003, 2007-2014 Free Software Foundation, Inc.
+dnl Copyright (C) 2003, 2007-2015 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.
# quote.m4 serial 6
-dnl Copyright (C) 2002-2003, 2005-2006, 2009-2014 Free Software Foundation,
+dnl Copyright (C) 2002-2003, 2005-2006, 2009-2015 Free Software Foundation,
dnl Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
# quotearg.m4 serial 9
-dnl Copyright (C) 2002, 2004-2014 Free Software Foundation, Inc.
+dnl Copyright (C) 2002, 2004-2015 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.
# raise.m4 serial 3
-dnl Copyright (C) 2011-2014 Free Software Foundation, Inc.
+dnl Copyright (C) 2011-2015 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.
# readdir.m4 serial 1
-dnl Copyright (C) 2011-2014 Free Software Foundation, Inc.
+dnl Copyright (C) 2011-2015 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.
# readlink.m4 serial 12
-dnl Copyright (C) 2003, 2007, 2009-2014 Free Software Foundation, Inc.
+dnl Copyright (C) 2003, 2007, 2009-2015 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.
--- /dev/null
+# serial 4
+# See if we need to provide readlinkat replacement.
+
+dnl Copyright (C) 2009-2015 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.
+
+# Written by Eric Blake.
+
+AC_DEFUN([gl_FUNC_READLINKAT],
+[
+ AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
+ AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
+ AC_CHECK_FUNCS_ONCE([readlinkat])
+ if test $ac_cv_func_readlinkat = no; then
+ HAVE_READLINKAT=0
+ else
+ AC_CACHE_CHECK([whether readlinkat signature is correct],
+ [gl_cv_decl_readlinkat_works],
+ [AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[#include <unistd.h>
+ /* Check whether original declaration has correct type. */
+ ssize_t readlinkat (int, char const *, char *, size_t);]])],
+ [gl_cv_decl_readlinkat_works=yes],
+ [gl_cv_decl_readlinkat_works=no])])
+ if test "$gl_cv_decl_readlink_works" != yes; then
+ REPLACE_READLINKAT=1
+ fi
+ fi
+])
# realloc.m4 serial 13
-dnl Copyright (C) 2007, 2009-2014 Free Software Foundation, Inc.
+dnl Copyright (C) 2007, 2009-2015 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.
# serial 26
-# Copyright (C) 2001, 2003, 2005-2006, 2009-2014 Free Software Foundation, Inc.
+# Copyright (C) 2001, 2003, 2005-2006, 2009-2015 Free Software Foundation, Inc.
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
--- /dev/null
+# serial 3
+# See if we need to provide renameat replacement.
+
+dnl Copyright (C) 2009-2015 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.
+
+# Written by Eric Blake.
+
+AC_DEFUN([gl_FUNC_RENAMEAT],
+[
+ AC_REQUIRE([gl_FUNC_OPENAT])
+ AC_REQUIRE([gl_FUNC_RENAME])
+ AC_REQUIRE([gl_STDIO_H_DEFAULTS])
+ AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
+ AC_CHECK_FUNCS_ONCE([renameat])
+ if test $ac_cv_func_renameat = no; then
+ HAVE_RENAMEAT=0
+ elif test $REPLACE_RENAME = 1; then
+ dnl Solaris 9 and 10 have the same bugs in renameat as in rename.
+ REPLACE_RENAMEAT=1
+ fi
+])
# rmdir.m4 serial 13
-dnl Copyright (C) 2002, 2005, 2009-2014 Free Software Foundation, Inc.
+dnl Copyright (C) 2002, 2005, 2009-2015 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.
# safe-read.m4 serial 6
-dnl Copyright (C) 2002-2003, 2005-2006, 2009-2014 Free Software Foundation,
+dnl Copyright (C) 2002-2003, 2005-2006, 2009-2015 Free Software Foundation,
dnl Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
# safe-write.m4 serial 4
-dnl Copyright (C) 2002, 2005-2006, 2009-2014 Free Software Foundation, Inc.
+dnl Copyright (C) 2002, 2005-2006, 2009-2015 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.
--- /dev/null
+# serial 10
+dnl Copyright (C) 2002-2006, 2009-2015 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 Prerequisites for lib/save-cwd.c.
+AC_DEFUN([gl_SAVE_CWD],
+[
+ AC_CHECK_FUNCS_ONCE([fchdir])
+])
# Look up an environment variable more securely.
-dnl Copyright 2013-2014 Free Software Foundation, Inc.
+dnl Copyright 2013-2015 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.
# setenv.m4 serial 26
-dnl Copyright (C) 2001-2004, 2006-2014 Free Software Foundation, Inc.
+dnl Copyright (C) 2001-2004, 2006-2015 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.
# signal_h.m4 serial 18
-dnl Copyright (C) 2007-2014 Free Software Foundation, Inc.
+dnl Copyright (C) 2007-2015 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.
# size_max.m4 serial 10
-dnl Copyright (C) 2003, 2005-2006, 2008-2014 Free Software Foundation, Inc.
+dnl Copyright (C) 2003, 2005-2006, 2008-2015 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.
# ssize_t.m4 serial 5 (gettext-0.18.2)
-dnl Copyright (C) 2001-2003, 2006, 2010-2014 Free Software Foundation, Inc.
+dnl Copyright (C) 2001-2003, 2006, 2010-2015 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.
# Checks for stat-related time functions.
-# Copyright (C) 1998-1999, 2001, 2003, 2005-2007, 2009-2014 Free Software
+# Copyright (C) 1998-1999, 2001, 2003, 2005-2007, 2009-2015 Free Software
# Foundation, Inc.
# This file is free software; the Free Software Foundation
# serial 11
-# Copyright (C) 2009-2014 Free Software Foundation, Inc.
+# Copyright (C) 2009-2015 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# stdarg.m4 serial 6
-dnl Copyright (C) 2006, 2008-2014 Free Software Foundation, Inc.
+dnl Copyright (C) 2006, 2008-2015 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.
# Check for stdbool.h that conforms to C99.
-dnl Copyright (C) 2002-2006, 2009-2014 Free Software Foundation, Inc.
+dnl Copyright (C) 2002-2006, 2009-2015 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 A placeholder for POSIX 2008 <stddef.h>, for platforms that have issues.
-# stddef_h.m4 serial 4
-dnl Copyright (C) 2009-2014 Free Software Foundation, Inc.
+dnl A placeholder for <stddef.h>, for platforms that have issues.
+# stddef_h.m4 serial 5
+dnl Copyright (C) 2009-2015 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_REQUIRE([gl_STDDEF_H_DEFAULTS])
AC_REQUIRE([gt_TYPE_WCHAR_T])
STDDEF_H=
+ AC_CHECK_TYPE([max_align_t], [], [HAVE_MAX_ALIGN_T=0; STDDEF_H=stddef.h],
+ [[#include <stddef.h>
+ ]])
if test $gt_cv_c_wchar_t = no; then
HAVE_WCHAR_T=0
STDDEF_H=stddef.h
[
dnl Assume proper GNU behavior unless another module says otherwise.
REPLACE_NULL=0; AC_SUBST([REPLACE_NULL])
+ HAVE_MAX_ALIGN_T=1; AC_SUBST([HAVE_MAX_ALIGN_T])
HAVE_WCHAR_T=1; AC_SUBST([HAVE_WCHAR_T])
])
# stdint.m4 serial 43
-dnl Copyright (C) 2001-2014 Free Software Foundation, Inc.
+dnl Copyright (C) 2001-2015 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.
# stdint_h.m4 serial 9
-dnl Copyright (C) 1997-2004, 2006, 2008-2014 Free Software Foundation, Inc.
+dnl Copyright (C) 1997-2004, 2006, 2008-2015 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.
-# stdio_h.m4 serial 43
-dnl Copyright (C) 2007-2014 Free Software Foundation, Inc.
+# stdio_h.m4 serial 44
+dnl Copyright (C) 2007-2015 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
AC_DEFUN([gl_STDIO_H],
[
+ dnl For __USE_MINGW_ANSI_STDIO
+ AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
+
AC_REQUIRE([gl_STDIO_H_DEFAULTS])
gl_NEXT_HEADERS([stdio.h])
+ dnl Determine whether __USE_MINGW_ANSI_STDIO makes printf and
+ dnl inttypes.h behave like gnu instead of system; we must give our
+ dnl printf wrapper the right attribute to match.
+ AC_CACHE_CHECK([whether inttypes macros match system or gnu printf],
+ [gl_cv_func_printf_attribute_flavor],
+ [AC_EGREP_CPP([findme .(ll|j)d. findme],
+ [#define __STDC_FORMAT_MACROS 1
+ #include <stdio.h>
+ #include <inttypes.h>
+ findme PRIdMAX findme
+ ], [gl_cv_func_printf_attribute_flavor=gnu],
+ [gl_cv_func_printf_attribute_flavor=system])])
+ if test "$gl_cv_func_printf_attribute_flavor" = gnu; then
+ AC_DEFINE([GNULIB_PRINTF_ATTRIBUTE_FLAVOR_GNU], [1],
+ [Define to 1 if printf and friends should be labeled with
+ attribute "__gnu_printf__" instead of "__printf__"])
+ fi
+
dnl No need to create extra modules for these functions. Everyone who uses
dnl <stdio.h> likely needs them.
GNULIB_FSCANF=1
# stdlib_h.m4 serial 42
-dnl Copyright (C) 2007-2014 Free Software Foundation, Inc.
+dnl Copyright (C) 2007-2015 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.
--- /dev/null
+# strdup.m4 serial 13
+
+dnl Copyright (C) 2002-2015 Free Software Foundation, Inc.
+
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+AC_DEFUN([gl_FUNC_STRDUP],
+[
+ AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS])
+ AC_CHECK_FUNCS_ONCE([strdup])
+ AC_CHECK_DECLS_ONCE([strdup])
+ if test $ac_cv_have_decl_strdup = no; then
+ HAVE_DECL_STRDUP=0
+ fi
+])
+
+AC_DEFUN([gl_FUNC_STRDUP_POSIX],
+[
+ AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS])
+ AC_REQUIRE([gl_CHECK_MALLOC_POSIX])
+ AC_CHECK_FUNCS_ONCE([strdup])
+ if test $ac_cv_func_strdup = yes; then
+ if test $gl_cv_func_malloc_posix != yes; then
+ REPLACE_STRDUP=1
+ fi
+ fi
+ AC_CHECK_DECLS_ONCE([strdup])
+ if test $ac_cv_have_decl_strdup = no; then
+ HAVE_DECL_STRDUP=0
+ fi
+])
+
+# Prerequisites of lib/strdup.c.
+AC_DEFUN([gl_PREREQ_STRDUP], [:])
# strerror.m4 serial 17
-dnl Copyright (C) 2002, 2007-2014 Free Software Foundation, Inc.
+dnl Copyright (C) 2002, 2007-2015 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.
# Configure a GNU-like replacement for <string.h>.
-# Copyright (C) 2007-2014 Free Software Foundation, Inc.
+# Copyright (C) 2007-2015 Free Software Foundation, Inc.
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# strndup.m4 serial 21
-dnl Copyright (C) 2002-2003, 2005-2014 Free Software Foundation, Inc.
+dnl Copyright (C) 2002-2003, 2005-2015 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.
# strnlen.m4 serial 13
-dnl Copyright (C) 2002-2003, 2005-2007, 2009-2014 Free Software Foundation,
+dnl Copyright (C) 2002-2003, 2005-2007, 2009-2015 Free Software Foundation,
dnl Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
# serial 6
# See if we need to provide symlink replacement.
-dnl Copyright (C) 2009-2014 Free Software Foundation, Inc.
+dnl Copyright (C) 2009-2015 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.
--- /dev/null
+# serial 6
+# See if we need to provide symlinkat replacement.
+
+dnl Copyright (C) 2009-2015 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.
+
+# Written by Eric Blake.
+
+AC_DEFUN([gl_FUNC_SYMLINKAT],
+[
+ AC_REQUIRE([gl_FUNC_OPENAT])
+ AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
+ AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
+ AC_CHECK_FUNCS_ONCE([symlinkat])
+ if test $ac_cv_func_symlinkat = no; then
+ HAVE_SYMLINKAT=0
+ else
+ AC_CACHE_CHECK([whether symlinkat handles trailing slash correctly],
+ [gl_cv_func_symlinkat_works],
+ [AC_RUN_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[#include <fcntl.h>
+ #include <unistd.h>
+ ]],
+ [[int result = 0;
+ if (!symlinkat ("a", AT_FDCWD, "conftest.link/"))
+ result |= 1;
+ if (symlinkat ("conftest.f", AT_FDCWD, "conftest.lnk2"))
+ result |= 2;
+ else if (!symlinkat ("a", AT_FDCWD, "conftest.lnk2/"))
+ result |= 4;
+ return result;
+ ]])],
+ [gl_cv_func_symlinkat_works=yes],
+ [gl_cv_func_symlinkat_works=no],
+ [case "$host_os" in
+ # Guess yes on glibc systems.
+ *-gnu*) gl_cv_func_symlinkat_works="guessing yes" ;;
+ # If we don't know, assume the worst.
+ *) gl_cv_func_symlinkat_works="guessing no" ;;
+ esac
+ ])
+ rm -f conftest.f conftest.link conftest.lnk2])
+ case "$gl_cv_func_symlinkat_works" in
+ *yes) ;;
+ *)
+ REPLACE_SYMLINKAT=1
+ ;;
+ esac
+ fi
+])
# sys_socket_h.m4 serial 23
-dnl Copyright (C) 2005-2014 Free Software Foundation, Inc.
+dnl Copyright (C) 2005-2015 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.
# sys_stat_h.m4 serial 28 -*- Autoconf -*-
-dnl Copyright (C) 2006-2014 Free Software Foundation, Inc.
+dnl Copyright (C) 2006-2015 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.
# Configure a replacement for <sys/time.h>.
# serial 8
-# Copyright (C) 2007, 2009-2014 Free Software Foundation, Inc.
+# Copyright (C) 2007, 2009-2015 Free Software Foundation, Inc.
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# sys_types_h.m4 serial 5
-dnl Copyright (C) 2011-2014 Free Software Foundation, Inc.
+dnl Copyright (C) 2011-2015 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.
#serial 5
-# Copyright (C) 2006-2007, 2009-2014 Free Software Foundation, Inc.
+# Copyright (C) 2006-2007, 2009-2015 Free Software Foundation, Inc.
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# Configure a more-standard replacement for <time.h>.
-# Copyright (C) 2000-2001, 2003-2007, 2009-2014 Free Software Foundation, Inc.
+# Copyright (C) 2000-2001, 2003-2007, 2009-2015 Free Software Foundation, Inc.
-# serial 8
+# serial 9
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
])
dnl Check whether 'struct timespec' is declared
-dnl in time.h, sys/time.h, or pthread.h.
+dnl in time.h, sys/time.h, pthread.h, or unistd.h.
AC_DEFUN([gl_CHECK_TYPE_STRUCT_TIMESPEC],
[
TIME_H_DEFINES_STRUCT_TIMESPEC=0
SYS_TIME_H_DEFINES_STRUCT_TIMESPEC=0
PTHREAD_H_DEFINES_STRUCT_TIMESPEC=0
+ UNISTD_H_DEFINES_STRUCT_TIMESPEC=0
if test $gl_cv_sys_struct_timespec_in_time_h = yes; then
TIME_H_DEFINES_STRUCT_TIMESPEC=1
else
[gl_cv_sys_struct_timespec_in_pthread_h=no])])
if test $gl_cv_sys_struct_timespec_in_pthread_h = yes; then
PTHREAD_H_DEFINES_STRUCT_TIMESPEC=1
+ else
+ AC_CACHE_CHECK([for struct timespec in <unistd.h>],
+ [gl_cv_sys_struct_timespec_in_unistd_h],
+ [AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[#include <unistd.h>
+ ]],
+ [[static struct timespec x; x.tv_sec = x.tv_nsec;]])],
+ [gl_cv_sys_struct_timespec_in_unistd_h=yes],
+ [gl_cv_sys_struct_timespec_in_unistd_h=no])])
+ if test $gl_cv_sys_struct_timespec_in_unistd_h = yes; then
+ UNISTD_H_DEFINES_STRUCT_TIMESPEC=1
+ fi
fi
fi
fi
AC_SUBST([TIME_H_DEFINES_STRUCT_TIMESPEC])
AC_SUBST([SYS_TIME_H_DEFINES_STRUCT_TIMESPEC])
AC_SUBST([PTHREAD_H_DEFINES_STRUCT_TIMESPEC])
+ AC_SUBST([UNISTD_H_DEFINES_STRUCT_TIMESPEC])
])
AC_DEFUN([gl_TIME_MODULE_INDICATOR],
dnl Reentrant time functions: localtime_r, gmtime_r.
-dnl Copyright (C) 2003, 2006-2014 Free Software Foundation, Inc.
+dnl Copyright (C) 2003, 2006-2015 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.
#serial 15
-# Copyright (C) 2000-2001, 2003-2007, 2009-2014 Free Software Foundation, Inc.
+# Copyright (C) 2000-2001, 2003-2007, 2009-2015 Free Software Foundation, Inc.
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# tm_gmtoff.m4 serial 3
-dnl Copyright (C) 2002, 2009-2014 Free Software Foundation, Inc.
+dnl Copyright (C) 2002, 2009-2015 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.
#serial 9
-dnl Copyright (C) 2002, 2005-2006, 2009-2014 Free Software Foundation, Inc.
+dnl Copyright (C) 2002, 2005-2006, 2009-2015 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.
# unistd_h.m4 serial 68
-dnl Copyright (C) 2006-2014 Free Software Foundation, Inc.
+dnl Copyright (C) 2006-2015 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.
# unlink.m4 serial 11
-dnl Copyright (C) 2009-2014 Free Software Foundation, Inc.
+dnl Copyright (C) 2009-2015 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.
--- /dev/null
+# unlinkat.m4 serial 2
+dnl Copyright (C) 2004-2015 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.
+
+# Written by Jim Meyering.
+
+AC_DEFUN([gl_FUNC_UNLINKAT],
+[
+ AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
+ AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
+ AC_CHECK_FUNCS_ONCE([unlinkat])
+ AC_REQUIRE([gl_FUNC_UNLINK])
+ AC_REQUIRE([gl_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK])
+ if test $ac_cv_func_unlinkat = no; then
+ HAVE_UNLINKAT=0
+ else
+ case "$gl_cv_func_lstat_dereferences_slashed_symlink" in
+ *no)
+ # Solaris 9 has *at functions, but uniformly mishandles trailing
+ # slash in all of them.
+ REPLACE_UNLINKAT=1
+ ;;
+ *)
+ # GNU/Hurd has unlinkat, but it has the same bug as unlink.
+ if test $REPLACE_UNLINK = 1; then
+ REPLACE_UNLINKAT=1
+ fi
+ ;;
+ esac
+ fi
+])
# serial 9
-# Copyright (C) 1998-2001, 2003-2004, 2007, 2009-2014 Free Software Foundation,
+# Copyright (C) 1998-2001, 2003-2004, 2007, 2009-2015 Free Software Foundation,
# Inc.
#
# This file is free software; the Free Software Foundation
-dnl Copyright (C) 2003-2014 Free Software Foundation, Inc.
+dnl Copyright (C) 2003-2015 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.
--- /dev/null
+# serial 5
+# See if we need to provide utimensat replacement.
+
+dnl Copyright (C) 2009-2015 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.
+
+# Written by Eric Blake.
+
+AC_DEFUN([gl_FUNC_UTIMENSAT],
+[
+ AC_REQUIRE([gl_SYS_STAT_H_DEFAULTS])
+ AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
+ AC_CHECK_FUNCS_ONCE([utimensat])
+ if test $ac_cv_func_utimensat = no; then
+ HAVE_UTIMENSAT=0
+ else
+ AC_CACHE_CHECK([whether utimensat works],
+ [gl_cv_func_utimensat_works],
+ [AC_RUN_IFELSE(
+ [AC_LANG_PROGRAM([[
+#include <fcntl.h>
+#include <sys/stat.h>
+#include <unistd.h>
+]], [[int result = 0;
+ const char *f = "conftest.file";
+ if (close (creat (f, 0600)))
+ return 1;
+ /* Test whether the AT_SYMLINK_NOFOLLOW flag is supported. */
+ {
+ if (utimensat (AT_FDCWD, f, NULL, AT_SYMLINK_NOFOLLOW))
+ result |= 2;
+ }
+ /* Test whether UTIME_NOW and UTIME_OMIT work. */
+ {
+ struct timespec ts[2] = { { 1, UTIME_OMIT }, { 1, UTIME_NOW } };
+ if (utimensat (AT_FDCWD, f, ts, 0))
+ result |= 4;
+ }
+ sleep (1);
+ {
+ struct timespec ts[2] = { { 1, UTIME_NOW }, { 1, UTIME_OMIT } };
+ struct stat st;
+ if (utimensat (AT_FDCWD, f, ts, 0))
+ result |= 8;
+ if (stat (f, &st))
+ result |= 16;
+ else if (st.st_ctime < st.st_atime)
+ result |= 32;
+ }
+ return result;
+ ]])],
+dnl FIXME: simplify this in 2012, when file system bugs are no longer common
+ [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+#ifdef __linux__
+/* The Linux kernel added utimensat in 2.6.22, but has bugs with UTIME_OMIT
+ in several file systems as recently as 2.6.32. Always replace utimensat
+ to support older kernels. */
+choke me
+#endif
+ ]])],
+ [gl_cv_func_utimensat_works=yes],
+ [gl_cv_func_utimensat_works="needs runtime check"])],
+ [gl_cv_func_utimensat_works=no],
+ [gl_cv_func_utimensat_works="guessing no"])])
+ if test "$gl_cv_func_utimensat_works" != yes; then
+ REPLACE_UTIMENSAT=1
+ fi
+ fi
+])
# Detect some bugs in glibc's implementation of utimes.
# serial 3
-dnl Copyright (C) 2003-2005, 2009-2014 Free Software Foundation, Inc.
+dnl Copyright (C) 2003-2005, 2009-2015 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.
# vasnprintf.m4 serial 36
-dnl Copyright (C) 2002-2004, 2006-2014 Free Software Foundation, Inc.
+dnl Copyright (C) 2002-2004, 2006-2015 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.
# vasprintf.m4 serial 6
-dnl Copyright (C) 2002-2003, 2006-2007, 2009-2014 Free Software Foundation,
+dnl Copyright (C) 2002-2003, 2006-2007, 2009-2015 Free Software Foundation,
dnl Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
# warn-on-use.m4 serial 5
-dnl Copyright (C) 2010-2014 Free Software Foundation, Inc.
+dnl Copyright (C) 2010-2015 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.
# warnings.m4 serial 11
-dnl Copyright (C) 2008-2014 Free Software Foundation, Inc.
+dnl Copyright (C) 2008-2015 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 A placeholder for ISO C99 <wchar.h>, for platforms that have issues.
-dnl Copyright (C) 2007-2014 Free Software Foundation, Inc.
+dnl Copyright (C) 2007-2015 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.
# wchar_t.m4 serial 4 (gettext-0.18.2)
-dnl Copyright (C) 2002-2003, 2008-2014 Free Software Foundation, Inc.
+dnl Copyright (C) 2002-2003, 2008-2015 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 A placeholder for ISO C99 <wctype.h>, for platforms that lack it.
-dnl Copyright (C) 2006-2014 Free Software Foundation, Inc.
+dnl Copyright (C) 2006-2015 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.
# wint_t.m4 serial 5 (gettext-0.18.2)
-dnl Copyright (C) 2003, 2007-2014 Free Software Foundation, Inc.
+dnl Copyright (C) 2003, 2007-2015 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.
# write.m4 serial 5
-dnl Copyright (C) 2008-2014 Free Software Foundation, Inc.
+dnl Copyright (C) 2008-2015 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.
# xalloc.m4 serial 18
-dnl Copyright (C) 2002-2006, 2009-2014 Free Software Foundation, Inc.
+dnl Copyright (C) 2002-2006, 2009-2015 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.
# xsize.m4 serial 5
-dnl Copyright (C) 2003-2004, 2008-2014 Free Software Foundation, Inc.
+dnl Copyright (C) 2003-2004, 2008-2015 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.
# xstrndup.m4 serial 2
-dnl Copyright (C) 2003, 2009-2014 Free Software Foundation, Inc.
+dnl Copyright (C) 2003, 2009-2015 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.
# xvasprintf.m4 serial 2
-dnl Copyright (C) 2006, 2009-2014 Free Software Foundation, Inc.
+dnl Copyright (C) 2006, 2009-2015 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.
# This Makefile fragment tries to be general-purpose enough to be
# used by many projects via the gnulib maintainer-makefile module.
-## Copyright (C) 2001-2014 Free Software Foundation, Inc.
+## Copyright (C) 2001-2015 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
perl -lne \
'$(_gl_TS_function_match) and print "^$$1\$$"' $$hdr; \
) | sort -u > $$t; \
- nm -e $(_gl_TS_obj_files)|$(SED) -n 's/.* T //p'|grep -Ev -f $$t \
+ nm -g $(_gl_TS_obj_files)|$(SED) -n 's/.* T //p'|grep -Ev -f $$t \
&& { echo the above functions should have static scope >&2; \
exit 1; } || : ; \
( printf '^%s$$\n' '__.*' $(_gl_TS_unmarked_extern_vars); \
perl -lne '$(_gl_TS_var_match) and print "^$$1\$$"' \
$$hdr $(_gl_TS_other_headers) \
) | sort -u > $$t; \
- nm -e $(_gl_TS_obj_files) | $(SED) -n 's/.* [BCDGRS] //p' \
+ nm -g $(_gl_TS_obj_files) | $(SED) -n 's/.* [BCDGRS] //p' \
| sort -u | grep -Ev -f $$t \
&& { echo the above variables should have static scope >&2; \
exit 1; } || :
patch.c \
pch.c \
pch.h \
+ safe.c \
+ safe.h \
util.c \
util.h \
version.c \
$(top_srcdir)/m4/absolute-header.m4 $(top_srcdir)/m4/alloca.m4 \
$(top_srcdir)/m4/backupfile.m4 $(top_srcdir)/m4/bison.m4 \
$(top_srcdir)/m4/canonicalize.m4 \
+ $(top_srcdir)/m4/chdir-long.m4 $(top_srcdir)/m4/chown.m4 \
$(top_srcdir)/m4/clock_time.m4 $(top_srcdir)/m4/close.m4 \
$(top_srcdir)/m4/closedir.m4 $(top_srcdir)/m4/codeset.m4 \
$(top_srcdir)/m4/configmake.m4 $(top_srcdir)/m4/d-ino.m4 \
$(top_srcdir)/m4/eealloc.m4 $(top_srcdir)/m4/environ.m4 \
$(top_srcdir)/m4/errno_h.m4 $(top_srcdir)/m4/error.m4 \
$(top_srcdir)/m4/exponentd.m4 $(top_srcdir)/m4/extensions.m4 \
- $(top_srcdir)/m4/extern-inline.m4 $(top_srcdir)/m4/fcntl-o.m4 \
- $(top_srcdir)/m4/fcntl.m4 $(top_srcdir)/m4/fcntl_h.m4 \
+ $(top_srcdir)/m4/extern-inline.m4 $(top_srcdir)/m4/fchdir.m4 \
+ $(top_srcdir)/m4/fchmodat.m4 $(top_srcdir)/m4/fchownat.m4 \
+ $(top_srcdir)/m4/fcntl-o.m4 $(top_srcdir)/m4/fcntl.m4 \
+ $(top_srcdir)/m4/fcntl_h.m4 $(top_srcdir)/m4/filenamecat.m4 \
$(top_srcdir)/m4/float_h.m4 $(top_srcdir)/m4/fstat.m4 \
+ $(top_srcdir)/m4/fstatat.m4 $(top_srcdir)/m4/getcwd.m4 \
$(top_srcdir)/m4/getdtablesize.m4 $(top_srcdir)/m4/getopt.m4 \
$(top_srcdir)/m4/gettime.m4 $(top_srcdir)/m4/gettimeofday.m4 \
$(top_srcdir)/m4/glibc21.m4 $(top_srcdir)/m4/gnulib-common.m4 \
$(top_srcdir)/m4/gnulib-comp.m4 \
$(top_srcdir)/m4/include_next.m4 $(top_srcdir)/m4/intmax_t.m4 \
$(top_srcdir)/m4/inttypes_h.m4 $(top_srcdir)/m4/largefile.m4 \
- $(top_srcdir)/m4/lchmod.m4 $(top_srcdir)/m4/localcharset.m4 \
+ $(top_srcdir)/m4/lchown.m4 $(top_srcdir)/m4/localcharset.m4 \
$(top_srcdir)/m4/locale-fr.m4 $(top_srcdir)/m4/locale-ja.m4 \
$(top_srcdir)/m4/locale-zh.m4 $(top_srcdir)/m4/longlong.m4 \
$(top_srcdir)/m4/lstat.m4 $(top_srcdir)/m4/malloc.m4 \
$(top_srcdir)/m4/malloca.m4 $(top_srcdir)/m4/manywarnings.m4 \
$(top_srcdir)/m4/mbrtowc.m4 $(top_srcdir)/m4/mbsinit.m4 \
$(top_srcdir)/m4/mbstate_t.m4 $(top_srcdir)/m4/memchr.m4 \
+ $(top_srcdir)/m4/mempcpy.m4 $(top_srcdir)/m4/memrchr.m4 \
$(top_srcdir)/m4/minmax.m4 $(top_srcdir)/m4/mkdir.m4 \
- $(top_srcdir)/m4/mktime.m4 $(top_srcdir)/m4/mmap-anon.m4 \
+ $(top_srcdir)/m4/mkdirat.m4 $(top_srcdir)/m4/mktime.m4 \
+ $(top_srcdir)/m4/mmap-anon.m4 $(top_srcdir)/m4/mode_t.m4 \
$(top_srcdir)/m4/msvc-inval.m4 \
$(top_srcdir)/m4/msvc-nothrow.m4 $(top_srcdir)/m4/multiarch.m4 \
$(top_srcdir)/m4/nocrash.m4 $(top_srcdir)/m4/off_t.m4 \
+ $(top_srcdir)/m4/open.m4 $(top_srcdir)/m4/openat.m4 \
$(top_srcdir)/m4/opendir.m4 $(top_srcdir)/m4/parse-datetime.m4 \
$(top_srcdir)/m4/pathmax.m4 $(top_srcdir)/m4/printf.m4 \
$(top_srcdir)/m4/quote.m4 $(top_srcdir)/m4/quotearg.m4 \
$(top_srcdir)/m4/raise.m4 $(top_srcdir)/m4/readdir.m4 \
- $(top_srcdir)/m4/readlink.m4 $(top_srcdir)/m4/realloc.m4 \
- $(top_srcdir)/m4/rename.m4 $(top_srcdir)/m4/rmdir.m4 \
+ $(top_srcdir)/m4/readlink.m4 $(top_srcdir)/m4/readlinkat.m4 \
+ $(top_srcdir)/m4/realloc.m4 $(top_srcdir)/m4/rename.m4 \
+ $(top_srcdir)/m4/renameat.m4 $(top_srcdir)/m4/rmdir.m4 \
$(top_srcdir)/m4/safe-read.m4 $(top_srcdir)/m4/safe-write.m4 \
- $(top_srcdir)/m4/secure_getenv.m4 $(top_srcdir)/m4/setenv.m4 \
- $(top_srcdir)/m4/setmode.m4 $(top_srcdir)/m4/signal_h.m4 \
- $(top_srcdir)/m4/size_max.m4 $(top_srcdir)/m4/ssize_t.m4 \
- $(top_srcdir)/m4/stat-time.m4 $(top_srcdir)/m4/stat.m4 \
- $(top_srcdir)/m4/stdarg.m4 $(top_srcdir)/m4/stdbool.m4 \
- $(top_srcdir)/m4/stddef_h.m4 $(top_srcdir)/m4/stdint.m4 \
- $(top_srcdir)/m4/stdint_h.m4 $(top_srcdir)/m4/stdio_h.m4 \
- $(top_srcdir)/m4/stdlib_h.m4 $(top_srcdir)/m4/strerror.m4 \
+ $(top_srcdir)/m4/save-cwd.m4 $(top_srcdir)/m4/secure_getenv.m4 \
+ $(top_srcdir)/m4/setenv.m4 $(top_srcdir)/m4/setmode.m4 \
+ $(top_srcdir)/m4/signal_h.m4 $(top_srcdir)/m4/size_max.m4 \
+ $(top_srcdir)/m4/ssize_t.m4 $(top_srcdir)/m4/stat-time.m4 \
+ $(top_srcdir)/m4/stat.m4 $(top_srcdir)/m4/stdarg.m4 \
+ $(top_srcdir)/m4/stdbool.m4 $(top_srcdir)/m4/stddef_h.m4 \
+ $(top_srcdir)/m4/stdint.m4 $(top_srcdir)/m4/stdint_h.m4 \
+ $(top_srcdir)/m4/stdio_h.m4 $(top_srcdir)/m4/stdlib_h.m4 \
+ $(top_srcdir)/m4/strdup.m4 $(top_srcdir)/m4/strerror.m4 \
$(top_srcdir)/m4/string_h.m4 $(top_srcdir)/m4/strndup.m4 \
$(top_srcdir)/m4/strnlen.m4 $(top_srcdir)/m4/symlink.m4 \
- $(top_srcdir)/m4/sys_socket_h.m4 \
+ $(top_srcdir)/m4/symlinkat.m4 $(top_srcdir)/m4/sys_socket_h.m4 \
$(top_srcdir)/m4/sys_stat_h.m4 $(top_srcdir)/m4/sys_time_h.m4 \
$(top_srcdir)/m4/sys_types_h.m4 $(top_srcdir)/m4/tempname.m4 \
$(top_srcdir)/m4/time_h.m4 $(top_srcdir)/m4/time_r.m4 \
$(top_srcdir)/m4/timespec.m4 $(top_srcdir)/m4/tm_gmtoff.m4 \
$(top_srcdir)/m4/unistd-safer.m4 $(top_srcdir)/m4/unistd_h.m4 \
- $(top_srcdir)/m4/unlink.m4 $(top_srcdir)/m4/utimbuf.m4 \
- $(top_srcdir)/m4/utimens.m4 $(top_srcdir)/m4/utimes.m4 \
+ $(top_srcdir)/m4/unlink.m4 $(top_srcdir)/m4/unlinkat.m4 \
+ $(top_srcdir)/m4/utimbuf.m4 $(top_srcdir)/m4/utimens.m4 \
+ $(top_srcdir)/m4/utimensat.m4 $(top_srcdir)/m4/utimes.m4 \
$(top_srcdir)/m4/vasnprintf.m4 $(top_srcdir)/m4/vasprintf.m4 \
$(top_srcdir)/m4/warn-on-use.m4 $(top_srcdir)/m4/warnings.m4 \
$(top_srcdir)/m4/wchar_h.m4 $(top_srcdir)/m4/wchar_t.m4 \
am__installdirs = "$(DESTDIR)$(bindir)"
PROGRAMS = $(bin_PROGRAMS)
am__patch_SOURCES_DIST = bestmatch.h common.h inp.c inp.h patch.c \
- pch.c pch.h util.c util.h version.c version.h merge.c
+ pch.c pch.h safe.c safe.h util.c util.h version.c version.h \
+ merge.c
@ENABLE_MERGE_TRUE@am__objects_1 = merge.$(OBJEXT)
am_patch_OBJECTS = inp.$(OBJEXT) patch.$(OBJEXT) pch.$(OBJEXT) \
- util.$(OBJEXT) version.$(OBJEXT) $(am__objects_1)
+ safe.$(OBJEXT) util.$(OBJEXT) version.$(OBJEXT) \
+ $(am__objects_1)
patch_OBJECTS = $(am_patch_OBJECTS)
am__DEPENDENCIES_1 =
patch_DEPENDENCIES = $(top_builddir)/lib/libpatch.a \
HAVE_LINKAT = @HAVE_LINKAT@
HAVE_LONG_LONG_INT = @HAVE_LONG_LONG_INT@
HAVE_LSTAT = @HAVE_LSTAT@
+HAVE_MAX_ALIGN_T = @HAVE_MAX_ALIGN_T@
HAVE_MBRLEN = @HAVE_MBRLEN@
HAVE_MBRTOWC = @HAVE_MBRTOWC@
HAVE_MBSINIT = @HAVE_MBSINIT@
SYS_TIME_H_DEFINES_STRUCT_TIMESPEC = @SYS_TIME_H_DEFINES_STRUCT_TIMESPEC@
TIME_H_DEFINES_STRUCT_TIMESPEC = @TIME_H_DEFINES_STRUCT_TIMESPEC@
UNDEFINE_STRTOK_R = @UNDEFINE_STRTOK_R@
+UNISTD_H_DEFINES_STRUCT_TIMESPEC = @UNISTD_H_DEFINES_STRUCT_TIMESPEC@
UNISTD_H_HAVE_WINSOCK2_H = @UNISTD_H_HAVE_WINSOCK2_H@
UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS = @UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS@
VERSION = @VERSION@
top_srcdir = @top_srcdir@
AM_CFLAGS = $(WARN_CFLAGS) $(WERROR_CFLAGS)
patch_SOURCES = bestmatch.h common.h inp.c inp.h patch.c pch.c pch.h \
- util.c util.h version.c version.h $(am__append_1)
+ safe.c safe.h util.c util.h version.c version.h \
+ $(am__append_1)
AM_CPPFLAGS = -I$(top_builddir)/lib -I$(top_srcdir)/lib \
$(am__append_2)
patch_LDADD = $(LDADD) $(top_builddir)/lib/libpatch.a $(LIB_CLOCK_GETTIME) \
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/merge.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/patch.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pch.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/safe.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/util.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/version.Po@am__quote@
#undef XTERN
#define XTERN
#include <inp.h>
+#include <safe.h>
/* Input-file-with-indexable-lines abstract type */
{
if (S_ISREG (instat.st_mode))
{
- int ifd = open (filename, O_RDONLY|binary_transput);
+ int ifd = safe_open (filename, O_RDONLY|binary_transput, 0);
size_t buffered = 0, n;
if (ifd < 0)
pfatal ("can't open file %s", quotearg (filename));
else if (S_ISLNK (instat.st_mode))
{
ssize_t n;
- n = readlink (filename, buffer, size);
+ n = safe_readlink (filename, buffer, size);
if (n < 0)
pfatal ("can't read %s %s", "symbolic link", quotearg (filename));
size = n;
static void
plan_b (char const *filename)
{
+ int ifd;
FILE *ifp;
int c;
size_t len;
if (instat.st_size == 0)
filename = NULL_DEVICE;
- if (! (ifp = fopen (filename, binary_transput ? "rb" : "r")))
+ if ((ifd = safe_open (filename, O_RDONLY | binary_transput, 0)) < 0
+ || ! (ifp = fdopen (ifd, binary_transput ? "rb" : "r")))
pfatal ("Can't open file %s", quotearg (filename));
if (TMPINNAME_needs_removal)
{
#include <gl_linked_list.h>
#include <gl_xlist.h>
#include <minmax.h>
+#include <safe.h>
/* procedures */
if (read_only_behavior != RO_IGNORE
&& ! inerrno && ! S_ISLNK (instat.st_mode)
- && access (inname, W_OK) != 0)
+ && safe_access (inname, W_OK) != 0)
{
say ("File %s is read-only; ", quotearg (inname));
if (read_only_behavior == RO_WARN)
outstate.ofp = fdopen(outfd, binary_transput ? "wb" : "w");
if (! outstate.ofp)
pfatal ("%s", TMPOUTNAME);
+ /* outstate.ofp now owns the file descriptor */
+ outfd = -1;
}
/* find out where all the lines are */
enum file_attributes attr = 0;
struct timespec new_time = pch_timestamp (! reverse);
mode_t mode = file_type |
- ((new_mode ? new_mode : instat.st_mode) & S_IRWXUGO);
+ ((set_mode ? new_mode : instat.st_mode) & S_IRWXUGO);
if ((set_time | set_utc) && new_time.tv_sec != -1)
{
from_st, file_to_output->to,
file_to_output->mode, file_to_output->backup);
if (file_to_output->to && from_needs_removal)
- unlink (file_to_output->from);
+ safe_unlink (file_to_output->from);
if (st && st->st_dev == from_st->st_dev && st->st_ino == from_st->st_ino)
{
{
const struct file_to_output *file_to_output = elt;
- unlink (file_to_output->from);
+ safe_unlink (file_to_output->from);
}
gl_list_iterator_free (&iter);
gl_list_clear (files_to_output);
{
if (*needs_removal)
{
- unlink (name);
+ safe_unlink (name);
*needs_removal = false;
}
}
#if HAVE_SETMODE_DOS
# include <io.h>
#endif
+#include <safe.h>
#define INITHUNKMAX 125 /* initial dynamic allocation size */
static bool
name_is_valid (char const *name)
{
- char const *n;
int i;
bool is_valid = true;
int version_controlled[3];
enum diff retval;
mode_t file_type;
+ size_t indent = -1;
for (i = OLD; i <= INDEX; i++)
if (p_name[i]) {
file_offset previous_line = this_line;
bool last_line_was_command = this_is_a_command;
bool stars_last_line = stars_this_line;
- size_t indent = 0;
+ size_t indent_last_line = indent;
char ed_command_letter;
bool strip_trailing_cr;
size_t chars_read;
+ indent = 0;
this_line = file_tell (pfp);
chars_read = pget_line (0, 0, false, false);
if (chars_read == (size_t) -1)
if ((diff_type == NO_DIFF
|| diff_type == CONTEXT_DIFF
|| diff_type == NEW_CONTEXT_DIFF)
- && stars_last_line && strnEQ (s, "*** ", 4)) {
+ && stars_last_line && indent_last_line == indent
+ && strnEQ (s, "*** ", 4)) {
s += 4;
if (s[0] == '0' && !ISDIGIT (s[1]))
p_says_nonexistent[OLD] = 1 + ! p_timestamp[OLD].tv_sec;
if (checkdirs)
{
*f = '\0';
- stat_result = stat (filename, &stat_buf);
+ stat_result = safe_stat (filename, &stat_buf);
*f = '/';
if (! (stat_result == 0 && S_ISDIR (stat_buf.st_mode)))
break;
--- /dev/null
+/* safe path traversal functions for 'patch' */
+
+/* Copyright (C) 2015 Free Software Foundation, Inc.
+
+ Written by Tim Waugh <twaugh@redhat.com> and
+ Andreas Gruenbacher <agruenba@redhat.com>.
+
+ 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 <sys/types.h>
+#include <sys/stat.h>
+#include <sys/resource.h>
+#include <sys/time.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include <unistd.h>
+#include <errno.h>
+#include <string.h>
+#include <alloca.h>
+#include <safe.h>
+#include "dirname.h"
+
+#include <hash.h>
+#include <xalloc.h>
+#include <minmax.h>
+
+#define XTERN extern
+#include "common.h"
+
+/* Path lookup results are cached in a hash table + LRU list. When the
+ cache is full, the oldest entries are removed. */
+
+unsigned long dirfd_cache_misses;
+
+struct cached_dirfd {
+ /* lru list */
+ struct cached_dirfd *prev, *next;
+
+ /* key (openat arguments) */
+ int dirfd;
+ char *name;
+
+ /* value (openat result) */
+ int fd;
+};
+
+static Hash_table *cached_dirfds = NULL;
+static size_t max_cached_fds;
+static struct cached_dirfd lru_list = {
+ .prev = &lru_list,
+ .next = &lru_list,
+};
+
+static size_t hash_cached_dirfd (const void *entry, size_t table_size)
+{
+ const struct cached_dirfd *d = entry;
+ size_t strhash = hash_string (d->name, table_size);
+ return (strhash * 31 + d->dirfd) % table_size;
+}
+
+static bool compare_cached_dirfds (const void *_a,
+ const void *_b)
+{
+ const struct cached_dirfd *a = _a;
+ const struct cached_dirfd *b = _b;
+
+ return (a->dirfd == b->dirfd &&
+ !strcmp (a->name, b->name));
+}
+
+static void free_cached_dirfd (struct cached_dirfd *d)
+{
+ close (d->fd);
+ free (d->name);
+ free (d);
+}
+
+static void init_dirfd_cache (void)
+{
+ struct rlimit nofile;
+
+ max_cached_fds = 8;
+ if (getrlimit (RLIMIT_NOFILE, &nofile) == 0)
+ max_cached_fds = MAX (nofile.rlim_cur / 4, max_cached_fds);
+
+ cached_dirfds = hash_initialize (max_cached_fds,
+ NULL,
+ hash_cached_dirfd,
+ compare_cached_dirfds,
+ NULL);
+
+ if (!cached_dirfds)
+ xalloc_die ();
+}
+
+static void lru_list_add (struct cached_dirfd *entry, struct cached_dirfd *head)
+{
+ struct cached_dirfd *next = head->next;
+ entry->prev = head;
+ entry->next = next;
+ head->next = next->prev = entry;
+}
+
+static void lru_list_del (struct cached_dirfd *entry)
+{
+ struct cached_dirfd *prev = entry->prev;
+ struct cached_dirfd *next = entry->next;
+ prev->next = next;
+ next->prev = prev;
+}
+
+static struct cached_dirfd *lookup_cached_dirfd (int dirfd, const char *name)
+{
+ struct cached_dirfd *entry = NULL;
+
+ if (cached_dirfds)
+ {
+ struct cached_dirfd key;
+ key.dirfd = dirfd;
+ key.name = (char *) name;
+ entry = hash_lookup (cached_dirfds, &key);
+ if (entry)
+ {
+ /* Move this most recently used entry to the head of the lru list */
+ lru_list_del (entry);
+ lru_list_add (entry, &lru_list);
+ }
+ }
+
+ return entry;
+}
+
+static void remove_cached_dirfd (struct cached_dirfd *entry)
+{
+ lru_list_del (entry);
+ hash_delete (cached_dirfds, entry);
+ free_cached_dirfd (entry);
+}
+
+static void insert_cached_dirfd (struct cached_dirfd *entry, int keepfd)
+{
+ if (cached_dirfds == NULL)
+ init_dirfd_cache ();
+
+ /* Trim off the least recently used entries */
+ while (hash_get_n_entries (cached_dirfds) >= max_cached_fds)
+ {
+ struct cached_dirfd *last = lru_list.prev;
+ assert (last != &lru_list);
+ if (last->fd == keepfd)
+ {
+ last = last->prev;
+ assert (last != &lru_list);
+ }
+ remove_cached_dirfd (last);
+ }
+
+ assert (hash_insert (cached_dirfds, entry) == entry);
+ lru_list_add (entry, &lru_list);
+}
+
+static void invalidate_cached_dirfd (int dirfd, const char *name)
+{
+ struct cached_dirfd key, *entry;
+ if (!cached_dirfds)
+ return;
+
+ key.dirfd = dirfd;
+ key.name = (char *) name;
+ entry = hash_lookup (cached_dirfds, &key);
+ if (entry)
+ remove_cached_dirfd (entry);
+}
+
+static int openat_cached (int dirfd, const char *name, int keepfd)
+{
+ int fd;
+ struct cached_dirfd *entry = lookup_cached_dirfd (dirfd, name);
+
+ if (entry)
+ return entry->fd;
+ dirfd_cache_misses++;
+
+ /* Actually get the new directory file descriptor. Don't follow
+ symbolic links. */
+ fd = openat (dirfd, name, O_DIRECTORY | O_NOFOLLOW);
+
+ /* Don't cache errors. */
+ if (fd < 0)
+ return fd;
+
+ /* Store new cache entry */
+ entry = xmalloc (sizeof (struct cached_dirfd));
+ entry->dirfd = dirfd;
+ entry->name = xstrdup (name);
+ entry->fd = fd;
+ insert_cached_dirfd (entry, keepfd);
+
+ return fd;
+}
+
+/* Resolve the next path component in PATH inside DIRFD. */
+static int traverse_next (int dirfd, const char **path, int keepfd)
+{
+ const char *p = *path;
+ char *name;
+
+ while (*p && ! ISSLASH (*p))
+ p++;
+ if (**path == '.' && *path + 1 == p)
+ goto skip;
+ name = alloca (p - *path + 1);
+ memcpy(name, *path, p - *path);
+ name[p - *path] = 0;
+
+ dirfd = openat_cached (dirfd, name, keepfd);
+ if (dirfd < 0 && dirfd != AT_FDCWD)
+ {
+ *path = p;
+ return -1;
+ }
+skip:
+ while (ISSLASH (*p))
+ p++;
+ *path = p;
+ return dirfd;
+}
+
+/* Traverse PATHNAME. Updates PATHNAME to point to the last path component and
+ returns a file descriptor to its parent directory (which can be AT_FDCWD).
+ When KEEPFD is given, make sure that the cache entry for DIRFD is not
+ removed from the cache (and KEEPFD remains open) even if the cache grows
+ beyond MAX_CACHED_FDS entries. */
+static int traverse_another_path (const char **pathname, int keepfd)
+{
+ unsigned long misses = dirfd_cache_misses;
+ const char *path = *pathname, *last;
+ int dirfd = AT_FDCWD;
+
+ if (! *path || IS_ABSOLUTE_FILE_NAME (path))
+ return dirfd;
+
+ /* Find the last pathname component */
+ last = strrchr (path, 0) - 1;
+ if (ISSLASH (*last))
+ {
+ while (last != path)
+ if (! ISSLASH (*--last))
+ break;
+ }
+ while (last != path && ! ISSLASH (*(last - 1)))
+ last--;
+ if (last == path)
+ return dirfd;
+
+ if (debug & 32)
+ printf ("Resolving path \"%.*s\"", (int) (last - path), path);
+
+ while (path != last)
+ {
+ dirfd = traverse_next (dirfd, &path, keepfd);
+ if (dirfd < 0 && dirfd != AT_FDCWD)
+ {
+ if (debug & 32)
+ {
+ printf (" (failed)\n");
+ fflush (stdout);
+ }
+ if (errno == ELOOP)
+ {
+ fprintf (stderr, "Refusing to follow symbolic link %.*s\n",
+ (int) (path - *pathname), *pathname);
+ fatal_exit (0);
+ }
+ return dirfd;
+ }
+ }
+ *pathname = last;
+ if (debug & 32)
+ {
+ misses = dirfd_cache_misses - misses;
+ if (! misses)
+ printf(" (cached)\n");
+ else
+ printf (" (%lu miss%s)\n", misses, misses == 1 ? "" : "es");
+ fflush (stdout);
+ }
+ return dirfd;
+}
+
+/* Just traverse PATHNAME; see traverse_another_path(). */
+static int traverse_path (const char **pathname)
+{
+ return traverse_another_path (pathname, -1);
+}
+
+static int safe_xstat (const char *pathname, struct stat *buf, int flags)
+{
+ int dirfd;
+
+ dirfd = traverse_path (&pathname);
+ if (dirfd < 0 && dirfd != AT_FDCWD)
+ return dirfd;
+ return fstatat (dirfd, pathname, buf, flags);
+}
+
+/* Replacement for stat() */
+int safe_stat (const char *pathname, struct stat *buf)
+{
+ return safe_xstat (pathname, buf, 0);
+}
+
+/* Replacement for lstat() */
+int safe_lstat (const char *pathname, struct stat *buf)
+{
+ return safe_xstat (pathname, buf, AT_SYMLINK_NOFOLLOW);
+}
+
+/* Replacement for open() */
+int safe_open (const char *pathname, int flags, mode_t mode)
+{
+ int dirfd;
+
+ dirfd = traverse_path (&pathname);
+ if (dirfd < 0 && dirfd != AT_FDCWD)
+ return dirfd;
+ return openat (dirfd, pathname, flags, mode);
+}
+
+/* Replacement for rename() */
+int safe_rename (const char *oldpath, const char *newpath)
+{
+ int olddirfd, newdirfd;
+ int ret;
+
+ olddirfd = traverse_path (&oldpath);
+ if (olddirfd != AT_FDCWD && olddirfd < 0)
+ return olddirfd;
+
+ newdirfd = traverse_another_path (&newpath, olddirfd);
+ if (newdirfd != AT_FDCWD && newdirfd < 0)
+ return newdirfd;
+
+ ret = renameat (olddirfd, oldpath, newdirfd, newpath);
+ invalidate_cached_dirfd (olddirfd, oldpath);
+ invalidate_cached_dirfd (newdirfd, newpath);
+ return ret;
+}
+
+/* Replacement for mkdir() */
+int safe_mkdir (const char *pathname, mode_t mode)
+{
+ int dirfd;
+
+ dirfd = traverse_path (&pathname);
+ if (dirfd < 0 && dirfd != AT_FDCWD)
+ return dirfd;
+ return mkdirat (dirfd, pathname, mode);
+}
+
+/* Replacement for rmdir() */
+int safe_rmdir (const char *pathname)
+{
+ int dirfd;
+ int ret;
+
+ dirfd = traverse_path (&pathname);
+ if (dirfd < 0 && dirfd != AT_FDCWD)
+ return dirfd;
+
+ ret = unlinkat (dirfd, pathname, AT_REMOVEDIR);
+ invalidate_cached_dirfd (dirfd, pathname);
+ return ret;
+}
+
+/* Replacement for unlink() */
+int safe_unlink (const char *pathname)
+{
+ int dirfd;
+
+ dirfd = traverse_path (&pathname);
+ if (dirfd < 0 && dirfd != AT_FDCWD)
+ return dirfd;
+ return unlinkat (dirfd, pathname, 0);
+}
+
+/* Replacement for symlink() */
+int safe_symlink (const char *target, const char *linkpath)
+{
+ int dirfd;
+
+ dirfd = traverse_path (&linkpath);
+ if (dirfd < 0 && dirfd != AT_FDCWD)
+ return dirfd;
+ return symlinkat (target, dirfd, linkpath);
+}
+
+/* Replacement for chmod() */
+int safe_chmod (const char *pathname, mode_t mode)
+{
+ int dirfd;
+
+ dirfd = traverse_path (&pathname);
+ if (dirfd < 0 && dirfd != AT_FDCWD)
+ return dirfd;
+ return fchmodat (dirfd, pathname, mode, 0);
+}
+
+/* Replacement for lchown() */
+int safe_lchown (const char *pathname, uid_t owner, gid_t group)
+{
+ int dirfd;
+
+ dirfd = traverse_path (&pathname);
+ if (dirfd < 0 && dirfd != AT_FDCWD)
+ return dirfd;
+ return fchownat (dirfd, pathname, owner, group, AT_SYMLINK_NOFOLLOW);
+}
+
+/* Replacement for lutimens() */
+int safe_lutimens (const char *pathname, struct timespec const times[2])
+{
+ int dirfd;
+
+ dirfd = traverse_path (&pathname);
+ if (dirfd < 0 && dirfd != AT_FDCWD)
+ return dirfd;
+ return utimensat (dirfd, pathname, times, AT_SYMLINK_NOFOLLOW);
+}
+
+/* Replacement for readlink() */
+ssize_t safe_readlink(const char *pathname, char *buf, size_t bufsiz)
+{
+ int dirfd;
+
+ dirfd = traverse_path (&pathname);
+ if (dirfd < 0 && dirfd != AT_FDCWD)
+ return dirfd;
+ return readlinkat (dirfd, pathname, buf, bufsiz);
+}
+
+/* Replacement for access() */
+int safe_access(const char *pathname, int mode)
+{
+ int dirfd;
+
+ dirfd = traverse_path (&pathname);
+ if (dirfd < 0 && dirfd != AT_FDCWD)
+ return dirfd;
+ return faccessat (dirfd, pathname, mode, 0);
+}
--- /dev/null
+/* safe path traversal functions for 'patch' */
+
+/* Copyright (C) 2015 Free Software Foundation, Inc.
+
+ Written by Tim Waugh <twaugh@redhat.com> and
+ Andreas Gruenbacher <agruenba@redhat.com>.
+
+ 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/>. */
+
+int safe_stat (const char *pathname, struct stat *buf);
+int safe_lstat (const char *pathname, struct stat *buf);
+int safe_open (const char *pathname, int flags, mode_t mode);
+int safe_rename (const char *oldpath, const char *newpath);
+int safe_mkdir (const char *pathname, mode_t mode);
+int safe_rmdir (const char *pathname);
+int safe_unlink (const char *pathname);
+int safe_symlink (const char *target, const char *linkpath);
+int safe_chmod (const char *pathname, mode_t mode);
+int safe_lchown (const char *pathname, uid_t owner, gid_t group);
+int safe_lutimens (const char *pathname, struct timespec const times[2]);
+ssize_t safe_readlink(const char *pathname, char *buf, size_t bufsiz);
+int safe_access(const char *pathname, int mode);
# include "verror.h"
#endif
+#include <safe.h>
+
static void makedirs (char const *);
typedef struct
.quote = copy_attr_quote,
.quote_free = copy_attr_free
};
+ /* FIXME: We are copying between files we know we can safely access by
+ * pathname. A safe_ version of attr_copy_file() might still be slightly
+ * more efficient for deep paths. */
return attr_copy_file (src_path, dst_path, copy_attr_check, &ctx);
}
times[0] = get_stat_atime (st);
times[1] = get_stat_mtime (st);
}
- if (lutimens (to, times) != 0)
+ if (safe_lutimens (to, times) != 0)
pfatal ("Failed to set the timestamps of %s %s",
S_ISLNK (mode) ? "symbolic link" : "file",
quotearg (to));
/* May fail if we are not privileged to set the file owner, or we are
not in group instat.st_gid. Ignore those errors. */
if ((uid != -1 || gid != -1)
- && lchown (to, uid, gid) != 0
+ && safe_lchown (to, uid, gid) != 0
&& (errno != EPERM
|| (uid != -1
- && lchown (to, (uid = -1), gid) != 0
+ && safe_lchown (to, (uid = -1), gid) != 0
&& errno != EPERM)))
pfatal ("Failed to set the %s of %s %s",
(uid == -1) ? "owner" : "owning group",
systems where we could. */
if (lchmod (to, mode))
#else
- if (! S_ISLNK (mode) && chmod (to, mode) != 0)
+ if (! S_ISLNK (mode) && safe_chmod (to, mode) != 0)
#endif
pfatal ("Failed to set the permissions of %s %s",
S_ISLNK (mode) ? "symbolic link" : "file",
say ("Creating empty file %s\n", quotearg (bakname));
try_makedirs_errno = ENOENT;
- unlink (bakname);
- while ((fd = creat (bakname, 0666)) < 0)
+ safe_unlink (bakname);
+ while ((fd = safe_open (bakname, O_CREAT | O_WRONLY | O_TRUNC, 0666)) < 0)
{
if (errno != try_makedirs_errno)
pfatal ("Can't create file %s", quotearg (bakname));
if (debug & 4)
say ("Renaming file %s to %s\n",
quotearg_n (0, to), quotearg_n (1, bakname));
- while (rename (to, bakname) != 0)
+ while (safe_rename (to, bakname) != 0)
{
if (errno == try_makedirs_errno)
{
{
create_backup_copy (to, bakname, to_st,
try_makedirs_errno == 0);
- unlink (to);
+ safe_unlink (to);
break;
}
else
}
}
-/* Only allow symlink targets which are relative and free of ".." components:
- * otherwise, the operating system may follow one of those symlinks in a
- * pathname component, leading to a path traversal vulnerability.
- *
- * An alternative to disallowing many kinds of symlinks would be to implement
- * path traversal in user space using openat() without following symlinks
- * altogether.
- */
-static bool
-symlink_target_is_valid (char const *target, char const *to)
-{
- bool is_valid = filename_is_safe (target);
-
- /* Allow any symlink target if we are in the filesystem root. */
- return is_valid || cwd_is_root (to);
-}
-
/* Move a file FROM (where *FROM_NEEDS_REMOVAL is nonzero if FROM
needs removal when cleaning up at the end of execution, and where
*FROMST is FROM's status if known),
char *buffer = xmalloc (PATH_MAX);
int fd, size = 0, i;
- if ((fd = open (from, O_RDONLY | O_BINARY)) < 0)
+ if ((fd = safe_open (from, O_RDONLY | O_BINARY, 0)) < 0)
pfatal ("Can't reopen file %s", quotearg (from));
while ((i = read (fd, buffer + size, PATH_MAX - size)) > 0)
size += i;
read_fatal ();
buffer[size] = 0;
- /* If we are allowed to create a file with an absolute path name,
- anywhere, we also don't need to worry about symlinks that can
- leave the working directory. */
- if (! (IS_ABSOLUTE_FILE_NAME (to)
- || symlink_target_is_valid (buffer, to)))
- {
- fprintf (stderr, "symbolic link target '%s' is invalid\n",
- buffer);
- fatal_exit (0);
- }
-
if (! backup)
{
- if (unlink (to) == 0)
+ if (safe_unlink (to) == 0)
to_dir_known_to_exist = true;
}
- if (symlink (buffer, to) != 0)
+ if (safe_symlink (buffer, to) != 0)
{
if (errno == ENOENT && ! to_dir_known_to_exist)
makedirs (to);
- if (symlink (buffer, to) != 0)
+ if (safe_symlink (buffer, to) != 0)
pfatal ("Can't create %s %s", "symbolic link", to);
}
free (buffer);
- if (lstat (to, &to_st) != 0)
+ if (safe_lstat (to, &to_st) != 0)
pfatal ("Can't get file attributes of %s %s", "symbolic link", to);
insert_file_id (&to_st, CREATED);
}
say ("Renaming file %s to %s\n",
quotearg_n (0, from), quotearg_n (1, to));
- if (rename (from, to) != 0)
+ if (safe_rename (from, to) != 0)
{
bool to_dir_known_to_exist = false;
{
makedirs (to);
to_dir_known_to_exist = true;
- if (rename (from, to) == 0)
+ if (safe_rename (from, to) == 0)
goto rename_succeeded;
}
struct stat tost;
if (! backup)
{
- if (unlink (to) == 0)
+ if (safe_unlink (to) == 0)
to_dir_known_to_exist = true;
else if (errno != ENOENT)
pfatal ("Can't remove file %s", quotearg (to));
{
if (debug & 4)
say ("Removing file %s\n", quotearg (to));
- if (unlink (to) != 0 && errno != ENOENT)
+ if (safe_unlink (to) != 0 && errno != ENOENT)
pfatal ("Can't remove file %s", quotearg (to));
}
}
do
{
if (! (O_CREAT && O_TRUNC))
- close (creat (file, mode));
- fd = open (file, O_CREAT | O_TRUNC | open_flags, mode);
+ close (safe_open (file, O_CREAT | O_WRONLY | O_TRUNC, mode));
+ fd = safe_open (file, O_CREAT | O_TRUNC | open_flags, mode);
if (fd < 0)
{
char *f;
int fromfd;
ssize_t i;
- if ((fromfd = open (from, O_RDONLY | O_BINARY)) < 0)
+ if ((fromfd = safe_open (from, O_RDONLY | O_BINARY, 0)) < 0)
pfatal ("Can't reopen file %s", quotearg (from));
while ((i = read (fromfd, buf, bufsize)) != 0)
{
{
char *buffer = xmalloc (PATH_MAX);
- if (readlink (from, buffer, PATH_MAX) < 0)
+ if (safe_readlink (from, buffer, PATH_MAX) < 0)
pfatal ("Can't read %s %s", "symbolic link", from);
- if (symlink (buffer, to) != 0)
+ if (safe_symlink (buffer, to) != 0)
pfatal ("Can't create %s %s", "symbolic link", to);
- if (tost && lstat (to, tost) != 0)
+ if (tost && safe_lstat (to, tost) != 0)
pfatal ("Can't get file attributes of %s %s", "symbolic link", to);
free (buffer);
}
{
int tofd;
- if ((tofd = open (to, O_WRONLY | O_BINARY | O_APPEND)) < 0)
+ if ((tofd = safe_open (to, O_WRONLY | O_BINARY | O_APPEND, 0)) < 0)
pfatal ("Can't reopen file %s", quotearg (to));
copy_to_fd (from, tofd);
if (close (tofd) != 0)
sprintf (trybuf, "%s/", dir);
-#define try1(f,a1) (sprintf (trybuf + dirlen, f, a1), stat (trybuf, &cstat) == 0)
-#define try2(f,a1,a2) (sprintf (trybuf + dirlen, f, a1,a2), stat (trybuf, &cstat) == 0)
+#define try1(f,a1) (sprintf (trybuf + dirlen, f, a1), safe_stat (trybuf, &cstat) == 0)
+#define try2(f,a1,a2) (sprintf (trybuf + dirlen, f, a1,a2), safe_stat (trybuf, &cstat) == 0)
/* Check that RCS file is not working file.
Some hosts don't report file name length errors. */
cs, readonly ? "" : " with lock");
if (systemic (getbuf) != 0)
fatal ("Can't get file %s from %s", quotearg (filename), cs);
- if (stat (filename, filestat) != 0)
+ if (safe_stat (filename, filestat) != 0)
pfatal ("%s", quotearg (filename));
}
char *f;
char *flim = replace_slashes (filename);
+ /* FIXME: Now with the pathname lookup cache, there is no reason for
+ deferring the creation of directories. Callers should be updated. */
+
if (flim)
{
/* Create any missing directories, replacing NULs by '/'s.
for (f = filename; f <= flim; f++)
if (!*f)
{
- mkdir (filename,
+ safe_mkdir (filename,
S_IRUSR|S_IWUSR|S_IXUSR
|S_IRGRP|S_IWGRP|S_IXGRP
|S_IROTH|S_IWOTH|S_IXOTH);
|| ISSLASH (filename[i - 3])))))))
{
filename[i] = '\0';
- if (rmdir (filename) == 0 && verbosity == VERBOSE)
+ if (safe_rmdir (filename) == 0 && verbosity == VERBOSE)
say ("Removed empty directory %s\n", quotearg (filename));
filename[i] = '/';
}
{
int fd;
+ /* gen_tempname(..., GT_NOCREATE) calls lstat() to check if a file
+ already exists. In the worst case, this leads to a template that
+ follows a symbolic link and that we cannot use; safe_open() will
+ detect that. */
+
if (gen_tempname (template, 0, flags, GT_NOCREATE))
pfatal ("Can't create temporary file %s", template);
retry:
- fd = open (template, O_CREAT | O_EXCL | flags, mode);
+ fd = safe_open (template, O_CREAT | O_EXCL | flags, mode);
if (fd == -1)
{
if (errno == try_makedirs_errno)
int stat_file (char const *filename, struct stat *st)
{
int (*xstat)(char const *, struct stat *) =
- follow_symlinks ? stat : lstat;
+ follow_symlinks ? safe_stat : safe_lstat;
return xstat (filename, st) == 0 ? 0 : errno;
}
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 <utimens.h>
#include <timespec.h>
#include <stat-time.h>
#include <backupfile.h>
file-modes \
filename-choice \
git-binary-diff \
+ garbage \
global-reject-files \
inname \
line-numbers \
mixed-patch-types \
munged-context-format \
need-filename \
+ no-mode-change-git-diff \
no-newline-triggers-assert \
preserve-c-function-names \
preserve-mode-and-timestamp \
remember-reject-files \
remove-directories \
symlinks \
- unmodified-files
+ unmodified-files \
+ deep-directories
XFAIL_TESTS = \
dash-o-append
$(top_srcdir)/m4/absolute-header.m4 $(top_srcdir)/m4/alloca.m4 \
$(top_srcdir)/m4/backupfile.m4 $(top_srcdir)/m4/bison.m4 \
$(top_srcdir)/m4/canonicalize.m4 \
+ $(top_srcdir)/m4/chdir-long.m4 $(top_srcdir)/m4/chown.m4 \
$(top_srcdir)/m4/clock_time.m4 $(top_srcdir)/m4/close.m4 \
$(top_srcdir)/m4/closedir.m4 $(top_srcdir)/m4/codeset.m4 \
$(top_srcdir)/m4/configmake.m4 $(top_srcdir)/m4/d-ino.m4 \
$(top_srcdir)/m4/eealloc.m4 $(top_srcdir)/m4/environ.m4 \
$(top_srcdir)/m4/errno_h.m4 $(top_srcdir)/m4/error.m4 \
$(top_srcdir)/m4/exponentd.m4 $(top_srcdir)/m4/extensions.m4 \
- $(top_srcdir)/m4/extern-inline.m4 $(top_srcdir)/m4/fcntl-o.m4 \
- $(top_srcdir)/m4/fcntl.m4 $(top_srcdir)/m4/fcntl_h.m4 \
+ $(top_srcdir)/m4/extern-inline.m4 $(top_srcdir)/m4/fchdir.m4 \
+ $(top_srcdir)/m4/fchmodat.m4 $(top_srcdir)/m4/fchownat.m4 \
+ $(top_srcdir)/m4/fcntl-o.m4 $(top_srcdir)/m4/fcntl.m4 \
+ $(top_srcdir)/m4/fcntl_h.m4 $(top_srcdir)/m4/filenamecat.m4 \
$(top_srcdir)/m4/float_h.m4 $(top_srcdir)/m4/fstat.m4 \
+ $(top_srcdir)/m4/fstatat.m4 $(top_srcdir)/m4/getcwd.m4 \
$(top_srcdir)/m4/getdtablesize.m4 $(top_srcdir)/m4/getopt.m4 \
$(top_srcdir)/m4/gettime.m4 $(top_srcdir)/m4/gettimeofday.m4 \
$(top_srcdir)/m4/glibc21.m4 $(top_srcdir)/m4/gnulib-common.m4 \
$(top_srcdir)/m4/gnulib-comp.m4 \
$(top_srcdir)/m4/include_next.m4 $(top_srcdir)/m4/intmax_t.m4 \
$(top_srcdir)/m4/inttypes_h.m4 $(top_srcdir)/m4/largefile.m4 \
- $(top_srcdir)/m4/lchmod.m4 $(top_srcdir)/m4/localcharset.m4 \
+ $(top_srcdir)/m4/lchown.m4 $(top_srcdir)/m4/localcharset.m4 \
$(top_srcdir)/m4/locale-fr.m4 $(top_srcdir)/m4/locale-ja.m4 \
$(top_srcdir)/m4/locale-zh.m4 $(top_srcdir)/m4/longlong.m4 \
$(top_srcdir)/m4/lstat.m4 $(top_srcdir)/m4/malloc.m4 \
$(top_srcdir)/m4/malloca.m4 $(top_srcdir)/m4/manywarnings.m4 \
$(top_srcdir)/m4/mbrtowc.m4 $(top_srcdir)/m4/mbsinit.m4 \
$(top_srcdir)/m4/mbstate_t.m4 $(top_srcdir)/m4/memchr.m4 \
+ $(top_srcdir)/m4/mempcpy.m4 $(top_srcdir)/m4/memrchr.m4 \
$(top_srcdir)/m4/minmax.m4 $(top_srcdir)/m4/mkdir.m4 \
- $(top_srcdir)/m4/mktime.m4 $(top_srcdir)/m4/mmap-anon.m4 \
+ $(top_srcdir)/m4/mkdirat.m4 $(top_srcdir)/m4/mktime.m4 \
+ $(top_srcdir)/m4/mmap-anon.m4 $(top_srcdir)/m4/mode_t.m4 \
$(top_srcdir)/m4/msvc-inval.m4 \
$(top_srcdir)/m4/msvc-nothrow.m4 $(top_srcdir)/m4/multiarch.m4 \
$(top_srcdir)/m4/nocrash.m4 $(top_srcdir)/m4/off_t.m4 \
+ $(top_srcdir)/m4/open.m4 $(top_srcdir)/m4/openat.m4 \
$(top_srcdir)/m4/opendir.m4 $(top_srcdir)/m4/parse-datetime.m4 \
$(top_srcdir)/m4/pathmax.m4 $(top_srcdir)/m4/printf.m4 \
$(top_srcdir)/m4/quote.m4 $(top_srcdir)/m4/quotearg.m4 \
$(top_srcdir)/m4/raise.m4 $(top_srcdir)/m4/readdir.m4 \
- $(top_srcdir)/m4/readlink.m4 $(top_srcdir)/m4/realloc.m4 \
- $(top_srcdir)/m4/rename.m4 $(top_srcdir)/m4/rmdir.m4 \
+ $(top_srcdir)/m4/readlink.m4 $(top_srcdir)/m4/readlinkat.m4 \
+ $(top_srcdir)/m4/realloc.m4 $(top_srcdir)/m4/rename.m4 \
+ $(top_srcdir)/m4/renameat.m4 $(top_srcdir)/m4/rmdir.m4 \
$(top_srcdir)/m4/safe-read.m4 $(top_srcdir)/m4/safe-write.m4 \
- $(top_srcdir)/m4/secure_getenv.m4 $(top_srcdir)/m4/setenv.m4 \
- $(top_srcdir)/m4/setmode.m4 $(top_srcdir)/m4/signal_h.m4 \
- $(top_srcdir)/m4/size_max.m4 $(top_srcdir)/m4/ssize_t.m4 \
- $(top_srcdir)/m4/stat-time.m4 $(top_srcdir)/m4/stat.m4 \
- $(top_srcdir)/m4/stdarg.m4 $(top_srcdir)/m4/stdbool.m4 \
- $(top_srcdir)/m4/stddef_h.m4 $(top_srcdir)/m4/stdint.m4 \
- $(top_srcdir)/m4/stdint_h.m4 $(top_srcdir)/m4/stdio_h.m4 \
- $(top_srcdir)/m4/stdlib_h.m4 $(top_srcdir)/m4/strerror.m4 \
+ $(top_srcdir)/m4/save-cwd.m4 $(top_srcdir)/m4/secure_getenv.m4 \
+ $(top_srcdir)/m4/setenv.m4 $(top_srcdir)/m4/setmode.m4 \
+ $(top_srcdir)/m4/signal_h.m4 $(top_srcdir)/m4/size_max.m4 \
+ $(top_srcdir)/m4/ssize_t.m4 $(top_srcdir)/m4/stat-time.m4 \
+ $(top_srcdir)/m4/stat.m4 $(top_srcdir)/m4/stdarg.m4 \
+ $(top_srcdir)/m4/stdbool.m4 $(top_srcdir)/m4/stddef_h.m4 \
+ $(top_srcdir)/m4/stdint.m4 $(top_srcdir)/m4/stdint_h.m4 \
+ $(top_srcdir)/m4/stdio_h.m4 $(top_srcdir)/m4/stdlib_h.m4 \
+ $(top_srcdir)/m4/strdup.m4 $(top_srcdir)/m4/strerror.m4 \
$(top_srcdir)/m4/string_h.m4 $(top_srcdir)/m4/strndup.m4 \
$(top_srcdir)/m4/strnlen.m4 $(top_srcdir)/m4/symlink.m4 \
- $(top_srcdir)/m4/sys_socket_h.m4 \
+ $(top_srcdir)/m4/symlinkat.m4 $(top_srcdir)/m4/sys_socket_h.m4 \
$(top_srcdir)/m4/sys_stat_h.m4 $(top_srcdir)/m4/sys_time_h.m4 \
$(top_srcdir)/m4/sys_types_h.m4 $(top_srcdir)/m4/tempname.m4 \
$(top_srcdir)/m4/time_h.m4 $(top_srcdir)/m4/time_r.m4 \
$(top_srcdir)/m4/timespec.m4 $(top_srcdir)/m4/tm_gmtoff.m4 \
$(top_srcdir)/m4/unistd-safer.m4 $(top_srcdir)/m4/unistd_h.m4 \
- $(top_srcdir)/m4/unlink.m4 $(top_srcdir)/m4/utimbuf.m4 \
- $(top_srcdir)/m4/utimens.m4 $(top_srcdir)/m4/utimes.m4 \
+ $(top_srcdir)/m4/unlink.m4 $(top_srcdir)/m4/unlinkat.m4 \
+ $(top_srcdir)/m4/utimbuf.m4 $(top_srcdir)/m4/utimens.m4 \
+ $(top_srcdir)/m4/utimensat.m4 $(top_srcdir)/m4/utimes.m4 \
$(top_srcdir)/m4/vasnprintf.m4 $(top_srcdir)/m4/vasprintf.m4 \
$(top_srcdir)/m4/warn-on-use.m4 $(top_srcdir)/m4/warnings.m4 \
$(top_srcdir)/m4/wchar_h.m4 $(top_srcdir)/m4/wchar_t.m4 \
HAVE_LINKAT = @HAVE_LINKAT@
HAVE_LONG_LONG_INT = @HAVE_LONG_LONG_INT@
HAVE_LSTAT = @HAVE_LSTAT@
+HAVE_MAX_ALIGN_T = @HAVE_MAX_ALIGN_T@
HAVE_MBRLEN = @HAVE_MBRLEN@
HAVE_MBRTOWC = @HAVE_MBRTOWC@
HAVE_MBSINIT = @HAVE_MBSINIT@
SYS_TIME_H_DEFINES_STRUCT_TIMESPEC = @SYS_TIME_H_DEFINES_STRUCT_TIMESPEC@
TIME_H_DEFINES_STRUCT_TIMESPEC = @TIME_H_DEFINES_STRUCT_TIMESPEC@
UNDEFINE_STRTOK_R = @UNDEFINE_STRTOK_R@
+UNISTD_H_DEFINES_STRUCT_TIMESPEC = @UNISTD_H_DEFINES_STRUCT_TIMESPEC@
UNISTD_H_HAVE_WINSOCK2_H = @UNISTD_H_HAVE_WINSOCK2_H@
UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS = @UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS@
VERSION = @VERSION@
file-modes \
filename-choice \
git-binary-diff \
+ garbage \
global-reject-files \
inname \
line-numbers \
mixed-patch-types \
munged-context-format \
need-filename \
+ no-mode-change-git-diff \
no-newline-triggers-assert \
preserve-c-function-names \
preserve-mode-and-timestamp \
remember-reject-files \
remove-directories \
symlinks \
- unmodified-files
+ unmodified-files \
+ deep-directories
XFAIL_TESTS = \
dash-o-append
--log-file $$b.log --trs-file $$b.trs \
$(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
"$$tst" $(AM_TESTS_FD_REDIRECT)
+garbage.log: garbage
+ @p='garbage'; \
+ b='garbage'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
global-reject-files.log: global-reject-files
@p='global-reject-files'; \
b='global-reject-files'; \
--log-file $$b.log --trs-file $$b.trs \
$(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
"$$tst" $(AM_TESTS_FD_REDIRECT)
+no-mode-change-git-diff.log: no-mode-change-git-diff
+ @p='no-mode-change-git-diff'; \
+ b='no-mode-change-git-diff'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
no-newline-triggers-assert.log: no-newline-triggers-assert
@p='no-newline-triggers-assert'; \
b='no-newline-triggers-assert'; \
--log-file $$b.log --trs-file $$b.trs \
$(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
"$$tst" $(AM_TESTS_FD_REDIRECT)
+deep-directories.log: deep-directories
+ @p='deep-directories'; \
+ b='deep-directories'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
.test.log:
@p='$<'; \
$(am__set_b); \
. $srcdir/test-lib.sh
-require_cat
+require cat
use_local_patch
use_tmpdir
. $srcdir/test-lib.sh
-require_cat
+require cat
use_local_patch
use_tmpdir
. $srcdir/test-lib.sh
-require_cat
+require cat
use_local_patch
use_tmpdir
. $srcdir/test-lib.sh
-require_cat
+require cat
use_local_patch
use_tmpdir
. $srcdir/test-lib.sh
-require_cat
+require cat
use_local_patch
use_tmpdir
. $srcdir/test-lib.sh
-require_cat
+require cat
use_local_patch
use_tmpdir
. $srcdir/test-lib.sh
-require_cat
-require_sed
+require cat
+require sed
use_local_patch
use_tmpdir
. $srcdir/test-lib.sh
-require_cat
+require cat
use_local_patch
use_tmpdir
. $srcdir/test-lib.sh
-require_gnu_diff
-require_sed
+require gnu_diff
+require sed
use_local_patch
use_tmpdir
. $srcdir/test-lib.sh
-require_cat
+require cat
use_local_patch
use_tmpdir
--- /dev/null
+# Copyright (C) 2015 Free Software Foundation, Inc.
+#
+# Copying and distribution of this file, with or without modification,
+# in any medium, are permitted without royalty provided the copyright
+# notice and this notice are preserved.
+
+. $srcdir/test-lib.sh
+
+require cat
+use_local_patch
+use_tmpdir
+
+# ==============================================================
+# Exercise the directory file descriptor cache
+
+# Artificially limit to 8 cache entries
+ulimit -n 32 >& /dev/null || exit 77
+
+cat > ab.diff <<EOF
+--- /dev/null
++++ b/1/2/3/4/5/6/7/8/9/foo
+@@ -0,0 +1 @@
++foo
+EOF
+
+check 'patch -p1 < ab.diff || echo Status: $?' <<EOF
+patching file 1/2/3/4/5/6/7/8/9/foo
+EOF
. $srcdir/test-lib.sh
-require_cat
+require cat
use_local_patch
use_tmpdir
umask 022
. $srcdir/test-lib.sh
-require_cat
+require cat
use_local_patch
use_tmpdir
. $srcdir/test-lib.sh
-require_cat
-require_sed
+require cat
+require sed
use_local_patch
use_tmpdir
. $srcdir/test-lib.sh
-require_cat
+require cat
use_local_patch
use_tmpdir
--- /dev/null
+# Copyright (C) 2015 Free Software Foundation, Inc.
+#
+# Copying and distribution of this file, with or without modification,
+# in any medium, are permitted without royalty provided the copyright
+# notice and this notice are preserved.
+
+. $srcdir/test-lib.sh
+
+require cat
+use_local_patch
+use_tmpdir
+
+# ==============================================================
+
+cat > bad.diff <<EOF
+ ***************
+*** 0 ****
+--- 1 ----
++ foo
+EOF
+
+check 'patch foo -i bad.diff || echo "Status: $?"' <<EOF
+$PATCH: **** Only garbage was found in the patch input.
+Status: 2
+EOF
. $srcdir/test-lib.sh
-require_cat
+require cat
use_local_patch
use_tmpdir
. $srcdir/test-lib.sh
-require_cat
+require cat
use_local_patch
use_tmpdir
. $srcdir/test-lib.sh
-require_cat
+require cat
use_local_patch
use_tmpdir
. $srcdir/test-lib.sh
-require_cat
-require_sed
+require cat
+require sed
use_local_patch
use_tmpdir
. $srcdir/test-lib.sh
-require_cat
+require cat
use_local_patch
use_tmpdir
. $srcdir/test-lib.sh
-require_cat
-require_gnu_diff
-require_sed
+require cat
+require gnu_diff
+require sed
use_local_patch
use_tmpdir
. $srcdir/test-lib.sh
-require_cat
+require cat
use_local_patch
use_tmpdir
umask 022
. $srcdir/test-lib.sh
-require_cat
-require_sed
+require cat
+require sed
use_local_patch
use_tmpdir
. $srcdir/test-lib.sh
-require_cat
-require_sed
+require cat
+require sed
use_local_patch
use_tmpdir
--- /dev/null
+# Copyright (C) 2010-2012 Free Software Foundation, Inc.
+#
+# Copying and distribution of this file, with or without modification,
+# in any medium, are permitted without royalty provided the copyright
+# notice and this notice are preserved.
+
+. $srcdir/test-lib.sh
+
+require cat
+require chmod
+require stat
+use_local_patch
+use_tmpdir
+
+echo 'ksplice' > f
+chmod 755 f
+
+cat > simple.diff <<EOF
+diff --git a/f b/f
+index 422a422a..736b6c7063690a 100644
+--- a/f
++++ b/f
+@@ -1 +1 @@
+-ksplice
++ksplice rocks!
+EOF
+
+check 'patch -p1 < simple.diff || echo "Status: $?"' <<EOF
+patching file f
+EOF
+
+check 'stat -c "%a" f'<<EOF
+755
+EOF
. $srcdir/test-lib.sh
-require_cat
+require cat
use_local_patch
use_tmpdir
. $srcdir/test-lib.sh
-require_cat
-require_gnu_diff
+require cat
+require gnu_diff
use_local_patch
use_tmpdir
. $srcdir/test-lib.sh
-require_cat
-require_sed
+require cat
+require sed
use_local_patch
use_tmpdir
. $srcdir/test-lib.sh
-require_cat
+require cat
use_local_patch
use_tmpdir
. $srcdir/test-lib.sh
-require_cat
+require cat
use_local_patch
use_tmpdir
. $srcdir/test-lib.sh
-require_cat
-require_sed
-require_gnu_diff
+require cat
+require sed
+require gnu_diff
use_local_patch
use_tmpdir
. $srcdir/test-lib.sh
-require_cat
+require cat
use_local_patch
use_tmpdir
. $srcdir/test-lib.sh
-require_cat
+require cat
use_local_patch
use_tmpdir
. $srcdir/test-lib.sh
-require_cat
+require cat
use_local_patch
use_tmpdir
. $srcdir/test-lib.sh
-require_cat
+require cat
use_local_patch
use_tmpdir
# guarantee that they won't end up higher up in the working tree than we think;
# the path to the symlink may follow symlinks itself.
#
-#cat > symlink-target.diff <<EOF
-#diff --git a/dir/foo b/dir/foo
-#new file mode 120000
-#index 0000000..cad2309
-#--- /dev/null
-#+++ b/dir/foo
-#@@ -0,0 +1 @@
-#+../foo
-#\ No newline at end of file
-#EOF
-#
-#check 'patch -p1 < symlink-target.diff || echo "Status: $?"' <<EOF
-#patching symbolic link dir/foo
-#EOF
+cat > symlink-target.diff <<EOF
+diff --git a/dir/foo b/dir/foo
+new file mode 120000
+index 0000000..cad2309
+--- /dev/null
++++ b/dir/foo
+@@ -0,0 +1 @@
++../foo
+\ No newline at end of file
+EOF
+
+check 'patch -p1 < symlink-target.diff || echo "Status: $?"' <<EOF
+patching symbolic link dir/foo
+EOF
+
+rm -f dir/foo
+cat > follow-symlink.diff <<EOF
+diff --git a/dir/foo b/dir/foo
+new file mode 120000
+index 0000000..cad2309
+--- /dev/null
++++ b/dir/foo
+@@ -0,0 +1 @@
++..
+\ No newline at end of file
+diff --git a/dir/foo/bar b/dir/foo/bar
+new file mode 100644
+index 0000000..2ab772d
+--- /dev/null
++++ b/dir/foo/bar
+@@ -0,0 +1 @@
++created in ..
+EOF
+
+check 'patch -f -p1 < follow-symlink.diff || echo "Status: $?"' <<EOF
+patching symbolic link dir/foo
+Refusing to follow symbolic link dir/foo
+Status: 2
+EOF
cat > bad-symlink-target1.diff <<EOF
diff --git a/bar b/bar
check 'patch -p1 < bad-symlink-target1.diff || echo "Status: $?"' <<EOF
patching symbolic link bar
-symbolic link target '/bar' is invalid
-Status: 2
EOF
cat > bad-symlink-target2.diff <<EOF
check 'patch -p1 < bad-symlink-target2.diff || echo "Status: $?"' <<EOF
patching symbolic link baz
-symbolic link target '../baz' is invalid
-Status: 2
EOF
# --------------------------------------------------------------
b
EOF
rm -f target2
+
+# --------------------------------------------------------------
+# Make sure we do follow symlinks to patch files.
+
+ncheck 'mkdir d'
+cat > d/ab.diff <<EOF
+--- /dev/null
++++ b/foo
+@@ -0,0 +1 @@
++foo
+EOF
+
+ncheck 'ln -sf d l'
+
+check 'patch -p1 -i l/ab.diff' <<EOF
+patching file foo
+EOF
# FIXME: Requires a version of diff that understands "-u".
-require_cat() {
- if ! type cat > /dev/null 2> /dev/null; then
- echo "This test requires the cat utility" >&2
- exit 77
- fi
-}
-
require_gnu_diff() {
case "`diff --version 2> /dev/null`" in
*GNU*)
esac
}
-require_sed() {
- if ! type sed > /dev/null 2> /dev/null; then
- echo "This test requires the sed utility" >&2
+require() {
+ utility="$1"
+ if type require_${utility} > /dev/null 2> /dev/null; then
+ require_${utility}
+ elif ! type "${utility}" > /dev/null 2> /dev/null; then
+ echo "This test requires the ${utility} utility" >&2
exit 77
fi
}
)}
fi
-require_cat
+require cat
clean_env
checks_succeeded=0
. $srcdir/test-lib.sh
-require_cat
+require cat
use_local_patch
use_tmpdir