summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog210
-rw-r--r--FAQ32
-rw-r--r--Makeconfig4
-rw-r--r--Makefile7
-rw-r--r--Makerules5
-rw-r--r--config.make.in2
-rwxr-xr-xconfigure93
-rw-r--r--configure.in15
-rw-r--r--elf/Makefile8
-rw-r--r--glibcbug.in16
-rw-r--r--inet/arpa/inet.h1
-rw-r--r--inet/netinet/ip.h3
-rw-r--r--libc-symbols.h31
-rw-r--r--locale/C-time.c30
-rw-r--r--locale/localeinfo.h34
-rw-r--r--locale/programs/ld-time.c6
-rw-r--r--locale/programs/linereader.c32
-rw-r--r--malloc/malloc.c4
-rw-r--r--misc/syslog.c4
-rw-r--r--posix/getopt.c13
-rw-r--r--resolv/nss_dns/dns-host.c13
-rw-r--r--stdio-common/Makefile5
-rw-r--r--stdio-common/bug10.c4
-rw-r--r--stdio-common/scanf1.c8
-rw-r--r--stdio-common/scanf10.c2
-rw-r--r--stdio-common/scanf11.c14
-rw-r--r--stdio-common/scanf3.c4
-rw-r--r--stdio-common/tstdiomisc.c2
-rw-r--r--stdio-common/vfscanf.c23
-rw-r--r--stdlib/strtol.c9
-rw-r--r--stdlib/tst-strtol.c8
-rw-r--r--sysdeps/generic/sysd-stdio.c30
-rw-r--r--sysdeps/libm-i387/e_exp.S2
-rw-r--r--sysdeps/libm-i387/e_expf.S2
-rw-r--r--sysdeps/libm-i387/e_expl.S2
-rw-r--r--sysdeps/libm-i387/s_expm1.S12
-rw-r--r--sysdeps/libm-i387/s_expm1f.S12
-rw-r--r--sysdeps/libm-i387/s_expm1l.S12
-rw-r--r--sysdeps/mach/hurd/posix_opt.h9
-rw-r--r--sysdeps/mach/hurd/vdprintf.c57
-rw-r--r--sysdeps/mach/libc-lock.h36
-rw-r--r--sysdeps/posix/vdprintf.c49
-rw-r--r--sysdeps/stub/vdprintf.c31
-rw-r--r--sysdeps/unix/Makefile2
-rw-r--r--sysdeps/unix/bsd/bsd4.4/direntry.h28
-rw-r--r--sysdeps/unix/sysv/linux/alpha/kernel_sigaction.h7
-rw-r--r--sysdeps/unix/sysv/linux/alpha/sys/ipc_buf.h85
-rw-r--r--sysdeps/unix/sysv/linux/alpha/sys/procfs.h109
-rw-r--r--sysdeps/unix/sysv/linux/i386/getgroups.c43
-rw-r--r--sysdeps/unix/sysv/linux/i386/setgroups.c41
-rw-r--r--sysdeps/unix/sysv/linux/i386/syscalls.list2
-rw-r--r--sysdeps/unix/sysv/linux/kernel_sigaction.h10
-rw-r--r--sysdeps/unix/sysv/linux/m68k/getgroups.c2
-rw-r--r--sysdeps/unix/sysv/linux/m68k/setgroups.c2
-rw-r--r--sysdeps/unix/sysv/linux/m68k/syscalls.list2
-rw-r--r--sysdeps/unix/sysv/linux/sigaction.c63
-rw-r--r--sysdeps/unix/sysv/linux/sys/ipc_buf.h44
-rw-r--r--sysdeps/unix/sysv/linux/sys/mtio.h242
-rw-r--r--sysdeps/unix/sysv/linux/sys/procfs.h82
-rw-r--r--sysdeps/unix/sysv/linux/sys/sysmacros.h6
-rw-r--r--sysdeps/unix/sysv/linux/syscalls.list1
-rw-r--r--time/Makefile43
-rw-r--r--time/mktime.c37
-rw-r--r--time/simplebackw2
-rw-r--r--time/strptime.c471
-rw-r--r--time/test-tz.c5
-rw-r--r--time/tzfile.c42
-rw-r--r--time/tzselect.ksh8
-rw-r--r--time/tzset.c15
-rw-r--r--values.h11
70 files changed, 1891 insertions, 410 deletions
diff --git a/ChangeLog b/ChangeLog
index 6389d5a268..7781e5c371 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -22,6 +22,216 @@ Tue Jan  7 09:48:15 1997  Andreas Jaeger  <aj@arthur.pfalz.de>
 	* signal/sigempty.c (sigemptyset): Correct typo: Empty set should
 	have all bits zero.
 
+Sun Jan 19 04:38:20 1997  Ulrich Drepper  <drepper@cygnus.com>
+
+	* config.make.in (have-ksh, KSH): New variables.  Will be filled
+	in by configure.
+	* configure.in: Add test for ksh like shell (prefer bash).
+	* time/Makefile (tests): Depend on install-test-data.
+	(distribute): Add simplebackw.
+	(generated-dirs): New variable.
+	[$(have-ksh)==yes] (install-others): Add iso3166.tab and zone.tab.
+	(install-bin): Add tzselect.
+	(install-test-data): Install the zoneinfo files which are needed
+	for the test case in the build directory.
+	(test-tz-ENV): New variable.  Call test-tz program using data in
+	build directory.
+	* time/simpleback: New file.
+	* time/test-tz.c: Pretty print.
+	* time/tzfile.c: Use value of environment variable TZDIR as directory
+	to look for zone info files.
+	don't let search for DST data destroy already found values.
+	* time/tzselect.ksh: Use @KSH@ and @TZDIR@ to be substituted when
+	installing.
+	* time/tzset.c (__tzset_internal): Avoid freeing string twice.
+	Set DST zone name to normal zone name if no information is provided.
+
+	* time/mktime.c (mktime): Call __tzset_internal to use current
+	value of TZ.
+
+	* Makerules (common-clean): Remove $(generated-dirs) inclusing content.
+
+	* glibcbug.in: Fix several bugs.  Reported by several people.
+
+	* elf/Makefile: Correct dependecies for $(objpfx)ldd.
+
+	* inet/netinet/ip.h: Define IPTOS_LOWCOST and IPTOS_MINCOST.
+
+	* locale/C-time.c: Update copyright.
+	* locale/localeinfo.h: Likewise.
+	* sysdeps/unix/bsd/bsd4.4/direntry.h: Likewise.
+
+	* locale/programs/ld-time.c (time_finish): Correct message string.
+	* locale/programs/linereader.c (lr_token): Use correctly `number'
+	not `digit' in message string.
+
+	* stdlib/strtol.c [UNSIGNED]: Don't punt immediately when `-' is
+	seen.  Instead return ULONG_MAX and set ERANGE.
+	* stdlib/tst-strtol.c: Correct test to reflect above change.
+
+Sun Jan 19 03:22:30 1997  Ulrich Drepper  <drepper@cygnus.com>
+
+	* sysdeps/unix/sysv/linux/sys/mtio.h: Don't use <linux/mtio.h>.
+	We must not use <linux/posix_types.h>.
+
+	* sysdeps/unix/sysv/linux/sys/ipc_buf.h: Don't use __kernel_* types
+	since we must not use <linux/posix_types.h>.
+	* sysdeps/unix/sysv/linux/sys/procfs.h: Likewise.
+	* sysdeps/unix/sysv/linux/alpha/sys/ipc_buf.h: New file.  Similar
+	to sysdeps/unix/sysv/linux/sys/ipc_buf.h, but use alpha relavent
+	types.
+	* sysdeps/unix/sysv/linux/alpha/sys/procfs.h: New file.  Similar
+	to sysdeps/unix/sysv/linux/sys/procfs.h, but use alpha relavent
+	types.
+
+Sun Jan 19 01:48:20 1997  H.J. Lu  <hjl@gnu.ai.mit.edu>
+
+	* sysdeps/libm-i387/e_exp.S: Correct computation of fractional
+	part.
+	* sysdeps/libm-i387/e_expf.S: Likewise.
+	* sysdeps/libm-i387/e_expl.S: Likewise.
+	* sysdeps/libm-i387/s_expm1.S: Correct computation of fractional
+	part.  Take care of additional value left on stack by fscale.
+	* sysdeps/libm-i387/s_expm1f.S: Likewise.
+	* sysdeps/libm-i387/s_expm1l.S: Likewise.
+
+Fri Jan 17 17:45:32 1997  Ulrich Drepper  <drepper@cygnus.com>
+
+	* posix/getopt.c: Change all direct usages of `gettext' to `_'.
+
+	* sysdeps/generic/sysd-stdio.c (__stdio_reopen): Add missing
+	parameter.
+	Reported by Harmanjit Singh <harman@netearth.iitd.ernet.in>.
+
+Thu Jan 16 23:39:25 1997  Ulrich Drepper  <drepper@cygnus.com>
+
+	* stdio-common/Makefile (tests): Add scanf11.
+	* stdio-common/scanf11.c: New file.
+	* stdio-common/vfscanf.c (__vfscanf): Increment `done' when %n
+	was processed and value is not suppressed.
+	* stdio-common/bug10.c: Correct test to expect %n increment the
+	return value of scanf.
+	* stdio-common/scanf1.c: Likewise.
+	* stdio-common/scanf3.c: Likewise.
+	* stdio-common/scanf10.c: Likewise.
+	* stdio-common/tstdiomisc.c: Likewise.
+
+	* time/strptime.c: Add lots of conditional compiling to enable use
+	outside glibc.  When used in glibc, make sure C locale format
+	strings will always be recognized.
+
+Sat Jan 11 18:53:47 1997  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>
+
+	* sysdeps/unix/sysv/linux/sys/sysmacros.h (major, minor, makedev):
+	Fix definitions so that they work with __kernel_dev_t.
+
+Sat Jan 11 14:24:10 1997  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>
+
+	* sysdeps/unix/sysv/linux/kernel_sigaction.h,
+	sysdeps/unix/sysv/linux/alpha/kernel_sigaction.h,
+	sysdeps/unix/sysv/linux/sigaction.c: New files.
+	* sysdeps/unix/sysv/linux/syscalls.list: Add s_sigaction.
+
+Sun Jan 12 15:22:33 1997  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>
+
+	* libc-symbols.h (link_warning): Make sure that the .gnu.warning
+	section is not allocated.
+	Update and reformat copyright.
+
+Sun Jan 12 12:19:28 1997  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>
+
+	* elf/Makefile ($(objpfx)ldd): Fix depedency list.
+
+Sat Jan 11 15:11:26 1997  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>
+
+	* sysdeps/unix/Makefile ($(common-objpfx)sysd-syscalls): Fix
+	command so that it works in subdirectories.
+
+Wed Jan  8 22:07:58 1997  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>
+
+	* sysdeps/unix/sysv/linux/i386/syscalls.list: Add s_getgroups and
+	s_setgroups.
+	* sysdeps/unix/sysv/linux/m68k/syscalls.list: Likewise.
+	* sysdeps/unix/sysv/linux/i386/getgroups.c,
+	sysdeps/unix/sysv/linux/i386/setgroups.c,
+	sysdeps/unix/sysv/linux/m68k/getgroups.c,
+	sysdeps/unix/sysv/linux/m68k/setgroups.c: New files.
+
+Wed Jan  8 19:42:59 1997  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>
+
+	* Makefile (config.status): Delete bogus rule.
+	($(objpfx)glibcbug): Renamed from plain `glibcbug', depend on
+	config.status in build directory, fix command to change to build
+	directory.
+	* Makeconfig ($(common-objpfx)config.status): Depend on version.h.
+
+Thu Jan  9 08:47:54 1997  Andreas Jaeger  <aj@arthur.pfalz.de>
+
+	* glibcbug.in (while): We test for four and not five conditions,
+	set MAIL_AGENT instead of RMAIL, filter spaces and tabs.
+
+Thu Jan 16 22:00:27 1997  Ulrich Drepper  <drepper@cygnus.com>
+
+	* misc/syslog.c: Don't define cancel_handler if _LIBC_REENTRANT
+	is not defined.  Reported by Andreas Jaeger.
+
+Thu Jan  9 08:47:54 1997  Andreas Jaeger  <aj@arthur.pfalz.de>
+
+	* new-malloc/malloc.c (__MALLOC_P): define call to pthread
+	initializer only if NO_THREADS is not defined.
+
+Wed Jan  8 21:28:58 1997  Andreas Jaeger  <aj@arthur.pfalz.de>
+
+	* resolv/nss_dns/dns-host.c: Clean-up: delete unnecessary includes
+	and variables.
+
+Thu Jan 16 21:50:27 1997  Ulrich Drepper  <drepper@cygnus.com>
+
+	* inet/arpa/inet.h: Include <netinet/in.h> to get struct in_addr
+	defined.
+
+Tue Jan  7 17:29:59 1997  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>
+
+	* Makerules (LDLIBS-c.so): New variable.
+
+Tue Jan  7 19:22:00 1997  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>
+
+	* Makefile ($(includedir)/gnu/lib-names.h): Define the library
+	names as strings, not as sequence of tokens that may fall apart.
+
+Fri Jan 10 14:08:41 1997  Roland McGrath  <roland@fmh.frob.com>
+
+	* time/tzfile.c (__tzfile_read): Check for bogus type and zone name
+	indices in data file and punt, so a bogus file can't crash us.
+
+Thu Jan 16 20:29:15 1997  Ulrich Drepper  <drepper@cygnus.com>
+
+	* values.h [__USE_MISC]: Define BITSPERBYTE.
+
+Fri Jan 17 14:16:28 1997  Thomas Bushnell, n/BSG  <thomas@gnu.ai.mit.edu>
+
+	* stdio/vdprintf.c: Moved file to ...
+	* sysdeps/posix/vdprintf.c: Here.  De-ansideclificate.
+	* sysdeps/stub/vdprintf.c: New file.
+	* sysdeps/mach/hurd/vdprintf.c: New file.
+
+Thu Jan  9 15:59:35 1997  Thomas Bushnell, n/BSG  <thomas@gnu.ai.mit.edu>
+
+	* sysdeps/mach/hurd/posix_opt.h: New file.
+
+	* sysdeps/mach/hurd/sigwait.c (sigwait): Don't affect signal mask.
+
+	* sysdeps/unix/bsd/tcsendbrk.c (tcsendbreak): Finish
+	deansideclification.
+
+	* sysdeps/mach/libc-lock.h: Add kludges to pretend to implement
+	recursive locks.
+
+Tue Jan  7 09:48:15 1997  Andreas Jaeger  <aj@arthur.pfalz.de>
+
+	* signal/sigempty.c (sigemptyset): Correct typo: Empty set should
+	have all bits zero.
+
 Tue Jan  7 23:44:39 1997  Ulrich Drepper  <drepper@cygnus.com>
 
 	* inet/gethstbynm.c: Include additional headers for additional
diff --git a/FAQ b/FAQ
index e5b18bfdfa..642dfee9a6 100644
--- a/FAQ
+++ b/FAQ
@@ -260,7 +260,7 @@ incompatibilities:
 
 * swapon(): the interface of this function didn't changed, but the
   prototype is in a separate header file <sys/swap.h>.  For the additional
-  argument of of swapon() you should use the SWAP_* constants from
+  argument of swapon() you should use the SWAP_* constants from
   <linux/swap.h>, which get defined when <sys/swap.h> is included.
 
 * errno: If a program uses variable "errno", then it _must_ include header
@@ -298,6 +298,13 @@ incompatibilities:
   a separate library libresolv.  If you find some symbols starting with
   `res_*' undefined simply add -lresolv to your call of the linker.
 
+* the `signal' function's behaviour corresponds to the BSD semantic and
+  not the SysV semantic as it was in libc-5.  The interface on all GNU
+  systems shall be the same and BSD is the semantic of choice.  To use
+  the SysV behaviour simply use `sysv_signal'.  The major difference is
+  that the SysV implementation sets the SA_ONESHOT flag and so the handler
+  gets removed after the first call.
+
 
 ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
 [Q10]	``Why does getlogin() always return NULL on my Linux box?''
@@ -365,10 +372,10 @@ catalog files to the XPG4 form:
 [Q13]	``How do I configure GNU libc so that the essential libraries
 	  like libc.so go into /lib and the other into /usr/lib?''
 
-[A13] {UD} Like all other GNU packages GNU libc is configured to use a
-base directory and install all files relative to this.  If you intend
-to really use GNU libc on your system this base directory is /usr.  I.e.,
-you run
+[A13] {UD,AJ} Like all other GNU packages GNU libc is configured to
+use a base directory and install all files relative to this.  If you
+intend to really use GNU libc on your system this base directory is
+/usr.  I.e., you run
 	configure --prefix=/usr <other_options>
 
 Some systems like Linux have a filesystem standard which makes a
@@ -378,10 +385,10 @@ located on the same disk partition as /.  The /usr subtree might be
 found on another partition/disk.
 
 To install the essential libraries which come with GNU libc in /lib
-one must explicitly tell this.  Autoconf has no option for this so you
-have to use the file where all user supplied additional information
-should go in: `configparms' (see the `INSTALL' file).  For Linux the
-`configparms' file should contain:
+one must explicitly tell this (except on Linux, see below).  Autoconf
+has no option for this so you have to use the file where all user
+supplied additional information should go in: `configparms' (see the
+`INSTALL' file).  Therefore the `configparms' file should contain:
 
 slibdir=/lib
 sysconfdir=/etc
@@ -390,6 +397,10 @@ The first line specifies the directory for the essential libraries,
 the second line the directory for file which are by tradition placed
 in a directory named /etc.
 
+No rule without an exception: If you configure for Linux with
+--prefix=/usr, then slibdir and sysconfdir will automatically be
+defined as stated above.
+
 
 ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
 [Q14]	``When linking with the new libc I get unresolved symbols
@@ -534,7 +545,7 @@ a different name: ld-linux.so.2.  So you have to replace
 by
 	%{!dynamic-linker:-dynamic-linker=/home/gnu/lib/ld.so.1}
 
-in the above example specs file ti make it work for other systems.
+in the above example specs file to make it work for other systems.
 
 Future versions of GCC will automatically provide the correct specs.
 
@@ -606,6 +617,7 @@ Answers were given by:
 {DMT} David Mosberger-Tang, <davidm@AZStarNet.com>
 {RM} Roland McGrath, <roland@gnu.ai.mit.edu>
 {HJL} H.J. Lu, <hjl@gnu.ai.mit.edu>
+{AJ} Andreas Jaeger, <aj@arthur.pfalz.de>
 
 Local Variables:
  mode:text
