1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-04-29 19:30:36 +02:00

Update gnulib to 0.1.5414-8204d and add posix_spawn, posix_spawnp.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
This commit is contained in:
Josselin Poiret 2022-09-05 08:48:13 +02:00 committed by Ludovic Courtès
parent fe2a0c54ac
commit edfca3b7e5
531 changed files with 16245 additions and 3306 deletions

View file

@ -5,7 +5,7 @@
# It is necessary if you want to build targets usually of interest
# only to the maintainer.
# Copyright (C) 2001, 2003, 2006-2021 Free Software Foundation, Inc.
# Copyright (C) 2001, 2003, 2006-2022 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

View file

@ -3,7 +3,7 @@
# Generate a release announcement message.
# Copyright (C) 2002-2021 Free Software Foundation, Inc.
# Copyright (C) 2002-2022 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
@ -35,13 +35,13 @@
eval 'exec perl -wSx "$0" "$@"'
if 0;
my $VERSION = '2021-08-04 09:17'; # UTC
my $VERSION = '2022-07-10 01:47'; # UTC
# The definition above must lie within the first 8 lines in order
# for the Emacs time-stamp write hook (at end) to update it.
# If you change this file with Emacs, please let the write hook
# do its job. Otherwise, update this string manually.
my $copyright_year = '2021';
my $copyright_year = '2022';
use strict;
use Getopt::Long;
@ -90,6 +90,10 @@ The following are optional:
VERSION is the result of running git describe
in the gnulib source directory.
required if gnulib is in TOOL_LIST.
--gpg-key-email=EMAIL The email address of the key used to
sign the tarballs
--gpg-keyring-url=URL URL pointing to keyring containing the key used
to sign the tarballs
--no-print-checksums do not emit SHA1 or SHA256 checksums
--archive-suffix=SUF add SUF to the list of archive suffixes
--mail-headers=HEADERS a space-separated list of mail headers, e.g.,
@ -377,6 +381,8 @@ sub get_tool_versions ($$)
my $bootstrap_tools;
my $gnulib_version;
my $print_checksums_p = 1;
my $gpg_key_email;
my $gpg_keyring_url;
# Reformat the warnings before displaying them.
local $SIG{__WARN__} = sub
@ -395,6 +401,8 @@ sub get_tool_versions ($$)
'previous-version=s' => \$prev_version,
'current-version=s' => \$curr_version,
'gpg-key-id=s' => \$gpg_key_id,
'gpg-key-email=s' => \$gpg_key_email,
'gpg-keyring-url=s' => \$gpg_keyring_url,
'url-directory=s' => \@url_dir_list,
'news=s' => \@news_file,
'srcdir=s' => \$srcdir,
@ -437,11 +445,15 @@ sub get_tool_versions ($$)
my @tool_list = split ',', $bootstrap_tools
if $bootstrap_tools;
grep (/^gnulib$/, @tool_list) ^ defined $gnulib_version
grep (/^gnulib$/, @tool_list) && ! defined $gnulib_version
and (warn "when specifying gnulib as a tool, you must also specify\n"
. "--gnulib-version=V, where V is the result of running git describe\n"
. "in the gnulib source directory.\n"), $fail = 1;
! grep (/^gnulib$/, @tool_list) && defined $gnulib_version
and (warn "with --gnulib-version=V you must use --bootstrap-tools=...\n"
. "including gnulib in that list"), $fail = 1;
!$release_type || exists $valid_release_types{$release_type}
or (warn "'$release_type': invalid release type\n"), $fail = 1;
@ -490,7 +502,7 @@ EOF
{
# When there's only one tarball and one URL, use a more concise form.
my $m = "$url_dir_list[0]/$tarballs[0]";
print "Here are the compressed sources and a GPG detached signature[*]:\n"
print "Here are the compressed sources and a GPG detached signature:\n"
. " $m\n"
. " $m.sig\n\n";
}
@ -502,7 +514,7 @@ EOF
. "please tell bug-gnulib\@gnu.org)",
@url_dir_list, %size, $xd);
my @sig_files = map { "$_.sig" } @tarballs;
print_locations ("GPG detached signatures[*]", @url_dir_list, %size,
print_locations ("GPG detached signatures", @url_dir_list, %size,
@sig_files);
}
@ -527,18 +539,55 @@ EOF
and print_checksums (@sizable);
print <<EOF;
[*] Use a .sig file to verify that the corresponding file (without the
Use a .sig file to verify that the corresponding file (without the
.sig suffix) is intact. First, be sure to download both the .sig file
and the corresponding tarball. Then, run a command like this:
gpg --verify $tarballs[0].sig
EOF
my $gpg_fingerprint = `LC_ALL=C gpg --fingerprint $gpg_key_id | grep -v ^sub`;
if ($gpg_fingerprint =~ /^pub/)
{
chop $gpg_fingerprint;
$gpg_fingerprint =~ s/ \[expires:.*//mg;
$gpg_fingerprint =~ s/^uid \[ultimate\]/uid /mg;
$gpg_fingerprint =~ s/^/ /mg;
print<<EOF
The signature should match the fingerprint of the following key:
$gpg_fingerprint
EOF
}
print <<EOF;
If that command fails because you don't have the required public key,
then run this command to import it:
or that public key has expired, try the following commands to retrieve
or refresh it, and then rerun the 'gpg --verify' command.
EOF
if ($gpg_key_email) {
print <<EOF;
gpg --keyserver keys.gnupg.net --recv-keys $gpg_key_id
gpg --locate-external-key $gpg_key_email
EOF
}
print <<EOF;
gpg --recv-keys $gpg_key_id
EOF
if ($gpg_keyring_url) {
print <<EOF;
wget -q -O- '$gpg_keyring_url' | gpg --import -
EOF
}
print <<EOF;
As a last resort to find the key, you can try the official GNU
keyring:
wget -q https://ftp.gnu.org/gnu/gnu-keyring.gpg
gpg --keyring gnu-keyring.gpg --verify $tarballs[0].sig
and rerun the 'gpg --verify' command.
EOF
my @tool_versions = get_tool_versions (\@tool_list, $gnulib_version);

View file

@ -2,13 +2,13 @@
# gendocs.sh -- generate a GNU manual in many formats. This script is
# mentioned in maintain.texi. See the help message below for usage details.
scriptversion=2021-07-19.18
scriptversion=2022-01-01.00
# Copyright 2003-2021 Free Software Foundation, Inc.
# Copyright 2003-2022 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
# 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,
@ -40,15 +40,15 @@ srcdir=`pwd`
scripturl="https://git.savannah.gnu.org/cgit/gnulib.git/plain/build-aux/gendocs.sh"
templateurl="https://git.savannah.gnu.org/cgit/gnulib.git/plain/doc/gendocs_template"
: ${SETLANG="env LANG= LC_MESSAGES= LC_ALL= LANGUAGE="}
: ${MAKEINFO="makeinfo"}
: ${TEXI2DVI="texi2dvi"}
: ${DOCBOOK2HTML="docbook2html"}
: ${DOCBOOK2PDF="docbook2pdf"}
: ${DOCBOOK2TXT="docbook2txt"}
: ${GENDOCS_TEMPLATE_DIR="."}
: ${PERL='perl'}
: ${TEXI2HTML="texi2html"}
: "${SETLANG="env LANG= LC_MESSAGES= LC_ALL= LANGUAGE="}"
: "${MAKEINFO="makeinfo"}"
: "${TEXI2DVI="texi2dvi"}"
: "${DOCBOOK2HTML="docbook2html"}"
: "${DOCBOOK2PDF="docbook2pdf"}"
: "${DOCBOOK2TXT="docbook2txt"}"
: "${GENDOCS_TEMPLATE_DIR="."}"
: "${PERL="perl"}"
: "${TEXI2HTML="texi2html"}"
unset CDPATH
unset use_texi2html
@ -73,7 +73,7 @@ texarg="-t @finalout"
version="gendocs.sh $scriptversion
Copyright 2021 Free Software Foundation, Inc.
Copyright 2022 Free Software Foundation, Inc.
There is NO warranty. You may redistribute this software
under the terms of the GNU General Public License.
For more information about these matters, see the files named COPYING."
@ -304,7 +304,7 @@ fi # end info
#
if $generate_tex; then
cmd="$SETLANG $TEXI2DVI $dirargs $texarg \"$srcfile\""
printf "\nGenerating dvi... ($cmd)\n"
printf "\nGenerating dvi... (%s)\n" "$cmd"
eval "$cmd"
# compress/finish dvi:
gzip -f -9 $PACKAGE.dvi
@ -313,7 +313,7 @@ if $generate_tex; then
ls -l "$outdir/$PACKAGE.dvi.gz"
cmd="$SETLANG $TEXI2DVI --pdf $dirargs $texarg \"$srcfile\""
printf "\nGenerating pdf... ($cmd)\n"
printf "\nGenerating pdf... (%s)\n" "$cmd"
eval "$cmd"
pdf_size=`calcsize $PACKAGE.pdf`
mv $PACKAGE.pdf "$outdir/"
@ -324,7 +324,7 @@ fi # end tex (dvi + pdf)
if $generate_ascii; then
opt="-o $PACKAGE.txt --no-split --no-headers $commonarg"
cmd="$SETLANG $MAKEINFO $opt \"$srcfile\""
printf "\nGenerating ascii... ($cmd)\n"
printf "\nGenerating ascii... (%s)\n" "$cmd"
eval "$cmd"
ascii_size=`calcsize $PACKAGE.txt`
gzip -f -9 -c $PACKAGE.txt >"$outdir/$PACKAGE.txt.gz"
@ -341,7 +341,7 @@ html_split()
{
opt="--split=$1 --node-files $commonarg $htmlarg"
cmd="$SETLANG $TEXI2HTML --output $PACKAGE.html $opt \"$srcfile\""
printf "\nGenerating html by $1... ($cmd)\n"
printf "\nGenerating html by %s... (%s)\n" "$1" "$cmd"
eval "$cmd"
split_html_dir=$PACKAGE.html
(
@ -359,7 +359,7 @@ html_split()
if test -z "$use_texi2html"; then
opt="--no-split --html -o $PACKAGE.html $commonarg $htmlarg"
cmd="$SETLANG $MAKEINFO $opt \"$srcfile\""
printf "\nGenerating monolithic html... ($cmd)\n"
printf "\nGenerating monolithic html... (%s)\n" "$cmd"
rm -rf $PACKAGE.html # in case a directory is left over
eval "$cmd"
html_mono_size=`calcsize $PACKAGE.html`
@ -380,7 +380,7 @@ if test -z "$use_texi2html"; then
#
opt="--html -o $PACKAGE.html $split_arg $commonarg $htmlarg"
cmd="$SETLANG $MAKEINFO $opt \"$srcfile\""
printf "\nGenerating html by $split... ($cmd)\n"
printf "\nGenerating html by %s... (%s)\n" "$split" "$cmd"
eval "$cmd"
split_html_dir=$PACKAGE.html
copy_images $split_html_dir/ $split_html_dir/*.html
@ -398,7 +398,7 @@ if test -z "$use_texi2html"; then
else # use texi2html:
opt="--output $PACKAGE.html $commonarg $htmlarg"
cmd="$SETLANG $TEXI2HTML $opt \"$srcfile\""
printf "\nGenerating monolithic html with texi2html... ($cmd)\n"
printf "\nGenerating monolithic html with texi2html... (%s)\n" "$cmd"
rm -rf $PACKAGE.html # in case a directory is left over
eval "$cmd"
html_mono_size=`calcsize $PACKAGE.html`
@ -428,7 +428,7 @@ texi_tgz_size=`calcsize "$outdir/$PACKAGE.texi.tar.gz"`
if test -n "$docbook"; then
opt="-o - --docbook $commonarg"
cmd="$SETLANG $MAKEINFO $opt \"$srcfile\" >${srcdir}/$PACKAGE-db.xml"
printf "\nGenerating docbook XML... ($cmd)\n"
printf "\nGenerating docbook XML... (%s)\n" "$cmd"
eval "$cmd"
docbook_xml_size=`calcsize $PACKAGE-db.xml`
gzip -f -9 -c $PACKAGE-db.xml >"$outdir/$PACKAGE-db.xml.gz"
@ -438,7 +438,7 @@ if test -n "$docbook"; then
split_html_db_dir=html_node_db
opt="$commonarg -o $split_html_db_dir"
cmd="$DOCBOOK2HTML $opt \"${outdir}/$PACKAGE-db.xml\""
printf "\nGenerating docbook HTML... ($cmd)\n"
printf "\nGenerating docbook HTML... (%s)\n" "$cmd"
eval "$cmd"
(
cd ${split_html_db_dir} || exit 1
@ -451,20 +451,20 @@ if test -n "$docbook"; then
rmdir ${split_html_db_dir}
cmd="$DOCBOOK2TXT \"${outdir}/$PACKAGE-db.xml\""
printf "\nGenerating docbook ASCII... ($cmd)\n"
printf "\nGenerating docbook ASCII... (%s)\n" "$cmd"
eval "$cmd"
docbook_ascii_size=`calcsize $PACKAGE-db.txt`
mv $PACKAGE-db.txt "$outdir/"
cmd="$DOCBOOK2PDF \"${outdir}/$PACKAGE-db.xml\""
printf "\nGenerating docbook PDF... ($cmd)\n"
printf "\nGenerating docbook PDF... (%s)\n" "$cmd"
eval "$cmd"
docbook_pdf_size=`calcsize $PACKAGE-db.pdf`
mv $PACKAGE-db.pdf "$outdir/"
fi
#
printf "\nMaking index.html for $PACKAGE...\n"
printf "\nMaking index.html for %s...\n" "$PACKAGE"
if test -z "$use_texi2html"; then
CONDS="/%%IF *HTML_SECTION%%/,/%%ENDIF *HTML_SECTION%%/d;\
/%%IF *HTML_CHAPTER%%/,/%%ENDIF *HTML_CHAPTER%%/d"

View file

@ -1,12 +1,12 @@
#!/bin/sh
# Print a version string.
scriptversion=2019-10-13.15; # UTC
scriptversion=2022-07-09.08; # UTC
# Copyright (C) 2007-2021 Free Software Foundation, Inc.
# Copyright (C) 2007-2022 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
# 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,
@ -65,9 +65,10 @@ scriptversion=2019-10-13.15; # UTC
# EXTRA_DIST = $(top_srcdir)/.version
# BUILT_SOURCES = $(top_srcdir)/.version
# $(top_srcdir)/.version:
# echo $(VERSION) > $@-t && mv $@-t $@
# echo '$(VERSION)' > $@-t
# mv $@-t $@
# dist-hook:
# echo $(VERSION) > $(distdir)/.tarball-version
# echo '$(VERSION)' > $(distdir)/.tarball-version
me=$0
@ -94,7 +95,7 @@ Options:
--help display this help and exit
--version output version information and exit
Running without arguments will suffice in most cases."
Send patches and bug reports to <bug-gnulib@gnu.org>."
prefix=v
fallback=

View file

@ -3,7 +3,7 @@
# Convert git log output to ChangeLog format.
# Copyright (C) 2008-2021 Free Software Foundation, Inc.
# Copyright (C) 2008-2022 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
@ -35,7 +35,7 @@
eval 'exec perl -wSx "$0" "$@"'
if 0;
my $VERSION = '2021-02-24 23:42'; # UTC
my $VERSION = '2022-01-27 18:49'; # UTC
# The definition above must lie within the first 8 lines in order
# for the Emacs time-stamp write hook (at end) to update it.
# If you change this file with Emacs, please let the write hook

View file

@ -2,9 +2,9 @@
# Run this after each non-alpha release, to update the web documentation at
# https://www.gnu.org/software/$pkg/manual/
VERSION=2021-01-09.09; # UTC
VERSION=2022-01-27.18; # UTC
# Copyright (C) 2009-2021 Free Software Foundation, Inc.
# Copyright (C) 2009-2022 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

View file

@ -1,9 +1,9 @@
#!/bin/sh
# Sign files and upload them.
scriptversion=2021-04-11.09; # UTC
scriptversion=2022-01-27.18; # UTC
# Copyright (C) 2004-2021 Free Software Foundation, Inc.
# Copyright (C) 2004-2022 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

View file

@ -4,7 +4,7 @@
# Detect instances of "if (p) free (p);".
# Likewise "if (p != 0)", "if (0 != p)", or with NULL; and with braces.
# Copyright (C) 2008-2021 Free Software Foundation, Inc.
# Copyright (C) 2008-2022 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
@ -36,13 +36,13 @@
eval 'exec perl -wSx "$0" "$@"'
if 0;
my $VERSION = '2021-04-11 10:11'; # UTC
my $VERSION = '2022-01-27 18:51'; # UTC
# The definition above must lie within the first 8 lines in order
# for the Emacs time-stamp write hook (at end) to update it.
# If you change this file with Emacs, please let the write hook
# do its job. Otherwise, update this string manually.
my $copyright_year = '2021';
my $copyright_year = '2022';
use strict;
use warnings;

View file

@ -4,7 +4,7 @@
# Print a version string.
scriptversion=2018-03-07.03; # UTC
# Copyright (C) 2006-2021 Free Software Foundation, Inc.
# Copyright (C) 2006-2022 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

View file

@ -2,7 +2,7 @@
<!-- Parent-Version: 1.78 -->
<!--
Copyright (C) 2006-2021 Free Software Foundation, Inc.
Copyright (C) 2006-2022 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
@ -87,7 +87,7 @@ the FSF. Broken links and other corrections or suggestions can be sent
to <a href="mailto:%%EMAIL%%">&lt;%%EMAIL%%&gt;</a>.</p>
</div>
<p>Copyright &copy; 2020 Free Software Foundation, Inc.</p>
<p>Copyright &copy; 2022 Free Software Foundation, Inc.</p>
<p>This page is licensed under a <a rel="license"
href="https://creativecommons.org/licenses/by-nd/3.0/us/">Creative

View file

@ -4,7 +4,7 @@
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<!--
Copyright (C) 2007-2021 Free Software Foundation, Inc.
Copyright (C) 2007-2022 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright

View file

@ -4,16 +4,13 @@ See <http://lists.gnu.org/archive/html/bug-gnulib/2011-06/msg00227.html>
for details.
diff --git a/m4/clock_time.m4 b/m4/clock_time.m4
index 0bec0ef..fb3a17a 100644
index 225355331..61373c4b7 100644
--- a/m4/clock_time.m4
+++ b/m4/clock_time.m4
@@ -24,8 +24,15 @@ AC_DEFUN([gl_CLOCK_TIME],
@@ -25,8 +25,17 @@ AC_DEFUN([gl_CLOCK_TIME],
AC_SUBST([LIB_CLOCK_GETTIME])
gl_saved_libs=$LIBS
AC_SEARCH_LIBS([clock_gettime], [rt posix4],
- [test "$ac_cv_search_clock_gettime" = "none required" ||
- LIB_CLOCK_GETTIME=$ac_cv_search_clock_gettime])
- AC_CHECK_FUNCS([clock_gettime clock_settime])
+ [if test "$ac_cv_search_clock_gettime" = "none required"; then
+ AC_SEARCH_LIBS([clock_getcpuclockid], [rt posix4],
+ [test "$ac_cv_search_clock_getcpuclockid" = "none required" \
@ -23,6 +20,9 @@ index 0bec0ef..fb3a17a 100644
+ else
+ LIB_CLOCK_GETTIME=$ac_cv_search_clock_gettime
+ fi])
+ AC_CHECK_FUNCS([clock_gettime clock_settime clock_getcpuclockid])
[test "$ac_cv_search_clock_gettime" = "none required" ||
LIB_CLOCK_GETTIME=$ac_cv_search_clock_gettime])
- AC_CHECK_FUNCS([clock_getres clock_gettime clock_settime])
+ AC_CHECK_FUNCS([clock_getres clock_gettime clock_settime clock_getcpuclockid])
LIBS=$gl_saved_libs
])

File diff suppressed because it is too large Load diff

View file

@ -1,5 +1,5 @@
/* A C macro for declaring that a function does not return.
Copyright (C) 2011-2021 Free Software Foundation, Inc.
Copyright (C) 2011-2022 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published

View file

@ -1,6 +1,6 @@
/* accept.c --- wrappers for Windows accept function
Copyright (C) 2008-2021 Free Software Foundation, Inc.
Copyright (C) 2008-2022 Free Software Foundation, Inc.
This file is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as

View file

@ -1,9 +1,9 @@
/* Accept a connection on a socket, with specific opening flags.
Copyright (C) 2009-2021 Free Software Foundation, Inc.
Copyright (C) 2009-2022 Free Software Foundation, Inc.
This file is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 3 of the
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This file is distributed in the hope that it will be useful,

31
lib/access.c Normal file
View file

@ -0,0 +1,31 @@
/* Test the access rights of a file.
Copyright (C) 2019-2022 Free Software Foundation, Inc.
This file is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
This file 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 Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. */
#include <config.h>
/* Specification. */
#include <unistd.h>
#include <fcntl.h>
#include <io.h>
int
access (const char *file, int mode)
{
if ((mode & X_OK) != 0)
mode = (mode & ~X_OK) | R_OK;
return _access (file, mode);
}

View file

@ -1,5 +1,5 @@
/* Determine alignment of types.
Copyright (C) 2003-2004, 2006, 2009-2021 Free Software Foundation, Inc.
Copyright (C) 2003-2004, 2006, 2009-2022 Free Software Foundation, Inc.
This file is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as

View file

@ -30,17 +30,6 @@
#include <string.h>
#include <stdlib.h>
#ifdef emacs
# include "lisp.h"
# include "blockinput.h"
# ifdef EMACS_FREE
# undef free
# define free EMACS_FREE
# endif
#else
# define memory_full() abort ()
#endif
/* If compiling with GCC or clang, this file is not needed. */
#if !(defined __GNUC__ || defined __clang__)
@ -48,22 +37,6 @@
there must be some other way alloca is supposed to work. */
# ifndef alloca
# ifdef emacs
# ifdef static
/* actually, only want this if static is defined as ""
-- this is for usg, in which emacs must undefine static
in order to make unexec workable
*/
# ifndef STACK_DIRECTION
you
lose
-- must know STACK_DIRECTION at compile-time
/* Using #error here is not wise since this file should work for
old and obscure compilers. */
# endif /* STACK_DIRECTION undefined */
# endif /* static */
# endif /* emacs */
/* Define STACK_DIRECTION if you know the direction of stack
growth for your system; otherwise it will be automatically
deduced at run-time.
@ -145,10 +118,6 @@ alloca (size_t size)
{
register header *hp; /* Traverses linked list. */
# ifdef emacs
BLOCK_INPUT;
# endif
for (hp = last_alloca_header; hp != NULL;)
if ((STACK_DIR > 0 && hp->h.deep > depth)
|| (STACK_DIR < 0 && hp->h.deep < depth))
@ -163,10 +132,6 @@ alloca (size_t size)
break; /* Rest are not deeper. */
last_alloca_header = hp; /* -> last valid storage. */
# ifdef emacs
UNBLOCK_INPUT;
# endif
}
if (size == 0)

View file

@ -1,6 +1,6 @@
/* Memory allocation on the stack.
Copyright (C) 1995, 1999, 2001-2004, 2006-2021 Free Software Foundation,
Copyright (C) 1995, 1999, 2001-2004, 2006-2022 Free Software Foundation,
Inc.
This file is free software: you can redistribute it and/or modify

View file

@ -1,5 +1,5 @@
/* A C macro for declaring that specific arguments must not be NULL.
Copyright (C) 2009-2021 Free Software Foundation, Inc.
Copyright (C) 2009-2022 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published

View file

@ -1,6 +1,6 @@
/* A GNU-like <arpa/inet.h>.
Copyright (C) 2005-2006, 2008-2021 Free Software Foundation, Inc.
Copyright (C) 2005-2006, 2008-2022 Free Software Foundation, Inc.
This file is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as

View file

@ -1,5 +1,5 @@
/* Formatted output to strings.
Copyright (C) 1999, 2002, 2006, 2009-2021 Free Software Foundation, Inc.
Copyright (C) 1999, 2002, 2006, 2009-2022 Free Software Foundation, Inc.
This file is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as

View file

@ -1,6 +1,6 @@
/* Run-time assert-like macros.
Copyright (C) 2014-2021 Free Software Foundation, Inc.
Copyright (C) 2014-2022 Free Software Foundation, Inc.
This file is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as

View file

@ -1,6 +1,6 @@
/* ATTRIBUTE_* macros for using attributes in GCC and similar compilers
Copyright 2020-2021 Free Software Foundation, Inc.
Copyright 2020-2022 Free Software Foundation, Inc.
This file is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
@ -76,6 +76,14 @@
/* Applies to: function, pointer to function, function types. */
#define ATTRIBUTE_ALLOC_SIZE(args) _GL_ATTRIBUTE_ALLOC_SIZE (args)
/* ATTRIBUTE_DEALLOC (F, I) declares that the function returns pointers
that can be freed by passing them as the Ith argument to the
function F.
ATTRIBUTE_DEALLOC_FREE declares that the function returns pointers that
can be freed via 'free'; it can be used only after declaring 'free'. */
/* Applies to: functions. Cannot be used on inline functions. */
#define ATTRIBUTE_DEALLOC(f, i) _GL_ATTRIBUTE_DEALLOC(f, i)
#define ATTRIBUTE_DEALLOC_FREE _GL_ATTRIBUTE_DEALLOC_FREE
/* Attributes for variadic functions. */

View file

@ -1,6 +1,6 @@
/* basename.c -- return the last element in a file name
Copyright (C) 1990, 1998-2001, 2003-2006, 2009-2021 Free Software
Copyright (C) 1990, 1998-2001, 2003-2006, 2009-2022 Free Software
Foundation, Inc.
This file is free software: you can redistribute it and/or modify

View file

@ -1,6 +1,6 @@
/* Extract the last component (base name) of a file name.
Copyright (C) 1998, 2001, 2003-2006, 2009-2021 Free Software Foundation,
Copyright (C) 1998, 2001, 2003-2006, 2009-2022 Free Software Foundation,
Inc.
This file is free software: you can redistribute it and/or modify

View file

@ -1,5 +1,5 @@
/* Binary mode I/O.
Copyright 2017-2021 Free Software Foundation, Inc.
Copyright 2017-2022 Free Software Foundation, Inc.
This file is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as

View file

@ -1,5 +1,5 @@
/* Binary mode I/O.
Copyright (C) 2001, 2003, 2005, 2008-2021 Free Software Foundation, Inc.
Copyright (C) 2001, 2003, 2005, 2008-2022 Free Software Foundation, Inc.
This file is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
@ -47,7 +47,7 @@ _GL_INLINE_HEADER_BEGIN
/* Use a function rather than a macro, to avoid gcc warnings
"warning: statement with no effect". */
BINARY_IO_INLINE int
__gl_setmode (int fd _GL_UNUSED, int mode _GL_UNUSED)
__gl_setmode (_GL_UNUSED int fd, _GL_UNUSED int mode)
{
return O_BINARY;
}

View file

@ -1,6 +1,6 @@
/* bind.c --- wrappers for Windows bind function
Copyright (C) 2008-2021 Free Software Foundation, Inc.
Copyright (C) 2008-2022 Free Software Foundation, Inc.
This file is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as

View file

@ -1,5 +1,5 @@
/* Convert unibyte character to wide character.
Copyright (C) 2008, 2010-2021 Free Software Foundation, Inc.
Copyright (C) 2008, 2010-2022 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2008.
This file is free software: you can redistribute it and/or modify

View file

@ -1,5 +1,5 @@
/* byteswap.h - Byte swapping
Copyright (C) 2005, 2007, 2009-2021 Free Software Foundation, Inc.
Copyright (C) 2005, 2007, 2009-2022 Free Software Foundation, Inc.
Written by Oskar Liljeblad <oskar@osk.mine.nu>, 2005.
This file is free software: you can redistribute it and/or modify

View file

@ -1,5 +1,5 @@
/* C++ compatible function declaration macros.
Copyright (C) 2010-2021 Free Software Foundation, Inc.
Copyright (C) 2010-2022 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published

View file

@ -1,6 +1,6 @@
/* Character handling in C locale.
Copyright (C) 2003-2021 Free Software Foundation, Inc.
Copyright (C) 2003-2022 Free Software Foundation, Inc.
This file is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as

View file

@ -5,7 +5,7 @@
<ctype.h> functions' behaviour depends on the current locale set via
setlocale.
Copyright (C) 2000-2003, 2006, 2008-2021 Free Software Foundation, Inc.
Copyright (C) 2000-2003, 2006, 2008-2022 Free Software Foundation, Inc.
This file is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as

View file

@ -1,5 +1,5 @@
/* Case-insensitive string comparison functions in C locale.
Copyright (C) 1995-1996, 2001, 2003, 2005, 2009-2021 Free Software
Copyright (C) 1995-1996, 2001, 2003, 2005, 2009-2022 Free Software
Foundation, Inc.
This file is free software: you can redistribute it and/or modify

View file

@ -1,5 +1,5 @@
/* c-strcasecmp.c -- case insensitive string comparator in C locale
Copyright (C) 1998-1999, 2005-2006, 2009-2021 Free Software Foundation, Inc.
Copyright (C) 1998-1999, 2005-2006, 2009-2022 Free Software Foundation, Inc.
This file is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as

View file

@ -1,5 +1,5 @@
/* Optimized case-insensitive string comparison in C locale.
Copyright (C) 2001-2002, 2007, 2009-2021 Free Software Foundation, Inc.
Copyright (C) 2001-2002, 2007, 2009-2022 Free Software Foundation, Inc.
This file is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as

View file

@ -1,5 +1,5 @@
/* c-strncasecmp.c -- case insensitive string comparator in C locale
Copyright (C) 1998-1999, 2005-2006, 2009-2021 Free Software Foundation, Inc.
Copyright (C) 1998-1999, 2005-2006, 2009-2022 Free Software Foundation, Inc.
This file is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as

View file

@ -1,5 +1,5 @@
/* Return the canonical absolute name of a given file.
Copyright (C) 1996-2021 Free Software Foundation, Inc.
Copyright (C) 1996-2022 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or

View file

@ -1,4 +1,5 @@
/* Copyright (C) 1992-2021 Free Software Foundation, Inc.
/* Copyright (C) 1992-2022 Free Software Foundation, Inc.
Copyright The GNU Toolchain Authors.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@ -40,7 +41,9 @@
Similarly for __has_builtin, etc. */
#if (defined __has_attribute \
&& (!defined __clang_minor__ \
|| 3 < __clang_major__ + (5 <= __clang_minor__)))
|| (defined __apple_build_version__ \
? 6000000 <= __apple_build_version__ \
: 3 < __clang_major__ + (5 <= __clang_minor__))))
# define __glibc_has_attribute(attr) __has_attribute (attr)
#else
# define __glibc_has_attribute(attr) 0
@ -142,7 +145,8 @@
#define __bos0(ptr) __builtin_object_size (ptr, 0)
/* Use __builtin_dynamic_object_size at _FORTIFY_SOURCE=3 when available. */
#if __USE_FORTIFY_LEVEL == 3 && __glibc_clang_prereq (9, 0)
#if __USE_FORTIFY_LEVEL == 3 && (__glibc_clang_prereq (9, 0) \
|| __GNUC_PREREQ (12, 0))
# define __glibc_objsize0(__o) __builtin_dynamic_object_size (__o, 0)
# define __glibc_objsize(__o) __builtin_dynamic_object_size (__o, 1)
#else
@ -150,6 +154,53 @@
# define __glibc_objsize(__o) __bos (__o)
#endif
/* Compile time conditions to choose between the regular, _chk and _chk_warn
variants. These conditions should get evaluated to constant and optimized
away. */
#define __glibc_safe_len_cond(__l, __s, __osz) ((__l) <= (__osz) / (__s))
#define __glibc_unsigned_or_positive(__l) \
((__typeof (__l)) 0 < (__typeof (__l)) -1 \
|| (__builtin_constant_p (__l) && (__l) > 0))
/* Length is known to be safe at compile time if the __L * __S <= __OBJSZ
condition can be folded to a constant and if it is true, or unknown (-1) */
#define __glibc_safe_or_unknown_len(__l, __s, __osz) \
((__osz) == (__SIZE_TYPE__) -1 \
|| (__glibc_unsigned_or_positive (__l) \
&& __builtin_constant_p (__glibc_safe_len_cond ((__SIZE_TYPE__) (__l), \
(__s), (__osz))) \
&& __glibc_safe_len_cond ((__SIZE_TYPE__) (__l), (__s), (__osz))))
/* Conversely, we know at compile time that the length is unsafe if the
__L * __S <= __OBJSZ condition can be folded to a constant and if it is
false. */
#define __glibc_unsafe_len(__l, __s, __osz) \
(__glibc_unsigned_or_positive (__l) \
&& __builtin_constant_p (__glibc_safe_len_cond ((__SIZE_TYPE__) (__l), \
__s, __osz)) \
&& !__glibc_safe_len_cond ((__SIZE_TYPE__) (__l), __s, __osz))
/* Fortify function f. __f_alias, __f_chk and __f_chk_warn must be
declared. */
#define __glibc_fortify(f, __l, __s, __osz, ...) \
(__glibc_safe_or_unknown_len (__l, __s, __osz) \
? __ ## f ## _alias (__VA_ARGS__) \
: (__glibc_unsafe_len (__l, __s, __osz) \
? __ ## f ## _chk_warn (__VA_ARGS__, __osz) \
: __ ## f ## _chk (__VA_ARGS__, __osz))) \
/* Fortify function f, where object size argument passed to f is the number of
elements and not total size. */
#define __glibc_fortify_n(f, __l, __s, __osz, ...) \
(__glibc_safe_or_unknown_len (__l, __s, __osz) \
? __ ## f ## _alias (__VA_ARGS__) \
: (__glibc_unsafe_len (__l, __s, __osz) \
? __ ## f ## _chk_warn (__VA_ARGS__, (__osz) / (__s)) \
: __ ## f ## _chk (__VA_ARGS__, (__osz) / (__s)))) \
#if __GNUC_PREREQ (4,3)
# define __warnattr(msg) __attribute__((__warning__ (msg)))
# define __errordecl(name, msg) \
@ -243,6 +294,15 @@
# define __attribute_alloc_size__(params) /* Ignore. */
#endif
/* Tell the compiler which argument to an allocation function
indicates the alignment of the allocation. */
#if __GNUC_PREREQ (4, 9) || __glibc_has_attribute (__alloc_align__)
# define __attribute_alloc_align__(param) \
__attribute__ ((__alloc_align__ param))
#else
# define __attribute_alloc_align__(param) /* Ignore. */
#endif
/* At some point during the gcc 2.96 development the `pure' attribute
for functions was introduced. We don't want to use it unconditionally
(although this would be possible) since it generates warnings. */
@ -605,12 +665,22 @@ _Static_assert (0, "IEEE 128-bits long double requires redirection on this platf
size-index is not provided:
access (access-mode, <ref-index> [, <size-index>]) */
# define __attr_access(x) __attribute__ ((__access__ x))
/* For _FORTIFY_SOURCE == 3 we use __builtin_dynamic_object_size, which may
use the access attribute to get object sizes from function definition
arguments, so we can't use them on functions we fortify. Drop the object
size hints for such functions. */
# if __USE_FORTIFY_LEVEL == 3
# define __fortified_attr_access(a, o, s) __attribute__ ((__access__ (a, o)))
# else
# define __fortified_attr_access(a, o, s) __attr_access ((a, o, s))
# endif
# if __GNUC_PREREQ (11, 0)
# define __attr_access_none(argno) __attribute__ ((__access__ (__none__, argno)))
# else
# define __attr_access_none(argno)
# endif
#else
# define __fortified_attr_access(a, o, s)
# define __attr_access(x)
# define __attr_access_none(argno)
#endif

View file

@ -1,9 +1,9 @@
/* Round towards positive infinity.
Copyright (C) 2007, 2010-2021 Free Software Foundation, Inc.
Copyright (C) 2007, 2010-2022 Free Software Foundation, Inc.
This file is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 3 of the
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This file is distributed in the hope that it will be useful,

View file

@ -1,6 +1,6 @@
/* cloexec.c - set or clear the close-on-exec descriptor flag
Copyright (C) 1991, 2004-2006, 2009-2021 Free Software Foundation, Inc.
Copyright (C) 1991, 2004-2006, 2009-2022 Free Software Foundation, Inc.
This file is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as

View file

@ -1,6 +1,6 @@
/* cloexec.c - set or clear the close-on-exec descriptor flag
Copyright (C) 2004, 2009-2021 Free Software Foundation, Inc.
Copyright (C) 2004, 2009-2022 Free Software Foundation, Inc.
This file is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as

View file

@ -1,5 +1,5 @@
/* close replacement.
Copyright (C) 2008-2021 Free Software Foundation, Inc.
Copyright (C) 2008-2022 Free Software Foundation, Inc.
This file is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as

73
lib/concat-filename.c Normal file
View file

@ -0,0 +1,73 @@
/* Construct a full filename from a directory and a relative filename.
Copyright (C) 2001-2004, 2006-2022 Free Software Foundation, Inc.
This file is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
This file 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 Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. */
/* Written by Bruno Haible <haible@clisp.cons.org>. */
#include <config.h>
/* Specification. */
#include "concat-filename.h"
#include <errno.h>
#include <stdlib.h>
#include <string.h>
#include "filename.h"
/* Concatenate a directory filename, a relative filename and an optional
suffix. The directory may end with the directory separator. The second
argument may not start with the directory separator (it is relative).
Return a freshly allocated filename. Return NULL and set errno
upon memory allocation failure. */
char *
concatenated_filename (const char *directory, const char *filename,
const char *suffix)
{
char *result;
char *p;
if (strcmp (directory, ".") == 0)
{
/* No need to prepend the directory. */
result = (char *) malloc (strlen (filename)
+ (suffix != NULL ? strlen (suffix) : 0)
+ 1);
if (result == NULL)
return NULL; /* errno is set here */
p = result;
}
else
{
size_t directory_len = strlen (directory);
int need_slash =
(directory_len > FILE_SYSTEM_PREFIX_LEN (directory)
&& !ISSLASH (directory[directory_len - 1]));
result = (char *) malloc (directory_len + need_slash
+ strlen (filename)
+ (suffix != NULL ? strlen (suffix) : 0)
+ 1);
if (result == NULL)
return NULL; /* errno is set here */
memcpy (result, directory, directory_len);
p = result + directory_len;
if (need_slash)
*p++ = '/';
}
p = stpcpy (p, filename);
if (suffix != NULL)
stpcpy (p, suffix);
return result;
}

46
lib/concat-filename.h Normal file
View file

@ -0,0 +1,46 @@
/* Construct a full filename from a directory and a relative filename.
Copyright (C) 2001-2004, 2007-2022 Free Software Foundation, Inc.
This file is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
This file 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 Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. */
#ifndef _CONCAT_FILENAME_H
#define _CONCAT_FILENAME_H
#include <stdlib.h>
#ifdef __cplusplus
extern "C" {
#endif
/* Concatenate a directory filename, a relative filename and an optional
suffix. Return a freshly allocated filename. Return NULL and set errno
upon memory allocation failure. */
extern char *concatenated_filename (const char *directory,
const char *filename, const char *suffix)
_GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE;
/* Concatenate a directory filename, a relative filename and an optional
suffix. Return a freshly allocated filename. */
extern char *xconcatenated_filename (const char *directory,
const char *filename, const char *suffix)
_GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE
_GL_ATTRIBUTE_RETURNS_NONNULL;
#ifdef __cplusplus
}
#endif
#endif /* _CONCAT_FILENAME_H */

View file

@ -1,6 +1,6 @@
/* connect.c --- wrappers for Windows connect function
Copyright (C) 2008-2021 Free Software Foundation, Inc.
Copyright (C) 2008-2022 Free Software Foundation, Inc.
This file is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as

View file

@ -1,9 +1,9 @@
/* Copy sign into another 'double' number.
Copyright (C) 2011-2021 Free Software Foundation, Inc.
Copyright (C) 2011-2022 Free Software Foundation, Inc.
This file is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 3 of the
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This file is distributed in the hope that it will be useful,

View file

@ -1,5 +1,5 @@
/* A GNU-like <dirent.h>.
Copyright (C) 2006-2021 Free Software Foundation, Inc.
Copyright (C) 2006-2022 Free Software Foundation, Inc.
This file is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
@ -55,6 +55,28 @@ typedef struct gl_directory DIR;
# endif
#endif
/* _GL_ATTRIBUTE_DEALLOC (F, I) declares that the function returns pointers
that can be freed by passing them as the Ith argument to the
function F. */
#ifndef _GL_ATTRIBUTE_DEALLOC
# if __GNUC__ >= 11
# define _GL_ATTRIBUTE_DEALLOC(f, i) __attribute__ ((__malloc__ (f, i)))
# else
# define _GL_ATTRIBUTE_DEALLOC(f, i)
# endif
#endif
/* _GL_ATTRIBUTE_MALLOC declares that the function returns a pointer to freshly
allocated memory. */
/* Applies to: functions. */
#ifndef _GL_ATTRIBUTE_MALLOC
# if __GNUC__ >= 3 || defined __clang__
# define _GL_ATTRIBUTE_MALLOC __attribute__ ((__malloc__))
# else
# define _GL_ATTRIBUTE_MALLOC
# endif
#endif
/* The __attribute__ feature is available in gcc versions 2.5 and later.
The attribute __pure__ was added in gcc 2.96. */
#ifndef _GL_ATTRIBUTE_PURE

View file

@ -1,6 +1,6 @@
/* dirfd.c -- return the file descriptor associated with an open DIR*
Copyright (C) 2001, 2006, 2008-2021 Free Software Foundation, Inc.
Copyright (C) 2001, 2006, 2008-2022 Free Software Foundation, Inc.
This file is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as

View file

@ -1,6 +1,6 @@
/* dirname.c -- return all but the last element in a file name
Copyright (C) 1990, 1998, 2000-2001, 2003-2006, 2009-2021 Free Software
Copyright (C) 1990, 1998, 2000-2001, 2003-2006, 2009-2022 Free Software
Foundation, Inc.
This file is free software: you can redistribute it and/or modify

View file

@ -1,6 +1,6 @@
/* Take file names apart into directory and base names.
Copyright (C) 1998, 2001, 2003-2006, 2009-2021 Free Software Foundation,
Copyright (C) 1998, 2001, 2003-2006, 2009-2022 Free Software Foundation,
Inc.
This file is free software: you can redistribute it and/or modify

View file

@ -1,6 +1,6 @@
/* Duplicate an open file descriptor to a specified file descriptor.
Copyright (C) 1999, 2004-2007, 2009-2021 Free Software Foundation, Inc.
Copyright (C) 1999, 2004-2007, 2009-2022 Free Software Foundation, Inc.
This file is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as

View file

@ -1,9 +1,9 @@
/* Duplicate a locale object.
Copyright (C) 2009-2021 Free Software Foundation, Inc.
Copyright (C) 2009-2022 Free Software Foundation, Inc.
This file is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 3 of the
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This file is distributed in the hope that it will be useful,

View file

@ -1,5 +1,5 @@
/* Type-safe arrays which grow dynamically.
Copyright 2021 Free Software Foundation, Inc.
Copyright 2021-2022 Free Software Foundation, Inc.
This file is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as

View file

@ -1,5 +1,5 @@
/* Threshold at which to diagnose ELOOP. Generic version.
Copyright (C) 2012-2021 Free Software Foundation, Inc.
Copyright (C) 2012-2022 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or

View file

@ -1,6 +1,6 @@
/* A POSIX-like <errno.h>.
Copyright (C) 2008-2021 Free Software Foundation, Inc.
Copyright (C) 2008-2022 Free Software Foundation, Inc.
This file is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as

View file

@ -1,6 +1,6 @@
/* Provide file descriptor control.
Copyright (C) 2009-2021 Free Software Foundation, Inc.
Copyright (C) 2009-2022 Free Software Foundation, Inc.
This file is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as

View file

@ -1,6 +1,6 @@
/* Like <fcntl.h>, but with non-working flags defined to 0.
Copyright (C) 2006-2021 Free Software Foundation, Inc.
Copyright (C) 2006-2022 Free Software Foundation, Inc.
This file is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
@ -435,6 +435,10 @@ _GL_WARN_ON_USE (openat, "openat is not portable - "
# define AT_EACCESS 4
#endif
/* Ignore this flag if not supported. */
#ifndef AT_NO_AUTOMOUNT
# define AT_NO_AUTOMOUNT 0
#endif
#endif /* _@GUARD_PREFIX@_FCNTL_H */
#endif /* _@GUARD_PREFIX@_FCNTL_H */

View file

@ -1,5 +1,5 @@
/* Hook for making file descriptor functions close(), ioctl() extensible.
Copyright (C) 2009-2021 Free Software Foundation, Inc.
Copyright (C) 2009-2022 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2009.
This file is free software: you can redistribute it and/or modify

View file

@ -1,5 +1,5 @@
/* Hook for making file descriptor functions close(), ioctl() extensible.
Copyright (C) 2009-2021 Free Software Foundation, Inc.
Copyright (C) 2009-2022 Free Software Foundation, Inc.
This file is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as

View file

@ -1,5 +1,5 @@
/* Basic filename support macros.
Copyright (C) 2001-2004, 2007-2021 Free Software Foundation, Inc.
Copyright (C) 2001-2022 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or

399
lib/findprog-in.c Normal file
View file

@ -0,0 +1,399 @@
/* Locating a program in a given path.
Copyright (C) 2001-2004, 2006-2022 Free Software Foundation, Inc.
Written by Bruno Haible <haible@clisp.cons.org>, 2001, 2019.
This file is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
This file 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 Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. */
#include <config.h>
/* Specification. */
#include "findprog.h"
#include <errno.h>
#include <stdbool.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/stat.h>
#include "filename.h"
#include "concat-filename.h"
#if (defined _WIN32 && !defined __CYGWIN__) || defined __EMX__ || defined __DJGPP__
/* Native Windows, OS/2, DOS */
# define NATIVE_SLASH '\\'
#else
/* Unix */
# define NATIVE_SLASH '/'
#endif
/* Separator in PATH like lists of pathnames. */
#if (defined _WIN32 && !defined __CYGWIN__) || defined __EMX__ || defined __DJGPP__
/* Native Windows, OS/2, DOS */
# define PATH_SEPARATOR ';'
#else
/* Unix */
# define PATH_SEPARATOR ':'
#endif
/* The list of suffixes that the execlp/execvp function tries when searching
for the program. */
static const char * const suffixes[] =
{
#if defined _WIN32 && !defined __CYGWIN__ /* Native Windows */
"", ".com", ".exe", ".bat", ".cmd"
/* Note: Files without any suffix are not considered executable. */
/* Note: The cmd.exe program does a different lookup: It searches according
to the PATHEXT environment variable.
See <https://stackoverflow.com/questions/7839150/>.
Also, it executes files ending in .bat and .cmd directly without letting
the kernel interpret the program file. */
#elif defined __CYGWIN__
"", ".exe", ".com"
#elif defined __EMX__
"", ".exe"
#elif defined __DJGPP__
"", ".com", ".exe", ".bat"
#else /* Unix */
""
#endif
};
const char *
find_in_given_path (const char *progname, const char *path,
const char *directory, bool optimize_for_exec)
{
{
bool has_slash = false;
{
const char *p;
for (p = progname; *p != '\0'; p++)
if (ISSLASH (*p))
{
has_slash = true;
break;
}
}
if (has_slash)
{
/* If progname contains a slash, it is either absolute or relative to
the current directory. PATH is not used. */
if (optimize_for_exec)
/* The execl/execv/execlp/execvp functions will try the various
suffixes anyway and fail if no executable is found. */
return progname;
else
{
/* Try the various suffixes and see whether one of the files
with such a suffix is actually executable. */
int failure_errno;
size_t i;
const char *directory_as_prefix =
(directory != NULL && IS_RELATIVE_FILE_NAME (progname)
? directory
: "");
#if defined _WIN32 && !defined __CYGWIN__ /* Native Windows */
const char *progbasename;
{
const char *p;
progbasename = progname;
for (p = progname; *p != '\0'; p++)
if (ISSLASH (*p))
progbasename = p + 1;
}
bool progbasename_has_dot = (strchr (progbasename, '.') != NULL);
#endif
/* Try all platform-dependent suffixes. */
failure_errno = ENOENT;
for (i = 0; i < sizeof (suffixes) / sizeof (suffixes[0]); i++)
{
const char *suffix = suffixes[i];
#if defined _WIN32 && !defined __CYGWIN__ /* Native Windows */
/* File names without a '.' are not considered executable, and
for file names with a '.' no additional suffix is tried. */
if ((*suffix != '\0') != progbasename_has_dot)
#endif
{
/* Concatenate directory_as_prefix, progname, suffix. */
char *progpathname =
concatenated_filename (directory_as_prefix, progname,
suffix);
if (progpathname == NULL)
return NULL; /* errno is set here */
/* On systems which have the eaccess() system call, let's
use it. On other systems, let's hope that this program
is not installed setuid or setgid, so that it is ok to
call access() despite its design flaw. */
if (eaccess (progpathname, X_OK) == 0)
{
/* Check that the progpathname does not point to a
directory. */
struct stat statbuf;
if (stat (progpathname, &statbuf) >= 0)
{
if (! S_ISDIR (statbuf.st_mode))
{
/* Found! */
if (strcmp (progpathname, progname) == 0)
{
free (progpathname);
return progname;
}
else
return progpathname;
}
errno = EACCES;
}
}
if (errno != ENOENT)
failure_errno = errno;
free (progpathname);
}
}
#if defined _WIN32 && !defined __CYGWIN__ /* Native Windows */
if (failure_errno == ENOENT && !progbasename_has_dot)
{
/* In the loop above, we skipped suffix = "". Do this loop
round now, merely to provide a better errno than ENOENT. */
char *progpathname =
concatenated_filename (directory_as_prefix, progname, "");
if (progpathname == NULL)
return NULL; /* errno is set here */
if (eaccess (progpathname, X_OK) == 0)
{
struct stat statbuf;
if (stat (progpathname, &statbuf) >= 0)
{
if (! S_ISDIR (statbuf.st_mode))
errno = ENOEXEC;
else
errno = EACCES;
}
}
failure_errno = errno;
free (progpathname);
}
#endif
errno = failure_errno;
return NULL;
}
}
}
if (path == NULL)
/* If PATH is not set, the default search path is implementation dependent.
In practice, it is treated like an empty PATH. */
path = "";
{
/* Make a copy, to prepare for destructive modifications. */
char *path_copy = strdup (path);
if (path_copy == NULL)
return NULL; /* errno is set here */
int failure_errno;
char *path_rest;
char *cp;
#if defined _WIN32 && !defined __CYGWIN__ /* Native Windows */
bool progname_has_dot = (strchr (progname, '.') != NULL);
#endif
failure_errno = ENOENT;
for (path_rest = path_copy; ; path_rest = cp + 1)
{
const char *dir;
bool last;
char *dir_as_prefix_to_free;
const char *dir_as_prefix;
size_t i;
/* Extract next directory in PATH. */
dir = path_rest;
for (cp = path_rest; *cp != '\0' && *cp != PATH_SEPARATOR; cp++)
;
last = (*cp == '\0');
*cp = '\0';
/* Empty PATH components designate the current directory. */
if (dir == cp)
dir = ".";
/* Concatenate directory and dir. */
if (directory != NULL && IS_RELATIVE_FILE_NAME (dir))
{
dir_as_prefix_to_free =
concatenated_filename (directory, dir, NULL);
if (dir_as_prefix_to_free == NULL)
{
/* errno is set here. */
failure_errno = errno;
goto failed;
}
dir_as_prefix = dir_as_prefix_to_free;
}
else
{
dir_as_prefix_to_free = NULL;
dir_as_prefix = dir;
}
/* Try all platform-dependent suffixes. */
for (i = 0; i < sizeof (suffixes) / sizeof (suffixes[0]); i++)
{
const char *suffix = suffixes[i];
#if defined _WIN32 && !defined __CYGWIN__ /* Native Windows */
/* File names without a '.' are not considered executable, and
for file names with a '.' no additional suffix is tried. */
if ((*suffix != '\0') != progname_has_dot)
#endif
{
/* Concatenate dir_as_prefix, progname, and suffix. */
char *progpathname =
concatenated_filename (dir_as_prefix, progname, suffix);
if (progpathname == NULL)
{
/* errno is set here. */
failure_errno = errno;
free (dir_as_prefix_to_free);
goto failed;
}
/* On systems which have the eaccess() system call, let's
use it. On other systems, let's hope that this program
is not installed setuid or setgid, so that it is ok to
call access() despite its design flaw. */
if (eaccess (progpathname, X_OK) == 0)
{
/* Check that the progpathname does not point to a
directory. */
struct stat statbuf;
if (stat (progpathname, &statbuf) >= 0)
{
if (! S_ISDIR (statbuf.st_mode))
{
/* Found! */
if (strcmp (progpathname, progname) == 0)
{
free (progpathname);
/* Add the "./" prefix for real, that
concatenated_filename() optimized away.
This avoids a second PATH search when the
caller uses execl/execv/execlp/execvp. */
progpathname =
(char *) malloc (2 + strlen (progname) + 1);
if (progpathname == NULL)
{
/* errno is set here. */
failure_errno = errno;
free (dir_as_prefix_to_free);
goto failed;
}
progpathname[0] = '.';
progpathname[1] = NATIVE_SLASH;
memcpy (progpathname + 2, progname,
strlen (progname) + 1);
}
free (dir_as_prefix_to_free);
free (path_copy);
return progpathname;
}
errno = EACCES;
}
}
if (errno != ENOENT)
failure_errno = errno;
free (progpathname);
}
}
#if defined _WIN32 && !defined __CYGWIN__ /* Native Windows */
if (failure_errno == ENOENT && !progname_has_dot)
{
/* In the loop above, we skipped suffix = "". Do this loop
round now, merely to provide a better errno than ENOENT. */
char *progpathname =
concatenated_filename (dir_as_prefix, progname, "");
if (progpathname == NULL)
{
/* errno is set here. */
failure_errno = errno;
free (dir_as_prefix_to_free);
goto failed;
}
if (eaccess (progpathname, X_OK) == 0)
{
struct stat statbuf;
if (stat (progpathname, &statbuf) >= 0)
{
if (! S_ISDIR (statbuf.st_mode))
errno = ENOEXEC;
else
errno = EACCES;
}
}
failure_errno = errno;
free (progpathname);
}
#endif
free (dir_as_prefix_to_free);
if (last)
break;
}
failed:
/* Not found in PATH. */
free (path_copy);
errno = failure_errno;
return NULL;
}
}

77
lib/findprog.h Normal file
View file

@ -0,0 +1,77 @@
/* Locating a program in PATH.
Copyright (C) 2001-2003, 2009-2022 Free Software Foundation, Inc.
Written by Bruno Haible <haible@clisp.cons.org>, 2001.
This file is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
This file 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 Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. */
#ifndef _FINDPROG_H
#define _FINDPROG_H
#include <stdbool.h>
#ifdef __cplusplus
extern "C" {
#endif
/* Looks up a program in the PATH.
Attempts to determine the pathname that would be called by execlp/execvp
of PROGNAME. If successful, it returns a pathname containing a slash
(either absolute or relative to the current directory). Otherwise, it
returns PROGNAME unmodified.
Because of the latter case, callers should use execlp/execvp, not
execl/execv on the returned pathname.
The returned string is freshly malloc()ed if it is != PROGNAME. */
extern const char *find_in_path (const char *progname);
/* Looks up a program in the given PATH-like string.
The PATH argument consists of a list of directories, separated by ':' or
(on native Windows) by ';'. An empty PATH element designates the current
directory. A null PATH is equivalent to an empty PATH, that is, to the
singleton list that contains only the current directory.
If DIRECTORY is not NULL, all relative filenames (i.e. PROGNAME when it
contains a slash, and the PATH elements) are considered relative to
DIRECTORY instead of relative to the current directory of this process.
Determines the pathname that would be called by execlp/execvp of PROGNAME.
- If successful, it returns a pathname containing a slash (either absolute
or relative to the current directory). The returned string can be used
with either execl/execv or execlp/execvp. It is freshly malloc()ed if it
is != PROGNAME.
- Otherwise, it sets errno and returns NULL.
Specific errno values include:
- ENOENT: means that the program's file was not found.
- EACCES: means that the program's file cannot be accessed (due to some
issue with one of the ancestor directories) or lacks the execute
permissions.
- ENOMEM: means out of memory.
If OPTIMIZE_FOR_EXEC is true, the function saves some work, under the
assumption that the resulting pathname will not be accessed directly,
only through execl/execv or execlp/execvp.
Here, a "slash" means:
- On POSIX systems excluding Cygwin: a '/',
- On Windows, OS/2, DOS platforms: a '/' or '\'. */
extern const char *find_in_given_path (const char *progname, const char *path,
const char *directory,
bool optimize_for_exec);
#ifdef __cplusplus
}
#endif
#endif /* _FINDPROG_H */

View file

@ -1,6 +1,6 @@
/* Sizes of structs with flexible array members.
Copyright 2016-2021 Free Software Foundation, Inc.
Copyright 2016-2022 Free Software Foundation, Inc.
This file is part of the GNU C Library.

View file

@ -1,5 +1,5 @@
/* Supplemental information about the floating-point formats.
Copyright (C) 2007, 2009-2021 Free Software Foundation, Inc.
Copyright (C) 2007, 2009-2022 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2007.
This file is free software: you can redistribute it and/or modify

View file

@ -1,5 +1,5 @@
/* Auxiliary definitions for <float.h>.
Copyright (C) 2011-2021 Free Software Foundation, Inc.
Copyright (C) 2011-2022 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2011.
This file is free software: you can redistribute it and/or modify

View file

@ -1,6 +1,6 @@
/* A correct <float.h>.
Copyright (C) 2007-2021 Free Software Foundation, Inc.
Copyright (C) 2007-2022 Free Software Foundation, Inc.
This file is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as

View file

@ -6,7 +6,7 @@
Written by Richard W.M. Jones <rjones.at.redhat.com>
Copyright (C) 2008-2021 Free Software Foundation, Inc.
Copyright (C) 2008-2022 Free Software Foundation, Inc.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public

View file

@ -1,9 +1,9 @@
/* Round towards negative infinity.
Copyright (C) 2007, 2010-2021 Free Software Foundation, Inc.
Copyright (C) 2007, 2010-2022 Free Software Foundation, Inc.
This file is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 3 of the
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This file is distributed in the hope that it will be useful,

View file

@ -1,6 +1,6 @@
/* Make free() preserve errno.
Copyright (C) 2003, 2006, 2009-2021 Free Software Foundation, Inc.
Copyright (C) 2003, 2006, 2009-2022 Free Software Foundation, Inc.
This file is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as

View file

@ -1,5 +1,5 @@
/* Split a double into fraction and mantissa.
Copyright (C) 2007-2021 Free Software Foundation, Inc.
Copyright (C) 2007-2022 Free Software Foundation, Inc.
This file is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as

View file

@ -1,5 +1,5 @@
/* fstat() replacement.
Copyright (C) 2011-2021 Free Software Foundation, Inc.
Copyright (C) 2011-2022 Free Software Foundation, Inc.
This file is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as

View file

@ -7,7 +7,7 @@
Written by Richard W.M. Jones <rjones.at.redhat.com>
Copyright (C) 2008-2021 Free Software Foundation, Inc.
Copyright (C) 2008-2022 Free Software Foundation, Inc.
This file is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as

View file

@ -1,5 +1,5 @@
/* An interface to read that retries after partial reads and interrupts.
Copyright (C) 2002-2003, 2009-2021 Free Software Foundation, Inc.
Copyright (C) 2002-2003, 2009-2022 Free Software Foundation, Inc.
This file is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as

View file

@ -1,6 +1,6 @@
/* An interface to read() that reads all it is asked to read.
Copyright (C) 2002, 2009-2021 Free Software Foundation, Inc.
Copyright (C) 2002, 2009-2022 Free Software Foundation, Inc.
This file is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as

View file

@ -1,6 +1,6 @@
/* An interface to read and write that retries (if necessary) until complete.
Copyright (C) 1993-1994, 1997-2006, 2009-2021 Free Software Foundation, Inc.
Copyright (C) 1993-1994, 1997-2006, 2009-2022 Free Software Foundation, Inc.
This file is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as

View file

@ -1,6 +1,6 @@
/* An interface to write() that writes all it is asked to write.
Copyright (C) 2002-2003, 2009-2021 Free Software Foundation, Inc.
Copyright (C) 2002-2003, 2009-2022 Free Software Foundation, Inc.
This file is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as

View file

@ -1,4 +1,4 @@
/* Copyright (C) 1997, 2001-2002, 2004-2006, 2008-2021 Free Software
/* Copyright (C) 1997, 2001-2002, 2004-2006, 2008-2022 Free Software
Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Philip Blundell <pjb27@cam.ac.uk>, 1997.

View file

@ -1,5 +1,5 @@
/* Get address information (partial implementation).
Copyright (C) 1997, 2001-2002, 2004-2021 Free Software Foundation, Inc.
Copyright (C) 1997, 2001-2002, 2004-2022 Free Software Foundation, Inc.
Contributed by Simon Josefsson <simon@josefsson.org>.
This file is free software: you can redistribute it and/or modify

View file

@ -1,5 +1,5 @@
/* getdtablesize() function: Return maximum possible file descriptor value + 1.
Copyright (C) 2008-2021 Free Software Foundation, Inc.
Copyright (C) 2008-2022 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2008.
This file is free software: you can redistribute it and/or modify

View file

@ -1,6 +1,6 @@
/* Provide a working getlogin for systems which lack it.
Copyright (C) 2010-2021 Free Software Foundation, Inc.
Copyright (C) 2010-2022 Free Software Foundation, Inc.
This file is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as

View file

@ -1,6 +1,6 @@
/* getpeername.c --- wrappers for Windows getpeername function
Copyright (C) 2008-2021 Free Software Foundation, Inc.
Copyright (C) 2008-2022 Free Software Foundation, Inc.
This file is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as

View file

@ -1,6 +1,6 @@
/* Obtain a series of random bytes.
Copyright 2020-2021 Free Software Foundation, Inc.
Copyright 2020-2022 Free Software Foundation, Inc.
This file is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as

View file

@ -1,6 +1,6 @@
/* getsockname.c --- wrappers for Windows getsockname function
Copyright (C) 2008-2021 Free Software Foundation, Inc.
Copyright (C) 2008-2022 Free Software Foundation, Inc.
This file is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as

View file

@ -1,6 +1,6 @@
/* getsockopt.c --- wrappers for Windows getsockopt function
Copyright (C) 2008-2021 Free Software Foundation, Inc.
Copyright (C) 2008-2022 Free Software Foundation, Inc.
This file is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as

View file

@ -1,5 +1,5 @@
/* Convenience header for conditional use of GNU <libintl.h>.
Copyright (C) 1995-1998, 2000-2002, 2004-2006, 2009-2021 Free Software
Copyright (C) 1995-1998, 2000-2002, 2004-2006, 2009-2022 Free Software
Foundation, Inc.
This file is free software: you can redistribute it and/or modify
@ -138,7 +138,7 @@
#define dcnpgettext(Domainname, Msgctxt, Msgid, MsgidPlural, N, Category) \
npgettext_aux (Domainname, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, MsgidPlural, N, Category)
#ifdef __GNUC__
#if defined __GNUC__ || defined __clang__
__inline
#else
#ifdef __cplusplus
@ -157,7 +157,7 @@ pgettext_aux (const char *domain,
return translation;
}
#ifdef __GNUC__
#if defined __GNUC__ || defined __clang__
__inline
#else
#ifdef __cplusplus
@ -191,9 +191,8 @@ npgettext_aux (const char *domain,
or may have security implications due to non-deterministic stack usage. */
#if (!defined GNULIB_NO_VLA \
&& (((__GNUC__ >= 3 || __GNUG__ >= 2) && !defined __STRICT_ANSI__) \
/* || (__STDC_VERSION__ == 199901L && !defined __HP_cc)
|| (__STDC_VERSION__ >= 201112L && !defined __STDC_NO_VLA__) */ ))
&& defined __STDC_VERSION__ && 199901L <= __STDC_VERSION__ \
&& !defined __STDC_NO_VLA__)
# define _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS 1
#else
# define _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS 0
@ -208,7 +207,7 @@ npgettext_aux (const char *domain,
#define dpgettext_expr(Domainname, Msgctxt, Msgid) \
dcpgettext_expr (Domainname, Msgctxt, Msgid, LC_MESSAGES)
#ifdef __GNUC__
#if defined __GNUC__ || defined __clang__
__inline
#else
#ifdef __cplusplus
@ -255,7 +254,7 @@ dcpgettext_expr (const char *domain,
#define dnpgettext_expr(Domainname, Msgctxt, Msgid, MsgidPlural, N) \
dcnpgettext_expr (Domainname, Msgctxt, Msgid, MsgidPlural, N, LC_MESSAGES)
#ifdef __GNUC__
#if defined __GNUC__ || defined __clang__
__inline
#else
#ifdef __cplusplus

View file

@ -1,6 +1,6 @@
/* hard-locale.c -- Determine whether a locale is hard.
Copyright (C) 1997-1999, 2002-2004, 2006-2007, 2009-2021 Free Software
Copyright (C) 1997-1999, 2002-2004, 2006-2007, 2009-2022 Free Software
Foundation, Inc.
This file is free software: you can redistribute it and/or modify

View file

@ -1,6 +1,6 @@
/* Determine whether a locale is hard.
Copyright (C) 1999, 2003-2004, 2009-2021 Free Software Foundation, Inc.
Copyright (C) 1999, 2003-2004, 2009-2022 Free Software Foundation, Inc.
This file is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as

View file

@ -1,5 +1,5 @@
/* Character set conversion.
Copyright (C) 1999-2001, 2007, 2009-2021 Free Software Foundation, Inc.
Copyright (C) 1999-2001, 2007, 2009-2022 Free Software Foundation, Inc.
This file is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as

View file

@ -1,6 +1,6 @@
/* A GNU-like <iconv.h>.
Copyright (C) 2007-2021 Free Software Foundation, Inc.
Copyright (C) 2007-2022 Free Software Foundation, Inc.
This file is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as

View file

@ -1,5 +1,5 @@
/* Character set conversion.
Copyright (C) 2007, 2009-2021 Free Software Foundation, Inc.
Copyright (C) 2007, 2009-2022 Free Software Foundation, Inc.
This file is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as

View file

@ -1,5 +1,5 @@
/* Character set conversion.
Copyright (C) 2007, 2020-2021 Free Software Foundation, Inc.
Copyright (C) 2007, 2020-2022 Free Software Foundation, Inc.
This file is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as

View file

@ -1,5 +1,5 @@
/* Character set conversion.
Copyright (C) 2007, 2020-2021 Free Software Foundation, Inc.
Copyright (C) 2007, 2020-2022 Free Software Foundation, Inc.
This file is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as

View file

@ -1,5 +1,5 @@
/* Character set conversion.
Copyright (C) 2007, 2020-2021 Free Software Foundation, Inc.
Copyright (C) 2007, 2020-2022 Free Software Foundation, Inc.
This file is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as

View file

@ -1,5 +1,5 @@
/* Character set conversion.
Copyright (C) 2007, 2020-2021 Free Software Foundation, Inc.
Copyright (C) 2007, 2020-2022 Free Software Foundation, Inc.
This file is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as

View file

@ -1,5 +1,5 @@
/* Character set conversion.
Copyright (C) 2007, 2009, 2020-2021 Free Software Foundation, Inc.
Copyright (C) 2007, 2009, 2020-2022 Free Software Foundation, Inc.
This file is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as

View file

@ -1,5 +1,5 @@
/* Character set conversion.
Copyright (C) 2019-2021 Free Software Foundation, Inc.
Copyright (C) 2019-2022 Free Software Foundation, Inc.
This file is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as

329
lib/iconv_open-zos.h Normal file
View file

@ -0,0 +1,329 @@
/* ANSI-C code produced by gperf version 3.1 */
/* Command-line: gperf -m 10 ./iconv_open-zos.gperf */
/* Computed positions: -k'4,$' */
#if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \
&& ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \
&& (')' == 41) && ('*' == 42) && ('+' == 43) && (',' == 44) \
&& ('-' == 45) && ('.' == 46) && ('/' == 47) && ('0' == 48) \
&& ('1' == 49) && ('2' == 50) && ('3' == 51) && ('4' == 52) \
&& ('5' == 53) && ('6' == 54) && ('7' == 55) && ('8' == 56) \
&& ('9' == 57) && (':' == 58) && (';' == 59) && ('<' == 60) \
&& ('=' == 61) && ('>' == 62) && ('?' == 63) && ('A' == 65) \
&& ('B' == 66) && ('C' == 67) && ('D' == 68) && ('E' == 69) \
&& ('F' == 70) && ('G' == 71) && ('H' == 72) && ('I' == 73) \
&& ('J' == 74) && ('K' == 75) && ('L' == 76) && ('M' == 77) \
&& ('N' == 78) && ('O' == 79) && ('P' == 80) && ('Q' == 81) \
&& ('R' == 82) && ('S' == 83) && ('T' == 84) && ('U' == 85) \
&& ('V' == 86) && ('W' == 87) && ('X' == 88) && ('Y' == 89) \
&& ('Z' == 90) && ('[' == 91) && ('\\' == 92) && (']' == 93) \
&& ('^' == 94) && ('_' == 95) && ('a' == 97) && ('b' == 98) \
&& ('c' == 99) && ('d' == 100) && ('e' == 101) && ('f' == 102) \
&& ('g' == 103) && ('h' == 104) && ('i' == 105) && ('j' == 106) \
&& ('k' == 107) && ('l' == 108) && ('m' == 109) && ('n' == 110) \
&& ('o' == 111) && ('p' == 112) && ('q' == 113) && ('r' == 114) \
&& ('s' == 115) && ('t' == 116) && ('u' == 117) && ('v' == 118) \
&& ('w' == 119) && ('x' == 120) && ('y' == 121) && ('z' == 122) \
&& ('{' == 123) && ('|' == 124) && ('}' == 125) && ('~' == 126))
/* The character set is not based on ISO-646. */
#error "gperf generated tables don't work with this execution character set. Please report a bug to <bug-gperf@gnu.org>."
#endif
#line 17 "./iconv_open-zos.gperf"
struct mapping { int standard_name; const char vendor_name[10 + 1]; };
#define TOTAL_KEYWORDS 49
#define MIN_WORD_LENGTH 3
#define MAX_WORD_LENGTH 11
#define MIN_HASH_VALUE 3
#define MAX_HASH_VALUE 64
/* maximum key range = 62, duplicates = 0 */
#ifdef __GNUC__
__inline
#else
#ifdef __cplusplus
inline
#endif
#endif
static unsigned int
mapping_hash (register const char *str, register size_t len)
{
static const unsigned char asso_values[] =
{
65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
65, 65, 65, 65, 65, 65, 65, 65, 16, 38,
14, 1, 32, 22, 29, 3, 0, 7, 40, 2,
5, 18, 23, 65, 65, 65, 65, 65, 65, 65,
65, 65, 65, 0, 65, 0, 65, 65, 65, 0,
43, 65, 1, 65, 65, 8, 65, 65, 65, 65,
65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
65, 65
};
register unsigned int hval = len;
switch (hval)
{
default:
hval += asso_values[(unsigned char)str[3]+6];
/*FALLTHROUGH*/
case 3:
break;
}
return hval + asso_values[(unsigned char)str[len - 1]];
}
struct stringpool_t
{
char stringpool_str3[sizeof("GBK")];
char stringpool_str5[sizeof("ASCII")];
char stringpool_str7[sizeof("CP1253")];
char stringpool_str8[sizeof("EUC-KR")];
char stringpool_str9[sizeof("CP1257")];
char stringpool_str10[sizeof("CP857")];
char stringpool_str11[sizeof("ISO-8859-8")];
char stringpool_str12[sizeof("ISO-8859-3")];
char stringpool_str13[sizeof("ISO-8859-13")];
char stringpool_str14[sizeof("ISO-8859-7")];
char stringpool_str15[sizeof("CP437")];
char stringpool_str16[sizeof("CP1129")];
char stringpool_str17[sizeof("CP869")];
char stringpool_str18[sizeof("ISO-8859-9")];
char stringpool_str19[sizeof("CP922")];
char stringpool_str20[sizeof("CP1252")];
char stringpool_str21[sizeof("CP852")];
char stringpool_str22[sizeof("CP1250")];
char stringpool_str23[sizeof("CP850")];
char stringpool_str24[sizeof("CP862")];
char stringpool_str25[sizeof("ISO-8859-2")];
char stringpool_str26[sizeof("CP932")];
char stringpool_str27[sizeof("GB2312")];
char stringpool_str28[sizeof("CP1255")];
char stringpool_str29[sizeof("CP855")];
char stringpool_str30[sizeof("KOI8-R")];
char stringpool_str31[sizeof("CP1125")];
char stringpool_str32[sizeof("CP865")];
char stringpool_str33[sizeof("ISO-8859-5")];
char stringpool_str34[sizeof("ISO-8859-15")];
char stringpool_str35[sizeof("CP1256")];
char stringpool_str36[sizeof("CP856")];
char stringpool_str37[sizeof("KOI8-U")];
char stringpool_str38[sizeof("CP1254")];
char stringpool_str39[sizeof("CP866")];
char stringpool_str40[sizeof("ISO-8859-6")];
char stringpool_str41[sizeof("CP1124")];
char stringpool_str42[sizeof("CP864")];
char stringpool_str43[sizeof("ISO-8859-4")];
char stringpool_str44[sizeof("CP1251")];
char stringpool_str45[sizeof("CP775")];
char stringpool_str46[sizeof("CP943")];
char stringpool_str47[sizeof("CP1131")];
char stringpool_str48[sizeof("CP861")];
char stringpool_str49[sizeof("ISO-8859-1")];
char stringpool_str50[sizeof("EUC-JP")];
char stringpool_str52[sizeof("CP949")];
char stringpool_str55[sizeof("CP874")];
char stringpool_str64[sizeof("CP1046")];
};
static const struct stringpool_t stringpool_contents =
{
"GBK",
"ASCII",
"CP1253",
"EUC-KR",
"CP1257",
"CP857",
"ISO-8859-8",
"ISO-8859-3",
"ISO-8859-13",
"ISO-8859-7",
"CP437",
"CP1129",
"CP869",
"ISO-8859-9",
"CP922",
"CP1252",
"CP852",
"CP1250",
"CP850",
"CP862",
"ISO-8859-2",
"CP932",
"GB2312",
"CP1255",
"CP855",
"KOI8-R",
"CP1125",
"CP865",
"ISO-8859-5",
"ISO-8859-15",
"CP1256",
"CP856",
"KOI8-U",
"CP1254",
"CP866",
"ISO-8859-6",
"CP1124",
"CP864",
"ISO-8859-4",
"CP1251",
"CP775",
"CP943",
"CP1131",
"CP861",
"ISO-8859-1",
"EUC-JP",
"CP949",
"CP874",
"CP1046"
};
#define stringpool ((const char *) &stringpool_contents)
static const struct mapping mappings[] =
{
{-1}, {-1}, {-1},
#line 76 "./iconv_open-zos.gperf"
{(int)(size_t)&((struct stringpool_t *)0)->stringpool_str3, "IBM-1386"},
{-1},
#line 28 "./iconv_open-zos.gperf"
{(int)(size_t)&((struct stringpool_t *)0)->stringpool_str5, "00367"},
{-1},
#line 68 "./iconv_open-zos.gperf"
{(int)(size_t)&((struct stringpool_t *)0)->stringpool_str7, "IBM-5349"},
#line 75 "./iconv_open-zos.gperf"
{(int)(size_t)&((struct stringpool_t *)0)->stringpool_str8, "IBM-eucKR"},
#line 72 "./iconv_open-zos.gperf"
{(int)(size_t)&((struct stringpool_t *)0)->stringpool_str9, "09449"},
#line 48 "./iconv_open-zos.gperf"
{(int)(size_t)&((struct stringpool_t *)0)->stringpool_str10, "00857"},
#line 36 "./iconv_open-zos.gperf"
{(int)(size_t)&((struct stringpool_t *)0)->stringpool_str11, "05012"},
#line 31 "./iconv_open-zos.gperf"
{(int)(size_t)&((struct stringpool_t *)0)->stringpool_str12, "00913"},
#line 38 "./iconv_open-zos.gperf"
{(int)(size_t)&((struct stringpool_t *)0)->stringpool_str13, "ISO8859-13"},
#line 35 "./iconv_open-zos.gperf"
{(int)(size_t)&((struct stringpool_t *)0)->stringpool_str14, "ISO8859-7"},
#line 42 "./iconv_open-zos.gperf"
{(int)(size_t)&((struct stringpool_t *)0)->stringpool_str15, "IBM-437"},
#line 63 "./iconv_open-zos.gperf"
{(int)(size_t)&((struct stringpool_t *)0)->stringpool_str16, "01129"},
#line 54 "./iconv_open-zos.gperf"
{(int)(size_t)&((struct stringpool_t *)0)->stringpool_str17, "IBM-869"},
#line 37 "./iconv_open-zos.gperf"
{(int)(size_t)&((struct stringpool_t *)0)->stringpool_str18, "ISO8859-9"},
#line 56 "./iconv_open-zos.gperf"
{(int)(size_t)&((struct stringpool_t *)0)->stringpool_str19, "IBM-922"},
#line 67 "./iconv_open-zos.gperf"
{(int)(size_t)&((struct stringpool_t *)0)->stringpool_str20, "IBM-5348"},
#line 45 "./iconv_open-zos.gperf"
{(int)(size_t)&((struct stringpool_t *)0)->stringpool_str21, "IBM-852"},
#line 65 "./iconv_open-zos.gperf"
{(int)(size_t)&((struct stringpool_t *)0)->stringpool_str22, "IBM-5346"},
#line 44 "./iconv_open-zos.gperf"
{(int)(size_t)&((struct stringpool_t *)0)->stringpool_str23, "09042"},
#line 50 "./iconv_open-zos.gperf"
{(int)(size_t)&((struct stringpool_t *)0)->stringpool_str24, "IBM-862"},
#line 30 "./iconv_open-zos.gperf"
{(int)(size_t)&((struct stringpool_t *)0)->stringpool_str25, "ISO8859-2"},
#line 57 "./iconv_open-zos.gperf"
{(int)(size_t)&((struct stringpool_t *)0)->stringpool_str26, "IBM-943"},
#line 73 "./iconv_open-zos.gperf"
{(int)(size_t)&((struct stringpool_t *)0)->stringpool_str27, "IBM-eucCN"},
#line 70 "./iconv_open-zos.gperf"
{(int)(size_t)&((struct stringpool_t *)0)->stringpool_str28, "09447"},
#line 46 "./iconv_open-zos.gperf"
{(int)(size_t)&((struct stringpool_t *)0)->stringpool_str29, "13143"},
#line 40 "./iconv_open-zos.gperf"
{(int)(size_t)&((struct stringpool_t *)0)->stringpool_str30, "00878"},
#line 62 "./iconv_open-zos.gperf"
{(int)(size_t)&((struct stringpool_t *)0)->stringpool_str31, "IBM-1125"},
#line 52 "./iconv_open-zos.gperf"
{(int)(size_t)&((struct stringpool_t *)0)->stringpool_str32, "00865"},
#line 33 "./iconv_open-zos.gperf"
{(int)(size_t)&((struct stringpool_t *)0)->stringpool_str33, "ISO8859-5"},
#line 39 "./iconv_open-zos.gperf"
{(int)(size_t)&((struct stringpool_t *)0)->stringpool_str34, "ISO8859-15"},
#line 71 "./iconv_open-zos.gperf"
{(int)(size_t)&((struct stringpool_t *)0)->stringpool_str35, "09448"},
#line 47 "./iconv_open-zos.gperf"
{(int)(size_t)&((struct stringpool_t *)0)->stringpool_str36, "IBM-856"},
#line 41 "./iconv_open-zos.gperf"
{(int)(size_t)&((struct stringpool_t *)0)->stringpool_str37, "01168"},
#line 69 "./iconv_open-zos.gperf"
{(int)(size_t)&((struct stringpool_t *)0)->stringpool_str38, "IBM-5350"},
#line 53 "./iconv_open-zos.gperf"
{(int)(size_t)&((struct stringpool_t *)0)->stringpool_str39, "04962"},
#line 34 "./iconv_open-zos.gperf"
{(int)(size_t)&((struct stringpool_t *)0)->stringpool_str40, "ISO8859-6"},
#line 61 "./iconv_open-zos.gperf"
{(int)(size_t)&((struct stringpool_t *)0)->stringpool_str41, "IBM-1124"},
#line 51 "./iconv_open-zos.gperf"
{(int)(size_t)&((struct stringpool_t *)0)->stringpool_str42, "IBM-864"},
#line 32 "./iconv_open-zos.gperf"
{(int)(size_t)&((struct stringpool_t *)0)->stringpool_str43, "ISO8859-4"},
#line 66 "./iconv_open-zos.gperf"
{(int)(size_t)&((struct stringpool_t *)0)->stringpool_str44, "IBM-5347"},
#line 43 "./iconv_open-zos.gperf"
{(int)(size_t)&((struct stringpool_t *)0)->stringpool_str45, "00775"},
#line 58 "./iconv_open-zos.gperf"
{(int)(size_t)&((struct stringpool_t *)0)->stringpool_str46, "IBM-943"},
#line 64 "./iconv_open-zos.gperf"
{(int)(size_t)&((struct stringpool_t *)0)->stringpool_str47, "01131"},
#line 49 "./iconv_open-zos.gperf"
{(int)(size_t)&((struct stringpool_t *)0)->stringpool_str48, "IBM-861"},
#line 29 "./iconv_open-zos.gperf"
{(int)(size_t)&((struct stringpool_t *)0)->stringpool_str49, "ISO8859-1"},
#line 74 "./iconv_open-zos.gperf"
{(int)(size_t)&((struct stringpool_t *)0)->stringpool_str50, "01350"},
{-1},
#line 59 "./iconv_open-zos.gperf"
{(int)(size_t)&((struct stringpool_t *)0)->stringpool_str52, "IBM-1363"},
{-1}, {-1},
#line 55 "./iconv_open-zos.gperf"
{(int)(size_t)&((struct stringpool_t *)0)->stringpool_str55, "TIS-620"},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
#line 60 "./iconv_open-zos.gperf"
{(int)(size_t)&((struct stringpool_t *)0)->stringpool_str64, "IBM-1046"}
};
const struct mapping *
mapping_lookup (register const char *str, register size_t len)
{
if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
{
register unsigned int key = mapping_hash (str, len);
if (key <= MAX_HASH_VALUE)
{
register int o = mappings[key].standard_name;
if (o >= 0)
{
register const char *s = o + stringpool;
if (*str == *s && !strcmp (str + 1, s + 1))
return &mappings[key];
}
}
}
return 0;
}

Some files were not shown because too many files have changed in this diff Show more