about summary refs log tree commit diff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1997-09-21 01:47:02 +0000
committerUlrich Drepper <drepper@redhat.com>1997-09-21 01:47:02 +0000
commit2604afb1b2d9acc3c70b1214285f996200bf0358 (patch)
treeba59d75147565b8ab19686d98cee368d8ec697fc
parent4547c1a410fbc3ab5592a68bac1661135d91983f (diff)
downloadglibc-2604afb1b2d9acc3c70b1214285f996200bf0358.tar.gz
glibc-2604afb1b2d9acc3c70b1214285f996200bf0358.tar.xz
glibc-2604afb1b2d9acc3c70b1214285f996200bf0358.zip
1997-09-21 03:19  Ulrich Drepper  <drepper@cygnus.com>

	* libio/libio.h: More libstdc++ cleanups.  Define _IO_USE_DTOA if
	_G_HAVE_PRINTF_FP is not defined.
	* libio/strops.c: Undo patch of 1997-07-08 02:18.  Must find a
	different solution for the problem.

	* misc/search.h [__USE_GNU]: Define comparison_fn_t.
	* stdlib/stdlib.h: Define comparison_fn_t only if __COMPAR_FN_T is
	not defined.
	Fix typo.  Pretty print inline functions.

	* sysdeps/i386/i486/string.h (__stpcpy_small): Increment __cp not cp.
	Patch by HJ Lu <hjl@gnu.ai.mit.edu>.

1997-09-20 16:45  Ulrich Drepper  <drepper@cygnus.com>

	* hesiod/hesiod.c (hesiod_init): Use __secure_getenv to get
	HES_DOMAIN environment variable.
	Suggested by Mark Kettenis <kettenis@phys.uva.nl>.

	* hesiod/README.hesiod: A bit of information about Hesiod and how
	to use it.  Written by Mark Kettenis <kettenis@phys.uva.nl>.

1997-09-20 05:15  Ulrich Drepper  <drepper@cygnus.com>

	* manual/maint.texi: Update requirement list.

	* io/ftw.h: Don't use parameter names from global namespace in
	prototypes.

	* stdlib/strtol.c: If used outside glibc handle broken systems
	which have character classification functions which are not 8-bit
	clean gracefully.  Patch by Bruno Haible <haible@ilog.fr>.

1997-09-19 21:42  David S. Miller  <davem@tanya.rutgers.edu>

	* sysdeps/unix/sysv/linux/sparc/sparc64/bits/types.h: ssize_t is
	a long long int.

1997-09-19 15:12  H.J. Lu  <hjl@gnu.ai.mit.edu>

	* posix/Makefile (test-srcs): New, set to globtest.

1997-09-20 00:24  Ulrich Drepper  <drepper@cygnus.com>

	* manual/filesys.texi: Document ftw, nftw and needed data types.

1997-09-19 12:53  H.J. Lu  <hjl@gnu.ai.mit.edu>

	* sysdeps/i386/i486/bits/string.h: Fix typo.

1997-09-19 14:11  Ulrich Drepper  <drepper@cygnus.com>

	* io/ftwtest.c (cb): Print level.
	* io/ftwtest-sh: Updated for ftwtest.c change.

	* string/argz.h (__argz_next): Cast NULL to char * to satisfy C++
	compilers.
	Reported by Mirko Streckenbach <mirko@ramz.ing.tu-bs.de>.

	* catgets/catgets.c (catopen): Correctly allocate string of nlspath.
	Reported by Charles C. Fu <ccwf@klab.caltech.edu>.

1997-09-18 13:30  Klaus Espenlaub  <kespenla@student.informatik.uni-ulm.de>

	* sysdeps/i386/init-first.c: Call __getopt_clean_environment with
	additional argument.
	* sysdeps/mach/hurd/i386/init-first.c: Likewise.
	* sysdeps/mach/hurd/mips/init-first.c: Likewise.
	* sysdeps/stub/init-first.c: Likewise.

1997-09-18 03:16  Ulrich Drepper  <drepper@cygnus.com>

	* manual/search.texi: Document lsearch, lfind, the hsearch and
	tsearch functions.

1997-09-18 00:04  Ulrich Drepper  <drepper@cygnus.com>

	* misc/hsearch_r.c (hsearch_r): Only return error for ENTER action
	if the table is full and we *really* have to enter a new entry.

1997-09-17 19:44  Ulrich Drepper  <drepper@cygnus.com>

	* sysdeps/sparc/sparc32/dl-machine.h (elf_machine_rela): Get rid
	of hack for handling flush opcode.
	Patch by Richard Henderson <rth@cygnus.com>.
-rw-r--r--ChangeLog88
-rw-r--r--INSTALL315
-rw-r--r--PROJECTS4
-rw-r--r--catgets/catgets.c3
-rw-r--r--hesiod/README.hesiod150
-rw-r--r--hesiod/hesiod.c2
-rw-r--r--io/ftw.h17
-rw-r--r--io/ftwtest-sh97
-rw-r--r--io/ftwtest.c2
-rw-r--r--libio/libio.h3
-rw-r--r--libio/strops.c4
-rw-r--r--manual/filesys.texi206
-rw-r--r--manual/maint.texi60
-rw-r--r--manual/search.texi366
-rw-r--r--misc/hsearch_r.c22
-rw-r--r--misc/search.h4
-rw-r--r--posix/Makefile1
-rw-r--r--stdlib/stdlib.h159
-rw-r--r--stdlib/strtol.c11
-rw-r--r--string/argz.h6
-rw-r--r--sysdeps/i386/i486/bits/string.h8
-rw-r--r--sysdeps/i386/init-first.c8
-rw-r--r--sysdeps/mach/hurd/i386/init-first.c20
-rw-r--r--sysdeps/mach/hurd/mips/init-first.c10
-rw-r--r--sysdeps/sparc/sparc32/dl-machine.h4
-rw-r--r--sysdeps/stub/init-first.c4
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc64/bits/types.h2
27 files changed, 1170 insertions, 406 deletions
diff --git a/ChangeLog b/ChangeLog
index 4dca6d8b91..6048b08796 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,91 @@
+1997-09-21 03:19  Ulrich Drepper  <drepper@cygnus.com>
+
+	* libio/libio.h: More libstdc++ cleanups.  Define _IO_USE_DTOA if
+	_G_HAVE_PRINTF_FP is not defined.
+	* libio/strops.c: Undo patch of 1997-07-08 02:18.  Must find a
+	different solution for the problem.
+
+	* misc/search.h [__USE_GNU]: Define comparison_fn_t.
+	* stdlib/stdlib.h: Define comparison_fn_t only if __COMPAR_FN_T is
+	not defined.
+	Fix typo.  Pretty print inline functions.
+
+	* sysdeps/i386/i486/string.h (__stpcpy_small): Increment __cp not cp.
+	Patch by HJ Lu <hjl@gnu.ai.mit.edu>.
+
+1997-09-20 16:45  Ulrich Drepper  <drepper@cygnus.com>
+
+	* hesiod/hesiod.c (hesiod_init): Use __secure_getenv to get
+	HES_DOMAIN environment variable.
+	Suggested by Mark Kettenis <kettenis@phys.uva.nl>.
+
+	* hesiod/README.hesiod: A bit of information about Hesiod and how
+	to use it.  Written by Mark Kettenis <kettenis@phys.uva.nl>.
+
+1997-09-20 05:15  Ulrich Drepper  <drepper@cygnus.com>
+
+	* manual/maint.texi: Update requirement list.
+
+	* io/ftw.h: Don't use parameter names from global namespace in
+	prototypes.
+
+	* stdlib/strtol.c: If used outside glibc handle broken systems
+	which have character classification functions which are not 8-bit
+	clean gracefully.  Patch by Bruno Haible <haible@ilog.fr>.
+
+1997-09-19 21:42  David S. Miller  <davem@tanya.rutgers.edu>
+
+	* sysdeps/unix/sysv/linux/sparc/sparc64/bits/types.h: ssize_t is
+	a long long int.
+
+1997-09-19 15:12  H.J. Lu  <hjl@gnu.ai.mit.edu>
+
+	* posix/Makefile (test-srcs): New, set to globtest.
+
+1997-09-20 00:24  Ulrich Drepper  <drepper@cygnus.com>
+
+	* manual/filesys.texi: Document ftw, nftw and needed data types.
+
+1997-09-19 12:53  H.J. Lu  <hjl@gnu.ai.mit.edu>
+
+	* sysdeps/i386/i486/bits/string.h: Fix typo.
+
+1997-09-19 14:11  Ulrich Drepper  <drepper@cygnus.com>
+
+	* io/ftwtest.c (cb): Print level.
+	* io/ftwtest-sh: Updated for ftwtest.c change.
+
+	* string/argz.h (__argz_next): Cast NULL to char * to satisfy C++
+	compilers.
+	Reported by Mirko Streckenbach <mirko@ramz.ing.tu-bs.de>.
+
+	* catgets/catgets.c (catopen): Correctly allocate string of nlspath.
+	Reported by Charles C. Fu <ccwf@klab.caltech.edu>.
+
+1997-09-18 13:30  Klaus Espenlaub  <kespenla@student.informatik.uni-ulm.de>
+
+	* sysdeps/i386/init-first.c: Call __getopt_clean_environment with
+	additional argument.
+	* sysdeps/mach/hurd/i386/init-first.c: Likewise.
+	* sysdeps/mach/hurd/mips/init-first.c: Likewise.
+	* sysdeps/stub/init-first.c: Likewise.
+
+1997-09-18 03:16  Ulrich Drepper  <drepper@cygnus.com>
+
+	* manual/search.texi: Document lsearch, lfind, the hsearch and
+	tsearch functions.
+
+1997-09-18 00:04  Ulrich Drepper  <drepper@cygnus.com>
+
+	* misc/hsearch_r.c (hsearch_r): Only return error for ENTER action
+	if the table is full and we *really* have to enter a new entry.
+
+1997-09-17 19:44  Ulrich Drepper  <drepper@cygnus.com>
+
+	* sysdeps/sparc/sparc32/dl-machine.h (elf_machine_rela): Get rid
+	of hack for handling flush opcode.
+	Patch by Richard Henderson <rth@cygnus.com>.
+
 1997-09-16 23:48  Ulrich Drepper  <drepper@cygnus.com>
 
 	* libio/fileops.c: Define __set_errno if necessary.
diff --git a/INSTALL b/INSTALL
index 889780433e..85fe1eb904 100644
--- a/INSTALL
+++ b/INSTALL
@@ -47,11 +47,13 @@ you run `configure':
 `--prefix=DIRECTORY'
      Install machine-independent data files in subdirectories of
      `DIRECTORY'.  (You can also set this in `configparms'; see below.)
+     The default is to install in `/usr/local'.
 
 `--exec-prefix=DIRECTORY'
      Install the library and other machine-dependent files in
      subdirectories of `DIRECTORY'.  (You can also set this in
-     `configparms'; see below.)
+     `configparms'; see below.)  The default is to use <prefix>/bin and
+     <prefix>/sbin.
 
 `--enable-shared'
 `--disable-shared'
@@ -76,23 +78,6 @@ you run `configure':
      static library is compiled with no optimization and full debugging
      information, and installed as `-lc_g'.
 
-`--enable-bounded'
-`--disable-bounded'
-     Enable or disable building of the C library with support for bounded
-     pointers.  To do this one need the enhanced version of the GNU CC
-     with can generate code for bounded pointers.  This version of the
-     C library is necessary to run code which is also compiled using the
-     enhanced gcc for debugging purposes.
-
-There are two more options:
-
-`--with-gmp'
-`--with-gettext'
-     These options are not of much use for the normal installer of the
-     GNU libc.  Only maintainers need this to get automatic updates of
-     the files from these packages in the GNU C library source tree.
-
-
    The simplest way to run `configure' is to do it in the directory
 that contains the library sources.  This prepares to build the library
 in that very directory.
@@ -127,7 +112,7 @@ and define in that file the parameters you want to specify.
 `configparms' should *not* be an edited copy of `Makeconfig'; specify
 only the parameters that you want to override.  To see how to set these
 parameters, find the section of `Makeconfig' that says "These are the
-configuration variables." Then for each parameter that you want to
+configuration variables."  Then for each parameter that you want to
 change, copy the definition from `Makeconfig' to your new `configparms'
 file, and change the value as appropriate for your system.
 
@@ -155,11 +140,15 @@ library facilities, type `make check'.  This will produce several files
 with names like `PROGRAM.out'.
 
    To format the `GNU C Library Reference Manual' for printing, type
-`make dvi'.
+`make dvi'.  You need a working TeX installation to do this.
 
    To install the library and its header files, and the Info files of
 the manual, type `make install'.  This will build things if necessary,