diff --git a/Makeconfig b/Makeconfig
index 4f65e6d476..e3f7b5290e 100644
--- a/Makeconfig
+++ b/Makeconfig
@@ -1,4 +1,4 @@
-# Copyright (C) 1991, 92, 93, 94, 95, 96 Free Software Foundation, Inc.
+# Copyright (C) 1991, 92, 93, 94, 95, 96, 97 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
@@ -96,7 +96,7 @@ $(common-objpfx)config.make: $(common-objpfx)config.status $(..)config.h.in
 
 # Find all the sysdeps configure fragments, to make sure we re-run
 # configure when any of them changes.
-$(common-objpfx)config.status: $(..)configure \
+$(common-objpfx)config.status: $(..)version.h $(..)configure \
 			       $(foreach dir,$(full-config-sysdirs),\
 					 $(wildcard \
 					   $(dir)/Implies) \
diff --git a/Makefile b/Makefile
index 00be7a8d89..6420be8b30 100644
--- a/Makefile
+++ b/Makefile
@@ -38,7 +38,6 @@ endef
 
 configure: configure.in aclocal.m4; $(autoconf-it)
 %/configure: %/configure.in aclocal.m4; $(autoconf-it)
-config.status: configure version.h; $(SHELL) ./config.status --recheck
 
 include Makeconfig
 
@@ -198,7 +197,7 @@ $(includedir)/gnu/lib-names.h: $(common-objpfx)soversions.mk
 	  for l in $$libs; do \
 	    upname=`echo $$l | sed 's/[.]so.*//' | \
 		    tr '[:lower:]-' '[:upper:]_'`; \
-	    echo "#define	$${upname}_SO	$$l"; \
+	    echo "#define	$${upname}_SO	\"$$l\""; \
 	  done;) | sort; \
 	 echo; \
 	 echo '#endif	/* gnu/lib-names.h */';) > $(objpfx)lib-names.h
@@ -210,8 +209,8 @@ endif
 
 # The `glibcbug' script contains the version number and it shall be rebuild
 # whenever this changes or the `glibcbug.in' file.
-glibcbug: glibcbug.in config.status
-	CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status
+$(objpfx)glibcbug: $(common-objpfx)config.status glibcbug.in
+	cd $(<D); CONFIG_FILES=$(@F) CONFIG_HEADERS= $(SHELL) $(<F)
 
 # This makes the Info or DVI file of the documentation from the Texinfo source.
 .PHONY: info dvi
diff --git a/Makerules b/Makerules
index abff545546..88d55a664a 100644
--- a/Makerules
+++ b/Makerules
@@ -1,4 +1,4 @@
-# Copyright (C) 1991, 92, 93, 94, 95, 96 Free Software Foundation, Inc.
+# Copyright (C) 1991, 92, 93, 94, 95, 96, 97 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
@@ -344,6 +344,8 @@ endef
 # Also omits crti.o and crtn.o, which we do not want
 # since we define our own `.init' section specially.
 LDFLAGS-c.so = -nostdlib -nostartfiles
+# But we still want to link libc.so against -lgcc.
+LDLIBS-c.so = -lgcc
 # Give libc.so an entry point and make it directly runnable itself.
 LDFLAGS-c.so += -e __libc_main
 # Use our own special initializer and finalizer files for libc.so.
@@ -823,6 +825,7 @@ endef
 # Also remove the dependencies and generated source files.
 common-clean: common-mostlyclean
 	-rm -f $(addprefix $(objpfx),$(generated)) $(+depfiles)
+	-rm -fr $(addprefix $(objpfx),$(generated-dirs))
 	-rm -f $(addprefix $(common-objpfx),$(common-generated))
 	-rm -f $(common-objpfx)distinfo-$(subdir)
 
diff --git a/config.make.in b/config.make.in
index 8211b64b05..a4a667625e 100644
--- a/config.make.in
+++ b/config.make.in
@@ -23,6 +23,7 @@ have-initfini = @libc_cv_have_initfini@
 have-no-whole-archive = @libc_cv_ld_no_whole_archive@
 have-no-exceptions = @libc_cv_gcc_no_exceptions@
 have-bash2 = @libc_cv_have_bash2@
+have-ksh = @libc_cv_have_ksh@
 
 # Configuration options.
 gnu-as = @gnu_as@
@@ -49,5 +50,6 @@ INSTALL_DATA = @INSTALL_DATA@
 LN_S = @LN_S@
 MSGFMT = @MSGFMT@
 BASH = @BASH@
+KSH = @KSH@
 
 # More variables may be inserted below by configure.
diff --git a/configure b/configure
index cf93d8addb..b1772ec0ed 100755
--- a/configure
+++ b/configure
@@ -1409,8 +1409,53 @@ else
 fi
 
 
+if test "$BASH" = no; then
+  # Extract the first word of "ksh", so it can be a program name with args.
+set dummy ksh; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:1417: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_path_KSH'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  case "$KSH" in
+  /*)
+  ac_cv_path_KSH="$KSH" # Let the user override the test with a path.
+  ;;
+  *)
+  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS="${IFS}:"
+  for ac_dir in $PATH; do
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$ac_word; then
+      ac_cv_path_KSH="$ac_dir/$ac_word"
+      break
+    fi
+  done
+  IFS="$ac_save_ifs"
+  test -z "$ac_cv_path_KSH" && ac_cv_path_KSH="no"
+  ;;
+esac
+fi
+KSH="$ac_cv_path_KSH"
+if test -n "$KSH"; then
+  echo "$ac_t""$KSH" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+  if test "$KSH" = no; then
+    libc_cv_have_ksh=no
+  else
+    libc_cv_have_ksh=yes
+  fi
+else
+  KSH="$BASH"
+  
+  libc_cv_have_ksh=yes
+fi
+
+
 echo $ac_n "checking for signed size_t type""... $ac_c" 1>&6
-echo "configure:1414: checking for signed size_t type" >&5
+echo "configure:1459: checking for signed size_t type" >&5
 if eval "test \"`echo '$''{'libc_cv_signed_size_t'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1434,12 +1479,12 @@ EOF
 fi
 
 echo $ac_n "checking for libc-friendly stddef.h""... $ac_c" 1>&6
-echo "configure:1438: checking for libc-friendly stddef.h" >&5
+echo "configure:1483: checking for libc-friendly stddef.h" >&5
 if eval "test \"`echo '$''{'libc_cv_friendly_stddef'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1443 "configure"
+#line 1488 "configure"
 #include "confdefs.h"
 #define __need_size_t
 #define __need_wchar_t
@@ -1454,7 +1499,7 @@ size_t size; wchar_t wchar;
 if (&size == NULL || &wchar == NULL) abort ();
 ; return 0; }
 EOF
-if { (eval echo configure:1458: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1503: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   libc_cv_friendly_stddef=yes
 else
@@ -1473,7 +1518,7 @@ override stddef.h = # The installed <stddef.h> seems to be libc-friendly."
 fi
 
 echo $ac_n "checking whether we need to use -P to assemble .S files""... $ac_c" 1>&6
-echo "configure:1477: checking whether we need to use -P to assemble .S files" >&5
+echo "configure:1522: checking whether we need to use -P to assemble .S files" >&5
 if eval "test \"`echo '$''{'libc_cv_need_minus_P'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1496,7 +1541,7 @@ asm-CPPFLAGS = -P # The assembler can't grok cpp's # line directives."
 fi
 
 echo $ac_n "checking for assembler global-symbol directive""... $ac_c" 1>&6
-echo "configure:1500: checking for assembler global-symbol directive" >&5
+echo "configure:1545: checking for assembler global-symbol directive" >&5
 if eval "test \"`echo '$''{'libc_cv_asm_global_directive'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1526,7 +1571,7 @@ EOF
 fi
 
 echo $ac_n "checking for .set assembler directive""... $ac_c" 1>&6
-echo "configure:1530: checking for .set assembler directive" >&5
+echo "configure:1575: checking for .set assembler directive" >&5
 if eval "test \"`echo '$''{'libc_cv_asm_set_directive'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1561,12 +1606,12 @@ fi
 
 if test $elf != yes; then
   echo $ac_n "checking for .init and .fini sections""... $ac_c" 1>&6
-echo "configure:1565: checking for .init and .fini sections" >&5
+echo "configure:1610: checking for .init and .fini sections" >&5
 if eval "test \"`echo '$''{'libc_cv_have_initfini'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1570 "configure"
+#line 1615 "configure"
 #include "confdefs.h"
 
 int main() {
@@ -1575,7 +1620,7 @@ asm (".section .init");
 				    asm (".text");
 ; return 0; }
 EOF
-if { (eval echo configure:1579: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1624: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   libc_cv_have_initfini=yes
 else
@@ -1600,19 +1645,19 @@ if test $elf = yes; then
   libc_cv_asm_underscores=no
 else
   echo $ac_n "checking for _ prefix on C symbol names""... $ac_c" 1>&6
-echo "configure:1604: checking for _ prefix on C symbol names" >&5
+echo "configure:1649: checking for _ prefix on C symbol names" >&5
 if eval "test \"`echo '$''{'libc_cv_asm_underscores'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1609 "configure"
+#line 1654 "configure"
 #include "confdefs.h"
 asm ("_glibc_foobar:");
 int main() {
 glibc_foobar ();
 ; return 0; }
 EOF
-if { (eval echo configure:1616: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:1661: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   libc_cv_asm_underscores=yes
 else
@@ -1639,7 +1684,7 @@ if test $elf = yes; then
   libc_cv_asm_weakext_directive=no
 else
   echo $ac_n "checking for assembler .weak directive""... $ac_c" 1>&6
-echo "configure:1643: checking for assembler .weak directive" >&5
+echo "configure:1688: checking for assembler .weak directive" >&5
 if eval "test \"`echo '$''{'libc_cv_asm_weak_directive'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1662,7 +1707,7 @@ echo "$ac_t""$libc_cv_asm_weak_directive" 1>&6
 
 if test $libc_cv_asm_weak_directive = no; then
   echo $ac_n "checking for assembler .weakext directive""... $ac_c" 1>&6
-echo "configure:1666: checking for assembler .weakext directive" >&5
+echo "configure:1711: checking for assembler .weakext directive" >&5
 if eval "test \"`echo '$''{'libc_cv_asm_weakext_directive'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1699,7 +1744,7 @@ EOF
 fi
 
 echo $ac_n "checking for ld --no-whole-archive""... $ac_c" 1>&6
-echo "configure:1703: checking for ld --no-whole-archive" >&5
+echo "configure:1748: checking for ld --no-whole-archive" >&5
 if eval "test \"`echo '$''{'libc_cv_ld_no_whole_archive'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1710,7 +1755,7 @@ __throw () {}
 EOF
 if { ac_try='${CC-cc} $CFLAGS
 			    -nostdlib -nostartfiles -Wl,--no-whole-archive
-			    -o conftest conftest.c'; { (eval echo configure:1714: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then
+			    -o conftest conftest.c'; { (eval echo configure:1759: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then
   libc_cv_ld_no_whole_archive=yes
 else
   libc_cv_ld_no_whole_archive=no
@@ -1721,7 +1766,7 @@ fi
 echo "$ac_t""$libc_cv_ld_no_whole_archive" 1>&6
 
 echo $ac_n "checking for gcc -fno-exceptions""... $ac_c" 1>&6
-echo "configure:1725: checking for gcc -fno-exceptions" >&5
+echo "configure:1770: checking for gcc -fno-exceptions" >&5
 if eval "test \"`echo '$''{'libc_cv_gcc_no_exceptions'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1732,7 +1777,7 @@ __throw () {}
 EOF
 if { ac_try='${CC-cc} $CFLAGS
 			    -nostdlib -nostartfiles -fno-exceptions
-			    -o conftest conftest.c'; { (eval echo configure:1736: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then
+			    -o conftest conftest.c'; { (eval echo configure:1781: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then
   libc_cv_gcc_no_exceptions=yes
 else
   libc_cv_gcc_no_exceptions=no
@@ -1784,7 +1829,7 @@ if test "$uname" = generic; then
   fi
 
   echo $ac_n "checking OS release for uname""... $ac_c" 1>&6
-echo "configure:1788: checking OS release for uname" >&5
+echo "configure:1833: checking OS release for uname" >&5
 if eval "test \"`echo '$''{'libc_cv_uname_release'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1806,7 +1851,7 @@ echo "$ac_t""$libc_cv_uname_release" 1>&6
   uname_release="$libc_cv_uname_release"
 
   echo $ac_n "checking OS version for uname""... $ac_c" 1>&6
-echo "configure:1810: checking OS version for uname" >&5
+echo "configure:1855: checking OS version for uname" >&5
 if eval "test \"`echo '$''{'libc_cv_uname_version'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1828,7 +1873,7 @@ else
 fi
 
 echo $ac_n "checking stdio selection""... $ac_c" 1>&6
-echo "configure:1832: checking stdio selection" >&5
+echo "configure:1877: checking stdio selection" >&5
 
 case $stdio in
 libio) cat >> confdefs.h <<\EOF
@@ -1840,7 +1885,7 @@ esac
 echo "$ac_t""$stdio" 1>&6
 
 echo $ac_n "checking malloc selection""... $ac_c" 1>&6
-echo "configure:1844: checking malloc selection" >&5
+echo "configure:1889: checking malloc selection" >&5
 
 case $malloc in
 new-malloc) USE_NEW_MALLOC=-DUSE_NEW_MALLOC ;;
@@ -2052,6 +2097,8 @@ s%@AR@%$AR%g
 s%@RANLIB@%$RANLIB%g
 s%@BASH@%$BASH%g
 s%@libc_cv_have_bash2@%$libc_cv_have_bash2%g
+s%@KSH@%$KSH%g
+s%@libc_cv_have_ksh@%$libc_cv_have_ksh%g
 s%@libc_cv_have_initfini@%$libc_cv_have_initfini%g
 s%@libc_cv_ld_no_whole_archive@%$libc_cv_ld_no_whole_archive%g
 s%@libc_cv_gcc_no_exceptions@%$libc_cv_gcc_no_exceptions%g
diff --git a/configure.in b/configure.in
index 4716052ba9..7280c7a4ec 100644
--- a/configure.in
+++ b/configure.in
@@ -383,6 +383,21 @@ else
 fi
 AC_SUBST(libc_cv_have_bash2)
 
+dnl We need a ksh compatible shell for tzselect.
+if test "$BASH" = no; then
+  AC_PATH_PROG(KSH, ksh, no)
+  if test "$KSH" = no; then
+    libc_cv_have_ksh=no
+  else
+    libc_cv_have_ksh=yes
+  fi
+else
+  KSH="$BASH"
+  AC_SUBST(KSH)
+  libc_cv_have_ksh=yes
+fi
+AC_SUBST(libc_cv_have_ksh)
+
 AC_CACHE_CHECK(for signed size_t type, libc_cv_signed_size_t, [dnl
 echo '#include <stddef.h>
 FOOBAR __SIZE_TYPE__ FOOBAR' > conftest.c
diff --git a/elf/Makefile b/elf/Makefile
index 4cb8d7e53f..8f98cb8406 100644
--- a/elf/Makefile
+++ b/elf/Makefile
@@ -1,6 +1,6 @@
 # Makefile for elf subdirectory of GNU C Library.
 
-# Copyright (C) 1995, 1996 Free Software Foundation, Inc.
+# 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
@@ -100,13 +100,15 @@ $(objpfx)libdl.so: $(objpfx)libdl_pic.a $(common-objpfx)libc.so $(objpfx)ld.so
 $(slibdir)/$(rtld-installed-name): $(objpfx)ld.so; $(do-install-program)
 
 ifneq ($(have-bash2),yes)
-$(objpfx)ldd: ldd.sh.in Makefile
+$(objpfx)ldd: ldd.sh.in $(common-objpfx)version.mk \
+	      $(common-objpfx)soversions.mk $(common-objpfx)config.make
 	sed -e 's%@RTLD@%$(slibdir)/$(rtld-installed-name)%g' \
 	    -e 's%@VERSION@%$(version)%g' < $< > $@.new
 	chmod 555 $@.new
 	mv -f $@.new $@
 else
-$(objpfx)ldd: ldd.bash.in Makefile
+$(objpfx)ldd: ldd.bash.in $(common-objpfx)version.mk \
+	      $(common-objpfx)soversions.mk $(common-objpfx)config.make
 	sed -e 's%@BASH@%$(BASH)%g' \
 	    -e 's%@RTLD@%$(slibdir)/$(rtld-installed-name)%g' \
 	    -e 's%@VERSION@%$(version)%g' \
diff --git a/glibcbug.in b/glibcbug.in
index c23f32a9ea..6473b2c7e7 100644
--- a/glibcbug.in
+++ b/glibcbug.in
@@ -29,11 +29,11 @@ trap 'rm -f $TEMP $TEMP.x' 0
 PASSWD="cat /etc/passwd"
 
 if [ -f /usr/lib/sendmail ] ; then
-        RMAIL="/usr/lib/sendmail -oi -t"
+        MAIL_AGENT="/usr/lib/sendmail -oi -t"
 elif [ -f /usr/sbin/sendmail ] ; then
-        RMAIL="/usr/sbin/sendmail -oi -t"
+        MAIL_AGENT="/usr/sbin/sendmail -oi -t"
 else
-        RMAIL=rmail
+        MAIL_AGENT=rmail
 fi
 
 # Figure out how to echo a string without a trailing newline
@@ -153,8 +153,8 @@ SED_CMD='
 /$PATTERN/{
 s|||
 s|<.*>||
-s|^[    ]*||
-s|[     ]*$||
+s|^[ 	]*||
+s|[ 	]*$||
 p
 q
 }'
@@ -199,7 +199,7 @@ while :; do
     *)  echo "$COMMAND: \`$CLASS' is not a valid value for \`Class'."
   esac
 
-  [ $CNT -lt 5 ] &&
+  [ $CNT -lt 4 ] &&
     echo "Errors were found with the problem report."
 
   while :; do
@@ -239,9 +239,9 @@ sed  -e "
 /^>Description:/,/^>[A-Za-z-]*:/s;$DESCRIPTION_C;;
 /^>How-To-Repeat:/,/^>[A-Za-z-]*:/s;$HOW_TO_REPEAT_C;;
 /^>Fix:/,/^>[A-Za-z-]*:/s;$FIX_C;;
-" $TEMP > $REF
+" $TEMP > $TEMP.x
 
-if $MAIL_AGENT < $REF; then
+if $MAIL_AGENT $BUGGLIBC < $TEMP.x; then
   echo "$COMMAND: problem report sent"
   xs=0; exit
 else
diff --git a/inet/arpa/inet.h b/inet/arpa/inet.h
index 561994372f..03021e614c 100644
--- a/inet/arpa/inet.h
+++ b/inet/arpa/inet.h
@@ -40,6 +40,7 @@
 
 #include <sys/cdefs.h>
 #include <sys/types.h>
+#include <netinet/in.h>		/* To define `struct in_addr'.  */
 
 __BEGIN_DECLS
 u_long		 inet_addr __P((const char *));
