aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorPaul Eggert2017-03-12 00:02:52 -0800
committerPaul Eggert2017-03-12 00:03:38 -0800
commit026c2cbf354fab138a65ad7093f17fbb23edb23c (patch)
treeac7c2c3989f020a81aeab2e4a45a6a1a30d1300b /lib
parentcbd4708db21b633c64066dd6288d33d4ff6b4a5f (diff)
downloademacs-026c2cbf354fab138a65ad7093f17fbb23edb23c.tar.gz
emacs-026c2cbf354fab138a65ad7093f17fbb23edb23c.zip
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.
Diffstat (limited to 'lib')
-rw-r--r--lib/gnulib.mk2
-rw-r--r--lib/unsetenv.c128
2 files changed, 1 insertions, 129 deletions
diff --git a/lib/gnulib.mk b/lib/gnulib.mk
index e4aa90ecac9..7a0de1b440d 100644
--- a/lib/gnulib.mk
+++ b/lib/gnulib.mk
@@ -21,7 +21,7 @@
21# the same distribution terms as the rest of that program. 21# the same distribution terms as the rest of that program.
22# 22#
23# Generated by gnulib-tool. 23# Generated by gnulib-tool.
24# 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 24# 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
25 25
26 26
27MOSTLYCLEANFILES += core *.stackdump 27MOSTLYCLEANFILES += core *.stackdump
diff --git a/lib/unsetenv.c b/lib/unsetenv.c
deleted file mode 100644
index 6d742c15964..00000000000
--- a/lib/unsetenv.c
+++ /dev/null
@@ -1,128 +0,0 @@
1/* Copyright (C) 1992, 1995-2002, 2005-2017 Free Software Foundation,
2 Inc.
3 This file is part of the GNU C Library.
4
5 This program is free software: you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 3 of the License, or
8 (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>. */
17
18/* Don't use __attribute__ __nonnull__ in this compilation unit. Otherwise gcc
19 optimizes away the name == NULL test below. */
20#define _GL_ARG_NONNULL(params)
21
22#include <config.h>
23
24/* Specification. */
25#include <stdlib.h>
26
27#include <errno.h>
28#if !_LIBC
29# define __set_errno(ev) ((errno) = (ev))
30#endif
31
32#include <string.h>
33#include <unistd.h>
34
35#if !_LIBC
36# define __environ environ
37#endif
38
39#if _LIBC
40/* This lock protects against simultaneous modifications of 'environ'. */
41# include <bits/libc-lock.h>
42__libc_lock_define_initialized (static, envlock)
43# define LOCK __libc_lock_lock (envlock)
44# define UNLOCK __libc_lock_unlock (envlock)
45#else
46# define LOCK
47# define UNLOCK
48#endif
49
50/* In the GNU C library we must keep the namespace clean. */
51#ifdef _LIBC
52# define unsetenv __unsetenv
53#endif
54
55#if _LIBC || !HAVE_UNSETENV
56
57int
58unsetenv (const char *name)
59{
60 size_t len;
61 char **ep;
62
63 if (name == NULL || *name == '\0' || strchr (name, '=') != NULL)
64 {
65 __set_errno (EINVAL);
66 return -1;
67 }
68
69 len = strlen (name);
70
71 LOCK;
72
73 ep = __environ;
74 while (*ep != NULL)
75 if (!strncmp (*ep, name, len) && (*ep)[len] == '=')
76 {
77 /* Found it. Remove this pointer by moving later ones back. */
78 char **dp = ep;
79
80 do
81 dp[0] = dp[1];
82 while (*dp++);
83 /* Continue the loop in case NAME appears again. */
84 }
85 else
86 ++ep;
87
88 UNLOCK;
89
90 return 0;
91}
92
93#ifdef _LIBC
94# undef unsetenv
95weak_alias (__unsetenv, unsetenv)
96#endif
97
98#else /* HAVE_UNSETENV */
99
100# undef unsetenv
101# if !HAVE_DECL_UNSETENV
102# if VOID_UNSETENV
103extern void unsetenv (const char *);
104# else
105extern int unsetenv (const char *);
106# endif
107# endif
108
109/* Call the underlying unsetenv, in case there is hidden bookkeeping
110 that needs updating beyond just modifying environ. */
111int
112rpl_unsetenv (const char *name)
113{
114 int result = 0;
115 if (!name || !*name || strchr (name, '='))
116 {
117 errno = EINVAL;
118 return -1;
119 }
120 while (getenv (name))
121# if !VOID_UNSETENV
122 result =
123# endif
124 unsetenv (name);
125 return result;
126}
127
128#endif /* HAVE_UNSETENV */