-before installing them.
+before installing them.  If you want to install the files in a different
+place than the one specified at configuration time you can specify a
+value for the Makefile variable `install_root' on the command line.
+This is useful to create chroot'ed environment or to prepare binary
+releases.
 
 Recommended Tools to Install the GNU C Library
 ----------------------------------------------
@@ -167,27 +156,57 @@ Recommended Tools to Install the GNU C Library
    We recommend installing the following GNU tools before attempting to
 build the GNU C library:
 
-   * `make' 3.75
+   * `make' 3.76.1
 
      You need the latest version of GNU `make'.  Modifying the GNU C
      Library to work with other `make' programs would be so hard that we
-     recommend you port GNU `make' instead.  *Really.* We recommend
-     version GNU `make' version 3.75 or later.
+     recommend you port GNU `make' instead.  *Really.*  We recommend
+     version GNU `make' version 3.75, 3.76.1 or later.  Version 3.76 is
+     known to have a bug which only shows up in big projects like GNU
+     `libc'.
 
-   * GCC 2.7.2.1
+   * GCC 2.7.2.3
 
      On most platforms, the GNU C library can only be compiled with the
      GNU C compiler.  We recommend GCC version 2.7.2 or later; earlier
      versions may have problems.
 
-   * `binutils' 2.7
+     On PowerPC, GCC versions dated earlier than 970904 are known not
+     to work (they crash), including 2.7.2.
+
+   * `binutils' 2.8.1
 
      Using the GNU `binutils' (assembler, linker, and related tools) is
      preferable when possible, and they are required to build an ELF
-     shared C library.  We recommend `binutils' version 2.7 or later;
+     shared C library.  We recommend `binutils' version 2.8.1 or later;
      earlier versions are known to have problems or to not support all
      architectures.
 
+   * `texinfo' 3.11
+
+     To correctly translate and install the Texinfo documentation you
+     need this version of the `texinfo' package.  Former versions did
+     not understand all the tags used in the document and also the
+     installation mechanisms for the info files was not present or
+     worked differently.
+
+     On some Debian Linux based systems the used `install-info' program
+     works differently.  Here you have to run make like this:
+
+          make INSTALL_INFO=/path/to/GNU/install-info install
+
+   If you change any configuration file you will need also
+
+   * `autoconf' 2.12
+
+and if you change any of the message translation files you will also
+need
+
+   * `GNU gettext' 0.10 or later
+
+If you upgrade your source tree using the patches made available you
+probably will need those package above in any case.
+
 Supported Configurations
 ------------------------
 
@@ -195,18 +214,16 @@ Supported Configurations
 following patterns:
 
      alpha-ANYTHING-linux
-     alpha-ANYTHING-linuxecoff
      iX86-ANYTHING-gnu
      iX86-ANYTHING-linux
      m68k-ANYTHING-linux
-     mips-ANYTHING-linux
-     sparc-ANYTHING-linux
      powerpc-ANYTHING-linux
 
-   Former versions of this library used to support the following
-configurations but the current status is unknown:
+   Former releases of this library (version 1.09.1 and perhaps earlier
+versions) used to run on the following configurations:
 
      alpha-dec-osf1
+     alpha-ANYTHING-linuxecoff
      iX86-ANYTHING-bsd4.3
      iX86-ANYTHING-isc2.2
      iX86-ANYTHING-isc3.N
@@ -228,6 +245,12 @@ configurations but the current status is unknown:
      sparc-sun-solaris2.N
      sparc-sun-sunos4.N
 
+   Since no one has volunteered to test and fix the above
+configurations, these are not supported at the moment.  It's expected
+that these don't work anymore.  Porting the library is not hard.  If
+you are interested in doing a port, please contact the glibc
+maintainers by sending electronic mail to <bug-glibc@prep.ai.mit.edu>.
+
    Each case of `iX86' can be `i386', `i486', `i586', or `i686'.  All
 of those configurations produce a library that can run on any of these
 processors.  The library will be optimized for the specified processor,
@@ -278,11 +301,11 @@ and `config.make' which are created by running `configure'; they will
 be in whatever directory was current when you ran `configure'.
 
    If you think you have found some way in which the GNU C library does
-not conform to the ANSI and POSIX standards (*note Standards and
+not conform to the ISO and POSIX standards (*note Standards and
 Portability::.), that is definitely a bug.  Report it!
 
-   Send bug reports to the Internet address `bug-glibc@prep.ai.mit.edu'
-or the UUCP path `mit-eddie!prep.ai.mit.edu!bug-glibc'.  If you have
+   Send bug reports to the Internet address <bug-glibc@prep.ai.mit.edu>
+or the UUCP path <mit-eddie!prep.ai.mit.edu!bug-glibc>.  If you have
 other problems with installation or use, please report those as well.
 
    If you are not sure how a function should behave, and this manual
@@ -290,8 +313,8 @@ doesn't tell you, that's a bug in the manual.  Report that too!  If the
 function's behavior disagrees with the manual, then either the library
 or the manual has a bug, so report the disagreement.  If you find any
 errors or omissions in this manual, please report them to the Internet
-address `bug-glibc-manual@prep.ai.mit.edu' or the UUCP path
-`mit-eddie!prep.ai.mit.edu!bug-glibc-manual'.
+address <bug-glibc-manual@prep.ai.mit.edu> or the UUCP path
+<mit-eddie!prep.ai.mit.edu!bug-glibc-manual>.
 
 Adding New Functions
 ====================
@@ -672,10 +695,11 @@ level of the `sysdeps' hierarchy.  This directory contains
 subdirectories (and subdirectory trees) for various Unix variants.
 
    The functions which are system calls in most Unix systems are
-automatically generated from the `syscalls.list' files for the appropriate
-archirecture.  The format of the syscalls.list files is quite easy: only
-a few informations are necessary line the system call name, the number of
-arguments and such.  The files are run through the C preprocessor.
+implemented in assembly code, which is generated automatically from
+specifications in the file `sysdeps/unix/syscalls.list'.  Some special
+system calls are implemented in files that are named with a suffix of
+`.S'; for example, `_exit.S'.  Files ending in `.S' are run through the
+C preprocessor before being fed to the assembler.
 
    These files all use a set of macros that should be defined in
 `sysdep.h'.  The `sysdep.h' file in `sysdeps/unix' partially defines