diff --git a/inet/netinet/ip.h b/inet/netinet/ip.h
index 6624ac458e..65338852ae 100644
--- a/inet/netinet/ip.h
+++ b/inet/netinet/ip.h
@@ -77,7 +77,8 @@ struct ip {
 #define	IPTOS_LOWDELAY		0x10
 #define	IPTOS_THROUGHPUT	0x08
 #define	IPTOS_RELIABILITY	0x04
-/*	IPTOS_LOWCOST		0x02 XXX */
+#define	IPTOS_LOWCOST		0x02
+#define	IPTOS_MINCOST		IPTOS_LOWCOST
 
 /*
  * Definitions for IP precedence (also in ip_tos) (hopefully unused)
diff --git a/libc-symbols.h b/libc-symbols.h
index 370c631f20..b583f33133 100644
--- a/libc-symbols.h
+++ b/libc-symbols.h
@@ -1,25 +1,25 @@
 /* Support macros for making weak and strong aliases for symbols,
    and for using symbol sets and linker warnings with GNU ld.
-Copyright (C) 1995, 1996 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
-published by the Free Software Foundation; either version 2 of the
-License, or (at your option) any later version.
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
 
-The GNU C Library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-Library General Public License for more details.
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
 
-You should have received a copy of the GNU Library General Public
-License along with the GNU C Library; see the file COPYING.LIB.  If
-not, write to the Free Software Foundation, Inc., 675 Mass Ave,
-Cambridge, MA 02139, USA.  */
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
 
 #ifndef _LIBC_SYMBOLS_H
-#define _LIBC_SYMBOLS_H
+#define _LIBC_SYMBOLS_H	1
 
 /* This file's macros are included implicitly in the compilation of every
    file in the C library by -imacros.
@@ -225,6 +225,7 @@ extern const char _libc_intl_domainname[];
 #ifdef HAVE_GNU_LD
 #ifdef HAVE_ELF
 #define link_warning(symbol, msg)			\
+  asm(".section .gnu.warning." #symbol "; .previous");	\
   static const char __evoke_link_warning_##symbol[]	\
     __attribute__ ((section (".gnu.warning." #symbol))) = msg;
 #else
diff --git a/locale/C-time.c b/locale/C-time.c
index dbb51f383b..67254b2c53 100644
--- a/locale/C-time.c
+++ b/locale/C-time.c
@@ -1,21 +1,21 @@
-/* Copyright (C) 1995, 1996 Free Software Foundation, Inc.
-This file is part of the GNU C Library.
-Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.
+/* Copyright (C) 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>, 1995.
 
-The GNU C Library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Library General Public License as
-published by the Free Software Foundation; either version 2 of the
-License, or (at your option) any later version.
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
 
-The GNU C Library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-Library General Public License for more details.
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
 
-You should have received a copy of the GNU Library General Public
-License along with the GNU C Library; see the file COPYING.LIB.  If
-not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA.  */
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
 
 #include "localeinfo.h"
 
diff --git a/locale/localeinfo.h b/locale/localeinfo.h
index 335e866f91..018220f6df 100644
--- a/locale/localeinfo.h
+++ b/locale/localeinfo.h
@@ -1,21 +1,21 @@
 /* localeinfo.h -- declarations for internal libc locale interfaces
-Copyright (C) 1995, 1996 Free Software Foundation, Inc.
-This file is part of the GNU C Library.
-
-The GNU C Library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Library General Public License as
-published by the Free Software Foundation; either version 2 of the
-License, or (at your option) any later version.
-
-The GNU C Library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-Library General Public License for more details.
-
-You should have received a copy of the GNU Library General Public
-License along with the GNU C Library; see the file COPYING.LIB.  If
-not, write to the Free Software Foundation, Inc., 675 Mass Ave,
-Cambridge, MA 02139, USA.  */
+   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
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
 
 #ifndef _LOCALEINFO_H
 #define _LOCALEINFO_H 1
diff --git a/locale/programs/ld-time.c b/locale/programs/ld-time.c
index abd21dbc59..cc571b8a04 100644
--- a/locale/programs/ld-time.c
+++ b/locale/programs/ld-time.c
@@ -1,6 +1,6 @@
-/* Copyright (C) 1995, 1996 Free Software Foundation, Inc.
+/* Copyright (C) 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>.
+   Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.
 
    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
@@ -335,7 +335,7 @@ time_finish (struct localedef_t *locale)
 	  if (str == NULL || *str == '\0')
 	    {
 	      error (0, 0, _("missing era name in string %d in `era' field"
-			     "in category `%s'"), idx + 1, "LC_TIME");
+			     " in category `%s'"), idx + 1, "LC_TIME");
 	      time->era_entries[idx].name =
 		time->era_entries[idx].format = "";
 	    }
diff --git a/locale/programs/linereader.c b/locale/programs/linereader.c
index 4759615ec3..edb5a51f5c 100644
--- a/locale/programs/linereader.c
+++ b/locale/programs/linereader.c
@@ -1,21 +1,21 @@
-/* Copyright (C) 1996 Free Software Foundation, Inc.
-This file is part of the GNU C Library.
-Contributed by Ulrich Drepper, <drepper@gnu.ai.mit.edu>.
+/* Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1996.
 
-The GNU C Library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Library General Public License as
-published by the Free Software Foundation; either version 2 of the
-License, or (at your option) any later version.
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
 
-The GNU C Library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-Library General Public License for more details.
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
 
-You should have received a copy of the GNU Library General Public
-License along with the GNU C Library; see the file COPYING.LIB.  If
-not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA.  */
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
 
 #ifdef HAVE_CONFIG_H
 # include <config.h>
@@ -211,7 +211,7 @@ lr_token (struct linereader *lr, const struct charset_t *charset)
 	  lr->token.val.num += ch - '0';
 	}
       if (isalpha (ch))
-	lr_error (lr, _("garbage at end of digit"));
+	lr_error (lr, _("garbage at end of number"));
       lr_ungetn (lr, 1);
 
       return &lr->token;
diff --git a/malloc/malloc.c b/malloc/malloc.c
index 7e71e9777a..50bba6b446 100644
--- a/malloc/malloc.c
+++ b/malloc/malloc.c
@@ -1,5 +1,5 @@
 /* Malloc implementation for multiple threads without lock contention.
-   Copyright (C) 1996 Free Software Foundation, Inc.
+   Copyright (C) 1996, 1997 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Wolfram Gloger <wmglo@dent.med.uni-muenchen.de>
    and Doug Lea <dl@cs.oswego.edu>, 1996.
@@ -1521,7 +1521,7 @@ ptmalloc_init __MALLOC_P((void))
   __malloc_hook = malloc_starter;
   __free_hook = free_starter;
 #endif
-#if defined(_LIBC)
+#if defined(_LIBC) && !defined (NO_THREADS)
   /* Initialize the pthreads interface. */
   if (__pthread_initialize != NULL)
     __pthread_initialize();
diff --git a/misc/syslog.c b/misc/syslog.c
index 6e9cdef547..5521ceb9d0 100644
--- a/misc/syslog.c
+++ b/misc/syslog.c
@@ -73,7 +73,9 @@ __libc_lock_define_initialized (static, syslog_lock)
 static void openlog_internal(const char *, int, int);
 static void closelog_internal(void);
 static void sigpipe_handler (int);
+#ifdef _LIBC_REENTRANT
 static void cancel_handler (void *);
+#endif
 
 /*
  * syslog, vsyslog --
@@ -310,6 +312,7 @@ closelog ()
   __libc_cleanup_region_end (1);
 }
 
+#ifdef _LIBC_REENTRANT
 static void
 cancel_handler (void *ptr)
 {
@@ -322,6 +325,7 @@ cancel_handler (void *ptr)
   /* Free the lock.  */
   __libc_lock_unlock (syslog_lock);
 }
+#endif
 
 /* setlogmask -- set the log mask level */
 int
