mirror of
https://git.savannah.gnu.org/git/emacs.git
synced 2024-12-23 10:34:07 +00:00
Remove some stray gnulib files
* admin/merge-gnulib: rm m4/gnulib-tool.m4 too. (GNULIB_MODULES): Remove unsetenv, as it is not needed and the --avoid=unsetenv option avoided most of it anyway. * lib/unsetenv.c, m4/gnulib-tool.m4, m4/setenv.m4: Remove. * lib/gnulib.mk: Regenerate.
This commit is contained in:
parent
cbd4708db2
commit
026c2cbf35
@ -40,7 +40,7 @@ GNULIB_MODULES='
|
||||
sig2str socklen stat-time std-gnu11 stdalign stddef stdio
|
||||
stpcpy strftime strtoimax strtoumax symlink sys_stat
|
||||
sys_time time time_r time_rz timegm timer-time timespec-add timespec-sub
|
||||
unsetenv update-copyright utimens
|
||||
update-copyright utimens
|
||||
vla warnings
|
||||
'
|
||||
|
||||
@ -97,7 +97,8 @@ test -x "$gnulib_srcdir"/gnulib-tool || {
|
||||
"$gnulib_srcdir"/gnulib-tool --dir="$src" $GNULIB_TOOL_FLAGS $GNULIB_MODULES &&
|
||||
rm -- "$src"lib/gl_openssl.h "$src"m4/fcntl-o.m4 \
|
||||
"$src"m4/gl-openssl.m4 \
|
||||
"$src"m4/gnulib-cache.m4 "$src"m4/warn-on-use.m4 "$src"m4/wint_t.m4 &&
|
||||
"$src"m4/gnulib-cache.m4 "$src"m4/gnulib-tool.m4 \
|
||||
"$src"m4/warn-on-use.m4 "$src"m4/wint_t.m4 &&
|
||||
cp -- "$gnulib_srcdir"/build-aux/texinfo.tex "$src"doc/misc &&
|
||||
cp -- "$gnulib_srcdir"/build-aux/move-if-change "$src"build-aux &&
|
||||
{ test -z "$src" || cd "$src"; } &&
|
||||
|
@ -21,7 +21,7 @@
|
||||
# the same distribution terms as the rest of that program.
|
||||
#
|
||||
# Generated by gnulib-tool.
|
||||
# Reproduce by: gnulib-tool --import --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --avoid=close --avoid=dup --avoid=fchdir --avoid=fstat --avoid=malloc-posix --avoid=msvc-inval --avoid=msvc-nothrow --avoid=open --avoid=openat-die --avoid=opendir --avoid=raise --avoid=save-cwd --avoid=select --avoid=setenv --avoid=sigprocmask --avoid=stdarg --avoid=stdbool --avoid=threadlib --avoid=unsetenv --makefile-name=gnulib.mk --conditional-dependencies --no-libtool --macro-prefix=gl --no-vc-files alloca-opt binary-io byteswap c-ctype c-strcase careadlinkat close-stream count-leading-zeros count-one-bits count-trailing-zeros crypto/md5 crypto/sha1 crypto/sha256 crypto/sha512 dtoastr dtotimespec dup2 environ execinfo faccessat fcntl fcntl-h fdatasync fdopendir filemode filevercmp flexmember fstatat fsync getloadavg getopt-gnu gettime gettimeofday gitlog-to-changelog ignore-value intprops largefile lstat manywarnings memrchr mkostemp mktime pipe2 pselect pthread_sigmask putenv qcopy-acl readlink readlinkat sig2str socklen stat-time std-gnu11 stdalign stddef stdio stpcpy strftime strtoimax strtoumax symlink sys_stat sys_time time time_r time_rz timegm timer-time timespec-add timespec-sub unsetenv update-copyright utimens vla warnings
|
||||
# Reproduce by: gnulib-tool --import --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --avoid=close --avoid=dup --avoid=fchdir --avoid=fstat --avoid=malloc-posix --avoid=msvc-inval --avoid=msvc-nothrow --avoid=open --avoid=openat-die --avoid=opendir --avoid=raise --avoid=save-cwd --avoid=select --avoid=setenv --avoid=sigprocmask --avoid=stdarg --avoid=stdbool --avoid=threadlib --avoid=unsetenv --makefile-name=gnulib.mk --conditional-dependencies --no-libtool --macro-prefix=gl --no-vc-files alloca-opt binary-io byteswap c-ctype c-strcase careadlinkat close-stream count-leading-zeros count-one-bits count-trailing-zeros crypto/md5 crypto/sha1 crypto/sha256 crypto/sha512 dtoastr dtotimespec dup2 environ execinfo faccessat fcntl fcntl-h fdatasync fdopendir filemode filevercmp flexmember fstatat fsync getloadavg getopt-gnu gettime gettimeofday gitlog-to-changelog ignore-value intprops largefile lstat manywarnings memrchr mkostemp mktime pipe2 pselect pthread_sigmask putenv qcopy-acl readlink readlinkat sig2str socklen stat-time std-gnu11 stdalign stddef stdio stpcpy strftime strtoimax strtoumax symlink sys_stat sys_time time time_r time_rz timegm timer-time timespec-add timespec-sub update-copyright utimens vla warnings
|
||||
|
||||
|
||||
MOSTLYCLEANFILES += core *.stackdump
|
||||
|
128
lib/unsetenv.c
128
lib/unsetenv.c
@ -1,128 +0,0 @@
|
||||
/* Copyright (C) 1992, 1995-2002, 2005-2017 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 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/>. */
|
||||
|
||||
/* Don't use __attribute__ __nonnull__ in this compilation unit. Otherwise gcc
|
||||
optimizes away the name == NULL test below. */
|
||||
#define _GL_ARG_NONNULL(params)
|
||||
|
||||
#include <config.h>
|
||||
|
||||
/* Specification. */
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <errno.h>
|
||||
#if !_LIBC
|
||||
# define __set_errno(ev) ((errno) = (ev))
|
||||
#endif
|
||||
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#if !_LIBC
|
||||
# define __environ environ
|
||||
#endif
|
||||
|
||||
#if _LIBC
|
||||
/* This lock protects against simultaneous modifications of 'environ'. */
|
||||
# include <bits/libc-lock.h>
|
||||
__libc_lock_define_initialized (static, envlock)
|
||||
# define LOCK __libc_lock_lock (envlock)
|
||||
# define UNLOCK __libc_lock_unlock (envlock)
|
||||
#else
|
||||
# define LOCK
|
||||
# define UNLOCK
|
||||
#endif
|
||||
|
||||
/* In the GNU C library we must keep the namespace clean. */
|
||||
#ifdef _LIBC
|
||||
# define unsetenv __unsetenv
|
||||
#endif
|
||||
|
||||
#if _LIBC || !HAVE_UNSETENV
|
||||
|
||||
int
|
||||
unsetenv (const char *name)
|
||||
{
|
||||
size_t len;
|
||||
char **ep;
|
||||
|
||||
if (name == NULL || *name == '\0' || strchr (name, '=') != NULL)
|
||||
{
|
||||
__set_errno (EINVAL);
|
||||
return -1;
|
||||
}
|
||||
|
||||
len = strlen (name);
|
||||
|
||||
LOCK;
|
||||
|
||||
ep = __environ;
|
||||
while (*ep != NULL)
|
||||
if (!strncmp (*ep, name, len) && (*ep)[len] == '=')
|
||||
{
|
||||
/* Found it. Remove this pointer by moving later ones back. */
|
||||
char **dp = ep;
|
||||
|
||||
do
|
||||
dp[0] = dp[1];
|
||||
while (*dp++);
|
||||
/* Continue the loop in case NAME appears again. */
|
||||
}
|
||||
else
|
||||
++ep;
|
||||
|
||||
UNLOCK;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef _LIBC
|
||||
# undef unsetenv
|
||||
weak_alias (__unsetenv, unsetenv)
|
||||
#endif
|
||||
|
||||
#else /* HAVE_UNSETENV */
|
||||
|
||||
# undef unsetenv
|
||||
# if !HAVE_DECL_UNSETENV
|
||||
# if VOID_UNSETENV
|
||||
extern void unsetenv (const char *);
|
||||
# else
|
||||
extern int unsetenv (const char *);
|
||||
# endif
|
||||
# endif
|
||||
|
||||
/* Call the underlying unsetenv, in case there is hidden bookkeeping
|
||||
that needs updating beyond just modifying environ. */
|
||||
int
|
||||
rpl_unsetenv (const char *name)
|
||||
{
|
||||
int result = 0;
|
||||
if (!name || !*name || strchr (name, '='))
|
||||
{
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
while (getenv (name))
|
||||
# if !VOID_UNSETENV
|
||||
result =
|
||||
# endif
|
||||
unsetenv (name);
|
||||
return result;
|
||||
}
|
||||
|
||||
#endif /* HAVE_UNSETENV */
|
@ -1,57 +0,0 @@
|
||||
# gnulib-tool.m4 serial 2
|
||||
dnl Copyright (C) 2004-2005, 2009-2017 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 The following macros need not be invoked explicitly.
|
||||
dnl Invoking them does nothing except to declare default arguments
|
||||
dnl for "gnulib-tool --import".
|
||||
|
||||
dnl Usage: gl_LOCAL_DIR([DIR])
|
||||
AC_DEFUN([gl_LOCAL_DIR], [])
|
||||
|
||||
dnl Usage: gl_MODULES([module1 module2 ...])
|
||||
AC_DEFUN([gl_MODULES], [])
|
||||
|
||||
dnl Usage: gl_AVOID([module1 module2 ...])
|
||||
AC_DEFUN([gl_AVOID], [])
|
||||
|
||||
dnl Usage: gl_SOURCE_BASE([DIR])
|
||||
AC_DEFUN([gl_SOURCE_BASE], [])
|
||||
|
||||
dnl Usage: gl_M4_BASE([DIR])
|
||||
AC_DEFUN([gl_M4_BASE], [])
|
||||
|
||||
dnl Usage: gl_PO_BASE([DIR])
|
||||
AC_DEFUN([gl_PO_BASE], [])
|
||||
|
||||
dnl Usage: gl_DOC_BASE([DIR])
|
||||
AC_DEFUN([gl_DOC_BASE], [])
|
||||
|
||||
dnl Usage: gl_TESTS_BASE([DIR])
|
||||
AC_DEFUN([gl_TESTS_BASE], [])
|
||||
|
||||
dnl Usage: gl_WITH_TESTS
|
||||
AC_DEFUN([gl_WITH_TESTS], [])
|
||||
|
||||
dnl Usage: gl_LIB([LIBNAME])
|
||||
AC_DEFUN([gl_LIB], [])
|
||||
|
||||
dnl Usage: gl_LGPL or gl_LGPL([VERSION])
|
||||
AC_DEFUN([gl_LGPL], [])
|
||||
|
||||
dnl Usage: gl_MAKEFILE_NAME([FILENAME])
|
||||
AC_DEFUN([gl_MAKEFILE_NAME], [])
|
||||
|
||||
dnl Usage: gl_LIBTOOL
|
||||
AC_DEFUN([gl_LIBTOOL], [])
|
||||
|
||||
dnl Usage: gl_MACRO_PREFIX([PREFIX])
|
||||
AC_DEFUN([gl_MACRO_PREFIX], [])
|
||||
|
||||
dnl Usage: gl_PO_DOMAIN([DOMAIN])
|
||||
AC_DEFUN([gl_PO_DOMAIN], [])
|
||||
|
||||
dnl Usage: gl_VC_FILES([BOOLEAN])
|
||||
AC_DEFUN([gl_VC_FILES], [])
|
160
m4/setenv.m4
160
m4/setenv.m4
@ -1,160 +0,0 @@
|
||||
# setenv.m4 serial 26
|
||||
dnl Copyright (C) 2001-2004, 2006-2017 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_SETENV],
|
||||
[
|
||||
AC_REQUIRE([gl_FUNC_SETENV_SEPARATE])
|
||||
AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
|
||||
if test $ac_cv_func_setenv = no; then
|
||||
HAVE_SETENV=0
|
||||
else
|
||||
AC_CACHE_CHECK([whether setenv validates arguments],
|
||||
[gl_cv_func_setenv_works],
|
||||
[AC_RUN_IFELSE([AC_LANG_PROGRAM([[
|
||||
#include <stdlib.h>
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
]], [[
|
||||
int result = 0;
|
||||
{
|
||||
if (setenv ("", "", 0) != -1)
|
||||
result |= 1;
|
||||
else if (errno != EINVAL)
|
||||
result |= 2;
|
||||
}
|
||||
{
|
||||
if (setenv ("a", "=", 1) != 0)
|
||||
result |= 4;
|
||||
else if (strcmp (getenv ("a"), "=") != 0)
|
||||
result |= 8;
|
||||
}
|
||||
return result;
|
||||
]])],
|
||||
[gl_cv_func_setenv_works=yes], [gl_cv_func_setenv_works=no],
|
||||
[case "$host_os" in
|
||||
# Guess yes on glibc systems.
|
||||
*-gnu*) gl_cv_func_setenv_works="guessing yes" ;;
|
||||
# If we don't know, assume the worst.
|
||||
*) gl_cv_func_setenv_works="guessing no" ;;
|
||||
esac
|
||||
])])
|
||||
case "$gl_cv_func_setenv_works" in
|
||||
*yes) ;;
|
||||
*)
|
||||
REPLACE_SETENV=1
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
])
|
||||
|
||||
# Like gl_FUNC_SETENV, except prepare for separate compilation
|
||||
# (no REPLACE_SETENV, no AC_LIBOBJ).
|
||||
AC_DEFUN([gl_FUNC_SETENV_SEPARATE],
|
||||
[
|
||||
AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
|
||||
AC_CHECK_DECLS_ONCE([setenv])
|
||||
if test $ac_cv_have_decl_setenv = no; then
|
||||
HAVE_DECL_SETENV=0
|
||||
fi
|
||||
AC_CHECK_FUNCS_ONCE([setenv])
|
||||
gl_PREREQ_SETENV
|
||||
])
|
||||
|
||||
AC_DEFUN([gl_FUNC_UNSETENV],
|
||||
[
|
||||
AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
|
||||
AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
|
||||
AC_CHECK_DECLS_ONCE([unsetenv])
|
||||
if test $ac_cv_have_decl_unsetenv = no; then
|
||||
HAVE_DECL_UNSETENV=0
|
||||
fi
|
||||
AC_CHECK_FUNCS([unsetenv])
|
||||
if test $ac_cv_func_unsetenv = no; then
|
||||
HAVE_UNSETENV=0
|
||||
else
|
||||
HAVE_UNSETENV=1
|
||||
dnl Some BSDs return void, failing to do error checking.
|
||||
AC_CACHE_CHECK([for unsetenv() return type], [gt_cv_func_unsetenv_ret],
|
||||
[AC_COMPILE_IFELSE(
|
||||
[AC_LANG_PROGRAM(
|
||||
[[
|
||||
#undef _BSD
|
||||
#define _BSD 1 /* unhide unsetenv declaration in OSF/1 5.1 <stdlib.h> */
|
||||
#include <stdlib.h>
|
||||
extern
|
||||
#ifdef __cplusplus
|
||||
"C"
|
||||
#endif
|
||||
int unsetenv (const char *name);
|
||||
]],
|
||||
[[]])],
|
||||
[gt_cv_func_unsetenv_ret='int'],
|
||||
[gt_cv_func_unsetenv_ret='void'])])
|
||||
if test $gt_cv_func_unsetenv_ret = 'void'; then
|
||||
AC_DEFINE([VOID_UNSETENV], [1], [Define to 1 if unsetenv returns void
|
||||
instead of int.])
|
||||
REPLACE_UNSETENV=1
|
||||
fi
|
||||
|
||||
dnl Solaris 10 unsetenv does not remove all copies of a name.
|
||||
dnl Haiku alpha 2 unsetenv gets confused by assignment to environ.
|
||||
dnl OpenBSD 4.7 unsetenv("") does not fail.
|
||||
AC_CACHE_CHECK([whether unsetenv obeys POSIX],
|
||||
[gl_cv_func_unsetenv_works],
|
||||
[AC_RUN_IFELSE([AC_LANG_PROGRAM([[
|
||||
#include <stdlib.h>
|
||||
#include <errno.h>
|
||||
extern char **environ;
|
||||
]], [[
|
||||
char entry1[] = "a=1";
|
||||
char entry2[] = "b=2";
|
||||
char *env[] = { entry1, entry2, NULL };
|
||||
if (putenv ((char *) "a=1")) return 1;
|
||||
if (putenv (entry2)) return 2;
|
||||
entry2[0] = 'a';
|
||||
unsetenv ("a");
|
||||
if (getenv ("a")) return 3;
|
||||
if (!unsetenv ("") || errno != EINVAL) return 4;
|
||||
entry2[0] = 'b';
|
||||
environ = env;
|
||||
if (!getenv ("a")) return 5;
|
||||
entry2[0] = 'a';
|
||||
unsetenv ("a");
|
||||
if (getenv ("a")) return 6;
|
||||
]])],
|
||||
[gl_cv_func_unsetenv_works=yes], [gl_cv_func_unsetenv_works=no],
|
||||
[case "$host_os" in
|
||||
# Guess yes on glibc systems.
|
||||
*-gnu*) gl_cv_func_unsetenv_works="guessing yes" ;;
|
||||
# If we don't know, assume the worst.
|
||||
*) gl_cv_func_unsetenv_works="guessing no" ;;
|
||||
esac
|
||||
])])
|
||||
case "$gl_cv_func_unsetenv_works" in
|
||||
*yes) ;;
|
||||
*)
|
||||
REPLACE_UNSETENV=1
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
])
|
||||
|
||||
# Prerequisites of lib/setenv.c.
|
||||
AC_DEFUN([gl_PREREQ_SETENV],
|
||||
[
|
||||
AC_REQUIRE([AC_FUNC_ALLOCA])
|
||||
AC_REQUIRE([gl_ENVIRON])
|
||||
AC_CHECK_HEADERS_ONCE([unistd.h])
|
||||
AC_CHECK_HEADERS([search.h])
|
||||
AC_CHECK_FUNCS([tsearch])
|
||||
])
|
||||
|
||||
# Prerequisites of lib/unsetenv.c.
|
||||
AC_DEFUN([gl_PREREQ_UNSETENV],
|
||||
[
|
||||
AC_REQUIRE([gl_ENVIRON])
|
||||
AC_CHECK_HEADERS_ONCE([unistd.h])
|
||||
])
|
Loading…
Reference in New Issue
Block a user