@@ -711,7 +735,7 @@ parts of the library were contributed or worked on by other people.
      related code were written by Michael J. Haertel.
 
    * Fast implementations of many of the string functions (`memcpy',
-     `strlen', etc.) were written by Torbjorn Granlund.
+     `strlen', etc.) were written by Torbj"orn Granlund.
 
    * The `tar.h' header file was written by David J. MacKenzie.
 
@@ -722,7 +746,7 @@ parts of the library were contributed or worked on by other people.
    * The DES encryption function `crypt' and related functions were
      contributed by Michael Glad.
 
-   * The `ftw' function was contributed by Ian Lance Taylor.
+   * The `ftw' and `nftw' function was contributed by Ulrich Drepper.
 
    * The startup code to support SunOS shared libraries was contributed
      by Tom Quinn.
@@ -749,7 +773,7 @@ parts of the library were contributed or worked on by other people.
      and the floating-point reading function used by `scanf', `strtod'
      and friends were written by Ulrich Drepper.  The multi-precision
      integer functions used in those functions are taken from GNU MP,
-     which was contributed by Torbjorn Granlund.
+     which was contributed by Torbj"orn Granlund.
 
    * The internationalization support in the library, and the support
      programs `locale' and `localedef', were written by Ulrich Drepper.
@@ -771,9 +795,9 @@ parts of the library were contributed or worked on by other people.
    * The port to Linux/m68k (`m68k-ANYTHING-linux') was contributed by
      Andreas Schwab.
 
-   * The ports to Linux/ARM (`arm-ANYTHING-linuxaout') and ARM standalone
-     (`arm-ANYTHING-none'), as well as parts of the IPv6 support code, were
-     contributed by Philip Blundell.
+   * The ports to Linux/ARM (`arm-ANYTHING-linuxaout') and ARM
+     standalone (`arm-ANYTHING-none'), as well as parts of the IPv6
+     support code, were contributed by Philip Blundell.
 
    * Richard Henderson contributed the ELF dynamic linking code and
      other support for the Alpha processor.
@@ -781,6 +805,12 @@ parts of the library were contributed or worked on by other people.
    * David Mosberger-Tang contributed the port to Linux/Alpha
      (`alpha-ANYTHING-linux').
 
+   * The port to Linux on PowerPC (`powerpc-ANYTHING-linux') was
+     contributed by Geoffrey Keating.
+
+   * Miles Bader wrote the argp argument-parsing package, and the
+     argz/envz interfaces.
+
    * Stephen R. van den Berg contributed a highly-optimized `strstr'
      function.
 
@@ -797,10 +827,9 @@ parts of the library were contributed or worked on by other people.
      platforms was written by Per Bothner and modified by Ulrich
      Drepper.
 
-   * Some of the Internet-related code (most of the `inet'
-     subdirectory) and several other miscellaneous functions and
-     header files have been included from 4.4 BSD with little or no
-     modification.
+   * The Internet-related code (most of the `inet' subdirectory) and
+     several other miscellaneous functions and header files have been
+     included from 4.4 BSD with little or no modification.
 
      All code incorporated from 4.4 BSD is under the following
      copyright:
@@ -851,7 +880,7 @@ parts of the library were contributed or worked on by other people.
      `rand' and `srand' functions, were written by Earl T. Cohen for
      the University of California at Berkeley and are copyrighted by the
      Regents of the University of California.  They have undergone minor
-     changes to fit into the GNU C library and to fit the ANSI C
+     changes to fit into the GNU C library and to fit the ISO C
      standard, but the functional code is Berkeley's.
 
    * The Internet resolver code is taken directly from BIND 4.9.5,
@@ -938,187 +967,7 @@ parts of the library were contributed or worked on by other people.
                 Carnegie Mellon University
                 Pittsburgh PA 15213-3890
 
-          or `Software.Distribution@CS.CMU.EDU' any improvements or
+          or <Software.Distribution@CS.CMU.EDU> any improvements or
           extensions that they make and grant Carnegie Mellon the
           rights to redistribute these changes.
 
-   * The `getaddrinfo' function is written by Craig Metz and it has the
-     following copyright:
-
-	The Inner Net License, Version 2.00
-	===================================
-
-	The author(s) grant permission for redistribution and use in source and
-	binary forms, with or without modification, of the software
-	and documentation provided that the following conditions are met:
-
-	0. If you receive a version of the software that is
-	   specifically labelled as not being for redistribution
-	   (check the version message and/or README), you are not
-	   permitted to redistribute that version of the software in
-	   any way or form.
-	1. All terms of the all other applicable copyrights and
-	   licenses must be followed.
-	2. Redistributions of source code must retain the authors'
-	   copyright notice(s), this list of conditions, and the
-	   following disclaimer.
-	3. Redistributions in binary form must reproduce the authors'
-	   copyright notice(s), this list of conditions, and the
-	   following disclaimer in the documentation and/or other
-	   materials provided with the distribution.
-	4. All advertising materials mentioning features or use of
-	   this software must display the following acknowledgement
-	   with the name(s) of the authors as specified in the
-	   copyright notice(s) substituted where indicated:
-
-	This product includes software developed by <name(s)>, The Inner
-	Net, and other contributors.
-
-	5. Neither the name(s) of the author(s) nor the names of its
-	   contributors may be used to endorse or promote products
-	   derived from this software without specific prior written
-	   permission.
-
-	THIS SOFTWARE IS PROVIDED BY ITS AUTHORS AND CONTRIBUTORS ``AS
-	IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-	LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
-	FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
-	SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
-	INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-	DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-	SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
-	OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-	LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-	(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
-	THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
-	OF SUCH DAMAGE.
-
-	If these license terms cause you a real problem, contact the author.
-+
-   * The `db' library is taken from the db-2.3.4 distribution by Sleepycat
-     Software, and is covered by the following terms:
-
-	/*-
-	 * @(#)LICENSE	10.4 (Sleepycat) 7/24/97
-	 */
-
-	The following are the copyrights and redistribution conditions
-	that apply to this copy of the DB software.  For a license to use,
-	redistribute or sell DB software under conditions other than those
-	described here, or to purchase support for this software, please
-	contact Sleepycat Software at one of the following addresses:
-
-		Sleepycat Software		db@sleepycat.com
-		394 E. Riding Dr.		+1-508-287-4781
-		Carlisle, MA 01741
-		USA
-
-	=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-	/*
-	 * Copyright (c) 1990, 1993, 1994, 1995, 1996, 1997
-	 *	Sleepycat Software.  All rights reserved.
-	 *
-	 * Redistribution and use in source and binary forms, with or without
-	 * modification, are permitted provided that the following conditions
-	 * are met:
-	 * 1. Redistributions of source code must retain the above copyright
-	 *    notice, this list of conditions and the following disclaimer.
-	 * 2. Redistributions in binary form must reproduce the above copyright
-	 *    notice, this list of conditions and the following disclaimer in
-	 *    the documentation and/or other materials provided with the
-	 *    distribution.
-	 * 3. Redistributions in any form must be accompanied by information on
-	 *    how to obtain complete source code for the DB software and any
-	 *    accompanying software that uses the DB software.  The source code
-	 *    must either be included in the distribution or be available for
-	 *    no more than the cost of distribution plus a nominal fee, and
-	 *    must be freely redistributable under reasonable conditions.  For
-	 *    an executable file, complete source code means the source code
-	 *    for all modules it contains.  It does not mean source code for
-	 *    modules or files that typically accompany the operating system
-	 *    on which the executable file runs, e.g., standard library
-	 *    modules or system header files.
-	 *
-	 * THIS SOFTWARE IS PROVIDED BY SLEEPYCAT SOFTWARE ``AS IS'' AND
-	 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
-	 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
-	 * PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL SLEEPYCAT
-	 * SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-	 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
-	 * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-	 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
-	 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
-	 * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
-	 * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-	 * SUCH DAMAGE.
-	 */
-	/*
-	 * Copyright (c) 1990, 1993, 1994, 1995
-	 *	The Regents of the University of California.  All rights
-	 *      reserved.
-	 *
-	 * Redistribution and use in source and binary forms, with or without
-	 * modification, are permitted provided that the following conditions
-	 * are met:
-	 * 1. Redistributions of source code must retain the above copyright
-	 *    notice, this list of conditions and the following disclaimer.
-	 * 2. Redistributions in binary form must reproduce the above copyright
-	 *    notice, this list of conditions and the following disclaimer in
-	 *    the documentation and/or other materials provided with the
-	 *    distribution.
-	 * 3. All advertising materials mentioning features or use of this
-	 *    software must display the following acknowledgement:
-	 *	This product includes software developed by the University of
-	 *	California, Berkeley and its contributors.
-	 * 4. Neither the name of the University nor the names of its
-	 *    contributors may be used to endorse or promote products derived
-	 *    from this software without specific prior written permission.
-	 *
-	 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS''
-	 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
-	 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
-	 * PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS
-	 * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-	 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-	 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
-	 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
-	 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-	 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
-	 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
-	 * THE POSSIBILITY OF SUCH DAMAGE.
-	 */
-	/*
-	 * Copyright (c) 1995, 1996
-	 *	The President and Fellows of Harvard University.  All rights
-	 *      reserved.
-	 *
-	 * Redistribution and use in source and binary forms, with or without
-	 * modification, are permitted provided that the following conditions
-	 * are met:
-	 * 1. Redistributions of source code must retain the above copyright
-	 *    notice, this list of conditions and the following disclaimer.
-	 * 2. Redistributions in binary form must reproduce the above copyright
-	 *    notice, this list of conditions and the following disclaimer in
-	 *    the documentation and/or other materials provided with the
-	 *    distribution.
-	 * 3. All advertising materials mentioning features or use of this
-	 *    software must display the following acknowledgement:
-	 *	This product includes software developed by Harvard University
-	 *	and its contributors.
-	 * 4. Neither the name of the University nor the names of its
-	 *    contributors may be used to endorse or promote products derived
- 	 *    from this software without specific prior written permission.
-	 *
-	 * THIS SOFTWARE IS PROVIDED BY HARVARD AND ITS CONTRIBUTORS ``AS IS''
-	 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
-	 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
-	 * PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL HARVARD OR
-	 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-	 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-	 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
-	 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
-	 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-	 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
-	 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-	 * POSSIBILITY OF SUCH DAMAGE.
-	 */
diff --git a/PROJECTS b/PROJECTS
index 0cff31ae35..d7291b8744 100644
--- a/PROJECTS
+++ b/PROJECTS
@@ -107,7 +107,3 @@ contact <bug-glibc@prep.ai.mit.edu>
 		int foo __P ((int, int, int, int));
 
      Blargh!
-
-[16] Write an nss_hesiod module.  The Hesiod daemon from the MIT Athena
-     project should be available.  The goal is to avoid the ugly NIS
-     emulation interface and contacting the daemon directly.
diff --git a/catgets/catgets.c b/catgets/catgets.c
index d5eefc9e08..ebfb2c54cc 100644
--- a/catgets/catgets.c
+++ b/catgets/catgets.c
@@ -94,8 +94,9 @@ catopen (const char *cat_name, int flag)
 	  nlspath = tmp;
 	}
       else
-	result->nlspath = __strdup (NLSPATH);
+	nlspath = NLSPATH;
 
+      result->nlspath = __strdup (NLSPATH);
       if (result->nlspath == NULL)
 	{
 	  free ((void *) result->cat_name);
diff --git a/hesiod/README.hesiod b/hesiod/README.hesiod
new file mode 100644
index 0000000000..914e0d1bd9
--- /dev/null
+++ b/hesiod/README.hesiod
@@ -0,0 +1,150 @@
+The GNU C library contains an NSS module for the Hesiod name service.
+Hesiod is a general name service for a variety of applications and is
+based on the Berkeley Internet Name Daemon (BIND).
+
+Introduction
+============
+
+The Hesiod NSS module implements access to all relevant standard
+Hesiod types, which means that Hesiod can be used for the `group',
+`passwd' and `services' databases.  There is however a restriction.
+In the same way that it is impossible to use `gethostent()' to iterate
+over all the data provided by DNS, it is not possible to scan the
+entire Hesiod database by means of `getgrent()', `getpwent()' and
+`getservent()'.  Besides, Hesiod only provides support for looking up
+services by name and not for looking them up by port.  In essence this
+means that the Hesiod name service is only consulted as a result of
+one of the following function calls:
+
+  * getgrname(), getgrgid()
+  * getpwname(), getpwuid()
+  * getservbyname()
+
+and their reentrant counterparts.
+
+
+Configuring your systems
+========================
+
+Configuring your systems to make use use the Hesiod name service
+requires one or more of the following steps, depending on whether you
+are already running Hesiod in your network.
+
+Configuring NSS
+---------------
+
+First you should modify the file `/etc/nsswitch.conf' to tell
+NSS for which database you want to use the Hesiod name service.  If
+you want to use Hesiod for all databases it can handle your
+configuration file could look like this:
+
+  # /etc/nsswitch.conf
+  #
+  # Example configuration of GNU Name Service Switch functionality.
+  #
+
+  passwd:	  db files hesiod
+  group:	  db files hesiod
+  shadow:	  db files
+
+  hosts:	  files dns
+  networks:	  files dns
+
+  protocols:	  db files
+  services:	  db files hesiod
+  ethers:	  db files
+  rpc:		  db files
+
+For more information on NSS, please refer to the `The GNU C Library
+Reference Manual'.
+
+
+Configuring Hesiod
+------------------
+
+Next, you will have to configure Hesiod.  If you are already running
+Hesiod in your network, you probably already have a file named
+`hesiod.conf' on your machines (probably as `/etc/hesiod.conf' or
+`/usr/local/etc/hesiod.conf').  The Hesiod NSS module expects this
+file to be found in the sysconfdir (`/usr/local/etc/hesiod.conf' by
+default, see the installation notes on how to change this) or in the
+location specified by the environment variable `HESIOD_CONFIG'.  If
+there is no configuration file you will want to create your own.  It
+should look something like:
+
+  rhs=.your.domain
+  lhs=.ns
+
+The value of rhs can be overridden by the environment variable
+HES_DOMAIN.
+
+Configuring your name servers
+-----------------------------
+
+In addition, if you are not already running Hesiod in your network,
+you need to create Hesiod information on your central name servers.
+You need to run `named' from BIND 4.9 or higher on these servers, and
+make them authoritative for the domain `ns.your.domain' with a line in
+`/etc/named.boot' reading something like:
+
+  primary         ns.your.domain          named.hesiod
+
+or if you are using the new BIND 8.1 or higher add something to
+`/etc/named.conf' like:
+
+  zone "ns.your.domain" {
+          type master;
+          file "named.hesiod";
+  };
+
+Then in the BIND working directory (usually `/var/named') create the
+file `named.hesiod' containing data that looks something like:
+
+  ; SOA and NS records.
+  @       IN      SOA     server1.your.domain admin-address.your.domain (
+                  40000           ; serial - database version number
+                  1800            ; refresh - sec servers
+                  300             ; retry - for refresh
+                  3600000         ; expire - unrefreshed data
+                  7200 )          ; min
+                  NS      server1.your.domain
+                  NS      server2.your.domain
+
+  ; Actual Hesiod data.
+  libc.group      TXT     "libc:*:123:gnu,gnat"
+  123.gid         CNAME   libc.group
+  gnu.passwd      TXT     "gnu:*:4567:123:GNU:/home/gnu:/bin/bash"
+  456.uid         CNAME   mark.passwd
+  nss.service     TXT     "nss;tcp;789;switch sw "
+  nss.service     TXT     "nss;udp;789;switch sw"
+
+where `libc' is an example of a group, `gnu' an example of an user,
+and `nss' an example of a service.  Note that the format used to
+describe services differs from the format used in `/etc/services'.
+For more information on `named' refer to the `Name Server Operations
+Guide for BIND' that is included in the BIND distribution.
+
+
+Security
+========
+
+Note that the information stored in the Hesiod database in principle
+is publicly available.  Care should be taken with including vulnerable
+information like encrypted passwords in the Hesiod database.  There
+are some ways to improve security by using features provided by
+`named' (see the discussion about `secure zones' in the BIND
+documentation), but one should keep in mind that Hesiod was never
+intended to distribute passwords.  In the origional design
+authenticating users was the job of the Kerberos service.
+
+
+More information
+================
+
+For more information on the Hesiod name service take a look at some of
+the papers in ftp://athena-dist.mit.edu:/pub/ATHENA/usenix and the
+documentation that accompanies the source code for the Hesiod name
+service library in ftp://athena-dist.mit.edu:/pub/ATHENA/hesiod.
+
+There is a mailing list at MIT for Hesiod users, hesiod@mit.edu.  To
+get yourself on or off the list, send mail to hesiod-request@mit.edu.
diff --git a/hesiod/hesiod.c b/hesiod/hesiod.c
index 076b6e7dbc..46ae9a988c 100644
--- a/hesiod/hesiod.c
+++ b/hesiod/hesiod.c
@@ -89,7 +89,7 @@ int hesiod_init(void **context)
       if (read_config_file(ctx, configname) >= 0)
 	{
 	  /* The default rhs can be overridden by an environment variable. */
-	  p = getenv("HES_DOMAIN");
+	  p = __secure_getenv("HES_DOMAIN");
 	  if (p)
 	    {
 	      if (ctx->rhs)
diff --git a/io/ftw.h b/io/ftw.h
index d788b39d16..d377f2c947 100644
--- a/io/ftw.h
+++ b/io/ftw.h
@@ -86,22 +86,23 @@ struct FTW
 
 
 /* Convenient types for callback functions.  */
-typedef int (*__ftw_func_t) __P ((__const char *filename,
-				  __const struct stat *status, int flag));
+typedef int (*__ftw_func_t) __P ((__const char *__filename,
+				  __const struct stat *__status, int __flag));
 #ifdef __USE_XOPEN_EXTENDED
-typedef int (*__nftw_func_t) __P ((__const char *filename,
-				   __const struct stat *status, int flag,
-				   struct FTW *));
+typedef int (*__nftw_func_t) __P ((__const char *__filename,
+				   __const struct stat *__status, int __flag,
+				   struct FTW *__info));
 #endif
 
 /* Call a function on every element in a directory tree.  */
-extern int ftw __P ((__const char *dir, __ftw_func_t func, int descriptors));
+extern int ftw __P ((__const char *__dir, __ftw_func_t __func,
+		     int __descriptors));
 
 #ifdef __USE_XOPEN_EXTENDED
 /* Call a function on every element in a directory tree.  FLAG allows
    to specify the behaviour more detailed.  */
-extern int nftw __P ((__const char *dir, __nftw_func_t func,
-		      int descriptors, int flag));
+extern int nftw __P ((__const char *__dir, __nftw_func_t __func,
+		      int __descriptors, int __flag));
 #endif
 
 __END_DECLS
diff --git a/io/ftwtest-sh b/io/ftwtest-sh
index 79c35d4f9c..f0cd56ab02 100644
--- a/io/ftwtest-sh
+++ b/io/ftwtest-sh
@@ -46,18 +46,18 @@ LD_LIBRARY_PATH=$objpfx $ldso $testprogram $tmpdir |
     sort > $testout
 
 cat <<EOF | cmp $testout - || exit 1
-base = "$tmp/", file = "ftwtest.d", flag = FTW_D
-base = "$tmp/ftwtest.d/", file = "bar", flag = FTW_D
-base = "$tmp/ftwtest.d/", file = "baz", flag = FTW_F
-base = "$tmp/ftwtest.d/", file = "foo", flag = FTW_D
-base = "$tmp/ftwtest.d/bar/", file = "xo", flag = FTW_NS
-base = "$tmp/ftwtest.d/foo/", file = "lvl1", flag = FTW_D
-base = "$tmp/ftwtest.d/foo/lvl1/", file = "file@1", flag = FTW_F
-base = "$tmp/ftwtest.d/foo/lvl1/", file = "link@1", flag = FTW_SLN
-base = "$tmp/ftwtest.d/foo/lvl1/", file = "lvl2", flag = FTW_D
-base = "$tmp/ftwtest.d/foo/lvl1/lvl2/", file = "file@2", flag = FTW_F
-base = "$tmp/ftwtest.d/foo/lvl1/lvl2/", file = "lvl3", flag = FTW_D
-base = "$tmp/ftwtest.d/foo/lvl1/lvl2/lvl3/", file = "file@3", flag = FTW_F
+base = "/tmp/", file = "ftwtest.d", flag = FTW_D, level = 0
+base = "/tmp/ftwtest.d/", file = "bar", flag = FTW_D, level = 1
+base = "/tmp/ftwtest.d/", file = "baz", flag = FTW_F, level = 1
+base = "/tmp/ftwtest.d/", file = "foo", flag = FTW_D, level = 1
+base = "/tmp/ftwtest.d/bar/", file = "xo", flag = FTW_NS, level = 2
+base = "/tmp/ftwtest.d/foo/", file = "lvl1", flag = FTW_D, level = 2
+base = "/tmp/ftwtest.d/foo/lvl1/", file = "file@1", flag = FTW_F, level = 3
+base = "/tmp/ftwtest.d/foo/lvl1/", file = "link@1", flag = FTW_SLN, level = 3
+base = "/tmp/ftwtest.d/foo/lvl1/", file = "lvl2", flag = FTW_D, level = 3
+base = "/tmp/ftwtest.d/foo/lvl1/lvl2/", file = "file@2", flag = FTW_F, level = 4
+base = "/tmp/ftwtest.d/foo/lvl1/lvl2/", file = "lvl3", flag = FTW_D, level = 4
+base = "/tmp/ftwtest.d/foo/lvl1/lvl2/lvl3/", file = "file@3", flag = FTW_F, level = 5
 EOF
 rm $testout
 
@@ -65,18 +65,18 @@ LD_LIBRARY_PATH=$objpfx $ldso $testprogram --depth $tmpdir |
     sort > $testout
 
 cat <<EOF | cmp $testout - || exit 1
-base = "$tmp/", file = "ftwtest.d", flag = FTW_DP
-base = "$tmp/ftwtest.d/", file = "bar", flag = FTW_DP
-base = "$tmp/ftwtest.d/", file = "baz", flag = FTW_F
-base = "$tmp/ftwtest.d/", file = "foo", flag = FTW_DP
-base = "$tmp/ftwtest.d/bar/", file = "xo", flag = FTW_NS
-base = "$tmp/ftwtest.d/foo/", file = "lvl1", flag = FTW_DP
-base = "$tmp/ftwtest.d/foo/lvl1/", file = "file@1", flag = FTW_F
-base = "$tmp/ftwtest.d/foo/lvl1/", file = "link@1", flag = FTW_SLN
-base = "$tmp/ftwtest.d/foo/lvl1/", file = "lvl2", flag = FTW_DP
-base = "$tmp/ftwtest.d/foo/lvl1/lvl2/", file = "file@2", flag = FTW_F
-base = "$tmp/ftwtest.d/foo/lvl1/lvl2/", file = "lvl3", flag = FTW_DP
-base = "$tmp/ftwtest.d/foo/lvl1/lvl2/lvl3/", file = "file@3", flag = FTW_F
+base = "/tmp/", file = "ftwtest.d", flag = FTW_DP, level = 0
+base = "/tmp/ftwtest.d/", file = "bar", flag = FTW_DP, level = 1
+base = "/tmp/ftwtest.d/", file = "baz", flag = FTW_F, level = 1
+base = "/tmp/ftwtest.d/", file = "foo", flag = FTW_DP, level = 1
+base = "/tmp/ftwtest.d/bar/", file = "xo", flag = FTW_NS, level = 2
+base = "/tmp/ftwtest.d/foo/", file = "lvl1", flag = FTW_DP, level = 2
+base = "/tmp/ftwtest.d/foo/lvl1/", file = "file@1", flag = FTW_F, level = 3
+base = "/tmp/ftwtest.d/foo/lvl1/", file = "link@1", flag = FTW_SLN, level = 3
+base = "/tmp/ftwtest.d/foo/lvl1/", file = "lvl2", flag = FTW_DP, level = 3
+base = "/tmp/ftwtest.d/foo/lvl1/lvl2/", file = "file@2", flag = FTW_F, level = 4
+base = "/tmp/ftwtest.d/foo/lvl1/lvl2/", file = "lvl3", flag = FTW_DP, level = 4
+base = "/tmp/ftwtest.d/foo/lvl1/lvl2/lvl3/", file = "file@3", flag = FTW_F, level = 5
 EOF
 rm $testout
 
@@ -84,24 +84,45 @@ LD_LIBRARY_PATH=$objpfx $ldso $testprogram --phys $tmpdir |
     sort > $testout
 
 cat <<EOF | cmp $testout - || exit 1
-base = "$tmp/", file = "ftwtest.d", flag = FTW_D
-base = "$tmp/ftwtest.d/", file = "bar", flag = FTW_D
-base = "$tmp/ftwtest.d/", file = "baz", flag = FTW_F
-base = "$tmp/ftwtest.d/", file = "foo", flag = FTW_D
-base = "$tmp/ftwtest.d/bar/", file = "xo", flag = FTW_NS
-base = "$tmp/ftwtest.d/foo/", file = "lvl1", flag = FTW_D
-base = "$tmp/ftwtest.d/foo/lvl1/", file = "file@1", flag = FTW_F
-base = "$tmp/ftwtest.d/foo/lvl1/", file = "link@1", flag = FTW_SL
-base = "$tmp/ftwtest.d/foo/lvl1/", file = "lvl2", flag = FTW_D
-base = "$tmp/ftwtest.d/foo/lvl1/lvl2/", file = "file@2", flag = FTW_F
-base = "$tmp/ftwtest.d/foo/lvl1/lvl2/", file = "link@2", flag = FTW_SL
-base = "$tmp/ftwtest.d/foo/lvl1/lvl2/", file = "lvl3", flag = FTW_D
-base = "$tmp/ftwtest.d/foo/lvl1/lvl2/lvl3/", file = "file@3", flag = FTW_F
-base = "$tmp/ftwtest.d/foo/lvl1/lvl2/lvl3/", file = "link@3", flag = FTW_SL
+base = "/tmp/", file = "ftwtest.d", flag = FTW_D, level = 0
+base = "/tmp/ftwtest.d/", file = "bar", flag = FTW_D, level = 1
+base = "/tmp/ftwtest.d/", file = "baz", flag = FTW_F, level = 1
+base = "/tmp/ftwtest.d/", file = "foo", flag = FTW_D, level = 1
+base = "/tmp/ftwtest.d/bar/", file = "xo", flag = FTW_NS, level = 2
+base = "/tmp/ftwtest.d/foo/", file = "lvl1", flag = FTW_D, level = 2
+base = "/tmp/ftwtest.d/foo/lvl1/", file = "file@1", flag = FTW_F, level = 3
+base = "/tmp/ftwtest.d/foo/lvl1/", file = "link@1", flag = FTW_SL, level = 3
+base = "/tmp/ftwtest.d/foo/lvl1/", file = "lvl2", flag = FTW_D, level = 3
+base = "/tmp/ftwtest.d/foo/lvl1/lvl2/", file = "file@2", flag = FTW_F, level = 4
+base = "/tmp/ftwtest.d/foo/lvl1/lvl2/", file = "link@2", flag = FTW_SL, level = 4
+base = "/tmp/ftwtest.d/foo/lvl1/lvl2/", file = "lvl3", flag = FTW_D, level = 4
+base = "/tmp/ftwtest.d/foo/lvl1/lvl2/lvl3/", file = "file@3", flag = FTW_F, level = 5
+base = "/tmp/ftwtest.d/foo/lvl1/lvl2/lvl3/", file = "link@3", flag = FTW_SL, level = 5
 EOF
 rm $testout
 
+# For the next test everything must be readable.
 chmod -R a+x $tmpdir
+
+LD_LIBRARY_PATH=$objpfx $ldso $testprogram --chdir $tmpdir |
+    sort > $testout
+
+cat <<EOF | cmp $testout - || exit 1
+base = "/tmp/", file = "ftwtest.d", flag = FTW_D, cwd = /tmp, level = 0
+base = "/tmp/ftwtest.d/", file = "bar", flag = FTW_D, cwd = /tmp/ftwtest.d, level = 1
+base = "/tmp/ftwtest.d/", file = "baz", flag = FTW_F, cwd = /tmp/ftwtest.d, level = 1
+base = "/tmp/ftwtest.d/", file = "foo", flag = FTW_D, cwd = /tmp/ftwtest.d, level = 1
+base = "/tmp/ftwtest.d/bar/", file = "xo", flag = FTW_F, cwd = /tmp/ftwtest.d/bar, level = 2
+base = "/tmp/ftwtest.d/foo/", file = "lvl1", flag = FTW_D, cwd = /tmp/ftwtest.d/foo, level = 2
+base = "/tmp/ftwtest.d/foo/lvl1/", file = "file@1", flag = FTW_F, cwd = /tmp/ftwtest.d/foo/lvl1, level = 3
+base = "/tmp/ftwtest.d/foo/lvl1/", file = "link@1", flag = FTW_SLN, cwd = /tmp/ftwtest.d/foo/lvl1, level = 3
+base = "/tmp/ftwtest.d/foo/lvl1/", file = "lvl2", flag = FTW_D, cwd = /tmp/ftwtest.d/foo/lvl1, level = 3
+base = "/tmp/ftwtest.d/foo/lvl1/lvl2/", file = "file@2", flag = FTW_F, cwd = /tmp/ftwtest.d/foo/lvl1/lvl2, level = 4
+base = "/tmp/ftwtest.d/foo/lvl1/lvl2/", file = "lvl3", flag = FTW_D, cwd = /tmp/ftwtest.d/foo/lvl1/lvl2, level = 4
+base = "/tmp/ftwtest.d/foo/lvl1/lvl2/lvl3/", file = "file@3", flag = FTW_F, cwd = /tmp/ftwtest.d/foo/lvl1/lvl2/lvl3, level = 5
+EOF
+rm $testout
+
 rm -fr $tmpdir
 
 exit 0
diff --git a/io/ftwtest.c b/io/ftwtest.c
index 6daa7e9eee..6079265175 100644
--- a/io/ftwtest.c
+++ b/io/ftwtest.c
@@ -42,7 +42,7 @@ cb (const char *name, const struct stat *st, int flag, struct FTW *f)
       printf (", cwd = %s", cwd);
       free (cwd);
     }
-  puts ("");
+  printf (", level = %d\n", f->level);
   return 0;
 }
 
diff --git a/libio/libio.h b/libio/libio.h
index 03b2afdf28..9e8c108af6 100644
--- a/libio/libio.h
+++ b/libio/libio.h
@@ -72,6 +72,9 @@
 # define const
 #endif
 #define _IO_UNIFIED_JUMPTABLES 1
+#ifndef _G_HAVE_PRINTF_FP
+# define _IO_USE_DTOA 1
+#endif
 
 #if 0
 # ifdef _IO_NEED_STDARG_H
diff --git a/libio/strops.c b/libio/strops.c
index f7c22627e7..a9f812e045 100644
--- a/libio/strops.c
+++ b/libio/strops.c
@@ -200,8 +200,8 @@ _IO_ssize_t
 _IO_str_count (fp)
      _IO_FILE *fp;
 {
-  return ((fp->_IO_write_end > fp->_IO_read_end
-	   ? fp->_IO_write_end : fp->_IO_read_end)
+  return ((fp->_IO_write_ptr > fp->_IO_read_end
+	   ? fp->_IO_write_ptr : fp->_IO_read_end)
 	  - fp->_IO_read_base);
 }
 
diff --git a/manual/filesys.texi b/manual/filesys.texi
index 5ddd8a20a7..7e8a1a12d2 100644
--- a/manual/filesys.texi
+++ b/manual/filesys.texi
@@ -17,6 +17,8 @@ access permissions and modification times.
 				 file names.
 * Accessing Directories::       Finding out what files a directory
 				 contains.
+* Working on Directory Trees::  Apply actions to all files or a selectable
+                                 subset of a directory hierachy.
 * Hard Links::                  Adding alternate names to a file.
 * Symbolic Links::              A file that ``points to'' a file name.
 * Deleting Files::              How to delete a file, and what that means.
@@ -500,6 +502,210 @@ Please note the simple selector function for this example.  Since
 we want to see all directory entries we always return @code{1}.
 
 
+@node Working on Directory Trees
+@section Working on Directory Trees
+@cindex directory hierachy
+@cindex hierachy, directory
+@cindex tree, directory
+
+The functions to handle files in directories described so far allowed to
+retrieve all the information in small pieces or process all files in a
+directory (see @code{scandir}).  Sometimes it is useful to process whole
+hierachies of directories and the contained files.  The X/Open
+specification define two functions to do this.  The simpler form is
+derived from an early definition in @w{System V} systems and therefore
+this function is available on SVID derived systems.  The prototypes and
+required definitions can be found in the @file{ftw.h} header.
+
+Both functions of this @code{ftw} family take as one of the arguments a
+reference to a callback function.  The functions must be of these types.
+
+@deftp {Data Type} __ftw_func_t
+
+@smallexample
+int (*) (const char *, const struct stat *, int)
+@end smallexample
+
+Type for callback functions given to the @code{ftw} function.  The first
+parameter will contain a pointer to the filename, the second parameter
+will point to an object of type @code{struct stat} which will be filled
+for the file named by the first parameter.
+
+@noindent
+The last parameter is a flag given more information about the current
+file.  It can have the following values:
+
+@vindex FTW_F
+@vindex FTW_D
+@vindex FTW_NS
+@vindex FTW_DNR
+@vindex FTW_SL
+@table @code
+@item FTW_F
+The current item is a normal file or files which do not fit into one of
+the following categories.  This means especially special files, sockets
+etc.
+@item FTW_D
+The current item is a directory.
+@item FTW_NS
+The @code{stat} call to fill the object pointed to by the second
+parameter failed and so the information is invalid.
+@item FTW_DNR
+The item is a directory which cannot be read.
+@item FTW_SL
+The item is a symbolic link.  Since symbolic links are normally followed
+seeing this value in a @code{ftw} callback function means the referenced
+file does not exist.  The situation for @code{nftw} is different.
+
+This value is only available if the program is compiled with
+@code{_BSD_SOURCE} or @code{_XOPEN_EXTENDED} defined before including
+the first header.  The original SVID systems do not have symbolic links.
+@end table
+@end deftp
+
+@deftp {Data Type} __nftw_func_t
+
+@smallexample
+int (*) (const char *, const struct stat *, int, struct FTW *)
+@end smallexample
+
+@vindex FTW_DP
+@vindex FTW_SLN
+The first three arguments have the same as for the @code{__ftw_func_t}
+type.  A difference is that for the third argument some additional
+values are defined to allow finer differentiation:
+@table @code
+@item FTW_DP
+The current item is a directory and all subdirectories have already been
+visited and reported.  This flag is returned instead of @code{FTW_D} if
+the @code{FTW_DEPTH} flag is given to @code{nftw} (see below).
+@item FTW_SLN
+The current item is a stale symbolic link.  The file it points to does
+not exist.
+@end table
+
+The last parameter of the callback function is a pointer to a structure
+with some extra information as described below.
+@end deftp
+
+@deftp {Data Type} {struct FTW}
+The contained information helps to interpret the name parameter and
+gives some information about current state of the traversal of the
+directory hierachy.
+
+@table @code
+@item int base
+The value specifies which part of the filename argument given in the
+first parameter to the callback function is the name of the file.  The
+rest of the string is the path to locate the file.  This information is
+especially important if the @code{FTW_CHDIR} flag for @code{nftw} was
+set since then the current directory is the one the current item is
+found in.
+@item int level
+While processing the directory the functions tracks how many directories
+have been examine to find the current item.  This nesting level is
+@math{0} for the item given starting item (file or directory) and is
+incremented by one for each entered directory.
+@end table
+@end deftp
+
+
+@comment ftw.h
+@comment SVID
+@deftypefun int ftw (const char *@var{filename}, __ftw_func_t @var{func}, int @var{descriptors})
+The @code{ftw} function calls the callback function given in the
+parameter @var{func} for every item which is found in the directory
+specified by @var{filename} and all directories below.  The function
+follows symbolic links if necessary but does not process an item twice.
+If @var{filename} names no directory this item is the only object
+reported by calling the callback function.
+
+The filename given to the callback function is constructed by taking the
+@var{filename} parameter and appending the names of all passed
+directories and then the local file name.  So the callback function can
+use this parameter to access the file.  Before the callback function is
+called @code{ftw} calls @code{stat} for this file and passes the
+information up to the callback function.  If this @code{stat} call was
+not successful the failure is indicated by setting the falg argument of
+the callback function to @code{FTW_NS}.  Otherwise the flag is set
+according to the description given in the description of
+@code{__ftw_func_t} above.
+
+The callback function is expected to return @math{0} to indicate that no
+error occurred and the processing should be continued.  If an error
+occurred in the callback function or the call to @code{ftw} shall return
+immediately the callback function can return a value other than
+@math{0}.  This is the only correct way to stop the function.  The
+program must not use @code{setjmp} or similar techniques to continue the
+program in another place.  This would leave the resources allocated in
+the @code{ftw} function allocated.
+
+The @var{descriptors} parameter to the @code{ftw} function specifies how
+many file descriptors the @code{ftw} function is allowed to consume.
+The more descriptors can be used the faster the function can run.  For
+each level of directories at most one descriptor is used so that for
+very deep directory hierachies the limit on open file descriptors for
+the process or the system can be exceeded.  Beside this the limit on
+file descriptors is counted together for all threads in a multi-threaded
+program and therefore it is always good too limit the maximal number of
+open descriptors to a reasonable number.
+
+The return value of the @code{ftw} function is @math{0} if all callback
+function calls returned @math{0} and all actions performed by the
+@code{ftw} succeeded.  If some function call failed (other than calling
+@code{stat} on an item) the function return @math{-1}.  If a callback
+function returns a value other than @math{0} this value is returned as
+the return value of @code{ftw}.
+@end deftypefun
+
+@comment ftw.h
+@comment XPG4.2
+@deftypefun int nftw (const char *@var{filename}, __nftw_func_t @var{func}, int @var{descriptors}, int @var{flag})
+The @code{nftw} functions works like the @code{ftw} functions.  It calls
+the callback function @var{func} for all items it finds in the directory
+@var{filename} and below.  At most @var{descriptors} file descriptors
+are consumed during the @code{nftw} call.
+
+The differences are that for one the callback function is of a different
+type.  It is of type @w{@code{struct FTW *}} and provides the callback
+functions the information described above.
+
+The second difference is that @code{nftw} takes an additional fourth
+argument which is @math{0} or a combination of any of the following
+values, combined using bitwise OR.
+
+@table @code
+@item FTW_PHYS
+While traversing the directory symbolic links are not followed.  I.e.,
+if this flag is given symbolic links are reported using the
+@code{FTW_SL} value for the type parameter to the callback function.
+Please note that if this flag is used the appearence of @code{FTW_SL} in
+a callback function does not mean the referenced file does not exist.
+To indicate this the extra value @code{FTW_SLN} exists.
+@item FTW_MOUNT
+The callback function is only called for items which are on the same
+mounted filesystem as the directory given as the @var{filename}
+parameter to @code{nftw}.
+@item FTW_CHDIR
+If this flag is given the current working directory is changed to the
+directory containing the reported object before the callback function is
+called.
+@item FTW_DEPTH
+If this option is given the function visits first all files and
+subdirectories before the callback function is called for the directory
+itself (depth-first processing).  This also means the type flag given to
+the callback function is @code{FTW_DP} and not @code{FTW_D}.
+@end table
+
+The return value is computed in the same way as for @code{ftw}.
+@code{nftw} return @math{0} if no failure occurred in @code{nftw} and
+all callback function call return values are also @math{0}.  For
+internal errors such as memory problems @math{-1} is returned and
+@var{errno} is set accordingly.  If the return value of a callback
+invocation is nonzero this very same value is returned.
+@end deftypefun
+
+
 @node Hard Links
 @section Hard Links
 @cindex hard link
diff --git a/manual/maint.texi b/manual/maint.texi
index 3675c4faba..d8e835f441 100644
--- a/manual/maint.texi
+++ b/manual/maint.texi
@@ -176,11 +176,15 @@ facilities, type @code{make check}.  This will produce several files
 with names like @file{@var{program}.out}.
 
 To format the @cite{GNU C Library Reference Manual} for printing, type
-@w{@code{make dvi}}.
+@w{@code{make dvi}}.  You need a working @TeX{} installation to do this.
 
 To install the library and its header files, and the Info files of the
 manual, type @code{make install}.  This will build things if necessary,
-before installing them.@refill
+before installing them.  If you want to install the files in a different
+place than the one specified at configuration time you can specify a
+value for the Makefile variable @code{install_root} on the command line.
+This is useful to create chroot'ed environment or to prepare binary
+releases.@refill
 
 @node Tools for Installation
 @appendixsubsec Recommended Tools to Install the GNU C Library
@@ -192,15 +196,17 @@ build the GNU C library:
 
 @itemize @bullet
 @item
-@code{make} 3.75
+@code{make} 3.76.1
 
 You need the latest version of GNU @code{make}.  Modifying the GNU C
 Library to work with other @code{make} programs would be so hard that we
-recommend you port GNU @code{make} instead.  @strong{Really.}
-We recommend version GNU @code{make} version 3.75 or later.
+recommend you port GNU @code{make} instead.  @strong{Really.}  We
+recommend version GNU @code{make} version 3.75, 3.76.1 or later.
+Version 3.76 is known to have a bug which only shows up in big projects
+like GNU @code{libc}.
 
 @item
-GCC 2.7.2
+GCC 2.7.2.3
 
 On most platforms, the GNU C library can only be compiled with the GNU C
 compiler.  We recommend GCC version 2.7.2 or later; earlier versions may
@@ -216,8 +222,43 @@ Using the GNU @code{binutils} (assembler, linker, and related tools) is
 preferable when possible, and they are required to build an ELF shared C
 library.  We recommend @code{binutils} version 2.8.1 or later; earlier
 versions are known to have problems or to not support all architectures.
+
+@item
+@code{texinfo} 3.11
+
+To correctly translate and install the Texinfo documentation you need
+this version of the @code{texinfo} package.  Former versions did not
+understand all the tags used in the document and also the installation
+mechanisms for the info files was not present or worked differently.
+
+On some Debian Linux based systems the used @code{install-info} program
+works differently.  Here you have to run make like this:
+
+@smallexample
+make INSTALL_INFO=/path/to/GNU/install-info install
+@end smallexample
+@end itemize
+
+If you change any configuration file you will need also
+
+@itemize @bullet
+@item
+@code{autoconf} 2.12
 @end itemize
 
+@noindent
+and if you change any of the message translation files you will also need
+
+@itemize @bullet
+@item
+@code{GNU gettext} 0.10 or later
+@end itemize
+
+@noindent
+If you upgrade your source tree using the patches made available you probably
+will need those package above in any case.
+
+
 @node Supported Configurations
 @appendixsubsec Supported Configurations
 @cindex configurations, all supported
@@ -834,7 +875,7 @@ The DES encryption function @code{crypt} and related functions were
 contributed by Michael Glad.
 
 @item
-The @code{ftw} function was contributed by Ian Lance Taylor.
+The @code{ftw} and @code{nftw} function was contributed by Ulrich Drepper.
 
 @item
 The startup code to support SunOS shared libraries was contributed by
@@ -894,6 +935,11 @@ The port to Linux/m68k (@code{m68k-@var{anything}-linux}) was
 contributed by Andreas Schwab.
 
 @item
+The ports to Linux/ARM (@code{arm-@var{ANYTHING}-linuxaout}) and ARM
+standalone (@code{arm-@var{ANYTHING}-none}), as well as parts of the
+IPv6 support code, were contributed by Philip Blundell.
+
+@item
 Richard Henderson contributed the ELF dynamic linking code and other
 support for the Alpha processor.
 
diff --git a/manual/search.texi b/manual/search.texi
index abb93bb5a8..356d976555 100644
--- a/manual/search.texi
+++ b/manual/search.texi
@@ -14,9 +14,11 @@ and the total number of elements.
 * Array Search Function::       The @code{bsearch} function.
 * Array Sort Function::         The @code{qsort} function.
 * Search/Sort Example::         An example program.
+* Hash Search Function::        The @code{hsearch} function.
+* Tree Search Function::        The @code{tsearch} function.
 @end menu
 
-@node Comparison Functions, Array Search Function,  , Searching and Sorting
+@node Comparison Functions
 @section Defining the Comparison Function
 @cindex Comparison Function
 
@@ -52,12 +54,53 @@ comparison functions.  This type is a GNU extension.
 int comparison_fn_t (const void *, const void *);
 @end smallexample
 
-@node Array Search Function, Array Sort Function, Comparison Functions, Searching and Sorting
+@node Array Search Function
 @section Array Search Function
 @cindex search function (for arrays)
 @cindex binary search function (for arrays)
 @cindex array search function
 
+Generally searching for a specific element in an array means that
+potentially all elements must be checked.  The GNU C library contains
+functions to perform linear search.  The prototypes for the following
+two functions can be found in @file{search.h}.
+
+@comment search.h
+@comment SVID
+@deftypefun {void *} lfind (const void *@var{key}, void *@var{base}, size_t *@var{nmemb}, size_t @var{size}, comparison_fn_t @var{compar})
+The @code{lfind} function searches in the array with @code{*@var{nmemb}}
+elements of @var{size} bytes pointed to by @var{base} for an element
+which matches the one pointed to by @var{key}.  The function pointed to
+by @var{compar} is used decide whether two elements match.
+
+The return value is a pointer to the matching element in the array
+starting at @var{base} if it is found.  If no matching element is
+available @code{NULL} is returned.
+
+The mean runtime of this function is @code{*@var{nmemb}}/2.  This
+function should only be used elements often get added to or deleted from
+the array in which case it might not be useful to sort the array before
+searching.
+@end deftypefun
+
+@comment search.h
+@comment SVID
+@deftypefun {void *} lsearch (const void *@var{key}, void *@var{base}, size_t *@var{nmemb}, size_t @var{size}, comparison_fn_t @var{compar})
+The @code{lsearch} function is similar to the @code{lfind} function.  It
+searches the given array for an element and returns it if found.  The
+difference is that if no matching element is found the @code{lsearch}
+function adds the object pointed to by @var{key} (with a size of
+@var{size} bytes) at the end of the array and it increments the value of
+@code{*@var{nmemb}} to reflect this addition.
+
+This means for the caller that if it is not sure that the array contains
+the element one is searching for the memory allocated for the array
+starting at @var{base} must have room for at least @var{size} more
+bytes.  If one is sure the element is in the array it is better to use
+@code{lfind} so having more room in the array is always necessary when
+calling @code{lsearch}.
+@end deftypefun
+
 To search a sorted array for an element matching the key, use the
 @code{bsearch} function.  The prototype for this function is in
 the header file @file{stdlib.h}.
@@ -85,7 +128,7 @@ This function derives its name from the fact that it is implemented
 using the binary search algorithm.
 @end deftypefun
 
-@node Array Sort Function, Search/Sort Example, Array Search Function, Searching and Sorting
+@node Array Sort Function
 @section Array Sort Function
 @cindex sort function (for arrays)
 @cindex quick sort function (for arrays)
@@ -138,7 +181,7 @@ The @code{qsort} function derives its name from the fact that it was
 originally implemented using the ``quick sort'' algorithm.
 @end deftypefun
 
-@node Search/Sort Example,  , Array Sort Function, Searching and Sorting
+@node Search/Sort Example
 @section Searching and Sorting Example
 
 Here is an example showing the use of @code{qsort} and @code{bsearch}
@@ -191,3 +234,318 @@ Kermit, the frog
 Gonzo, the whatever
 Couldn't find Janice.
 @end smallexample
+
+
+@node Hash Search Function
+@section The @code{hsearch} function.
+
+The functions mentioned so far in this chapter are searching in a sorted
+or unsorted array.  There are other methods to organize information
+which later should be searched.  The costs of insert, delete and search
+differ.  One possible implementation is using hashing tables.
+
+@comment search.h
+@comment SVID
+@deftypefun int hcreate (size_t @var{nel})
+The @code{hcreate} function creates a hashing table which can contain at
+least @var{nel} elements.  There is no possibility to grow this table so
+it is necessary to choose the value for @var{nel} wisely.  The used
+methods to implement this function might make it necessary to make the
+number of elements in the hashing table larger than the expected maximal
+number of elements.  Hashing tables usually work inefficient if they are
+filled 80% or more.  The constant access time guaranteed by hashing can
+only be achieved if few collisions exist.  See Knuth's ``The Art of
+Computer Programming, Part 3: Searching and Sorting'' for more
+information.
+
+The weakest aspect of this function is that there can be at most one
+hashing table used throught the whole program.  The table is allocated
+in local memory out of control of the programmer.  As an extension the
+GNU C library provides an additional set of functions with an reentrant
+interface which provide a similar interface but which allow to keep
+arbitrary many hashing tables.
+
+It is possible to use more than one hashing table in the program run if
+the former table is first destroyed by a call to @code{hdestroy}.
+
+The function returns a non-zero value if successful.  If it return zero
+something went wrong.  This could either mean there is already a hashing
+table in use or the program runs out of memory.
+@end deftypefun
+
+@comment search.h
+@comment SVID
+@deftypefun void hdestroy (void)
+The @code{hdestroy} function can be used to free all the resources
+allocated in a previous call of @code{hcreate}.  After a call to this
+function it is again possible to call @code{hcreate} and allocate a new
+table with possibly different size.
+
+It is important to remember that the elements contained in the hashing
+table at the time @code{hdestroy} is called are @emph{not} freed by this
+function.  It is the responsibility of the program code to free those
+strings (if necessary at all).  Freeing all the element memory iss not
+possible without extra, separately kept information since there is no
+function to iterate through all available elements in the hashing table.
+If it is really necessary to free a table and all elements the
+programmer has to keep a list of all table elements and before calling
+@code{hdestroy} s/he has to free all element's data using this list.
+This is a very unpleasent mechanism and it also shows that this kind of
+hashing tables is mainly meant for tables which are created once and
+used until the end of the program run.
+@end deftypefun
+
+Entries of the hashing table and keys for the search are defined using
+this type:
+
+@deftp {Data type} {struct ENTRY}
+Both elements of this structure are pointers to zero-terminated strings.
+This is a limiting restriction of the functionality of the
+@code{hsearch} functions.  They can only be used for data sets which use
+the NUL character always and solely to terminate the records.  It is not
+possible to handle general binary data.
+
+@table @code
+@item char *key
+Pointer to a zero-terminated string of characters describing the key for
+the search or the element in the hashing table.
+@item char *data
+Pointer to a zero-terminated string of characters describing the data.
+If the functions will be called only for searching an existing entry
+this element might stay undefined since it is not used.
+@end table
+@end deftp
+
+@comment search.h
+@comment SVID
+@deftypefun {ENTRY *} hsearch (ENTRY @var{item}, ACTION @var{action})
+To search in a hashing table created using @code{hcreate} the
+@code{hsearch} function must be used.  This function can perform simple
+search for an element (if @var{action} has the @code{FIND}) or it can
+alternatively insert the key element into the hashing table, possibly
+replacing a previous value (if @var{action} is @code{ENTER}).
+
+The key is denoted by a pointer to an object of type @code{ENTRY}.  For
+locating the corresponding position in the hashing table only the
+@code{key} element of the structure is used.
+
+The return value depends on the @var{action} parameter value.  If it is
+@code{FIND} the value is a pointer to the matching element in the
+hashing table or @code{NULL} if no matching element exists.  If
+@var{action} is @code{ENTER} the return value is only @code{NULL} if the
+programs runs out of memory while adding the new element to the table.
+Otherwise the return value is a pointer to the element in the hashing
+table which contains newly added element based on the data in @var{key}.
+@end deftypefun
+
+As mentioned before the hashing table used by the functions described so
+far is global and there can be at any time at most one hashing table in
+the program.  A solution is to use the following functions which are a
+GNU extension.  All have in common that they operate on a hashing table
+which is described by the content of an object of the type @code{struct
+hsearch_data}.  This type should be treated as opaque, none of its
+members should be changed directly.
+
+@comment search.h
+@comment GNU
+@deftypefun int hcreate_r (size_t @var{nel}, struct hsearch_data *@var{htab})
+The @code{hcreate_r} function intializes the object pointed to by
+@var{htab} to contain a hashing table with at least @var{nel} elements.
+So this function is equivalent to the @code{hcreate} function except
+that the initialized data structure is controlled by the user.
+
+This allows to have more than once hashing table at one time.  The
+memory necessary for the @code{struct hsearch_data} object can be
+allocated dynamically.
+
+The return value is non-zero if the operation were successful.  if the
+return value is zero something went wrong which probably means the
+programs runs out of memory.
+@end deftypefun
+
+@comment search.h
+@comment GNU
+@deftypefun void hdestroy_r (struct hsearch_data *@var{htab})
+The @code{hdestroy_r} function frees all resources allocated by the
+@code{hcreate_r} function for this very same object @var{htab}.  As for
+@code{hdestroy} it is the programs responsibility to free the strings
+for the elements of the table.
+@end deftypefun
+
+@comment search.h
+@comment GNU
+@deftypefun int hsearch_r (ENTRY @var{item}, ACTION @var{action}, ENTRY **@var{retval}, struct hsearch_data *@var{htab})
+The @code{hsearch_r} function is equivalent to @code{hsearch}.  The
+meaning of the first two arguments is identical.  But instead of
+operating on a single global hashing table the functio works on the
+table described by the object pointed to by @var{htab} (which is
+initialized by a call to @code{hcreate_r}).
+
+Another difference to @code{hcreate} is that the pointer to the found
+entry in the table is not the return value of the functions.  It is
+returned by storing it in a pointer variables pointed to by the
+@var{retval} parameter.  The return value of the function is an integer
+value indicating success if it is non-zero and failure if it is zero.
+In the later case the global variable @var{errno} signals the reason for
+the failure.
+
+@table @code
+@item ENOMEM
+The table is filled and @code{hsearch_r} was called with an so far
+unknown key and @var{action} set to @code{ENTER}.
+@item ESRCH
+The @var{action} parameter is @code{FIND} and no corresponding element
+is found in the table.
+@end table
+@end deftypefun
+
+
+@node Tree Search Function
+@section The @code{tsearch} function.
+
+Another common form to organize data for efficient search is to use
+trees.  The @code{tsearch} function family provides a nice interface to
+functions to organize possibly large amounts of data by providing a mean
+access time proportional to the logarithm of the number of elements.
+The GNU C library implementation even guarantees that this bound is
+never exceeded even for input data which cause problems for simple
+binary tree implementations.
+
+The functions desribed in the chapter are all described in the @w{System
+V} and X/Open specifications and are therefore quite portable.
+
+In contrast to the @code{hsearch} functions the @code{tsearch} functions
+can be used with arbitrary data and not only zero-terminated strings.
+
+The @code{tsearch} functions have the advantage that no function to
+initialize data structures is necessary.  A simple pointer of type
+@code{void *} initialized to @code{NULL} is a valid tree and can be
+extended or searched.
+
+@comment search.h
+@comment SVID
+@deftypefun {void *} tsearch (const void *@var{key}, void **@var{rootp}, comparison_fn_t @var{compar})
+The @code{tsearch} function searches in the tree pointed to by
+@code{*@var{rootp}} for an element matching @var{key}.  The function
+pointed to by @var{compar} is used to determine wether two elements
+match.  @xref{Comparison Functions} for a specification of the functions
+which can be used for the @var{compar} parameter.
+
+If the tree does not contain a matching entry the @var{key} value will
+be added to the tree.  @code{tsearch} does not make a copy of the object
+pointed to by @var{key} (how could it since the size is unknown).
+Instead it adds a reference to this object which means the object must
+be available as long as the tree data structure is used.
+
+The tree is represented by a pointer to a pointer since it is sometimes
+necessary to change the root node of the tree.  So it must not be
+assumed that the variable pointed to by @var{rootp} has the same value
+after the call.  This also shows that it is not safe to call the
+@code{tsearch} function more than once at the same time using the same
+tree.  It is no problem to run it more than once at a time on different
+trees.
+
+The return value is a pointer to the matching element in the tree.  If a
+new element was created the pointer points to the new data (which is in
+fact @var{key}).  If an entry had to be created and the program ran out
+of space @code{NULL} is returned.
+@end deftypefun
+
+@comment search.h
+@comment SVID
+@deftypefun {void *} tfind (const void *@var{key}, void *const *@var{rootp}, comparison_fn_t @var{compar})
+The @code{tfind} function is similar to the @code{tsearch} function.  It
+locates an element matching the one pointed to by @var{key} and returns
+a pointer to this element.  But if no matching element is available no
+new element is entered (note that the @var{rootp} parameter points to a
+constant pointer).  Instead the function returns @code{NULL}.
+@end deftypefun
+
+Another advantage of the @code{tsearch} function in contrast to the
+@code{hsearch} functions is that there is an easy way to remove
+elements.
+
+@comment search.h
+@comment SVID
+@deftypefun {void *} tdelete (const void *@var{key}, void **@var{rootp}, comparison_fn_t @var{compar})
+To remove a specific element matching @var{key} from the tree
+@code{tdelete} can be used.  It locates the matching element using the
+same method as @code{tfind}.  The corresponding element is then removed
+and the data if this tree node is returned by the function.  If there is
+no matching entry in the tree nothing can be deleted and the function
+returns @code{NULL}.
+@end deftypefun
+
+@comment search.h
+@comment GNU
+@deftypefun void tdestroy (void *@var{vroot}, __free_fn_t @var{freefct})
+If the complete search tree has to be removed one can use
+@code{tdestroy}.  It frees all resources allocated by the @code{tsearch}
+function to generate the tree pointed to by @var{vroot}.
+
+For the data in each tree node the function @var{freefct} is called.
+The pointer to the data is passed as the argument to the function.  If
+no such work is necessary @var{freefct} must point to a function doing
+nothing.  It is called in any case.
+
+This function is a GNU extension and not covered by the @w{System V} or
+X/Open specifications.
+@end deftypefun
+
+In addition to the function to create and destroy the tree data
+structure there is another function which allows to apply a function on
+all elements of the tree.  The function must have this type:
+
+@smallexample
+int __action_fn_t (const void *nodep, VISIT value, int level);
+@end smallexample
+
+The @var{nodep} is the data value of the current node (nce given as the
+@var{key} argument to @code{tsearch}).  @var{level} is a numeric value
+which corresponds to the depth of the current node in the tree.  The
+root node has the depth @math{0} and its children have a depth of
+@math{1} and so on.  The @code{VISIT} type is an enumeration type.
+
+@deftp {Data Type} VISIT
+The @code{VISIT} value indicates the status of the current node in the
+tree and how the function is called.  The status of a node is either
+`leaf' or `internal node'.  For each leaf node the function is called
+exactly once, for each internal node it is called three times: before
+the first child is processed, after the first child is processed and
+after both childs are processed.  This makes it possible to handle all
+three methods of tree traversal (or even a combination of them).
+
+@table @code
+@item preorder
+The current node is an internal node and the function is called before
+the first child was processed.
+@item endorder
+The current node is an internal node and the function is called after
+the first child was processed.
+@item postorder
+The current node is an internal node and the function is called after
+the second child was processed.
+@item leaf
+The current node is a leaf.
+@end table
+@end deftp
+
+@comment search.h
+@comment SVID
+@deftypefun void twalk (const void *@var{root}, __action_fn_t @var{action})
+For each node in the tree with a node pointed to by @var{root} the
+@code{twalk} function calls the function provided by the parameter
+@var{action}.  For leaf nodes the function is called exactly once with
+@var{value} set to @code{leaf}.  For internal nodes the function is
+called three times, setting the @var{value} parameter or @var{action} to
+the appropriate value.  The @var{level} argument for the @var{action}
+function is computed while descending the tree with increasing the value
+by one for the escend to a child, starting with the value @math{0} for
+the root node.
+
+Since the functions used for the @var{action} parameter to @code{twalk}
+must not modify the tree data it is safe to run @code{twalk} is more
+than one thread at the same time working on the same tree.  It is also
+safe to call @code{tfind} in parallel.  Functions which modify the tree
+must not be used.  Otherwise the behaviour is undefined.
+@end deftypefun
diff --git a/misc/hsearch_r.c b/misc/hsearch_r.c
index 980b7c8d72..d9255e1c6b 100644
--- a/misc/hsearch_r.c
+++ b/misc/hsearch_r.c
@@ -1,6 +1,6 @@
-/* Copyright (C) 1993, 1995, 1996 Free Software Foundation, Inc.
-   Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>
+/* Copyright (C) 1993, 1995, 1996, 1997 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1993.
 
    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
@@ -143,15 +143,6 @@ hsearch_r (item, action, retval, htab)
   unsigned int len = strlen (item.key);
   unsigned int idx;
 
-  /* If table is full and another entry should be entered return with
-     error.  */
-  if (action == ENTER && htab->filled == htab->size)
-    {
-      __set_errno (ENOMEM);
-      *retval = NULL;
-      return 0;
-    }
-
   /* Compute an value for the given string. Perhaps use a better method. */
   hval = len;
   count = len;
@@ -213,6 +204,15 @@ hsearch_r (item, action, retval, htab)
   /* An empty bucket has been found. */
   if (action == ENTER)
     {
+      /* If table is full and another entry should be entered return
+	 with error.  */
+      if (action == ENTER && htab->filled == htab->size)
+	{
+	  __set_errno (ENOMEM);
+	  *retval = NULL;
+	  return 0;
+	}
+
       htab->table[idx].used  = hval;
       htab->table[idx].entry = item;
 
diff --git a/misc/search.h b/misc/search.h
index 2b0106463d..1cd4fdb9ef 100644
--- a/misc/search.h
+++ b/misc/search.h
@@ -52,6 +52,10 @@ extern void remque __P ((void *__elem));
 #ifndef __COMPAR_FN_T
 # define __COMPAR_FN_T
 typedef int (*__compar_fn_t) __P ((__const __ptr_t, __const __ptr_t));
+
+# ifdef	__USE_GNU
+typedef __compar_fn_t comparison_fn_t;
+# endif
 #endif
 
 /* Action which shall be performed in the call the hsearch.  */
diff --git a/posix/Makefile b/posix/Makefile
index 2b14fac138..cbcb6d1b1b 100644
--- a/posix/Makefile
+++ b/posix/Makefile
@@ -52,6 +52,7 @@ routines :=								      \
 
 aux		:= init-posix environ
 tests		:= tstgetopt testfnm runtests
+test-srcs	:= globtest
 others		:= getconf
 install-bin	:= getconf
 install-lib	:= libposix.a
diff --git a/stdlib/stdlib.h b/stdlib/stdlib.h
index 7963cb6fec..a92df4bc9e 100644
--- a/stdlib/stdlib.h
+++ b/stdlib/stdlib.h
@@ -210,58 +210,90 @@ extern unsigned long long int __strtoull_internal __P ((__const char *
 #if defined __OPTIMIZE__ && __GNUC__ >= 2
 /* Define inline functions which call the internal entry points.  */
 
-extern __inline double strtod (__const char *__restrict __nptr,
-			       char **__restrict __endptr)
-{ return __strtod_internal (__nptr, __endptr, 0); }
-extern __inline long int strtol (__const char *__restrict __nptr,
-				 char **__restrict __endptr, int __base)
-{ return __strtol_internal (__nptr, __endptr, __base, 0); }
-extern __inline unsigned long int strtoul (__const char *__restrict __nptr,
-					   char **__restrict __endptr,
-					   int __base)
-{ return __strtoul_internal (__nptr, __endptr, __base, 0); }
-
-#ifdef __USE_GNU
-extern __inline float strtof (__const char *__restrict __nptr,
-			      char **__restrict __endptr)
-{ return __strtof_internal (__nptr, __endptr, 0); }
-extern __inline __long_double_t strtold (__const char *__restrict __nptr,
-					 char **__restrict __endptr)
-{ return __strtold_internal (__nptr, __endptr, 0); }
-#endif
-
-#ifdef __USE_BSD
-extern __inline long long int strtoq (__const char *__restrict __nptr,
-				      char **__restrict __endptr, int __base)
-{ return __strtoll_internal (__nptr, __endptr, __base, 0); }
-extern __inline unsigned long long int strtouq (__const char *__restrict __nptr,
-						char **__restrict __endptr,
-						int __base)
-{ return __strtoull_internal (__nptr, __endptr, __base, 0); }
-#endif
-
-#if defined __USE_MISC || defined __USE_ISOC9X
-extern __inline long long int strtoll (__const char *__restrict __nptr,
-				       char **__restrict __endptr, int __base)
-{ return __strtoll_internal (__nptr, __endptr, __base, 0); }
-extern __inline unsigned long long int strtoull (__const char *
-						 __restrict __nptr,
-						 char **__restrict __endptr,
-						 int __base)
-{ return __strtoull_internal (__nptr, __endptr, __base, 0); }
-#endif
-
-extern __inline double atof (__const char *__nptr)
-{ return strtod (__nptr, (char **) NULL); }
-extern __inline int atoi (__const char *__nptr)
-{ return (int) strtol (__nptr, (char **) NULL, 10); }
-extern __inline long int atol (__const char *__nptr)
-{ return strtol (__nptr, (char **) NULL, 10); }
-
-#if defined __USE_MISC || defined __USE_ISOC9X
-extern __inline long long int atoll (__const char *__nptr)
-{ return strtoll (__nptr, (char **) NULL, 10); }
-#endif
+extern __inline double
+strtod (__const char *__restrict __nptr, char **__restrict __endptr)
+{
+  return __strtod_internal (__nptr, __endptr, 0);
+}
+extern __inline long int
+strtol (__const char *__restrict __nptr, char **__restrict __endptr,
+	int __base)
+{
+  return __strtol_internal (__nptr, __endptr, __base, 0);
+}
+extern __inline unsigned long int
+strtoul (__const char *__restrict __nptr, char **__restrict __endptr,
+	 int __base)
+{
+  return __strtoul_internal (__nptr, __endptr, __base, 0);
+}
+
+# ifdef __USE_GNU
+extern __inline float
+strtof (__const char *__restrict __nptr, char **__restrict __endptr)
+{
+  return __strtof_internal (__nptr, __endptr, 0);
+}
+extern __inline __long_double_t
+strtold (__const char *__restrict __nptr, char **__restrict __endptr)
+{
+  return __strtold_internal (__nptr, __endptr, 0);
+}
+# endif
+
+# ifdef __USE_BSD
+extern __inline long long int
+strtoq (__const char *__restrict __nptr, char **__restrict __endptr,
+	int __base)
+{
+  return __strtoll_internal (__nptr, __endptr, __base, 0);
+}
+extern __inline unsigned long long int
+strtouq (__const char *__restrict __nptr, char **__restrict __endptr,
+	 int __base)
+{
+  return __strtoull_internal (__nptr, __endptr, __base, 0);
+}
+# endif
+
+# if defined __USE_MISC || defined __USE_ISOC9X
+extern __inline long long int
+strtoll (__const char *__restrict __nptr, char **__restrict __endptr,
+	 int __base)
+{
+  return __strtoll_internal (__nptr, __endptr, __base, 0);
+}
+extern __inline unsigned long long int
+strtoull (__const char * __restrict __nptr, char **__restrict __endptr,
+	  int __base)
+{
+  return __strtoull_internal (__nptr, __endptr, __base, 0);
+}
+# endif
+
+extern __inline double
+atof (__const char *__nptr)
+{
+  return strtod (__nptr, (char **) NULL);
+}
+extern __inline int
+atoi (__const char *__nptr)
+{
+  return (int) strtol (__nptr, (char **) NULL, 10);
+}
+extern __inline long int
+atol (__const char *__nptr)
+{
+  return strtol (__nptr, (char **) NULL, 10);
+}
+
+# if defined __USE_MISC || defined __USE_ISOC9X
+extern __inline long long int
+atoll (__const char *__nptr)
+{
+  return strtoll (__nptr, (char **) NULL, 10);
+}
+# endif
 #endif /* Optimizing GCC >=2.  */
 
 
@@ -304,7 +336,7 @@ extern __ptr_t __setstate __P ((__ptr_t __statebuf));
 extern __ptr_t setstate __P ((__ptr_t __statebuf));
 
 
-#ifdef __USE_MISC
+# ifdef __USE_MISC
 /* Reentrant versions of the `random' family of functions.
    These functions all use the following data structure to contain
    state, rather than global state variables.  */
@@ -333,7 +365,7 @@ extern int initstate_r __P ((unsigned int __seed, __ptr_t __statebuf,
 
 extern int __setstate_r __P ((__ptr_t __statebuf, struct random_data *__buf));
 extern int setstate_r __P ((__ptr_t __statebuf, struct random_data *__buf));
-#endif	/* Use misc.  */
+# endif	/* Use misc.  */
 #endif	/* Use SVID || extended X/Open.  */
 
 
@@ -441,7 +473,7 @@ extern void cfree __P ((__ptr_t __ptr));
 #endif /* Use misc.  */
 
 #if defined __USE_GNU || defined __USE_BSD || defined __USE_MISC
-#include <alloca.h>
+# include <alloca.h>
 #endif /* Use GNU, BSD, or misc.  */
 
 #if defined __USE_BSD || defined __USE_XOPEN_EXTENDED
@@ -545,12 +577,12 @@ extern char *realpath __P ((__const char *__name, char *__resolved));
 
 /* Shorthand for type of comparison functions.  */
 #ifndef __COMPAR_FN_T
-#define __COMPAR_FN_T
+# define __COMPAR_FN_T
 typedef int (*__compar_fn_t) __P ((__const __ptr_t, __const __ptr_t));
-#endif
 
-#ifdef	__USE_GNU
+# ifdef	__USE_GNU
 typedef __compar_fn_t comparison_fn_t;
+# endif
 #endif
 
 /* Do a binary search for KEY in BASE, which consists of NMEMB elements
@@ -568,7 +600,7 @@ extern void qsort __P ((__ptr_t __base, size_t __nmemb, size_t __size,
 /* Return the absolute value of X.  */
 extern int abs __P ((int __x)) __attribute__ ((__const__));
 extern long int labs __P ((long int __x)) __attribute__ ((__const__));
-#if defined __USE_ISOC9X
+#ifdef __USE_ISOC9X
 extern long long int llabs __P ((long long int __x))
      __attribute__ ((__const__));
 #endif
@@ -643,8 +675,11 @@ extern int mbtowc __P ((wchar_t *__restrict __pwc,
 extern int wctomb __P ((char *__s, wchar_t __wchar));
 
 #if defined __OPTIMIZE__ && __GNUC__ >= 2
-extern __inline int mblen (__const char *__s, size_t __n)
-{ return mbtowc ((wchar_t *) NULL, __s, __n); }
+extern __inline int
+mblen (__const char *__s, size_t __n)
+{
+  return mbtowc ((wchar_t *) NULL, __s, __n);
+}
 #endif /* Optimizing GCC >=2.  */
 
 
@@ -671,7 +706,7 @@ extern int rpmatch __P ((__const char *__response));
    optional value introduced by an equal sign.  If the suboption is
    not part of TOKENS return in *VALUEP beginning of unknown
    suboption.  On exit *OPTIONP is set to the beginning of the next
-   otken or at the terminating NUL character.  */
+   token or at the terminating NUL character.  */
 extern int getsubopt __P ((char **__optionp, __const char *__const *__tokens,
 			   char **__valuep));
 #endif
diff --git a/stdlib/strtol.c b/stdlib/strtol.c
index 97ad23453b..19e4a52880 100644
--- a/stdlib/strtol.c
+++ b/stdlib/strtol.c
@@ -184,6 +184,11 @@ extern int errno;
 #  define TOUPPER(Ch) towupper (Ch)
 # endif
 # else
+#  if defined STDC_HEADERS || (!defined isascii && !defined HAVE_ISASCII)
+#   define IN_CTYPE_DOMAIN(c) 1
+#  else
+#   define IN_CTYPE_DOMAIN(c) isascii(c)
+#  endif
 #  define L_(Ch) Ch
 #  define UCHAR_TYPE unsigned char
 #  define STRING_TYPE char
@@ -192,9 +197,9 @@ extern int errno;
 #  define ISALPHA(Ch) __isalpha_l ((Ch), loc)
 #  define TOUPPER(Ch) __toupper_l ((Ch), loc)
 # else
-#  define ISSPACE(Ch) isspace (Ch)
-#  define ISALPHA(Ch) isalpha (Ch)
-#  define TOUPPER(Ch) toupper (Ch)
+#  define ISSPACE(Ch) (IN_CTYPE_DOMAIN (Ch) && isspace (Ch))
+#  define ISALPHA(Ch) (IN_CTYPE_DOMAIN (Ch) && isalpha (Ch))
+#  define TOUPPER(Ch) (IN_CTYPE_DOMAIN (Ch) ? toupper (Ch) : (Ch))
 # endif
 #endif
 
diff --git a/string/argz.h b/string/argz.h
index d5847cb425..20e8a55321 100644
--- a/string/argz.h
+++ b/string/argz.h
@@ -27,7 +27,7 @@
 #include <string.h>		/* Need size_t, and strchr is called below.  */
 
 #ifndef __const
-#define __const const
+# define __const const
 #endif
 
 #ifndef __error_t_defined
@@ -133,7 +133,7 @@ extern char *__argz_next __P ((char *argz, size_t __argz_len,
 extern char *argz_next __P ((char *argz, size_t __argz_len,
 			     __const char *entry));
 
-#if defined (__OPTIMIZE__) && __GNUC__ >= 2
+#if defined __OPTIMIZE__ && __GNUC__ >= 2
 extern inline char *
 __argz_next (char *__argz, size_t __argz_len, __const char *__entry)
 {
@@ -142,7 +142,7 @@ __argz_next (char *__argz, size_t __argz_len, __const char *__entry)
       if (__entry < __argz + __argz_len)
 	__entry = strchr (__entry, '\0') + 1;
 
-      return __entry >= __argz + __argz_len ? NULL : (char *) __entry;
+      return __entry >= __argz + __argz_len ? (char *) NULL : (char *) __entry;
     }
   else
     return __argz_len > 0 ? __argz : 0;
diff --git a/sysdeps/i386/i486/bits/string.h b/sysdeps/i386/i486/bits/string.h
index 5e4abbc3e5..10915ced1d 100644
--- a/sysdeps/i386/i486/bits/string.h
+++ b/sysdeps/i386/i486/bits/string.h
@@ -471,7 +471,7 @@ __strcpy_g (char *__dest, __const char *__src)
 		      case 2:						      \
 			*((__uint16_t *) __cp) =			      \
 			  __STRING_SMALL_GET16 (src, 0);		      \
-			++cp;						      \
+			++__cp;						      \
 			break;						      \
 		      case 3:						      \
 			*((__uint16_t *) __cp)++ =			      \
@@ -481,7 +481,7 @@ __strcpy_g (char *__dest, __const char *__src)
 		      case 4:						      \
 			*((__uint32_t *) __cp) =			      \
 			  __STRING_SMALL_GET32 (src, 0);		      \
-			cp += 3;					      \
+			__cp += 3;					      \
 			break;						      \
 		      case 5:						      \
 			*((__uint32_t *) __cp)++ =			      \
@@ -493,7 +493,7 @@ __strcpy_g (char *__dest, __const char *__src)
 			  __STRING_SMALL_GET32 (src, 0);		      \
 			*((__uint16_t *) __cp) =			      \
 			  __STRING_SMALL_GET16 (src, 4);		      \
-			++cp;						      \
+			++__cp;						      \
 			break;						      \
 		      case 7:						      \
 			*((__uint32_t *) __cp)++ =			      \
@@ -507,7 +507,7 @@ __strcpy_g (char *__dest, __const char *__src)
 			  __STRING_SMALL_GET32 (src, 0);		      \
 			*((__uint32_t *) __cp) =			      \
 			  __STRING_SMALL_GET32 (src, 4);		      \
-			cp += 3;					      \
+			__cp += 3;					      \
 			break;						      \
 		      }							      \
 		    __cp; }))
diff --git a/sysdeps/i386/init-first.c b/sysdeps/i386/init-first.c
index 47dd299e18..118f84201f 100644
--- a/sysdeps/i386/init-first.c
+++ b/sysdeps/i386/init-first.c
@@ -1,6 +1,6 @@
 /* Initialization code run first thing by the ELF startup code.  For i386/Unix.
-     Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
-     This file is part of the GNU C Library.
+   Copyright (C) 1995, 1996, 1997 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
@@ -20,7 +20,7 @@
 #include <unistd.h>
 
 extern void __libc_init (int, char **, char **);
-extern void __getopt_clean_environment (void);
+extern void __getopt_clean_environment (char **);
 extern void __libc_global_ctors (void);
 
 int __libc_multiple_libcs = 1;
@@ -36,7 +36,7 @@ init (int *data)
   __libc_init (argc, argv, envp);
 
   /* This is a hack to make the special getopt in GNU libc working.  */
-  __getopt_clean_environment ();
+  __getopt_clean_environment (envp);
 }
 
 #ifdef PIC
diff --git a/sysdeps/mach/hurd/i386/init-first.c b/sysdeps/mach/hurd/i386/init-first.c
index 4c4f6ff665..10094f0967 100644
--- a/sysdeps/mach/hurd/i386/init-first.c
+++ b/sysdeps/mach/hurd/i386/init-first.c
@@ -27,7 +27,7 @@
 
 extern void __mach_init (void);
 extern void __libc_init (int, char **, char **);
-extern void __getopt_clean_environment (void);
+extern void __getopt_clean_environment (char **);
 extern void __libc_global_ctors (void);
 
 unsigned int __hurd_threadvar_max;
@@ -109,7 +109,7 @@ init1 (int argc, char *arg0, ...)
   __libc_init (argc, argv, __environ);
 
   /* This is a hack to make the special getopt in GNU libc working.  */
-  __getopt_clean_environment ();
+  __getopt_clean_environment (envp);
 
 #ifdef PIC
   __libc_global_ctors ();
@@ -170,7 +170,7 @@ init (int *data)
       /* Force NEWSP into %ecx and &init1 into %eax, which are not restored
 	 by function return.  */
       asm volatile ("# a %0 c %1" : : "a" (newsp), "c" (&init1));
-    } 
+    }
   else
     {
       /* The argument data is just above the stack frame we will unwind by
@@ -202,7 +202,7 @@ init (int *data)
      init1's return address, and then jump there.  */
   asm volatile ("pushl %eax; jmp *%ecx");
   /* NOTREACHED */
-}  
+}
 
 
 #ifdef PIC
@@ -223,7 +223,7 @@ _init (int argc, ...)
   __mach_init ();
 
   RUN_HOOK (_hurd_preinit_hook, ());
-  
+
   init (&argc);
 }
 #endif
@@ -256,7 +256,7 @@ __libc_init_first (int argc __attribute__ ((unused)), ...)
   __mach_init ();
 
   RUN_HOOK (_hurd_preinit_hook, ());
-  
+
   _hurd_startup ((void **) &argc, &doinit);
 #endif
 }
@@ -267,8 +267,8 @@ __libc_init_first (int argc __attribute__ ((unused)), ...)
    in ld.so causes disaster, because the _init definition above will
    cause ld.so to gain an init function, which is not a cool thing. */
 
-void 
-_dl_start (void) 
-{ 
-  abort (); 
+void
+_dl_start (void)
+{
+  abort ();
 }
diff --git a/sysdeps/mach/hurd/mips/init-first.c b/sysdeps/mach/hurd/mips/init-first.c
index b057aeb097..a411a1b0e9 100644
--- a/sysdeps/mach/hurd/mips/init-first.c
+++ b/sysdeps/mach/hurd/mips/init-first.c
@@ -27,7 +27,7 @@
 
 extern void __mach_init (void);
 extern void __libc_init (int, char **, char **);
-extern void __getopt_clean_environment (void);
+extern void __getopt_clean_environment (char **);
 extern void __libc_global_ctors (void);
 
 unsigned int __hurd_threadvar_max;
@@ -110,7 +110,7 @@ init1 (int argc, char *arg0, ...)
   __libc_init (argc, argv, __environ);
 
   /* This is a hack to make the special getopt in GNU libc working.  */
-  __getopt_clean_environment ();
+  __getopt_clean_environment (envp);
 
 #ifdef PIC
   __libc_global_ctors ();
@@ -169,14 +169,14 @@ __init (int *data)
 	 be the return address for `init1'; we will jump there with NEWSP
 	 as the stack pointer.  */
       return newsp;
-    } 
+    }
 
   /* The argument data is just above the stack frame we will unwind by
      returning.  */
   return (void *) data;
 
   (void) &__init;
-}  
+}
 
 #ifdef PIC
 /* This function is called to initialize the shared C library.
@@ -399,7 +399,7 @@ ___libc_init_first (int return_addr, int argc, ...)
 #endif
 
   RUN_HOOK (_hurd_preinit_hook, ());
-  
+
   _hurd_startup ((void **) &argc, &doinit);
 
   (void) &___libc_init_first;
diff --git a/sysdeps/sparc/sparc32/dl-machine.h b/sysdeps/sparc/sparc32/dl-machine.h
index 39bcab7df5..b80c126487 100644
--- a/sysdeps/sparc/sparc32/dl-machine.h
+++ b/sysdeps/sparc/sparc32/dl-machine.h
@@ -308,10 +308,10 @@ elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc,
 	  /* For thread safety, write the instructions from the bottom and
 	     flush before we overwrite the critical "b,a".  */
 	  reloc_addr[2] = OPCODE_JMP_G1 | (value & 0x3ff);
-	  if (1 || (_dl_hwcap & 1)) /* HWCAP_SPARC_FLUSH */
+	  if (_dl_hwcap & HWCAP_SPARC_FLUSH)
 	    __asm __volatile ("flush %0+8" : : "r"(reloc_addr));
 	  reloc_addr[1] = OPCODE_SETHI_G1 | (value >> 10);
-	  if (1 || (_dl_hwcap & 1)) /* HWCAP_SPARC_FLUSH */
+	  if (_dl_hwcap & HWCAP_SPARC_FLUSH)
 	    __asm __volatile ("flush %0+4" : : "r"(reloc_addr));
 	  break;
 	case R_SPARC_8:
diff --git a/sysdeps/stub/init-first.c b/sysdeps/stub/init-first.c
index 4fcc67ddbe..dacefdcb63 100644
--- a/sysdeps/stub/init-first.c
+++ b/sysdeps/stub/init-first.c
@@ -23,7 +23,7 @@
 int __libc_multiple_libcs = 1;
 
 extern void __libc_init (int, char **, char **);
-extern void __getopt_clean_environment (void);
+extern void __getopt_clean_environment (char **);
 
 pid_t __libc_pid;
 
@@ -51,5 +51,5 @@ void __libc_init_first
   __libc_init (argc, argv, envp);
 
   /* This is a hack to make the special getopt in GNU libc working.  */
-  __getopt_clean_environment ();
+  __getopt_clean_environment (envp);
 }
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/bits/types.h b/sysdeps/unix/sysv/linux/sparc/sparc64/bits/types.h
index 9a4666a508..462f7c2998 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc64/bits/types.h
+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/bits/types.h
@@ -51,7 +51,7 @@ typedef __u_int __nlink_t; 		/* Type of file link counts.  */
 typedef long int __off_t;		/* Type of file sizes and offsets.  */
 typedef __quad_t __loff_t;		/* Type of file sizes and offsets.  */
 typedef int __pid_t;			/* Type of process identifications.  */
-typedef long int __ssize_t;		/* Type of a byte count, or error.  */
+typedef long long int __ssize_t;	/* Type of a byte count, or error.  */
 
 typedef struct
   {