diff --git a/posix/getopt.c b/posix/getopt.c
index 1cefc10820..1c79eaaae2 100644
--- a/posix/getopt.c
+++ b/posix/getopt.c
@@ -763,8 +763,7 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only)
 	    if (opterr)
 	      {
 		/* 1003.2 specifies the format of this message.  */
-		fprintf (stderr,
-			 gettext ("%s: option requires an argument -- %c\n"),
+		fprintf (stderr, _("%s: option requires an argument -- %c\n"),
 			 argv[0], c);
 	      }
 	    optopt = c;
@@ -811,7 +810,7 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only)
 	if (ambig && !exact)
 	  {
 	    if (opterr)
-	      fprintf (stderr, gettext ("%s: option `-W %s' is ambiguous\n"),
+	      fprintf (stderr, _("%s: option `-W %s' is ambiguous\n"),
 		       argv[0], argv[optind]);
 	    nextchar += strlen (nextchar);
 	    optind++;
@@ -829,9 +828,9 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only)
 		else
 		  {
 		    if (opterr)
-		      fprintf (stderr,
-				 gettext ("%s: option `-W %s' doesn't allow an argument\n"),
-				 argv[0], pfound->name);
+		      fprintf (stderr, _("\
+%s: option `-W %s' doesn't allow an argument\n"),
+			       argv[0], pfound->name);
 
 		    nextchar += strlen (nextchar);
 		    return '?';
@@ -845,7 +844,7 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only)
 		  {
 		    if (opterr)
 		      fprintf (stderr,
-			 gettext ("%s: option `%s' requires an argument\n"),
+			       _("%s: option `%s' requires an argument\n"),
 			       argv[0], argv[optind - 1]);
 		    nextchar += strlen (nextchar);
 		    return optstring[0] == ':' ? ':' : '?';
diff --git a/resolv/nss_dns/dns-host.c b/resolv/nss_dns/dns-host.c
index 8d9d517542..374da83429 100644
--- a/resolv/nss_dns/dns-host.c
+++ b/resolv/nss_dns/dns-host.c
@@ -84,11 +84,6 @@
 #include <string.h>
 #include <sys/syslog.h>
 
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#include <arpa/nameser.h>
-#include <resolv.h>
-
 #include "nsswitch.h"
 
 /* Get implementation for some internal functions.  */
@@ -126,14 +121,6 @@ enum nss_status
 _nss_dns_gethostbyname2_r (const char *name, int af, struct hostent *result,
 			   char *buffer, size_t buflen, int *h_errnop)
 {
-  struct host_data
-  {
-    char *aliases[MAX_NR_ALIASES];
-    unsigned char host_addr[16];	/* IPv4 or IPv6 */
-    char *h_addr_ptrs[MAX_NR_ADDRS + 1];
-    char linebuffer[0];
-  } *host_data = (struct host_data *) buffer;
-  int linebuflen = buflen - offsetof (struct host_data, linebuffer);
   querybuf host_buffer;
   int size, type, n;
   const char *cp;
diff --git a/stdio-common/Makefile b/stdio-common/Makefile
index f4e49e6b9d..e7c1cb8c52 100644
--- a/stdio-common/Makefile
+++ b/stdio-common/Makefile
@@ -1,4 +1,4 @@
-# Copyright (C) 1991, 92, 93, 94, 95, 96 Free Software Foundation, Inc.
+# Copyright (C) 1991, 92, 93, 94, 95, 96, 97 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
@@ -43,7 +43,8 @@ tests := tst-printf tstscanf test_rdwr test-popen tstgetln test-fseek \
 	 xbug errnobug \
 	 bug1 bug2 bug3 bug4 bug5 bug6 bug7 bug8 bug9 bug10 bug11 \
 	 tfformat tiformat tstdiomisc \
-	 scanf1 scanf2 scanf3 scanf4 scanf5 scanf7 scanf8 scanf9 scanf10
+	 scanf1 scanf2 scanf3 scanf4 scanf5 scanf7 scanf8 scanf9 scanf10 \
+	 scanf11
 
 
 include ../Rules
diff --git a/stdio-common/bug10.c b/stdio-common/bug10.c
index 53064715ab..5e8ae25021 100644
--- a/stdio-common/bug10.c
+++ b/stdio-common/bug10.c
@@ -1,7 +1,7 @@
 #include <stdio.h>
 
 int
-main(int arc, char *argv)
+main (int arc, char *argv)
 {
   int n, res;
   unsigned int val;
@@ -14,7 +14,7 @@ main(int arc, char *argv)
   printf("Result of sscanf = %d\n", res);
   printf("Scanned format %%u = %u\n", val);
   printf("Possibly scanned format %%n = %d\n", n);
-  result |= res != 1 || val != 111 || n != 3;
+  result |= res != 2 || val != 111 || n != 3;
 
 
   result |= sscanf ("", " %n", &n) == EOF;
diff --git a/stdio-common/scanf1.c b/stdio-common/scanf1.c
index 3adf532250..58c78c2292 100644
--- a/stdio-common/scanf1.c
+++ b/stdio-common/scanf1.c
@@ -2,14 +2,14 @@
 #include  <stdlib.h>
 
 int
-main(int argc, char *argv[])
+main (int argc, char *argv[])
 {
   int i,n,r;
 
   n = i = r = -1;
-  r = sscanf("1234:567", "%d%n", &i, &n);
-  printf("%d %d %d\n", r, n, i);
-  if (r != 1 || i != 1234 || n != 4)
+  r = sscanf ("1234:567", "%d%n", &i, &n);
+  printf ("%d %d %d\n", r, n, i);
+  if (r != 2 || i != 1234 || n != 4)
     abort ();
   return 0;
 }
diff --git a/stdio-common/scanf10.c b/stdio-common/scanf10.c
index f8961378ef..27a5e66a9e 100644
--- a/stdio-common/scanf10.c
+++ b/stdio-common/scanf10.c
@@ -11,5 +11,5 @@ main (int argc, char *argv[])
 
   printf ("retc=%d a=%d b=%d\n", retc, a, b);
 
-  return retc == -1 && a == 6 && b == 12 ? 0 : 1;
+  return retc == 2 && a == 6 && b == 12 ? 0 : 1;
 }
diff --git a/stdio-common/scanf11.c b/stdio-common/scanf11.c
new file mode 100644
index 0000000000..50ef26aded
--- /dev/null
+++ b/stdio-common/scanf11.c
@@ -0,0 +1,14 @@
+/* This test comes from ISO C Corrigendum 1.  */
+#include <stdio.h>
+
+int
+main (int argc, char *argv[])
+{
+  int d1, n1, n2, i;
+#define NOISE 1234567
+  int d2 = NOISE;
+
+  i = sscanf ("123", "%d%n%n%d", &d1, &n1, &n2, &d2);
+
+  return i != 3 || d1 != 123 || n1 != 3 || n2 != 3 || d2 != NOISE;
+}
diff --git a/stdio-common/scanf3.c b/stdio-common/scanf3.c
index 33495cca79..5bfa80b62f 100644
--- a/stdio-common/scanf3.c
+++ b/stdio-common/scanf3.c
@@ -13,7 +13,7 @@ main(int arc, char *argv[])
   printf("Result of sscanf = %d\n", res);
   printf("Scanned format %%u = %u\n", val);
   printf("Possibly scanned format %%n = %d\n", n);
-  if (n != 3 || val != 111 || res != 1)
+  if (n != 3 || val != 111 || res != 2)
     abort ();
 
   val = n = -1;
@@ -21,7 +21,7 @@ main(int arc, char *argv[])
   printf("Result of sscanf = %d\n", res);
   printf("Scanned format %%u = %u\n", val);
   printf("Possibly scanned format %%n = %d\n", n);
-  if (n != 3 || val != 111 || res != 1)
+  if (n != 3 || val != 111 || res != 2)
     abort ();
 
   return 0;
diff --git a/stdio-common/tstdiomisc.c b/stdio-common/tstdiomisc.c
index 8dac4f2039..dbce6237c9 100644
--- a/stdio-common/tstdiomisc.c
+++ b/stdio-common/tstdiomisc.c
@@ -27,7 +27,7 @@ t2 (void)
   SCAN ("12345", "%ld", N, 1, 12345);
   SCAN ("12345", "%llllld", N, 0, -1);
   SCAN ("12345", "%LLLLLd", N, 0, -1);
-  SCAN ("test ", "%*s%n",  n, 0, 4);
+  SCAN ("test ", "%*s%n",  n, 1, 4);
   SCAN ("test ",   "%2*s%n",  n, 0, -1);
   SCAN ("12 ",   "%l2d",  n, 0, -1);
   SCAN ("12 ",   "%2ld",  N, 1, 12);
diff --git a/stdio-common/vfscanf.c b/stdio-common/vfscanf.c
index cb6d39629e..ef0dbeea32 100644
--- a/stdio-common/vfscanf.c
+++ b/stdio-common/vfscanf.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 92, 93, 94, 95, 96 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 92, 93, 94, 95, 96, 97 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
@@ -452,15 +452,18 @@ __vfscanf (FILE *s, const char *format, va_list argptr)
 	  /* Corrigendum 1 to ISO C 1990 describes the allowed flags
 	     with the 'n' conversion specifier.  */
 	  if (!(flags & SUPPRESS))
-	    /* Don't count the read-ahead.  */
-	    if (flags & LONGDBL)
-	      *ARG (long long int *) = read_in;
-	    else if (flags & LONG)
-	      *ARG (long int *) = read_in;
-	    else if (flags & SHORT)
-	      *ARG (short int *) = read_in;
-	    else
-	      *ARG (int *) = read_in;
+	    {
+	      /* Don't count the read-ahead.  */
+	      if (flags & LONGDBL)
+		*ARG (long long int *) = read_in;
+	      else if (flags & LONG)
+		*ARG (long int *) = read_in;
+	      else if (flags & SHORT)
+		*ARG (short int *) = read_in;
+	      else
+		*ARG (int *) = read_in;
+	      ++done;
+	    }
 	  break;
 
 	case 'c':	/* Match characters.  */
diff --git a/stdlib/strtol.c b/stdlib/strtol.c
index 5a097b40a4..396e2ecd74 100644
--- a/stdlib/strtol.c
+++ b/stdlib/strtol.c
@@ -1,5 +1,5 @@
 /* strtol - Convert string representation of a number into an integer value.
-   Copyright (C) 1991, 92, 94, 95, 96 Free Software Foundation, Inc.
+   Copyright (C) 1991, 92, 94, 95, 96, 97 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
@@ -217,13 +217,8 @@ INTERNAL (strtol) (nptr, endptr, base, group)
   /* Check for a sign.  */
   if (*s == L_('-'))
     {
-#if UNSIGNED
-      __set_errno (EINVAL);
-      return 0;
-#else
       negative = 1;
       ++s;
-#endif
     }
   else if (*s == L_('+'))
     {
@@ -317,6 +312,8 @@ INTERNAL (strtol) (nptr, endptr, base, group)
 	      ? -((unsigned LONG int) (LONG_MIN + 1)) + 1
 	      : (unsigned LONG int) LONG_MAX))
     overflow = 1;
+#else
+  overflow |= negative;
 #endif
 
   if (overflow)
diff --git a/stdlib/tst-strtol.c b/stdlib/tst-strtol.c
index 58878f236e..1d398b4558 100644
--- a/stdlib/tst-strtol.c
+++ b/stdlib/tst-strtol.c
@@ -37,8 +37,8 @@ static const struct ltest tests[] =
     { "  0",		0,		0,	0,	0 },
     { "0xffffffffg",	0xffffffff,	0,	'g',	0 },
     { "0xf1f2f3f4f5",	0xffffffff,	0,	0,	ERANGE },
-    { "-0x123456789",	0,		0,	0,	EINVAL },
-    { "-0xfedcba98",	0,		0,	0,	EINVAL },
+    { "-0x123456789",	0xffffffff,	0,	0,	ERANGE },
+    { "-0xfedcba98",	0xffffffff,	0,	0,	ERANGE },
     { NULL,		0,		0,	0,	0 },
 #else
     /* assume 64 bit long... */
@@ -65,8 +65,8 @@ static const struct ltest tests[] =
     { "0xffffffffg",	0xffffffff,	0,	'g',	0 },
     { "0xffffffffffffffffg",	0xffffffffffffffff,	0,	'g',	0 },
     { "0xf1f2f3f4f5f6f7f8f9",	0xffffffffffffffff,	0,	0,	ERANGE },
-    { "-0x123456789abcdef01",	0,			0,	0,	EINVAL },
-    { "-0xfedcba987654321",	0,			0,	0,	EINVAL },
+    { "-0x123456789abcdef01",	0xffffffffffffffff,	0,	0,	ERANGE },
+    { "-0xfedcba987654321",	0xffffffffffffffff,	0,	0,	ERANGE },
     { NULL,		0,		0,	0,	0 },
 #endif
   };
diff --git a/sysdeps/generic/sysd-stdio.c b/sysdeps/generic/sysd-stdio.c
index d28dde87f1..363a763449 100644
--- a/sysdeps/generic/sysd-stdio.c
+++ b/sysdeps/generic/sysd-stdio.c
@@ -1,20 +1,20 @@
-/* Copyright (C) 1991, 92, 93, 94, 95, 96 Free Software Foundation, Inc.
-This file is part of the GNU C Library.
+/* Copyright (C) 1991, 92, 93, 94, 95, 96, 97 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
 
-The GNU C Library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Library General Public License as
-published by the Free Software Foundation; either version 2 of the
-License, or (at your option) any later version.
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
 
-The GNU C Library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-Library General Public License for more details.
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
 
-You should have received a copy of the GNU Library General Public
-License along with the GNU C Library; see the file COPYING.LIB.  If
-not, write to the Free Software Foundation, Inc., 675 Mass Ave,
-Cambridge, MA 02139, USA.  */
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
 
 #include <stddef.h>
 #include <stdio.h>
@@ -163,7 +163,7 @@ __stdio_open (filename, m, cookieptr)
 /* Open FILENAME with the mode in M.  Use the same magic cookie
    already in *COOKIEPTR if possible, closing the old cookie with CLOSEFN.  */
 int
-__stdio_reopen (filename, m, cookieptr)
+__stdio_reopen (filename, m, cookieptr, closefn)
      const char *filename;
      __io_mode m;
      void **cookieptr;
diff --git a/sysdeps/libm-i387/e_exp.S b/sysdeps/libm-i387/e_exp.S
index 3c9d45b746..e76b9c63df 100644
--- a/sysdeps/libm-i387/e_exp.S
+++ b/sysdeps/libm-i387/e_exp.S
@@ -24,7 +24,7 @@ ENTRY(__ieee754_exp)
 	fmulp				/* x * log2(e) */
 	fstl	%st(1)
 	frndint				/* int(x * log2(e)) */
-	fsub	%st,%st(1)		/* fract(x * log2(e)) */
+	fsubr	%st,%st(1)		/* fract(x * log2(e)) */
 	fxch
 	f2xm1				/* 2^(fract(x * log2(e))) - 1 */
 	fld1
diff --git a/sysdeps/libm-i387/e_expf.S b/sysdeps/libm-i387/e_expf.S
index cd8dc7f0b9..9a669cf8d4 100644
--- a/sysdeps/libm-i387/e_expf.S
+++ b/sysdeps/libm-i387/e_expf.S
@@ -25,7 +25,7 @@ ENTRY(__ieee754_expf)
 	fmulp				/* x * log2(e) */
 	fstl	%st(1)
 	frndint				/* int(x * log2(e)) */
-	fsub	%st,%st(1)		/* fract(x * log2(e)) */
+	fsubr	%st,%st(1)		/* fract(x * log2(e)) */
 	fxch
 	f2xm1				/* 2^(fract(x * log2(e))) - 1 */
 	fld1
diff --git a/sysdeps/libm-i387/e_expl.S b/sysdeps/libm-i387/e_expl.S
index e398a90ef6..e83d30640d 100644
--- a/sysdeps/libm-i387/e_expl.S
+++ b/sysdeps/libm-i387/e_expl.S
@@ -26,7 +26,7 @@ ENTRY(__ieee754_expl)
 	fmulp				/* x * log2(e) */
 	fstl	%st(1)
 	frndint				/* int(x * log2(e)) */
-	fsub	%st,%st(1)		/* fract(x * log2(e)) */
+	fsubr	%st,%st(1)		/* fract(x * log2(e)) */
 	fxch
 	f2xm1				/* 2^(fract(x * log2(e))) - 1 */
 	fld1
diff --git a/sysdeps/libm-i387/s_expm1.S b/sysdeps/libm-i387/s_expm1.S
index 2685d6e770..78e8013b7e 100644
--- a/sysdeps/libm-i387/s_expm1.S
+++ b/sysdeps/libm-i387/s_expm1.S
@@ -1,8 +1,9 @@
 /* ix87 specific implementation of exp(x)-1.
-   Copyright (C) 1996 Free Software Foundation, Inc.
+   Copyright (C) 1996, 1997 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
    Based on code by John C. Bowman <bowman@ipp-garching.mpg.de>.
+   Corrections by H.J. Lu (hjl@gnu.ai.mit.edu), 1997.
 
    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
@@ -64,15 +65,16 @@ ENTRY(__expm1)
 	fmulp			// log2(e)*x
 	fld	%st		// log2(e)*x : log2(e)*x
 	frndint			// int(log2(e)*x) : log2(e)*x
-	fsub	%st, %st(1)	// int(log2(e)*x) : fract(log2(e)*x)
+	fsubr	%st, %st(1)	// int(log2(e)*x) : fract(log2(e)*x)
 	fxch			// fract(log2(e)*x) : int(log2(e)*x)
 	f2xm1			// 2^fract(log2(e)*x)-1 : int(log2(e)*x)
 	fscale			// 2^(log2(e)*x)-2^int(log2(e)*x) : int(log2(e)*x)
 	fxch			// int(log2(e)*x) : 2^(log2(e)*x)-2^int(log2(e)*x)
 	fldl	MO(one)		// 1 : int(log2(e)*x) : 2^(log2(e)*x)-2^int(log2(e)*x)
-	fscale			// 2^int(log2(e)*x) : 2^(log2(e)*x)-2^int(log2(e)*x)
-	faddp			// 2^(log2(e)*x)
-	fsubl	MO(one)
+	fscale			// 2^int(log2(e)*x) : int(log2(e)*x) : 2^(log2(e)*x)-2^int(log2(e)*x)
+	fsubrl	MO(one)		// 1-2^int(log2(e)*x) : int(log2(e)*x) : 2^(log2(e)*x)-2^int(log2(e)*x)
+	fstp	%st(1)		// 1-2^int(log2(e)*x) : 2^(log2(e)*x)-2^int(log2(e)*x)
+	fsubrp	%st, %st(1)	// 2^(log2(e)*x)
 	ret
 
 2:	testl	$0x200, %eax	// Test sign.
diff --git a/sysdeps/libm-i387/s_expm1f.S b/sysdeps/libm-i387/s_expm1f.S
index 85c3c849f1..00f1562e73 100644
--- a/sysdeps/libm-i387/s_expm1f.S
+++ b/sysdeps/libm-i387/s_expm1f.S
@@ -1,8 +1,9 @@
 /* ix87 specific implementation of exp(x)-1.
-   Copyright (C) 1996 Free Software Foundation, Inc.
+   Copyright (C) 1996, 1997 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
    Based on code by John C. Bowman <bowman@ipp-garching.mpg.de>.
+   Corrections by H.J. Lu (hjl@gnu.ai.mit.edu), 1997.
 
    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
@@ -64,15 +65,16 @@ ENTRY(__expm1f)
 	fmulp			// log2(e)*x
 	fld	%st		// log2(e)*x : log2(e)*x
 	frndint			// int(log2(e)*x) : log2(e)*x
-	fsub	%st, %st(1)	// int(log2(e)*x) : fract(log2(e)*x)
+	fsubr	%st, %st(1)	// int(log2(e)*x) : fract(log2(e)*x)
 	fxch			// fract(log2(e)*x) : int(log2(e)*x)
 	f2xm1			// 2^fract(log2(e)*x)-1 : int(log2(e)*x)
 	fscale			// 2^(log2(e)*x)-2^int(log2(e)*x) : int(log2(e)*x)
 	fxch			// int(log2(e)*x) : 2^(log2(e)*x)-2^int(log2(e)*x)
 	fldl	MO(one)		// 1 : int(log2(e)*x) : 2^(log2(e)*x)-2^int(log2(e)*x)
-	fscale			// 2^int(log2(e)*x) : 2^(log2(e)*x)-2^int(log2(e)*x)
-	faddp			// 2^(log2(e)*x)
-	fsubl	MO(one)
+	fscale			// 2^int(log2(e)*x) : int(log2(e)*x) : 2^(log2(e)*x)-2^int(log2(e)*x)
+	fsubrl	MO(one)		// 1-2^int(log2(e)*x) : int(log2(e)*x) : 2^(log2(e)*x)-2^int(log2(e)*x)
+	fstp	%st(1)		// 1-2^int(log2(e)*x) : 2^(log2(e)*x)-2^int(log2(e)*x)
+	fsubrp	%st, %st(1)	// 2^(log2(e)*x)
 	ret
 
 2:	testl	$0x200, %eax	// Test sign.
diff --git a/sysdeps/libm-i387/s_expm1l.S b/sysdeps/libm-i387/s_expm1l.S
index 45aa753094..b7e6b36d39 100644
--- a/sysdeps/libm-i387/s_expm1l.S
+++ b/sysdeps/libm-i387/s_expm1l.S
@@ -1,8 +1,9 @@
 /* ix87 specific implementation of exp(x)-1.
-   Copyright (C) 1996 Free Software Foundation, Inc.
+   Copyright (C) 1996, 1997 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
    Based on code by John C. Bowman <bowman@ipp-garching.mpg.de>.
+   Corrections by H.J. Lu (hjl@gnu.ai.mit.edu), 1997.
 
    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
@@ -64,15 +65,16 @@ ENTRY(__expm1l)
 	fmulp			// log2(e)*x
 	fld	%st		// log2(e)*x : log2(e)*x
 	frndint			// int(log2(e)*x) : log2(e)*x
-	fsub	%st, %st(1)	// int(log2(e)*x) : fract(log2(e)*x)
+	fsubr	%st, %st(1)	// int(log2(e)*x) : fract(log2(e)*x)
 	fxch			// fract(log2(e)*x) : int(log2(e)*x)
 	f2xm1			// 2^fract(log2(e)*x)-1 : int(log2(e)*x)
 	fscale			// 2^(log2(e)*x)-2^int(log2(e)*x) : int(log2(e)*x)
 	fxch			// int(log2(e)*x) : 2^(log2(e)*x)-2^int(log2(e)*x)
 	fldl	MO(one)		// 1 : int(log2(e)*x) : 2^(log2(e)*x)-2^int(log2(e)*x)
-	fscale			// 2^int(log2(e)*x) : 2^(log2(e)*x)-2^int(log2(e)*x)
-	faddp			// 2^(log2(e)*x)
-	fsubl	MO(one)
+	fscale			// 2^int(log2(e)*x) : int(log2(e)*x) : 2^(log2(e)*x)-2^int(log2(e)*x)
+	fsubrl	MO(one)		// 1-2^int(log2(e)*x) : int(log2(e)*x) : 2^(log2(e)*x)-2^int(log2(e)*x)
+	fstp	%st(1)		// 1-2^int(log2(e)*x) : 2^(log2(e)*x)-2^int(log2(e)*x)
+	fsubrp	%st, %st(1)	// 2^(log2(e)*x)
 	ret
 
 2:	testl	$0x200, %eax	// Test sign.
diff --git a/sysdeps/mach/hurd/posix_opt.h b/sysdeps/mach/hurd/posix_opt.h
index 75a07e1539..045b4b6666 100644
--- a/sysdeps/mach/hurd/posix_opt.h
+++ b/sysdeps/mach/hurd/posix_opt.h
@@ -1,3 +1,12 @@
+/* Posix options supported by the GNU Hurd port of GNU libc. */
+
+#define _POSIX_JOB_CONTROL	1
+#define _POSIX_SAVED_IDS	1
+#define _POSIX_VDISABLE		((unsigned char) -1)
+
+/* Different Hurd filesystems might do these differently. */
+#undef _POSIX_CHOWN_RESTRICTED
+#undef _POSIX_NO_TRUNC
 /* Posix options supported by the GNU Hurd port of GNU libc. */ 
 
 #define _POSIX_JOB_CONTROL	1
diff --git a/sysdeps/mach/hurd/vdprintf.c b/sysdeps/mach/hurd/vdprintf.c
index 002f8c630a..a69607e663 100644
--- a/sysdeps/mach/hurd/vdprintf.c
+++ b/sysdeps/mach/hurd/vdprintf.c
@@ -55,3 +55,60 @@ vdprintf (int d, const char *format, va_list arg)
 
   return done;
 }
+/* Copyright (C) 1991, 1992, 1993, 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
+published by the Free Software Foundation; either version 2 of the
+License, or (at your option) any later version.
+
+The GNU C Library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with the GNU C Library; see the file COPYING.LIB.  If
+not, write to the Free Software Foundation, Inc., 675 Mass Ave,
+Cambridge, MA 02139, USA.  */
+
+#include <errno.h>
+#include <limits.h>
+#include <stdarg.h>
+#include <stdio.h>
+#include <string.h>
+#include <hurd/fd.h>
+
+/* Write formatted output to file descriptor D according to the format string
+   FORMAT, using the argument list in ARG.  */
+int
+vdprintf (int d, const char *format, va_list arg)
+{
+  int done;
+  FILE f;
+  struct hurd_fd *fd;
+
+  HURD_CRITICAL_BEGIN;
+  fd = _hurd_fd_get (fd);
+  HURD_CRITICAL_END;
+
+  if (!fd)
+    return 0;
+
+  /* Create an unbuffered stream talking to D on the stack.  */
+  memset ((PTR) &f, 0, sizeof(f));
+  f.__magic = _IOMAGIC;
+  f.__mode.__write = 1;
+  f.__cookie = fd;
+  f.__room_funcs = __default_room_functions;
+  f.__io_funcs = __default_io_functions;
+  f.__seen = 1;
+  f.__userbuf = 1;
+
+  /* vfprintf will use a buffer on the stack for the life of the call,
+     and flush it when finished.  */
+  done = vfprintf (&f, format, arg);
+
+  return done;
+}
diff --git a/sysdeps/mach/libc-lock.h b/sysdeps/mach/libc-lock.h
index 53dc8ee9e0..05eb70c56f 100644
--- a/sysdeps/mach/libc-lock.h
+++ b/sysdeps/mach/libc-lock.h
@@ -1,21 +1,21 @@
 /* libc-internal interface for mutex locks.  Mach cthreads version.
-Copyright (C) 1996, 1997 Free Software Foundation, Inc.
-This file is part of the GNU C Library.
+   Copyright (C) 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
-published by the Free Software Foundation; either version 2 of the
-License, or (at your option) any later version.
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
 
-The GNU C Library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-Library General Public License for more details.
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
 
-You should have received a copy of the GNU Library General Public
-License along with the GNU C Library; see the file COPYING.LIB.  If
-not, write to the Free Software Foundation, Inc., 675 Mass Ave,
-Cambridge, MA 02139, USA.  */
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
 
 #ifndef _LIBC_LOCK_H
 #define _LIBC_LOCK_H 1
@@ -87,4 +87,12 @@ typedef struct __libc_lock_opaque__ __libc_lock_t;
 #define __libc_lock_unlock_recursive __libc_lock_unlock
 #define __libc_lock_lock_recursive __libc_lock_lock
 
+/* XXX until cthreads supports recursive locks */
+#define __libc_lock_define_initialized_recursive __libc_lock_define_initialized
+#define __libc_lock_init_recursive __libc_lock_init
+#define __libc_lock_fini_recursive __libc_lock_fini
+#define __libc_lock_trylock_recursive __libc_lock_trylock
+#define __libc_lock_unlock_recursive __libc_lock_unlock
+#define __libc_lock_lock_recursive __libc_lock_lock
+
 #endif	/* libc-lock.h */
diff --git a/sysdeps/posix/vdprintf.c b/sysdeps/posix/vdprintf.c
index 5147bb84bc..1cb05723b4 100644
--- a/sysdeps/posix/vdprintf.c
+++ b/sysdeps/posix/vdprintf.c
@@ -47,3 +47,52 @@ vdprintf (int d, const char *format, va_list arg)
 
   return done;
 }
+/* Copyright (C) 1991, 1992, 1993, 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
+published by the Free Software Foundation; either version 2 of the
+License, or (at your option) any later version.
+
+The GNU C Library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with the GNU C Library; see the file COPYING.LIB.  If
+not, write to the Free Software Foundation, Inc., 675 Mass Ave,
+Cambridge, MA 02139, USA.  */
+
+#include <errno.h>
+#include <limits.h>
+#include <stdarg.h>
+#include <stdio.h>
+#include <string.h>
+
+
+/* Write formatted output to file descriptor D according to the format string
+   FORMAT, using the argument list in ARG.  */
+int
+vdprintf (int d, const char *format, va_list arg)
+{
+  int done;
+  FILE f;
+
+  /* Create an unbuffered stream talking to D on the stack.  */
+  memset ((PTR) &f, 0, sizeof(f));
+  f.__magic = _IOMAGIC;
+  f.__mode.__write = 1;
+  f.__cookie = (PTR) (long int) d; /* Casting to long quiets GCC on Alpha.  */
+  f.__room_funcs = __default_room_functions;
+  f.__io_funcs = __default_io_functions;
+  f.__seen = 1;
+  f.__userbuf = 1;
+
+  /* vfprintf will use a buffer on the stack for the life of the call,
+     and flush it when finished.  */
+  done = vfprintf (&f, format, arg);
+
+  return done;
+}
diff --git a/sysdeps/stub/vdprintf.c b/sysdeps/stub/vdprintf.c
index 729f0123ca..f7ae121097 100644
--- a/sysdeps/stub/vdprintf.c
+++ b/sysdeps/stub/vdprintf.c
@@ -29,3 +29,34 @@ vdprintf (int d, const char *format, va_list arg)
 }
 
 stub_warning (vdprintf)
