mirror of
git://sourceware.org/git/glibc.git
synced 2024-11-21 01:12:26 +08:00
48896b9dba
2000-12-05 Andreas Jaeger <aj@suse.de> * elf/dl-misc.c (_dl_sysdep_read_whole_file): Mark as internal_function. * sysdeps/generic/dl-cache.c (_dl_load_cache_lookup): Likewise. * sysdeps/generic/dl-sysdep.c (_dl_sysdep_start_cleanup): Likewise. * sysdeps/generic/dl-cache.c: Remove declaration of _dl_sysdep_read_whole_file. * elf/dl-load.c (_dl_map_object): Remove declaration of _dl_load_cache_lookup. * sysdeps/generic/ldsodefs.h: Add declarations of _dl_load_cache_lookup, _dl_unload_cache, _dl_sysdep_read_whole_file, _dl_sysdep_start and _dl_sysdep_start_cleanup. * elf/rtld.c: Remove prototypes that are defined in ldsodefs.h now. * elf/dl-misc.c: Include <ldsodefs.h> to get prototypes. * sysdeps/generic/dl-environ.c: Likewise. * stdio-common/printf_fp.c: Include <gmp.h> instead of <stdlib/gmp.h>. * math/atest-exp.c: Likewise. * math/atest-exp2.c: Likewise. * math/atest-sincos.c: Likewise. * stdio-common/_itoa.c: Likewise. * stdio-common/_itowa.c: Likewise. * include/gmp.h: New file with internal prototypes. * sysdeps/generic/longjmp.c: Move _longjmp_unwind declaration from here to... * include/setjmp.h: ...here. * locale/Makefile (routines): Remove codeset_name since it's not needed anywhere. * locale/codeset_name.c: Removed.
73 lines
1.9 KiB
C
73 lines
1.9 KiB
C
/* Environment handling for dynamic loader.
|
|
Copyright (C) 1995, 1996, 1997, 1998, 2000 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
|
|
modify it under the terms of the GNU Library General Public License as
|
|
published by the Free Software Foundation; either version 2 of the
|
|
License, or (at your option) any later version.
|
|
|
|
The GNU C Library 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
|
|
Library General Public License for more details.
|
|
|
|
You should have received a copy of the GNU Library General Public
|
|
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
|
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
Boston, MA 02111-1307, USA. */
|
|
|
|
#include <string.h>
|
|
#include <ldsodefs.h>
|
|
|
|
extern char **_environ;
|
|
|
|
/* Walk through the environment of the process and return all entries
|
|
starting with `LD_'. */
|
|
char *
|
|
internal_function
|
|
_dl_next_ld_env_entry (char ***position)
|
|
{
|
|
char **current = *position;
|
|
char *result = NULL;
|
|
|
|
if (current == NULL)
|
|
/* We start over. */
|
|
current = _environ;
|
|
|
|
while (result == NULL && *current != NULL)
|
|
{
|
|
if ((*current)[0] == 'L' && (*current)[1] == 'D' && (*current)[2] == '_')
|
|
result = *current;
|
|
|
|
++current;
|
|
}
|
|
|
|
/* Save current position for next visit. */
|
|
*position = current;
|
|
|
|
return result;
|
|
}
|
|
|
|
void
|
|
unsetenv (const char *name)
|
|
{
|
|
const size_t len = strlen (name);
|
|
char **ep;
|
|
|
|
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;
|
|
}
|