+/* Copyright (C) 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
+published by the Free Software Foundation; either version 2 of the
+License, or (at your option) any later version.
+
+The GNU C Library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with the GNU C Library; see the file COPYING.LIB.  If
+not, write to the Free Software Foundation, Inc., 675 Mass Ave,
+Cambridge, MA 02139, USA.  */
+ 
+#include <errno.h>
+#include <stdio.h>
+
+/* Write formatted output to file descriptor D according to the format string
+   FORMAT, using the argument list in ARG.  */
+int
+vdprintf (int d, const char *format, va_list arg)
+{
+  __set_errno (ENOSYS);
+  return NULL;
+}
+
+stub_warning (vdprintf)
diff --git a/sysdeps/unix/Makefile b/sysdeps/unix/Makefile
index 15993b34ac..1aea477064 100644
--- a/sysdeps/unix/Makefile
+++ b/sysdeps/unix/Makefile
@@ -289,7 +289,7 @@ $(common-objpfx)sysd-syscalls: $(..)sysdeps/unix/make-syscalls.sh \
 	  test -f $$dir/syscalls.list && \
 	  { $(SHELL) $(dir $<)$(notdir $<) \
 		     $$dir $(object-suffixes) || exit 1; }; \
-	  test $$dir = sysdeps/unix && break; \
+	  test $$dir = $(..)sysdeps/unix && break; \
 	done > $@T
 	mv -f $@T $@
 
diff --git a/sysdeps/unix/bsd/bsd4.4/direntry.h b/sysdeps/unix/bsd/bsd4.4/direntry.h
index c221d55c0d..b9e0d7277e 100644
--- a/sysdeps/unix/bsd/bsd4.4/direntry.h
+++ b/sysdeps/unix/bsd/bsd4.4/direntry.h
@@ -1,21 +1,21 @@
 /* Directory entry structure `struct dirent'.  4.4BSD version.
-Copyright (C) 1996 Free Software Foundation, Inc.
-This file is part of the GNU C Library.
+   Copyright (C) 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
-published by the Free Software Foundation; either version 2 of the
-License, or (at your option) any later version.
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
 
-The GNU C Library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-Library General Public License for more details.
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
 
-You should have received a copy of the GNU Library General Public
-License along with the GNU C Library; see the file COPYING.LIB.  If
-not, write to the Free Software Foundation, Inc., 675 Mass Ave,
-Cambridge, MA 02139, USA.  */
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
 
 struct dirent
   {
diff --git a/sysdeps/unix/sysv/linux/alpha/kernel_sigaction.h b/sysdeps/unix/sysv/linux/alpha/kernel_sigaction.h
new file mode 100644
index 0000000000..900bff4aab
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/alpha/kernel_sigaction.h
@@ -0,0 +1,7 @@
+/* This is the sigaction struction from the Linux 2.1.20 kernel.  */
+
+struct kernel_sigaction {
+	__sighandler_t sa_handler;
+	unsigned long sa_mask;
+	unsigned int sa_flags;
+};
diff --git a/sysdeps/unix/sysv/linux/alpha/sys/ipc_buf.h b/sysdeps/unix/sysv/linux/alpha/sys/ipc_buf.h
new file mode 100644
index 0000000000..57830daae1
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/alpha/sys/ipc_buf.h
@@ -0,0 +1,85 @@
+/* Copyright (C) 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>, August 1995.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#ifndef _SYS_IPC_BUF_H
+
+#define _SYS_IPC_BUF_H	1
+#include <features.h>
+
+#include <sys/types.h>
+
+/* Mode bits for `msgget', `semget', and `shmget'.  */
+#define IPC_CREAT	01000		/* Create key if key does not exist. */
+#define IPC_EXCL	02000		/* Fail if key exists.  */
+#define IPC_NOWAIT	04000		/* Return error on wait.  */
+
+/* Control commands for `msgctl', `semctl', and `shmctl'.  */
+#define IPC_RMID	0		/* Remove identifier.  */
+#define IPC_SET		1		/* Set `ipc_perm' options.  */
+#define IPC_STAT	2		/* Get `ipc_perm' options.  */
+#define IPC_INFO	3		/* See ipcs.  */
+
+
+__BEGIN_DECLS
+
+/* Special key values.  */
+#define IPC_PRIVATE	((__key_t) 0)	/* Private key.  */
+
+
+/* Data structure used to pass permission information to IPC operations.  */
+struct ipc_perm
+  {
+    __key_t __key;			/* Key.  */
+    unsigned int uid;			/* Owner's user ID.  */
+    unsigned int gid;			/* Owner's group ID.  */
+    unsigned int cuid;			/* Creator's user ID.  */
+    unsigned int cgid;			/* Creator's group ID.  */
+    unsigned int mode;			/* Read/write permission.  */
+    unsigned short int __seq;		/* Sequence number.  */
+  };
+
+
+/* Kludge to work around Linux' restriction of only up to five
+   arguments to a system call.  */
+struct ipc_kludge
+  {
+    void *msgp;
+    long int msgtyp;
+  };
+
+/* The actual system call: all functions are multiplexed by this.  */
+extern int __ipc __P ((int __call, int __first, int __second, int __third,
+		       void *__ptr));
+
+/* The codes for the functions to use the multiplexer `__ipc'.  */
+#define IPCOP_semop	 1
+#define IPCOP_semget	 2
+#define IPCOP_semctl	 3
+#define IPCOP_msgsnd	11
+#define IPCOP_msgrcv	12
+#define IPCOP_msgget	13
+#define IPCOP_msgctl	14
+#define IPCOP_shmat	21
+#define IPCOP_shmdt	22
+#define IPCOP_shmget	23
+#define IPCOP_shmctl	24
+
+__END_DECLS
+
+#endif /* _SYS_IPC_BUF_H */
diff --git a/sysdeps/unix/sysv/linux/alpha/sys/procfs.h b/sysdeps/unix/sysv/linux/alpha/sys/procfs.h
new file mode 100644
index 0000000000..03af029254
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/alpha/sys/procfs.h
@@ -0,0 +1,109 @@
+/* Copyright (C) 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
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#ifndef _SYS_PROCFS_H
+
+#define _SYS_PROCFS_H	1
+#include <features.h>
+
+/* This is somehow modelled after the file of the same name on SysVr4
+   systems.  It provides a definition of the core file format for ELF
+   used on Linux.  */
+
+#include <signal.h>
+#include <sys/time.h>
+#include <sys/types.h>
+#include <asm/user.h>
+#include <asm/elf.h>
+
+__BEGIN_DECLS
+
+struct elf_siginfo
+  {
+    int si_signo;			/* Signal number.  */
+    int si_code;			/* Extra code.  */
+    int si_errno;			/* Errno.  */
+  };
+
+typedef elf_greg_t greg_t;
+typedef elf_gregset_t gregset_t;
+typedef elf_fpregset_t fpregset_t;
+#define NGREG ELF_NGREG
+
+/* Definitions to generate Intel SVR4-like core files.  These mostly
+   have the same names as the SVR4 types with "elf_" tacked on the
+   front to prevent clashes with linux definitions, and the typedef
+   forms have been avoided.  This is mostly like the SVR4 structure,
+   but more Linuxy, with things that Linux does not support and which
+   gdb doesn't really use excluded.  Fields present but not used are
+   marked with "XXX".  */
+struct elf_prstatus
+  {
+#if 0
+    long int pr_flags;			/* XXX Process flags.  */
+    short int pr_why;			/* XXX Reason for process halt.  */
+    short int pr_what;			/* XXX More detailed reason.  */
+#endif
+    struct elf_siginfo pr_info;		/* Info associated with signal.  */
+    short int pr_cursig;		/* Current signal.  */
+    unsigned long int pr_sigpend;	/* Set of pending signals.  */
+    unsigned long int pr_sighold;	/* Set of held signals.  */
+#if 0
+    struct sigaltstack pr_altstack;	/* Alternate stack info.  */
+    struct sigaction pr_action;		/* Signal action for current sig.  */
+#endif
+    __pid_t pr_pid;
+    __pid_t pr_ppid;
+    __pid_t pr_pgrp;
+    __pid_t pr_sid;
+    struct timeval pr_utime;		/* User time.  */
+    struct timeval pr_stime;		/* System time.  */
+    struct timeval pr_cutime;		/* Cumulative user time.  */
+    struct timeval pr_cstime;		/* Cumulative system time.  */
+#if 0
+    long int pr_instr;			/* Current instruction.  */
+#endif
+    elf_gregset_t pr_reg;		/* GP registers.  */
+    int pr_fpvalid;			/* True if math copro being used.  */
+  };
+
+
+#define ELF_PRARGSZ     (80)    /* Number of chars for args */
+
+struct elf_prpsinfo
+  {
+    char pr_state;			/* Numeric process state.  */
+    char pr_sname;			/* Char for pr_state.  */
+    char pr_zomb;			/* Zombie.  */
+    char pr_nice;			/* Nice val.  */
+    unsigned long int pr_flag;		/* Flags.  */
+    unsigned int pr_uid;
+    unsigned int pr_gid;
+    unsigned int pr_pid, pr_ppid, pr_pgrp, pr_sid;
+    /* Lots missing */
+    char pr_fname[16];			/* Filename of executable.  */
+    char pr_psargs[ELF_PRARGSZ];	/* Initial part of arg list.  */
+  };
+
+
+typedef struct elf_prstatus prstatus_t;
+typedef struct elf_prpsinfo prpsinfo_t;
+
+__END_DECLS
+
+#endif	/* sys/procfs.h */
diff --git a/sysdeps/unix/sysv/linux/i386/getgroups.c b/sysdeps/unix/sysv/linux/i386/getgroups.c
new file mode 100644
index 0000000000..2b8f9575fb
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/i386/getgroups.c
@@ -0,0 +1,43 @@
+/* Copyright (C) 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
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#include <sys/types.h>
+#include <unistd.h>
+
+#include <linux/posix_types.h>
+
+extern int __syscall_getgroups __P ((int, __kernel_gid_t *));
+
+/* For Linux we must convert the array of groups from the format that the
+   kernel returns.  */
+int
+__getgroups (n, groups)
+     int n;
+     gid_t *groups;
+{
+  int i, ngids;
+  __kernel_gid_t kernel_groups[n];
+
+  ngids = __syscall_getgroups (n, kernel_groups);
+  if (n != 0 && ngids > 0)
+    for (i = 0; i < ngids; i++)
+      groups[i] = kernel_groups[i];
+  return ngids;
+}
+
+weak_alias (__getgroups, getgroups)
diff --git a/sysdeps/unix/sysv/linux/i386/setgroups.c b/sysdeps/unix/sysv/linux/i386/setgroups.c
new file mode 100644
index 0000000000..8f8711913e
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/i386/setgroups.c
@@ -0,0 +1,41 @@
+/* Copyright (C) 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
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#include <sys/types.h>
+#include <unistd.h>
+#include <grp.h>
+
+#include <linux/posix_types.h>
+
+extern int __syscall_setgroups __P ((int, const __kernel_gid_t *));
+
+/* Set the group set for the current user to GROUPS (N of them).  For
+   Linux we must convert the array of groups into the format that the
+   kernel expects.  */
+int
+setgroups (n, groups)
+     size_t n;
+     const gid_t *groups;
+{
+  size_t i;
+  __kernel_gid_t kernel_groups[n];
+
+  for (i = 0; i < n; i++)
+    kernel_groups[i] = groups[i];
+  return __syscall_setgroups (n, kernel_groups);
+}
diff --git a/sysdeps/unix/sysv/linux/i386/syscalls.list b/sysdeps/unix/sysv/linux/i386/syscalls.list
index d95a120aa0..392a257194 100644
--- a/sysdeps/unix/sysv/linux/i386/syscalls.list
+++ b/sysdeps/unix/sysv/linux/i386/syscalls.list
@@ -1,4 +1,6 @@
 # File name	Caller	Syscall name	# args	Strong name	Weak names
 
+s_getgroups	getgroups getgroups	2	__syscall_getgroups
 s_llseek	llseek	_llseek		5	__sys_llseek
+s_setgroups	setgroups setgroups	2	__syscall_setgroups
 vm86		-	vm86		1	__vm86		vm86
diff --git a/sysdeps/unix/sysv/linux/kernel_sigaction.h b/sysdeps/unix/sysv/linux/kernel_sigaction.h
new file mode 100644
index 0000000000..a058642d85
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/kernel_sigaction.h
@@ -0,0 +1,10 @@
+/* This is the sigaction structure from the Linux 2.1.20 kernel.  */
+
+#define HAVE_SA_RESTORER
+
+struct kernel_sigaction {
+	__sighandler_t sa_handler;
+	unsigned long sa_mask;
+	unsigned long sa_flags;
+	void (*sa_restorer) __P ((void));
+};
diff --git a/sysdeps/unix/sysv/linux/m68k/getgroups.c b/sysdeps/unix/sysv/linux/m68k/getgroups.c
new file mode 100644
index 0000000000..102ea24e14
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/m68k/getgroups.c
@@ -0,0 +1,2 @@
+/* We also have to rewrite the kernel gid_t to the user land type.  */
+#include <sysdeps/unix/sysv/linux/i386/getgroups.c>
diff --git a/sysdeps/unix/sysv/linux/m68k/setgroups.c b/sysdeps/unix/sysv/linux/m68k/setgroups.c
new file mode 100644
index 0000000000..0e7086278f
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/m68k/setgroups.c
@@ -0,0 +1,2 @@
+/* We also have to rewrite the kernel gid_t to the user land type.  */
+#include <sysdeps/unix/sysv/linux/i386/setgroups.c>
diff --git a/sysdeps/unix/sysv/linux/m68k/syscalls.list b/sysdeps/unix/sysv/linux/m68k/syscalls.list
index 7883d70719..9a3e4d0e58 100644
--- a/sysdeps/unix/sysv/linux/m68k/syscalls.list
+++ b/sysdeps/unix/sysv/linux/m68k/syscalls.list
@@ -1,3 +1,5 @@
 # File name	Caller	Syscall name	# args	Strong name	Weak names
 
+s_getgroups	getgroups getgroups	2	__syscall_getgroups
 s_llseek	llseek	_llseek		5	__sys_llseek
+s_setgroups	setgroups setgroups	2	__syscall_setgroups
diff --git a/sysdeps/unix/sysv/linux/sigaction.c b/sysdeps/unix/sysv/linux/sigaction.c
new file mode 100644
index 0000000000..a7b3e07dae
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sigaction.c
@@ -0,0 +1,63 @@
+/* Copyright (C) 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
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#include <signal.h>
+
+/* The difference here is that the sigaction structure used in the
+   kernel is not the same as we use in the libc.  Therefore we must
+   translate it here.  */
+#include <kernel_sigaction.h>
+
+extern int __syscall_sigaction (int, const struct kernel_sigaction *,
+				struct kernel_sigaction *);
+
+/* If ACT is not NULL, change the action for SIG to *ACT.
+   If OACT is not NULL, put the old action for SIG in *OACT.  */
+int
+__sigaction (sig, act, oact)
+     int sig;
+     const struct sigaction *act;
+     struct sigaction *oact;
+{
+  struct kernel_sigaction k_sigact, k_osigact;
+  int error;
+
+  if (act)
+    {
+      k_sigact.sa_handler = act->sa_handler;
+      k_sigact.sa_mask = act->sa_mask.__val[0];
+      k_sigact.sa_flags = act->sa_flags;
+#ifdef HAVE_SA_RESTORER
+      k_sigact.sa_restorer = act->sa_restorer;
+#endif
+    }
+  error = __syscall_sigaction (sig, act ? &k_sigact : 0,
+			       oact ? &k_osigact : 0);
+  if (oact && error >= 0)
+    {
+      oact->sa_handler = k_osigact.sa_handler;
+      oact->sa_mask.__val[0] = k_osigact.sa_mask;
+      oact->sa_flags = k_osigact.sa_flags;
+#ifdef HAVE_SA_RESTORER
+      oact->sa_restorer = k_osigact.sa_restorer;
+#endif
+    }
+  return error;
+}
+
+weak_alias (__sigaction, sigaction)
diff --git a/sysdeps/unix/sysv/linux/sys/ipc_buf.h b/sysdeps/unix/sysv/linux/sys/ipc_buf.h
index a1eba68113..f5fea0d295 100644
--- a/sysdeps/unix/sysv/linux/sys/ipc_buf.h
+++ b/sysdeps/unix/sysv/linux/sys/ipc_buf.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995, 1996 Free Software Foundation, Inc.
+/* Copyright (C) 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>, August 1995.
 
@@ -25,43 +25,43 @@
 #include <sys/types.h>
 
 /* Mode bits for `msgget', `semget', and `shmget'.  */
-#define IPC_CREAT	01000		/* create key if key does not exist */
-#define IPC_EXCL	02000		/* fail if key exists */
-#define IPC_NOWAIT	04000		/* return error on wait */
+#define IPC_CREAT	01000		/* Create key if key does not exist. */
+#define IPC_EXCL	02000		/* Fail if key exists.  */
+#define IPC_NOWAIT	04000		/* Return error on wait.  */
 
 /* Control commands for `msgctl', `semctl', and `shmctl'.  */
-#define IPC_RMID	0		/* remove identifier */
-#define IPC_SET		1		/* set `ipc_perm' options */
-#define IPC_STAT	2		/* get `ipc_perm' options */
-#define IPC_INFO	3		/* see ipcs */
+#define IPC_RMID	0		/* Remove identifier.  */
+#define IPC_SET		1		/* Set `ipc_perm' options.  */
+#define IPC_STAT	2		/* Get `ipc_perm' options.  */
+#define IPC_INFO	3		/* See ipcs.  */
 
 
 __BEGIN_DECLS
 
 /* Special key values.  */
-#define IPC_PRIVATE	((key_t) 0)	/* private key */
+#define IPC_PRIVATE	((__key_t) 0)	/* Private key.  */
 
 
 /* Data structure used to pass permission information to IPC operations.  */
 struct ipc_perm
-{
-  key_t __key;				/* key */
-  __uid_t uid;				/* owner's user ID */
-  __gid_t gid;				/* owner's group ID */
-  __uid_t cuid;				/* creator's user ID */
-  __gid_t cgid;				/* creator's group ID */
-  __mode_t mode;			/* read/write permission */
-  unsigned short int __seq;		/* sequence number */
-};
+  {
+    __key_t __key;			/* Key.  */
+    unsigned short int uid;		/* Owner's user ID.  */
+    unsigned short int gid;		/* Owner's group ID.  */
+    unsigned short int cuid;		/* Creator's user ID.  */
+    unsigned short int cgid;		/* Creator's group ID.  */
+    unsigned short int mode;		/* Read/write permission.  */
+    unsigned short int __seq;		/* Sequence number.  */
+  };
 
 
 /* Kludge to work around Linux' restriction of only up to five
    arguments to a system call.  */
 struct ipc_kludge
-{
-  void *msgp;
-  long msgtyp;
-};
+  {
+    void *msgp;
+    long int msgtyp;
+  };
 
 /* The actual system call: all functions are multiplexed by this.  */
 extern int __ipc __P ((int __call, int __first, int __second, int __third,
diff --git a/sysdeps/unix/sysv/linux/sys/mtio.h b/sysdeps/unix/sysv/linux/sys/mtio.h
index 45db6a51b4..e238ef92d7 100644
--- a/sysdeps/unix/sysv/linux/sys/mtio.h
+++ b/sysdeps/unix/sysv/linux/sys/mtio.h
@@ -1,4 +1,5 @@
-/* Copyright (C) 1996 Free Software Foundation, Inc.
+/* Structures and definitions for magnetic tape I/O control commands.
+   Copyright (C) 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
@@ -16,13 +17,250 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
+/* Written by H. Bergman <hennus@cybercomm.nl>.  */
+
 #ifndef _SYS_MTIO_H
 #define _SYS_MTIO_H	1
 
 /* Get necessary definitions from system and kernel headers.  */
 #include <sys/types.h>
 #include <sys/ioctl.h>
-#include <linux/mtio.h>
+
+
+/* Structure for MTIOCTOP - magnetic tape operation command.  */
+struct mtop
+  {
+    short int mt_op;		/* Operations defined below.  */
+    int mt_count;		/* How many of them.  */
+  };
+
+/* Magnetic Tape operations [Not all operations supported by all drivers].  */
+#define MTRESET 0	/* +reset drive in case of problems.  */
+#define MTFSF	1	/* Forward space over FileMark,
+			 * position at first record of next file.  */
+#define MTBSF	2	/* Backward space FileMark (position before FM).  */
+#define MTFSR	3	/* Forward space record.  */
+#define MTBSR	4	/* Backward space record.  */
+#define MTWEOF	5	/* Write an end-of-file record (mark).  */
+#define MTREW	6	/* Rewind.  */
+#define MTOFFL	7	/* Rewind and put the drive offline (eject?).  */
+#define MTNOP	8	/* No op, set status only (read with MTIOCGET).  */
+#define MTRETEN 9	/* Retension tape.  */
+#define MTBSFM	10	/* +backward space FileMark, position at FM.  */
+#define MTFSFM  11	/* +forward space FileMark, position at FM.  */
+#define MTEOM	12	/* Goto end of recorded media (for appending files).
+			   MTEOM positions after the last FM, ready for
+			   appending another file.  */
+#define MTERASE 13	/* Erase tape -- be careful!  */
+
+#define MTRAS1  14	/* Run self test 1 (nondestructive).  */
+#define MTRAS2	15	/* Run self test 2 (destructive).  */
+#define MTRAS3  16	/* Reserved for self test 3.  */
+
+#define MTSETBLK 20	/* Set block length (SCSI).  */
+#define MTSETDENSITY 21	/* Set tape density (SCSI).  */
+#define MTSEEK	22	/* Seek to block (Tandberg, etc.).  */
+#define MTTELL	23	/* Tell block (Tandberg, etc.).  */
+#define MTSETDRVBUFFER 24 /* Set the drive buffering according to SCSI-2.
+			     Ordinary buffered operation with code 1.  */
+#define MTFSS	25	/* Space forward over setmarks.  */
+#define MTBSS	26	/* Space backward over setmarks.  */
+#define MTWSM	27	/* Write setmarks.  */
+
+#define MTLOCK  28	/* Lock the drive door.  */
+#define MTUNLOCK 29	/* Unlock the drive door.  */
+#define MTLOAD  30	/* Execute the SCSI load command.  */
+#define MTUNLOAD 31	/* Execute the SCSI unload command.  */
+#define MTCOMPRESSION 32/* Control compression with SCSI mode page 15.  */
+#define MTSETPART 33	/* Change the active tape partition.  */
+#define MTMKPART  34	/* Format the tape with one or two partitions.  */
+
+/* structure for MTIOCGET - mag tape get status command */
+
+struct mtget
+  {
+    long int mt_type;		/* Type of magtape device.  */
+    long int mt_resid;		/* Residual count: (not sure)
+				   number of bytes ignored, or
+				   number of files not skipped, or
+				   number of records not skipped.  */
+    /* The following registers are device dependent.  */
+    long int mt_dsreg;		/* Status register.  */
+    long int mt_gstat;		/* Generic (device independent) status.  */
+    long int mt_erreg;		/* Error register.  */
+    /* The next two fields are not always used.  */
+    __daddr_t mt_fileno;	/* Number of current file on tape.  */
+    __daddr_t mt_blkno;		/* Current block number.  */
+  };
+
+
+
+/* Constants for mt_type. Not all of these are supported, and
+   these are not all of the ones that are supported.  */
+#define MT_ISUNKNOWN		0x01
+#define MT_ISQIC02		0x02	/* Generic QIC-02 tape streamer.  */
+#define MT_ISWT5150		0x03	/* Wangtek 5150EQ, QIC-150, QIC-02.  */
+#define MT_ISARCHIVE_5945L2	0x04	/* Archive 5945L-2, QIC-24, QIC-02?. */
+#define MT_ISCMSJ500		0x05	/* CMS Jumbo 500 (QIC-02?).  */
+#define MT_ISTDC3610		0x06	/* Tandberg 6310, QIC-24.  */
+#define MT_ISARCHIVE_VP60I	0x07	/* Archive VP60i, QIC-02.  */
+#define MT_ISARCHIVE_2150L	0x08	/* Archive Viper 2150L.  */
+#define MT_ISARCHIVE_2060L	0x09	/* Archive Viper 2060L.  */
+#define MT_ISARCHIVESC499	0x0A	/* Archive SC-499 QIC-36 controller. */
+#define MT_ISQIC02_ALL_FEATURES	0x0F	/* Generic QIC-02 with all features. */
+#define MT_ISWT5099EEN24	0x11	/* Wangtek 5099-een24, 60MB, QIC-24. */
+#define MT_ISTEAC_MT2ST		0x12	/* Teac MT-2ST 155mb drive,
+					   Teac DC-1 card (Wangtek type).  */
+#define MT_ISEVEREX_FT40A	0x32	/* Everex FT40A (QIC-40).  */
+#define MT_ISDDS1		0x51	/* DDS device without partitions.  */
+#define MT_ISDDS2		0x52	/* DDS device with partitions.  */
+#define MT_ISSCSI1		0x71	/* Generic ANSI SCSI-1 tape unit.  */
+#define MT_ISSCSI2		0x72	/* Generic ANSI SCSI-2 tape unit.  */
+
+/* QIC-40/80/3010/3020 ftape supported drives.
+   20bit vendor ID + 0x800000 (see vendors.h in ftape distribution).  */
+#define MT_ISFTAPE_UNKNOWN	0x800000 /* obsolete */
+#define MT_ISFTAPE_FLAG		0x800000
+
+struct mt_tape_info
+  {
+    long int t_type;		/* Device type id (mt_type).  */
+    char *t_name;		/* Descriptive name.  */
+  };
+
+#define MT_TAPE_INFO \
+  {									      \
+	{MT_ISUNKNOWN,		"Unknown type of tape device"},		      \
+	{MT_ISQIC02,		"Generic QIC-02 tape streamer"},	      \
+	{MT_ISWT5150,		"Wangtek 5150, QIC-150"},		      \
+	{MT_ISARCHIVE_5945L2,	"Archive 5945L-2"},			      \
+	{MT_ISCMSJ500,		"CMS Jumbo 500"},			      \
+	{MT_ISTDC3610,		"Tandberg TDC 3610, QIC-24"},		      \
+	{MT_ISARCHIVE_VP60I,	"Archive VP60i, QIC-02"},		      \
+	{MT_ISARCHIVE_2150L,	"Archive Viper 2150L"},			      \
+	{MT_ISARCHIVE_2060L,	"Archive Viper 2060L"},			      \
+	{MT_ISARCHIVESC499,	"Archive SC-499 QIC-36 controller"},	      \
+	{MT_ISQIC02_ALL_FEATURES, "Generic QIC-02 tape, all features"},	      \
+	{MT_ISWT5099EEN24,	"Wangtek 5099-een24, 60MB"},		      \
+	{MT_ISTEAC_MT2ST,	"Teac MT-2ST 155mb data cassette drive"},     \
+	{MT_ISEVEREX_FT40A,	"Everex FT40A, QIC-40"},		      \
+	{MT_ISSCSI1,		"Generic SCSI-1 tape"},			      \
+	{MT_ISSCSI2,		"Generic SCSI-2 tape"},			      \
+	{0, NULL}							      \
+  }
+
+
+/* Structure for MTIOCPOS - mag tape get position command.  */
+
+struct mtpos
+  {
+    long int mt_blkno;	/* Current block number.  */
+  };
+
+
+/* Structure for MTIOCGETCONFIG/MTIOCSETCONFIG primarily intended
+   as an interim solution for QIC-02 until DDI is fully implemented.  */
+struct mtconfiginfo
+  {
+    long int mt_type;		/* Drive type.  */
+    long int ifc_type;		/* Interface card type.  */
+    unsigned short int irqnr;	/* IRQ number to use.  */
+    unsigned short int dmanr;	/* DMA channel to use.  */
+    unsigned short int port;	/* IO port base address.  */
+
+    unsigned long int debug;	/* Debugging flags.  */
+
+    unsigned have_dens:1;
+    unsigned have_bsf:1;
+    unsigned have_fsr:1;
+    unsigned have_bsr:1;
+    unsigned have_eod:1;
+    unsigned have_seek:1;
+    unsigned have_tell:1;
+    unsigned have_ras1:1;
+    unsigned have_ras2:1;
+    unsigned have_ras3:1;
+    unsigned have_qfa:1;
+
+    unsigned pad1:5;
+    char reserved[10];
+  };
+
+
+/* Magnetic tape I/O control commands.  */
+#define	MTIOCTOP	_IOW('m', 1, struct mtop)	/* Do a mag tape op. */
+#define	MTIOCGET	_IOR('m', 2, struct mtget)	/* Get tape status.  */
+#define	MTIOCPOS	_IOR('m', 3, struct mtpos)	/* Get tape position.*/
+
+/* The next two are used by the QIC-02 driver for runtime reconfiguration.
+   See tpqic02.h for struct mtconfiginfo.  */
+#define	MTIOCGETCONFIG	_IOR('m', 4, struct mtconfiginfo) /* Get tape config.*/
+#define	MTIOCSETCONFIG	_IOW('m', 5, struct mtconfiginfo) /* Set tape config.*/
+
+/* Generic Mag Tape (device independent) status macros for examining
+   mt_gstat -- HP-UX compatible.
+   There is room for more generic status bits here, but I don't
+   know which of them are reserved. At least three or so should
+   be added to make this really useful.  */
+#define GMT_EOF(x)              ((x) & 0x80000000)
+#define GMT_BOT(x)              ((x) & 0x40000000)
+#define GMT_EOT(x)              ((x) & 0x20000000)
+#define GMT_SM(x)               ((x) & 0x10000000)  /* DDS setmark */
+#define GMT_EOD(x)              ((x) & 0x08000000)  /* DDS EOD */
+#define GMT_WR_PROT(x)          ((x) & 0x04000000)
+/* #define GMT_ ? 		((x) & 0x02000000) */
+#define GMT_ONLINE(x)           ((x) & 0x01000000)
+#define GMT_D_6250(x)           ((x) & 0x00800000)
+#define GMT_D_1600(x)           ((x) & 0x00400000)
+#define GMT_D_800(x)            ((x) & 0x00200000)
+/* #define GMT_ ? 		((x) & 0x00100000) */
+/* #define GMT_ ? 		((x) & 0x00080000) */
+#define GMT_DR_OPEN(x)          ((x) & 0x00040000)  /* Door open (no tape).  */
+/* #define GMT_ ? 		((x) & 0x00020000) */
+#define GMT_IM_REP_EN(x)        ((x) & 0x00010000)  /* Immediate report mode.*/
+/* 16 generic status bits unused.  */
+
+
+/* SCSI-tape specific definitions.  Bitfield shifts in the status  */
+#define MT_ST_BLKSIZE_SHIFT	0
+#define MT_ST_BLKSIZE_MASK	0xffffff
+#define MT_ST_DENSITY_SHIFT	24
+#define MT_ST_DENSITY_MASK	0xff000000
+
+#define MT_ST_SOFTERR_SHIFT	0
+#define MT_ST_SOFTERR_MASK	0xffff
+
+/* Bitfields for the MTSETDRVBUFFER ioctl.  */
+#define MT_ST_OPTIONS		0xf0000000
+#define MT_ST_BOOLEANS		0x10000000
+#define MT_ST_SETBOOLEANS	0x30000000
+#define MT_ST_CLEARBOOLEANS	0x40000000
+#define MT_ST_WRITE_THRESHOLD	0x20000000
+#define MT_ST_DEF_BLKSIZE	0x50000000
+#define MT_ST_DEF_OPTIONS	0x60000000
+
+#define MT_ST_BUFFER_WRITES	0x1
+#define MT_ST_ASYNC_WRITES	0x2
+#define MT_ST_READ_AHEAD	0x4
+#define MT_ST_DEBUGGING		0x8
+#define MT_ST_TWO_FM		0x10
+#define MT_ST_FAST_MTEOM	0x20
+#define MT_ST_AUTO_LOCK		0x40
+#define MT_ST_DEF_WRITES	0x80
+#define MT_ST_CAN_BSR		0x100
+#define MT_ST_NO_BLKLIMS	0x200
+#define MT_ST_CAN_PARTITIONS    0x400
+#define MT_ST_SCSI2LOGICAL      0x800
+
+/* The mode parameters to be controlled. Parameter chosen with bits 20-28.  */
+#define MT_ST_CLEAR_DEFAULT	0xfffff
+#define MT_ST_DEF_DENSITY	(MT_ST_DEF_OPTIONS | 0x100000)
+#define MT_ST_DEF_COMPRESSION	(MT_ST_DEF_OPTIONS | 0x200000)
+#define MT_ST_DEF_DRVBUFFER	(MT_ST_DEF_OPTIONS | 0x300000)
+
+/* The offset for the arguments for the special HP changer load command.  */
+#define MT_ST_HPLOADER_OFFSET 10000
+
 
 /* Specify default tape device.  */
 #ifndef DEFTAPE
diff --git a/sysdeps/unix/sysv/linux/sys/procfs.h b/sysdeps/unix/sysv/linux/sys/procfs.h
index 59f0fcd594..e8d32390fa 100644
--- a/sysdeps/unix/sysv/linux/sys/procfs.h
+++ b/sysdeps/unix/sysv/linux/sys/procfs.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996 Free Software Foundation, Inc.
+/* Copyright (C) 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
@@ -34,11 +34,11 @@
 __BEGIN_DECLS
 
 struct elf_siginfo
-{
-  int si_signo;				/* signal number */
-  int si_code;				/* extra code */
-  int si_errno;				/* errno */
-};
+  {
+    int si_signo;			/* Signal number.  */
+    int si_code;			/* Extra code.  */
+    int si_errno;			/* Errno.  */
+  };
 
 typedef elf_greg_t greg_t;
 typedef elf_gregset_t gregset_t;
@@ -53,52 +53,52 @@ typedef elf_fpregset_t fpregset_t;
    gdb doesn't really use excluded.  Fields present but not used are
    marked with "XXX".  */
 struct elf_prstatus
-{
+  {
 #if 0
-  long pr_flags;			/* XXX Process flags */
-  short pr_why;				/* XXX Reason for process halt */
-  short pr_what;			/* XXX More detailed reason */
+    long int pr_flags;			/* XXX Process flags.  */
+    short int pr_why;			/* XXX Reason for process halt.  */
+    short int pr_what;			/* XXX More detailed reason.  */
 #endif
-  struct elf_siginfo pr_info;		/* Info associated with signal */
-  short pr_cursig;			/* Current signal */
-  sigset_t pr_sigpend;			/* Set of pending signals */
-  sigset_t pr_sighold;			/* Set of held signals */
+    struct elf_siginfo pr_info;		/* Info associated with signal.  */
+    short int pr_cursig;		/* Current signal.  */
+    unsigned long int pr_sigpend;	/* Set of pending signals.  */
+    unsigned long int pr_sighold;	/* Set of held signals.  */
 #if 0
-  struct sigaltstack pr_altstack;	/* Alternate stack info */
-  struct sigaction pr_action;		/* Signal action for current sig */
+    struct sigaltstack pr_altstack;	/* Alternate stack info.  */
+    struct sigaction pr_action;		/* Signal action for current sig.  */
 #endif
-  pid_t pr_pid;
-  pid_t pr_ppid;
-  pid_t pr_pgrp;
-  pid_t pr_sid;
-  struct timeval pr_utime;		/* User time */
-  struct timeval pr_stime;		/* System time */
-  struct timeval pr_cutime;		/* Cumulative user time */
-  struct timeval pr_cstime;		/* Cumulative system time */
+    __pid_t pr_pid;
+    __pid_t pr_ppid;
+    __pid_t pr_pgrp;
+    __pid_t pr_sid;
+    struct timeval pr_utime;		/* User time.  */
+    struct timeval pr_stime;		/* System time.  */
+    struct timeval pr_cutime;		/* Cumulative user time.  */
+    struct timeval pr_cstime;		/* Cumulative system time.  */
 #if 0
-  long pr_instr;			/* Current instruction */
+    long int pr_instr;			/* Current instruction.  */
 #endif
-  elf_gregset_t pr_reg;			/* GP registers */
-  int pr_fpvalid;			/* True if math copro being used.  */
-};
+    elf_gregset_t pr_reg;		/* GP registers.  */
+    int pr_fpvalid;			/* True if math copro being used.  */
+  };
 
 
 #define ELF_PRARGSZ     (80)    /* Number of chars for args */
 
 struct elf_prpsinfo
-{
-  char pr_state;			/* numeric process state */
-  char pr_sname;			/* char for pr_state */
-  char pr_zomb;				/* zombie */
-  char pr_nice;				/* nice val */
-  unsigned long pr_flag;		/* flags */
-  uid_t pr_uid;
-  gid_t pr_gid;
-  pid_t pr_pid, pr_ppid, pr_pgrp, pr_sid;
-  /* Lots missing */
-  char pr_fname[16];			/* filename of executable */
-  char pr_psargs[ELF_PRARGSZ];		/* initial part of arg list */
-};
+  {
+    char pr_state;			/* Numeric process state.  */
+    char pr_sname;			/* Char for pr_state.  */
+    char pr_zomb;			/* Zombie.  */
+    char pr_nice;			/* Nice val.  */
+    unsigned long int pr_flag;		/* Flags.  */
+    unsigned short int pr_uid;
+    unsigned short int pr_gid;
+    unsigned short int pr_pid, pr_ppid, pr_pgrp, pr_sid;
+    /* Lots missing */
+    char pr_fname[16];			/* Filename of executable.  */
+    char pr_psargs[ELF_PRARGSZ];	/* Initial part of arg list.  */
+  };
 
 
 typedef struct elf_prstatus prstatus_t;
diff --git a/sysdeps/unix/sysv/linux/sys/sysmacros.h b/sysdeps/unix/sysv/linux/sys/sysmacros.h
index b859dc7d64..85b1b85d2e 100644
--- a/sysdeps/unix/sysv/linux/sys/sysmacros.h
+++ b/sysdeps/unix/sysv/linux/sys/sysmacros.h
@@ -22,8 +22,8 @@
 #define _SYS_SYSMACROS_H	1
 
 /* For compatibility we provide alternative names.  */
-#define major(dev) ((dev) >> 32)
-#define minor(dev) ((dev) & 0xffffffff)
-#define makedev(major, minor) (((major) << 32) | (monor))
+#define major(dev) (((dev) >> 8) & 0xff)
+#define minor(dev) ((dev) & 0xff)
+#define makedev(major, minor) (((major) << 8) | (minor))
 
 #endif /* _SYS_SYSMACROS_H */
diff --git a/sysdeps/unix/sysv/linux/syscalls.list b/sysdeps/unix/sysv/linux/syscalls.list
index 5367a2826b..20ac94ae26 100644
--- a/sysdeps/unix/sysv/linux/syscalls.list
+++ b/sysdeps/unix/sysv/linux/syscalls.list
@@ -35,6 +35,7 @@ s_getdents	EXTRA	getdents	3	__getdents
 s_getpriority	getpriority getpriority	2	__syscall_getpriority
 s_ptrace	ptrace	ptrace		4	__syscall_ptrace
 s_reboot	EXTRA	reboot		3	__syscall_reboot
+s_sigaction	sigaction sigaction	3	__syscall_sigaction
 s_sigsuspend	sigsuspend sigsuspend	3	__syscall_sigsuspend
 s_sysctl	sysctl	_sysctl		1	__syscall__sysctl
 s_ustat		ustat	ustat		2	__syscall_ustat
diff --git a/time/Makefile b/time/Makefile
index 966d9f2790..af03fa2961 100644
--- a/time/Makefile
+++ b/time/Makefile
@@ -1,4 +1,4 @@
-# Copyright (C) 1991, 92, 93, 94, 95, 96 Free Software Foundation, Inc.
+# Copyright (C) 1991, 92, 93, 94, 95, 96, 97 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
@@ -12,9 +12,9 @@
 # Library General Public License for more details.
 
 # You should have received a copy of the GNU Library General Public
-# License along with the GNU C Library; see the file COPYING.LIB.  If
-# not, write to the Free Software Foundation, Inc., 675 Mass Ave,
-# Cambridge, MA 02139, USA.
+# License along with the GNU C Library; see the file COPYING.LIB.  If not,
+# write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
 
 #
 #	Makefile for time routines
@@ -36,15 +36,21 @@ routines	:= offtime asctime clock ctime ctime_r difftime	\
 others	:= ap zdump zic
 tests	:= test_time clocktest test-tz
 
+# Before the test-tz test can be run we need the data to be installed.
+tests: install-test-data
+
+
 tzfiles := africa antarctica asia australasia europe northamerica \
 	   southamerica etcetera factory systemv backward \
 	   solar87 solar88 solar89
 # pacificnew doesn't compile; if it is to be used, it should be included in
 # northamerica.
-distribute := $(distribute) $(tzfiles) leapseconds pacificnew
+distribute := $(distribute) $(tzfiles) leapseconds pacificnew simplebackw
 
 install-sbin := zic zdump
 
+generated-dirs = testdata
+
 all: # Make this the default target; it will be defined in Rules.
 
 include ../Makeconfig	# Get objpfx defined so we can use it below.
@@ -72,6 +78,11 @@ install-others = $(addprefix $(zonedir)/,$(zonenames) \
 		 $(installed-localtime-file) $(installed-posixrules-file)
 endif
 
+ifeq ($(have-ksh),yes)
+install-others += $(zonedir)/iso3166.tab $(zonedir)/zone.tab
+install-bin += tzselect
+endif
+
 include ../Rules
 
 
@@ -146,3 +157,25 @@ CFLAGS-zic.c = -Wno-strict-prototypes -DNOID $(tz-cflags)
 CFLAGS-ialloc.c = -Wno-strict-prototypes -DNOID
 CFLAGS-scheck.c = -Wno-strict-prototypes -DNOID
 CFLAGS-tzfile.c = $(tz-cflags)
+
+# We have to make sure the data for testing the tz functions is available.
+.PHONY: install-test-data
+install-test-data: northamerica $(objpfx)zic $(leapseconds) yearistype \
+		   etcetera simplebackw
+	-mkdir $(objpfx)testdata
+	$(built-program-cmd) -d $(objpfx)testdata -L $(leapseconds) \
+	  -y yearistype northamerica
+	$(built-program-cmd) -d $(objpfx)testdata -L $(leapseconds) \
+	  -y yearistype etcetera
+	$(built-program-cmd) -d $(objpfx)testdata -L $(leapseconds) \
+	  -y yearistype simplebackw
+test-tz-ENV = TZDIR=$(objpfx)testdata
+
+
+$(objpfx)tzselect: tzselect.ksh
+	sed -e 's%@KSH@%$(KSH)%g' \
+	    -e 's%@TZDIR@%$(zonedir)%g' < $< > $@.new
+	chmod 555 $@.new
+	mv -f $@.new $@
+
+$(addprefix $(zonedir)/,iso3166.tab zone.tab): $(zonedir)/%: %; $(do-install)
diff --git a/time/mktime.c b/time/mktime.c
index 7fa5ccb23a..223872f228 100644
--- a/time/mktime.c
+++ b/time/mktime.c
@@ -1,22 +1,21 @@
-/* Copyright (C) 1993, 1994, 1995, 1996 Free Software Foundation, Inc.
+/* Copyright (C) 1993, 1994, 1995, 1996, 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
    Contributed by Paul Eggert (eggert@twinsun.com).
 
-This file is part of the GNU C Library.
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
 
-The GNU C Library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Library General Public License as
-published by the Free Software Foundation; either version 2 of the
-License, or (at your option) any later version.
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
 
-The GNU C Library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-Library General Public License for more details.
-
-You should have received a copy of the GNU Library General Public
-License along with the GNU C Library; see the file COPYING.LIB.  If
-not, write to the Free Software Foundation, Inc., 675 Mass Ave,
-Cambridge, MA 02139, USA.  */
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
 
 /* Define this to have a standalone program to test this implementation of
    mktime.  */
@@ -86,6 +85,9 @@ Cambridge, MA 02139, USA.  */
   ((year) % 4 == 0 && ((year) % 100 != 0 || (year) % 400 == 0))
 #endif
 
+/* Prototype for the internal function to get information based on TZ.  */
+extern void __tzset_internal __P ((int always));
+
 /* How many days come before each month (0-12).  */
 const unsigned short int __mon_yday[2][13] =
   {
@@ -161,6 +163,11 @@ time_t
 mktime (tp)
      struct tm *tp;
 {
+#ifdef _LIBC
+  /* Update internal database according to current TZ setting.  */
+  __tzset_internal (1);
+#endif
+
   return __mktime_internal (tp, localtime_r, &localtime_offset);
 }
 
diff --git a/time/simplebackw b/time/simplebackw
new file mode 100644
index 0000000000..860624a1c3
--- /dev/null
+++ b/time/simplebackw
@@ -0,0 +1,2 @@
+Link	Etc/UTC			UTC
+Link	Etc/Universal		Universal
diff --git a/time/strptime.c b/time/strptime.c
index bd38f9681f..f220313475 100644
--- a/time/strptime.c
+++ b/time/strptime.c
@@ -1,5 +1,5 @@
-/* strptime - Convert a string representation of time to a time value.
-   Copyright (C) 1996 Free Software Foundation, Inc.
+/* Convert a string representation of time to a time value.
+   Copyright (C) 1996, 1997 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
 
@@ -18,24 +18,71 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
+/* XXX This version of the implementation is not really complete.
+   Some of the fields cannot add information alone.  But if seeing
+   some of them in the same format (such as year, week and weekday)
+   this is enough information for determining the date.  */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
 #include <ctype.h>
 #include <langinfo.h>
 #include <limits.h>
 #include <string.h>
 #include <time.h>
 
-#include "../locale/localeinfo.h"
+#ifdef _LIBC
+# include "../locale/localeinfo.h"
+#endif
+
+
+#ifndef __P
+# if defined (__GNUC__) || (defined (__STDC__) && __STDC__)
+#  define __P(args) args
+# else
+#  define __P(args) ()
+# endif  /* GCC.  */
+#endif  /* Not __P.  */
+
+#if ! HAVE_LOCALTIME_R && ! defined (localtime_r)
+#ifdef _LIBC
+#define localtime_r __localtime_r
+#else
+/* Approximate localtime_r as best we can in its absence.  */
+#define localtime_r my_localtime_r
+static struct tm *localtime_r __P ((const time_t *, struct tm *));
+static struct tm *
+localtime_r (t, tp)
+     const time_t *t;
+     struct tm *tp;
+{
+  struct tm *l = localtime (t);
+  if (! l)
+    return 0;
+  *tp = *l;
+  return tp;
+}
+#endif /* ! _LIBC */
+#endif /* ! HAVE_LOCALTIME_R && ! defined (localtime_r) */
 
 
 #define match_char(ch1, ch2) if (ch1 != ch2) return NULL
-#define match_string(cs1, s2)						      \
+#if defined __GNUC__ && __GNUC__ >= 2
+# define match_string(cs1, s2) \
   ({ size_t len = strlen (cs1);						      \
-     int result = strncasecmp (cs1, s2, len) == 0;			      \
-     if (result) s2 += len;						      \
+     int result = strncasecmp ((cs1), (s2), len) == 0;			      \
+     if (result) (s2) += len;						      \
      result; })
+#else
+/* Oh come on.  Get a reasonable compiler.  */
+# define match_string(cs1, s2) \
+  (strncasecmp ((cs1), (s2), strlen (cs1)) ? 0 : ((s2) += strlen (cs1), 1))
+#endif
 /* We intentionally do not use isdigit() for testing because this will
    lead to problems with the wide character version.  */
-#define get_number(from, to)						      \
+#define get_number(from, to) \
   do {									      \
     val = 0;								      \
     if (*rp < '0' || *rp > '9')						      \
@@ -47,33 +94,98 @@
     if (val < from || val > to)						      \
       return NULL;							      \
   } while (0)
-#define get_alt_number(from, to)					      \
+#ifdef _NL_CURRENT
+# define get_alt_number(from, to) \
   do {									      \
-    const char *alts = _NL_CURRENT (LC_TIME, ALT_DIGITS);		      \
-    val = 0;								      \
-    while (*alts != '\0')						      \
+    if (*decided != raw)						      \
       {									      \
-	size_t len = strlen (alts);					      \
-	if (strncasecmp (alts, rp, len) == 0)				      \
-	  break;							      \
-	alts = strchr (alts, '\0') + 1;					      \
-	++val;								      \
+	const char *alts = _NL_CURRENT (LC_TIME, ALT_DIGITS);		      \
+	val = 0;							      \
+	while (*alts != '\0')						      \
+	  {								      \
+	    size_t len = strlen (alts);					      \
+	    if (strncasecmp (alts, rp, len) == 0)			      \
+	      break;							      \
+	    alts = strchr (alts, '\0') + 1;				      \
+	    ++val;							      \
+	  }								      \
+	if (*alts == '\0')						      \
+	  {								      \
+	    if (*decided == loc && val != 0)				      \
+	      return NULL;						      \
+	  }								      \
+	else								      \
+	  {								      \
+	    *decided = loc;						      \
+	    break;							      \
+	  }								      \
       }									      \
-    if (*alts == '\0')							      \
-      return NULL;							      \
-  } while (0)
-#define recursive(new_fmt)						      \
-  do {									      \
-    if (*new_fmt == '\0')						      \
-      return NULL;							      \
-    rp = strptime (rp, new_fmt, tm);					      \
-    if (rp == NULL)							      \
-      return NULL;							      \
+    get_number (from, to);						      \
   } while (0)
+#else
+# define get_alt_number(from, to) \
+  /* We don't have the alternate representation.  */			      \
+  get_number(from, to)
+#endif
+#define recursive(new_fmt) \
+  (*(new_fmt) != '\0'							      \
+   || strptime_internal (rp, (new_fmt), tm, decided) != NULL)
 
 
-char *
-strptime (const char *buf, const char *format, struct tm *tm)
+#ifdef _LIBC
+/* This is defined in locale/C-time.c in the GNU libc.  */
+extern const struct locale_data _nl_C_LC_TIME;
+
+# define weekday_name (&_nl_C_LC_TIME.values[_NL_ITEM_INDEX (DAY_1)].string)
+# define ab_weekday_name \
+  (&_nl_C_LC_TIME.values[_NL_ITEM_INDEX (ABDAY_1)].string)
+# define month_name (&_nl_C_LC_TIME.values[_NL_ITEM_INDEX (MON_1)].string)
+# define ab_month_name (&_nl_C_LC_TIME.values[_NL_ITEM_INDEX (ABMON_1)].string)
+# define HERE_D_T_FMT (_nl_C_LC_TIME.values[_NL_ITEM_INDEX (D_T_FMT)].string)
+# define HERE_D_FMT (_nl_C_LC_TIME.values[_NL_ITEM_INDEX (D_T_FMT)].string)
+# define HERE_AM_STR (_nl_C_LC_TIME.values[_NL_ITEM_INDEX (AM_STR)].string)
+# define HERE_PM_STR (_nl_C_LC_TIME.values[_NL_ITEM_INDEX (PM_STR)].string)
+# define HERE_T_FMT_AMPM \
+  (_nl_C_LC_TIME.values[_NL_ITEM_INDEX (T_FMT_AMPM)].string)
+# define HERE_T_FMT (_nl_C_LC_TIME.values[_NL_ITEM_INDEX (T_FMT)].string)
+#else
+static char const weekday_name[][10] =
+  {
+    "Sunday", "Monday", "Tuesday", "Wednesday",
+    "Thursday", "Friday", "Saturday"
+  };
+static char const ab_weekday_name[][4] =
+  {
+    "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"
+  };
+static char const month_name[][10] =
+  {
+    "January", "February", "March", "April", "May", "June",
+    "July", "August", "September", "October", "November", "December"
+  };
+static char const ab_month_name[][4] =
+  {
+    "Jan", "Feb", "Mar", "Apr", "May", "Jun",
+    "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
+  };
+# define HERE_D_T_FMT "%a %b %e %H:%M:%S %Y"
+# define HERE_D_FMT "%m/%d/%y"
+# define HERE_AM_STR "AM"
+# define HERE_PM_STR "PM"
+# define HERE_T_FMT_AMPM "%I:%M:%S %p"
+# define HERE_T_FMT "%H:%M:%S"
+#endif
+
+/* Status of lookup: do we use the locale data or the raw data?  */
+enum locale_status { not, loc, raw };
+
+
+static char *
+strptime_internal (buf, format, tm, decided)
+     const char *buf;
+     const char *format;
+     struct tm *tm;
+     enum locale_status *decided;
 {
   const char *rp;
   const char *fmt;
@@ -106,6 +218,10 @@ strptime (const char *buf, const char *format, struct tm *tm)
 	}
 
       ++fmt;
+#ifndef _NL_CURRENT
+      /* We need this for handling the `E' modifier.  */
+    start_over:
+#endif
       switch (*fmt++)
 	{
 	case '%':
@@ -117,10 +233,34 @@ strptime (const char *buf, const char *format, struct tm *tm)
 	  /* Match day of week.  */
 	  for (cnt = 0; cnt < 7; ++cnt)
 	    {
-	      if (match_string (_NL_CURRENT (LC_TIME, ABDAY_1 + cnt), rp))
-		break;
-	      if (match_string (_NL_CURRENT (LC_TIME, DAY_1 + cnt), rp))
-		break;
+#ifdef _NL_CURRENT
+	      if (*decided !=raw)
+		{
+		  if (match_string (_NL_CURRENT (LC_TIME, ABDAY_1 + cnt), rp))
+		    {
+		      if (*decided == not
+			  && strcmp (_NL_CURRENT (LC_TIME, ABDAY_1 + cnt),
+				     ab_weekday_name[cnt]))
+			*decided = loc;
+		      break;
+		    }
+		  if (match_string (_NL_CURRENT (LC_TIME, DAY_1 + cnt), rp))
+		    {
+		      if (*decided == not
+			  && strcmp (_NL_CURRENT (LC_TIME, DAY_1 + cnt),
+				     weekday_name[cnt]))
+			*decided = loc;
+		      break;
+		    }
+		}
+#endif
+	      if (*decided != loc
+		  && (match_string (ab_weekday_name[cnt], rp)
+		      || match_string (weekday_name[cnt], rp)))
+		{
+		  *decided = raw;
+		  break;
+		}
 	    }
 	  if (cnt == 7)
 	    /* Does not match a weekday name.  */
@@ -133,10 +273,33 @@ strptime (const char *buf, const char *format, struct tm *tm)
 	  /* Match month name.  */
 	  for (cnt = 0; cnt < 12; ++cnt)
 	    {
-	      if (match_string (_NL_CURRENT (LC_TIME, ABMON_1 + cnt), rp))
-		break;
-	      if (match_string (_NL_CURRENT (LC_TIME, MON_1 + cnt), rp))
-		break;
+#ifdef _NL_CURRENT
+	      if (*decided !=raw)
+		{
+		  if (match_string (_NL_CURRENT (LC_TIME, ABMON_1 + cnt), rp))
+		    {
+		      if (*decided == not
+			  && strcmp (_NL_CURRENT (LC_TIME, ABMON_1 + cnt),
+				     ab_month_name[cnt]))
+			*decided = loc;
+		      break;
+		    }
+		  if (match_string (_NL_CURRENT (LC_TIME, MON_1 + cnt), rp))
+		    {
+		      if (*decided == not
+			  && strcmp (_NL_CURRENT (LC_TIME, MON_1 + cnt),
+				     month_name[cnt]))
+			*decided = loc;
+		      break;
+		    }
+		}
+#endif
+	      if (match_string (ab_month_name[cnt], rp)
+		  || match_string (month_name[cnt], rp))
+		{
+		  *decided = raw;
+		  break;
+		}
 	    }
 	  if (cnt == 12)
 	    /* Does not match a month name.  */
@@ -145,7 +308,26 @@ strptime (const char *buf, const char *format, struct tm *tm)
 	  break;
 	case 'c':
 	  /* Match locale's date and time format.  */
-	  recursive (_NL_CURRENT (LC_TIME, D_T_FMT));
+#ifdef _NL_CURRENT
+	  if (*decided != raw)
+	    {
+	      if (!recursive (_NL_CURRENT (LC_TIME, D_T_FMT)))
+		{
+		  if (*decided == loc)
+		    return NULL;
+		}
+	      else
+		{
+		  if (*decided == not &&
+		      strcmp (_NL_CURRENT (LC_TIME, D_T_FMT), HERE_D_T_FMT))
+		    *decided = loc;
+		  break;
+		}
+	      *decided = raw;
+	    }
+#endif
+	  if (!recursive (HERE_D_T_FMT))
+	    return NULL;
 	  break;
 	case 'C':
 	  /* Match century number.  */
@@ -158,9 +340,30 @@ strptime (const char *buf, const char *format, struct tm *tm)
 	  get_number (1, 31);
 	  tm->tm_mday = val;
 	  break;
+	case 'x':
+#ifdef _NL_CURRENT
+	  if (*decided != raw)
+	    {
+	      if (!recursive (_NL_CURRENT (LC_TIME, D_FMT)))
+		{
+		  if (*decided == loc)
+		    return NULL;
+		}
+	      else
+		{
+		  if (decided == not
+		      && strcmp (_NL_CURRENT (LC_TIME, D_FMT), HERE_D_FMT))
+		    *decided = loc;
+		  break;
+		}
+	      *decided = raw;
+	    }
+#endif
+	  /* Fall through.  */
 	case 'D':
 	  /* Match standard day format.  */
-	  recursive ("%m/%d/%y");
+	  if (!recursive (HERE_D_FMT))
+	    return NULL;
 	  break;
 	case 'H':
 	  /* Match hour in 24-hour clock.  */
@@ -197,19 +400,57 @@ strptime (const char *buf, const char *format, struct tm *tm)
 	  break;
 	case 'p':
 	  /* Match locale's equivalent of AM/PM.  */
-	  if (match_string (_NL_CURRENT (LC_TIME, AM_STR), rp))
-	    break;
-	  if (match_string (_NL_CURRENT (LC_TIME, PM_STR), rp))
+#ifdef _NL_CURRENT
+	  if (*decided != raw)
 	    {
-	      is_pm = 1;
-	      break;
+	      if (match_string (_NL_CURRENT (LC_TIME, AM_STR), rp))
+		{
+		  if (strcmp (_NL_CURRENT (LC_TIME, AM_STR), HERE_AM_STR))
+		    *decided = loc;
+		  break;
+		}
+	      if (match_string (_NL_CURRENT (LC_TIME, PM_STR), rp))
+		{
+		  if (strcmp (_NL_CURRENT (LC_TIME, PM_STR), HERE_PM_STR))
+		    *decided = loc;
+		  is_pm = 1;
+		  break;
+		}
+	      *decided = raw;
 	    }
-	  return NULL;
+#endif
+	  if (!match_string (HERE_AM_STR, rp))
+	    if (match_string (HERE_PM_STR, rp))
+	      is_pm = 1;
+	    else
+	      return NULL;
+	  break;
 	case 'r':
-	  recursive (_NL_CURRENT (LC_TIME, T_FMT_AMPM));
+#ifdef _NL_CURRENT
+	  if (*decided != raw)
+	    {
+	      if (!recursive (_NL_CURRENT (LC_TIME, T_FMT_AMPM)))
+		{
+		  if (*decided == loc)
+		    return NULL;
+		}
+	      else
+		{
+		  if (*decided == not &&
+		      strcmp (_NL_CURRENT (LC_TIME, T_FMT_AMPM),
+			      HERE_T_FMT_AMPM))
+		    *decided = loc;
+		  break;
+		}
+	      *decided = raw;
+	    }
+#endif
+	  if (!recursive (HERE_T_FMT_AMPM))
+	    return NULL;
 	  break;
 	case 'R':
-	  recursive ("%H:%M");
+	  if (!recursive ("%H:%M"))
+	    return NULL;
 	  break;
 	case 's':
 	  {
@@ -229,7 +470,7 @@ strptime (const char *buf, const char *format, struct tm *tm)
 	      }
 	    while (*rp >= '0' && *rp <= '9');
 
-	    if (__localtime_r (&secs, tm) == NULL)
+	    if (localtime_r (&secs, tm) == NULL)
 	      /* Error in function.  */
 	      return NULL;
 	  }
@@ -238,8 +479,28 @@ strptime (const char *buf, const char *format, struct tm *tm)
 	  get_number (0, 61);
 	  tm->tm_sec = val;
 	  break;
+	case 'X':
+#ifdef _NL_CURRENT
+	  if (*decided != raw)
+	    {
+	      if (!recursive (_NL_CURRENT (LC_TIME, T_FMT)))
+		{
+		  if (*decided == loc)
+		    return NULL;
+		}
+	      else
+		{
+		  if (strcmp (_NL_CURRENT (LC_TIME, T_FMT), HERE_T_FMT))
+		    *decided = loc;
+		  break;
+		}
+	      *decided = raw;
+	    }
+#endif
+	  /* Fall through.  */
 	case 'T':
-	  recursive ("%H:%M:%S");
+	  if (!recursive (HERE_T_FMT))
+	    return NULL;
 	  break;
 	case 'u':
 	  get_number (1, 7);
@@ -262,19 +523,14 @@ strptime (const char *buf, const char *format, struct tm *tm)
 	case 'V':
 	case 'W':
 	  get_number (0, 53);
-	  /* XXX This cannot determine any field in TM.  */
+	  /* XXX This cannot determine any field in TM without some
+	     information.  */
 	  break;
 	case 'w':
 	  /* Match number of weekday.  */
 	  get_number (0, 6);
 	  tm->tm_wday = val;
 	  break;
-	case 'x':
-	  recursive (_NL_CURRENT (LC_TIME, D_FMT));
-	  break;
-	case 'X':
-	  recursive (_NL_CURRENT (LC_TIME, T_FMT));
-	  break;
 	case 'y':
 	  /* Match year within century.  */
 	  get_number (0, 99);
@@ -289,11 +545,35 @@ strptime (const char *buf, const char *format, struct tm *tm)
 	  /* XXX How to handle this?  */
 	  break;
 	case 'E':
+#ifdef _NL_CURRENT
 	  switch (*fmt++)
 	    {
 	    case 'c':
 	      /* Match locale's alternate date and time format.  */
-	      recursive (_NL_CURRENT (LC_TIME, ERA_D_T_FMT));
+	      if (*decided != raw)
+		{
+		  const char *fmt = _NL_CURRENT (LC_TIME, ERA_D_T_FMT);
+
+		  if (*fmt == '\0')
+		    fmt = _NL_CURRENT (LC_TIME, D_T_FMT);
+
+		  if (!recursive (fmt))
+		    {
+		      if (*decided == loc)
+			return NULL;
+		    }
+		  else
+		    {
+		      if (strcmp (fmt, HERE_D_T_FMT))
+			*decided = loc;
+		      break;
+		    }
+		  *decided = raw;
+		}
+	      /* The C locale has no era information, so use the
+		 normal representation.  */
+	      if (!recursive (HERE_D_T_FMT))
+		return NULL;
 	      break;
 	    case 'C':
 	    case 'y':
@@ -301,20 +581,70 @@ strptime (const char *buf, const char *format, struct tm *tm)
 	      /* Match name of base year in locale's alternate
 		 representation.  */
 	      /* XXX This is currently not implemented.  It should
-		 use the value _NL_CURRENT (LC_TIME, ERA) but POSIX
-		 leaves this implementation defined and we haven't
-		 figured out how to do it yet.  */
+		 use the value _NL_CURRENT (LC_TIME, ERA).  */
 	      break;
 	    case 'x':
-	      recursive (_NL_CURRENT (LC_TIME, ERA_D_FMT));
+	      if (*decided != raw)
+		{
+		  const char *fmt = _NL_CURRENT (LC_TIME, ERA_D_FMT);
+
+		  if (*fmt == '\0')
+		    fmt = _NL_CURRENT (LC_TIME, D_FMT);
+
+		  if (!recursive (fmt))
+		    {
+		      if (*decided == loc)
+			return NULL;
+		    }
+		  else
+		    {
+		      if (strcmp (fmt, HERE_D_FMT))
+			*decided = loc;
+		      break;
+		    }
+		  *decided = raw;
+		}
+	      if (!recursive (HERE_D_FMT))
+		return NULL;
 	      break;
 	    case 'X':
-	      recursive (_NL_CURRENT (LC_TIME, ERA_T_FMT));
+	      if (*decided != raw)
+		{
+		  const char *fmt = _NL_CURRENT (LC_TIME, ERA_T_FMT);
+
+		  if (*fmt == '\0')
+		    fmt = _NL_CURRENT (LC_TIME, T_FMT);
+
+		  if (!recursive (fmt))
+		    {
+		      if (*decided == loc)
+			return NULL;
+		    }
+		  else
+		    {
+		      if (strcmp (fmt, HERE_T_FMT))
+			*decided = loc;
+		      break;
+		    }
+		  *decided = raw;
+		}
+	      if (!recursive (HERE_T_FMT))
+		return NULL;
 	      break;
 	    default:
 	      return NULL;
 	    }
 	  break;
+#else
+	  /* We have no information about the era format.  Just use
+	     the normal format.  */
+	  if (*fmt != 'c' && *fmt != 'C' && *fmt != 'y' && *fmt != 'Y'
+	      && *fmt != 'x' && *fmt != 'X')
+	    /* This is an illegal format.  */
+	    return NULL;
+
+	  goto start_over;
+#endif
 	case 'O':
 	  switch (*fmt++)
 	    {
@@ -357,7 +687,8 @@ strptime (const char *buf, const char *format, struct tm *tm)
 	    case 'V':
 	    case 'W':
 	      get_alt_number (0, 53);
-	      /* XXX This cannot determine any field in TM.  */
+	      /* XXX This cannot determine any field in TM without
+		 further information.  */
 	      break;
 	    case 'w':
 	      /* Match number of weekday using alternate numeric symbols.  */
@@ -382,3 +713,19 @@ strptime (const char *buf, const char *format, struct tm *tm)
 
   return (char *) rp;
 }
+
+
+char *
+strptime (buf, format, tm)
+     const char *buf;
+     const char *format;
+     struct tm *tm;
+{
+  enum locale_status decided;
+#ifdef _NL_CURRENT
+  decided = not;
+#else
+  decided = raw;
+#endif
+  return strptime_internal (buf, format, tm, &decided);
+}
diff --git a/time/test-tz.c b/time/test-tz.c
index 2e1432cf11..528aa6f7ab 100644
--- a/time/test-tz.c
+++ b/time/test-tz.c
@@ -17,7 +17,7 @@ struct {
 
 
 int
-main(int argc, char ** argv)
+main (int argc, char ** argv)
 {
   int errors = 0;
   struct tm tm;
@@ -36,8 +36,7 @@ main(int argc, char ** argv)
   for (i = 0; i < sizeof (tests) / sizeof (tests[0]); ++i)
     {
       putenv (tests[i].env);
-      tzset ();
-      t = mktime(&tm);
+      t = mktime (&tm);
       if (t != tests[i].expected)
 	{
 	  printf ("%s: flunked test %u (expected %lu, got %lu)\n",
diff --git a/time/tzfile.c b/time/tzfile.c
index d80789d570..761ddc9539 100644
--- a/time/tzfile.c
+++ b/time/tzfile.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 92, 93, 95, 96 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 92, 93, 95, 96, 97 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
@@ -113,16 +113,28 @@ __tzfile_read (const char *file)
 
   if (*file != '/')
     {
-      static const char tzdir[] = TZDIR;
-      register const unsigned int len = strlen (file) + 1;
-      char *new = (char *) __alloca (sizeof (tzdir) + len);
-      memcpy (new, tzdir, sizeof(tzdir) - 1);
-      new[sizeof (tzdir) - 1] = '/';
-      memcpy (&new[sizeof (tzdir)], file, len);
+      static const char default_tzdir[] = TZDIR;
+      const char *tzdir;
+      unsigned int len, tzdir_len;
+      char *new;
+
+      tzdir = __secure_getenv ("TZDIR");
+      if (tzdir == NULL || *tzdir == '\0')
+	{
+	  tzdir = default_tzdir;
+	  tzdir_len = sizeof (default_tzdir) - 1;
+	}
+      else
+	tzdir_len = strlen (tzdir);
+      len = strlen (file) + 1;
+      new = (char *) __alloca (tzdir_len + 1 + len);
+      memcpy (new, tzdir, tzdir_len);
+      new[tzdir_len] = '/';
+      memcpy (&new[tzdir_len + 1], file, len);
       file = new;
     }
 
-  f = fopen(file, "r");
+  f = fopen (file, "r");
   if (f == NULL)
     return;
 
@@ -171,6 +183,12 @@ __tzfile_read (const char *file)
       fread(type_idxs, 1, num_transitions, f) != num_transitions)
     goto lose;
 
+  /* Check for bogus indices in the data file, so we can hereafter
+     safely use type_idxs[T] as indices into `types' and never crash.  */
+  for (i = 0; i < num_transitions; ++i)
+    if (type_idxs[i] >= num_types)
+      goto lose;
+
   if (BYTE_ORDER != BIG_ENDIAN || sizeof (time_t) != 4)
     {
       /* Decode the transition times, stored as 4-byte integers in
@@ -189,6 +207,8 @@ __tzfile_read (const char *file)
 	  fread (&types[i].isdst, 1, 1, f) != 1 ||
 	  fread (&types[i].idx, 1, 1, f) != 1)
 	goto lose;
+      if (types[i].idx >= chars) /* Bogus index in data file.  */
+	goto lose;
       types[i].offset = (long int) decode (x);
     }
 
@@ -335,6 +355,10 @@ __tzfile_default (char *std, char *dst, long int stdoff, long int dstoff)
   types[1].offset = dstoff;
   types[1].isdst = 1;
 
+  /* Reset the zone names to point to the user's names.  */
+  __tzname[0] = &zone_names[0];
+  __tzname[1] = &zone_names[stdlen];
+
   compute_tzname_max (stdlen + dstlen);
 }
 
@@ -425,7 +449,7 @@ compute_tzname_max (size_t chars)
       const char *start = p;
       while (*p != '\0')
 	++p;
-      if (p - start > __tzname_cur_max)
+      if ((size_t) (p - start) > __tzname_cur_max)
 	__tzname_cur_max = p - start;
     } while (++p < &zone_names[chars]);
 }
diff --git a/time/tzselect.ksh b/time/tzselect.ksh
index 0f0a3bb28e..33bdbc7431 100644
--- a/time/tzselect.ksh
+++ b/time/tzselect.ksh
@@ -1,4 +1,4 @@
-#! /bin/ksh
+#! @KSH@
 # Ask the user about the time zone, and output the resulting TZ value to stdout.
 # Interact with the user via stderr and stdin.
 
@@ -11,7 +11,7 @@
 # you can use either of the following free programs instead:
 #
 #	Bourne-Again shell (bash)
-#	<URL:ftp://prep.ai.mit.edu:/pub/gnu/bash-1.14.7.tar.gz>
+#	<URL:ftp://prep.ai.mit.edu:/pub/gnu/bash-2.0.tar.gz>
 #	(or any later version)
 #
 #	Public domain ksh
@@ -22,7 +22,7 @@
 # you can use either of the following free programs instead:
 #
 #	GNU awk (gawk)
-#	<URL:ftp://prep.ai.mit.edu:/pub/gnu/gawk-3.0.0.tar.gz>
+#	<URL:ftp://prep.ai.mit.edu:/pub/gnu/gawk-3.0.2.tar.gz>
 #	(or any later version)
 #
 #	mawk
@@ -32,7 +32,7 @@
 
 # Specify default values for environment variables if they are unset.
 : ${AWK=awk}
-: ${TZDIR=$(pwd)}
+: ${TZDIR=@TZDIR@}
 
 # Check for awk Posix compliance.
 ($AWK -v x=y 'BEGIN { exit 123 }') </dev/null >/dev/null 2>&1
diff --git a/time/tzset.c b/time/tzset.c
index 13360b445b..8d8be34405 100644
--- a/time/tzset.c
+++ b/time/tzset.c
@@ -108,16 +108,12 @@ __tzset_internal (always)
 
   /* Free old storage.  */
   if (tz_rules[0].name != NULL && *tz_rules[0].name != '\0')
-    {
-      free((void *) tz_rules[0].name);
-      tz_rules[0].name = NULL;
-    }
+    free((void *) tz_rules[0].name);
   if (tz_rules[1].name != NULL && *tz_rules[1].name != '\0' &&
       tz_rules[1].name != tz_rules[0].name)
-    {
-      free((void *) tz_rules[1].name);
-      tz_rules[1].name = NULL;
-    }
+    free((void *) tz_rules[1].name);
+  tz_rules[0].name = NULL;
+  tz_rules[1].name = NULL;
 
   /* Save the value of `tz'.  */
   if (old_tz != NULL)
@@ -234,6 +230,9 @@ __tzset_internal (always)
 	  tz += l;
 	}
     }
+  else
+    /* There is no DST.  */
+    tz_rules[1].name = tz_rules[0].name;
 
   /* Figure out the DST offset from GMT.  */
   if (*tz == '-' || *tz == '+')
diff --git a/values.h b/values.h
index 0b2b661abd..3c82842870 100644
--- a/values.h
+++ b/values.h
@@ -1,5 +1,5 @@
 /* Old compatibility names for <limits.h> and <float.h> constants.
-   Copyright (C) 1995, 1996 Free Software Foundation, Inc.
+   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
@@ -21,7 +21,9 @@
    <limits.h> and/or <float.h> instead of <values.h>.  */
 
 #ifndef	_VALUES_H
+
 #define	_VALUES_H	1
+#include <features.h>
 
 #include <limits.h>
 
@@ -30,7 +32,7 @@
 #define CHARBITS	_TYPEBITS (char)
 #define SHORTBITS	_TYPEBITS (short int)
 #define INTBITS		_TYPEBITS (int)
-#define LONGBITS	_TYPEBITS (long)
+#define LONGBITS	_TYPEBITS (long int)
 #define PTRBITS		_TYPEBITS (char *)
 #define DOUBLEBITS	_TYPEBITS (double)
 #define FLOATBITS	_TYPEBITS (float)
@@ -59,4 +61,9 @@
 #define	FMAXEXP		FLT_MAX_EXP
 
 
+#ifdef __USE_MISC
+/* Some systems define this name instead of CHAR_BIT or CHARBITS.  */
+#define BITSPERBYTE	CHAR_BIT
+#endif
+
 #endif	/* values.h */