summary refs log tree commit diff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1997-11-26 04:23:08 +0000
committerUlrich Drepper <drepper@redhat.com>1997-11-26 04:23:08 +0000
commitf4017d205738b913f1002433cde5d4b4e93fbd81 (patch)
tree078a2f6aab0f3faf7355b41e12d8a06be81663a2
parente34b0f2902588bbbfaf55829692e32c3c7134b74 (diff)
downloadglibc-f4017d205738b913f1002433cde5d4b4e93fbd81.tar.gz
glibc-f4017d205738b913f1002433cde5d4b4e93fbd81.tar.xz
glibc-f4017d205738b913f1002433cde5d4b4e93fbd81.zip
1997-11-26 04:28  Ulrich Drepper  <drepper@cygnus.com>

	* eld/dl-profile.c (_dl_start_profile): Avoid FP calculation when
	computing s_scale.  Patch by a sun <asun@zoology.washington.edu>.

	* iconv/gconv_close.c: Correct freeing of descriptor data.
	* iconv/gconv_simple.c: Return correct error values for illegal or
	incomplete characters.

	* Makefile (iconvdata/%): Special goal to simplify iconvdata
	development.
	* iconvdata/Makefile: New file.
	* iconvdata/configure: Likewise.
	* iconvdata/extra-module.mk: Likewise.
	* iconvdata/gconv-modules: Likewise.
	* iconvdata/iso6937.c: Likewise.
	* iconvdata/iso8859-1.c: Likewise.
	* iconvdata/iso8859-10.c: Likewise.
	* iconvdata/iso8859-10.h: Likewise.
	* iconvdata/iso8859-2.c: Likewise.
	* iconvdata/iso8859-2.h: Likewise.
	* iconvdata/iso8859-3.c: Likewise.
	* iconvdata/iso8859-3.h: Likewise.
	* iconvdata/iso8859-4.c: Likewise.
	* iconvdata/iso8859-4.h: Likewise.
	* iconvdata/iso8859-5.c: Likewise.
	* iconvdata/iso8859-5.h: Likewise.
	* iconvdata/iso8859-6.c: Likewise.
	* iconvdata/iso8859-6.h: Likewise.
	* iconvdata/iso8859-7.c: Likewise.
	* iconvdata/iso8859-7.h: Likewise.
	* iconvdata/iso8859-8.c: Likewise.
	* iconvdata/iso8859-8.h: Likewise.
	* iconvdata/iso8859-9.c: Likewise.
	* iconvdata/iso8859-9.h: Likewise.
	* iconvdata/iso8859-generic.c: Likewise.
	* iconvdata/t61.c: Likewise.

	* string/Makefile (routines): Add strcasestr.
	* string/string.h: Add prototype for strcasestr.
	* sysdeps/generic/strcasestr.c: New file.
	* wcsmbs/mbrtowc.c: Simplify special case a bit.
	* wcsmbs/wcrtomb.c: Likewise.
	* wcsmbs/mbsnrtowcs.c: Correctly handle incomplete characters.
	* wcsmbs/wcsnrtombs.c: Likewise.
	* wcsmbs/mbsrtowcs.c: Make sure SRC argument is correct when
	partial character is read.
	* wcsmbs/wcsrtombs.c: Likewise.
	* wcsmbs/wmemrtombs.c: Likewise.
	* wcsmbs/wmemrtowcs.c: Likewise.

	* io/ftw.h: Include <sys/stat.h> instead of <bits/stat.h>.
	* login/pty.h: Include <sys/ioctl.h> instead og <bits/ioctl-types.h>.
	* sysdeps/i386/__longjmp.S: Define _SETJMP_H.
	* sysdeps/i386/elf/setjmp.S: Likewise.
	* sysdeps/unix/sysv/linux/kernel_termios.h: Do include
	<bits/termios.h>.

	* sysdeps/posix/mk-stdiolim.c: Output file with comment.
	* sysdeps/unix/sysv/linux/stdio_lim.h.in: Add comment.

	* sysdeps/unix/sysv/linux/sys/mman.h: Pretty print.
	* sysvipc/sys/ipc.h: Likewise.
	* sysvipc/sys/msg.h: Likewise.
	* sysvipc/sys/sem.h: Likewise.
	* sysvipc/sys/shm.h: Likewise.

	* sysdeps/alpha/bits/endian.h: Issue error message if the header is
	used directly.
	* sysdeps/alpha/bits/setjmp.h: Likewise.
	* sysdeps/alpha/fpu/bits/fenv.h: Likewise.
	* sysdeps/arm/bits/endian.h: Likewise.
	* sysdeps/arm/bits/setjmp.h: Likewise.
	* sysdeps/generic/bits/byteswap.h: Likewise.
	* sysdeps/generic/bits/confname.h: Likewise.
	* sysdeps/generic/bits/dirent.h: Likewise.
	* sysdeps/generic/bits/dlfcn.h: Likewise.
	* sysdeps/generic/bits/endian.h: Likewise.
	* sysdeps/generic/bits/fenv.h: Likewise.
	* sysdeps/generic/bits/huge_val.h: Likewise.
	* sysdeps/generic/bits/in.h: Likewise.
	* sysdeps/generic/bits/ioctl-types.h: Likewise.
	* sysdeps/generic/bits/ioctls.h: Likewise.
	* sysdeps/generic/bits/ipc.h: Likewise.
	* sysdeps/generic/bits/msq.h: Likewise.
	* sysdeps/generic/bits/poll.h: Likewise.
	* sysdeps/generic/bits/resource.h: Likewise.
	* sysdeps/generic/bits/sched.h: Likewise.
	* sysdeps/generic/bits/sem.h: Likewise.
	* sysdeps/generic/bits/setjmp.h: Likewise.
	* sysdeps/generic/bits/shm.h: Likewise.
	* sysdeps/generic/bits/sigaction.h: Likewise.
	* sysdeps/generic/bits/sigcontext.h: Likewise.
	* sysdeps/generic/bits/socket.h: Likewise.
	* sysdeps/generic/bits/stat.h: Likewise.
	* sysdeps/generic/bits/statfs.h: Likewise.
	* sysdeps/generic/bits/stdio_lim.h: Likewise.
	* sysdeps/generic/bits/termios.h: Likewise.
	* sysdeps/generic/bits/time.h: Likewise.
	* sysdeps/generic/bits/uio.h: Likewise.
	* sysdeps/generic/bits/utmp.h: Likewise.
	* sysdeps/generic/bits/utmpx.h: Likewise.
	* sysdeps/generic/bits/utsname.h: Likewise.
	* sysdeps/generic/bits/waitflags.h: Likewise.
	* sysdeps/generic/bits/waitstatus.h: Likewise.
	* sysdeps/gnu/bits/utmp.h: Likewise.
	* sysdeps/gnu/bits/utmpx.h: Likewise.
	* sysdeps/i386/bits/byteswap.h: Likewise.
	* sysdeps/i386/bits/endian.h: Likewise.
	* sysdeps/i386/bits/huge_val.h: Likewise.
	* sysdeps/i386/bits/setjmp.h: Likewise.
	* sysdeps/i386/fpu/bits/fenv.h: Likewise.
	* sysdeps/ieee754/bits/huge_val.h: Likewise.
	* sysdeps/m68k/bits/byteswap.h: Likewise.
	* sysdeps/m68k/bits/endian.h: Likewise.
	* sysdeps/m68k/bits/setjmp.h: Likewise.
	* sysdeps/m68k/fpu/bits/fenv.h: Likewise.
	* sysdeps/mach/hurd/alpha/bits/sigcontext.h: Likewise.
	* sysdeps/mach/hurd/bits/ioctls.h: Likewise.
	* sysdeps/mach/hurd/bits/stat.h: Likewise.
	* sysdeps/mach/hurd/hppa/bits/sigcontext.h: Likewise.
	* sysdeps/mach/hurd/i386/bits/sigcontext.h: Likewise.
	* sysdeps/mach/hurd/mips/bits/sigcontext.h: Likewise.
	* sysdeps/mips/bits/dlfcn.h: Likewise.
	* sysdeps/mips/bits/endian.h: Likewise.
	* sysdeps/mips/bits/setjmp.h: Likewise.
	* sysdeps/mips/dec/bits/endian.h: Likewise.
	* sysdeps/mips/mips64/bits/setjmp.h: Likewise.
	* sysdeps/mips/mipsel/bits/endian.h: Likewise.
	* sysdeps/mips/p40/bits/endian.h: Likewise.
	* sysdeps/powerpc/bits/endian.h: Likewise.
	* sysdeps/powerpc/bits/fenv.h: Likewise.
	* sysdeps/powerpc/bits/setjmp.h: Likewise.
	* sysdeps/sparc/sparc32/bits/endian.h: Likewise.
	* sysdeps/sparc/sparc32/bits/setjmp.h: Likewise.
	* sysdeps/sparc/sparc32/fpu/bits/fenv.h: Likewise.
	* sysdeps/sparc/sparc64/bits/endian.h: Likewise.
	* sysdeps/sparc/sparc64/fpu/bits/fenv.h: Likewise.
	* sysdeps/unix/bsd/bits/dirent.h: Likewise.
	* sysdeps/unix/bsd/bits/stat.h: Likewise.
	* sysdeps/unix/bsd/bits/waitflags.h: Likewise.
	* sysdeps/unix/bsd/bsd4.4/bits/dirent.h: Likewise.
	* sysdeps/unix/bsd/osf/alpha/bits/stat.h: Likewise.
	* sysdeps/unix/bsd/osf/bits/sigaction.h: Likewise.
	* sysdeps/unix/bsd/sun/m68k/bits/sigcontext.h: Likewise.
	* sysdeps/unix/bsd/sun/sparc/bits/sigcontext.h: Likewise.
	* sysdeps/unix/bsd/sun/sunos4/bits/resource.h: Likewise.
	* sysdeps/unix/bsd/sun/sunos4/bits/termios.h: Likewise.
	* sysdeps/unix/bsd/sun/sunos4/bits/utsname.h: Likewise.
	* sysdeps/unix/bsd/ultrix4/bits/utsname.h: Likewise.
	* sysdeps/unix/bsd/ultrix4/mips/bits/sigcontext.h: Likewise.
	* sysdeps/unix/common/bits/dirent.h: Likewise.
	* sysdeps/unix/sysv/bits/dirent.h: Likewise.
	* sysdeps/unix/sysv/bits/stat.h: Likewise.
	* sysdeps/unix/sysv/bits/utmp.h: Likewise.
	* sysdeps/unix/sysv/bits/utsname.h: Likewise.
	* sysdeps/unix/sysv/irix4/bits/confname.h: Likewise.
	* sysdeps/unix/sysv/irix4/bits/stat.h: Likewise.
	* sysdeps/unix/sysv/linux/alpha/bits/ioctls.h: Likewise.
	* sysdeps/unix/sysv/linux/alpha/bits/ipc.h: Likewise.
	* sysdeps/unix/sysv/linux/alpha/bits/mman.h: Likewise.
	* sysdeps/unix/sysv/linux/alpha/bits/sigaction.h: Likewise.
	* sysdeps/unix/sysv/linux/alpha/bits/stat.h: Likewise.
	* sysdeps/unix/sysv/linux/alpha/bits/termios.h: Likewise.
	* sysdeps/unix/sysv/linux/alpha/bits/time.h: Likewise.
	* sysdeps/unix/sysv/linux/bits/dirent.h: Likewise.
	* sysdeps/unix/sysv/linux/bits/in.h: Likewise.
	* sysdeps/unix/sysv/linux/bits/ioctl-types.h: Likewise.
	* sysdeps/unix/sysv/linux/bits/ioctls.h: Likewise.
	* sysdeps/unix/sysv/linux/bits/ipc.h: Likewise.
	* sysdeps/unix/sysv/linux/bits/msq.h: Likewise.
	* sysdeps/unix/sysv/linux/bits/poll.h: Likewise.
	* sysdeps/unix/sysv/linux/bits/resource.h: Likewise.
	* sysdeps/unix/sysv/linux/bits/sched.h: Likewise.
	* sysdeps/unix/sysv/linux/bits/sem.h: Likewise.
	* sysdeps/unix/sysv/linux/bits/shm.h: Likewise.
	* sysdeps/unix/sysv/linux/bits/sigaction.h: Likewise.
	* sysdeps/unix/sysv/linux/bits/sigcontext.h: Likewise.
	* sysdeps/unix/sysv/linux/bits/socket.h: Likewise.
	* sysdeps/unix/sysv/linux/bits/stat.h: Likewise.
	* sysdeps/unix/sysv/linux/bits/statfs.h: Likewise.
	* sysdeps/unix/sysv/linux/bits/termios.h: Likewise.
	* sysdeps/unix/sysv/linux/bits/time.h: Likewise.
	* sysdeps/unix/sysv/linux/bits/uio.h: Likewise.
	* sysdeps/unix/sysv/linux/bits/utsname.h: Likewise.
	* sysdeps/unix/sysv/linux/bits/waitflags.h: Likewise.
	* sysdeps/unix/sysv/linux/i386/bits/mman.h: Likewise.
	* sysdeps/unix/sysv/linux/m68k/bits/mman.h: Likewise.
	* sysdeps/unix/sysv/linux/m68k/bits/poll.h: Likewise.
	* sysdeps/unix/sysv/linux/mips/bits/endian.h: Likewise.
	* sysdeps/unix/sysv/linux/mips/bits/ioctl-types.h: Likewise.
	* sysdeps/unix/sysv/linux/mips/bits/ipc.h: Likewise.
	* sysdeps/unix/sysv/linux/mips/bits/mman.h: Likewise.
	* sysdeps/unix/sysv/linux/mips/bits/poll.h: Likewise.
	* sysdeps/unix/sysv/linux/mips/bits/shm.h: Likewise.
	* sysdeps/unix/sysv/linux/mips/bits/sigaction.h: Likewise.
	* sysdeps/unix/sysv/linux/mips/bits/socket.h: Likewise.
	* sysdeps/unix/sysv/linux/mips/bits/stat.h: Likewise.
	* sysdeps/unix/sysv/linux/mips/bits/statfs.h: Likewise.
	* sysdeps/unix/sysv/linux/mips/bits/termios.h: Likewise.
	* sysdeps/unix/sysv/linux/mips/bits/time.h: Likewise.
	* sysdeps/unix/sysv/linux/powerpc/bits/ioctl-types.h: Likewise.
	* sysdeps/unix/sysv/linux/powerpc/bits/mman.h: Likewise.
	* sysdeps/unix/sysv/linux/powerpc/bits/termios.h: Likewise.
	* sysdeps/unix/sysv/linux/sparc/bits/ioctls.h: Likewise.
	* sysdeps/unix/sysv/linux/sparc/bits/poll.h: Likewise.
	* sysdeps/unix/sysv/linux/sparc/bits/sigaction.h: Likewise.
	* sysdeps/unix/sysv/linux/sparc/bits/termios.h: Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc32/bits/mman.h: Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc64/bits/mman.h: Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc64/bits/setjmp.h: Likewise.
	* sysdeps/unix/sysv/minix/bits/sigaction.h: Likewise.
	* sysdeps/unix/sysv/sco3.2.4/bits/confname.h: Likewise.
	* sysdeps/unix/sysv/sco3.2.4/bits/sigaction.h: Likewise.
	* sysdeps/unix/sysv/sysv4/bits/sigaction.h: Likewise.
	* sysdeps/unix/sysv/sysv4/bits/utsname.h: Likewise.
	* sysdeps/unix/sysv/sysv4/bits/waitflags.h: Likewise.
	* sysdeps/unix/sysv/sysv4/i386/bits/stat.h: Likewise.
	* sysdeps/unix/sysv/sysv4/solaris2/bits/stat.h: Likewise.
	* sysdeps/unix/sysv/sysv4/solaris2/sparc/bits/sigcontext.h: Likewise.
	* sysdeps/vax/bits/huge_val.h: Likewise.
	* sysdeps/vax/bits/setjmp.h: Likewise.
	* sysdeps/wordsize-32/bits/elfclass.h: Likewise.
	* sysdeps/wordsize-64/bits/elfclass.h: Likewise.

1997-11-25  Andreas Jaeger  <aj@arthur.rhein-neckar.de>

	* libio/stdio.h: Correct comment of sys_nerr/sys_errlist

1997-11-25  Paul Eggert  <eggert@shade.twinsun.com>

	* strftime.c (strftime):
	No longer any need to undef or declare if emacs is defined.
	(my_strftime): When checking a -1 returned by mktime, don't blow up
	if localtime_r returns NULL.

1997-11-24  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>

	* README.template: Fix spelling.

1997-11-25  Andreas Jaeger  <aj@arthur.rhein-neckar.de>

	* configure.in: Enhance --enable-add-ons description a wee bit.

1997-11-24  Andreas Jaeger  <aj@arthur.rhein-neckar.de>

	* glibcbug.in: Add more information of build environment and flags.

1997-11-23  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>

	* sysdeps/posix/getcwd.c: Recognize EOF from readdir and translate
	it into ENOENT.
-rw-r--r--ChangeLog253
-rw-r--r--FAQ78
-rw-r--r--Makefile3
-rw-r--r--README.template2
-rw-r--r--bits/byteswap.h7
-rw-r--r--bits/confname.h4
-rw-r--r--bits/dirent.h6
-rw-r--r--bits/dlfcn.h7
-rw-r--r--bits/endian.h4
-rw-r--r--bits/fenv.h2
-rw-r--r--bits/huge_val.h4
-rw-r--r--bits/in.h15
-rw-r--r--bits/ioctl-types.h25
-rw-r--r--bits/ioctls.h4
-rw-r--r--bits/ipc.h30
-rw-r--r--bits/msq.h6
-rw-r--r--bits/poll.h3
-rw-r--r--bits/resource.h7
-rw-r--r--bits/sched.h4
-rw-r--r--bits/sem.h9
-rw-r--r--bits/setjmp.h4
-rw-r--r--bits/shm.h29
-rw-r--r--bits/sigaction.h4
-rw-r--r--bits/sigcontext.h4
-rw-r--r--bits/socket.h9
-rw-r--r--bits/stat.h36
-rw-r--r--bits/statfs.h12
-rw-r--r--bits/termios.h78
-rw-r--r--bits/time.h18
-rw-r--r--bits/uio.h2
-rw-r--r--bits/utmp.h8
-rw-r--r--bits/utsname.h22
-rw-r--r--bits/waitflags.h2
-rw-r--r--bits/waitstatus.h34
-rwxr-xr-xconfigure4
-rw-r--r--configure.in6
-rw-r--r--elf/dl-profile.c11
-rw-r--r--glibcbug.in22
-rw-r--r--iconv/gconv_close.c10
-rw-r--r--iconv/gconv_simple.c55
-rw-r--r--iconvdata/Makefile119
-rwxr-xr-xiconvdata/configure5
-rw-r--r--iconvdata/extra-module.mk16
-rw-r--r--iconvdata/gconv-modules145
-rw-r--r--iconvdata/iso6937.c681
-rw-r--r--iconvdata/iso8859-1.c219
-rw-r--r--iconvdata/iso8859-10.c24
-rw-r--r--iconvdata/iso8859-10.h516
-rw-r--r--iconvdata/iso8859-2.c24
-rw-r--r--iconvdata/iso8859-2.h516
-rw-r--r--iconvdata/iso8859-3.c24
-rw-r--r--iconvdata/iso8859-3.h502
-rw-r--r--iconvdata/iso8859-4.c24
-rw-r--r--iconvdata/iso8859-4.h516
-rw-r--r--iconvdata/iso8859-5.c24
-rw-r--r--iconvdata/iso8859-5.h516
-rw-r--r--iconvdata/iso8859-6.c24
-rw-r--r--iconvdata/iso8859-6.h426
-rw-r--r--iconvdata/iso8859-7.c24
-rw-r--r--iconvdata/iso8859-7.h504
-rw-r--r--iconvdata/iso8859-8.c24
-rw-r--r--iconvdata/iso8859-8.h440
-rw-r--r--iconvdata/iso8859-9.c24
-rw-r--r--iconvdata/iso8859-9.h516
-rw-r--r--iconvdata/iso8859-generic.c228
-rw-r--r--iconvdata/t61.c630
-rw-r--r--io/ftw.h2
-rw-r--r--login/pty.h4
-rw-r--r--manual/arith.texi2
-rw-r--r--string/Makefile2
-rw-r--r--string/string.h9
-rw-r--r--sysdeps/alpha/bits/endian.h4
-rw-r--r--sysdeps/alpha/bits/setjmp.h40
-rw-r--r--sysdeps/alpha/fpu/bits/fenv.h17
-rw-r--r--sysdeps/arm/bits/endian.h4
-rw-r--r--sysdeps/arm/bits/setjmp.h10
-rw-r--r--sysdeps/generic/bits/byteswap.h7
-rw-r--r--sysdeps/generic/bits/confname.h4
-rw-r--r--sysdeps/generic/bits/dirent.h6
-rw-r--r--sysdeps/generic/bits/dlfcn.h7
-rw-r--r--sysdeps/generic/bits/endian.h4
-rw-r--r--sysdeps/generic/bits/fenv.h2
-rw-r--r--sysdeps/generic/bits/huge_val.h4
-rw-r--r--sysdeps/generic/bits/in.h15
-rw-r--r--sysdeps/generic/bits/ioctl-types.h25
-rw-r--r--sysdeps/generic/bits/ioctls.h4
-rw-r--r--sysdeps/generic/bits/ipc.h30
-rw-r--r--sysdeps/generic/bits/msq.h6
-rw-r--r--sysdeps/generic/bits/poll.h3
-rw-r--r--sysdeps/generic/bits/resource.h7
-rw-r--r--sysdeps/generic/bits/sched.h4
-rw-r--r--sysdeps/generic/bits/sem.h9
-rw-r--r--sysdeps/generic/bits/setjmp.h4
-rw-r--r--sysdeps/generic/bits/shm.h29
-rw-r--r--sysdeps/generic/bits/sigaction.h4
-rw-r--r--sysdeps/generic/bits/sigcontext.h4
-rw-r--r--sysdeps/generic/bits/socket.h9
-rw-r--r--sysdeps/generic/bits/stat.h36
-rw-r--r--sysdeps/generic/bits/statfs.h12
-rw-r--r--sysdeps/generic/bits/stdio_lim.h18
-rw-r--r--sysdeps/generic/bits/termios.h78
-rw-r--r--sysdeps/generic/bits/time.h18
-rw-r--r--sysdeps/generic/bits/uio.h2
-rw-r--r--sysdeps/generic/bits/utmp.h8
-rw-r--r--sysdeps/generic/bits/utmpx.h14
-rw-r--r--sysdeps/generic/bits/utsname.h22
-rw-r--r--sysdeps/generic/bits/waitflags.h2
-rw-r--r--sysdeps/generic/bits/waitstatus.h34
-rw-r--r--sysdeps/generic/strcasestr.c129
-rw-r--r--sysdeps/gnu/bits/utmp.h46
-rw-r--r--sysdeps/gnu/bits/utmpx.h23
-rw-r--r--sysdeps/i386/__longjmp.S1
-rw-r--r--sysdeps/i386/bits/byteswap.h7
-rw-r--r--sysdeps/i386/bits/endian.h4
-rw-r--r--sysdeps/i386/bits/huge_val.h36
-rw-r--r--sysdeps/i386/bits/setjmp.h18
-rw-r--r--sysdeps/i386/elf/setjmp.S1
-rw-r--r--sysdeps/i386/fpu/bits/fenv.h5
-rw-r--r--sysdeps/ieee754/bits/huge_val.h54
-rw-r--r--sysdeps/m68k/bits/byteswap.h13
-rw-r--r--sysdeps/m68k/bits/endian.h4
-rw-r--r--sysdeps/m68k/bits/setjmp.h10
-rw-r--r--sysdeps/m68k/fpu/bits/fenv.h2
-rw-r--r--sysdeps/mach/hurd/alpha/bits/sigcontext.h4
-rw-r--r--sysdeps/mach/hurd/bits/ioctls.h56
-rw-r--r--sysdeps/mach/hurd/bits/stat.h12
-rw-r--r--sysdeps/mach/hurd/hppa/bits/sigcontext.h4
-rw-r--r--sysdeps/mach/hurd/i386/bits/sigcontext.h4
-rw-r--r--sysdeps/mach/hurd/mips/bits/sigcontext.h4
-rw-r--r--sysdeps/mips/bits/dlfcn.h14
-rw-r--r--sysdeps/mips/bits/endian.h4
-rw-r--r--sysdeps/mips/bits/setjmp.h5
-rw-r--r--sysdeps/mips/dec/bits/endian.h4
-rw-r--r--sysdeps/mips/mips64/bits/setjmp.h5
-rw-r--r--sysdeps/mips/mipsel/bits/endian.h4
-rw-r--r--sysdeps/mips/p40/bits/endian.h4
-rw-r--r--sysdeps/posix/getcwd.c12
-rw-r--r--sysdeps/posix/mk-stdiolim.c26
-rw-r--r--sysdeps/powerpc/bits/endian.h4
-rw-r--r--sysdeps/powerpc/bits/fenv.h20
-rw-r--r--sysdeps/powerpc/bits/setjmp.h18
-rw-r--r--sysdeps/sparc/sparc32/bits/endian.h4
-rw-r--r--sysdeps/sparc/sparc32/bits/setjmp.h12
-rw-r--r--sysdeps/sparc/sparc32/fpu/bits/fenv.h6
-rw-r--r--sysdeps/sparc/sparc64/bits/endian.h8
-rw-r--r--sysdeps/sparc/sparc64/fpu/bits/fenv.h6
-rw-r--r--sysdeps/unix/bsd/bits/dirent.h4
-rw-r--r--sysdeps/unix/bsd/bits/stat.h12
-rw-r--r--sysdeps/unix/bsd/bits/waitflags.h4
-rw-r--r--sysdeps/unix/bsd/bsd4.4/bits/dirent.h4
-rw-r--r--sysdeps/unix/bsd/osf/alpha/bits/stat.h12
-rw-r--r--sysdeps/unix/bsd/osf/bits/sigaction.h4
-rw-r--r--sysdeps/unix/bsd/sun/m68k/bits/sigcontext.h4
-rw-r--r--sysdeps/unix/bsd/sun/sparc/bits/sigcontext.h4
-rw-r--r--sysdeps/unix/bsd/sun/sunos4/bits/resource.h7
-rw-r--r--sysdeps/unix/bsd/sun/sunos4/bits/termios.h112
-rw-r--r--sysdeps/unix/bsd/sun/sunos4/bits/utsname.h22
-rw-r--r--sysdeps/unix/bsd/ultrix4/bits/utsname.h22
-rw-r--r--sysdeps/unix/bsd/ultrix4/mips/bits/sigcontext.h5
-rw-r--r--sysdeps/unix/common/bits/dirent.h6
-rw-r--r--sysdeps/unix/sysv/bits/dirent.h4
-rw-r--r--sysdeps/unix/sysv/bits/stat.h11
-rw-r--r--sysdeps/unix/sysv/bits/utmp.h15
-rw-r--r--sysdeps/unix/sysv/bits/utsname.h22
-rw-r--r--sysdeps/unix/sysv/irix4/bits/confname.h4
-rw-r--r--sysdeps/unix/sysv/irix4/bits/stat.h11
-rw-r--r--sysdeps/unix/sysv/linux/alpha/bits/ioctls.h11
-rw-r--r--sysdeps/unix/sysv/linux/alpha/bits/ipc.h19
-rw-r--r--sysdeps/unix/sysv/linux/alpha/bits/mman.h4
-rw-r--r--sysdeps/unix/sysv/linux/alpha/bits/sigaction.h4
-rw-r--r--sysdeps/unix/sysv/linux/alpha/bits/stat.h11
-rw-r--r--sysdeps/unix/sysv/linux/alpha/bits/termios.h7
-rw-r--r--sysdeps/unix/sysv/linux/alpha/bits/time.h39
-rw-r--r--sysdeps/unix/sysv/linux/bits/dirent.h7
-rw-r--r--sysdeps/unix/sysv/linux/bits/in.h7
-rw-r--r--sysdeps/unix/sysv/linux/bits/ioctl-types.h12
-rw-r--r--sysdeps/unix/sysv/linux/bits/ioctls.h13
-rw-r--r--sysdeps/unix/sysv/linux/bits/ipc.h20
-rw-r--r--sysdeps/unix/sysv/linux/bits/msq.h34
-rw-r--r--sysdeps/unix/sysv/linux/bits/poll.h3
-rw-r--r--sysdeps/unix/sysv/linux/bits/resource.h7
-rw-r--r--sysdeps/unix/sysv/linux/bits/sched.h22
-rw-r--r--sysdeps/unix/sysv/linux/bits/sem.h18
-rw-r--r--sysdeps/unix/sysv/linux/bits/shm.h78
-rw-r--r--sysdeps/unix/sysv/linux/bits/sigaction.h4
-rw-r--r--sysdeps/unix/sysv/linux/bits/sigcontext.h4
-rw-r--r--sysdeps/unix/sysv/linux/bits/socket.h9
-rw-r--r--sysdeps/unix/sysv/linux/bits/stat.h11
-rw-r--r--sysdeps/unix/sysv/linux/bits/statfs.h11
-rw-r--r--sysdeps/unix/sysv/linux/bits/termios.h12
-rw-r--r--sysdeps/unix/sysv/linux/bits/time.h44
-rw-r--r--sysdeps/unix/sysv/linux/bits/uio.h2
-rw-r--r--sysdeps/unix/sysv/linux/bits/utsname.h6
-rw-r--r--sysdeps/unix/sysv/linux/bits/waitflags.h2
-rw-r--r--sysdeps/unix/sysv/linux/i386/bits/mman.h4
-rw-r--r--sysdeps/unix/sysv/linux/kernel_termios.h3
-rw-r--r--sysdeps/unix/sysv/linux/m68k/bits/mman.h4
-rw-r--r--sysdeps/unix/sysv/linux/m68k/bits/poll.h3
-rw-r--r--sysdeps/unix/sysv/linux/mips/bits/endian.h12
-rw-r--r--sysdeps/unix/sysv/linux/mips/bits/ioctl-types.h11
-rw-r--r--sysdeps/unix/sysv/linux/mips/bits/ipc.h28
-rw-r--r--sysdeps/unix/sysv/linux/mips/bits/mman.h4
-rw-r--r--sysdeps/unix/sysv/linux/mips/bits/poll.h3
-rw-r--r--sysdeps/unix/sysv/linux/mips/bits/shm.h78
-rw-r--r--sysdeps/unix/sysv/linux/mips/bits/sigaction.h6
-rw-r--r--sysdeps/unix/sysv/linux/mips/bits/socket.h11
-rw-r--r--sysdeps/unix/sysv/linux/mips/bits/stat.h11
-rw-r--r--sysdeps/unix/sysv/linux/mips/bits/statfs.h11
-rw-r--r--sysdeps/unix/sysv/linux/mips/bits/termios.h136
-rw-r--r--sysdeps/unix/sysv/linux/mips/bits/time.h38
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/bits/ioctl-types.h4
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/bits/mman.h4
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/bits/termios.h9
-rw-r--r--sysdeps/unix/sysv/linux/sparc/bits/ioctls.h11
-rw-r--r--sysdeps/unix/sysv/linux/sparc/bits/poll.h3
-rw-r--r--sysdeps/unix/sysv/linux/sparc/bits/sigaction.h6
-rw-r--r--sysdeps/unix/sysv/linux/sparc/bits/termios.h17
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc32/bits/mman.h4
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc64/bits/mman.h4
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc64/bits/setjmp.h8
-rw-r--r--sysdeps/unix/sysv/linux/stdio_lim.h.in33
-rw-r--r--sysdeps/unix/sysv/linux/sys/mman.h3
-rw-r--r--sysdeps/unix/sysv/minix/bits/sigaction.h4
-rw-r--r--sysdeps/unix/sysv/sco3.2.4/bits/confname.h4
-rw-r--r--sysdeps/unix/sysv/sco3.2.4/bits/sigaction.h4
-rw-r--r--sysdeps/unix/sysv/sysv4/bits/sigaction.h4
-rw-r--r--sysdeps/unix/sysv/sysv4/bits/utsname.h22
-rw-r--r--sysdeps/unix/sysv/sysv4/bits/waitflags.h6
-rw-r--r--sysdeps/unix/sysv/sysv4/i386/bits/stat.h58
-rw-r--r--sysdeps/unix/sysv/sysv4/solaris2/bits/stat.h22
-rw-r--r--sysdeps/unix/sysv/sysv4/solaris2/sparc/bits/sigcontext.h35
-rw-r--r--sysdeps/vax/bits/huge_val.h4
-rw-r--r--sysdeps/vax/bits/setjmp.h4
-rw-r--r--sysdeps/wordsize-32/bits/elfclass.h4
-rw-r--r--sysdeps/wordsize-64/bits/elfclass.h4
-rw-r--r--sysvipc/sys/ipc.h3
-rw-r--r--sysvipc/sys/msg.h15
-rw-r--r--sysvipc/sys/sem.h7
-rw-r--r--sysvipc/sys/shm.h5
-rw-r--r--time/strftime.c24
-rw-r--r--wcsmbs/mbrtowc.c7
-rw-r--r--wcsmbs/mbsnrtowcs.c112
-rw-r--r--wcsmbs/mbsrtowcs.c7
-rw-r--r--wcsmbs/wcrtomb.c9
-rw-r--r--wcsmbs/wcsnrtombs.c7
-rw-r--r--wcsmbs/wcsrtombs.c11
-rw-r--r--wcsmbs/wmemrtombs.c7
-rw-r--r--wcsmbs/wmemrtowcs.c111
248 files changed, 8922 insertions, 1429 deletions
diff --git a/ChangeLog b/ChangeLog
index ad17e4fc23..e512253cb5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,256 @@
+1997-11-26 04:28  Ulrich Drepper  <drepper@cygnus.com>
+
+	* eld/dl-profile.c (_dl_start_profile): Avoid FP calculation when
+	computing s_scale.  Patch by a sun <asun@zoology.washington.edu>.
+
+	* iconv/gconv_close.c: Correct freeing of descriptor data.
+	* iconv/gconv_simple.c: Return correct error values for illegal or
+	incomplete characters.
+
+	* Makefile (iconvdata/%): Special goal to simplify iconvdata
+	development.
+	* iconvdata/Makefile: New file.
+	* iconvdata/configure: Likewise.
+	* iconvdata/extra-module.mk: Likewise.
+	* iconvdata/gconv-modules: Likewise.
+	* iconvdata/iso6937.c: Likewise.
+	* iconvdata/iso8859-1.c: Likewise.
+	* iconvdata/iso8859-10.c: Likewise.
+	* iconvdata/iso8859-10.h: Likewise.
+	* iconvdata/iso8859-2.c: Likewise.
+	* iconvdata/iso8859-2.h: Likewise.
+	* iconvdata/iso8859-3.c: Likewise.
+	* iconvdata/iso8859-3.h: Likewise.
+	* iconvdata/iso8859-4.c: Likewise.
+	* iconvdata/iso8859-4.h: Likewise.
+	* iconvdata/iso8859-5.c: Likewise.
+	* iconvdata/iso8859-5.h: Likewise.
+	* iconvdata/iso8859-6.c: Likewise.
+	* iconvdata/iso8859-6.h: Likewise.
+	* iconvdata/iso8859-7.c: Likewise.
+	* iconvdata/iso8859-7.h: Likewise.
+	* iconvdata/iso8859-8.c: Likewise.
+	* iconvdata/iso8859-8.h: Likewise.
+	* iconvdata/iso8859-9.c: Likewise.
+	* iconvdata/iso8859-9.h: Likewise.
+	* iconvdata/iso8859-generic.c: Likewise.
+	* iconvdata/t61.c: Likewise.
+
+	* string/Makefile (routines): Add strcasestr.
+	* string/string.h: Add prototype for strcasestr.
+	* sysdeps/generic/strcasestr.c: New file.
+	* wcsmbs/mbrtowc.c: Simplify special case a bit.
+	* wcsmbs/wcrtomb.c: Likewise.
+	* wcsmbs/mbsnrtowcs.c: Correctly handle incomplete characters.
+	* wcsmbs/wcsnrtombs.c: Likewise.
+	* wcsmbs/mbsrtowcs.c: Make sure SRC argument is correct when
+	partial character is read.
+	* wcsmbs/wcsrtombs.c: Likewise.
+	* wcsmbs/wmemrtombs.c: Likewise.
+	* wcsmbs/wmemrtowcs.c: Likewise.
+
+	* io/ftw.h: Include <sys/stat.h> instead of <bits/stat.h>.
+	* login/pty.h: Include <sys/ioctl.h> instead og <bits/ioctl-types.h>.
+	* sysdeps/i386/__longjmp.S: Define _SETJMP_H.
+	* sysdeps/i386/elf/setjmp.S: Likewise.
+	* sysdeps/unix/sysv/linux/kernel_termios.h: Do include
+	<bits/termios.h>.
+
+	* sysdeps/posix/mk-stdiolim.c: Output file with comment.
+	* sysdeps/unix/sysv/linux/stdio_lim.h.in: Add comment.
+
+	* sysdeps/unix/sysv/linux/sys/mman.h: Pretty print.
+	* sysvipc/sys/ipc.h: Likewise.
+	* sysvipc/sys/msg.h: Likewise.
+	* sysvipc/sys/sem.h: Likewise.
+	* sysvipc/sys/shm.h: Likewise.
+
+	* sysdeps/alpha/bits/endian.h: Issue error message if the header is
+	used directly.
+	* sysdeps/alpha/bits/setjmp.h: Likewise.
+	* sysdeps/alpha/fpu/bits/fenv.h: Likewise.
+	* sysdeps/arm/bits/endian.h: Likewise.
+	* sysdeps/arm/bits/setjmp.h: Likewise.
+	* sysdeps/generic/bits/byteswap.h: Likewise.
+	* sysdeps/generic/bits/confname.h: Likewise.
+	* sysdeps/generic/bits/dirent.h: Likewise.
+	* sysdeps/generic/bits/dlfcn.h: Likewise.
+	* sysdeps/generic/bits/endian.h: Likewise.
+	* sysdeps/generic/bits/fenv.h: Likewise.
+	* sysdeps/generic/bits/huge_val.h: Likewise.
+	* sysdeps/generic/bits/in.h: Likewise.
+	* sysdeps/generic/bits/ioctl-types.h: Likewise.
+	* sysdeps/generic/bits/ioctls.h: Likewise.
+	* sysdeps/generic/bits/ipc.h: Likewise.
+	* sysdeps/generic/bits/msq.h: Likewise.
+	* sysdeps/generic/bits/poll.h: Likewise.
+	* sysdeps/generic/bits/resource.h: Likewise.
+	* sysdeps/generic/bits/sched.h: Likewise.
+	* sysdeps/generic/bits/sem.h: Likewise.
+	* sysdeps/generic/bits/setjmp.h: Likewise.
+	* sysdeps/generic/bits/shm.h: Likewise.
+	* sysdeps/generic/bits/sigaction.h: Likewise.
+	* sysdeps/generic/bits/sigcontext.h: Likewise.
+	* sysdeps/generic/bits/socket.h: Likewise.
+	* sysdeps/generic/bits/stat.h: Likewise.
+	* sysdeps/generic/bits/statfs.h: Likewise.
+	* sysdeps/generic/bits/stdio_lim.h: Likewise.
+	* sysdeps/generic/bits/termios.h: Likewise.
+	* sysdeps/generic/bits/time.h: Likewise.
+	* sysdeps/generic/bits/uio.h: Likewise.
+	* sysdeps/generic/bits/utmp.h: Likewise.
+	* sysdeps/generic/bits/utmpx.h: Likewise.
+	* sysdeps/generic/bits/utsname.h: Likewise.
+	* sysdeps/generic/bits/waitflags.h: Likewise.
+	* sysdeps/generic/bits/waitstatus.h: Likewise.
+	* sysdeps/gnu/bits/utmp.h: Likewise.
+	* sysdeps/gnu/bits/utmpx.h: Likewise.
+	* sysdeps/i386/bits/byteswap.h: Likewise.
+	* sysdeps/i386/bits/endian.h: Likewise.
+	* sysdeps/i386/bits/huge_val.h: Likewise.
+	* sysdeps/i386/bits/setjmp.h: Likewise.
+	* sysdeps/i386/fpu/bits/fenv.h: Likewise.
+	* sysdeps/ieee754/bits/huge_val.h: Likewise.
+	* sysdeps/m68k/bits/byteswap.h: Likewise.
+	* sysdeps/m68k/bits/endian.h: Likewise.
+	* sysdeps/m68k/bits/setjmp.h: Likewise.
+	* sysdeps/m68k/fpu/bits/fenv.h: Likewise.
+	* sysdeps/mach/hurd/alpha/bits/sigcontext.h: Likewise.
+	* sysdeps/mach/hurd/bits/ioctls.h: Likewise.
+	* sysdeps/mach/hurd/bits/stat.h: Likewise.
+	* sysdeps/mach/hurd/hppa/bits/sigcontext.h: Likewise.
+	* sysdeps/mach/hurd/i386/bits/sigcontext.h: Likewise.
+	* sysdeps/mach/hurd/mips/bits/sigcontext.h: Likewise.
+	* sysdeps/mips/bits/dlfcn.h: Likewise.
+	* sysdeps/mips/bits/endian.h: Likewise.
+	* sysdeps/mips/bits/setjmp.h: Likewise.
+	* sysdeps/mips/dec/bits/endian.h: Likewise.
+	* sysdeps/mips/mips64/bits/setjmp.h: Likewise.
+	* sysdeps/mips/mipsel/bits/endian.h: Likewise.
+	* sysdeps/mips/p40/bits/endian.h: Likewise.
+	* sysdeps/powerpc/bits/endian.h: Likewise.
+	* sysdeps/powerpc/bits/fenv.h: Likewise.
+	* sysdeps/powerpc/bits/setjmp.h: Likewise.
+	* sysdeps/sparc/sparc32/bits/endian.h: Likewise.
+	* sysdeps/sparc/sparc32/bits/setjmp.h: Likewise.
+	* sysdeps/sparc/sparc32/fpu/bits/fenv.h: Likewise.
+	* sysdeps/sparc/sparc64/bits/endian.h: Likewise.
+	* sysdeps/sparc/sparc64/fpu/bits/fenv.h: Likewise.
+	* sysdeps/unix/bsd/bits/dirent.h: Likewise.
+	* sysdeps/unix/bsd/bits/stat.h: Likewise.
+	* sysdeps/unix/bsd/bits/waitflags.h: Likewise.
+	* sysdeps/unix/bsd/bsd4.4/bits/dirent.h: Likewise.
+	* sysdeps/unix/bsd/osf/alpha/bits/stat.h: Likewise.
+	* sysdeps/unix/bsd/osf/bits/sigaction.h: Likewise.
+	* sysdeps/unix/bsd/sun/m68k/bits/sigcontext.h: Likewise.
+	* sysdeps/unix/bsd/sun/sparc/bits/sigcontext.h: Likewise.
+	* sysdeps/unix/bsd/sun/sunos4/bits/resource.h: Likewise.
+	* sysdeps/unix/bsd/sun/sunos4/bits/termios.h: Likewise.
+	* sysdeps/unix/bsd/sun/sunos4/bits/utsname.h: Likewise.
+	* sysdeps/unix/bsd/ultrix4/bits/utsname.h: Likewise.
+	* sysdeps/unix/bsd/ultrix4/mips/bits/sigcontext.h: Likewise.
+	* sysdeps/unix/common/bits/dirent.h: Likewise.
+	* sysdeps/unix/sysv/bits/dirent.h: Likewise.
+	* sysdeps/unix/sysv/bits/stat.h: Likewise.
+	* sysdeps/unix/sysv/bits/utmp.h: Likewise.
+	* sysdeps/unix/sysv/bits/utsname.h: Likewise.
+	* sysdeps/unix/sysv/irix4/bits/confname.h: Likewise.
+	* sysdeps/unix/sysv/irix4/bits/stat.h: Likewise.
+	* sysdeps/unix/sysv/linux/alpha/bits/ioctls.h: Likewise.
+	* sysdeps/unix/sysv/linux/alpha/bits/ipc.h: Likewise.
+	* sysdeps/unix/sysv/linux/alpha/bits/mman.h: Likewise.
+	* sysdeps/unix/sysv/linux/alpha/bits/sigaction.h: Likewise.
+	* sysdeps/unix/sysv/linux/alpha/bits/stat.h: Likewise.
+	* sysdeps/unix/sysv/linux/alpha/bits/termios.h: Likewise.
+	* sysdeps/unix/sysv/linux/alpha/bits/time.h: Likewise.
+	* sysdeps/unix/sysv/linux/bits/dirent.h: Likewise.
+	* sysdeps/unix/sysv/linux/bits/in.h: Likewise.
+	* sysdeps/unix/sysv/linux/bits/ioctl-types.h: Likewise.
+	* sysdeps/unix/sysv/linux/bits/ioctls.h: Likewise.
+	* sysdeps/unix/sysv/linux/bits/ipc.h: Likewise.
+	* sysdeps/unix/sysv/linux/bits/msq.h: Likewise.
+	* sysdeps/unix/sysv/linux/bits/poll.h: Likewise.
+	* sysdeps/unix/sysv/linux/bits/resource.h: Likewise.
+	* sysdeps/unix/sysv/linux/bits/sched.h: Likewise.
+	* sysdeps/unix/sysv/linux/bits/sem.h: Likewise.
+	* sysdeps/unix/sysv/linux/bits/shm.h: Likewise.
+	* sysdeps/unix/sysv/linux/bits/sigaction.h: Likewise.
+	* sysdeps/unix/sysv/linux/bits/sigcontext.h: Likewise.
+	* sysdeps/unix/sysv/linux/bits/socket.h: Likewise.
+	* sysdeps/unix/sysv/linux/bits/stat.h: Likewise.
+	* sysdeps/unix/sysv/linux/bits/statfs.h: Likewise.
+	* sysdeps/unix/sysv/linux/bits/termios.h: Likewise.
+	* sysdeps/unix/sysv/linux/bits/time.h: Likewise.
+	* sysdeps/unix/sysv/linux/bits/uio.h: Likewise.
+	* sysdeps/unix/sysv/linux/bits/utsname.h: Likewise.
+	* sysdeps/unix/sysv/linux/bits/waitflags.h: Likewise.
+	* sysdeps/unix/sysv/linux/i386/bits/mman.h: Likewise.
+	* sysdeps/unix/sysv/linux/m68k/bits/mman.h: Likewise.
+	* sysdeps/unix/sysv/linux/m68k/bits/poll.h: Likewise.
+	* sysdeps/unix/sysv/linux/mips/bits/endian.h: Likewise.
+	* sysdeps/unix/sysv/linux/mips/bits/ioctl-types.h: Likewise.
+	* sysdeps/unix/sysv/linux/mips/bits/ipc.h: Likewise.
+	* sysdeps/unix/sysv/linux/mips/bits/mman.h: Likewise.
+	* sysdeps/unix/sysv/linux/mips/bits/poll.h: Likewise.
+	* sysdeps/unix/sysv/linux/mips/bits/shm.h: Likewise.
+	* sysdeps/unix/sysv/linux/mips/bits/sigaction.h: Likewise.
+	* sysdeps/unix/sysv/linux/mips/bits/socket.h: Likewise.
+	* sysdeps/unix/sysv/linux/mips/bits/stat.h: Likewise.
+	* sysdeps/unix/sysv/linux/mips/bits/statfs.h: Likewise.
+	* sysdeps/unix/sysv/linux/mips/bits/termios.h: Likewise.
+	* sysdeps/unix/sysv/linux/mips/bits/time.h: Likewise.
+	* sysdeps/unix/sysv/linux/powerpc/bits/ioctl-types.h: Likewise.
+	* sysdeps/unix/sysv/linux/powerpc/bits/mman.h: Likewise.
+	* sysdeps/unix/sysv/linux/powerpc/bits/termios.h: Likewise.
+	* sysdeps/unix/sysv/linux/sparc/bits/ioctls.h: Likewise.
+	* sysdeps/unix/sysv/linux/sparc/bits/poll.h: Likewise.
+	* sysdeps/unix/sysv/linux/sparc/bits/sigaction.h: Likewise.
+	* sysdeps/unix/sysv/linux/sparc/bits/termios.h: Likewise.
+	* sysdeps/unix/sysv/linux/sparc/sparc32/bits/mman.h: Likewise.
+	* sysdeps/unix/sysv/linux/sparc/sparc64/bits/mman.h: Likewise.
+	* sysdeps/unix/sysv/linux/sparc/sparc64/bits/setjmp.h: Likewise.
+	* sysdeps/unix/sysv/minix/bits/sigaction.h: Likewise.
+	* sysdeps/unix/sysv/sco3.2.4/bits/confname.h: Likewise.
+	* sysdeps/unix/sysv/sco3.2.4/bits/sigaction.h: Likewise.
+	* sysdeps/unix/sysv/sysv4/bits/sigaction.h: Likewise.
+	* sysdeps/unix/sysv/sysv4/bits/utsname.h: Likewise.
+	* sysdeps/unix/sysv/sysv4/bits/waitflags.h: Likewise.
+	* sysdeps/unix/sysv/sysv4/i386/bits/stat.h: Likewise.
+	* sysdeps/unix/sysv/sysv4/solaris2/bits/stat.h: Likewise.
+	* sysdeps/unix/sysv/sysv4/solaris2/sparc/bits/sigcontext.h: Likewise.
+	* sysdeps/vax/bits/huge_val.h: Likewise.
+	* sysdeps/vax/bits/setjmp.h: Likewise.
+	* sysdeps/wordsize-32/bits/elfclass.h: Likewise.
+	* sysdeps/wordsize-64/bits/elfclass.h: Likewise.
+
+1997-11-25  Andreas Jaeger  <aj@arthur.rhein-neckar.de>
+
+	* libio/stdio.h: Correct comment of sys_nerr/sys_errlist
+
+1997-11-25  Paul Eggert  <eggert@shade.twinsun.com>
+
+	* strftime.c (strftime):
+	No longer any need to undef or declare if emacs is defined.
+	(my_strftime): When checking a -1 returned by mktime, don't blow up
+	if localtime_r returns NULL.
+
+1997-11-24  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>
+
+	* README.template: Fix spelling.
+
+1997-11-25  Andreas Jaeger  <aj@arthur.rhein-neckar.de>
+
+	* configure.in: Enhance --enable-add-ons description a wee bit.
+
+1997-11-24  Andreas Jaeger  <aj@arthur.rhein-neckar.de>
+
+	* glibcbug.in: Add more information of build environment and flags.
+
+1997-11-23  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>
+
+	* sysdeps/posix/getcwd.c: Recognize EOF from readdir and translate
+	it into ENOENT.
+
 1997-11-24 03:01  Ulrich Drepper  <drepper@cygnus.com>
 
 	* elf/dl-support.c: Call __libc_init_secure to make sure
diff --git a/FAQ b/FAQ
index 653bbbfa7f..c2e23ad9e3 100644
--- a/FAQ
+++ b/FAQ
@@ -109,6 +109,10 @@ please let me know.
 	  I get
 	    XXX: Symbol `_sys_errlist' has different size in shared object, consider re-linking
 	  Why?  What to do?''
+
+[Q31]	``What's the problem with configure --enable-omitfp?''
+
+[Q32]	``Why don't signals interrupt system calls anymore?''
 
 ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
 [Q1]	``What systems does the GNU C Library run on?''
@@ -351,9 +355,8 @@ incompatibilities:
 * 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.
+  the SysV behaviour simply use `sysv_signal', or define _XOPEN_SOURCE.
+  See question 32 for details.
 
 
 ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
@@ -533,13 +536,15 @@ In this file you have to change a few things:
 
 - remove all expression `%{...:-lgmon}';  there is no libgmon in glibc
 
+- fix a minor bug by changing %{pipe:-} to %|
+
 
 Things are getting a bit more complicated if you have GNU libc
 installed in some other place than /usr, i.e., if you do not want to
 use it instead of the old libc.  In this case the needed startup files
 and libraries are not found in the regular places.  So the specs file
-must tell the compiler and linker exactly what to use.  Here is for
-example the gcc-2.7.2 specs file when GNU libc is installed at
+must tell the compiler and linker exactly what to use.  Here is what
+the gcc-2.7.2 specs file should look like when GNU libc is installed at
 /usr:
 
 -----------------------------------------------------------------------
@@ -547,7 +552,7 @@ example the gcc-2.7.2 specs file when GNU libc is installed at
 %{V} %{v:%{!V:-V}} %{Qy:} %{!Qn:-Qy} %{n} %{T} %{Ym,*} %{Yd,*} %{Wa,*:%*}
 
 *asm_final:
-%{pipe:-}
+%|
 
 *cpp:
 %{fPIC:-D__PIC__ -D__pic__} %{fpic:-D__PIC__ -D__pic__} %{!m386:-D__i486__} %{posix:-D_POSIX_SOURCE} %{pthread:-D_REENTRANT}
@@ -805,6 +810,66 @@ happen.  So in case of doubt report such a warning message as a problem.
 
 
 ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
+[Q31]	``What's the problem with configure --enable-omitfp?''
+
+{AJ} When configuring with --enable-omitfp the libraries are build
+without frame pointers. Some compilers produce in this situation buggy
+code and therefore we don't advise using it at the moment.
+
+If you use --enable-omitfp, you're on your own. If you encounter
+problems with a library that was build this way, I'll advise you to
+rebuild the library without --enable-omitfp.  If the problem vanishes
+consider tracking the problem down and report it as compiler failure.
+
+Since a library build with --enable-omitfp is undebuggable, a
+debuggable library is also build - you can recognize it by the suffix
+"_g" to the library names.
+
+The compilation of this extra libraries and the compiler optimizations
+slow down the build process and need more disk space.
+
+
+~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
+[Q32]	``Why don't signals interrupt system calls anymore?''
+
+[A32] {ZW} By default GNU libc uses the BSD semantics for signal(),
+unlike Linux libc 5 which used System V semantics.  This is partially
+for compatibility with other systems and partially because the BSD
+semantics tend to make programming with signals easier.
+
+There are three differences:
+
+* BSD-style signals that occur in the middle of a system call do not
+  affect the system call; System V signals cause the system call to
+  fail and set errno to EINTR.
+
+* BSD signal handlers remain installed once triggered.  System V signal
+  handlers work only once, so one must reinstall them each time.
+
+* A BSD signal is blocked during the execution of its handler.  In other
+  words, a handler for SIGCHLD (for example) does not need to worry about
+  being interrupted by another SIGCHLD.  It may, however, be interrrupted
+  by other signals.
+
+There is general consensus that for `casual' programming with signals, the
+BSD semantics are preferable.  You don't need to worry about system calls
+returning EINTR, and you don't need to worry about the race conditions
+associated with one-shot signal handlers.
+
+If you are porting an old program that relies on the old semantics, you can
+quickly fix the problem by changing signal() to sysv_signal() throughout.
+Alternatively, define _XOPEN_SOURCE before including <signal.h>.
+
+For new programs, the sigaction() function allows you to specify precisely
+how you want your signals to behave.  All three differences listed above are
+individually switchable on a per-signal basis with this function.
+
+If all you want is for one specific signal to cause system calls to fail
+and return EINTR (for example, to implement a timeout) you can do this with
+siginterrupt().
+
+
+~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
 
 Answers were given by:
 {UD} Ulrich Drepper, <drepper@cygnus.com>
@@ -815,6 +880,7 @@ Answers were given by:
 {EY} Eric Youngdale, <eric@andante.jic.com>
 {PB} Phil Blundell, <Philip.Blundell@pobox.com>
 {MK} Mark Kettenis, <kettenis@phys.uva.nl>
+{ZW} Zack Weinberg, <zack@rabi.phys.columbia.edu>
 
 Local Variables:
  mode:text
diff --git a/Makefile b/Makefile
index b9beed9303..50e29d1d66 100644
--- a/Makefile
+++ b/Makefile
@@ -334,6 +334,9 @@ FORCE:
 rpm/%: subdir_distinfo
 	$(MAKE) $(PARALLELMFLAGS) -C $(@D) subdirs='$(subdirs)' $(@F)
 
+iconvdata/%:
+	$(MAKE) $(PARALLELMFLAGS) -C $(@D) $(@F)
+
 # This is a special goal for people making binary distributions.  Normally
 # everybody uses the DES based crypt library but for the distribution we
 # need the only-MD5 based one as well.
diff --git a/README.template b/README.template
index 56873846cd..600a3e6d54 100644
--- a/README.template
+++ b/README.template
@@ -80,7 +80,7 @@ in the GNU C library, explaining how you can tell the library what
 facilities you want it to make available.
 
 We prefer to get bug reports sent using the `glibcbug' shell script which
-is install together with the rest of the GNU libc to <bugs@gnu.org>.
+is installed together with the rest of the GNU libc to <bugs@gnu.org>.
 Simply run this shell script and fill in the information.  Nevertheless
 you can still send bug reports to <bug-glibc@prep.ai.mit.edu> as normal
 electronic mails.
diff --git a/bits/byteswap.h b/bits/byteswap.h
index 9404cc452e..04a5efe9f0 100644
--- a/bits/byteswap.h
+++ b/bits/byteswap.h
@@ -17,8 +17,9 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-#ifndef _BITS_BYTESWAP_H
-#define _BITS_BYTESWAP_H	1
+#if !defined _BYTESWAP_H && !defined _NETINET_IN_H
+# error "Never use <bits/byteswap.h> directly; include <byteswap.h> instead."
+#endif
 
 /* Swap bytes in 16 bit value.  */
 #define __bswap_16(x) \
@@ -39,5 +40,3 @@
 	__r.__l[1] = __bswap_32 (__v.__l[0]);				      \
 	__r.__ll; })
 #endif
-
-#endif /* bits/byteswap.h */
diff --git a/bits/confname.h b/bits/confname.h
index 40228e11ed..4653887468 100644
--- a/bits/confname.h
+++ b/bits/confname.h
@@ -17,6 +17,10 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
+#ifndef _UNISTD_H
+# error "Never use <bits/confname.h> directly; include <unistd.h> instead."
+#endif
+
 /* Values for the NAME argument to `pathconf' and `fpathconf'.  */
 enum
   {
diff --git a/bits/dirent.h b/bits/dirent.h
index 2f7dca78aa..366cdf8ce2 100644
--- a/bits/dirent.h
+++ b/bits/dirent.h
@@ -1,5 +1,5 @@
 /* Directory entry structure `struct dirent'.  Stub version.
-   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
@@ -17,6 +17,10 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
+#ifndef _DIRENT_H
+# error "Never use <bits/dirent.h> directly; include <dirent.h> instead."
+#endif
+
 struct dirent
   {
     char d_name[1];		/* Variable length.  */
diff --git a/bits/dlfcn.h b/bits/dlfcn.h
index 79604fe8ff..7c33694018 100644
--- a/bits/dlfcn.h
+++ b/bits/dlfcn.h
@@ -17,8 +17,9 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-#ifndef	_BITS_DLFCN_H
-#define	_BITS_DLFCN_H 1
+#ifndef _DLFCN_H
+# error "Never use <bits/dlfcn.h> directly; include <dlfcn.h> instead."
+#endif
 
 /* The MODE argument to `dlopen' contains one of the following: */
 #define RTLD_LAZY	0x001	/* Lazy function call binding.  */
@@ -29,5 +30,3 @@
    the symbols of the loaded object and its dependencies are made
    visible as if the object were linked directly into the program.  */
 #define RTLD_GLOBAL	0x100
-
-#endif	/* bits/dlfcn.h */
diff --git a/bits/endian.h b/bits/endian.h
index 597f079a0f..45afd4ae47 100644
--- a/bits/endian.h
+++ b/bits/endian.h
@@ -6,4 +6,8 @@
    So if cross-compiling to a machine with a different byte order,
    the bits/endian.h file for that machine must exist.  */
 
+#ifndef _ENDIAN_H
+# error "Never use <bits/endian.h> directly; include <endian.h> instead."
+#endif
+
 #error Machine byte order unknown.
diff --git a/bits/fenv.h b/bits/fenv.h
index f45deb07c1..c42540fa61 100644
--- a/bits/fenv.h
+++ b/bits/fenv.h
@@ -17,7 +17,7 @@
    Boston, MA 02111-1307, USA.  */
 
 #ifndef _FENV_H
-#error "Never use <bits/fenv.h> directly; include <fenv.h> instead."
+# error "Never use <bits/fenv.h> directly; include <fenv.h> instead."
 #endif
 
 
diff --git a/bits/huge_val.h b/bits/huge_val.h
index 8f137d1734..0c30c86f33 100644
--- a/bits/huge_val.h
+++ b/bits/huge_val.h
@@ -1,6 +1,6 @@
 /* Stub `HUGE_VAL' constant.
    Used by <stdlib.h> and <math.h> functions for overflow.
-   Copyright (C) 1992, 1996 Free Software Foundation, Inc.
+   Copyright (C) 1992, 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
@@ -19,7 +19,7 @@
    Boston, MA 02111-1307, USA.  */
 
 #ifndef _MATH_H
-#error "Never use <bits/huge_val.h> directly; include <math.h> instead."
+# error "Never use <bits/huge_val.h> directly; include <math.h> instead."
 #endif
 
 
diff --git a/bits/in.h b/bits/in.h
index 7241bd24c3..83d7ae6b10 100644
--- a/bits/in.h
+++ b/bits/in.h
@@ -18,8 +18,9 @@
 
 /* Generic version.  */
 
-#ifndef _NETINET_INBITS_H
-#define _NETINET_INBITS_H 1
+#ifndef _NETINET_IN_H
+# error "Never use <bits/in.h> directly; include <netinet/in.h> instead."
+#endif
 
 /* Link numbers.  */
 #define	IMPLINK_IP		155
@@ -55,10 +56,10 @@ struct ip_opts
 
 /* Structure used for IP_ADD_MEMBERSHIP and IP_DROP_MEMBERSHIP. */
 struct ip_mreq
-{
-  struct in_addr imr_multiaddr;	/* IP multicast address of group */
-  struct in_addr imr_interface;	/* local IP address of interface */
-};
+  {
+    struct in_addr imr_multiaddr;	/* IP multicast address of group */
+    struct in_addr imr_interface;	/* local IP address of interface */
+  };
 
 /* IPV6 socket options.  */
 #define IPV6_ADDRFORM		1
@@ -80,5 +81,3 @@ struct ip_mreq
 #define IPV6_MULTICAST_LOOP	19
 #define IPV6_ADD_MEMBERSHIP	20
 #define IPV6_DROP_MEMBERSHIP	21
-
-#endif	/* netinet/inbits.h */
diff --git a/bits/ioctl-types.h b/bits/ioctl-types.h
index 1d5c8a002f..26283a0f10 100644
--- a/bits/ioctl-types.h
+++ b/bits/ioctl-types.h
@@ -1,5 +1,5 @@
 /* Structure types for pre-termios terminal ioctls.  Generic Unix version.
-   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
@@ -17,15 +17,11 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-/*
- * Never include this file directly; use <sys/ioctl.h> instead.
- */
-
-#ifndef _BITS_IOCTL_TYPES_H
-#define _BITS_IOCTL_TYPES_H 1
-
+#ifndef _SYS_IOCTL_H
+# error "Never use <bits/ioctl-types.h> directly; include <sys/ioctl.h> instead."
+#endif
 
-#if	defined(TIOCGETC) || defined(TIOCSETC)
+#if defined TIOCGETC || defined TIOCSETC
 /* Type of ARG for TIOCGETC and TIOCSETC requests.  */
 struct tchars
 {
@@ -41,7 +37,7 @@ struct tchars
   _IOT (_IOTS (char), 6, 0, 0, 0, 0)
 #endif
 
-#if	defined(TIOCGLTC) || defined(TIOCSLTC)
+#if defined TIOCGLTC || defined TIOCSLTC
 /* Type of ARG for TIOCGLTC and TIOCSLTC requests.  */
 struct ltchars
 {
@@ -70,7 +66,7 @@ struct sgttyb
 #define	_IOT_sgttyb	/* Hurd ioctl type field.  */ \
   _IOT (_IOTS (char), 6, _IOTS (short int), 1, 0, 0)
 
-#if	defined(TIOCGWINSZ) || defined(TIOCSWINSZ)
+#if defined TIOCGWINSZ || defined TIOCSWINSZ
 /* Type of ARG for TIOCGWINSZ and TIOCSWINSZ requests.  */
 struct winsize
 {
@@ -86,13 +82,13 @@ struct winsize
   _IOT (_IOTS (unsigned short int), 4, 0, 0, 0, 0)
 #endif
 
-#if	defined (TIOCGSIZE) || defined (TIOCSSIZE)
+#if defined TIOCGSIZE || defined TIOCSSIZE
 /* The BSD-style ioctl constructor macros use `sizeof', which can't be used
    in a preprocessor conditional.  Since the commands are always unique
    regardless of the size bits, we can safely define away `sizeof' for the
    purpose of the conditional.  */
 #  define sizeof(type) 0
-#  if defined (TIOCGWINSZ) && TIOCGSIZE == TIOCGWINSZ
+#  if defined TIOCGWINSZ && TIOCGSIZE == TIOCGWINSZ
 /* Many systems that have TIOCGWINSZ define TIOCGSIZE for source
    compatibility with Sun; they define `struct ttysize' to have identical
    layout as `struct winsize' and #define TIOCGSIZE to be TIOCGWINSZ
@@ -116,6 +112,3 @@ struct ttysize
 #  endif
 #  undef sizeof			/* See above.  */
 #endif
-
-
-#endif /* bits/ioctl-types.h */
diff --git a/bits/ioctls.h b/bits/ioctls.h
index 3b6178bfae..d3ecad9515 100644
--- a/bits/ioctls.h
+++ b/bits/ioctls.h
@@ -1 +1,5 @@
+#ifndef _SYS_IOCTL_H
+# error "Never use <bits/ioctls.h> directly; include <sys/ioctl.h> instead."
+#endif
+
 /* This space intentionally left blank.  */
diff --git a/bits/ipc.h b/bits/ipc.h
index a5ecbd90b7..58f419be1d 100644
--- a/bits/ipc.h
+++ b/bits/ipc.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.
 
@@ -17,10 +17,9 @@
    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>
+#ifndef _SYS_IPC_H
+# error "Never use <bits/ipc.h> directly; include <sys/ipc.h> instead."
+#endif
 
 #include <sys/types.h>
 
@@ -34,23 +33,16 @@
 #define IPC_SET		1		/* set `ipc_perm' options */
 #define IPC_STAT	2		/* get `ipc_perm' options */
 
-
-__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
-{
-  __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 */
-};
-
-__END_DECLS
-
-#endif /* _SYS_IPC_BUF_H */
+  {
+    __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 */
+  };
diff --git a/bits/msq.h b/bits/msq.h
index 37daa9bf8c..a263869a0e 100644
--- a/bits/msq.h
+++ b/bits/msq.h
@@ -1,6 +1,5 @@
 /* Copyright (C) 1995, 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
@@ -21,14 +20,11 @@
 #error "Never use <bits/msq.h> directly; include <sys/msg.h> instead."
 #endif
 
-
-#include <features.h>
 #include <sys/types.h>
 
 /* Define options for message queue functions.  */
 #define MSG_NOERROR	010000	/* no error if message is too big */
 
-__BEGIN_DECLS
 
 /* Structure of record for one message inside the kernel.
    The type `struct __msg' is opaque.  */
@@ -43,5 +39,3 @@ struct msqid_ds
   __pid_t msg_lspid;		/* pid of last msgsnd() */
   __pid_t msg_lrpid;		/* pid of last msgrcv() */
 };
-
-__END_DECLS
diff --git a/bits/poll.h b/bits/poll.h
index 55ec70e363..68f611a428 100644
--- a/bits/poll.h
+++ b/bits/poll.h
@@ -16,6 +16,9 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
+#ifndef _SYS_POLL_H
+# error "Never use <bits/poll.h> directly; include <sys/poll.h> instead."
+#endif
 
 /* Event types that can be polled for.  These bits may be set in `events'
    to indicate the interesting event types; they will appear in `revents'
diff --git a/bits/resource.h b/bits/resource.h
index 46cf9a7af5..d0ebeb56c8 100644
--- a/bits/resource.h
+++ b/bits/resource.h
@@ -17,6 +17,10 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
+#ifndef _SYS_RESOURCE_H
+# error "Never use <bits/resource.h> directly; include <sys/resource.h> instead."
+#endif
+
 /* These are the values for 4.4 BSD and GNU.  Earlier BSD systems have a
    subset of these kinds of resource limit.  In systems where `getrlimit'
    and `setrlimit' are not system calls, these are the values used by the C
@@ -107,7 +111,8 @@ enum __rusage_who
 #define RUSAGE_CHILDREN RUSAGE_CHILDREN
   };
 
-#include <sys/time.h>           /* For `struct timeval'.  */
+#define __need_timeval
+#include <bits/time.h>           /* For `struct timeval'.  */
 
 /* Structure which says how much of each resource has been used.  */
 struct rusage
diff --git a/bits/sched.h b/bits/sched.h
index bb5da5676f..0c246c8f9a 100644
--- a/bits/sched.h
+++ b/bits/sched.h
@@ -1,6 +1,6 @@
 /* Definitions of constants and data structure for POSIX 1003.1b-1993
    scheduling interface.
-   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
@@ -19,7 +19,7 @@
    Suite 330, Boston, MA 02111-1307, USA.  */
 
 #ifndef _SCHED_H
-#error "Never use <bits/sched.h> directly; include <sched.h> instead."
+# error "Never include <bits/sched.h> directly; use <sched.h> instead."
 #endif
 
 
diff --git a/bits/sem.h b/bits/sem.h
index 1d3e41bd56..8b9f97c62a 100644
--- a/bits/sem.h
+++ b/bits/sem.h
@@ -1,6 +1,5 @@
 /* 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
@@ -18,11 +17,9 @@
    Boston, MA 02111-1307, USA.  */
 
 #ifndef _SYS_SEM_H
-#error "Never use <bits/sem.h> directly; include <sys/sem.h> instead."
+# error "Never include <bits/sem.h> directly; use <sys/sem.h> instead."
 #endif
 
-
-#include <features.h>
 #include <sys/types.h>
 
 /* Flags for `semop'.  */
@@ -38,8 +35,6 @@
 #define SETALL		17		/* set all semval's */
 
 
-__BEGIN_DECLS
-
 /* Data structure describing a set of semaphores.  */
 struct semid_ds
 {
@@ -57,5 +52,3 @@ union semun
   unsigned short int *array;		/* array for GETALL & SETALL */
   struct seminfo *__buf;		/* buffer for IPC_INFO */
  };
-
-__END_DECLS
diff --git a/bits/setjmp.h b/bits/setjmp.h
index 6620e5ab15..9150d8d764 100644
--- a/bits/setjmp.h
+++ b/bits/setjmp.h
@@ -1,3 +1,7 @@
 /* Define the machine-dependent type `jmp_buf'.  Stub version.  */
 
+#ifndef _SETJMP_H
+# error "Never include <bits/setjmp.h> directly; use <setjmp.h> instead."
+#endif
+
 typedef int __jmp_buf[1];
diff --git a/bits/shm.h b/bits/shm.h
index b41d0c1e86..8c97999626 100644
--- a/bits/shm.h
+++ b/bits/shm.h
@@ -1,6 +1,5 @@
 /* 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
@@ -18,11 +17,9 @@
    Boston, MA 02111-1307, USA.  */
 
 #ifndef _SYS_SHM_H
-#error "Never use <bits/shm.h> directly; include <sys/shm.h> instead."
+# error "Never include <bits/shm.h> directly; use <sys/shm.h> instead."
 #endif
 
-
-#include <features.h>
 #include <sys/types.h>
 
 /* Flags for `shmat'.  */
@@ -35,19 +32,15 @@
 #define SHM_UNLOCK	12		/* unlock segment (root only) */
 
 
-__BEGIN_DECLS
-
 /* Data structure describing a set of semaphores.  */
 struct shmid_ds
-{
-  struct ipc_perm sem_perm;		/* operation permission struct */
-  int shm_segsz;			/* size of segment in bytes */
-  __time_t sem_atime;			/* time of last shmat() */
-  __time_t sem_dtime;			/* time of last shmdt() */
-  __time_t sem_ctime;			/* time of last change by shmctl() */
-  __pid_t shm_cpid;			/* pid of creator */
-  __pid_t shm_lpid;			/* pid of last shmop */
-  unsigned short int shm_nattch;	/* number of current attaches */
-};
-
-__END_DECLS
+  {
+    struct ipc_perm sem_perm;		/* operation permission struct */
+    int shm_segsz;			/* size of segment in bytes */
+    __time_t sem_atime;			/* time of last shmat() */
+    __time_t sem_dtime;			/* time of last shmdt() */
+    __time_t sem_ctime;			/* time of last change by shmctl() */
+    __pid_t shm_cpid;			/* pid of creator */
+    __pid_t shm_lpid;			/* pid of last shmop */
+    unsigned short int shm_nattch;	/* number of current attaches */
+  };
diff --git a/bits/sigaction.h b/bits/sigaction.h
index e89479bd1c..4499517b1a 100644
--- a/bits/sigaction.h
+++ b/bits/sigaction.h
@@ -16,6 +16,10 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
+#ifndef _SIGNAL_H
+# error "Never include <bits/sigaction.h> directly; use <signal.h> instead."
+#endif
+
 /* These definitions match those used by the 4.4 BSD kernel.
    If the operating system has a `sigaction' system call that correctly
    implements the POSIX.1 behavior, there should be a system-dependent
diff --git a/bits/sigcontext.h b/bits/sigcontext.h
index 46e4df8c64..576fd30c37 100644
--- a/bits/sigcontext.h
+++ b/bits/sigcontext.h
@@ -17,6 +17,10 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
+#ifndef _SIGNAL_H
+# error "Never use <bits/sigcontext.h> directly; include <signal.h> instead."
+#endif
+
 /* State of this thread when the signal was taken.  */
 struct sigcontext
   {
diff --git a/bits/socket.h b/bits/socket.h
index af42dfac78..a2858b8de8 100644
--- a/bits/socket.h
+++ b/bits/socket.h
@@ -18,17 +18,12 @@
    Boston, MA 02111-1307, USA.  */
 
 #ifndef _SYS_SOCKET_H
-#error "Never include <bits/socket.h> directly; use <sys/socket.h> instead."
+# error "Never include <bits/socket.h> directly; use <sys/socket.h> instead."
 #endif
 
-
-#include <features.h>
-
 #define	__need_size_t
 #include <stddef.h>
 
-__BEGIN_DECLS
-
 /* Type for length arguments in socket calls.  */
 typedef unsigned int socklen_t;
 
@@ -201,5 +196,3 @@ struct linger
     int l_onoff;		/* Nonzero to linger on close.  */
     int l_linger;		/* Time to linger.  */
   };
-
-__END_DECLS
diff --git a/bits/stat.h b/bits/stat.h
index 3648fed738..a0edf2be52 100644
--- a/bits/stat.h
+++ b/bits/stat.h
@@ -16,16 +16,13 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-/*
- * Never include this file directly; use <sys/stat.h> instead.
- */
+#ifndef _SYS_STAT_H
+# error "Never include <bits/stat.h> directly; use <sys/stat.h> instead."
+#endif
 
 /* This structure needs to be defined in accordance with the
    implementation of __stat, __fstat, and __lstat.  */
 
-#ifndef	_BITS_STAT_H
-#define	_BITS_STAT_H	1
-
 #include <bits/types.h>
 
 /* Structure describing file characteristics.  */
@@ -73,20 +70,17 @@ struct stat
 #ifdef __USE_LARGEFILE64
 struct stat64
   {
-    __dev_t st_dev;			/* Device.  */
-
-    __ino64_t st_ino;			/* File serial number.	*/
-    __mode_t st_mode;			/* File mode.  */
-    __nlink_t st_nlink;			/* Link count.  */
-    __uid_t st_uid;			/* User ID of the file's owner.	*/
-    __gid_t st_gid;			/* Group ID of the file's group.*/
-    __off64_t st_size;			/* Size of file, in bytes.  */
-
-    __time_t st_atime;			/* Time of last access.  */
-    __time_t st_mtime;			/* Time of last modification.  */
-    __time_t st_ctime;			/* Time of last status change.  */
-  };
-#endif
+    __dev_t st_dev;		/* Device.  */
 
+    __ino64_t st_ino;		/* File serial number.	*/
+    __mode_t st_mode;		/* File mode.  */
+    __nlink_t st_nlink;		/* Link count.  */
+    __uid_t st_uid;		/* User ID of the file's owner.	*/
+    __gid_t st_gid;		/* Group ID of the file's group.*/
+    __off64_t st_size;		/* Size of file, in bytes.  */
 
-#endif /* bits/stat.h */
+    __time_t st_atime;		/* Time of last access.  */
+    __time_t st_mtime;		/* Time of last modification.  */
+    __time_t st_ctime;		/* Time of last status change.  */
+  };
+#endif
diff --git a/bits/statfs.h b/bits/statfs.h
index 9fa3388801..a92cf52315 100644
--- a/bits/statfs.h
+++ b/bits/statfs.h
@@ -17,12 +17,9 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-/*
- * Never include this file directly; use <sys/statfs.h> instead.
- */
-
-#ifndef	_BITS_STATFS_H
-#define	_BITS_STATFS_H	1
+#ifndef _SYS_STATFS_H
+# error "Never include <bits/statfs.h> directly; use <sys/statfs.h> instead."
+#endif
 
 #include <bits/types.h>
 
@@ -47,6 +44,3 @@ struct statfs
     unsigned int f_namelen;
     unsigned int f_spare[6];
   };
-
-
-#endif /* bits/statfs.h */
diff --git a/bits/termios.h b/bits/termios.h
index 9a6aed2bba..da059cbf06 100644
--- a/bits/termios.h
+++ b/bits/termios.h
@@ -1,5 +1,5 @@
 /* termios type and macro definitions.  4.4 BSD/generic GNU version.
-   Copyright (C) 1993, 1994, 1996 Free Software Foundation, Inc.
+   Copyright (C) 1993, 1994, 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
@@ -17,31 +17,35 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
+#ifndef _TERMIOS_H
+# error "Never include <bits/termios.h> directly; use <termios.h> instead."
+#endif
+
 /* These macros are also defined in some <bits/ioctls.h> files (with
    numerically identical values), but this serves to shut up cpp's
    complaining. */
 #ifdef __USE_BSD
 
-#ifdef MDMBUF
-#undef MDMBUF
-#endif
-#ifdef FLUSHO
-#undef FLUSHO
-#endif
-#ifdef PENDIN
-#undef PENDIN
-#endif
+# ifdef MDMBUF
+#  undef MDMBUF
+# endif
+# ifdef FLUSHO
+#  undef FLUSHO
+# endif
+# ifdef PENDIN
+#  undef PENDIN
+# endif
 
 #endif /* __USE_BSD */
 
 #ifdef ECHO
-#undef ECHO
+# undef ECHO
 #endif
 #ifdef TOSTOP
-#undef TOSTOP
+# undef TOSTOP
 #endif
 #ifdef NOFLSH
-#undef NOFLSH
+# undef NOFLSH
 #endif
 
 
@@ -85,15 +89,15 @@ struct termios
   tcflag_t c_oflag;
 #define	OPOST	(1 << 0)	/* Perform output processing.  */
 #ifdef	__USE_BSD
-#define	ONLCR	(1 << 1)	/* Map NL to CR-NL on output.  */
-#define	OXTABS	(1 << 2)	/* Expand tabs to spaces.  */
-#define	ONOEOT	(1 << 8)	/* Discard EOT (^D) on output.  */
+# define ONLCR	(1 << 1)	/* Map NL to CR-NL on output.  */
+# define OXTABS	(1 << 2)	/* Expand tabs to spaces.  */
+# define ONOEOT	(1 << 8)	/* Discard EOT (^D) on output.  */
 #endif
 
   /* Control modes.  */
   tcflag_t c_cflag;
 #ifdef	__USE_BSD
-#define	CIGNORE	(1 << 0)	/* Ignore these control flags.  */
+# define CIGNORE	(1 << 0)	/* Ignore these control flags.  */
 #endif
 #define	CSIZE	(CS5|CS6|CS7|CS8)	/* Number of bits per byte (mask).  */
 #define	CS5	0		/* 5 bits per byte.  */
@@ -107,15 +111,15 @@ struct termios
 #define	HUPCL	(1 << 14)	/* Hang up on last close.  */
 #define	CLOCAL	(1 << 15)	/* Ignore modem status lines.  */
 #ifdef	__USE_BSD
-#define	CCTS_OFLOW	(1 << 16)	/* CTS flow control of output.  */
-#define	CRTS_IFLOW	(1 << 17)	/* RTS flow control of input.  */
-#define	MDMBUF		(1 << 20)	/* Carrier flow control of output.  */
+# define CCTS_OFLOW	(1 << 16)	/* CTS flow control of output.  */
+# define CRTS_IFLOW	(1 << 17)	/* RTS flow control of input.  */
+# define MDMBUF		(1 << 20)	/* Carrier flow control of output.  */
 #endif
 
   /* Local modes.  */
   tcflag_t c_lflag;
 #ifdef	__USE_BSD
-#define	ECHOKE	(1 << 0)	/* Visual erase for KILL.  */
+# define ECHOKE	(1 << 0)	/* Visual erase for KILL.  */
 #endif
 #define	_ECHOE	(1 << 1)	/* Visual erase for ERASE.  */
 #define	ECHOE	_ECHOE
@@ -126,15 +130,15 @@ struct termios
 #define	_ECHONL	(1 << 4)	/* Echo NL even if ECHO is off.  */
 #define	ECHONL	_ECHONL
 #ifdef	__USE_BSD
-#define	ECHOPRT	(1 << 5)	/* Hardcopy visual erase.  */
-#define	ECHOCTL	(1 << 6)	/* Echo control characters as ^X.  */
+# define ECHOPRT	(1 << 5)	/* Hardcopy visual erase.  */
+# define ECHOCTL	(1 << 6)	/* Echo control characters as ^X.  */
 #endif
 #define	_ISIG	(1 << 7)	/* Enable signals.  */
 #define	ISIG	_ISIG
 #define	_ICANON	(1 << 8)	/* Do erase and kill processing.  */
 #define	ICANON	_ICANON
 #ifdef	__USE_BSD
-#define	ALTWERASE (1 << 9)	/* Alternate WERASE algorithm.  */
+# define ALTWERASE (1 << 9)	/* Alternate WERASE algorithm.  */
 #endif
 #define	_IEXTEN	(1 << 10)	/* Enable DISCARD and LNEXT.  */
 #define	IEXTEN	_IEXTEN
@@ -142,9 +146,9 @@ struct termios
 #define	_TOSTOP	(1 << 22)	/* Send SIGTTOU for background output.  */
 #define	TOSTOP	_TOSTOP
 #ifdef	__USE_BSD
-#define	FLUSHO	(1 << 23)	/* Output being flushed (state).  */
-#define	NOKERNINFO (1 << 25)	/* Disable VSTATUS.  */
-#define	PENDIN	(1 << 29)	/* Retype pending input (state).  */
+# define FLUSHO	(1 << 23)	/* Output being flushed (state).  */
+# define NOKERNINFO (1 << 25)	/* Disable VSTATUS.  */
+# define PENDIN	(1 << 29)	/* Retype pending input (state).  */
 #endif
 #define	_NOFLSH	(1 << 31)	/* Disable flush after interrupt.  */
 #define	NOFLSH	_NOFLSH
@@ -153,32 +157,32 @@ struct termios
 #define	VEOF	0		/* End-of-file character [ICANON].  */
 #define	VEOL	1		/* End-of-line character [ICANON].  */
 #ifdef	__USE_BSD
-#define	VEOL2	2		/* Second EOL character [ICANON].  */
+# define VEOL2	2		/* Second EOL character [ICANON].  */
 #endif
 #define	VERASE	3		/* Erase character [ICANON].  */
 #ifdef	__USE_BSD
-#define	VWERASE	4		/* Word-erase character [ICANON].  */
+# define VWERASE	4		/* Word-erase character [ICANON].  */
 #endif
 #define	VKILL	5		/* Kill-line character [ICANON].  */
 #ifdef	__USE_BSD
-#define	VREPRINT 6		/* Reprint-line character [ICANON].  */
+# define VREPRINT 6		/* Reprint-line character [ICANON].  */
 #endif
 #define	VINTR	8		/* Interrupt character [ISIG].  */
 #define	VQUIT	9		/* Quit character [ISIG].  */
 #define	VSUSP	10		/* Suspend character [ISIG].  */
 #ifdef	__USE_BSD
-#define	VDSUSP	11		/* Delayed suspend character [ISIG].  */
+# define VDSUSP	11		/* Delayed suspend character [ISIG].  */
 #endif
 #define	VSTART	12		/* Start (X-ON) character [IXON, IXOFF].  */
 #define	VSTOP	13		/* Stop (X-OFF) character [IXON, IXOFF].  */
 #ifdef	__USE_BSD
-#define	VLNEXT	14		/* Literal-next character [IEXTEN].  */
-#define	VDISCARD 15		/* Discard character [IEXTEN].  */
+# define VLNEXT	14		/* Literal-next character [IEXTEN].  */
+# define VDISCARD 15		/* Discard character [IEXTEN].  */
 #endif
 #define	VMIN	16		/* Minimum number of bytes read at once [!ICANON].  */
 #define	VTIME	17		/* Time-out value (tenths of a second) [!ICANON].  */
 #ifdef	__USE_BSD
-#define	VSTATUS	18		/* Status character [ICANON].  */
+# define VSTATUS	18		/* Status character [ICANON].  */
 #endif
 #define	NCCS	20		/* Value duplicated in <hurd/tioctl.defs>.  */
   cc_t c_cc[NCCS];
@@ -202,8 +206,8 @@ struct termios
 #define	B19200	19200		/* 19200 baud.  */
 #define	B38400	38400		/* 38400 baud.  */
 #ifdef	__USE_BSD
-#define	EXTA	19200
-#define	EXTB	38400
+# define EXTA	19200
+# define EXTB	38400
 #endif
 };
 
@@ -215,7 +219,7 @@ struct termios
 #define	TCSADRAIN	1	/* Change when pending output is written.  */
 #define	TCSAFLUSH	2	/* Flush pending input before changing.  */
 #ifdef	__USE_BSD
-#define	TCSASOFT	0x10	/* Flag: Don't alter hardware state.  */
+# define TCSASOFT	0x10	/* Flag: Don't alter hardware state.  */
 #endif
 
 /* Values for the QUEUE_SELECTOR argument to `tcflush'.  */
diff --git a/bits/time.h b/bits/time.h
index e41a991b44..cdbd39f91d 100644
--- a/bits/time.h
+++ b/bits/time.h
@@ -21,6 +21,16 @@
  * Never include this file directly; use <time.h> instead.
  */
 
+#ifndef __need_timeval
+# ifndef _BITS_TIME_H
+#  define _BITS_TIME_H	1
+
+#  define CLOCKS_PER_SEC 60
+
+# endif	/* bits/time.h */
+#endif
+
+
 #ifdef __need_timeval
 # undef __need_timeval
 # ifndef _STRUCT_TIMEVAL
@@ -34,11 +44,3 @@ struct timeval
   };
 # endif	/* struct timeval */
 #endif	/* need timeval */
-
-
-#ifndef _BITS_TIME_H
-#define	_BITS_TIME_H	1
-
-#define CLOCKS_PER_SEC 60
-
-#endif	/* bits/time.h */
diff --git a/bits/uio.h b/bits/uio.h
index 1a12697008..56533c1c58 100644
--- a/bits/uio.h
+++ b/bits/uio.h
@@ -17,7 +17,7 @@
    Boston, MA 02111-1307, USA.  */
 
 #ifndef _SYS_UIO_H
-#error "Never use <bits/uio.h> directly; include <sys/uio.h> instead."
+# error "Never include <bits/uio.h> directly; use <sys/uio.h> instead."
 #endif
 
 
diff --git a/bits/utmp.h b/bits/utmp.h
index ccc318bfa1..62817d36d1 100644
--- a/bits/utmp.h
+++ b/bits/utmp.h
@@ -17,12 +17,9 @@
    Boston, MA 02111-1307, USA.  */
 
 #ifndef _UTMP_H
-# error "Never use <bits/utmp.h> directly; include <utmp.h> instead."
+# error "Never include <bits/utmp.h> directly; use <utmp.h> instead."
 #endif
 
-
-#include <features.h>
-
 #include <paths.h>
 #include <time.h>
 
@@ -31,7 +28,6 @@
 #define	UT_LINESIZE	8
 #define	UT_HOSTSIZE	16
 
-__BEGIN_DECLS
 
 struct lastlog
   {
@@ -51,5 +47,3 @@ struct utmp
 
 
 #define _HAVE_UT_HOST 1		/* We have the ut_host field.  */
-
-__END_DECLS
diff --git a/bits/utsname.h b/bits/utsname.h
index 5594bcc4da..ea3f163cef 100644
--- a/bits/utsname.h
+++ b/bits/utsname.h
@@ -1,3 +1,25 @@
+/* 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.  */
+
+#ifndef _UTSNAME_H
+# error "Never include <bits/utsname.h> directly; use <sys/utsname.h> instead."
+#endif
+
 /* The size of the character arrays used to hold the information
    in a `struct utsname'.  Enlarge this as necessary.  */
 #define	_UTSNAME_LENGTH	1024
diff --git a/bits/waitflags.h b/bits/waitflags.h
index 127eb6ce4c..596df932b7 100644
--- a/bits/waitflags.h
+++ b/bits/waitflags.h
@@ -18,7 +18,7 @@
    Boston, MA 02111-1307, USA.  */
 
 #ifndef _SYS_WAIT_H
-#error "Never use <bits/waitflags.h> directly; include <sys/wait.h> instead."
+# error "Never include <bits/waitflags.h> directly; use <sys/wait.h> instead."
 #endif
 
 
diff --git a/bits/waitstatus.h b/bits/waitstatus.h
index 8e97f2702c..1ec55107f9 100644
--- a/bits/waitstatus.h
+++ b/bits/waitstatus.h
@@ -18,7 +18,7 @@
    Boston, MA 02111-1307, USA.  */
 
 #ifndef _SYS_WAIT_H
-#error "Never use <bits/waitstatus.h> directly; include <sys/wait.h> instead."
+# error "Never include <bits/waitstatus.h> directly; use <sys/wait.h> instead."
 #endif
 
 
@@ -39,11 +39,11 @@
 
 /* Nonzero if STATUS indicates termination by a signal.  */
 #ifdef	__GNUC__
-#define	__WIFSIGNALED(status)						      \
+# define __WIFSIGNALED(status) \
   (__extension__ ({ int __status = (status);				      \
 		    !__WIFSTOPPED(__status) && !__WIFEXITED(__status); }))
 #else	/* Not GCC.  */
-#define	__WIFSIGNALED(status)	(!__WIFSTOPPED(status) && !__WIFEXITED(status))
+# define __WIFSIGNALED(status)	(!__WIFSTOPPED(status) && !__WIFEXITED(status))
 #endif	/* GCC.  */
 
 /* Nonzero if STATUS indicates the child is stopped.  */
@@ -60,45 +60,45 @@
 
 #ifdef	__USE_BSD
 
-#include <endian.h>
+# include <endian.h>
 
 union wait
   {
     int w_status;
     struct
       {
-#if	__BYTE_ORDER == __LITTLE_ENDIAN
+# if	__BYTE_ORDER == __LITTLE_ENDIAN
 	unsigned int __w_termsig:7; /* Terminating signal.  */
 	unsigned int __w_coredump:1; /* Set if dumped core.  */
 	unsigned int __w_retcode:8; /* Return code if exited normally.  */
 	unsigned int:16;
-#endif				/* Little endian.  */
-#if	__BYTE_ORDER == __BIG_ENDIAN
+# endif				/* Little endian.  */
+# if	__BYTE_ORDER == __BIG_ENDIAN
 	unsigned int:16;
 	unsigned int __w_retcode:8;
 	unsigned int __w_coredump:1;
 	unsigned int __w_termsig:7;
-#endif				/* Big endian.  */
+# endif				/* Big endian.  */
       } __wait_terminated;
     struct
       {
-#if	__BYTE_ORDER == __LITTLE_ENDIAN
+# if	__BYTE_ORDER == __LITTLE_ENDIAN
 	unsigned int __w_stopval:8; /* W_STOPPED if stopped.  */
 	unsigned int __w_stopsig:8; /* Stopping signal.  */
 	unsigned int:16;
-#endif				/* Little endian.  */
-#if	__BYTE_ORDER == __BIG_ENDIAN
+# endif				/* Little endian.  */
+# if	__BYTE_ORDER == __BIG_ENDIAN
 	unsigned int:16;
 	unsigned int __w_stopsig:8; /* Stopping signal.  */
 	unsigned int __w_stopval:8; /* W_STOPPED if stopped.  */
-#endif				/* Big endian.  */
+# endif				/* Big endian.  */
       } __wait_stopped;
   };
 
-#define	w_termsig	__wait_terminated.__w_termsig
-#define	w_coredump	__wait_terminated.__w_coredump
-#define	w_retcode	__wait_terminated.__w_retcode
-#define	w_stopsig	__wait_stopped.__w_stopsig
-#define	w_stopval	__wait_stopped.__w_stopval
+# define w_termsig	__wait_terminated.__w_termsig
+# define w_coredump	__wait_terminated.__w_coredump
+# define w_retcode	__wait_terminated.__w_retcode
+# define w_stopsig	__wait_stopped.__w_stopsig
+# define w_stopval	__wait_stopped.__w_stopval
 
 #endif	/* Use BSD.  */
diff --git a/configure b/configure
index 0fffa4b7fb..194bee3755 100755
--- a/configure
+++ b/configure
@@ -49,7 +49,7 @@ ac_help="$ac_help
   --disable-versioning    do not include versioning information in the
                           library objects [default=yes if supported]"
 ac_help="$ac_help
-  --enable-add-ons=DIR... configure and build named extra directories"
+  --enable-add-ons=DIR1,DIR2... configure and build named extra directories"
 ac_help="$ac_help
   --enable-static-nss     build static NSS modules [default=no]"
 
@@ -1989,7 +1989,7 @@ fi
 
 if test $VERSIONING = no; then
   echo "\
-*** WARNING: You should not compile GNU libc without versioning. Not using 
+*** WARNING: You should not compile GNU libc without versioning. Not using
 *** versioning will introduce incompatibilities so that old binaries
 *** will not run anymore.
 *** For versioning you need recent binutils (binutils-2.8.1.0.17 or newer)."
diff --git a/configure.in b/configure.in
index ead9e630da..b0db91f911 100644
--- a/configure.in
+++ b/configure.in
@@ -1,4 +1,4 @@
-Dnl Process this file with autoconf to produce a configure script.
+dnl Process this file with autoconf to produce a configure script.
 AC_REVISION([$CVSid$])
 AC_PREREQ(2.11)dnl		dnl Minimum Autoconf version required.
 AC_INIT(include/features.h)
@@ -81,7 +81,7 @@ AC_ARG_ENABLE(versioning, dnl
 
 dnl Generic infrastructure for drop-in additions to libc.
 AC_ARG_ENABLE(add-ons, dnl
-[  --enable-add-ons=DIR... configure and build named extra directories],
+[  --enable-add-ons=DIR1,DIR2... configure and build named extra directories],
    	      [add_ons=`echo "$enableval" | sed 's/,/ /g'`],
 	      [add_ons=])
 AC_CONFIG_SUBDIRS($add_ons)
@@ -633,7 +633,7 @@ AC_SUBST(VERSIONING)
 
 if test $VERSIONING = no; then
   echo "\
-*** WARNING: You should not compile GNU libc without versioning. Not using 
+*** WARNING: You should not compile GNU libc without versioning. Not using
 *** versioning will introduce incompatibilities so that old binaries
 *** will not run anymore.
 *** For versioning you need recent binutils (binutils-2.8.1.0.17 or newer)."
diff --git a/elf/dl-profile.c b/elf/dl-profile.c
index 1a4f6b3105..f67b5d08b5 100644
--- a/elf/dl-profile.c
+++ b/elf/dl-profile.c
@@ -402,7 +402,16 @@ _dl_start_profile (struct link_map *map, const char *output_dir)
 
   /* Setup counting data.  */
   if (kcountsize < highpc - lowpc)
-    s_scale = ((double) kcountsize / (highpc - lowpc)) * SCALE_1_TO_1;
+    {
+      /* XXX I've not yet verified that the second expression is really
+	 well suited but something like this is in any case necessary
+	 for targets without hardware FP support.  --drepper  */
+#if 0
+      s_scale = ((double) kcountsize / (highpc - lowpc)) * SCALE_1_TO_1;
+#else
+      s_scale = (kcountsize * SCALE_1_TO_1) / (highpc - lowpc);
+#endif
+    }
   else
     s_scale = SCALE_1_TO_1;
 
diff --git a/glibcbug.in b/glibcbug.in
index 69496b6e1a..beb9d07c23 100644
--- a/glibcbug.in
+++ b/glibcbug.in
@@ -9,6 +9,17 @@ VERSION="@VERSION@"
 BUGGLIBC="bugs@gnu.org"
 ADDONS="@subdirs@"
 HOST="@host@"
+CC='@CC@'
+CFLAGS="@CFLAGS@"
+VERSIONING="@VERSIONING@"
+BUILD_STATIC="@static@"
+BUILD_SHARED="@shared@"
+BUILD_PIC_DEFAULT="@pic_default@"
+BUILD_PROFILE="@profile@"
+BUILD_OMITFP="@omitfp@"
+BUILD_BOUNDED="@bounded@"
+BUILD_STATIC_NSS="@static_nss@"
+STDIO="@stdio@"
 
 PATH=/bin:/usr/bin:/usr/local/bin:$PATH
 export PATH
@@ -125,6 +136,17 @@ ${ORGANIZATION- $ORGANIZATION_C}
 `[ -n "$ARCH" ] && echo Architecture: $ARCH`
 `[ -n "$MACHINE" ] && echo Machine: $MACHINE`
 `[ -n "$ADDONS" ] && echo Addons: $ADDONS`
+`[ -n "$CFLAGS" ] && echo Build CFLAGS: $CFLAGS`
+`[ -n "$CC" ] && echo Build CC: $CC`
+`[ -n "$VERSIONING" ] && echo Versioning: $VERSIONING`
+`[ -n "$BUILD_STATIC" ] && echo Build static: $BUILD_STATIC`
+`[ -n "$BUILD_SHARED" ] && echo Build shared: $BUILD_SHARED`
+`[ -n "$BUILD_PIC_DEFAULT" ] && echo Build pic-default: $BUILD_PIC_DEFAULT`
+`[ -n "$BUILD_PROFILE" ] && echo Build profile: $BUILD_PROFILE`
+`[ -n "$BUILD_OMITFP" ] && echo Build omitfp: $BUILD_OMITFP`
+`[ -n "$BUILD_BOUNDED" ] && echo Build bounded: $BUILD_BOUNDED`
+`[ -n "$BUILD_STATIC_NSS" ] && echo Build static-nss: $BUILD_STATIC_NSS`
+`[ -n "$STDIO" ] && echo Stdio: $STDIO`
 
 >Description:
 	$DESCRIPTION_C
diff --git a/iconv/gconv_close.c b/iconv/gconv_close.c
index 791c0259a3..912fa26d13 100644
--- a/iconv/gconv_close.c
+++ b/iconv/gconv_close.c
@@ -40,11 +40,11 @@ __gconv_close (gconv_t cd)
       if (srunp->end_fct != NULL)
 	(*srunp->end_fct) (drunp);
       else
-	{
-	  free (drunp->outbuf);
-	  if (drunp->data != NULL)
-	    free (drunp->data);
-	}
+	if (drunp->data != NULL)
+	  free (drunp->data);
+
+      if (!drunp->is_last && drunp->outbuf != NULL)
+	free (drunp->outbuf);
 
       /* Next step.  */
       ++srunp;
diff --git a/iconv/gconv_simple.c b/iconv/gconv_simple.c
index f769795273..51e4673b2d 100644
--- a/iconv/gconv_simple.c
+++ b/iconv/gconv_simple.c
@@ -18,6 +18,7 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
+#include <errno.h>
 #include <gconv.h>
 #include <stdlib.h>
 #include <string.h>
@@ -112,16 +113,20 @@ __gconv_transform_ucs4_utf8 (struct gconv_step *step,
     }
   else
     {
+      int save_errno = errno;
       do_write = 0;
 
       do
 	{
 	  const char *newinbuf = inbuf;
-	  size_t actually = __wmemrtombs (&data->outbuf[data->outbufavail],
-					  (const wchar_t **) &newinbuf,
-					  *inlen / sizeof (wchar_t),
-					  data->outbufsize - data->outbufavail,
-					  (mbstate_t *) data->data);
+	  size_t actually;
+
+	  errno = 0;
+	  actually = __wmemrtombs (&data->outbuf[data->outbufavail],
+				   (const wchar_t **) &newinbuf,
+				   *inlen / sizeof (wchar_t),
+				   data->outbufsize - data->outbufavail,
+				   (mbstate_t *) data->data);
 
 	  /* Remember how much we converted.  */
 	  do_write += newinbuf - inbuf;
@@ -129,6 +134,13 @@ __gconv_transform_ucs4_utf8 (struct gconv_step *step,
 
 	  data->outbufavail += actually;
 
+	  /* Check whether an illegal character appeared.  */
+	  if (errno != 0)
+	    {
+	      result = GCONV_ILLEGAL_INPUT;
+	      break;
+	    }
+
 	  if (data->is_last)
 	    {
 	      /* This is the last step.  */
@@ -159,6 +171,8 @@ __gconv_transform_ucs4_utf8 (struct gconv_step *step,
 	    }
 	}
       while (*inlen > 0 && result == GCONV_EMPTY_INPUT);
+
+      __set_errno (save_errno);
     }
 
   if (written != NULL && data->is_last)
@@ -201,17 +215,20 @@ __gconv_transform_utf8_ucs4 (struct gconv_step *step,
     }
   else
     {
+      int save_errno = errno;
       do_write = 0;
 
       do
 	{
 	  const char *newinbuf = inbuf;
-	  size_t actually = __wmemrtowcs ((wchar_t *) &data->outbuf[data->outbufavail],
-					  &newinbuf, *inlen,
-					  ((data->outbufsize
-					    - data->outbufavail)
-					   / sizeof (wchar_t)),
-					  (mbstate_t *) data->data);
+	  size_t actually;
+
+	  errno = 0;
+	  actually = __wmemrtowcs ((wchar_t *) &data->outbuf[data->outbufavail],
+				   &newinbuf, *inlen,
+				   ((data->outbufsize
+				     - data->outbufavail) / sizeof (wchar_t)),
+				   (mbstate_t *) data->data);
 
 	  /* Remember how much we converted.  */
 	  do_write += actually;
@@ -219,6 +236,20 @@ __gconv_transform_utf8_ucs4 (struct gconv_step *step,
 
 	  data->outbufavail += actually * sizeof (wchar_t);
 
+	  /* Check whether an illegal character appeared.  */
+	  if (errno != 0)
+	    {
+	      result = GCONV_ILLEGAL_INPUT;
+	      break;
+	    }
+
+	  if (*inlen == 0 && !mbsinit ((mbstate_t *) data->data))
+	    {
+	      /* We have an incomplete character at the end.  */
+	      result = GCONV_INCOMPLETE_INPUT;
+	      break;
+	    }
+
 	  if (data->is_last)
 	    {
 	      /* This is the last step.  */
@@ -249,6 +280,8 @@ __gconv_transform_utf8_ucs4 (struct gconv_step *step,
 	    }
 	}
       while (*inlen > 0 && result == GCONV_EMPTY_INPUT);
+
+      __set_errno (save_errno);
     }
 
   if (written != NULL && data->is_last)
diff --git a/iconvdata/Makefile b/iconvdata/Makefile
new file mode 100644
index 0000000000..a79e12a291
--- /dev/null
+++ b/iconvdata/Makefile
@@ -0,0 +1,119 @@
+# 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.
+
+#
+#	Makefile for iconv data and code.
+#
+subdir	:= iconvdata
+
+# Names of all the shared objects which implement the transformations.
+modules	:= ISO8859-1 ISO8859-2 ISO8859-3 ISO8859-4 ISO8859-5	\
+	   ISO8859-6 ISO8859-7 ISO8859-8 ISO8859-9 ISO8859-10	\
+	   T.61 ISO_6937
+modules.so := $(addsuffix .so, $(modules))
+
+
+ISO8859-1-routines := iso8859-1
+ISO8859-2-routines := iso8859-2
+ISO8859-3-routines := iso8859-3
+ISO8859-4-routines := iso8859-4
+ISO8859-5-routines := iso8859-5
+ISO8859-6-routines := iso8859-6
+ISO8859-7-routines := iso8859-7
+ISO8859-8-routines := iso8859-8
+ISO8859-9-routines := iso8859-9
+ISO8859-10-routines := iso8859-10
+T.61-routines := t61
+ISO_6937-routines := iso6937
+
+distribute := iso8859-generic.c \
+	      iso8859-1.c iso8859-2.c iso8859-3.c iso8859-4.c iso8859-5.c \
+	      iso8859-6.c iso8859-7.c iso8859-8.c iso8859-9.c iso8859-10.c\
+	      iso8859-2.h iso8859-3.h iso8859-4.h iso8859-5.h iso8859-6.h \
+	      iso8859-7.h iso8859-8.h iso8859-9.h iso8859-10.h t61.c	  \
+	      iso6937.c
+
+include ../Makeconfig
+
+# We build the transformation modules only when we build shared libs.
+ifeq (yes,$(build-shared))
+
+# This macro is similar to build-shlib but it does not define a soname
+# and it does not depend on the destination name to start with `lib'.
+define build-module
+$(LINK.o) -shared -o $@ $(sysdep-LDFLAGS) $(config-LDFLAGS)  \
+	  -B$(csu-objpfx) $(load-map-file:%=-Wl,--version-script=%) \
+	  $(LDFLAGS.so) $(LDFLAGS-$(@F:%.so=%).so) \
+	  -L$(subst :, -L,$(rpath-link)) -Wl,-rpath-link=$(rpath-link) \
+	  -Wl,--whole-archive \
+	  $(filter-out $($(@F:.so=)-map) $(+preinit) $(+postinit),$^) \
+	  $(no-whole-archive) $(LDLIBS-$(@F:%.so=%).so)
+endef
+
+# Rule to generate the shared objects.
+extra-modules-left := $(modules)
+include extra-module.mk
+
+
+extra-objs	+= $(modules.so)
+install-others	= $(addprefix $(inst_gconvdir)/, $(modules.so))	\
+		  $(inst_gconvdir)/gconv-modules
+
+# If we have the localedata add-on available we can build the conversion
+# tables for numerous charsets.
+ifneq (,$(findstring localedata,$(add-ons)))
+define generate-8bit-table
+( echo "static const wchar_t to_ucs4[256] = {"; \
+  sed -e 's/^[^[:space:]]*[[:space:]]*.x\(..\)[[:space:]]*<U\(....\)>.*/  [0x\1] = 0x\2,/p' -e d $^ | sort -u; \
+  echo "};"; \
+  echo "static const char from_ucs4[] = {"; \
+  sed -e 's/^[^[:space:]]*[[:space:]]*.x\(..\)[[:space:]]*<U\(....\)>.*/  [0x\2] = 0x\1,/p' -e d $^ | sort -u; \
+  echo "};" ) > $@.new && rm -f $@ && mv $@.new $@
+endef
+
+iso8859-2.h: ../localedata/charmaps/ISO-8859-2
+	$(generate-8bit-table)
+iso8859-3.h: ../localedata/charmaps/ISO-8859-3
+	$(generate-8bit-table)
+iso8859-4.h: ../localedata/charmaps/ISO-8859-4
+	$(generate-8bit-table)
+iso8859-5.h: ../localedata/charmaps/ISO-8859-5
+	$(generate-8bit-table)
+iso8859-6.h: ../localedata/charmaps/ISO-8859-6
+	$(generate-8bit-table)
+iso8859-7.h: ../localedata/charmaps/ISO-8859-7
+	$(generate-8bit-table)
+iso8859-8.h: ../localedata/charmaps/ISO-8859-8
+	$(generate-8bit-table)
+iso8859-9.h: ../localedata/charmaps/ISO-8859-9
+	$(generate-8bit-table)
+iso8859-10.h: ../localedata/charmaps/ISO-8859-10
+	$(generate-8bit-table)
+
+headers: iso8859-2.h iso8859-3.h iso8859-4.h iso8859-5.h iso8859-6.h	\
+	 iso8859-7.h iso8859-8.h iso8859-9.h iso8859-10.h
+endif
+
+
+$(addprefix $(inst_gconvdir)/, $(modules.so)): $(inst_gconvdir)/%: $(objpfx)%
+	$(do-install-program)
+$(inst_gconvdir)/gconv_modules: gconv-modules
+	$(do-install)
+endif
+
+include ../Rules
diff --git a/iconvdata/configure b/iconvdata/configure
new file mode 100755
index 0000000000..3eafc93f5b
--- /dev/null
+++ b/iconvdata/configure
@@ -0,0 +1,5 @@
+# This is only to keep the GNU C library configure mechanism happy.
+#
+# Perhaps some day we need a real configuration script for different
+# kernel versions or so.
+exit 0
diff --git a/iconvdata/extra-module.mk b/iconvdata/extra-module.mk
new file mode 100644
index 0000000000..88c68041a8
--- /dev/null
+++ b/iconvdata/extra-module.mk
@@ -0,0 +1,16 @@
+mod := $(firstword $(extra-modules-left))
+extra-modules-left := $(strip $(filter-out $(mod),$(extra-modules-left)))
+
+extra-objs += $(patsubst %,%.os,$($(mod)-routines))
+
+$(objpfx)$(mod).so: $(addprefix $(objpfx),$(addsuffix .os,$($(mod)-routines)))
+	$(build-module)
+
+# Depend on libc.so so a DT_NEEDED is generated in the shared objects.
+# This ensures they will load libc.so for needed symbols if loaded by
+# a statically-linked program that hasn't already loaded it.
+$(objpfx)$(mod).so: $(common-objpfx)libc.so
+
+ifneq (,$(extra-modules-left))
+include extra-module.mk
+endif
diff --git a/iconvdata/gconv-modules b/iconvdata/gconv-modules
new file mode 100644
index 0000000000..270ac14f11
--- /dev/null
+++ b/iconvdata/gconv-modules
@@ -0,0 +1,145 @@
+# GNU libc iconv configuration.
+# Copyright (C) 1997 Free Software Foundation, Inc.
+# This file is part of the GNU C Library.
+# Contributed by Ulrich Drepper <drepper@cygnus.com>, 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
+# 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.  */
+
+# All lines contain the following information:
+
+# If the lines start with `module'
+#  fromset:	either a name triple or a regular expression triple.
+#  toset:	a name triple or an expression with \N to get regular
+#		expression matching results.
+#  filename:	filename of the module implementing the transformation.
+#		If it is not absolute the path is made absolute by prepending
+#		the directory the configuration file is found in.
+#  cost:	optional cost of the transformation.  Default is 1.
+
+# If the lines start with `alias'
+#  alias:	alias name which is not really recognized.
+#  name:	the real name of the character set
+
+#	from			  to			  module	cost
+alias	ISO-10646//		ISO-10646/UCS4/
+alias	10646-1:1993//		ISO-10646/UCS4/
+alias	10646-1:1993/UCS4/	ISO-10646/UCS4/
+
+#	from			  to			  module	cost
+alias	ISO-IR-100//		ISO-8859-1//
+alias	ISO_8859-1:1987//	ISO-8859-1//
+alias	ISO_8859-1//		ISO-8859-1//
+alias	LATIN1//		ISO-8859-1//
+alias	L1//			ISO-8859-1//
+alias	IBM819//		ISO-8859-1//
+alias	CP819//			ISO-8859-1//
+module	ISO-8859-1//		ISO-10646/UCS4/		ISO8859-1	1
+module	ISO-10646/UCS4/		ISO-8859-1//		ISO8859-1	1
+
+#	from			  to			  module	cost
+alias	ISO-IR-101//		ISO-8859-2//
+alias	ISO_8859-2:1987//	ISO-8859-2//
+alias	ISO_8859-2//		ISO-8859-2//
+alias	LATIN2//		ISO-8859-2//
+alias	L2//			ISO-8859-2//
+module	ISO-8859-2//		ISO-10646/UCS4/		ISO8859-2	1
+module	ISO-10646/UCS4/		ISO-8859-2//		ISO8859-2	1
+
+#	from			  to			  module	cost
+alias	ISO-IR-109//		ISO-8859-3//
+alias	ISO_8859-3:1988//	ISO-8859-3//
+alias	ISO_8859-3//		ISO-8859-3//
+alias	LATIN3//		ISO-8859-3//
+alias	L3//			ISO-8859-3//
+module	ISO-8859-3//		ISO-10646/UCS4/		ISO8859-3	1
+module	ISO-10646/UCS4/		ISO-8859-3//		ISO8859-3	1
+
+#	from			  to			  module	cost
+alias	ISO-IR-110//		ISO-8859-4//
+alias	ISO_8859-4:1988//	ISO-8859-4//
+alias	ISO_8859-4//		ISO-8859-4//
+alias	LATIN4//		ISO-8859-4//
+alias	L4//			ISO-8859-4//
+module	ISO-8859-4//		ISO-10646/UCS4/		ISO8859-4	1
+module	ISO-10646/UCS4/		ISO-8859-4//		ISO8859-4	1
+
+#	from			  to			  module	cost
+alias	ISO-IR-144//		ISO-8859-5//
+alias	ISO_8859-5:1988//	ISO-8859-5//
+alias	ISO_8859-5//		ISO-8859-5//
+alias	CYRILLIC//		ISO-8859-5//
+module	ISO-8859-5//		ISO-10646/UCS4/		ISO8859-5	1
+module	ISO-10646/UCS4/		ISO-8859-5//		ISO8859-5	1
+
+#	from			  to			  module	cost
+alias	ISO-IR-127//		ISO-8859-6//
+alias	ISO_8859-6:1987//	ISO-8859-6//
+alias	ISO_8859-6//		ISO-8859-6//
+alias	ECMA-114//		ISO-8859-6//
+alias	ASMO-708//		ISO-8859-6//
+alias	ARABIC//		ISO-8859-6//
+module	ISO-8859-6//		ISO-10646/UCS4/		ISO8859-6	1
+module	ISO-10646/UCS4/		ISO-8859-6//		ISO8859-6	1
+
+#	from			  to			  module	cost
+alias	ISO-IR-126//		ISO-8859-7//
+alias	ISO_8859-7:1987//	ISO-8859-7//
+alias	ISO_8859-7//		ISO-8859-7//
+alias	ELOT_928//		ISO-8859-7//
+alias	ECMA-118//		ISO-8859-7//
+alias	GREEK//			ISO-8859-7//
+alias	GREEK8//		ISO-8859-7//
+module	ISO-8859-7//		ISO-10646/UCS4/		ISO8859-7	1
+module	ISO-10646/UCS4/		ISO-8859-7//		ISO8859-7	1
+
+#	from			  to			  module	cost
+alias	ISO-IR-138//		ISO-8859-8//
+alias	ISO_8859-8:1988//	ISO-8859-8//
+alias	ISO_8859-8//		ISO-8859-8//
+alias	HEBREW//		ISO-8859-8//
+module	ISO-8859-8//		ISO-10646/UCS4/		ISO8859-8	1
+module	ISO-10646/UCS4/		ISO-8859-8//		ISO8859-8	1
+
+#	from			  to			  module	cost
+alias	ISO-IR-148//		ISO-8859-9//
+alias	ISO_8859-9:1989//	ISO-8859-9//
+alias	ISO_8859-9//		ISO-8859-9//
+alias	LATIN5//		ISO-8859-9//
+alias	L5//			ISO-8859-9//
+module	ISO-8859-9//		ISO-10646/UCS4/		ISO8859-9	1
+module	ISO-10646/UCS4/		ISO-8859-9//		ISO8859-9	1
+
+#	from			  to			  module	cost
+alias	ISO-IR-157//		ISO-8859-10//
+alias	ISO_8859-10:1993//	ISO-8859-10//
+alias	ISO_8859-10//		ISO-8859-10//
+alias	LATIN6//		ISO-8859-10//
+alias	L6//			ISO-8859-10//
+module	ISO-8859-10//		ISO-10646/UCS4/		ISO8859-10	1
+module	ISO-10646/UCS4/		ISO-8859-10//		ISO8859-10	1
+
+#	from			  to			  module	cost
+alias	T.61//			T.61-8BIT//
+alias	ISO-IR-103//		T.61-8BIT//
+module	T.61-8BIT//		ISO-10646/UCS4/		T.61		1
+module	ISO-10646/UCS4/		T.61-8BIT//		T.61		1
+
+#	from			  to			  module	cost
+alias	ISO-IR-156//		ISO_6937//
+alias	ISO_6937:1992//		ISO_6937//
+alias	ISO6937//		ISO_6937//
+module	ISO_6937//		ISO-10646/UCS4/		ISO_6937	1
+module	ISO-10646/UCS4/		ISO_6937//		ISO_6937	1
diff --git a/iconvdata/iso6937.c b/iconvdata/iso6937.c
new file mode 100644
index 0000000000..dc6da3b347
--- /dev/null
+++ b/iconvdata/iso6937.c
@@ -0,0 +1,681 @@
+/* Generic conversion to and from ISO 6937.
+   Copyright (C) 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@cygnus.com>, 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
+   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 <gconv.h>
+#include <stdlib.h>
+#include <string.h>
+
+/* Data taken from the WG15 tables.  */
+static const wchar_t to_ucs4[256] =
+{
+  /* 0x00 */ 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007,
+  /* 0x08 */ 0x0008, 0x0009, 0x000a, 0x000b, 0x000c, 0x000d, 0x000e, 0x000f,
+  /* 0x10 */ 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017,
+  /* 0x18 */ 0x0018, 0x0019, 0x001a, 0x001b, 0x001c, 0x001d, 0x001e, 0x001f,
+  /* 0x20 */ 0x0020, 0x0021, 0x0022, 0x0023, 0x0034, 0x0025, 0x0026, 0x0027,
+  /* 0x28 */ 0x0028, 0x0029, 0x002a, 0x002b, 0x002c, 0x002d, 0x002e, 0x002f,
+  /* 0x30 */ 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037,
+  /* 0x38 */ 0x0038, 0x0039, 0x003a, 0x003b, 0x003c, 0x003d, 0x003e, 0x003f,
+  /* 0x40 */ 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047,
+  /* 0x48 */ 0x0048, 0x0049, 0x004a, 0x004b, 0x004c, 0x004d, 0x004e, 0x004f,
+  /* 0x50 */ 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057,
+  /* 0x58 */ 0x0058, 0x0059, 0x005a, 0x005b, 0x005c, 0x005d, 0x005e, 0x005f,
+  /* 0x60 */ 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067,
+  /* 0x68 */ 0x0068, 0x0069, 0x006a, 0x006b, 0x006c, 0x006d, 0x006e, 0x006f,
+  /* 0x70 */ 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077,
+  /* 0x78 */ 0x0078, 0x0079, 0x007a, 0x007b, 0x007c, 0x007d, 0x007e, 0x007f,
+  /* 0x80 */ 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087,
+  /* 0x88 */ 0x0088, 0x0089, 0x008a, 0x008b, 0x008c, 0x008d, 0x008e, 0x008f,
+  /* 0x90 */ 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097,
+  /* 0x98 */ 0x0098, 0x0099, 0x009a, 0x009b, 0x009c, 0x009d, 0x009e, 0x009f,
+  /* 0xa0 */ 0x00a0, 0x00a1, 0x00a2, 0x00a3, 0x0000, 0x00a5, 0x0000, 0x00a7,
+  /* 0xa8 */ 0x00a4, 0x2018, 0x201c, 0x00ab, 0x2190, 0x2191, 0x2192, 0x2193,
+  /* 0xb0 */ 0x00b0, 0x00b1, 0x00b2, 0x00b3, 0x00b4, 0x00b5, 0x00b6, 0x00b7,
+  /* 0xb8 */ 0x00f7, 0x2019, 0x201d, 0x00bb, 0x00bc, 0x00bd, 0x00be, 0x00bf,
+  /* 0xc0 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+  /* 0xc8 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+  /* 0xd0 */ 0x2014, 0x00b9, 0x00ae, 0x00a9, 0x2122, 0x266a, 0x00ac, 0x00a6,
+  /* 0xd8 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x215b, 0x215c, 0x215d, 0x215e,
+  /* 0xe0 */ 0x2126, 0x00c6, 0x00d0, 0x00aa, 0x0126, 0x0000, 0x0132, 0x013f,
+  /* 0xe8 */ 0x0141, 0x00d8, 0x0152, 0x00ba, 0x00de, 0x0166, 0x014a, 0x0149,
+  /* 0xf0 */ 0x0138, 0x00e6, 0x0111, 0x00f0, 0x0127, 0x0131, 0x0133, 0x0140,
+  /* 0xf8 */ 0x0142, 0x00f8, 0x0153, 0x00df, 0x00fe, 0x0167, 0x014b, 0x00ad
+};
+
+/* The outer array range runs from 0xc1 to 0xcf, the inner range from 0x20
+   to 0x7f.  */
+static const wchar_t to_ucs4_comb[15][96] =
+{
+  /* 0xc1 */
+  {
+    /* 0x20 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+    /* 0x28 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+    /* 0x30 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+    /* 0x38 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+    /* 0x40 */ 0x0000, 0x00c0, 0x0000, 0x0000, 0x0000, 0x00c8, 0x0000, 0x0000,
+    /* 0x48 */ 0x0000, 0x00cc, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x00d2,
+    /* 0x50 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x00d9, 0x0000, 0x0000,
+    /* 0x58 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+    /* 0x60 */ 0x0000, 0x00e0, 0x0000, 0x0000, 0x0000, 0x00e8, 0x0000, 0x0000,
+    /* 0x68 */ 0x0000, 0x00ec, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x00f2,
+    /* 0x70 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x00f9, 0x0000, 0x0000,
+    /* 0x78 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000
+  },
+  /* 0xc2 */
+  {
+    /* 0x20 */ 0x00b4, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+    /* 0x28 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+    /* 0x30 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+    /* 0x38 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+    /* 0x40 */ 0x0000, 0x00c1, 0x0000, 0x0106, 0x0000, 0x00c9, 0x0000, 0x0000,
+    /* 0x48 */ 0x0000, 0x00cd, 0x0000, 0x0000, 0x0139, 0x0000, 0x0143, 0x00d3,
+    /* 0x50 */ 0x0000, 0x0000, 0x0154, 0x015a, 0x0000, 0x00da, 0x0000, 0x0000,
+    /* 0x58 */ 0x0000, 0x00dd, 0x0179, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+    /* 0x60 */ 0x0000, 0x00e1, 0x0000, 0x0107, 0x0000, 0x00e9, 0x0000, 0x0000,
+    /* 0x68 */ 0x0000, 0x00ed, 0x0000, 0x0000, 0x013a, 0x0000, 0x0144, 0x00f3,
+    /* 0x70 */ 0x0000, 0x0000, 0x0155, 0x015b, 0x0000, 0x00fa, 0x0000, 0x0000,
+    /* 0x78 */ 0x0000, 0x00fd, 0x017a, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000
+  },
+  /* 0xc3 */
+  {
+    /* 0x20 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+    /* 0x28 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+    /* 0x30 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+    /* 0x38 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+    /* 0x40 */ 0x0000, 0x00c2, 0x0000, 0x0108, 0x0000, 0x00ca, 0x0000, 0x011c,
+    /* 0x48 */ 0x0124, 0x00ce, 0x0134, 0x0000, 0x0000, 0x0000, 0x0000, 0x00d4,
+    /* 0x50 */ 0x0000, 0x0000, 0x0000, 0x015c, 0x0000, 0x00db, 0x0000, 0x0174,
+    /* 0x58 */ 0x0000, 0x0176, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+    /* 0x60 */ 0x0000, 0x00e2, 0x0000, 0x0109, 0x0000, 0x00ea, 0x0000, 0x011d,
+    /* 0x68 */ 0x0125, 0x00ee, 0x0135, 0x0000, 0x0000, 0x0000, 0x0000, 0x00f4,
+    /* 0x70 */ 0x0000, 0x0000, 0x0000, 0x015d, 0x0000, 0x00fb, 0x0000, 0x0175,
+    /* 0x78 */ 0x0000, 0x0177, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000
+  },
+  /* 0xc4 */
+  {
+    /* 0x20 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+    /* 0x28 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+    /* 0x30 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+    /* 0x38 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+    /* 0x40 */ 0x0000, 0x00c3, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+    /* 0x48 */ 0x0000, 0x0128, 0x0000, 0x0000, 0x0000, 0x0000, 0x00d1, 0x00d5,
+    /* 0x50 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0168, 0x0000, 0x0000,
+    /* 0x58 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+    /* 0x60 */ 0x0000, 0x00e3, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+    /* 0x68 */ 0x0000, 0x0129, 0x0000, 0x0000, 0x0000, 0x0000, 0x00f1, 0x00f5,
+    /* 0x70 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0169, 0x0000, 0x0000,
+    /* 0x78 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000
+  },
+  /* 0xc5 */
+  {
+    /* 0x20 */ 0x00af, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+    /* 0x28 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+    /* 0x30 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+    /* 0x38 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+    /* 0x40 */ 0x0000, 0x0100, 0x0000, 0x0000, 0x0000, 0x0112, 0x0000, 0x0000,
+    /* 0x48 */ 0x0000, 0x012a, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x014c,
+    /* 0x50 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x016a, 0x0000, 0x0000,
+    /* 0x58 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+    /* 0x60 */ 0x0000, 0x0101, 0x0000, 0x0000, 0x0000, 0x0113, 0x0000, 0x0000,
+    /* 0x68 */ 0x0000, 0x012b, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x014d,
+    /* 0x70 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x016b, 0x0000, 0x0000,
+    /* 0x78 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000
+  },
+  /* 0xc6 */
+  {
+    /* 0x20 */ 0x02d8, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+    /* 0x28 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+    /* 0x30 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+    /* 0x38 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+    /* 0x40 */ 0x0000, 0x0102, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x011e,
+    /* 0x48 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+    /* 0x50 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x016c, 0x0000, 0x0000,
+    /* 0x58 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+    /* 0x60 */ 0x0000, 0x0103, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x011f,
+    /* 0x68 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+    /* 0x70 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x016d, 0x0000, 0x0000,
+    /* 0x78 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000
+  },
+  /* 0xc7 */
+  {
+    /* 0x20 */ 0x02d9, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+    /* 0x28 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+    /* 0x30 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+    /* 0x38 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+    /* 0x40 */ 0x0000, 0x0000, 0x0000, 0x010a, 0x0000, 0x0116, 0x0000, 0x0120,
+    /* 0x48 */ 0x0000, 0x0130, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+    /* 0x50 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+    /* 0x58 */ 0x0000, 0x0000, 0x017b, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+    /* 0x60 */ 0x0000, 0x0000, 0x0000, 0x010b, 0x0000, 0x0117, 0x0000, 0x0121,
+    /* 0x68 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+    /* 0x70 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+    /* 0x78 */ 0x0000, 0x0000, 0x017c, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000
+  },
+  /* 0xc8 */
+  {
+    /* 0x20 */ 0x00a8, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+    /* 0x28 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+    /* 0x30 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+    /* 0x38 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+    /* 0x40 */ 0x0000, 0x00c4, 0x0000, 0x0000, 0x0000, 0x00cb, 0x0000, 0x0000,
+    /* 0x48 */ 0x0000, 0x00cf, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x00d6,
+    /* 0x50 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x00dc, 0x0000, 0x0000,
+    /* 0x58 */ 0x0000, 0x0178, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+    /* 0x60 */ 0x0000, 0x00e4, 0x0000, 0x0000, 0x0000, 0x00eb, 0x0000, 0x0000,
+    /* 0x68 */ 0x0000, 0x00ef, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x00f6,
+    /* 0x70 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x00fc, 0x0000, 0x0000,
+    /* 0x78 */ 0x0000, 0x00ff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000
+  },
+  /* 0xc9 */
+  {
+    0x0000,
+  },
+  /* 0xca */
+  {
+    /* 0x20 */ 0x02da, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+    /* 0x28 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+    /* 0x30 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+    /* 0x38 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+    /* 0x40 */ 0x0000, 0x00c5, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+    /* 0x48 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+    /* 0x50 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x016e, 0x0000, 0x0000,
+    /* 0x58 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+    /* 0x60 */ 0x0000, 0x00e5, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+    /* 0x68 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+    /* 0x70 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x016f, 0x0000, 0x0000,
+    /* 0x78 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000
+  },
+  /* 0xcb */
+  {
+    /* 0x20 */ 0x00b8, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+    /* 0x28 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+    /* 0x30 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+    /* 0x38 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+    /* 0x40 */ 0x0000, 0x0000, 0x0000, 0x00c7, 0x0000, 0x0000, 0x0000, 0x0122,
+    /* 0x48 */ 0x0000, 0x0000, 0x0000, 0x0136, 0x013b, 0x0000, 0x0145, 0x0000,
+    /* 0x50 */ 0x0000, 0x0000, 0x0156, 0x015e, 0x0162, 0x0000, 0x0000, 0x0000,
+    /* 0x58 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+    /* 0x60 */ 0x0000, 0x0000, 0x0000, 0x00e7, 0x0000, 0x0000, 0x0000, 0x0123,
+    /* 0x68 */ 0x0000, 0x0000, 0x0000, 0x0137, 0x013c, 0x0000, 0x0146, 0x0000,
+    /* 0x70 */ 0x0000, 0x0000, 0x0157, 0x015f, 0x0163, 0x0000, 0x0000, 0x0000,
+    /* 0x78 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000
+  },
+  /* 0xcc */
+  {
+    0x0000,
+  },
+  /* 0xcd */
+  {
+    /* 0x20 */ 0x02dd, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+    /* 0x28 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+    /* 0x30 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+    /* 0x38 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+    /* 0x40 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+    /* 0x48 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0150,
+    /* 0x50 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0170, 0x0000, 0x0000,
+    /* 0x58 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+    /* 0x60 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+    /* 0x68 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0151,
+    /* 0x70 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0171, 0x0000, 0x0000,
+    /* 0x78 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000
+  },
+  /* 0xce */
+  {
+    /* 0x20 */ 0x02db, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+    /* 0x28 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+    /* 0x30 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+    /* 0x38 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+    /* 0x40 */ 0x0000, 0x0104, 0x0000, 0x0000, 0x0000, 0x0118, 0x0000, 0x0000,
+    /* 0x48 */ 0x0000, 0x012e, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+    /* 0x50 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0172, 0x0000, 0x0000,
+    /* 0x58 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+    /* 0x60 */ 0x0000, 0x0105, 0x0000, 0x0000, 0x0000, 0x0119, 0x0000, 0x0000,
+    /* 0x68 */ 0x0000, 0x012f, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+    /* 0x70 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0173, 0x0000, 0x0000,
+    /* 0x78 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000
+  },
+  /* 0xcf */
+  {
+    /* 0x20 */ 0x02c7, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+    /* 0x28 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+    /* 0x30 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+    /* 0x38 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+    /* 0x40 */ 0x0000, 0x0000, 0x0000, 0x010c, 0x010e, 0x011a, 0x0000, 0x0000,
+    /* 0x48 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x013d, 0x0000, 0x0147, 0x0000,
+    /* 0x50 */ 0x0000, 0x0000, 0x0158, 0x0160, 0x0164, 0x0000, 0x0000, 0x0000,
+    /* 0x58 */ 0x0000, 0x0000, 0x017d, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+    /* 0x60 */ 0x0000, 0x0000, 0x0000, 0x010d, 0x010f, 0x011b, 0x0000, 0x0000,
+    /* 0x68 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x013e, 0x0000, 0x0148, 0x0000,
+    /* 0x70 */ 0x0000, 0x0000, 0x0159, 0x0161, 0x0165, 0x0000, 0x0000, 0x0000,
+    /* 0x78 */ 0x0000, 0x0000, 0x017e, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000
+  }
+};
+
+
+static const char from_ucs4[][2] =
+{
+  /* 0x0000 */ "\x00\x00", "\x01\x00", "\x02\x00", "\x03\x00", "\x04\x00",
+  /* 0x0005 */ "\x05\x00", "\x06\x00", "\x07\x00", "\x08\x00", "\x09\x00",
+  /* 0x000a */ "\x0a\x00", "\x0b\x00", "\x0c\x00", "\x0d\x00", "\x0e\x00",
+  /* 0x000f */ "\x0f\x00", "\x10\x00", "\x11\x00", "\x12\x00", "\x13\x00",
+  /* 0x0014 */ "\x14\x00", "\x15\x00", "\x16\x00", "\x17\x00", "\x18\x00",
+  /* 0x0019 */ "\x19\x00", "\x1a\x00", "\x1b\x00", "\x1c\x00", "\x1d\x00",
+  /* 0x001e */ "\x1e\x00", "\x1f\x00", "\x20\x00", "\x21\x00", "\x22\x00",
+  /* 0x0023 */ "\x23\x00", "\x24\x00", "\x25\x00", "\x26\x00", "\x27\x00",
+  /* 0x0028 */ "\x28\x00", "\x29\x00", "\x2a\x00", "\x2b\x00", "\x2c\x00",
+  /* 0x002d */ "\x2d\x00", "\x2e\x00", "\x2f\x00", "\x30\x00", "\x31\x00",
+  /* 0x0032 */ "\x32\x00", "\x33\x00", "\x34\x00", "\x35\x00", "\x36\x00",
+  /* 0x0037 */ "\x37\x00", "\x38\x00", "\x39\x00", "\x3a\x00", "\x3b\x00",
+  /* 0x003c */ "\x3c\x00", "\x3d\x00", "\x3e\x00", "\x3f\x00", "\x40\x00",
+  /* 0x0041 */ "\x41\x00", "\x42\x00", "\x43\x00", "\x44\x00", "\x45\x00",
+  /* 0x0046 */ "\x46\x00", "\x47\x00", "\x48\x00", "\x49\x00", "\x4a\x00",
+  /* 0x004b */ "\x4b\x00", "\x4c\x00", "\x4d\x00", "\x4e\x00", "\x4f\x00",
+  /* 0x0050 */ "\x50\x00", "\x51\x00", "\x52\x00", "\x53\x00", "\x54\x00",
+  /* 0x0055 */ "\x55\x00", "\x56\x00", "\x57\x00", "\x58\x00", "\x59\x00",
+  /* 0x005a */ "\x5a\x00", "\x5b\x00", "\x5c\x00", "\x5d\x00", "\x5e\x00",
+  /* 0x005f */ "\x5f\x00", "\x60\x00", "\x61\x00", "\x62\x00", "\x63\x00",
+  /* 0x0064 */ "\x64\x00", "\x65\x00", "\x66\x00", "\x67\x00", "\x68\x00",
+  /* 0x0069 */ "\x69\x00", "\x6a\x00", "\x6b\x00", "\x6c\x00", "\x6d\x00",
+  /* 0x006e */ "\x6e\x00", "\x6f\x00", "\x70\x00", "\x71\x00", "\x72\x00",
+  /* 0x0073 */ "\x73\x00", "\x74\x00", "\x75\x00", "\x76\x00", "\x77\x00",
+  /* 0x0078 */ "\x78\x00", "\x79\x00", "\x7a\x00", "\x7b\x00", "\x7c\x00",
+  /* 0x007d */ "\x7d\x00", "\x7e\x00", "\x7f\x00", "\x00\x80", "\x00\x81",
+  /* 0x0082 */ "\x82\x00", "\x83\x00", "\x84\x00", "\x85\x00", "\x86\x00",
+  /* 0x0087 */ "\x87\x00", "\x88\x00", "\x89\x00", "\x8a\x00", "\x8b\x00",
+  /* 0x008c */ "\x8c\x00", "\x8d\x00", "\x8e\x00", "\x8f\x00", "\x90\x00",
+  /* 0x0091 */ "\x91\x00", "\x92\x00", "\x93\x00", "\x94\x00", "\x95\x00",
+  /* 0x0096 */ "\x96\x00", "\x97\x00", "\x98\x00", "\x99\x00", "\x9a\x00",
+  /* 0x009b */ "\x9b\x00", "\x9c\x00", "\x9d\x00", "\x9e\x00", "\x9f\x00",
+  /* 0x00a0 */ "\xa0\x00", "\xa1\x00", "\xa2\x00", "\xa3\x00", "\xa4\x00",
+  /* 0x00a5 */ "\xa5\x00", "\xd7\x00", "\xa7\x00", "\xc8\x20", "\xd3\x00",
+  /* 0x00aa */ "\xe3\x00", "\xab\x00", "\xd6\x00", "\xff\x00", "\xd2\x00",
+  /* 0x00af */ "\xc5\x20", "\xb0\x00", "\xb1\x00", "\xb2\x00", "\xb3\x00",
+  /* 0x00b4 */ "\xc2\x20", "\xb5\x00", "\xb6\x00", "\xb7\x00", "\xcb\x20",
+  /* 0x00b9 */ "\xc1\x00", "\xeb\x00", "\xbb\x00", "\xbc\x00", "\xbd\x00",
+  /* 0x00be */ "\xbe\x00", "\xbf\x00", "\xc1\x41", "\xc2\x41", "\xc3\x41",
+  /* 0x00c3 */ "\xc4\x41", "\xc8\x41", "\xca\x41", "\xe1\x00", "\xcb\x43",
+  /* 0x00c8 */ "\xc1\x45", "\xc2\x45", "\xc3\x45", "\xc8\x45", "\xc1\x49",
+  /* 0x00cd */ "\xc2\x49", "\xc3\x49", "\xc8\x49", "\xe2\x00", "\xc4\x4e",
+  /* 0x00d2 */ "\xc1\x4f", "\xc2\x4f", "\xc3\x4f", "\xc4\x4f", "\xc8\x4f",
+  /* 0x00d7 */ "\xb4\x00", "\xe9\x00", "\xc1\x55", "\xc2\x55", "\xc3\x55",
+  /* 0x00dc */ "\xc8\x55", "\xc2\x59", "\xec\x00", "\xfb\x00", "\xc1\x61",
+  /* 0x00e1 */ "\xc2\x61", "\xc3\x61", "\xc4\x61", "\xc8\x61", "\xca\x61",
+  /* 0x00e6 */ "\xf1\x00", "\xcb\x63", "\xc1\x65", "\xc2\x65", "\xc3\x65",
+  /* 0x00eb */ "\xc8\x65", "\xc1\x69", "\xc2\xe9", "\xc3\x69", "\xc8\x69",
+  /* 0x00f0 */ "\xf3\x00", "\xc4\x6e", "\xc1\x6f", "\xc2\x6f", "\xc3\x6f",
+  /* 0x00f5 */ "\xc4\x6f", "\xc8\x6f", "\xb8\x00", "\xf9\x00", "\xc1\x75",
+  /* 0x00fa */ "\xc2\x75", "\xc3\x75", "\xc8\x75", "\xc2\x79", "\xfc\x00",
+  /* 0x00ff */ "\xc8\x79", "\xc5\x41", "\xc5\x61", "\xc6\x41", "\xc6\x61",
+  /* 0x0104 */ "\xce\x41", "\xce\x61", "\xc2\x43", "\xc2\x63", "\xc3\x43",
+  /* 0x0109 */ "\xc3\x63", "\xc7\x43", "\xc7\x63", "\xcf\x43", "\xcf\x63",
+  /* 0x010e */ "\xcf\x44", "\xcf\x64", "\x00\x00", "\xf2\x00", "\xc5\x45",
+  /* 0x0113 */ "\xc5\x65", "\x00\x00", "\x00\x00", "\xc7\x45", "\xc7\x65",
+  /* 0x0118 */ "\xce\x45", "\xce\x65", "\xcf\x45", "\xcf\x65", "\xc3\x47",
+  /* 0x011d */ "\xc3\x67", "\xc6\x47", "\xc6\x67", "\xc7\x47", "\xc7\x67",
+  /* 0x0122 */ "\xcb\x47", "\xcb\x67", "\xc3\x48", "\xc3\x68", "\xe4\x00",
+  /* 0x0127 */ "\xf4\x00", "\xc4\x49", "\xc4\x69", "\xc5\x49", "\xc5\x69",
+  /* 0x012c */ "\x00\x00", "\x00\x00", "\xce\x49", "\xce\x69", "\xc7\x49",
+  /* 0x0131 */ "\xf5\x00", "\xe6\x00", "\xf6\x00", "\xc3\x4a", "\xc3\x6a",
+  /* 0x0136 */ "\xcb\x4b", "\xcb\x6b", "\xf0\x00", "\xc2\x4c", "\xc2\x6c",
+  /* 0x013b */ "\xcb\x4c", "\xcb\x6c", "\xcf\x4c", "\xcf\x6c", "\xe7\x00",
+  /* 0x0140 */ "\xf7\x00", "\xe8\x00", "\xf8\x00", "\xc2\x4e", "\xc2\x6e",
+  /* 0x0145 */ "\xcb\x4e", "\xcb\x6e", "\xcf\x4e", "\xcf\x6e", "\xef\x00",
+  /* 0x014a */ "\xee\x00", "\xfe\x00", "\xc5\x4f", "\xc5\x6f", "\x00\x00",
+  /* 0x014f */ "\x00\x00", "\xcd\x4f", "\xcd\x6f", "\xea\x00", "\xfa\x00",
+  /* 0x0154 */ "\xc2\x52", "\xc2\x72", "\xcb\x52", "\xcb\x72", "\xcf\x52",
+  /* 0x0159 */ "\xcf\x72", "\xc2\x53", "\xc2\x73", "\xc3\x53", "\xc3\x73",
+  /* 0x015e */ "\xcb\x53", "\xcb\x73", "\xcf\x53", "\xcf\x73", "\xcb\x54",
+  /* 0x0163 */ "\xcb\x74", "\xcf\x54", "\xcf\x74", "\xed\x00", "\xfd\x00",
+  /* 0x0168 */ "\xc4\x55", "\xc4\x75", "\xc5\x55", "\xc5\x75", "\xc6\x55",
+  /* 0x016d */ "\xc6\x75", "\xca\x55", "\xca\x75", "\xcd\x55", "\xcd\x75",
+  /* 0x0172 */ "\xce\x55", "\xce\x75", "\xc3\x57", "\xc3\x77", "\xc3\x59",
+  /* 0x0177 */ "\xc3\x79", "\xc8\x59", "\xc2\x5a", "\xc2\x7a", "\xc7\x5a",
+  /* 0x017c */ "\xc7\x7a", "\xcf\x5a", "\xcf\x7a"
+/*
+   This table does not cover the following positions:
+
+     0x02c7    "\xcf\x20",
+     ...
+     0x02d8    "\xc6\x20", "\xc7\x20", "\xca\x20", "\xce\x20", "\x00\x00",
+     0x02dd    "\xcd\x20",
+     ...
+     0x2014    "\xd0\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\xa9\x00",
+     0x2019    "\xb9\x00", "\x00\x00", "\x00\x00", "\xaa\x00", "\xba\x00",
+     0x201e    "\x00\x00", "\x00\x00", "\x00\x00", "\x00\x00", "\xd4\x00",
+     0x2123    "\x00\x00", "\x00\x00", "\x00\x00", "\xe0\x00", "\x00\x00",
+     ...
+     0x215b    "\xdc\x00", "\xdd\x00", "\xde\x00"
+     ...
+     0x2190    "\xac\x00", "\xad\x00", "\xae\x00", "\xaf\x00",
+     ...
+     0x266a    "\xd5\x00"
+
+   These would blow up the table and are therefore handled specially in
+   the code.
+*/
+};
+
+/* Direction of the transformation.  */
+enum direction
+{
+  illegal,
+  to_iso6937,
+  from_iso6937
+};
+
+struct iso6937_data
+{
+  enum direction dir;
+};
+
+
+int
+gconv_init (struct gconv_step *step, struct gconv_step_data *data)
+{
+  /* Determine which direction.  */
+  struct iso6937_data *new_data;
+  enum direction dir;
+  int result;
+
+  if (__strcasestr (step->from_name, "ISO_6937") != NULL)
+    dir = from_iso6937;
+  else if (__strcasestr (step->to_name, "ISO_6937") != NULL)
+    dir = to_iso6937;
+  else
+    dir = illegal;
+
+  result = GCONV_NOCONV;
+  if (dir != illegal
+      && ((new_data
+	   = (struct iso6937_data *) malloc (sizeof (struct iso6937_data)))
+	  != NULL))
+    {
+      new_data->dir = dir;
+      data->data = new_data;
+      result = GCONV_OK;
+    }
+
+  return result;
+}
+
+
+void
+gconv_end (struct gconv_step_data *data)
+{
+  free (data->data);
+}
+
+
+int
+gconv (struct gconv_step *step, struct gconv_step_data *data,
+       const char *inbuf, size_t *inbufsize, size_t *written, int do_flush)
+{
+  struct gconv_step *next_step = step + 1;
+  struct gconv_step_data *next_data = data + 1;
+  gconv_fct fct = next_step->fct;
+  size_t do_write;
+  int result;
+
+  /* If the function is called with no input this means we have to reset
+     to the initial state.  The possibly partly converted input is
+     dropped.  */
+  if (do_flush)
+    {
+      do_write = 0;
+
+      /* Call the steps down the chain if there are any.  */
+      if (data->is_last)
+	result = GCONV_OK;
+      else
+	{
+	  struct gconv_step *next_step = step + 1;
+	  struct gconv_step_data *next_data = data + 1;
+
+	  result = (*fct) (next_step, next_data, NULL, 0, written, 1);
+
+	  /* Clear output buffer.  */
+	  data->outbufavail = 0;
+	}
+    }
+  else
+    {
+      enum direction dir = ((struct iso6937_data *) data->data)->dir;
+
+      do_write = 0;
+
+      do
+	{
+	  result = GCONV_OK;
+
+	  if (dir == from_iso6937)
+	    {
+	      size_t inchars = *inbufsize;
+	      size_t outwchars = data->outbufavail;
+	      char *outbuf = data->outbuf;
+	      size_t cnt = 0;
+
+	      while (cnt < inchars
+		     && (outwchars + sizeof (wchar_t) <= data->outbufsize))
+		{
+		  int inchar = inbuf[cnt];
+		  wchar_t ch;
+
+		  if (inchar >= '\xc1' && inchar <= '\xcf')
+		    {
+		      /* Composed character.  First test whether the next
+			 character is also available.  */
+		      int inchar2;
+
+		      if (cnt + 1 >= inchars)
+			{
+			  /* The second character is not available.  Store
+			     the intermediate result.  */
+			  result = GCONV_INCOMPLETE_INPUT;
+			  break;
+			}
+
+		      inchar2 = inbuf[++cnt];
+
+		      if (inchar2 < '\x20' || inchar2 >= '\x80')
+			/* This is illegal.  */
+			ch = L'\0';
+		      else
+			ch = to_ucs4_comb[inchar - 0xc1][inchar2 - 0x20];
+		    }
+		  else
+		    ch = to_ucs4[inchar];
+
+		  if (ch == L'\0' && inbuf[cnt] != '\0')
+		    {
+		      /* This is an illegal character.  */
+		      result = GCONV_ILLEGAL_INPUT;
+		      break;
+		    }
+
+		  *((wchar_t *) (outbuf + outwchars)) = ch;
+		  ++do_write;
+		  outwchars += sizeof (wchar_t);
+		  ++cnt;
+		}
+	      *inbufsize -= cnt;
+	      data->outbufavail = outwchars;
+	    }
+	  else
+	    {
+	      size_t inwchars = *inbufsize;
+	      size_t outchars = data->outbufavail;
+	      char *outbuf = data->outbuf;
+	      size_t cnt = 0;
+	      int extra = 0;
+
+	      while (inwchars >= cnt + sizeof (wchar_t)
+		     && outchars < data->outbufsize)
+		{
+		  char tmp[2];
+		  int ch = *((wchar_t *) (inbuf + cnt));
+		  const char *cp;
+
+		  if (ch >= sizeof (from_ucs4) / sizeof (from_ucs4[0]))
+		    {
+		      int fail = 0;
+		      switch (ch)
+			{
+			case 0x2c7:
+			  cp = "\xcf\x20";
+			  break;
+			case 0x2d8 ... 0x2dd:
+			  {
+			    static const char map[5] = "\xc6\xc7\xca\xce\xcd";
+
+			    tmp[0] = map[ch - 0x2d8];
+			    tmp[1] = ' ';
+			    cp = tmp;
+			  }
+			  break;
+			case 0x2014:
+			  cp = "\xd0";
+			  break;
+			case 0x2018:
+			  cp = "\xa9";
+			  break;
+			case 0x2019:
+			  cp = "\xb9";
+			  break;
+			case 0x201c:
+			  cp = "\xaa";
+			  break;
+			case 0x201d:
+			  cp = "\xba";
+			  break;
+			case 0x2122:
+			  cp = "\xd4";
+			  break;
+			case 0x2126:
+			  cp = "\xe0";
+			  break;
+			case 0x215b ... 0x215e:
+			  tmp[0] = 0xdc + (ch - 0x215b);
+			  tmp[1] = '\0';
+			  cp = tmp;
+			  break;
+			case 0x2190 ... 0x2193:
+			  tmp[0] = 0xac + (ch - 0x2190);
+			  tmp[1] = '\0';
+			  cp = tmp;
+			  break;
+			case 0x266a:
+			  cp = "\xd5";
+			  break;
+			default:
+			  cp = NULL;
+			  fail = 1;
+			}
+
+		      if (fail)
+			/* Illegal characters.  */
+			break;
+		    }
+		  else if (ch < 0 || (from_ucs4[ch][0] == '\0' && ch != 0))
+		    break;
+		  else
+		    cp = from_ucs4[ch];
+
+		  outbuf[outchars] = cp[0];
+		  /* Now test for a possible second byte and write this
+		     if possible.  */
+		  if (cp[1] != '\0')
+		    {
+		      if (outchars + 1 >= data->outbufsize)
+			{
+			  /* The result does not fit into the buffer.  */
+			  extra = 1;
+			  break;
+			}
+		      outbuf[++outchars] = cp[1];
+		    }
+
+		  ++do_write;
+		  ++outchars;
+		  cnt += sizeof (wchar_t);
+		}
+	      *inbufsize -= cnt;
+	      data->outbufavail = outchars;
+
+	      if (outchars + extra < data->outbufsize)
+		{
+		  /* If there is still room in the output buffer something
+		     is wrong with the input.  */
+		  if (inwchars >= cnt + sizeof (wchar_t))
+		    {
+		      /* An error occurred.  */
+		      result = GCONV_ILLEGAL_INPUT;
+		      break;
+		    }
+		  if (inwchars != cnt)
+		    {
+		      /* There are some unprocessed bytes at the end of the
+			 input buffer.  */
+		      result = GCONV_INCOMPLETE_INPUT;
+		      break;
+		    }
+		}
+	    }
+
+	  if (result != GCONV_OK)
+	    break;
+
+	  if (data->is_last)
+	    {
+	      /* This is the last step.  */
+	      result = (*inbufsize > (dir == from_iso6937
+				      ? 0 : sizeof (wchar_t) - 1)
+			? GCONV_FULL_OUTPUT : GCONV_EMPTY_INPUT);
+	      break;
+	    }
+
+	  /* Status so far.  */
+	  result = GCONV_EMPTY_INPUT;
+
+	  if (data->outbufavail > 0)
+	    {
+	      /* Call the functions below in the chain.  */
+	      size_t newavail = data->outbufavail;
+
+	      result = (*fct) (next_step, next_data, data->outbuf, &newavail,
+			       written, 0);
+
+	      /* Correct the output buffer.  */
+	      if (newavail != data->outbufavail && newavail > 0)
+		{
+		  memmove (data->outbuf,
+			   &data->outbuf[data->outbufavail - newavail],
+			   newavail);
+		  data->outbufavail = newavail;
+		}
+	    }
+	}
+      while (*inbufsize > 0 && result == GCONV_EMPTY_INPUT);
+    }
+
+  if (written != NULL && data->is_last)
+    *written = do_write;
+
+  return result;
+}
diff --git a/iconvdata/iso8859-1.c b/iconvdata/iso8859-1.c
new file mode 100644
index 0000000000..94128fe72c
--- /dev/null
+++ b/iconvdata/iso8859-1.c
@@ -0,0 +1,219 @@
+/* Conversion to and from ISO 8859-1.
+   Copyright (C) 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@cygnus.com>, 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
+   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 <gconv.h>
+#include <stdlib.h>
+#include <string.h>
+
+/* Direction of the transformation.  */
+enum direction
+{
+  illegal,
+  to_iso88591,
+  from_iso88591
+};
+
+struct iso88591_data
+{
+  enum direction dir;
+};
+
+
+int
+gconv_init (struct gconv_step *step, struct gconv_step_data *data)
+{
+  /* Determine which direction.  */
+  struct iso88591_data *new_data;
+  enum direction dir;
+  int result;
+
+  if (__strcasestr (step->from_name, "ISO-8859-1") != NULL)
+    dir = from_iso88591;
+  else if (__strcasestr (step->to_name, "ISO-8859-1") != NULL)
+    dir = to_iso88591;
+  else
+    dir = illegal;
+
+  result = GCONV_NOCONV;
+  if (dir != illegal
+      && ((new_data
+	   = (struct iso88591_data *) malloc (sizeof (struct iso88591_data)))
+	  != NULL))
+    {
+      new_data->dir = dir;
+      data->data = new_data;
+      result = GCONV_OK;
+    }
+
+  return result;
+}
+
+
+void
+gconv_end (struct gconv_step_data *data)
+{
+  free (data->data);
+}
+
+
+int
+gconv (struct gconv_step *step, struct gconv_step_data *data,
+       const char *inbuf, size_t *inbufsize, size_t *written, int do_flush)
+{
+  struct gconv_step *next_step = step + 1;
+  struct gconv_step_data *next_data = data + 1;
+  gconv_fct fct = next_step->fct;
+  size_t do_write;
+  int result;
+
+  /* If the function is called with no input this means we have to reset
+     to the initial state.  The possibly partly converted input is
+     dropped.  */
+  if (do_flush)
+    {
+      do_write = 0;
+
+      /* Call the steps down the chain if there are any.  */
+      if (data->is_last)
+	result = GCONV_OK;
+      else
+	{
+	  struct gconv_step *next_step = step + 1;
+	  struct gconv_step_data *next_data = data + 1;
+
+	  result = (*fct) (next_step, next_data, NULL, 0, written, 1);
+
+	  /* Clear output buffer.  */
+	  data->outbufavail = 0;
+	}
+    }
+  else
+    {
+      enum direction dir = ((struct iso88591_data *) data->data)->dir;
+
+      do_write = 0;
+
+      do
+	{
+	  result = GCONV_OK;
+
+	  if (dir == from_iso88591)
+	    {
+	      size_t inchars = *inbufsize;
+	      size_t outwchars = data->outbufavail;
+	      char *outbuf = data->outbuf;
+	      size_t cnt = 0;
+
+	      while (cnt < inchars
+		     && (outwchars + sizeof (wchar_t) <= data->outbufsize))
+		{
+		  *((wchar_t *) (outbuf + outwchars)) = inbuf[cnt];
+		  ++do_write;
+		  outwchars += sizeof (wchar_t);
+		  ++cnt;
+		}
+	      *inbufsize -= cnt;
+	      data->outbufavail = outwchars;
+	    }
+	  else
+	    {
+	      size_t inwchars = *inbufsize;
+	      size_t outchars = data->outbufavail;
+	      char *outbuf = data->outbuf;
+	      size_t cnt = 0;
+
+	      while (inwchars >= cnt + sizeof (wchar_t)
+		     && outchars < data->outbufsize)
+		{
+		  if (*((wchar_t *) (inbuf + cnt)) <= L'\377')
+		    outbuf[outchars] = *((wchar_t *) (inbuf + cnt));
+		  else
+		    /* Here is where the transliteration would enter the
+		       scene.  */
+		    break;
+
+		  ++do_write;
+		  ++outchars;
+		  cnt += sizeof (wchar_t);
+		}
+	      *inbufsize -= cnt;
+	      data->outbufavail = outchars;
+
+	      if (outchars < data->outbufsize)
+		{
+		  /* If there is still room in the output buffer something
+		     is wrong with the input.  */
+		  if (inwchars >= cnt + sizeof (wchar_t))
+		    {
+		      /* An error occurred.  */
+		      result = GCONV_ILLEGAL_INPUT;
+		      break;
+		    }
+		  if (inwchars != cnt)
+		    {
+		      /* There are some unprocessed bytes at the end of the
+			 input buffer.  */
+		      result = GCONV_INCOMPLETE_INPUT;
+		      break;
+		    }
+		}
+	    }
+
+	  if (result != GCONV_OK)
+	    break;
+
+	  if (data->is_last)
+	    {
+	      /* This is the last step.  */
+	      result = (*inbufsize > (dir == from_iso88591
+				      ? 0 : sizeof (wchar_t) - 1)
+			? GCONV_FULL_OUTPUT : GCONV_EMPTY_INPUT);
+	      break;
+	    }
+
+	  /* Status so far.  */
+	  result = GCONV_EMPTY_INPUT;
+
+	  if (data->outbufavail > 0)
+	    {
+	      /* Call the functions below in the chain.  */
+	      size_t newavail = data->outbufavail;
+
+	      result = (*fct) (next_step, next_data, data->outbuf, &newavail,
+			       written, 0);
+
+	      /* Correct the output buffer.  */
+	      if (newavail != data->outbufavail && newavail > 0)
+		{
+		  memmove (data->outbuf,
+			   &data->outbuf[data->outbufavail - newavail],
+			   newavail);
+		  data->outbufavail = newavail;
+		}
+	    }
+	}
+      while (*inbufsize > 0 && result == GCONV_EMPTY_INPUT);
+    }
+
+  if (written != NULL && data->is_last)
+    *written = do_write;
+
+  return result;
+}
diff --git a/iconvdata/iso8859-10.c b/iconvdata/iso8859-10.c
new file mode 100644
index 0000000000..5c81214597
--- /dev/null
+++ b/iconvdata/iso8859-10.c
@@ -0,0 +1,24 @@
+/* Conversion from and to ISO 8859-10.
+   Copyright (C) 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@cygnus.com>, 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
+   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 <wchar.h>
+#include <iso8859-10.h>
+#define NAME "ISO-8859-10"
+#include <iso8859-generic.c>
diff --git a/iconvdata/iso8859-10.h b/iconvdata/iso8859-10.h
new file mode 100644
index 0000000000..04711c3274
--- /dev/null
+++ b/iconvdata/iso8859-10.h
@@ -0,0 +1,516 @@
+static const wchar_t to_ucs4[256] = {
+  [0x00] = 0x0000,
+  [0x01] = 0x0001,
+  [0x02] = 0x0002,
+  [0x03] = 0x0003,
+  [0x04] = 0x0004,
+  [0x05] = 0x0005,
+  [0x06] = 0x0006,
+  [0x07] = 0x0007,
+  [0x08] = 0x0008,
+  [0x09] = 0x0009,
+  [0x0A] = 0x000A,
+  [0x0B] = 0x000B,
+  [0x0C] = 0x000C,
+  [0x0D] = 0x000D,
+  [0x0E] = 0x000E,
+  [0x0F] = 0x000F,
+  [0x10] = 0x0010,
+  [0x11] = 0x0011,
+  [0x12] = 0x0012,
+  [0x13] = 0x0013,
+  [0x14] = 0x0014,
+  [0x15] = 0x0015,
+  [0x16] = 0x0016,
+  [0x17] = 0x0017,
+  [0x18] = 0x0018,
+  [0x19] = 0x0019,
+  [0x1A] = 0x001A,
+  [0x1B] = 0x001B,
+  [0x1C] = 0x001C,
+  [0x1D] = 0x001D,
+  [0x1E] = 0x001E,
+  [0x1F] = 0x001F,
+  [0x20] = 0x0020,
+  [0x21] = 0x0021,
+  [0x22] = 0x0022,
+  [0x23] = 0x0023,
+  [0x24] = 0x0024,
+  [0x25] = 0x0025,
+  [0x26] = 0x0026,
+  [0x27] = 0x0027,
+  [0x28] = 0x0028,
+  [0x29] = 0x0029,
+  [0x2A] = 0x002A,
+  [0x2B] = 0x002B,
+  [0x2C] = 0x002C,
+  [0x2D] = 0x002D,
+  [0x2E] = 0x002E,
+  [0x2F] = 0x002F,
+  [0x30] = 0x0030,
+  [0x31] = 0x0031,
+  [0x32] = 0x0032,
+  [0x33] = 0x0033,
+  [0x34] = 0x0034,
+  [0x35] = 0x0035,
+  [0x36] = 0x0036,
+  [0x37] = 0x0037,
+  [0x38] = 0x0038,
+  [0x39] = 0x0039,
+  [0x3A] = 0x003A,
+  [0x3B] = 0x003B,
+  [0x3C] = 0x003C,
+  [0x3D] = 0x003D,
+  [0x3E] = 0x003E,
+  [0x3F] = 0x003F,
+  [0x40] = 0x0040,
+  [0x41] = 0x0041,
+  [0x42] = 0x0042,
+  [0x43] = 0x0043,
+  [0x44] = 0x0044,
+  [0x45] = 0x0045,
+  [0x46] = 0x0046,
+  [0x47] = 0x0047,
+  [0x48] = 0x0048,
+  [0x49] = 0x0049,
+  [0x4A] = 0x004A,
+  [0x4B] = 0x004B,
+  [0x4C] = 0x004C,
+  [0x4D] = 0x004D,
+  [0x4E] = 0x004E,
+  [0x4F] = 0x004F,
+  [0x50] = 0x0050,
+  [0x51] = 0x0051,
+  [0x52] = 0x0052,
+  [0x53] = 0x0053,
+  [0x54] = 0x0054,
+  [0x55] = 0x0055,
+  [0x56] = 0x0056,
+  [0x57] = 0x0057,
+  [0x58] = 0x0058,
+  [0x59] = 0x0059,
+  [0x5A] = 0x005A,
+  [0x5B] = 0x005B,
+  [0x5C] = 0x005C,
+  [0x5D] = 0x005D,
+  [0x5E] = 0x005E,
+  [0x5F] = 0x005F,
+  [0x60] = 0x0060,
+  [0x61] = 0x0061,
+  [0x62] = 0x0062,
+  [0x63] = 0x0063,
+  [0x64] = 0x0064,
+  [0x65] = 0x0065,
+  [0x66] = 0x0066,
+  [0x67] = 0x0067,
+  [0x68] = 0x0068,
+  [0x69] = 0x0069,
+  [0x6A] = 0x006A,
+  [0x6B] = 0x006B,
+  [0x6C] = 0x006C,
+  [0x6D] = 0x006D,
+  [0x6E] = 0x006E,
+  [0x6F] = 0x006F,
+  [0x70] = 0x0070,
+  [0x71] = 0x0071,
+  [0x72] = 0x0072,
+  [0x73] = 0x0073,
+  [0x74] = 0x0074,
+  [0x75] = 0x0075,
+  [0x76] = 0x0076,
+  [0x77] = 0x0077,
+  [0x78] = 0x0078,
+  [0x79] = 0x0079,
+  [0x7A] = 0x007A,
+  [0x7B] = 0x007B,
+  [0x7C] = 0x007C,
+  [0x7D] = 0x007D,
+  [0x7E] = 0x007E,
+  [0x7F] = 0x007F,
+  [0x80] = 0x0080,
+  [0x81] = 0x0081,
+  [0x82] = 0x0082,
+  [0x83] = 0x0083,
+  [0x84] = 0x0084,
+  [0x85] = 0x0085,
+  [0x86] = 0x0086,
+  [0x87] = 0x0087,
+  [0x88] = 0x0088,
+  [0x89] = 0x0089,
+  [0x8A] = 0x008A,
+  [0x8B] = 0x008B,
+  [0x8C] = 0x008C,
+  [0x8D] = 0x008D,
+  [0x8E] = 0x008E,
+  [0x8F] = 0x008F,
+  [0x90] = 0x0090,
+  [0x91] = 0x0091,
+  [0x92] = 0x0092,
+  [0x93] = 0x0093,
+  [0x94] = 0x0094,
+  [0x95] = 0x0095,
+  [0x96] = 0x0096,
+  [0x97] = 0x0097,
+  [0x98] = 0x0098,
+  [0x99] = 0x0099,
+  [0x9A] = 0x009A,
+  [0x9B] = 0x009B,
+  [0x9C] = 0x009C,
+  [0x9D] = 0x009D,
+  [0x9E] = 0x009E,
+  [0x9F] = 0x009F,
+  [0xA0] = 0x00A0,
+  [0xA1] = 0x0104,
+  [0xA2] = 0x0112,
+  [0xA3] = 0x0122,
+  [0xA4] = 0x012A,
+  [0xA5] = 0x0128,
+  [0xA6] = 0x0136,
+  [0xA7] = 0x00A7,
+  [0xA8] = 0x013B,
+  [0xA9] = 0x0110,
+  [0xAA] = 0x0160,
+  [0xAB] = 0x0166,
+  [0xAC] = 0x017D,
+  [0xAD] = 0x00AD,
+  [0xAE] = 0x016A,
+  [0xAF] = 0x014A,
+  [0xB0] = 0x00B0,
+  [0xB1] = 0x0105,
+  [0xB2] = 0x0113,
+  [0xB3] = 0x0123,
+  [0xB4] = 0x012B,
+  [0xB5] = 0x0129,
+  [0xB6] = 0x0137,
+  [0xB7] = 0x00B7,
+  [0xB8] = 0x013C,
+  [0xB9] = 0x0111,
+  [0xBA] = 0x0161,
+  [0xBB] = 0x0167,
+  [0xBC] = 0x017E,
+  [0xBD] = 0x2014,
+  [0xBE] = 0x016B,
+  [0xBF] = 0x014B,
+  [0xC0] = 0x0100,
+  [0xC1] = 0x00C1,
+  [0xC2] = 0x00C2,
+  [0xC3] = 0x00C3,
+  [0xC4] = 0x00C4,
+  [0xC5] = 0x00C5,
+  [0xC6] = 0x00C6,
+  [0xC7] = 0x012E,
+  [0xC8] = 0x010C,
+  [0xC9] = 0x00C9,
+  [0xCA] = 0x0118,
+  [0xCB] = 0x00CB,
+  [0xCC] = 0x0116,
+  [0xCD] = 0x00CD,
+  [0xCE] = 0x00CE,
+  [0xCF] = 0x00CF,
+  [0xD0] = 0x00D0,
+  [0xD1] = 0x0145,
+  [0xD2] = 0x014C,
+  [0xD3] = 0x00D3,
+  [0xD4] = 0x00D4,
+  [0xD5] = 0x00D5,
+  [0xD6] = 0x00D6,
+  [0xD7] = 0x0168,
+  [0xD8] = 0x00D8,
+  [0xD9] = 0x0172,
+  [0xDA] = 0x00DA,
+  [0xDB] = 0x00DB,
+  [0xDC] = 0x00DC,
+  [0xDD] = 0x00DD,
+  [0xDE] = 0x00DE,
+  [0xDF] = 0x00DF,
+  [0xE0] = 0x0101,
+  [0xE1] = 0x00E1,
+  [0xE2] = 0x00E2,
+  [0xE3] = 0x00E3,
+  [0xE4] = 0x00E4,
+  [0xE5] = 0x00E5,
+  [0xE6] = 0x00E6,
+  [0xE7] = 0x012F,
+  [0xE8] = 0x010D,
+  [0xE9] = 0x00E9,
+  [0xEA] = 0x0119,
+  [0xEB] = 0x00EB,
+  [0xEC] = 0x0117,
+  [0xED] = 0x00ED,
+  [0xEE] = 0x00EE,
+  [0xEF] = 0x00EF,
+  [0xF0] = 0x00F0,
+  [0xF1] = 0x0146,
+  [0xF2] = 0x014D,
+  [0xF3] = 0x00F3,
+  [0xF4] = 0x00F4,
+  [0xF5] = 0x00F5,
+  [0xF6] = 0x00F6,
+  [0xF7] = 0x0169,
+  [0xF8] = 0x00F8,
+  [0xF9] = 0x0173,
+  [0xFA] = 0x00FA,
+  [0xFB] = 0x00FB,
+  [0xFC] = 0x00FC,
+  [0xFD] = 0x00FD,
+  [0xFE] = 0x00FE,
+  [0xFF] = 0x0138,
+};
+static const char from_ucs4[] = {
+  [0x0000] = 0x00,
+  [0x0001] = 0x01,
+  [0x0002] = 0x02,
+  [0x0003] = 0x03,
+  [0x0004] = 0x04,
+  [0x0005] = 0x05,
+  [0x0006] = 0x06,
+  [0x0007] = 0x07,
+  [0x0008] = 0x08,
+  [0x0009] = 0x09,
+  [0x000A] = 0x0A,
+  [0x000B] = 0x0B,
+  [0x000C] = 0x0C,
+  [0x000D] = 0x0D,
+  [0x000E] = 0x0E,
+  [0x000F] = 0x0F,
+  [0x0010] = 0x10,
+  [0x0011] = 0x11,
+  [0x0012] = 0x12,
+  [0x0013] = 0x13,
+  [0x0014] = 0x14,
+  [0x0015] = 0x15,
+  [0x0016] = 0x16,
+  [0x0017] = 0x17,
+  [0x0018] = 0x18,
+  [0x0019] = 0x19,
+  [0x001A] = 0x1A,
+  [0x001B] = 0x1B,
+  [0x001C] = 0x1C,
+  [0x001D] = 0x1D,
+  [0x001E] = 0x1E,
+  [0x001F] = 0x1F,
+  [0x0020] = 0x20,
+  [0x0021] = 0x21,
+  [0x0022] = 0x22,
+  [0x0023] = 0x23,
+  [0x0024] = 0x24,
+  [0x0025] = 0x25,
+  [0x0026] = 0x26,
+  [0x0027] = 0x27,
+  [0x0028] = 0x28,
+  [0x0029] = 0x29,
+  [0x002A] = 0x2A,
+  [0x002B] = 0x2B,
+  [0x002C] = 0x2C,
+  [0x002D] = 0x2D,
+  [0x002E] = 0x2E,
+  [0x002F] = 0x2F,
+  [0x0030] = 0x30,
+  [0x0031] = 0x31,
+  [0x0032] = 0x32,
+  [0x0033] = 0x33,
+  [0x0034] = 0x34,
+  [0x0035] = 0x35,
+  [0x0036] = 0x36,
+  [0x0037] = 0x37,
+  [0x0038] = 0x38,
+  [0x0039] = 0x39,
+  [0x003A] = 0x3A,
+  [0x003B] = 0x3B,
+  [0x003C] = 0x3C,
+  [0x003D] = 0x3D,
+  [0x003E] = 0x3E,
+  [0x003F] = 0x3F,
+  [0x0040] = 0x40,
+  [0x0041] = 0x41,
+  [0x0042] = 0x42,
+  [0x0043] = 0x43,
+  [0x0044] = 0x44,
+  [0x0045] = 0x45,
+  [0x0046] = 0x46,
+  [0x0047] = 0x47,
+  [0x0048] = 0x48,
+  [0x0049] = 0x49,
+  [0x004A] = 0x4A,
+  [0x004B] = 0x4B,
+  [0x004C] = 0x4C,
+  [0x004D] = 0x4D,
+  [0x004E] = 0x4E,
+  [0x004F] = 0x4F,
+  [0x0050] = 0x50,
+  [0x0051] = 0x51,
+  [0x0052] = 0x52,
+  [0x0053] = 0x53,
+  [0x0054] = 0x54,
+  [0x0055] = 0x55,
+  [0x0056] = 0x56,
+  [0x0057] = 0x57,
+  [0x0058] = 0x58,
+  [0x0059] = 0x59,
+  [0x005A] = 0x5A,
+  [0x005B] = 0x5B,
+  [0x005C] = 0x5C,
+  [0x005D] = 0x5D,
+  [0x005E] = 0x5E,
+  [0x005F] = 0x5F,
+  [0x0060] = 0x60,
+  [0x0061] = 0x61,
+  [0x0062] = 0x62,
+  [0x0063] = 0x63,
+  [0x0064] = 0x64,
+  [0x0065] = 0x65,
+  [0x0066] = 0x66,
+  [0x0067] = 0x67,
+  [0x0068] = 0x68,
+  [0x0069] = 0x69,
+  [0x006A] = 0x6A,
+  [0x006B] = 0x6B,
+  [0x006C] = 0x6C,
+  [0x006D] = 0x6D,
+  [0x006E] = 0x6E,
+  [0x006F] = 0x6F,
+  [0x0070] = 0x70,
+  [0x0071] = 0x71,
+  [0x0072] = 0x72,
+  [0x0073] = 0x73,
+  [0x0074] = 0x74,
+  [0x0075] = 0x75,
+  [0x0076] = 0x76,
+  [0x0077] = 0x77,
+  [0x0078] = 0x78,
+  [0x0079] = 0x79,
+  [0x007A] = 0x7A,
+  [0x007B] = 0x7B,
+  [0x007C] = 0x7C,
+  [0x007D] = 0x7D,
+  [0x007E] = 0x7E,
+  [0x007F] = 0x7F,
+  [0x0080] = 0x80,
+  [0x0081] = 0x81,
+  [0x0082] = 0x82,
+  [0x0083] = 0x83,
+  [0x0084] = 0x84,
+  [0x0085] = 0x85,
+  [0x0086] = 0x86,
+  [0x0087] = 0x87,
+  [0x0088] = 0x88,
+  [0x0089] = 0x89,
+  [0x008A] = 0x8A,
+  [0x008B] = 0x8B,
+  [0x008C] = 0x8C,
+  [0x008D] = 0x8D,
+  [0x008E] = 0x8E,
+  [0x008F] = 0x8F,
+  [0x0090] = 0x90,
+  [0x0091] = 0x91,
+  [0x0092] = 0x92,
+  [0x0093] = 0x93,
+  [0x0094] = 0x94,
+  [0x0095] = 0x95,
+  [0x0096] = 0x96,
+  [0x0097] = 0x97,
+  [0x0098] = 0x98,
+  [0x0099] = 0x99,
+  [0x009A] = 0x9A,
+  [0x009B] = 0x9B,
+  [0x009C] = 0x9C,
+  [0x009D] = 0x9D,
+  [0x009E] = 0x9E,
+  [0x009F] = 0x9F,
+  [0x00A0] = 0xA0,
+  [0x00A7] = 0xA7,
+  [0x00AD] = 0xAD,
+  [0x00B0] = 0xB0,
+  [0x00B7] = 0xB7,
+  [0x00C1] = 0xC1,
+  [0x00C2] = 0xC2,
+  [0x00C3] = 0xC3,
+  [0x00C4] = 0xC4,
+  [0x00C5] = 0xC5,
+  [0x00C6] = 0xC6,
+  [0x00C9] = 0xC9,
+  [0x00CB] = 0xCB,
+  [0x00CD] = 0xCD,
+  [0x00CE] = 0xCE,
+  [0x00CF] = 0xCF,
+  [0x00D0] = 0xD0,
+  [0x00D3] = 0xD3,
+  [0x00D4] = 0xD4,
+  [0x00D5] = 0xD5,
+  [0x00D6] = 0xD6,
+  [0x00D8] = 0xD8,
+  [0x00DA] = 0xDA,
+  [0x00DB] = 0xDB,
+  [0x00DC] = 0xDC,
+  [0x00DD] = 0xDD,
+  [0x00DE] = 0xDE,
+  [0x00DF] = 0xDF,
+  [0x00E1] = 0xE1,
+  [0x00E2] = 0xE2,
+  [0x00E3] = 0xE3,
+  [0x00E4] = 0xE4,
+  [0x00E5] = 0xE5,
+  [0x00E6] = 0xE6,
+  [0x00E9] = 0xE9,
+  [0x00EB] = 0xEB,
+  [0x00ED] = 0xED,
+  [0x00EE] = 0xEE,
+  [0x00EF] = 0xEF,
+  [0x00F0] = 0xF0,
+  [0x00F3] = 0xF3,
+  [0x00F4] = 0xF4,
+  [0x00F5] = 0xF5,
+  [0x00F6] = 0xF6,
+  [0x00F8] = 0xF8,
+  [0x00FA] = 0xFA,
+  [0x00FB] = 0xFB,
+  [0x00FC] = 0xFC,
+  [0x00FD] = 0xFD,
+  [0x00FE] = 0xFE,
+  [0x0100] = 0xC0,
+  [0x0101] = 0xE0,
+  [0x0104] = 0xA1,
+  [0x0105] = 0xB1,
+  [0x010C] = 0xC8,
+  [0x010D] = 0xE8,
+  [0x0110] = 0xA9,
+  [0x0111] = 0xB9,
+  [0x0112] = 0xA2,
+  [0x0113] = 0xB2,
+  [0x0116] = 0xCC,
+  [0x0117] = 0xEC,
+  [0x0118] = 0xCA,
+  [0x0119] = 0xEA,
+  [0x0122] = 0xA3,
+  [0x0123] = 0xB3,
+  [0x0128] = 0xA5,
+  [0x0129] = 0xB5,
+  [0x012A] = 0xA4,
+  [0x012B] = 0xB4,
+  [0x012E] = 0xC7,
+  [0x012F] = 0xE7,
+  [0x0136] = 0xA6,
+  [0x0137] = 0xB6,
+  [0x0138] = 0xFF,
+  [0x013B] = 0xA8,
+  [0x013C] = 0xB8,
+  [0x0145] = 0xD1,
+  [0x0146] = 0xF1,
+  [0x014A] = 0xAF,
+  [0x014B] = 0xBF,
+  [0x014C] = 0xD2,
+  [0x014D] = 0xF2,
+  [0x0160] = 0xAA,
+  [0x0161] = 0xBA,
+  [0x0166] = 0xAB,
+  [0x0167] = 0xBB,
+  [0x0168] = 0xD7,
+  [0x0169] = 0xF7,
+  [0x016A] = 0xAE,
+  [0x016B] = 0xBE,
+  [0x0172] = 0xD9,
+  [0x0173] = 0xF9,
+  [0x017D] = 0xAC,
+  [0x017E] = 0xBC,
+  [0x2014] = 0xBD,
+};
diff --git a/iconvdata/iso8859-2.c b/iconvdata/iso8859-2.c
new file mode 100644
index 0000000000..3bfc77b894
--- /dev/null
+++ b/iconvdata/iso8859-2.c
@@ -0,0 +1,24 @@
+/* Conversion from and to ISO 8859-2.
+   Copyright (C) 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@cygnus.com>, 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
+   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 <wchar.h>
+#include <iso8859-2.h>
+#define NAME "ISO-8859-2"
+#include <iso8859-generic.c>
diff --git a/iconvdata/iso8859-2.h b/iconvdata/iso8859-2.h
new file mode 100644
index 0000000000..515d8490d6
--- /dev/null
+++ b/iconvdata/iso8859-2.h
@@ -0,0 +1,516 @@
+static const wchar_t to_ucs4[256] = {
+  [0x00] = 0x0000,
+  [0x01] = 0x0001,
+  [0x02] = 0x0002,
+  [0x03] = 0x0003,
+  [0x04] = 0x0004,
+  [0x05] = 0x0005,
+  [0x06] = 0x0006,
+  [0x07] = 0x0007,
+  [0x08] = 0x0008,
+  [0x09] = 0x0009,
+  [0x0A] = 0x000A,
+  [0x0B] = 0x000B,
+  [0x0C] = 0x000C,
+  [0x0D] = 0x000D,
+  [0x0E] = 0x000E,
+  [0x0F] = 0x000F,
+  [0x10] = 0x0010,
+  [0x11] = 0x0011,
+  [0x12] = 0x0012,
+  [0x13] = 0x0013,
+  [0x14] = 0x0014,
+  [0x15] = 0x0015,
+  [0x16] = 0x0016,
+  [0x17] = 0x0017,
+  [0x18] = 0x0018,
+  [0x19] = 0x0019,
+  [0x1A] = 0x001A,
+  [0x1B] = 0x001B,
+  [0x1C] = 0x001C,
+  [0x1D] = 0x001D,
+  [0x1E] = 0x001E,
+  [0x1F] = 0x001F,
+  [0x20] = 0x0020,
+  [0x21] = 0x0021,
+  [0x22] = 0x0022,
+  [0x23] = 0x0023,
+  [0x24] = 0x0024,
+  [0x25] = 0x0025,
+  [0x26] = 0x0026,
+  [0x27] = 0x0027,
+  [0x28] = 0x0028,
+  [0x29] = 0x0029,
+  [0x2A] = 0x002A,
+  [0x2B] = 0x002B,
+  [0x2C] = 0x002C,
+  [0x2D] = 0x002D,
+  [0x2E] = 0x002E,
+  [0x2F] = 0x002F,
+  [0x30] = 0x0030,
+  [0x31] = 0x0031,
+  [0x32] = 0x0032,
+  [0x33] = 0x0033,
+  [0x34] = 0x0034,
+  [0x35] = 0x0035,
+  [0x36] = 0x0036,
+  [0x37] = 0x0037,
+  [0x38] = 0x0038,
+  [0x39] = 0x0039,
+  [0x3A] = 0x003A,
+  [0x3B] = 0x003B,
+  [0x3C] = 0x003C,
+  [0x3D] = 0x003D,
+  [0x3E] = 0x003E,
+  [0x3F] = 0x003F,
+  [0x40] = 0x0040,
+  [0x41] = 0x0041,
+  [0x42] = 0x0042,
+  [0x43] = 0x0043,
+  [0x44] = 0x0044,
+  [0x45] = 0x0045,
+  [0x46] = 0x0046,
+  [0x47] = 0x0047,
+  [0x48] = 0x0048,
+  [0x49] = 0x0049,
+  [0x4A] = 0x004A,
+  [0x4B] = 0x004B,
+  [0x4C] = 0x004C,
+  [0x4D] = 0x004D,
+  [0x4E] = 0x004E,
+  [0x4F] = 0x004F,
+  [0x50] = 0x0050,
+  [0x51] = 0x0051,
+  [0x52] = 0x0052,
+  [0x53] = 0x0053,
+  [0x54] = 0x0054,
+  [0x55] = 0x0055,
+  [0x56] = 0x0056,
+  [0x57] = 0x0057,
+  [0x58] = 0x0058,
+  [0x59] = 0x0059,
+  [0x5A] = 0x005A,
+  [0x5B] = 0x005B,
+  [0x5C] = 0x005C,
+  [0x5D] = 0x005D,
+  [0x5E] = 0x005E,
+  [0x5F] = 0x005F,
+  [0x60] = 0x0060,
+  [0x61] = 0x0061,
+  [0x62] = 0x0062,
+  [0x63] = 0x0063,
+  [0x64] = 0x0064,
+  [0x65] = 0x0065,
+  [0x66] = 0x0066,
+  [0x67] = 0x0067,
+  [0x68] = 0x0068,
+  [0x69] = 0x0069,
+  [0x6A] = 0x006A,
+  [0x6B] = 0x006B,
+  [0x6C] = 0x006C,
+  [0x6D] = 0x006D,
+  [0x6E] = 0x006E,
+  [0x6F] = 0x006F,
+  [0x70] = 0x0070,
+  [0x71] = 0x0071,
+  [0x72] = 0x0072,
+  [0x73] = 0x0073,
+  [0x74] = 0x0074,
+  [0x75] = 0x0075,
+  [0x76] = 0x0076,
+  [0x77] = 0x0077,
+  [0x78] = 0x0078,
+  [0x79] = 0x0079,
+  [0x7A] = 0x007A,
+  [0x7B] = 0x007B,
+  [0x7C] = 0x007C,
+  [0x7D] = 0x007D,
+  [0x7E] = 0x007E,
+  [0x7F] = 0x007F,
+  [0x80] = 0x0080,
+  [0x81] = 0x0081,
+  [0x82] = 0x0082,
+  [0x83] = 0x0083,
+  [0x84] = 0x0084,
+  [0x85] = 0x0085,
+  [0x86] = 0x0086,
+  [0x87] = 0x0087,
+  [0x88] = 0x0088,
+  [0x89] = 0x0089,
+  [0x8A] = 0x008A,
+  [0x8B] = 0x008B,
+  [0x8C] = 0x008C,
+  [0x8D] = 0x008D,
+  [0x8E] = 0x008E,
+  [0x8F] = 0x008F,
+  [0x90] = 0x0090,
+  [0x91] = 0x0091,
+  [0x92] = 0x0092,
+  [0x93] = 0x0093,
+  [0x94] = 0x0094,
+  [0x95] = 0x0095,
+  [0x96] = 0x0096,
+  [0x97] = 0x0097,
+  [0x98] = 0x0098,
+  [0x99] = 0x0099,
+  [0x9A] = 0x009A,
+  [0x9B] = 0x009B,
+  [0x9C] = 0x009C,
+  [0x9D] = 0x009D,
+  [0x9E] = 0x009E,
+  [0x9F] = 0x009F,
+  [0xA0] = 0x00A0,
+  [0xA1] = 0x0104,
+  [0xA2] = 0x02D8,
+  [0xA3] = 0x0141,
+  [0xA4] = 0x00A4,
+  [0xA5] = 0x013D,
+  [0xA6] = 0x015A,
+  [0xA7] = 0x00A7,
+  [0xA8] = 0x00A8,
+  [0xA9] = 0x0160,
+  [0xAA] = 0x015E,
+  [0xAB] = 0x0164,
+  [0xAC] = 0x0179,
+  [0xAD] = 0x00AD,
+  [0xAE] = 0x017D,
+  [0xAF] = 0x017B,
+  [0xB0] = 0x00B0,
+  [0xB1] = 0x0105,
+  [0xB2] = 0x02DB,
+  [0xB3] = 0x0142,
+  [0xB4] = 0x00B4,
+  [0xB5] = 0x013E,
+  [0xB6] = 0x015B,
+  [0xB7] = 0x02C7,
+  [0xB8] = 0x00B8,
+  [0xB9] = 0x0161,
+  [0xBA] = 0x015F,
+  [0xBB] = 0x0165,
+  [0xBC] = 0x017A,
+  [0xBD] = 0x02DD,
+  [0xBE] = 0x017E,
+  [0xBF] = 0x017C,
+  [0xC0] = 0x0154,
+  [0xC1] = 0x00C1,
+  [0xC2] = 0x00C2,
+  [0xC3] = 0x0102,
+  [0xC4] = 0x00C4,
+  [0xC5] = 0x0139,
+  [0xC6] = 0x0106,
+  [0xC7] = 0x00C7,
+  [0xC8] = 0x010C,
+  [0xC9] = 0x00C9,
+  [0xCA] = 0x0118,
+  [0xCB] = 0x00CB,
+  [0xCC] = 0x011A,
+  [0xCD] = 0x00CD,
+  [0xCE] = 0x00CE,
+  [0xCF] = 0x010E,
+  [0xD0] = 0x0110,
+  [0xD1] = 0x0143,
+  [0xD2] = 0x0147,
+  [0xD3] = 0x00D3,
+  [0xD4] = 0x00D4,
+  [0xD5] = 0x0150,
+  [0xD6] = 0x00D6,
+  [0xD7] = 0x00D7,
+  [0xD8] = 0x0158,
+  [0xD9] = 0x016E,
+  [0xDA] = 0x00DA,
+  [0xDB] = 0x0170,
+  [0xDC] = 0x00DC,
+  [0xDD] = 0x00DD,
+  [0xDE] = 0x0162,
+  [0xDF] = 0x00DF,
+  [0xE0] = 0x0155,
+  [0xE1] = 0x00E1,
+  [0xE2] = 0x00E2,
+  [0xE3] = 0x0103,
+  [0xE4] = 0x00E4,
+  [0xE5] = 0x013A,
+  [0xE6] = 0x0107,
+  [0xE7] = 0x00E7,
+  [0xE8] = 0x010D,
+  [0xE9] = 0x00E9,
+  [0xEA] = 0x0119,
+  [0xEB] = 0x00EB,
+  [0xEC] = 0x011B,
+  [0xED] = 0x00ED,
+  [0xEE] = 0x00EE,
+  [0xEF] = 0x010F,
+  [0xF0] = 0x0111,
+  [0xF1] = 0x0144,
+  [0xF2] = 0x0148,
+  [0xF3] = 0x00F3,
+  [0xF4] = 0x00F4,
+  [0xF5] = 0x0151,
+  [0xF6] = 0x00F6,
+  [0xF7] = 0x00F7,
+  [0xF8] = 0x0159,
+  [0xF9] = 0x016F,
+  [0xFA] = 0x00FA,
+  [0xFB] = 0x0171,
+  [0xFC] = 0x00FC,
+  [0xFD] = 0x00FD,
+  [0xFE] = 0x0163,
+  [0xFF] = 0x02D9,
+};
+static const char from_ucs4[] = {
+  [0x0000] = 0x00,
+  [0x0001] = 0x01,
+  [0x0002] = 0x02,
+  [0x0003] = 0x03,
+  [0x0004] = 0x04,
+  [0x0005] = 0x05,
+  [0x0006] = 0x06,
+  [0x0007] = 0x07,
+  [0x0008] = 0x08,
+  [0x0009] = 0x09,
+  [0x000A] = 0x0A,
+  [0x000B] = 0x0B,
+  [0x000C] = 0x0C,
+  [0x000D] = 0x0D,
+  [0x000E] = 0x0E,
+  [0x000F] = 0x0F,
+  [0x0010] = 0x10,
+  [0x0011] = 0x11,
+  [0x0012] = 0x12,
+  [0x0013] = 0x13,
+  [0x0014] = 0x14,
+  [0x0015] = 0x15,
+  [0x0016] = 0x16,
+  [0x0017] = 0x17,
+  [0x0018] = 0x18,
+  [0x0019] = 0x19,
+  [0x001A] = 0x1A,
+  [0x001B] = 0x1B,
+  [0x001C] = 0x1C,
+  [0x001D] = 0x1D,
+  [0x001E] = 0x1E,
+  [0x001F] = 0x1F,
+  [0x0020] = 0x20,
+  [0x0021] = 0x21,
+  [0x0022] = 0x22,
+  [0x0023] = 0x23,
+  [0x0024] = 0x24,
+  [0x0025] = 0x25,
+  [0x0026] = 0x26,
+  [0x0027] = 0x27,
+  [0x0028] = 0x28,
+  [0x0029] = 0x29,
+  [0x002A] = 0x2A,
+  [0x002B] = 0x2B,
+  [0x002C] = 0x2C,
+  [0x002D] = 0x2D,
+  [0x002E] = 0x2E,
+  [0x002F] = 0x2F,
+  [0x0030] = 0x30,
+  [0x0031] = 0x31,
+  [0x0032] = 0x32,
+  [0x0033] = 0x33,
+  [0x0034] = 0x34,
+  [0x0035] = 0x35,
+  [0x0036] = 0x36,
+  [0x0037] = 0x37,
+  [0x0038] = 0x38,
+  [0x0039] = 0x39,
+  [0x003A] = 0x3A,
+  [0x003B] = 0x3B,
+  [0x003C] = 0x3C,
+  [0x003D] = 0x3D,
+  [0x003E] = 0x3E,
+  [0x003F] = 0x3F,
+  [0x0040] = 0x40,
+  [0x0041] = 0x41,
+  [0x0042] = 0x42,
+  [0x0043] = 0x43,
+  [0x0044] = 0x44,
+  [0x0045] = 0x45,
+  [0x0046] = 0x46,
+  [0x0047] = 0x47,
+  [0x0048] = 0x48,
+  [0x0049] = 0x49,
+  [0x004A] = 0x4A,
+  [0x004B] = 0x4B,
+  [0x004C] = 0x4C,
+  [0x004D] = 0x4D,
+  [0x004E] = 0x4E,
+  [0x004F] = 0x4F,
+  [0x0050] = 0x50,
+  [0x0051] = 0x51,
+  [0x0052] = 0x52,
+  [0x0053] = 0x53,
+  [0x0054] = 0x54,
+  [0x0055] = 0x55,
+  [0x0056] = 0x56,
+  [0x0057] = 0x57,
+  [0x0058] = 0x58,
+  [0x0059] = 0x59,
+  [0x005A] = 0x5A,
+  [0x005B] = 0x5B,
+  [0x005C] = 0x5C,
+  [0x005D] = 0x5D,
+  [0x005E] = 0x5E,
+  [0x005F] = 0x5F,
+  [0x0060] = 0x60,
+  [0x0061] = 0x61,
+  [0x0062] = 0x62,
+  [0x0063] = 0x63,
+  [0x0064] = 0x64,
+  [0x0065] = 0x65,
+  [0x0066] = 0x66,
+  [0x0067] = 0x67,
+  [0x0068] = 0x68,
+  [0x0069] = 0x69,
+  [0x006A] = 0x6A,
+  [0x006B] = 0x6B,
+  [0x006C] = 0x6C,
+  [0x006D] = 0x6D,
+  [0x006E] = 0x6E,
+  [0x006F] = 0x6F,
+  [0x0070] = 0x70,
+  [0x0071] = 0x71,
+  [0x0072] = 0x72,
+  [0x0073] = 0x73,
+  [0x0074] = 0x74,
+  [0x0075] = 0x75,
+  [0x0076] = 0x76,
+  [0x0077] = 0x77,
+  [0x0078] = 0x78,
+  [0x0079] = 0x79,
+  [0x007A] = 0x7A,
+  [0x007B] = 0x7B,
+  [0x007C] = 0x7C,
+  [0x007D] = 0x7D,
+  [0x007E] = 0x7E,
+  [0x007F] = 0x7F,
+  [0x0080] = 0x80,
+  [0x0081] = 0x81,
+  [0x0082] = 0x82,
+  [0x0083] = 0x83,
+  [0x0084] = 0x84,
+  [0x0085] = 0x85,
+  [0x0086] = 0x86,
+  [0x0087] = 0x87,
+  [0x0088] = 0x88,
+  [0x0089] = 0x89,
+  [0x008A] = 0x8A,
+  [0x008B] = 0x8B,
+  [0x008C] = 0x8C,
+  [0x008D] = 0x8D,
+  [0x008E] = 0x8E,
+  [0x008F] = 0x8F,
+  [0x0090] = 0x90,
+  [0x0091] = 0x91,
+  [0x0092] = 0x92,
+  [0x0093] = 0x93,
+  [0x0094] = 0x94,
+  [0x0095] = 0x95,
+  [0x0096] = 0x96,
+  [0x0097] = 0x97,
+  [0x0098] = 0x98,
+  [0x0099] = 0x99,
+  [0x009A] = 0x9A,
+  [0x009B] = 0x9B,
+  [0x009C] = 0x9C,
+  [0x009D] = 0x9D,
+  [0x009E] = 0x9E,
+  [0x009F] = 0x9F,
+  [0x00A0] = 0xA0,
+  [0x00A4] = 0xA4,
+  [0x00A7] = 0xA7,
+  [0x00A8] = 0xA8,
+  [0x00AD] = 0xAD,
+  [0x00B0] = 0xB0,
+  [0x00B4] = 0xB4,
+  [0x00B8] = 0xB8,
+  [0x00C1] = 0xC1,
+  [0x00C2] = 0xC2,
+  [0x00C4] = 0xC4,
+  [0x00C7] = 0xC7,
+  [0x00C9] = 0xC9,
+  [0x00CB] = 0xCB,
+  [0x00CD] = 0xCD,
+  [0x00CE] = 0xCE,
+  [0x00D3] = 0xD3,
+  [0x00D4] = 0xD4,
+  [0x00D6] = 0xD6,
+  [0x00D7] = 0xD7,
+  [0x00DA] = 0xDA,
+  [0x00DC] = 0xDC,
+  [0x00DD] = 0xDD,
+  [0x00DF] = 0xDF,
+  [0x00E1] = 0xE1,
+  [0x00E2] = 0xE2,
+  [0x00E4] = 0xE4,
+  [0x00E7] = 0xE7,
+  [0x00E9] = 0xE9,
+  [0x00EB] = 0xEB,
+  [0x00ED] = 0xED,
+  [0x00EE] = 0xEE,
+  [0x00F3] = 0xF3,
+  [0x00F4] = 0xF4,
+  [0x00F6] = 0xF6,
+  [0x00F7] = 0xF7,
+  [0x00FA] = 0xFA,
+  [0x00FC] = 0xFC,
+  [0x00FD] = 0xFD,
+  [0x0102] = 0xC3,
+  [0x0103] = 0xE3,
+  [0x0104] = 0xA1,
+  [0x0105] = 0xB1,
+  [0x0106] = 0xC6,
+  [0x0107] = 0xE6,
+  [0x010C] = 0xC8,
+  [0x010D] = 0xE8,
+  [0x010E] = 0xCF,
+  [0x010F] = 0xEF,
+  [0x0110] = 0xD0,
+  [0x0111] = 0xF0,
+  [0x0118] = 0xCA,
+  [0x0119] = 0xEA,
+  [0x011A] = 0xCC,
+  [0x011B] = 0xEC,
+  [0x0139] = 0xC5,
+  [0x013A] = 0xE5,
+  [0x013D] = 0xA5,
+  [0x013E] = 0xB5,
+  [0x0141] = 0xA3,
+  [0x0142] = 0xB3,
+  [0x0143] = 0xD1,
+  [0x0144] = 0xF1,
+  [0x0147] = 0xD2,
+  [0x0148] = 0xF2,
+  [0x0150] = 0xD5,
+  [0x0151] = 0xF5,
+  [0x0154] = 0xC0,
+  [0x0155] = 0xE0,
+  [0x0158] = 0xD8,
+  [0x0159] = 0xF8,
+  [0x015A] = 0xA6,
+  [0x015B] = 0xB6,
+  [0x015E] = 0xAA,
+  [0x015F] = 0xBA,
+  [0x0160] = 0xA9,
+  [0x0161] = 0xB9,
+  [0x0162] = 0xDE,
+  [0x0163] = 0xFE,
+  [0x0164] = 0xAB,
+  [0x0165] = 0xBB,
+  [0x016E] = 0xD9,
+  [0x016F] = 0xF9,
+  [0x0170] = 0xDB,
+  [0x0171] = 0xFB,
+  [0x0179] = 0xAC,
+  [0x017A] = 0xBC,
+  [0x017B] = 0xAF,
+  [0x017C] = 0xBF,
+  [0x017D] = 0xAE,
+  [0x017E] = 0xBE,
+  [0x02C7] = 0xB7,
+  [0x02D8] = 0xA2,
+  [0x02D9] = 0xFF,
+  [0x02DB] = 0xB2,
+  [0x02DD] = 0xBD,
+};
diff --git a/iconvdata/iso8859-3.c b/iconvdata/iso8859-3.c
new file mode 100644
index 0000000000..a6b208dc81
--- /dev/null
+++ b/iconvdata/iso8859-3.c
@@ -0,0 +1,24 @@
+/* Conversion from and to ISO 8859-3.
+   Copyright (C) 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@cygnus.com>, 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
+   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 <wchar.h>
+#include <iso8859-3.h>
+#define NAME "ISO-8859-3"
+#include <iso8859-generic.c>
diff --git a/iconvdata/iso8859-3.h b/iconvdata/iso8859-3.h
new file mode 100644
index 0000000000..f9e632504b
--- /dev/null
+++ b/iconvdata/iso8859-3.h
@@ -0,0 +1,502 @@
+static const wchar_t to_ucs4[256] = {
+  [0x00] = 0x0000,
+  [0x01] = 0x0001,
+  [0x02] = 0x0002,
+  [0x03] = 0x0003,
+  [0x04] = 0x0004,
+  [0x05] = 0x0005,
+  [0x06] = 0x0006,
+  [0x07] = 0x0007,
+  [0x08] = 0x0008,
+  [0x09] = 0x0009,
+  [0x0A] = 0x000A,
+  [0x0B] = 0x000B,
+  [0x0C] = 0x000C,
+  [0x0D] = 0x000D,
+  [0x0E] = 0x000E,
+  [0x0F] = 0x000F,
+  [0x10] = 0x0010,
+  [0x11] = 0x0011,
+  [0x12] = 0x0012,
+  [0x13] = 0x0013,
+  [0x14] = 0x0014,
+  [0x15] = 0x0015,
+  [0x16] = 0x0016,
+  [0x17] = 0x0017,
+  [0x18] = 0x0018,
+  [0x19] = 0x0019,
+  [0x1A] = 0x001A,
+  [0x1B] = 0x001B,
+  [0x1C] = 0x001C,
+  [0x1D] = 0x001D,
+  [0x1E] = 0x001E,
+  [0x1F] = 0x001F,
+  [0x20] = 0x0020,
+  [0x21] = 0x0021,
+  [0x22] = 0x0022,
+  [0x23] = 0x0023,
+  [0x24] = 0x0024,
+  [0x25] = 0x0025,
+  [0x26] = 0x0026,
+  [0x27] = 0x0027,
+  [0x28] = 0x0028,
+  [0x29] = 0x0029,
+  [0x2A] = 0x002A,
+  [0x2B] = 0x002B,
+  [0x2C] = 0x002C,
+  [0x2D] = 0x002D,
+  [0x2E] = 0x002E,
+  [0x2F] = 0x002F,
+  [0x30] = 0x0030,
+  [0x31] = 0x0031,
+  [0x32] = 0x0032,
+  [0x33] = 0x0033,
+  [0x34] = 0x0034,
+  [0x35] = 0x0035,
+  [0x36] = 0x0036,
+  [0x37] = 0x0037,
+  [0x38] = 0x0038,
+  [0x39] = 0x0039,
+  [0x3A] = 0x003A,
+  [0x3B] = 0x003B,
+  [0x3C] = 0x003C,
+  [0x3D] = 0x003D,
+  [0x3E] = 0x003E,
+  [0x3F] = 0x003F,
+  [0x40] = 0x0040,
+  [0x41] = 0x0041,
+  [0x42] = 0x0042,
+  [0x43] = 0x0043,
+  [0x44] = 0x0044,
+  [0x45] = 0x0045,
+  [0x46] = 0x0046,
+  [0x47] = 0x0047,
+  [0x48] = 0x0048,
+  [0x49] = 0x0049,
+  [0x4A] = 0x004A,
+  [0x4B] = 0x004B,
+  [0x4C] = 0x004C,
+  [0x4D] = 0x004D,
+  [0x4E] = 0x004E,
+  [0x4F] = 0x004F,
+  [0x50] = 0x0050,
+  [0x51] = 0x0051,
+  [0x52] = 0x0052,
+  [0x53] = 0x0053,
+  [0x54] = 0x0054,
+  [0x55] = 0x0055,
+  [0x56] = 0x0056,
+  [0x57] = 0x0057,
+  [0x58] = 0x0058,
+  [0x59] = 0x0059,
+  [0x5A] = 0x005A,
+  [0x5B] = 0x005B,
+  [0x5C] = 0x005C,
+  [0x5D] = 0x005D,
+  [0x5E] = 0x005E,
+  [0x5F] = 0x005F,
+  [0x60] = 0x0060,
+  [0x61] = 0x0061,
+  [0x62] = 0x0062,
+  [0x63] = 0x0063,
+  [0x64] = 0x0064,
+  [0x65] = 0x0065,
+  [0x66] = 0x0066,
+  [0x67] = 0x0067,
+  [0x68] = 0x0068,
+  [0x69] = 0x0069,
+  [0x6A] = 0x006A,
+  [0x6B] = 0x006B,
+  [0x6C] = 0x006C,
+  [0x6D] = 0x006D,
+  [0x6E] = 0x006E,
+  [0x6F] = 0x006F,
+  [0x70] = 0x0070,
+  [0x71] = 0x0071,
+  [0x72] = 0x0072,
+  [0x73] = 0x0073,
+  [0x74] = 0x0074,
+  [0x75] = 0x0075,
+  [0x76] = 0x0076,
+  [0x77] = 0x0077,
+  [0x78] = 0x0078,
+  [0x79] = 0x0079,
+  [0x7A] = 0x007A,
+  [0x7B] = 0x007B,
+  [0x7C] = 0x007C,
+  [0x7D] = 0x007D,
+  [0x7E] = 0x007E,
+  [0x7F] = 0x007F,
+  [0x80] = 0x0080,
+  [0x81] = 0x0081,
+  [0x82] = 0x0082,
+  [0x83] = 0x0083,
+  [0x84] = 0x0084,
+  [0x85] = 0x0085,
+  [0x86] = 0x0086,
+  [0x87] = 0x0087,
+  [0x88] = 0x0088,
+  [0x89] = 0x0089,
+  [0x8A] = 0x008A,
+  [0x8B] = 0x008B,
+  [0x8C] = 0x008C,
+  [0x8D] = 0x008D,
+  [0x8E] = 0x008E,
+  [0x8F] = 0x008F,
+  [0x90] = 0x0090,
+  [0x91] = 0x0091,
+  [0x92] = 0x0092,
+  [0x93] = 0x0093,
+  [0x94] = 0x0094,
+  [0x95] = 0x0095,
+  [0x96] = 0x0096,
+  [0x97] = 0x0097,
+  [0x98] = 0x0098,
+  [0x99] = 0x0099,
+  [0x9A] = 0x009A,
+  [0x9B] = 0x009B,
+  [0x9C] = 0x009C,
+  [0x9D] = 0x009D,
+  [0x9E] = 0x009E,
+  [0x9F] = 0x009F,
+  [0xA0] = 0x00A0,
+  [0xA1] = 0x0126,
+  [0xA2] = 0x02D8,
+  [0xA3] = 0x00A3,
+  [0xA4] = 0x00A4,
+  [0xA6] = 0x0124,
+  [0xA7] = 0x00A7,
+  [0xA8] = 0x00A8,
+  [0xA9] = 0x0130,
+  [0xAA] = 0x015E,
+  [0xAB] = 0x011E,
+  [0xAC] = 0x0134,
+  [0xAD] = 0x00AD,
+  [0xAF] = 0x017B,
+  [0xB0] = 0x00B0,
+  [0xB1] = 0x0127,
+  [0xB2] = 0x00B2,
+  [0xB3] = 0x00B3,
+  [0xB4] = 0x00B4,
+  [0xB5] = 0x00B5,
+  [0xB6] = 0x0125,
+  [0xB7] = 0x00B7,
+  [0xB8] = 0x00B8,
+  [0xB9] = 0x0131,
+  [0xBA] = 0x015F,
+  [0xBB] = 0x011F,
+  [0xBC] = 0x0135,
+  [0xBD] = 0x00BD,
+  [0xBF] = 0x017C,
+  [0xC0] = 0x00C0,
+  [0xC1] = 0x00C1,
+  [0xC2] = 0x00C2,
+  [0xC4] = 0x00C4,
+  [0xC5] = 0x010A,
+  [0xC6] = 0x0108,
+  [0xC7] = 0x00C7,
+  [0xC8] = 0x00C8,
+  [0xC9] = 0x00C9,
+  [0xCA] = 0x00CA,
+  [0xCB] = 0x00CB,
+  [0xCC] = 0x00CC,
+  [0xCD] = 0x00CD,
+  [0xCE] = 0x00CE,
+  [0xCF] = 0x00CF,
+  [0xD1] = 0x00D1,
+  [0xD2] = 0x00D2,
+  [0xD3] = 0x00D3,
+  [0xD4] = 0x00D4,
+  [0xD5] = 0x0120,
+  [0xD6] = 0x00D6,
+  [0xD7] = 0x00D7,
+  [0xD8] = 0x011C,
+  [0xD9] = 0x00D9,
+  [0xDA] = 0x00DA,
+  [0xDB] = 0x00DB,
+  [0xDC] = 0x00DC,
+  [0xDD] = 0x016C,
+  [0xDE] = 0x015C,
+  [0xDF] = 0x00DF,
+  [0xE0] = 0x00E0,
+  [0xE1] = 0x00E1,
+  [0xE2] = 0x00E2,
+  [0xE4] = 0x00E4,
+  [0xE5] = 0x010B,
+  [0xE6] = 0x0109,
+  [0xE7] = 0x00E7,
+  [0xE8] = 0x00E8,
+  [0xE9] = 0x00E9,
+  [0xEA] = 0x00EA,
+  [0xEB] = 0x00EB,
+  [0xEC] = 0x00EC,
+  [0xED] = 0x00ED,
+  [0xEE] = 0x00EE,
+  [0xEF] = 0x00EF,
+  [0xF1] = 0x00F1,
+  [0xF2] = 0x00F2,
+  [0xF3] = 0x00F3,
+  [0xF4] = 0x00F4,
+  [0xF5] = 0x0121,
+  [0xF6] = 0x00F6,
+  [0xF7] = 0x00F7,
+  [0xF8] = 0x011D,
+  [0xF9] = 0x00F9,
+  [0xFA] = 0x00FA,
+  [0xFB] = 0x00FB,
+  [0xFC] = 0x00FC,
+  [0xFD] = 0x016D,
+  [0xFE] = 0x015D,
+  [0xFF] = 0x02D9,
+};
+static const char from_ucs4[] = {
+  [0x0000] = 0x00,
+  [0x0001] = 0x01,
+  [0x0002] = 0x02,
+  [0x0003] = 0x03,
+  [0x0004] = 0x04,
+  [0x0005] = 0x05,
+  [0x0006] = 0x06,
+  [0x0007] = 0x07,
+  [0x0008] = 0x08,
+  [0x0009] = 0x09,
+  [0x000A] = 0x0A,
+  [0x000B] = 0x0B,
+  [0x000C] = 0x0C,
+  [0x000D] = 0x0D,
+  [0x000E] = 0x0E,
+  [0x000F] = 0x0F,
+  [0x0010] = 0x10,
+  [0x0011] = 0x11,
+  [0x0012] = 0x12,
+  [0x0013] = 0x13,
+  [0x0014] = 0x14,
+  [0x0015] = 0x15,
+  [0x0016] = 0x16,
+  [0x0017] = 0x17,
+  [0x0018] = 0x18,
+  [0x0019] = 0x19,
+  [0x001A] = 0x1A,
+  [0x001B] = 0x1B,
+  [0x001C] = 0x1C,
+  [0x001D] = 0x1D,
+  [0x001E] = 0x1E,
+  [0x001F] = 0x1F,
+  [0x0020] = 0x20,
+  [0x0021] = 0x21,
+  [0x0022] = 0x22,
+  [0x0023] = 0x23,
+  [0x0024] = 0x24,
+  [0x0025] = 0x25,
+  [0x0026] = 0x26,
+  [0x0027] = 0x27,
+  [0x0028] = 0x28,
+  [0x0029] = 0x29,
+  [0x002A] = 0x2A,
+  [0x002B] = 0x2B,
+  [0x002C] = 0x2C,
+  [0x002D] = 0x2D,
+  [0x002E] = 0x2E,
+  [0x002F] = 0x2F,
+  [0x0030] = 0x30,
+  [0x0031] = 0x31,
+  [0x0032] = 0x32,
+  [0x0033] = 0x33,
+  [0x0034] = 0x34,
+  [0x0035] = 0x35,
+  [0x0036] = 0x36,
+  [0x0037] = 0x37,
+  [0x0038] = 0x38,
+  [0x0039] = 0x39,
+  [0x003A] = 0x3A,
+  [0x003B] = 0x3B,
+  [0x003C] = 0x3C,
+  [0x003D] = 0x3D,
+  [0x003E] = 0x3E,
+  [0x003F] = 0x3F,
+  [0x0040] = 0x40,
+  [0x0041] = 0x41,
+  [0x0042] = 0x42,
+  [0x0043] = 0x43,
+  [0x0044] = 0x44,
+  [0x0045] = 0x45,
+  [0x0046] = 0x46,
+  [0x0047] = 0x47,
+  [0x0048] = 0x48,
+  [0x0049] = 0x49,
+  [0x004A] = 0x4A,
+  [0x004B] = 0x4B,
+  [0x004C] = 0x4C,
+  [0x004D] = 0x4D,
+  [0x004E] = 0x4E,
+  [0x004F] = 0x4F,
+  [0x0050] = 0x50,
+  [0x0051] = 0x51,
+  [0x0052] = 0x52,
+  [0x0053] = 0x53,
+  [0x0054] = 0x54,
+  [0x0055] = 0x55,
+  [0x0056] = 0x56,
+  [0x0057] = 0x57,
+  [0x0058] = 0x58,
+  [0x0059] = 0x59,
+  [0x005A] = 0x5A,
+  [0x005B] = 0x5B,
+  [0x005C] = 0x5C,
+  [0x005D] = 0x5D,
+  [0x005E] = 0x5E,
+  [0x005F] = 0x5F,
+  [0x0060] = 0x60,
+  [0x0061] = 0x61,
+  [0x0062] = 0x62,
+  [0x0063] = 0x63,
+  [0x0064] = 0x64,
+  [0x0065] = 0x65,
+  [0x0066] = 0x66,
+  [0x0067] = 0x67,
+  [0x0068] = 0x68,
+  [0x0069] = 0x69,
+  [0x006A] = 0x6A,
+  [0x006B] = 0x6B,
+  [0x006C] = 0x6C,
+  [0x006D] = 0x6D,
+  [0x006E] = 0x6E,
+  [0x006F] = 0x6F,
+  [0x0070] = 0x70,
+  [0x0071] = 0x71,
+  [0x0072] = 0x72,
+  [0x0073] = 0x73,
+  [0x0074] = 0x74,
+  [0x0075] = 0x75,
+  [0x0076] = 0x76,
+  [0x0077] = 0x77,
+  [0x0078] = 0x78,
+  [0x0079] = 0x79,
+  [0x007A] = 0x7A,
+  [0x007B] = 0x7B,
+  [0x007C] = 0x7C,
+  [0x007D] = 0x7D,
+  [0x007E] = 0x7E,
+  [0x007F] = 0x7F,
+  [0x0080] = 0x80,
+  [0x0081] = 0x81,
+  [0x0082] = 0x82,
+  [0x0083] = 0x83,
+  [0x0084] = 0x84,
+  [0x0085] = 0x85,
+  [0x0086] = 0x86,
+  [0x0087] = 0x87,
+  [0x0088] = 0x88,
+  [0x0089] = 0x89,
+  [0x008A] = 0x8A,
+  [0x008B] = 0x8B,
+  [0x008C] = 0x8C,
+  [0x008D] = 0x8D,
+  [0x008E] = 0x8E,
+  [0x008F] = 0x8F,
+  [0x0090] = 0x90,
+  [0x0091] = 0x91,
+  [0x0092] = 0x92,
+  [0x0093] = 0x93,
+  [0x0094] = 0x94,
+  [0x0095] = 0x95,
+  [0x0096] = 0x96,
+  [0x0097] = 0x97,
+  [0x0098] = 0x98,
+  [0x0099] = 0x99,
+  [0x009A] = 0x9A,
+  [0x009B] = 0x9B,
+  [0x009C] = 0x9C,
+  [0x009D] = 0x9D,
+  [0x009E] = 0x9E,
+  [0x009F] = 0x9F,
+  [0x00A0] = 0xA0,
+  [0x00A3] = 0xA3,
+  [0x00A4] = 0xA4,
+  [0x00A7] = 0xA7,
+  [0x00A8] = 0xA8,
+  [0x00AD] = 0xAD,
+  [0x00B0] = 0xB0,
+  [0x00B2] = 0xB2,
+  [0x00B3] = 0xB3,
+  [0x00B4] = 0xB4,
+  [0x00B5] = 0xB5,
+  [0x00B7] = 0xB7,
+  [0x00B8] = 0xB8,
+  [0x00BD] = 0xBD,
+  [0x00C0] = 0xC0,
+  [0x00C1] = 0xC1,
+  [0x00C2] = 0xC2,
+  [0x00C4] = 0xC4,
+  [0x00C7] = 0xC7,
+  [0x00C8] = 0xC8,
+  [0x00C9] = 0xC9,
+  [0x00CA] = 0xCA,
+  [0x00CB] = 0xCB,
+  [0x00CC] = 0xCC,
+  [0x00CD] = 0xCD,
+  [0x00CE] = 0xCE,
+  [0x00CF] = 0xCF,
+  [0x00D1] = 0xD1,
+  [0x00D2] = 0xD2,
+  [0x00D3] = 0xD3,
+  [0x00D4] = 0xD4,
+  [0x00D6] = 0xD6,
+  [0x00D7] = 0xD7,
+  [0x00D9] = 0xD9,
+  [0x00DA] = 0xDA,
+  [0x00DB] = 0xDB,
+  [0x00DC] = 0xDC,
+  [0x00DF] = 0xDF,
+  [0x00E0] = 0xE0,
+  [0x00E1] = 0xE1,
+  [0x00E2] = 0xE2,
+  [0x00E4] = 0xE4,
+  [0x00E7] = 0xE7,
+  [0x00E8] = 0xE8,
+  [0x00E9] = 0xE9,
+  [0x00EA] = 0xEA,
+  [0x00EB] = 0xEB,
+  [0x00EC] = 0xEC,
+  [0x00ED] = 0xED,
+  [0x00EE] = 0xEE,
+  [0x00EF] = 0xEF,
+  [0x00F1] = 0xF1,
+  [0x00F2] = 0xF2,
+  [0x00F3] = 0xF3,
+  [0x00F4] = 0xF4,
+  [0x00F6] = 0xF6,
+  [0x00F7] = 0xF7,
+  [0x00F9] = 0xF9,
+  [0x00FA] = 0xFA,
+  [0x00FB] = 0xFB,
+  [0x00FC] = 0xFC,
+  [0x0108] = 0xC6,
+  [0x0109] = 0xE6,
+  [0x010A] = 0xC5,
+  [0x010B] = 0xE5,
+  [0x011C] = 0xD8,
+  [0x011D] = 0xF8,
+  [0x011E] = 0xAB,
+  [0x011F] = 0xBB,
+  [0x0120] = 0xD5,
+  [0x0121] = 0xF5,
+  [0x0124] = 0xA6,
+  [0x0125] = 0xB6,
+  [0x0126] = 0xA1,
+  [0x0127] = 0xB1,
+  [0x0130] = 0xA9,
+  [0x0131] = 0xB9,
+  [0x0134] = 0xAC,
+  [0x0135] = 0xBC,
+  [0x015C] = 0xDE,
+  [0x015D] = 0xFE,
+  [0x015E] = 0xAA,
+  [0x015F] = 0xBA,
+  [0x016C] = 0xDD,
+  [0x016D] = 0xFD,
+  [0x017B] = 0xAF,
+  [0x017C] = 0xBF,
+  [0x02D8] = 0xA2,
+  [0x02D9] = 0xFF,
+};
diff --git a/iconvdata/iso8859-4.c b/iconvdata/iso8859-4.c
new file mode 100644
index 0000000000..b2b6ef0246
--- /dev/null
+++ b/iconvdata/iso8859-4.c
@@ -0,0 +1,24 @@
+/* Conversion from and to ISO 8859-4.
+   Copyright (C) 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@cygnus.com>, 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
+   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 <wchar.h>
+#include <iso8859-4.h>
+#define NAME "ISO-8859-4"
+#include <iso8859-generic.c>
diff --git a/iconvdata/iso8859-4.h b/iconvdata/iso8859-4.h
new file mode 100644
index 0000000000..acf4aaad40
--- /dev/null
+++ b/iconvdata/iso8859-4.h
@@ -0,0 +1,516 @@
+static const wchar_t to_ucs4[256] = {
+  [0x00] = 0x0000,
+  [0x01] = 0x0001,
+  [0x02] = 0x0002,
+  [0x03] = 0x0003,
+  [0x04] = 0x0004,
+  [0x05] = 0x0005,
+  [0x06] = 0x0006,
+  [0x07] = 0x0007,
+  [0x08] = 0x0008,
+  [0x09] = 0x0009,
+  [0x0A] = 0x000A,
+  [0x0B] = 0x000B,
+  [0x0C] = 0x000C,
+  [0x0D] = 0x000D,
+  [0x0E] = 0x000E,
+  [0x0F] = 0x000F,
+  [0x10] = 0x0010,
+  [0x11] = 0x0011,
+  [0x12] = 0x0012,
+  [0x13] = 0x0013,
+  [0x14] = 0x0014,
+  [0x15] = 0x0015,
+  [0x16] = 0x0016,
+  [0x17] = 0x0017,
+  [0x18] = 0x0018,
+  [0x19] = 0x0019,
+  [0x1A] = 0x001A,
+  [0x1B] = 0x001B,
+  [0x1C] = 0x001C,
+  [0x1D] = 0x001D,
+  [0x1E] = 0x001E,
+  [0x1F] = 0x001F,
+  [0x20] = 0x0020,
+  [0x21] = 0x0021,
+  [0x22] = 0x0022,
+  [0x23] = 0x0023,
+  [0x24] = 0x0024,
+  [0x25] = 0x0025,
+  [0x26] = 0x0026,
+  [0x27] = 0x0027,
+  [0x28] = 0x0028,
+  [0x29] = 0x0029,
+  [0x2A] = 0x002A,
+  [0x2B] = 0x002B,
+  [0x2C] = 0x002C,
+  [0x2D] = 0x002D,
+  [0x2E] = 0x002E,
+  [0x2F] = 0x002F,
+  [0x30] = 0x0030,
+  [0x31] = 0x0031,
+  [0x32] = 0x0032,
+  [0x33] = 0x0033,
+  [0x34] = 0x0034,
+  [0x35] = 0x0035,
+  [0x36] = 0x0036,
+  [0x37] = 0x0037,
+  [0x38] = 0x0038,
+  [0x39] = 0x0039,
+  [0x3A] = 0x003A,
+  [0x3B] = 0x003B,
+  [0x3C] = 0x003C,
+  [0x3D] = 0x003D,
+  [0x3E] = 0x003E,
+  [0x3F] = 0x003F,
+  [0x40] = 0x0040,
+  [0x41] = 0x0041,
+  [0x42] = 0x0042,
+  [0x43] = 0x0043,
+  [0x44] = 0x0044,
+  [0x45] = 0x0045,
+  [0x46] = 0x0046,
+  [0x47] = 0x0047,
+  [0x48] = 0x0048,
+  [0x49] = 0x0049,
+  [0x4A] = 0x004A,
+  [0x4B] = 0x004B,
+  [0x4C] = 0x004C,
+  [0x4D] = 0x004D,
+  [0x4E] = 0x004E,
+  [0x4F] = 0x004F,
+  [0x50] = 0x0050,
+  [0x51] = 0x0051,
+  [0x52] = 0x0052,
+  [0x53] = 0x0053,
+  [0x54] = 0x0054,
+  [0x55] = 0x0055,
+  [0x56] = 0x0056,
+  [0x57] = 0x0057,
+  [0x58] = 0x0058,
+  [0x59] = 0x0059,
+  [0x5A] = 0x005A,
+  [0x5B] = 0x005B,
+  [0x5C] = 0x005C,
+  [0x5D] = 0x005D,
+  [0x5E] = 0x005E,
+  [0x5F] = 0x005F,
+  [0x60] = 0x0060,
+  [0x61] = 0x0061,
+  [0x62] = 0x0062,
+  [0x63] = 0x0063,
+  [0x64] = 0x0064,
+  [0x65] = 0x0065,
+  [0x66] = 0x0066,
+  [0x67] = 0x0067,
+  [0x68] = 0x0068,
+  [0x69] = 0x0069,
+  [0x6A] = 0x006A,
+  [0x6B] = 0x006B,
+  [0x6C] = 0x006C,
+  [0x6D] = 0x006D,
+  [0x6E] = 0x006E,
+  [0x6F] = 0x006F,
+  [0x70] = 0x0070,
+  [0x71] = 0x0071,
+  [0x72] = 0x0072,
+  [0x73] = 0x0073,
+  [0x74] = 0x0074,
+  [0x75] = 0x0075,
+  [0x76] = 0x0076,
+  [0x77] = 0x0077,
+  [0x78] = 0x0078,
+  [0x79] = 0x0079,
+  [0x7A] = 0x007A,
+  [0x7B] = 0x007B,
+  [0x7C] = 0x007C,
+  [0x7D] = 0x007D,
+  [0x7E] = 0x007E,
+  [0x7F] = 0x007F,
+  [0x80] = 0x0080,
+  [0x81] = 0x0081,
+  [0x82] = 0x0082,
+  [0x83] = 0x0083,
+  [0x84] = 0x0084,
+  [0x85] = 0x0085,
+  [0x86] = 0x0086,
+  [0x87] = 0x0087,
+  [0x88] = 0x0088,
+  [0x89] = 0x0089,
+  [0x8A] = 0x008A,
+  [0x8B] = 0x008B,
+  [0x8C] = 0x008C,
+  [0x8D] = 0x008D,
+  [0x8E] = 0x008E,
+  [0x8F] = 0x008F,
+  [0x90] = 0x0090,
+  [0x91] = 0x0091,
+  [0x92] = 0x0092,
+  [0x93] = 0x0093,
+  [0x94] = 0x0094,
+  [0x95] = 0x0095,
+  [0x96] = 0x0096,
+  [0x97] = 0x0097,
+  [0x98] = 0x0098,
+  [0x99] = 0x0099,
+  [0x9A] = 0x009A,
+  [0x9B] = 0x009B,
+  [0x9C] = 0x009C,
+  [0x9D] = 0x009D,
+  [0x9E] = 0x009E,
+  [0x9F] = 0x009F,
+  [0xA0] = 0x00A0,
+  [0xA1] = 0x0104,
+  [0xA2] = 0x0138,
+  [0xA3] = 0x0156,
+  [0xA4] = 0x00A4,
+  [0xA5] = 0x0128,
+  [0xA6] = 0x013B,
+  [0xA7] = 0x00A7,
+  [0xA8] = 0x00A8,
+  [0xA9] = 0x0160,
+  [0xAA] = 0x0112,
+  [0xAB] = 0x0122,
+  [0xAC] = 0x0166,
+  [0xAD] = 0x00AD,
+  [0xAE] = 0x017D,
+  [0xAF] = 0x00AF,
+  [0xB0] = 0x00B0,
+  [0xB1] = 0x0105,
+  [0xB2] = 0x02DB,
+  [0xB3] = 0x0157,
+  [0xB4] = 0x00B4,
+  [0xB5] = 0x0129,
+  [0xB6] = 0x013C,
+  [0xB7] = 0x02C7,
+  [0xB8] = 0x00B8,
+  [0xB9] = 0x0161,
+  [0xBA] = 0x0113,
+  [0xBB] = 0x0123,
+  [0xBC] = 0x0167,
+  [0xBD] = 0x014A,
+  [0xBE] = 0x017E,
+  [0xBF] = 0x014B,
+  [0xC0] = 0x0100,
+  [0xC1] = 0x00C1,
+  [0xC2] = 0x00C2,
+  [0xC3] = 0x00C3,
+  [0xC4] = 0x00C4,
+  [0xC5] = 0x00C5,
+  [0xC6] = 0x00C6,
+  [0xC7] = 0x012E,
+  [0xC8] = 0x010C,
+  [0xC9] = 0x00C9,
+  [0xCA] = 0x0118,
+  [0xCB] = 0x00CB,
+  [0xCC] = 0x0116,
+  [0xCD] = 0x00CD,
+  [0xCE] = 0x00CE,
+  [0xCF] = 0x012A,
+  [0xD0] = 0x0110,
+  [0xD1] = 0x0145,
+  [0xD2] = 0x014C,
+  [0xD3] = 0x0136,
+  [0xD4] = 0x00D4,
+  [0xD5] = 0x00D5,
+  [0xD6] = 0x00D6,
+  [0xD7] = 0x00D7,
+  [0xD8] = 0x00D8,
+  [0xD9] = 0x0172,
+  [0xDA] = 0x00DA,
+  [0xDB] = 0x00DB,
+  [0xDC] = 0x00DC,
+  [0xDD] = 0x0168,
+  [0xDE] = 0x016A,
+  [0xDF] = 0x00DF,
+  [0xE0] = 0x0101,
+  [0xE1] = 0x00E1,
+  [0xE2] = 0x00E2,
+  [0xE3] = 0x00E3,
+  [0xE4] = 0x00E4,
+  [0xE5] = 0x00E5,
+  [0xE6] = 0x00E6,
+  [0xE7] = 0x012F,
+  [0xE8] = 0x010D,
+  [0xE9] = 0x00E9,
+  [0xEA] = 0x0119,
+  [0xEB] = 0x00EB,
+  [0xEC] = 0x0117,
+  [0xED] = 0x00ED,
+  [0xEE] = 0x00EE,
+  [0xEF] = 0x012B,
+  [0xF0] = 0x0111,
+  [0xF1] = 0x0146,
+  [0xF2] = 0x014D,
+  [0xF3] = 0x0137,
+  [0xF4] = 0x00F4,
+  [0xF5] = 0x00F5,
+  [0xF6] = 0x00F6,
+  [0xF7] = 0x00F7,
+  [0xF8] = 0x00F8,
+  [0xF9] = 0x0173,
+  [0xFA] = 0x00FA,
+  [0xFB] = 0x00FB,
+  [0xFC] = 0x00FC,
+  [0xFD] = 0x0169,
+  [0xFE] = 0x016B,
+  [0xFF] = 0x02D9,
+};
+static const char from_ucs4[] = {
+  [0x0000] = 0x00,
+  [0x0001] = 0x01,
+  [0x0002] = 0x02,
+  [0x0003] = 0x03,
+  [0x0004] = 0x04,
+  [0x0005] = 0x05,
+  [0x0006] = 0x06,
+  [0x0007] = 0x07,
+  [0x0008] = 0x08,
+  [0x0009] = 0x09,
+  [0x000A] = 0x0A,
+  [0x000B] = 0x0B,
+  [0x000C] = 0x0C,
+  [0x000D] = 0x0D,
+  [0x000E] = 0x0E,
+  [0x000F] = 0x0F,
+  [0x0010] = 0x10,
+  [0x0011] = 0x11,
+  [0x0012] = 0x12,
+  [0x0013] = 0x13,
+  [0x0014] = 0x14,
+  [0x0015] = 0x15,
+  [0x0016] = 0x16,
+  [0x0017] = 0x17,
+  [0x0018] = 0x18,
+  [0x0019] = 0x19,
+  [0x001A] = 0x1A,
+  [0x001B] = 0x1B,
+  [0x001C] = 0x1C,
+  [0x001D] = 0x1D,
+  [0x001E] = 0x1E,
+  [0x001F] = 0x1F,
+  [0x0020] = 0x20,
+  [0x0021] = 0x21,
+  [0x0022] = 0x22,
+  [0x0023] = 0x23,
+  [0x0024] = 0x24,
+  [0x0025] = 0x25,
+  [0x0026] = 0x26,
+  [0x0027] = 0x27,
+  [0x0028] = 0x28,
+  [0x0029] = 0x29,
+  [0x002A] = 0x2A,
+  [0x002B] = 0x2B,
+  [0x002C] = 0x2C,
+  [0x002D] = 0x2D,
+  [0x002E] = 0x2E,
+  [0x002F] = 0x2F,
+  [0x0030] = 0x30,
+  [0x0031] = 0x31,
+  [0x0032] = 0x32,
+  [0x0033] = 0x33,
+  [0x0034] = 0x34,
+  [0x0035] = 0x35,
+  [0x0036] = 0x36,
+  [0x0037] = 0x37,
+  [0x0038] = 0x38,
+  [0x0039] = 0x39,
+  [0x003A] = 0x3A,
+  [0x003B] = 0x3B,
+  [0x003C] = 0x3C,
+  [0x003D] = 0x3D,
+  [0x003E] = 0x3E,
+  [0x003F] = 0x3F,
+  [0x0040] = 0x40,
+  [0x0041] = 0x41,
+  [0x0042] = 0x42,
+  [0x0043] = 0x43,
+  [0x0044] = 0x44,
+  [0x0045] = 0x45,
+  [0x0046] = 0x46,
+  [0x0047] = 0x47,
+  [0x0048] = 0x48,
+  [0x0049] = 0x49,
+  [0x004A] = 0x4A,
+  [0x004B] = 0x4B,
+  [0x004C] = 0x4C,
+  [0x004D] = 0x4D,
+  [0x004E] = 0x4E,
+  [0x004F] = 0x4F,
+  [0x0050] = 0x50,
+  [0x0051] = 0x51,
+  [0x0052] = 0x52,
+  [0x0053] = 0x53,
+  [0x0054] = 0x54,
+  [0x0055] = 0x55,
+  [0x0056] = 0x56,
+  [0x0057] = 0x57,
+  [0x0058] = 0x58,
+  [0x0059] = 0x59,
+  [0x005A] = 0x5A,
+  [0x005B] = 0x5B,
+  [0x005C] = 0x5C,
+  [0x005D] = 0x5D,
+  [0x005E] = 0x5E,
+  [0x005F] = 0x5F,
+  [0x0060] = 0x60,
+  [0x0061] = 0x61,
+  [0x0062] = 0x62,
+  [0x0063] = 0x63,
+  [0x0064] = 0x64,
+  [0x0065] = 0x65,
+  [0x0066] = 0x66,
+  [0x0067] = 0x67,
+  [0x0068] = 0x68,
+  [0x0069] = 0x69,
+  [0x006A] = 0x6A,
+  [0x006B] = 0x6B,
+  [0x006C] = 0x6C,
+  [0x006D] = 0x6D,
+  [0x006E] = 0x6E,
+  [0x006F] = 0x6F,
+  [0x0070] = 0x70,
+  [0x0071] = 0x71,
+  [0x0072] = 0x72,
+  [0x0073] = 0x73,
+  [0x0074] = 0x74,
+  [0x0075] = 0x75,
+  [0x0076] = 0x76,
+  [0x0077] = 0x77,
+  [0x0078] = 0x78,
+  [0x0079] = 0x79,
+  [0x007A] = 0x7A,
+  [0x007B] = 0x7B,
+  [0x007C] = 0x7C,
+  [0x007D] = 0x7D,
+  [0x007E] = 0x7E,
+  [0x007F] = 0x7F,
+  [0x0080] = 0x80,
+  [0x0081] = 0x81,
+  [0x0082] = 0x82,
+  [0x0083] = 0x83,
+  [0x0084] = 0x84,
+  [0x0085] = 0x85,
+  [0x0086] = 0x86,
+  [0x0087] = 0x87,
+  [0x0088] = 0x88,
+  [0x0089] = 0x89,
+  [0x008A] = 0x8A,
+  [0x008B] = 0x8B,
+  [0x008C] = 0x8C,
+  [0x008D] = 0x8D,
+  [0x008E] = 0x8E,
+  [0x008F] = 0x8F,
+  [0x0090] = 0x90,
+  [0x0091] = 0x91,
+  [0x0092] = 0x92,
+  [0x0093] = 0x93,
+  [0x0094] = 0x94,
+  [0x0095] = 0x95,
+  [0x0096] = 0x96,
+  [0x0097] = 0x97,
+  [0x0098] = 0x98,
+  [0x0099] = 0x99,
+  [0x009A] = 0x9A,
+  [0x009B] = 0x9B,
+  [0x009C] = 0x9C,
+  [0x009D] = 0x9D,
+  [0x009E] = 0x9E,
+  [0x009F] = 0x9F,
+  [0x00A0] = 0xA0,
+  [0x00A4] = 0xA4,
+  [0x00A7] = 0xA7,
+  [0x00A8] = 0xA8,
+  [0x00AD] = 0xAD,
+  [0x00AF] = 0xAF,
+  [0x00B0] = 0xB0,
+  [0x00B4] = 0xB4,
+  [0x00B8] = 0xB8,
+  [0x00C1] = 0xC1,
+  [0x00C2] = 0xC2,
+  [0x00C3] = 0xC3,
+  [0x00C4] = 0xC4,
+  [0x00C5] = 0xC5,
+  [0x00C6] = 0xC6,
+  [0x00C9] = 0xC9,
+  [0x00CB] = 0xCB,
+  [0x00CD] = 0xCD,
+  [0x00CE] = 0xCE,
+  [0x00D4] = 0xD4,
+  [0x00D5] = 0xD5,
+  [0x00D6] = 0xD6,
+  [0x00D7] = 0xD7,
+  [0x00D8] = 0xD8,
+  [0x00DA] = 0xDA,
+  [0x00DB] = 0xDB,
+  [0x00DC] = 0xDC,
+  [0x00DF] = 0xDF,
+  [0x00E1] = 0xE1,
+  [0x00E2] = 0xE2,
+  [0x00E3] = 0xE3,
+  [0x00E4] = 0xE4,
+  [0x00E5] = 0xE5,
+  [0x00E6] = 0xE6,
+  [0x00E9] = 0xE9,
+  [0x00EB] = 0xEB,
+  [0x00ED] = 0xED,
+  [0x00EE] = 0xEE,
+  [0x00F4] = 0xF4,
+  [0x00F5] = 0xF5,
+  [0x00F6] = 0xF6,
+  [0x00F7] = 0xF7,
+  [0x00F8] = 0xF8,
+  [0x00FA] = 0xFA,
+  [0x00FB] = 0xFB,
+  [0x00FC] = 0xFC,
+  [0x0100] = 0xC0,
+  [0x0101] = 0xE0,
+  [0x0104] = 0xA1,
+  [0x0105] = 0xB1,
+  [0x010C] = 0xC8,
+  [0x010D] = 0xE8,
+  [0x0110] = 0xD0,
+  [0x0111] = 0xF0,
+  [0x0112] = 0xAA,
+  [0x0113] = 0xBA,
+  [0x0116] = 0xCC,
+  [0x0117] = 0xEC,
+  [0x0118] = 0xCA,
+  [0x0119] = 0xEA,
+  [0x0122] = 0xAB,
+  [0x0123] = 0xBB,
+  [0x0128] = 0xA5,
+  [0x0129] = 0xB5,
+  [0x012A] = 0xCF,
+  [0x012B] = 0xEF,
+  [0x012E] = 0xC7,
+  [0x012F] = 0xE7,
+  [0x0136] = 0xD3,
+  [0x0137] = 0xF3,
+  [0x0138] = 0xA2,
+  [0x013B] = 0xA6,
+  [0x013C] = 0xB6,
+  [0x0145] = 0xD1,
+  [0x0146] = 0xF1,
+  [0x014A] = 0xBD,
+  [0x014B] = 0xBF,
+  [0x014C] = 0xD2,
+  [0x014D] = 0xF2,
+  [0x0156] = 0xA3,
+  [0x0157] = 0xB3,
+  [0x0160] = 0xA9,
+  [0x0161] = 0xB9,
+  [0x0166] = 0xAC,
+  [0x0167] = 0xBC,
+  [0x0168] = 0xDD,
+  [0x0169] = 0xFD,
+  [0x016A] = 0xDE,
+  [0x016B] = 0xFE,
+  [0x0172] = 0xD9,
+  [0x0173] = 0xF9,
+  [0x017D] = 0xAE,
+  [0x017E] = 0xBE,
+  [0x02C7] = 0xB7,
+  [0x02D9] = 0xFF,
+  [0x02DB] = 0xB2,
+};
diff --git a/iconvdata/iso8859-5.c b/iconvdata/iso8859-5.c
new file mode 100644
index 0000000000..b0ebd6f93b
--- /dev/null
+++ b/iconvdata/iso8859-5.c
@@ -0,0 +1,24 @@
+/* Conversion from and to ISO 8859-5.
+   Copyright (C) 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@cygnus.com>, 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
+   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 <wchar.h>
+#include <iso8859-5.h>
+#define NAME "ISO-8859-5"
+#include <iso8859-generic.c>
diff --git a/iconvdata/iso8859-5.h b/iconvdata/iso8859-5.h
new file mode 100644
index 0000000000..f20ce11fe0
--- /dev/null
+++ b/iconvdata/iso8859-5.h
@@ -0,0 +1,516 @@
+static const wchar_t to_ucs4[256] = {
+  [0x00] = 0x0000,
+  [0x01] = 0x0001,
+  [0x02] = 0x0002,
+  [0x03] = 0x0003,
+  [0x04] = 0x0004,
+  [0x05] = 0x0005,
+  [0x06] = 0x0006,
+  [0x07] = 0x0007,
+  [0x08] = 0x0008,
+  [0x09] = 0x0009,
+  [0x0A] = 0x000A,
+  [0x0B] = 0x000B,
+  [0x0C] = 0x000C,
+  [0x0D] = 0x000D,
+  [0x0E] = 0x000E,
+  [0x0F] = 0x000F,
+  [0x10] = 0x0010,
+  [0x11] = 0x0011,
+  [0x12] = 0x0012,
+  [0x13] = 0x0013,
+  [0x14] = 0x0014,
+  [0x15] = 0x0015,
+  [0x16] = 0x0016,
+  [0x17] = 0x0017,
+  [0x18] = 0x0018,
+  [0x19] = 0x0019,
+  [0x1A] = 0x001A,
+  [0x1B] = 0x001B,
+  [0x1C] = 0x001C,
+  [0x1D] = 0x001D,
+  [0x1E] = 0x001E,
+  [0x1F] = 0x001F,
+  [0x20] = 0x0020,
+  [0x21] = 0x0021,
+  [0x22] = 0x0022,
+  [0x23] = 0x0023,
+  [0x24] = 0x0024,
+  [0x25] = 0x0025,
+  [0x26] = 0x0026,
+  [0x27] = 0x0027,
+  [0x28] = 0x0028,
+  [0x29] = 0x0029,
+  [0x2A] = 0x002A,
+  [0x2B] = 0x002B,
+  [0x2C] = 0x002C,
+  [0x2D] = 0x002D,
+  [0x2E] = 0x002E,
+  [0x2F] = 0x002F,
+  [0x30] = 0x0030,
+  [0x31] = 0x0031,
+  [0x32] = 0x0032,
+  [0x33] = 0x0033,
+  [0x34] = 0x0034,
+  [0x35] = 0x0035,
+  [0x36] = 0x0036,
+  [0x37] = 0x0037,
+  [0x38] = 0x0038,
+  [0x39] = 0x0039,
+  [0x3A] = 0x003A,
+  [0x3B] = 0x003B,
+  [0x3C] = 0x003C,
+  [0x3D] = 0x003D,
+  [0x3E] = 0x003E,
+  [0x3F] = 0x003F,
+  [0x40] = 0x0040,
+  [0x41] = 0x0041,
+  [0x42] = 0x0042,
+  [0x43] = 0x0043,
+  [0x44] = 0x0044,
+  [0x45] = 0x0045,
+  [0x46] = 0x0046,
+  [0x47] = 0x0047,
+  [0x48] = 0x0048,
+  [0x49] = 0x0049,
+  [0x4A] = 0x004A,
+  [0x4B] = 0x004B,
+  [0x4C] = 0x004C,
+  [0x4D] = 0x004D,
+  [0x4E] = 0x004E,
+  [0x4F] = 0x004F,
+  [0x50] = 0x0050,
+  [0x51] = 0x0051,
+  [0x52] = 0x0052,
+  [0x53] = 0x0053,
+  [0x54] = 0x0054,
+  [0x55] = 0x0055,
+  [0x56] = 0x0056,
+  [0x57] = 0x0057,
+  [0x58] = 0x0058,
+  [0x59] = 0x0059,
+  [0x5A] = 0x005A,
+  [0x5B] = 0x005B,
+  [0x5C] = 0x005C,
+  [0x5D] = 0x005D,
+  [0x5E] = 0x005E,
+  [0x5F] = 0x005F,
+  [0x60] = 0x0060,
+  [0x61] = 0x0061,
+  [0x62] = 0x0062,
+  [0x63] = 0x0063,
+  [0x64] = 0x0064,
+  [0x65] = 0x0065,
+  [0x66] = 0x0066,
+  [0x67] = 0x0067,
+  [0x68] = 0x0068,
+  [0x69] = 0x0069,
+  [0x6A] = 0x006A,
+  [0x6B] = 0x006B,
+  [0x6C] = 0x006C,
+  [0x6D] = 0x006D,
+  [0x6E] = 0x006E,
+  [0x6F] = 0x006F,
+  [0x70] = 0x0070,
+  [0x71] = 0x0071,
+  [0x72] = 0x0072,
+  [0x73] = 0x0073,
+  [0x74] = 0x0074,
+  [0x75] = 0x0075,
+  [0x76] = 0x0076,
+  [0x77] = 0x0077,
+  [0x78] = 0x0078,
+  [0x79] = 0x0079,
+  [0x7A] = 0x007A,
+  [0x7B] = 0x007B,
+  [0x7C] = 0x007C,
+  [0x7D] = 0x007D,
+  [0x7E] = 0x007E,
+  [0x7F] = 0x007F,
+  [0x80] = 0x0080,
+  [0x81] = 0x0081,
+  [0x82] = 0x0082,
+  [0x83] = 0x0083,
+  [0x84] = 0x0084,
+  [0x85] = 0x0085,
+  [0x86] = 0x0086,
+  [0x87] = 0x0087,
+  [0x88] = 0x0088,
+  [0x89] = 0x0089,
+  [0x8A] = 0x008A,
+  [0x8B] = 0x008B,
+  [0x8C] = 0x008C,
+  [0x8D] = 0x008D,
+  [0x8E] = 0x008E,
+  [0x8F] = 0x008F,
+  [0x90] = 0x0090,
+  [0x91] = 0x0091,
+  [0x92] = 0x0092,
+  [0x93] = 0x0093,
+  [0x94] = 0x0094,
+  [0x95] = 0x0095,
+  [0x96] = 0x0096,
+  [0x97] = 0x0097,
+  [0x98] = 0x0098,
+  [0x99] = 0x0099,
+  [0x9A] = 0x009A,
+  [0x9B] = 0x009B,
+  [0x9C] = 0x009C,
+  [0x9D] = 0x009D,
+  [0x9E] = 0x009E,
+  [0x9F] = 0x009F,
+  [0xA0] = 0x00A0,
+  [0xA1] = 0x0401,
+  [0xA2] = 0x0402,
+  [0xA3] = 0x0403,
+  [0xA4] = 0x0404,
+  [0xA5] = 0x0405,
+  [0xA6] = 0x0406,
+  [0xA7] = 0x0407,
+  [0xA8] = 0x0408,
+  [0xA9] = 0x0409,
+  [0xAA] = 0x040A,
+  [0xAB] = 0x040B,
+  [0xAC] = 0x040C,
+  [0xAD] = 0x00AD,
+  [0xAE] = 0x040E,
+  [0xAF] = 0x040F,
+  [0xB0] = 0x0410,
+  [0xB1] = 0x0411,
+  [0xB2] = 0x0412,
+  [0xB3] = 0x0413,
+  [0xB4] = 0x0414,
+  [0xB5] = 0x0415,
+  [0xB6] = 0x0416,
+  [0xB7] = 0x0417,
+  [0xB8] = 0x0418,
+  [0xB9] = 0x0419,
+  [0xBA] = 0x041A,
+  [0xBB] = 0x041B,
+  [0xBC] = 0x041C,
+  [0xBD] = 0x041D,
+  [0xBE] = 0x041E,
+  [0xBF] = 0x041F,
+  [0xC0] = 0x0420,
+  [0xC1] = 0x0421,
+  [0xC2] = 0x0422,
+  [0xC3] = 0x0423,
+  [0xC4] = 0x0424,
+  [0xC5] = 0x0425,
+  [0xC6] = 0x0426,
+  [0xC7] = 0x0427,
+  [0xC8] = 0x0428,
+  [0xC9] = 0x0429,
+  [0xCA] = 0x042A,
+  [0xCB] = 0x042B,
+  [0xCC] = 0x042C,
+  [0xCD] = 0x042D,
+  [0xCE] = 0x042E,
+  [0xCF] = 0x042F,
+  [0xD0] = 0x0430,
+  [0xD1] = 0x0431,
+  [0xD2] = 0x0432,
+  [0xD3] = 0x0433,
+  [0xD4] = 0x0434,
+  [0xD5] = 0x0435,
+  [0xD6] = 0x0436,
+  [0xD7] = 0x0437,
+  [0xD8] = 0x0438,
+  [0xD9] = 0x0439,
+  [0xDA] = 0x043A,
+  [0xDB] = 0x043B,
+  [0xDC] = 0x043C,
+  [0xDD] = 0x043D,
+  [0xDE] = 0x043E,
+  [0xDF] = 0x043F,
+  [0xE0] = 0x0440,
+  [0xE1] = 0x0441,
+  [0xE2] = 0x0442,
+  [0xE3] = 0x0443,
+  [0xE4] = 0x0444,
+  [0xE5] = 0x0445,
+  [0xE6] = 0x0446,
+  [0xE7] = 0x0447,
+  [0xE8] = 0x0448,
+  [0xE9] = 0x0449,
+  [0xEA] = 0x044A,
+  [0xEB] = 0x044B,
+  [0xEC] = 0x044C,
+  [0xED] = 0x044D,
+  [0xEE] = 0x044E,
+  [0xEF] = 0x044F,
+  [0xF0] = 0x2116,
+  [0xF1] = 0x0451,
+  [0xF2] = 0x0452,
+  [0xF3] = 0x0453,
+  [0xF4] = 0x0454,
+  [0xF5] = 0x0455,
+  [0xF6] = 0x0456,
+  [0xF7] = 0x0457,
+  [0xF8] = 0x0458,
+  [0xF9] = 0x0459,
+  [0xFA] = 0x045A,
+  [0xFB] = 0x045B,
+  [0xFC] = 0x045C,
+  [0xFD] = 0x00A7,
+  [0xFE] = 0x045E,
+  [0xFF] = 0x045F,
+};
+static const char from_ucs4[] = {
+  [0x0000] = 0x00,
+  [0x0001] = 0x01,
+  [0x0002] = 0x02,
+  [0x0003] = 0x03,
+  [0x0004] = 0x04,
+  [0x0005] = 0x05,
+  [0x0006] = 0x06,
+  [0x0007] = 0x07,
+  [0x0008] = 0x08,
+  [0x0009] = 0x09,
+  [0x000A] = 0x0A,
+  [0x000B] = 0x0B,
+  [0x000C] = 0x0C,
+  [0x000D] = 0x0D,
+  [0x000E] = 0x0E,
+  [0x000F] = 0x0F,
+  [0x0010] = 0x10,
+  [0x0011] = 0x11,
+  [0x0012] = 0x12,
+  [0x0013] = 0x13,
+  [0x0014] = 0x14,
+  [0x0015] = 0x15,
+  [0x0016] = 0x16,
+  [0x0017] = 0x17,
+  [0x0018] = 0x18,
+  [0x0019] = 0x19,
+  [0x001A] = 0x1A,
+  [0x001B] = 0x1B,
+  [0x001C] = 0x1C,
+  [0x001D] = 0x1D,
+  [0x001E] = 0x1E,
+  [0x001F] = 0x1F,
+  [0x0020] = 0x20,
+  [0x0021] = 0x21,
+  [0x0022] = 0x22,
+  [0x0023] = 0x23,
+  [0x0024] = 0x24,
+  [0x0025] = 0x25,
+  [0x0026] = 0x26,
+  [0x0027] = 0x27,
+  [0x0028] = 0x28,
+  [0x0029] = 0x29,
+  [0x002A] = 0x2A,
+  [0x002B] = 0x2B,
+  [0x002C] = 0x2C,
+  [0x002D] = 0x2D,
+  [0x002E] = 0x2E,
+  [0x002F] = 0x2F,
+  [0x0030] = 0x30,
+  [0x0031] = 0x31,
+  [0x0032] = 0x32,
+  [0x0033] = 0x33,
+  [0x0034] = 0x34,
+  [0x0035] = 0x35,
+  [0x0036] = 0x36,
+  [0x0037] = 0x37,
+  [0x0038] = 0x38,
+  [0x0039] = 0x39,
+  [0x003A] = 0x3A,
+  [0x003B] = 0x3B,
+  [0x003C] = 0x3C,
+  [0x003D] = 0x3D,
+  [0x003E] = 0x3E,
+  [0x003F] = 0x3F,
+  [0x0040] = 0x40,
+  [0x0041] = 0x41,
+  [0x0042] = 0x42,
+  [0x0043] = 0x43,
+  [0x0044] = 0x44,
+  [0x0045] = 0x45,
+  [0x0046] = 0x46,
+  [0x0047] = 0x47,
+  [0x0048] = 0x48,
+  [0x0049] = 0x49,
+  [0x004A] = 0x4A,
+  [0x004B] = 0x4B,
+  [0x004C] = 0x4C,
+  [0x004D] = 0x4D,
+  [0x004E] = 0x4E,
+  [0x004F] = 0x4F,
+  [0x0050] = 0x50,
+  [0x0051] = 0x51,
+  [0x0052] = 0x52,
+  [0x0053] = 0x53,
+  [0x0054] = 0x54,
+  [0x0055] = 0x55,
+  [0x0056] = 0x56,
+  [0x0057] = 0x57,
+  [0x0058] = 0x58,
+  [0x0059] = 0x59,
+  [0x005A] = 0x5A,
+  [0x005B] = 0x5B,
+  [0x005C] = 0x5C,
+  [0x005D] = 0x5D,
+  [0x005E] = 0x5E,
+  [0x005F] = 0x5F,
+  [0x0060] = 0x60,
+  [0x0061] = 0x61,
+  [0x0062] = 0x62,
+  [0x0063] = 0x63,
+  [0x0064] = 0x64,
+  [0x0065] = 0x65,
+  [0x0066] = 0x66,
+  [0x0067] = 0x67,
+  [0x0068] = 0x68,
+  [0x0069] = 0x69,
+  [0x006A] = 0x6A,
+  [0x006B] = 0x6B,
+  [0x006C] = 0x6C,
+  [0x006D] = 0x6D,
+  [0x006E] = 0x6E,
+  [0x006F] = 0x6F,
+  [0x0070] = 0x70,
+  [0x0071] = 0x71,
+  [0x0072] = 0x72,
+  [0x0073] = 0x73,
+  [0x0074] = 0x74,
+  [0x0075] = 0x75,
+  [0x0076] = 0x76,
+  [0x0077] = 0x77,
+  [0x0078] = 0x78,
+  [0x0079] = 0x79,
+  [0x007A] = 0x7A,
+  [0x007B] = 0x7B,
+  [0x007C] = 0x7C,
+  [0x007D] = 0x7D,
+  [0x007E] = 0x7E,
+  [0x007F] = 0x7F,
+  [0x0080] = 0x80,
+  [0x0081] = 0x81,
+  [0x0082] = 0x82,
+  [0x0083] = 0x83,
+  [0x0084] = 0x84,
+  [0x0085] = 0x85,
+  [0x0086] = 0x86,
+  [0x0087] = 0x87,
+  [0x0088] = 0x88,
+  [0x0089] = 0x89,
+  [0x008A] = 0x8A,
+  [0x008B] = 0x8B,
+  [0x008C] = 0x8C,
+  [0x008D] = 0x8D,
+  [0x008E] = 0x8E,
+  [0x008F] = 0x8F,
+  [0x0090] = 0x90,
+  [0x0091] = 0x91,
+  [0x0092] = 0x92,
+  [0x0093] = 0x93,
+  [0x0094] = 0x94,
+  [0x0095] = 0x95,
+  [0x0096] = 0x96,
+  [0x0097] = 0x97,
+  [0x0098] = 0x98,
+  [0x0099] = 0x99,
+  [0x009A] = 0x9A,
+  [0x009B] = 0x9B,
+  [0x009C] = 0x9C,
+  [0x009D] = 0x9D,
+  [0x009E] = 0x9E,
+  [0x009F] = 0x9F,
+  [0x00A0] = 0xA0,
+  [0x00A7] = 0xFD,
+  [0x00AD] = 0xAD,
+  [0x0401] = 0xA1,
+  [0x0402] = 0xA2,
+  [0x0403] = 0xA3,
+  [0x0404] = 0xA4,
+  [0x0405] = 0xA5,
+  [0x0406] = 0xA6,
+  [0x0407] = 0xA7,
+  [0x0408] = 0xA8,
+  [0x0409] = 0xA9,
+  [0x040A] = 0xAA,
+  [0x040B] = 0xAB,
+  [0x040C] = 0xAC,
+  [0x040E] = 0xAE,
+  [0x040F] = 0xAF,
+  [0x0410] = 0xB0,
+  [0x0411] = 0xB1,
+  [0x0412] = 0xB2,
+  [0x0413] = 0xB3,
+  [0x0414] = 0xB4,
+  [0x0415] = 0xB5,
+  [0x0416] = 0xB6,
+  [0x0417] = 0xB7,
+  [0x0418] = 0xB8,
+  [0x0419] = 0xB9,
+  [0x041A] = 0xBA,
+  [0x041B] = 0xBB,
+  [0x041C] = 0xBC,
+  [0x041D] = 0xBD,
+  [0x041E] = 0xBE,
+  [0x041F] = 0xBF,
+  [0x0420] = 0xC0,
+  [0x0421] = 0xC1,
+  [0x0422] = 0xC2,
+  [0x0423] = 0xC3,
+  [0x0424] = 0xC4,
+  [0x0425] = 0xC5,
+  [0x0426] = 0xC6,
+  [0x0427] = 0xC7,
+  [0x0428] = 0xC8,
+  [0x0429] = 0xC9,
+  [0x042A] = 0xCA,
+  [0x042B] = 0xCB,
+  [0x042C] = 0xCC,
+  [0x042D] = 0xCD,
+  [0x042E] = 0xCE,
+  [0x042F] = 0xCF,
+  [0x0430] = 0xD0,
+  [0x0431] = 0xD1,
+  [0x0432] = 0xD2,
+  [0x0433] = 0xD3,
+  [0x0434] = 0xD4,
+  [0x0435] = 0xD5,
+  [0x0436] = 0xD6,
+  [0x0437] = 0xD7,
+  [0x0438] = 0xD8,
+  [0x0439] = 0xD9,
+  [0x043A] = 0xDA,
+  [0x043B] = 0xDB,
+  [0x043C] = 0xDC,
+  [0x043D] = 0xDD,
+  [0x043E] = 0xDE,
+  [0x043F] = 0xDF,
+  [0x0440] = 0xE0,
+  [0x0441] = 0xE1,
+  [0x0442] = 0xE2,
+  [0x0443] = 0xE3,
+  [0x0444] = 0xE4,
+  [0x0445] = 0xE5,
+  [0x0446] = 0xE6,
+  [0x0447] = 0xE7,
+  [0x0448] = 0xE8,
+  [0x0449] = 0xE9,
+  [0x044A] = 0xEA,
+  [0x044B] = 0xEB,
+  [0x044C] = 0xEC,
+  [0x044D] = 0xED,
+  [0x044E] = 0xEE,
+  [0x044F] = 0xEF,
+  [0x0451] = 0xF1,
+  [0x0452] = 0xF2,
+  [0x0453] = 0xF3,
+  [0x0454] = 0xF4,
+  [0x0455] = 0xF5,
+  [0x0456] = 0xF6,
+  [0x0457] = 0xF7,
+  [0x0458] = 0xF8,
+  [0x0459] = 0xF9,
+  [0x045A] = 0xFA,
+  [0x045B] = 0xFB,
+  [0x045C] = 0xFC,
+  [0x045E] = 0xFE,
+  [0x045F] = 0xFF,
+  [0x2116] = 0xF0,
+};
diff --git a/iconvdata/iso8859-6.c b/iconvdata/iso8859-6.c
new file mode 100644
index 0000000000..f0f0a91004
--- /dev/null
+++ b/iconvdata/iso8859-6.c
@@ -0,0 +1,24 @@
+/* Conversion from and to ISO 8859-6.
+   Copyright (C) 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@cygnus.com>, 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
+   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 <wchar.h>
+#include <iso8859-6.h>
+#define NAME "ISO-8859-6"
+#include <iso8859-generic.c>
diff --git a/iconvdata/iso8859-6.h b/iconvdata/iso8859-6.h
new file mode 100644
index 0000000000..f3b3480ff1
--- /dev/null
+++ b/iconvdata/iso8859-6.h
@@ -0,0 +1,426 @@
+static const wchar_t to_ucs4[256] = {
+  [0x00] = 0x0000,
+  [0x01] = 0x0001,
+  [0x02] = 0x0002,
+  [0x03] = 0x0003,
+  [0x04] = 0x0004,
+  [0x05] = 0x0005,
+  [0x06] = 0x0006,
+  [0x07] = 0x0007,
+  [0x08] = 0x0008,
+  [0x09] = 0x0009,
+  [0x0A] = 0x000A,
+  [0x0B] = 0x000B,
+  [0x0C] = 0x000C,
+  [0x0D] = 0x000D,
+  [0x0E] = 0x000E,
+  [0x0F] = 0x000F,
+  [0x10] = 0x0010,
+  [0x11] = 0x0011,
+  [0x12] = 0x0012,
+  [0x13] = 0x0013,
+  [0x14] = 0x0014,
+  [0x15] = 0x0015,
+  [0x16] = 0x0016,
+  [0x17] = 0x0017,
+  [0x18] = 0x0018,
+  [0x19] = 0x0019,
+  [0x1A] = 0x001A,
+  [0x1B] = 0x001B,
+  [0x1C] = 0x001C,
+  [0x1D] = 0x001D,
+  [0x1E] = 0x001E,
+  [0x1F] = 0x001F,
+  [0x20] = 0x0020,
+  [0x21] = 0x0021,
+  [0x22] = 0x0022,
+  [0x23] = 0x0023,
+  [0x24] = 0x0024,
+  [0x25] = 0x0025,
+  [0x26] = 0x0026,
+  [0x27] = 0x0027,
+  [0x28] = 0x0028,
+  [0x29] = 0x0029,
+  [0x2A] = 0x002A,
+  [0x2B] = 0x002B,
+  [0x2C] = 0x002C,
+  [0x2D] = 0x002D,
+  [0x2E] = 0x002E,
+  [0x2F] = 0x002F,
+  [0x30] = 0x0030,
+  [0x31] = 0x0031,
+  [0x32] = 0x0032,
+  [0x33] = 0x0033,
+  [0x34] = 0x0034,
+  [0x35] = 0x0035,
+  [0x36] = 0x0036,
+  [0x37] = 0x0037,
+  [0x38] = 0x0038,
+  [0x39] = 0x0039,
+  [0x3A] = 0x003A,
+  [0x3B] = 0x003B,
+  [0x3C] = 0x003C,
+  [0x3D] = 0x003D,
+  [0x3E] = 0x003E,
+  [0x3F] = 0x003F,
+  [0x40] = 0x0040,
+  [0x41] = 0x0041,
+  [0x42] = 0x0042,
+  [0x43] = 0x0043,
+  [0x44] = 0x0044,
+  [0x45] = 0x0045,
+  [0x46] = 0x0046,
+  [0x47] = 0x0047,
+  [0x48] = 0x0048,
+  [0x49] = 0x0049,
+  [0x4A] = 0x004A,
+  [0x4B] = 0x004B,
+  [0x4C] = 0x004C,
+  [0x4D] = 0x004D,
+  [0x4E] = 0x004E,
+  [0x4F] = 0x004F,
+  [0x50] = 0x0050,
+  [0x51] = 0x0051,
+  [0x52] = 0x0052,
+  [0x53] = 0x0053,
+  [0x54] = 0x0054,
+  [0x55] = 0x0055,
+  [0x56] = 0x0056,
+  [0x57] = 0x0057,
+  [0x58] = 0x0058,
+  [0x59] = 0x0059,
+  [0x5A] = 0x005A,
+  [0x5B] = 0x005B,
+  [0x5C] = 0x005C,
+  [0x5D] = 0x005D,
+  [0x5E] = 0x005E,
+  [0x5F] = 0x005F,
+  [0x60] = 0x0060,
+  [0x61] = 0x0061,
+  [0x62] = 0x0062,
+  [0x63] = 0x0063,
+  [0x64] = 0x0064,
+  [0x65] = 0x0065,
+  [0x66] = 0x0066,
+  [0x67] = 0x0067,
+  [0x68] = 0x0068,
+  [0x69] = 0x0069,
+  [0x6A] = 0x006A,
+  [0x6B] = 0x006B,
+  [0x6C] = 0x006C,
+  [0x6D] = 0x006D,
+  [0x6E] = 0x006E,
+  [0x6F] = 0x006F,
+  [0x70] = 0x0070,
+  [0x71] = 0x0071,
+  [0x72] = 0x0072,
+  [0x73] = 0x0073,
+  [0x74] = 0x0074,
+  [0x75] = 0x0075,
+  [0x76] = 0x0076,
+  [0x77] = 0x0077,
+  [0x78] = 0x0078,
+  [0x79] = 0x0079,
+  [0x7A] = 0x007A,
+  [0x7B] = 0x007B,
+  [0x7C] = 0x007C,
+  [0x7D] = 0x007D,
+  [0x7E] = 0x007E,
+  [0x7F] = 0x007F,
+  [0x80] = 0x0080,
+  [0x81] = 0x0081,
+  [0x82] = 0x0082,
+  [0x83] = 0x0083,
+  [0x84] = 0x0084,
+  [0x85] = 0x0085,
+  [0x86] = 0x0086,
+  [0x87] = 0x0087,
+  [0x88] = 0x0088,
+  [0x89] = 0x0089,
+  [0x8A] = 0x008A,
+  [0x8B] = 0x008B,
+  [0x8C] = 0x008C,
+  [0x8D] = 0x008D,
+  [0x8E] = 0x008E,
+  [0x8F] = 0x008F,
+  [0x90] = 0x0090,
+  [0x91] = 0x0091,
+  [0x92] = 0x0092,
+  [0x93] = 0x0093,
+  [0x94] = 0x0094,
+  [0x95] = 0x0095,
+  [0x96] = 0x0096,
+  [0x97] = 0x0097,
+  [0x98] = 0x0098,
+  [0x99] = 0x0099,
+  [0x9A] = 0x009A,
+  [0x9B] = 0x009B,
+  [0x9C] = 0x009C,
+  [0x9D] = 0x009D,
+  [0x9E] = 0x009E,
+  [0x9F] = 0x009F,
+  [0xA0] = 0x00A0,
+  [0xA4] = 0x00A4,
+  [0xAC] = 0x060C,
+  [0xAD] = 0x00AD,
+  [0xBB] = 0x061B,
+  [0xBF] = 0x061F,
+  [0xC1] = 0x0621,
+  [0xC2] = 0x0622,
+  [0xC3] = 0x0623,
+  [0xC4] = 0x0624,
+  [0xC5] = 0x0625,
+  [0xC6] = 0x0626,
+  [0xC7] = 0x0627,
+  [0xC8] = 0x0628,
+  [0xC9] = 0x0629,
+  [0xCA] = 0x062A,
+  [0xCB] = 0x062B,
+  [0xCC] = 0x062C,
+  [0xCD] = 0x062D,
+  [0xCE] = 0x062E,
+  [0xCF] = 0x062F,
+  [0xD0] = 0x0630,
+  [0xD1] = 0x0631,
+  [0xD2] = 0x0632,
+  [0xD3] = 0x0633,
+  [0xD4] = 0x0634,
+  [0xD5] = 0x0635,
+  [0xD6] = 0x0636,
+  [0xD7] = 0x0637,
+  [0xD8] = 0x0638,
+  [0xD9] = 0x0639,
+  [0xDA] = 0x063A,
+  [0xE0] = 0x0640,
+  [0xE1] = 0x0641,
+  [0xE2] = 0x0642,
+  [0xE3] = 0x0643,
+  [0xE4] = 0x0644,
+  [0xE5] = 0x0645,
+  [0xE6] = 0x0646,
+  [0xE7] = 0x0647,
+  [0xE8] = 0x0648,
+  [0xE9] = 0x0649,
+  [0xEA] = 0x064A,
+  [0xEB] = 0x064B,
+  [0xEC] = 0x064C,
+  [0xED] = 0x064D,
+  [0xEE] = 0x064E,
+  [0xEF] = 0x064F,
+  [0xF0] = 0x0650,
+  [0xF1] = 0x0651,
+  [0xF2] = 0x0652,
+};
+static const char from_ucs4[] = {
+  [0x0000] = 0x00,
+  [0x0001] = 0x01,
+  [0x0002] = 0x02,
+  [0x0003] = 0x03,
+  [0x0004] = 0x04,
+  [0x0005] = 0x05,
+  [0x0006] = 0x06,
+  [0x0007] = 0x07,
+  [0x0008] = 0x08,
+  [0x0009] = 0x09,
+  [0x000A] = 0x0A,
+  [0x000B] = 0x0B,
+  [0x000C] = 0x0C,
+  [0x000D] = 0x0D,
+  [0x000E] = 0x0E,
+  [0x000F] = 0x0F,
+  [0x0010] = 0x10,
+  [0x0011] = 0x11,
+  [0x0012] = 0x12,
+  [0x0013] = 0x13,
+  [0x0014] = 0x14,
+  [0x0015] = 0x15,
+  [0x0016] = 0x16,
+  [0x0017] = 0x17,
+  [0x0018] = 0x18,
+  [0x0019] = 0x19,
+  [0x001A] = 0x1A,
+  [0x001B] = 0x1B,
+  [0x001C] = 0x1C,
+  [0x001D] = 0x1D,
+  [0x001E] = 0x1E,
+  [0x001F] = 0x1F,
+  [0x0020] = 0x20,
+  [0x0021] = 0x21,
+  [0x0022] = 0x22,
+  [0x0023] = 0x23,
+  [0x0024] = 0x24,
+  [0x0025] = 0x25,
+  [0x0026] = 0x26,
+  [0x0027] = 0x27,
+  [0x0028] = 0x28,
+  [0x0029] = 0x29,
+  [0x002A] = 0x2A,
+  [0x002B] = 0x2B,
+  [0x002C] = 0x2C,
+  [0x002D] = 0x2D,
+  [0x002E] = 0x2E,
+  [0x002F] = 0x2F,
+  [0x0030] = 0x30,
+  [0x0031] = 0x31,
+  [0x0032] = 0x32,
+  [0x0033] = 0x33,
+  [0x0034] = 0x34,
+  [0x0035] = 0x35,
+  [0x0036] = 0x36,
+  [0x0037] = 0x37,
+  [0x0038] = 0x38,
+  [0x0039] = 0x39,
+  [0x003A] = 0x3A,
+  [0x003B] = 0x3B,
+  [0x003C] = 0x3C,
+  [0x003D] = 0x3D,
+  [0x003E] = 0x3E,
+  [0x003F] = 0x3F,
+  [0x0040] = 0x40,
+  [0x0041] = 0x41,
+  [0x0042] = 0x42,
+  [0x0043] = 0x43,
+  [0x0044] = 0x44,
+  [0x0045] = 0x45,
+  [0x0046] = 0x46,
+  [0x0047] = 0x47,
+  [0x0048] = 0x48,
+  [0x0049] = 0x49,
+  [0x004A] = 0x4A,
+  [0x004B] = 0x4B,
+  [0x004C] = 0x4C,
+  [0x004D] = 0x4D,
+  [0x004E] = 0x4E,
+  [0x004F] = 0x4F,
+  [0x0050] = 0x50,
+  [0x0051] = 0x51,
+  [0x0052] = 0x52,
+  [0x0053] = 0x53,
+  [0x0054] = 0x54,
+  [0x0055] = 0x55,
+  [0x0056] = 0x56,
+  [0x0057] = 0x57,
+  [0x0058] = 0x58,
+  [0x0059] = 0x59,
+  [0x005A] = 0x5A,
+  [0x005B] = 0x5B,
+  [0x005C] = 0x5C,
+  [0x005D] = 0x5D,
+  [0x005E] = 0x5E,
+  [0x005F] = 0x5F,
+  [0x0060] = 0x60,
+  [0x0061] = 0x61,
+  [0x0062] = 0x62,
+  [0x0063] = 0x63,
+  [0x0064] = 0x64,
+  [0x0065] = 0x65,
+  [0x0066] = 0x66,
+  [0x0067] = 0x67,
+  [0x0068] = 0x68,
+  [0x0069] = 0x69,
+  [0x006A] = 0x6A,
+  [0x006B] = 0x6B,
+  [0x006C] = 0x6C,
+  [0x006D] = 0x6D,
+  [0x006E] = 0x6E,
+  [0x006F] = 0x6F,
+  [0x0070] = 0x70,
+  [0x0071] = 0x71,
+  [0x0072] = 0x72,
+  [0x0073] = 0x73,
+  [0x0074] = 0x74,
+  [0x0075] = 0x75,
+  [0x0076] = 0x76,
+  [0x0077] = 0x77,
+  [0x0078] = 0x78,
+  [0x0079] = 0x79,
+  [0x007A] = 0x7A,
+  [0x007B] = 0x7B,
+  [0x007C] = 0x7C,
+  [0x007D] = 0x7D,
+  [0x007E] = 0x7E,
+  [0x007F] = 0x7F,
+  [0x0080] = 0x80,
+  [0x0081] = 0x81,
+  [0x0082] = 0x82,
+  [0x0083] = 0x83,
+  [0x0084] = 0x84,
+  [0x0085] = 0x85,
+  [0x0086] = 0x86,
+  [0x0087] = 0x87,
+  [0x0088] = 0x88,
+  [0x0089] = 0x89,
+  [0x008A] = 0x8A,
+  [0x008B] = 0x8B,
+  [0x008C] = 0x8C,
+  [0x008D] = 0x8D,
+  [0x008E] = 0x8E,
+  [0x008F] = 0x8F,
+  [0x0090] = 0x90,
+  [0x0091] = 0x91,
+  [0x0092] = 0x92,
+  [0x0093] = 0x93,
+  [0x0094] = 0x94,
+  [0x0095] = 0x95,
+  [0x0096] = 0x96,
+  [0x0097] = 0x97,
+  [0x0098] = 0x98,
+  [0x0099] = 0x99,
+  [0x009A] = 0x9A,
+  [0x009B] = 0x9B,
+  [0x009C] = 0x9C,
+  [0x009D] = 0x9D,
+  [0x009E] = 0x9E,
+  [0x009F] = 0x9F,
+  [0x00A0] = 0xA0,
+  [0x00A4] = 0xA4,
+  [0x00AD] = 0xAD,
+  [0x060C] = 0xAC,
+  [0x061B] = 0xBB,
+  [0x061F] = 0xBF,
+  [0x0621] = 0xC1,
+  [0x0622] = 0xC2,
+  [0x0623] = 0xC3,
+  [0x0624] = 0xC4,
+  [0x0625] = 0xC5,
+  [0x0626] = 0xC6,
+  [0x0627] = 0xC7,
+  [0x0628] = 0xC8,
+  [0x0629] = 0xC9,
+  [0x062A] = 0xCA,
+  [0x062B] = 0xCB,
+  [0x062C] = 0xCC,
+  [0x062D] = 0xCD,
+  [0x062E] = 0xCE,
+  [0x062F] = 0xCF,
+  [0x0630] = 0xD0,
+  [0x0631] = 0xD1,
+  [0x0632] = 0xD2,
+  [0x0633] = 0xD3,
+  [0x0634] = 0xD4,
+  [0x0635] = 0xD5,
+  [0x0636] = 0xD6,
+  [0x0637] = 0xD7,
+  [0x0638] = 0xD8,
+  [0x0639] = 0xD9,
+  [0x063A] = 0xDA,
+  [0x0640] = 0xE0,
+  [0x0641] = 0xE1,
+  [0x0642] = 0xE2,
+  [0x0643] = 0xE3,
+  [0x0644] = 0xE4,
+  [0x0645] = 0xE5,
+  [0x0646] = 0xE6,
+  [0x0647] = 0xE7,
+  [0x0648] = 0xE8,
+  [0x0649] = 0xE9,
+  [0x064A] = 0xEA,
+  [0x064B] = 0xEB,
+  [0x064C] = 0xEC,
+  [0x064D] = 0xED,
+  [0x064E] = 0xEE,
+  [0x064F] = 0xEF,
+  [0x0650] = 0xF0,
+  [0x0651] = 0xF1,
+  [0x0652] = 0xF2,
+};
diff --git a/iconvdata/iso8859-7.c b/iconvdata/iso8859-7.c
new file mode 100644
index 0000000000..87c2a2c06c
--- /dev/null
+++ b/iconvdata/iso8859-7.c
@@ -0,0 +1,24 @@
+/* Conversion from and to ISO 8859-7.
+   Copyright (C) 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@cygnus.com>, 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
+   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 <wchar.h>
+#include <iso8859-7.h>
+#define NAME "ISO-8859-7"
+#include <iso8859-generic.c>
diff --git a/iconvdata/iso8859-7.h b/iconvdata/iso8859-7.h
new file mode 100644
index 0000000000..fe38788e20
--- /dev/null
+++ b/iconvdata/iso8859-7.h
@@ -0,0 +1,504 @@
+static const wchar_t to_ucs4[256] = {
+  [0x00] = 0x0000,
+  [0x01] = 0x0001,
+  [0x02] = 0x0002,
+  [0x03] = 0x0003,
+  [0x04] = 0x0004,
+  [0x05] = 0x0005,
+  [0x06] = 0x0006,
+  [0x07] = 0x0007,
+  [0x08] = 0x0008,
+  [0x09] = 0x0009,
+  [0x0A] = 0x000A,
+  [0x0B] = 0x000B,
+  [0x0C] = 0x000C,
+  [0x0D] = 0x000D,
+  [0x0E] = 0x000E,
+  [0x0F] = 0x000F,
+  [0x10] = 0x0010,
+  [0x11] = 0x0011,
+  [0x12] = 0x0012,
+  [0x13] = 0x0013,
+  [0x14] = 0x0014,
+  [0x15] = 0x0015,
+  [0x16] = 0x0016,
+  [0x17] = 0x0017,
+  [0x18] = 0x0018,
+  [0x19] = 0x0019,
+  [0x1A] = 0x001A,
+  [0x1B] = 0x001B,
+  [0x1C] = 0x001C,
+  [0x1D] = 0x001D,
+  [0x1E] = 0x001E,
+  [0x1F] = 0x001F,
+  [0x20] = 0x0020,
+  [0x21] = 0x0021,
+  [0x22] = 0x0022,
+  [0x23] = 0x0023,
+  [0x24] = 0x0024,
+  [0x25] = 0x0025,
+  [0x26] = 0x0026,
+  [0x27] = 0x0027,
+  [0x28] = 0x0028,
+  [0x29] = 0x0029,
+  [0x2A] = 0x002A,
+  [0x2B] = 0x002B,
+  [0x2C] = 0x002C,
+  [0x2D] = 0x002D,
+  [0x2E] = 0x002E,
+  [0x2F] = 0x002F,
+  [0x30] = 0x0030,
+  [0x31] = 0x0031,
+  [0x32] = 0x0032,
+  [0x33] = 0x0033,
+  [0x34] = 0x0034,
+  [0x35] = 0x0035,
+  [0x36] = 0x0036,
+  [0x37] = 0x0037,
+  [0x38] = 0x0038,
+  [0x39] = 0x0039,
+  [0x3A] = 0x003A,
+  [0x3B] = 0x003B,
+  [0x3C] = 0x003C,
+  [0x3D] = 0x003D,
+  [0x3E] = 0x003E,
+  [0x3F] = 0x003F,
+  [0x40] = 0x0040,
+  [0x41] = 0x0041,
+  [0x42] = 0x0042,
+  [0x43] = 0x0043,
+  [0x44] = 0x0044,
+  [0x45] = 0x0045,
+  [0x46] = 0x0046,
+  [0x47] = 0x0047,
+  [0x48] = 0x0048,
+  [0x49] = 0x0049,
+  [0x4A] = 0x004A,
+  [0x4B] = 0x004B,
+  [0x4C] = 0x004C,
+  [0x4D] = 0x004D,
+  [0x4E] = 0x004E,
+  [0x4F] = 0x004F,
+  [0x50] = 0x0050,
+  [0x51] = 0x0051,
+  [0x52] = 0x0052,
+  [0x53] = 0x0053,
+  [0x54] = 0x0054,
+  [0x55] = 0x0055,
+  [0x56] = 0x0056,
+  [0x57] = 0x0057,
+  [0x58] = 0x0058,
+  [0x59] = 0x0059,
+  [0x5A] = 0x005A,
+  [0x5B] = 0x005B,
+  [0x5C] = 0x005C,
+  [0x5D] = 0x005D,
+  [0x5E] = 0x005E,
+  [0x5F] = 0x005F,
+  [0x60] = 0x0060,
+  [0x61] = 0x0061,
+  [0x62] = 0x0062,
+  [0x63] = 0x0063,
+  [0x64] = 0x0064,
+  [0x65] = 0x0065,
+  [0x66] = 0x0066,
+  [0x67] = 0x0067,
+  [0x68] = 0x0068,
+  [0x69] = 0x0069,
+  [0x6A] = 0x006A,
+  [0x6B] = 0x006B,
+  [0x6C] = 0x006C,
+  [0x6D] = 0x006D,
+  [0x6E] = 0x006E,
+  [0x6F] = 0x006F,
+  [0x70] = 0x0070,
+  [0x71] = 0x0071,
+  [0x72] = 0x0072,
+  [0x73] = 0x0073,
+  [0x74] = 0x0074,
+  [0x75] = 0x0075,
+  [0x76] = 0x0076,
+  [0x77] = 0x0077,
+  [0x78] = 0x0078,
+  [0x79] = 0x0079,
+  [0x7A] = 0x007A,
+  [0x7B] = 0x007B,
+  [0x7C] = 0x007C,
+  [0x7D] = 0x007D,
+  [0x7E] = 0x007E,
+  [0x7F] = 0x007F,
+  [0x80] = 0x0080,
+  [0x81] = 0x0081,
+  [0x82] = 0x0082,
+  [0x83] = 0x0083,
+  [0x84] = 0x0084,
+  [0x85] = 0x0085,
+  [0x86] = 0x0086,
+  [0x87] = 0x0087,
+  [0x88] = 0x0088,
+  [0x89] = 0x0089,
+  [0x8A] = 0x008A,
+  [0x8B] = 0x008B,
+  [0x8C] = 0x008C,
+  [0x8D] = 0x008D,
+  [0x8E] = 0x008E,
+  [0x8F] = 0x008F,
+  [0x90] = 0x0090,
+  [0x91] = 0x0091,
+  [0x92] = 0x0092,
+  [0x93] = 0x0093,
+  [0x94] = 0x0094,
+  [0x95] = 0x0095,
+  [0x96] = 0x0096,
+  [0x97] = 0x0097,
+  [0x98] = 0x0098,
+  [0x99] = 0x0099,
+  [0x9A] = 0x009A,
+  [0x9B] = 0x009B,
+  [0x9C] = 0x009C,
+  [0x9D] = 0x009D,
+  [0x9E] = 0x009E,
+  [0x9F] = 0x009F,
+  [0xA0] = 0x00A0,
+  [0xA1] = 0x201B,
+  [0xA2] = 0x2019,
+  [0xA3] = 0x00A3,
+  [0xA6] = 0x00A6,
+  [0xA7] = 0x00A7,
+  [0xA8] = 0x00A8,
+  [0xA9] = 0x00A9,
+  [0xAB] = 0x00AB,
+  [0xAC] = 0x00AC,
+  [0xAD] = 0x00AD,
+  [0xAF] = 0x2014,
+  [0xB0] = 0x00B0,
+  [0xB1] = 0x00B1,
+  [0xB2] = 0x00B2,
+  [0xB3] = 0x00B3,
+  [0xB4] = 0x00B4,
+  [0xB5] = 0x0385,
+  [0xB6] = 0x0386,
+  [0xB7] = 0x00B7,
+  [0xB8] = 0x0388,
+  [0xB9] = 0x0389,
+  [0xBA] = 0x038A,
+  [0xBB] = 0x00BB,
+  [0xBC] = 0x038C,
+  [0xBD] = 0x00BD,
+  [0xBE] = 0x038E,
+  [0xBF] = 0x038F,
+  [0xC0] = 0x0390,
+  [0xC1] = 0x0391,
+  [0xC2] = 0x0392,
+  [0xC3] = 0x0393,
+  [0xC4] = 0x0394,
+  [0xC5] = 0x0395,
+  [0xC6] = 0x0396,
+  [0xC7] = 0x0397,
+  [0xC8] = 0x0398,
+  [0xC9] = 0x0399,
+  [0xCA] = 0x039A,
+  [0xCB] = 0x039B,
+  [0xCC] = 0x039C,
+  [0xCD] = 0x039D,
+  [0xCE] = 0x039E,
+  [0xCF] = 0x039F,
+  [0xD0] = 0x03A0,
+  [0xD1] = 0x03A1,
+  [0xD3] = 0x03A3,
+  [0xD4] = 0x03A4,
+  [0xD5] = 0x03A5,
+  [0xD6] = 0x03A6,
+  [0xD7] = 0x03A7,
+  [0xD8] = 0x03A8,
+  [0xD9] = 0x03A9,
+  [0xDA] = 0x03AA,
+  [0xDB] = 0x03AB,
+  [0xDC] = 0x03AC,
+  [0xDD] = 0x03AD,
+  [0xDE] = 0x03AE,
+  [0xDF] = 0x03AF,
+  [0xE0] = 0x03B0,
+  [0xE1] = 0x03B1,
+  [0xE2] = 0x03B2,
+  [0xE3] = 0x03B3,
+  [0xE4] = 0x03B4,
+  [0xE5] = 0x03B5,
+  [0xE6] = 0x03B6,
+  [0xE7] = 0x03B7,
+  [0xE8] = 0x03B8,
+  [0xE9] = 0x03B9,
+  [0xEA] = 0x03BA,
+  [0xEB] = 0x03BB,
+  [0xEC] = 0x03BC,
+  [0xED] = 0x03BD,
+  [0xEE] = 0x03BE,
+  [0xEF] = 0x03BF,
+  [0xF0] = 0x03C0,
+  [0xF1] = 0x03C1,
+  [0xF2] = 0x03C2,
+  [0xF3] = 0x03C3,
+  [0xF4] = 0x03C4,
+  [0xF5] = 0x03C5,
+  [0xF6] = 0x03C6,
+  [0xF7] = 0x03C7,
+  [0xF8] = 0x03C8,
+  [0xF9] = 0x03C9,
+  [0xFA] = 0x03CA,
+  [0xFB] = 0x03CB,
+  [0xFC] = 0x03CC,
+  [0xFD] = 0x03CD,
+  [0xFE] = 0x03CE,
+};
+static const char from_ucs4[] = {
+  [0x0000] = 0x00,
+  [0x0001] = 0x01,
+  [0x0002] = 0x02,
+  [0x0003] = 0x03,
+  [0x0004] = 0x04,
+  [0x0005] = 0x05,
+  [0x0006] = 0x06,
+  [0x0007] = 0x07,
+  [0x0008] = 0x08,
+  [0x0009] = 0x09,
+  [0x000A] = 0x0A,
+  [0x000B] = 0x0B,
+  [0x000C] = 0x0C,
+  [0x000D] = 0x0D,
+  [0x000E] = 0x0E,
+  [0x000F] = 0x0F,
+  [0x0010] = 0x10,
+  [0x0011] = 0x11,
+  [0x0012] = 0x12,
+  [0x0013] = 0x13,
+  [0x0014] = 0x14,
+  [0x0015] = 0x15,
+  [0x0016] = 0x16,
+  [0x0017] = 0x17,
+  [0x0018] = 0x18,
+  [0x0019] = 0x19,
+  [0x001A] = 0x1A,
+  [0x001B] = 0x1B,
+  [0x001C] = 0x1C,
+  [0x001D] = 0x1D,
+  [0x001E] = 0x1E,
+  [0x001F] = 0x1F,
+  [0x0020] = 0x20,
+  [0x0021] = 0x21,
+  [0x0022] = 0x22,
+  [0x0023] = 0x23,
+  [0x0024] = 0x24,
+  [0x0025] = 0x25,
+  [0x0026] = 0x26,
+  [0x0027] = 0x27,
+  [0x0028] = 0x28,
+  [0x0029] = 0x29,
+  [0x002A] = 0x2A,
+  [0x002B] = 0x2B,
+  [0x002C] = 0x2C,
+  [0x002D] = 0x2D,
+  [0x002E] = 0x2E,
+  [0x002F] = 0x2F,
+  [0x0030] = 0x30,
+  [0x0031] = 0x31,
+  [0x0032] = 0x32,
+  [0x0033] = 0x33,
+  [0x0034] = 0x34,
+  [0x0035] = 0x35,
+  [0x0036] = 0x36,
+  [0x0037] = 0x37,
+  [0x0038] = 0x38,
+  [0x0039] = 0x39,
+  [0x003A] = 0x3A,
+  [0x003B] = 0x3B,
+  [0x003C] = 0x3C,
+  [0x003D] = 0x3D,
+  [0x003E] = 0x3E,
+  [0x003F] = 0x3F,
+  [0x0040] = 0x40,
+  [0x0041] = 0x41,
+  [0x0042] = 0x42,
+  [0x0043] = 0x43,
+  [0x0044] = 0x44,
+  [0x0045] = 0x45,
+  [0x0046] = 0x46,
+  [0x0047] = 0x47,
+  [0x0048] = 0x48,
+  [0x0049] = 0x49,
+  [0x004A] = 0x4A,
+  [0x004B] = 0x4B,
+  [0x004C] = 0x4C,
+  [0x004D] = 0x4D,
+  [0x004E] = 0x4E,
+  [0x004F] = 0x4F,
+  [0x0050] = 0x50,
+  [0x0051] = 0x51,
+  [0x0052] = 0x52,
+  [0x0053] = 0x53,
+  [0x0054] = 0x54,
+  [0x0055] = 0x55,
+  [0x0056] = 0x56,
+  [0x0057] = 0x57,
+  [0x0058] = 0x58,
+  [0x0059] = 0x59,
+  [0x005A] = 0x5A,
+  [0x005B] = 0x5B,
+  [0x005C] = 0x5C,
+  [0x005D] = 0x5D,
+  [0x005E] = 0x5E,
+  [0x005F] = 0x5F,
+  [0x0060] = 0x60,
+  [0x0061] = 0x61,
+  [0x0062] = 0x62,
+  [0x0063] = 0x63,
+  [0x0064] = 0x64,
+  [0x0065] = 0x65,
+  [0x0066] = 0x66,
+  [0x0067] = 0x67,
+  [0x0068] = 0x68,
+  [0x0069] = 0x69,
+  [0x006A] = 0x6A,
+  [0x006B] = 0x6B,
+  [0x006C] = 0x6C,
+  [0x006D] = 0x6D,
+  [0x006E] = 0x6E,
+  [0x006F] = 0x6F,
+  [0x0070] = 0x70,
+  [0x0071] = 0x71,
+  [0x0072] = 0x72,
+  [0x0073] = 0x73,
+  [0x0074] = 0x74,
+  [0x0075] = 0x75,
+  [0x0076] = 0x76,
+  [0x0077] = 0x77,
+  [0x0078] = 0x78,
+  [0x0079] = 0x79,
+  [0x007A] = 0x7A,
+  [0x007B] = 0x7B,
+  [0x007C] = 0x7C,
+  [0x007D] = 0x7D,
+  [0x007E] = 0x7E,
+  [0x007F] = 0x7F,
+  [0x0080] = 0x80,
+  [0x0081] = 0x81,
+  [0x0082] = 0x82,
+  [0x0083] = 0x83,
+  [0x0084] = 0x84,
+  [0x0085] = 0x85,
+  [0x0086] = 0x86,
+  [0x0087] = 0x87,
+  [0x0088] = 0x88,
+  [0x0089] = 0x89,
+  [0x008A] = 0x8A,
+  [0x008B] = 0x8B,
+  [0x008C] = 0x8C,
+  [0x008D] = 0x8D,
+  [0x008E] = 0x8E,
+  [0x008F] = 0x8F,
+  [0x0090] = 0x90,
+  [0x0091] = 0x91,
+  [0x0092] = 0x92,
+  [0x0093] = 0x93,
+  [0x0094] = 0x94,
+  [0x0095] = 0x95,
+  [0x0096] = 0x96,
+  [0x0097] = 0x97,
+  [0x0098] = 0x98,
+  [0x0099] = 0x99,
+  [0x009A] = 0x9A,
+  [0x009B] = 0x9B,
+  [0x009C] = 0x9C,
+  [0x009D] = 0x9D,
+  [0x009E] = 0x9E,
+  [0x009F] = 0x9F,
+  [0x00A0] = 0xA0,
+  [0x00A3] = 0xA3,
+  [0x00A6] = 0xA6,
+  [0x00A7] = 0xA7,
+  [0x00A8] = 0xA8,
+  [0x00A9] = 0xA9,
+  [0x00AB] = 0xAB,
+  [0x00AC] = 0xAC,
+  [0x00AD] = 0xAD,
+  [0x00B0] = 0xB0,
+  [0x00B1] = 0xB1,
+  [0x00B2] = 0xB2,
+  [0x00B3] = 0xB3,
+  [0x00B4] = 0xB4,
+  [0x00B7] = 0xB7,
+  [0x00BB] = 0xBB,
+  [0x00BD] = 0xBD,
+  [0x0385] = 0xB5,
+  [0x0386] = 0xB6,
+  [0x0388] = 0xB8,
+  [0x0389] = 0xB9,
+  [0x038A] = 0xBA,
+  [0x038C] = 0xBC,
+  [0x038E] = 0xBE,
+  [0x038F] = 0xBF,
+  [0x0390] = 0xC0,
+  [0x0391] = 0xC1,
+  [0x0392] = 0xC2,
+  [0x0393] = 0xC3,
+  [0x0394] = 0xC4,
+  [0x0395] = 0xC5,
+  [0x0396] = 0xC6,
+  [0x0397] = 0xC7,
+  [0x0398] = 0xC8,
+  [0x0399] = 0xC9,
+  [0x039A] = 0xCA,
+  [0x039B] = 0xCB,
+  [0x039C] = 0xCC,
+  [0x039D] = 0xCD,
+  [0x039E] = 0xCE,
+  [0x039F] = 0xCF,
+  [0x03A0] = 0xD0,
+  [0x03A1] = 0xD1,
+  [0x03A3] = 0xD3,
+  [0x03A4] = 0xD4,
+  [0x03A5] = 0xD5,
+  [0x03A6] = 0xD6,
+  [0x03A7] = 0xD7,
+  [0x03A8] = 0xD8,
+  [0x03A9] = 0xD9,
+  [0x03AA] = 0xDA,
+  [0x03AB] = 0xDB,
+  [0x03AC] = 0xDC,
+  [0x03AD] = 0xDD,
+  [0x03AE] = 0xDE,
+  [0x03AF] = 0xDF,
+  [0x03B0] = 0xE0,
+  [0x03B1] = 0xE1,
+  [0x03B2] = 0xE2,
+  [0x03B3] = 0xE3,
+  [0x03B4] = 0xE4,
+  [0x03B5] = 0xE5,
+  [0x03B6] = 0xE6,
+  [0x03B7] = 0xE7,
+  [0x03B8] = 0xE8,
+  [0x03B9] = 0xE9,
+  [0x03BA] = 0xEA,
+  [0x03BB] = 0xEB,
+  [0x03BC] = 0xEC,
+  [0x03BD] = 0xED,
+  [0x03BE] = 0xEE,
+  [0x03BF] = 0xEF,
+  [0x03C0] = 0xF0,
+  [0x03C1] = 0xF1,
+  [0x03C2] = 0xF2,
+  [0x03C3] = 0xF3,
+  [0x03C4] = 0xF4,
+  [0x03C5] = 0xF5,
+  [0x03C6] = 0xF6,
+  [0x03C7] = 0xF7,
+  [0x03C8] = 0xF8,
+  [0x03C9] = 0xF9,
+  [0x03CA] = 0xFA,
+  [0x03CB] = 0xFB,
+  [0x03CC] = 0xFC,
+  [0x03CD] = 0xFD,
+  [0x03CE] = 0xFE,
+  [0x2014] = 0xAF,
+  [0x2019] = 0xA2,
+  [0x201B] = 0xA1,
+};
diff --git a/iconvdata/iso8859-8.c b/iconvdata/iso8859-8.c
new file mode 100644
index 0000000000..ee69754cea
--- /dev/null
+++ b/iconvdata/iso8859-8.c
@@ -0,0 +1,24 @@
+/* Conversion from and to ISO 8859-8.
+   Copyright (C) 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@cygnus.com>, 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
+   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 <wchar.h>
+#include <iso8859-8.h>
+#define NAME "ISO-8859-8"
+#include <iso8859-generic.c>
diff --git a/iconvdata/iso8859-8.h b/iconvdata/iso8859-8.h
new file mode 100644
index 0000000000..bdccec689c
--- /dev/null
+++ b/iconvdata/iso8859-8.h
@@ -0,0 +1,440 @@
+static const wchar_t to_ucs4[256] = {
+  [0x00] = 0x0000,
+  [0x01] = 0x0001,
+  [0x02] = 0x0002,
+  [0x03] = 0x0003,
+  [0x04] = 0x0004,
+  [0x05] = 0x0005,
+  [0x06] = 0x0006,
+  [0x07] = 0x0007,
+  [0x08] = 0x0008,
+  [0x09] = 0x0009,
+  [0x0A] = 0x000A,
+  [0x0B] = 0x000B,
+  [0x0C] = 0x000C,
+  [0x0D] = 0x000D,
+  [0x0E] = 0x000E,
+  [0x0F] = 0x000F,
+  [0x10] = 0x0010,
+  [0x11] = 0x0011,
+  [0x12] = 0x0012,
+  [0x13] = 0x0013,
+  [0x14] = 0x0014,
+  [0x15] = 0x0015,
+  [0x16] = 0x0016,
+  [0x17] = 0x0017,
+  [0x18] = 0x0018,
+  [0x19] = 0x0019,
+  [0x1A] = 0x001A,
+  [0x1B] = 0x001B,
+  [0x1C] = 0x001C,
+  [0x1D] = 0x001D,
+  [0x1E] = 0x001E,
+  [0x1F] = 0x001F,
+  [0x20] = 0x0020,
+  [0x21] = 0x0021,
+  [0x22] = 0x0022,
+  [0x23] = 0x0023,
+  [0x24] = 0x0024,
+  [0x25] = 0x0025,
+  [0x26] = 0x0026,
+  [0x27] = 0x0027,
+  [0x28] = 0x0028,
+  [0x29] = 0x0029,
+  [0x2A] = 0x002A,
+  [0x2B] = 0x002B,
+  [0x2C] = 0x002C,
+  [0x2D] = 0x002D,
+  [0x2E] = 0x002E,
+  [0x2F] = 0x002F,
+  [0x30] = 0x0030,
+  [0x31] = 0x0031,
+  [0x32] = 0x0032,
+  [0x33] = 0x0033,
+  [0x34] = 0x0034,
+  [0x35] = 0x0035,
+  [0x36] = 0x0036,
+  [0x37] = 0x0037,
+  [0x38] = 0x0038,
+  [0x39] = 0x0039,
+  [0x3A] = 0x003A,
+  [0x3B] = 0x003B,
+  [0x3C] = 0x003C,
+  [0x3D] = 0x003D,
+  [0x3E] = 0x003E,
+  [0x3F] = 0x003F,
+  [0x40] = 0x0040,
+  [0x41] = 0x0041,
+  [0x42] = 0x0042,
+  [0x43] = 0x0043,
+  [0x44] = 0x0044,
+  [0x45] = 0x0045,
+  [0x46] = 0x0046,
+  [0x47] = 0x0047,
+  [0x48] = 0x0048,
+  [0x49] = 0x0049,
+  [0x4A] = 0x004A,
+  [0x4B] = 0x004B,
+  [0x4C] = 0x004C,
+  [0x4D] = 0x004D,
+  [0x4E] = 0x004E,
+  [0x4F] = 0x004F,
+  [0x50] = 0x0050,
+  [0x51] = 0x0051,
+  [0x52] = 0x0052,
+  [0x53] = 0x0053,
+  [0x54] = 0x0054,
+  [0x55] = 0x0055,
+  [0x56] = 0x0056,
+  [0x57] = 0x0057,
+  [0x58] = 0x0058,
+  [0x59] = 0x0059,
+  [0x5A] = 0x005A,
+  [0x5B] = 0x005B,
+  [0x5C] = 0x005C,
+  [0x5D] = 0x005D,
+  [0x5E] = 0x005E,
+  [0x5F] = 0x005F,
+  [0x60] = 0x0060,
+  [0x61] = 0x0061,
+  [0x62] = 0x0062,
+  [0x63] = 0x0063,
+  [0x64] = 0x0064,
+  [0x65] = 0x0065,
+  [0x66] = 0x0066,
+  [0x67] = 0x0067,
+  [0x68] = 0x0068,
+  [0x69] = 0x0069,
+  [0x6A] = 0x006A,
+  [0x6B] = 0x006B,
+  [0x6C] = 0x006C,
+  [0x6D] = 0x006D,
+  [0x6E] = 0x006E,
+  [0x6F] = 0x006F,
+  [0x70] = 0x0070,
+  [0x71] = 0x0071,
+  [0x72] = 0x0072,
+  [0x73] = 0x0073,
+  [0x74] = 0x0074,
+  [0x75] = 0x0075,
+  [0x76] = 0x0076,
+  [0x77] = 0x0077,
+  [0x78] = 0x0078,
+  [0x79] = 0x0079,
+  [0x7A] = 0x007A,
+  [0x7B] = 0x007B,
+  [0x7C] = 0x007C,
+  [0x7D] = 0x007D,
+  [0x7E] = 0x007E,
+  [0x7F] = 0x007F,
+  [0x80] = 0x0080,
+  [0x81] = 0x0081,
+  [0x82] = 0x0082,
+  [0x83] = 0x0083,
+  [0x84] = 0x0084,
+  [0x85] = 0x0085,
+  [0x86] = 0x0086,
+  [0x87] = 0x0087,
+  [0x88] = 0x0088,
+  [0x89] = 0x0089,
+  [0x8A] = 0x008A,
+  [0x8B] = 0x008B,
+  [0x8C] = 0x008C,
+  [0x8D] = 0x008D,
+  [0x8E] = 0x008E,
+  [0x8F] = 0x008F,
+  [0x90] = 0x0090,
+  [0x91] = 0x0091,
+  [0x92] = 0x0092,
+  [0x93] = 0x0093,
+  [0x94] = 0x0094,
+  [0x95] = 0x0095,
+  [0x96] = 0x0096,
+  [0x97] = 0x0097,
+  [0x98] = 0x0098,
+  [0x99] = 0x0099,
+  [0x9A] = 0x009A,
+  [0x9B] = 0x009B,
+  [0x9C] = 0x009C,
+  [0x9D] = 0x009D,
+  [0x9E] = 0x009E,
+  [0x9F] = 0x009F,
+  [0xA0] = 0x00A0,
+  [0xA2] = 0x00A2,
+  [0xA3] = 0x00A3,
+  [0xA4] = 0x00A4,
+  [0xA5] = 0x00A5,
+  [0xA6] = 0x00A6,
+  [0xA7] = 0x00A7,
+  [0xA8] = 0x00A8,
+  [0xA9] = 0x00A9,
+  [0xAA] = 0x00D7,
+  [0xAB] = 0x00AB,
+  [0xAC] = 0x00AC,
+  [0xAD] = 0x00AD,
+  [0xAE] = 0x00AE,
+  [0xAF] = 0x203E,
+  [0xB0] = 0x00B0,
+  [0xB1] = 0x00B1,
+  [0xB2] = 0x00B2,
+  [0xB3] = 0x00B3,
+  [0xB4] = 0x00B4,
+  [0xB5] = 0x00B5,
+  [0xB6] = 0x00B6,
+  [0xB7] = 0x00B7,
+  [0xB8] = 0x00B8,
+  [0xB9] = 0x00B9,
+  [0xBA] = 0x00F7,
+  [0xBB] = 0x00BB,
+  [0xBC] = 0x00BC,
+  [0xBD] = 0x00BD,
+  [0xBE] = 0x00BE,
+  [0xDF] = 0x2017,
+  [0xE0] = 0x05D0,
+  [0xE1] = 0x05D1,
+  [0xE2] = 0x05D2,
+  [0xE3] = 0x05D3,
+  [0xE4] = 0x05D4,
+  [0xE5] = 0x05D5,
+  [0xE6] = 0x05D6,
+  [0xE7] = 0x05D7,
+  [0xE8] = 0x05D8,
+  [0xE9] = 0x05D9,
+  [0xEA] = 0x05DA,
+  [0xEB] = 0x05DB,
+  [0xEC] = 0x05DC,
+  [0xED] = 0x05DD,
+  [0xEE] = 0x05DE,
+  [0xEF] = 0x05DF,
+  [0xF0] = 0x05E0,
+  [0xF1] = 0x05E1,
+  [0xF2] = 0x05E2,
+  [0xF3] = 0x05E3,
+  [0xF4] = 0x05E4,
+  [0xF5] = 0x05E5,
+  [0xF6] = 0x05E6,
+  [0xF7] = 0x05E7,
+  [0xF8] = 0x05E8,
+  [0xF9] = 0x05E9,
+  [0xFA] = 0x05EA,
+};
+static const char from_ucs4[] = {
+  [0x0000] = 0x00,
+  [0x0001] = 0x01,
+  [0x0002] = 0x02,
+  [0x0003] = 0x03,
+  [0x0004] = 0x04,
+  [0x0005] = 0x05,
+  [0x0006] = 0x06,
+  [0x0007] = 0x07,
+  [0x0008] = 0x08,
+  [0x0009] = 0x09,
+  [0x000A] = 0x0A,
+  [0x000B] = 0x0B,
+  [0x000C] = 0x0C,
+  [0x000D] = 0x0D,
+  [0x000E] = 0x0E,
+  [0x000F] = 0x0F,
+  [0x0010] = 0x10,
+  [0x0011] = 0x11,
+  [0x0012] = 0x12,
+  [0x0013] = 0x13,
+  [0x0014] = 0x14,
+  [0x0015] = 0x15,
+  [0x0016] = 0x16,
+  [0x0017] = 0x17,
+  [0x0018] = 0x18,
+  [0x0019] = 0x19,
+  [0x001A] = 0x1A,
+  [0x001B] = 0x1B,
+  [0x001C] = 0x1C,
+  [0x001D] = 0x1D,
+  [0x001E] = 0x1E,
+  [0x001F] = 0x1F,
+  [0x0020] = 0x20,
+  [0x0021] = 0x21,
+  [0x0022] = 0x22,
+  [0x0023] = 0x23,
+  [0x0024] = 0x24,
+  [0x0025] = 0x25,
+  [0x0026] = 0x26,
+  [0x0027] = 0x27,
+  [0x0028] = 0x28,
+  [0x0029] = 0x29,
+  [0x002A] = 0x2A,
+  [0x002B] = 0x2B,
+  [0x002C] = 0x2C,
+  [0x002D] = 0x2D,
+  [0x002E] = 0x2E,
+  [0x002F] = 0x2F,
+  [0x0030] = 0x30,
+  [0x0031] = 0x31,
+  [0x0032] = 0x32,
+  [0x0033] = 0x33,
+  [0x0034] = 0x34,
+  [0x0035] = 0x35,
+  [0x0036] = 0x36,
+  [0x0037] = 0x37,
+  [0x0038] = 0x38,
+  [0x0039] = 0x39,
+  [0x003A] = 0x3A,
+  [0x003B] = 0x3B,
+  [0x003C] = 0x3C,
+  [0x003D] = 0x3D,
+  [0x003E] = 0x3E,
+  [0x003F] = 0x3F,
+  [0x0040] = 0x40,
+  [0x0041] = 0x41,
+  [0x0042] = 0x42,
+  [0x0043] = 0x43,
+  [0x0044] = 0x44,
+  [0x0045] = 0x45,
+  [0x0046] = 0x46,
+  [0x0047] = 0x47,
+  [0x0048] = 0x48,
+  [0x0049] = 0x49,
+  [0x004A] = 0x4A,
+  [0x004B] = 0x4B,
+  [0x004C] = 0x4C,
+  [0x004D] = 0x4D,
+  [0x004E] = 0x4E,
+  [0x004F] = 0x4F,
+  [0x0050] = 0x50,
+  [0x0051] = 0x51,
+  [0x0052] = 0x52,
+  [0x0053] = 0x53,
+  [0x0054] = 0x54,
+  [0x0055] = 0x55,
+  [0x0056] = 0x56,
+  [0x0057] = 0x57,
+  [0x0058] = 0x58,
+  [0x0059] = 0x59,
+  [0x005A] = 0x5A,
+  [0x005B] = 0x5B,
+  [0x005C] = 0x5C,
+  [0x005D] = 0x5D,
+  [0x005E] = 0x5E,
+  [0x005F] = 0x5F,
+  [0x0060] = 0x60,
+  [0x0061] = 0x61,
+  [0x0062] = 0x62,
+  [0x0063] = 0x63,
+  [0x0064] = 0x64,
+  [0x0065] = 0x65,
+  [0x0066] = 0x66,
+  [0x0067] = 0x67,
+  [0x0068] = 0x68,
+  [0x0069] = 0x69,
+  [0x006A] = 0x6A,
+  [0x006B] = 0x6B,
+  [0x006C] = 0x6C,
+  [0x006D] = 0x6D,
+  [0x006E] = 0x6E,
+  [0x006F] = 0x6F,
+  [0x0070] = 0x70,
+  [0x0071] = 0x71,
+  [0x0072] = 0x72,
+  [0x0073] = 0x73,
+  [0x0074] = 0x74,
+  [0x0075] = 0x75,
+  [0x0076] = 0x76,
+  [0x0077] = 0x77,
+  [0x0078] = 0x78,
+  [0x0079] = 0x79,
+  [0x007A] = 0x7A,
+  [0x007B] = 0x7B,
+  [0x007C] = 0x7C,
+  [0x007D] = 0x7D,
+  [0x007E] = 0x7E,
+  [0x007F] = 0x7F,
+  [0x0080] = 0x80,
+  [0x0081] = 0x81,
+  [0x0082] = 0x82,
+  [0x0083] = 0x83,
+  [0x0084] = 0x84,
+  [0x0085] = 0x85,
+  [0x0086] = 0x86,
+  [0x0087] = 0x87,
+  [0x0088] = 0x88,
+  [0x0089] = 0x89,
+  [0x008A] = 0x8A,
+  [0x008B] = 0x8B,
+  [0x008C] = 0x8C,
+  [0x008D] = 0x8D,
+  [0x008E] = 0x8E,
+  [0x008F] = 0x8F,
+  [0x0090] = 0x90,
+  [0x0091] = 0x91,
+  [0x0092] = 0x92,
+  [0x0093] = 0x93,
+  [0x0094] = 0x94,
+  [0x0095] = 0x95,
+  [0x0096] = 0x96,
+  [0x0097] = 0x97,
+  [0x0098] = 0x98,
+  [0x0099] = 0x99,
+  [0x009A] = 0x9A,
+  [0x009B] = 0x9B,
+  [0x009C] = 0x9C,
+  [0x009D] = 0x9D,
+  [0x009E] = 0x9E,
+  [0x009F] = 0x9F,
+  [0x00A0] = 0xA0,
+  [0x00A2] = 0xA2,
+  [0x00A3] = 0xA3,
+  [0x00A4] = 0xA4,
+  [0x00A5] = 0xA5,
+  [0x00A6] = 0xA6,
+  [0x00A7] = 0xA7,
+  [0x00A8] = 0xA8,
+  [0x00A9] = 0xA9,
+  [0x00AB] = 0xAB,
+  [0x00AC] = 0xAC,
+  [0x00AD] = 0xAD,
+  [0x00AE] = 0xAE,
+  [0x00B0] = 0xB0,
+  [0x00B1] = 0xB1,
+  [0x00B2] = 0xB2,
+  [0x00B3] = 0xB3,
+  [0x00B4] = 0xB4,
+  [0x00B5] = 0xB5,
+  [0x00B6] = 0xB6,
+  [0x00B7] = 0xB7,
+  [0x00B8] = 0xB8,
+  [0x00B9] = 0xB9,
+  [0x00BB] = 0xBB,
+  [0x00BC] = 0xBC,
+  [0x00BD] = 0xBD,
+  [0x00BE] = 0xBE,
+  [0x00D7] = 0xAA,
+  [0x00F7] = 0xBA,
+  [0x05D0] = 0xE0,
+  [0x05D1] = 0xE1,
+  [0x05D2] = 0xE2,
+  [0x05D3] = 0xE3,
+  [0x05D4] = 0xE4,
+  [0x05D5] = 0xE5,
+  [0x05D6] = 0xE6,
+  [0x05D7] = 0xE7,
+  [0x05D8] = 0xE8,
+  [0x05D9] = 0xE9,
+  [0x05DA] = 0xEA,
+  [0x05DB] = 0xEB,
+  [0x05DC] = 0xEC,
+  [0x05DD] = 0xED,
+  [0x05DE] = 0xEE,
+  [0x05DF] = 0xEF,
+  [0x05E0] = 0xF0,
+  [0x05E1] = 0xF1,
+  [0x05E2] = 0xF2,
+  [0x05E3] = 0xF3,
+  [0x05E4] = 0xF4,
+  [0x05E5] = 0xF5,
+  [0x05E6] = 0xF6,
+  [0x05E7] = 0xF7,
+  [0x05E8] = 0xF8,
+  [0x05E9] = 0xF9,
+  [0x05EA] = 0xFA,
+  [0x2017] = 0xDF,
+  [0x203E] = 0xAF,
+};
diff --git a/iconvdata/iso8859-9.c b/iconvdata/iso8859-9.c
new file mode 100644
index 0000000000..5485de26f1
--- /dev/null
+++ b/iconvdata/iso8859-9.c
@@ -0,0 +1,24 @@
+/* Conversion from and to ISO 8859-9.
+   Copyright (C) 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@cygnus.com>, 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
+   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 <wchar.h>
+#include <iso8859-9.h>
+#define NAME "ISO-8859-9"
+#include <iso8859-generic.c>
diff --git a/iconvdata/iso8859-9.h b/iconvdata/iso8859-9.h
new file mode 100644
index 0000000000..f5794231c0
--- /dev/null
+++ b/iconvdata/iso8859-9.h
@@ -0,0 +1,516 @@
+static const wchar_t to_ucs4[256] = {
+  [0x00] = 0x0000,
+  [0x01] = 0x0001,
+  [0x02] = 0x0002,
+  [0x03] = 0x0003,
+  [0x04] = 0x0004,
+  [0x05] = 0x0005,
+  [0x06] = 0x0006,
+  [0x07] = 0x0007,
+  [0x08] = 0x0008,
+  [0x09] = 0x0009,
+  [0x0A] = 0x000A,
+  [0x0B] = 0x000B,
+  [0x0C] = 0x000C,
+  [0x0D] = 0x000D,
+  [0x0E] = 0x000E,
+  [0x0F] = 0x000F,
+  [0x10] = 0x0010,
+  [0x11] = 0x0011,
+  [0x12] = 0x0012,
+  [0x13] = 0x0013,
+  [0x14] = 0x0014,
+  [0x15] = 0x0015,
+  [0x16] = 0x0016,
+  [0x17] = 0x0017,
+  [0x18] = 0x0018,
+  [0x19] = 0x0019,
+  [0x1A] = 0x001A,
+  [0x1B] = 0x001B,
+  [0x1C] = 0x001C,
+  [0x1D] = 0x001D,
+  [0x1E] = 0x001E,
+  [0x1F] = 0x001F,
+  [0x20] = 0x0020,
+  [0x21] = 0x0021,
+  [0x22] = 0x0022,
+  [0x23] = 0x0023,
+  [0x24] = 0x0024,
+  [0x25] = 0x0025,
+  [0x26] = 0x0026,
+  [0x27] = 0x0027,
+  [0x28] = 0x0028,
+  [0x29] = 0x0029,
+  [0x2A] = 0x002A,
+  [0x2B] = 0x002B,
+  [0x2C] = 0x002C,
+  [0x2D] = 0x002D,
+  [0x2E] = 0x002E,
+  [0x2F] = 0x002F,
+  [0x30] = 0x0030,
+  [0x31] = 0x0031,
+  [0x32] = 0x0032,
+  [0x33] = 0x0033,
+  [0x34] = 0x0034,
+  [0x35] = 0x0035,
+  [0x36] = 0x0036,
+  [0x37] = 0x0037,
+  [0x38] = 0x0038,
+  [0x39] = 0x0039,
+  [0x3A] = 0x003A,
+  [0x3B] = 0x003B,
+  [0x3C] = 0x003C,
+  [0x3D] = 0x003D,
+  [0x3E] = 0x003E,
+  [0x3F] = 0x003F,
+  [0x40] = 0x0040,
+  [0x41] = 0x0041,
+  [0x42] = 0x0042,
+  [0x43] = 0x0043,
+  [0x44] = 0x0044,
+  [0x45] = 0x0045,
+  [0x46] = 0x0046,
+  [0x47] = 0x0047,
+  [0x48] = 0x0048,
+  [0x49] = 0x0049,
+  [0x4A] = 0x004A,
+  [0x4B] = 0x004B,
+  [0x4C] = 0x004C,
+  [0x4D] = 0x004D,
+  [0x4E] = 0x004E,
+  [0x4F] = 0x004F,
+  [0x50] = 0x0050,
+  [0x51] = 0x0051,
+  [0x52] = 0x0052,
+  [0x53] = 0x0053,
+  [0x54] = 0x0054,
+  [0x55] = 0x0055,
+  [0x56] = 0x0056,
+  [0x57] = 0x0057,
+  [0x58] = 0x0058,
+  [0x59] = 0x0059,
+  [0x5A] = 0x005A,
+  [0x5B] = 0x005B,
+  [0x5C] = 0x005C,
+  [0x5D] = 0x005D,
+  [0x5E] = 0x005E,
+  [0x5F] = 0x005F,
+  [0x60] = 0x0060,
+  [0x61] = 0x0061,
+  [0x62] = 0x0062,
+  [0x63] = 0x0063,
+  [0x64] = 0x0064,
+  [0x65] = 0x0065,
+  [0x66] = 0x0066,
+  [0x67] = 0x0067,
+  [0x68] = 0x0068,
+  [0x69] = 0x0069,
+  [0x6A] = 0x006A,
+  [0x6B] = 0x006B,
+  [0x6C] = 0x006C,
+  [0x6D] = 0x006D,
+  [0x6E] = 0x006E,
+  [0x6F] = 0x006F,
+  [0x70] = 0x0070,
+  [0x71] = 0x0071,
+  [0x72] = 0x0072,
+  [0x73] = 0x0073,
+  [0x74] = 0x0074,
+  [0x75] = 0x0075,
+  [0x76] = 0x0076,
+  [0x77] = 0x0077,
+  [0x78] = 0x0078,
+  [0x79] = 0x0079,
+  [0x7A] = 0x007A,
+  [0x7B] = 0x007B,
+  [0x7C] = 0x007C,
+  [0x7D] = 0x007D,
+  [0x7E] = 0x007E,
+  [0x7F] = 0x007F,
+  [0x80] = 0x0080,
+  [0x81] = 0x0081,
+  [0x82] = 0x0082,
+  [0x83] = 0x0083,
+  [0x84] = 0x0084,
+  [0x85] = 0x0085,
+  [0x86] = 0x0086,
+  [0x87] = 0x0087,
+  [0x88] = 0x0088,
+  [0x89] = 0x0089,
+  [0x8A] = 0x008A,
+  [0x8B] = 0x008B,
+  [0x8C] = 0x008C,
+  [0x8D] = 0x008D,
+  [0x8E] = 0x008E,
+  [0x8F] = 0x008F,
+  [0x90] = 0x0090,
+  [0x91] = 0x0091,
+  [0x92] = 0x0092,
+  [0x93] = 0x0093,
+  [0x94] = 0x0094,
+  [0x95] = 0x0095,
+  [0x96] = 0x0096,
+  [0x97] = 0x0097,
+  [0x98] = 0x0098,
+  [0x99] = 0x0099,
+  [0x9A] = 0x009A,
+  [0x9B] = 0x009B,
+  [0x9C] = 0x009C,
+  [0x9D] = 0x009D,
+  [0x9E] = 0x009E,
+  [0x9F] = 0x009F,
+  [0xA0] = 0x00A0,
+  [0xA1] = 0x00A1,
+  [0xA2] = 0x00A2,
+  [0xA3] = 0x00A3,
+  [0xA4] = 0x00A4,
+  [0xA5] = 0x00A5,
+  [0xA6] = 0x00A6,
+  [0xA7] = 0x00A7,
+  [0xA8] = 0x00A8,
+  [0xA9] = 0x00A9,
+  [0xAA] = 0x00AA,
+  [0xAB] = 0x00AB,
+  [0xAC] = 0x00AC,
+  [0xAD] = 0x00AD,
+  [0xAE] = 0x00AE,
+  [0xAF] = 0x00AF,
+  [0xB0] = 0x00B0,
+  [0xB1] = 0x00B1,
+  [0xB2] = 0x00B2,
+  [0xB3] = 0x00B3,
+  [0xB4] = 0x00B4,
+  [0xB5] = 0x00B5,
+  [0xB6] = 0x00B6,
+  [0xB7] = 0x00B7,
+  [0xB8] = 0x00B8,
+  [0xB9] = 0x00B9,
+  [0xBA] = 0x00BA,
+  [0xBB] = 0x00BB,
+  [0xBC] = 0x00BC,
+  [0xBD] = 0x00BD,
+  [0xBE] = 0x00BE,
+  [0xBF] = 0x00BF,
+  [0xC0] = 0x00C0,
+  [0xC1] = 0x00C1,
+  [0xC2] = 0x00C2,
+  [0xC3] = 0x00C3,
+  [0xC4] = 0x00C4,
+  [0xC5] = 0x00C5,
+  [0xC6] = 0x00C6,
+  [0xC7] = 0x00C7,
+  [0xC8] = 0x00C8,
+  [0xC9] = 0x00C9,
+  [0xCA] = 0x00CA,
+  [0xCB] = 0x00CB,
+  [0xCC] = 0x00CC,
+  [0xCD] = 0x00CD,
+  [0xCE] = 0x00CE,
+  [0xCF] = 0x00CF,
+  [0xD0] = 0x011E,
+  [0xD1] = 0x00D1,
+  [0xD2] = 0x00D2,
+  [0xD3] = 0x00D3,
+  [0xD4] = 0x00D4,
+  [0xD5] = 0x00D5,
+  [0xD6] = 0x00D6,
+  [0xD7] = 0x00D7,
+  [0xD8] = 0x00D8,
+  [0xD9] = 0x00D9,
+  [0xDA] = 0x00DA,
+  [0xDB] = 0x00DB,
+  [0xDC] = 0x00DC,
+  [0xDD] = 0x0130,
+  [0xDE] = 0x015E,
+  [0xDF] = 0x00DF,
+  [0xE0] = 0x00E0,
+  [0xE1] = 0x00E1,
+  [0xE2] = 0x00E2,
+  [0xE3] = 0x00E3,
+  [0xE4] = 0x00E4,
+  [0xE5] = 0x00E5,
+  [0xE6] = 0x00E6,
+  [0xE7] = 0x00E7,
+  [0xE8] = 0x00E8,
+  [0xE9] = 0x00E9,
+  [0xEA] = 0x0119,
+  [0xEB] = 0x00EB,
+  [0xEC] = 0x0117,
+  [0xED] = 0x00ED,
+  [0xEE] = 0x00EE,
+  [0xEF] = 0x012B,
+  [0xF0] = 0x011F,
+  [0xF1] = 0x00F1,
+  [0xF2] = 0x00F2,
+  [0xF3] = 0x00F3,
+  [0xF4] = 0x00F4,
+  [0xF5] = 0x00F5,
+  [0xF6] = 0x00F6,
+  [0xF7] = 0x00F7,
+  [0xF8] = 0x00F8,
+  [0xF9] = 0x00F9,
+  [0xFA] = 0x00FA,
+  [0xFB] = 0x00FB,
+  [0xFC] = 0x00FC,
+  [0xFD] = 0x0131,
+  [0xFE] = 0x015F,
+  [0xFF] = 0x00FF,
+};
+static const char from_ucs4[] = {
+  [0x0000] = 0x00,
+  [0x0001] = 0x01,
+  [0x0002] = 0x02,
+  [0x0003] = 0x03,
+  [0x0004] = 0x04,
+  [0x0005] = 0x05,
+  [0x0006] = 0x06,
+  [0x0007] = 0x07,
+  [0x0008] = 0x08,
+  [0x0009] = 0x09,
+  [0x000A] = 0x0A,
+  [0x000B] = 0x0B,
+  [0x000C] = 0x0C,
+  [0x000D] = 0x0D,
+  [0x000E] = 0x0E,
+  [0x000F] = 0x0F,
+  [0x0010] = 0x10,
+  [0x0011] = 0x11,
+  [0x0012] = 0x12,
+  [0x0013] = 0x13,
+  [0x0014] = 0x14,
+  [0x0015] = 0x15,
+  [0x0016] = 0x16,
+  [0x0017] = 0x17,
+  [0x0018] = 0x18,
+  [0x0019] = 0x19,
+  [0x001A] = 0x1A,
+  [0x001B] = 0x1B,
+  [0x001C] = 0x1C,
+  [0x001D] = 0x1D,
+  [0x001E] = 0x1E,
+  [0x001F] = 0x1F,
+  [0x0020] = 0x20,
+  [0x0021] = 0x21,
+  [0x0022] = 0x22,
+  [0x0023] = 0x23,
+  [0x0024] = 0x24,
+  [0x0025] = 0x25,
+  [0x0026] = 0x26,
+  [0x0027] = 0x27,
+  [0x0028] = 0x28,
+  [0x0029] = 0x29,
+  [0x002A] = 0x2A,
+  [0x002B] = 0x2B,
+  [0x002C] = 0x2C,
+  [0x002D] = 0x2D,
+  [0x002E] = 0x2E,
+  [0x002F] = 0x2F,
+  [0x0030] = 0x30,
+  [0x0031] = 0x31,
+  [0x0032] = 0x32,
+  [0x0033] = 0x33,
+  [0x0034] = 0x34,
+  [0x0035] = 0x35,
+  [0x0036] = 0x36,
+  [0x0037] = 0x37,
+  [0x0038] = 0x38,
+  [0x0039] = 0x39,
+  [0x003A] = 0x3A,
+  [0x003B] = 0x3B,
+  [0x003C] = 0x3C,
+  [0x003D] = 0x3D,
+  [0x003E] = 0x3E,
+  [0x003F] = 0x3F,
+  [0x0040] = 0x40,
+  [0x0041] = 0x41,
+  [0x0042] = 0x42,
+  [0x0043] = 0x43,
+  [0x0044] = 0x44,
+  [0x0045] = 0x45,
+  [0x0046] = 0x46,
+  [0x0047] = 0x47,
+  [0x0048] = 0x48,
+  [0x0049] = 0x49,
+  [0x004A] = 0x4A,
+  [0x004B] = 0x4B,
+  [0x004C] = 0x4C,
+  [0x004D] = 0x4D,
+  [0x004E] = 0x4E,
+  [0x004F] = 0x4F,
+  [0x0050] = 0x50,
+  [0x0051] = 0x51,
+  [0x0052] = 0x52,
+  [0x0053] = 0x53,
+  [0x0054] = 0x54,
+  [0x0055] = 0x55,
+  [0x0056] = 0x56,
+  [0x0057] = 0x57,
+  [0x0058] = 0x58,
+  [0x0059] = 0x59,
+  [0x005A] = 0x5A,
+  [0x005B] = 0x5B,
+  [0x005C] = 0x5C,
+  [0x005D] = 0x5D,
+  [0x005E] = 0x5E,
+  [0x005F] = 0x5F,
+  [0x0060] = 0x60,
+  [0x0061] = 0x61,
+  [0x0062] = 0x62,
+  [0x0063] = 0x63,
+  [0x0064] = 0x64,
+  [0x0065] = 0x65,
+  [0x0066] = 0x66,
+  [0x0067] = 0x67,
+  [0x0068] = 0x68,
+  [0x0069] = 0x69,
+  [0x006A] = 0x6A,
+  [0x006B] = 0x6B,
+  [0x006C] = 0x6C,
+  [0x006D] = 0x6D,
+  [0x006E] = 0x6E,
+  [0x006F] = 0x6F,
+  [0x0070] = 0x70,
+  [0x0071] = 0x71,
+  [0x0072] = 0x72,
+  [0x0073] = 0x73,
+  [0x0074] = 0x74,
+  [0x0075] = 0x75,
+  [0x0076] = 0x76,
+  [0x0077] = 0x77,
+  [0x0078] = 0x78,
+  [0x0079] = 0x79,
+  [0x007A] = 0x7A,
+  [0x007B] = 0x7B,
+  [0x007C] = 0x7C,
+  [0x007D] = 0x7D,
+  [0x007E] = 0x7E,
+  [0x007F] = 0x7F,
+  [0x0080] = 0x80,
+  [0x0081] = 0x81,
+  [0x0082] = 0x82,
+  [0x0083] = 0x83,
+  [0x0084] = 0x84,
+  [0x0085] = 0x85,
+  [0x0086] = 0x86,
+  [0x0087] = 0x87,
+  [0x0088] = 0x88,
+  [0x0089] = 0x89,
+  [0x008A] = 0x8A,
+  [0x008B] = 0x8B,
+  [0x008C] = 0x8C,
+  [0x008D] = 0x8D,
+  [0x008E] = 0x8E,
+  [0x008F] = 0x8F,
+  [0x0090] = 0x90,
+  [0x0091] = 0x91,
+  [0x0092] = 0x92,
+  [0x0093] = 0x93,
+  [0x0094] = 0x94,
+  [0x0095] = 0x95,
+  [0x0096] = 0x96,
+  [0x0097] = 0x97,
+  [0x0098] = 0x98,
+  [0x0099] = 0x99,
+  [0x009A] = 0x9A,
+  [0x009B] = 0x9B,
+  [0x009C] = 0x9C,
+  [0x009D] = 0x9D,
+  [0x009E] = 0x9E,
+  [0x009F] = 0x9F,
+  [0x00A0] = 0xA0,
+  [0x00A1] = 0xA1,
+  [0x00A2] = 0xA2,
+  [0x00A3] = 0xA3,
+  [0x00A4] = 0xA4,
+  [0x00A5] = 0xA5,
+  [0x00A6] = 0xA6,
+  [0x00A7] = 0xA7,
+  [0x00A8] = 0xA8,
+  [0x00A9] = 0xA9,
+  [0x00AA] = 0xAA,
+  [0x00AB] = 0xAB,
+  [0x00AC] = 0xAC,
+  [0x00AD] = 0xAD,
+  [0x00AE] = 0xAE,
+  [0x00AF] = 0xAF,
+  [0x00B0] = 0xB0,
+  [0x00B1] = 0xB1,
+  [0x00B2] = 0xB2,
+  [0x00B3] = 0xB3,
+  [0x00B4] = 0xB4,
+  [0x00B5] = 0xB5,
+  [0x00B6] = 0xB6,
+  [0x00B7] = 0xB7,
+  [0x00B8] = 0xB8,
+  [0x00B9] = 0xB9,
+  [0x00BA] = 0xBA,
+  [0x00BB] = 0xBB,
+  [0x00BC] = 0xBC,
+  [0x00BD] = 0xBD,
+  [0x00BE] = 0xBE,
+  [0x00BF] = 0xBF,
+  [0x00C0] = 0xC0,
+  [0x00C1] = 0xC1,
+  [0x00C2] = 0xC2,
+  [0x00C3] = 0xC3,
+  [0x00C4] = 0xC4,
+  [0x00C5] = 0xC5,
+  [0x00C6] = 0xC6,
+  [0x00C7] = 0xC7,
+  [0x00C8] = 0xC8,
+  [0x00C9] = 0xC9,
+  [0x00CA] = 0xCA,
+  [0x00CB] = 0xCB,
+  [0x00CC] = 0xCC,
+  [0x00CD] = 0xCD,
+  [0x00CE] = 0xCE,
+  [0x00CF] = 0xCF,
+  [0x00D1] = 0xD1,
+  [0x00D2] = 0xD2,
+  [0x00D3] = 0xD3,
+  [0x00D4] = 0xD4,
+  [0x00D5] = 0xD5,
+  [0x00D6] = 0xD6,
+  [0x00D7] = 0xD7,
+  [0x00D8] = 0xD8,
+  [0x00D9] = 0xD9,
+  [0x00DA] = 0xDA,
+  [0x00DB] = 0xDB,
+  [0x00DC] = 0xDC,
+  [0x00DF] = 0xDF,
+  [0x00E0] = 0xE0,
+  [0x00E1] = 0xE1,
+  [0x00E2] = 0xE2,
+  [0x00E3] = 0xE3,
+  [0x00E4] = 0xE4,
+  [0x00E5] = 0xE5,
+  [0x00E6] = 0xE6,
+  [0x00E7] = 0xE7,
+  [0x00E8] = 0xE8,
+  [0x00E9] = 0xE9,
+  [0x00EB] = 0xEB,
+  [0x00ED] = 0xED,
+  [0x00EE] = 0xEE,
+  [0x00F1] = 0xF1,
+  [0x00F2] = 0xF2,
+  [0x00F3] = 0xF3,
+  [0x00F4] = 0xF4,
+  [0x00F5] = 0xF5,
+  [0x00F6] = 0xF6,
+  [0x00F7] = 0xF7,
+  [0x00F8] = 0xF8,
+  [0x00F9] = 0xF9,
+  [0x00FA] = 0xFA,
+  [0x00FB] = 0xFB,
+  [0x00FC] = 0xFC,
+  [0x00FF] = 0xFF,
+  [0x0117] = 0xEC,
+  [0x0119] = 0xEA,
+  [0x011E] = 0xD0,
+  [0x011F] = 0xF0,
+  [0x012B] = 0xEF,
+  [0x0130] = 0xDD,
+  [0x0131] = 0xFD,
+  [0x015E] = 0xDE,
+  [0x015F] = 0xFE,
+};
diff --git a/iconvdata/iso8859-generic.c b/iconvdata/iso8859-generic.c
new file mode 100644
index 0000000000..e33e1d0a87
--- /dev/null
+++ b/iconvdata/iso8859-generic.c
@@ -0,0 +1,228 @@
+/* Generic conversion to and from ISO 8859-XXX.
+   Copyright (C) 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@cygnus.com>, 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
+   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 <gconv.h>
+#include <stdlib.h>
+#include <string.h>
+
+/* Direction of the transformation.  */
+enum direction
+{
+  illegal,
+  to_iso8859,
+  from_iso8859
+};
+
+struct iso8859_data
+{
+  enum direction dir;
+};
+
+
+int
+gconv_init (struct gconv_step *step, struct gconv_step_data *data)
+{
+  /* Determine which direction.  */
+  struct iso8859_data *new_data;
+  enum direction dir;
+  int result;
+
+  if (__strcasestr (step->from_name, NAME) != NULL)
+    dir = from_iso8859;
+  else if (__strcasestr (step->to_name, NAME) != NULL)
+    dir = to_iso8859;
+  else
+    dir = illegal;
+
+  result = GCONV_NOCONV;
+  if (dir != illegal
+      && ((new_data
+	   = (struct iso8859_data *) malloc (sizeof (struct iso8859_data)))
+	  != NULL))
+    {
+      new_data->dir = dir;
+      data->data = new_data;
+      result = GCONV_OK;
+    }
+
+  return result;
+}
+
+
+void
+gconv_end (struct gconv_step_data *data)
+{
+  free (data->data);
+}
+
+
+int
+gconv (struct gconv_step *step, struct gconv_step_data *data,
+       const char *inbuf, size_t *inbufsize, size_t *written, int do_flush)
+{
+  struct gconv_step *next_step = step + 1;
+  struct gconv_step_data *next_data = data + 1;
+  gconv_fct fct = next_step->fct;
+  size_t do_write;
+  int result;
+
+  /* If the function is called with no input this means we have to reset
+     to the initial state.  The possibly partly converted input is
+     dropped.  */
+  if (do_flush)
+    {
+      do_write = 0;
+
+      /* Call the steps down the chain if there are any.  */
+      if (data->is_last)
+	result = GCONV_OK;
+      else
+	{
+	  struct gconv_step *next_step = step + 1;
+	  struct gconv_step_data *next_data = data + 1;
+
+	  result = (*fct) (next_step, next_data, NULL, 0, written, 1);
+
+	  /* Clear output buffer.  */
+	  data->outbufavail = 0;
+	}
+    }
+  else
+    {
+      enum direction dir = ((struct iso8859_data *) data->data)->dir;
+
+      do_write = 0;
+
+      do
+	{
+	  result = GCONV_OK;
+
+	  if (dir == from_iso8859)
+	    {
+	      size_t inchars = *inbufsize;
+	      size_t outwchars = data->outbufavail;
+	      char *outbuf = data->outbuf;
+	      size_t cnt = 0;
+
+	      while (cnt < inchars
+		     && (outwchars + sizeof (wchar_t) <= data->outbufsize))
+		{
+		  wchar_t ch = to_ucs4[(int) inbuf[cnt]];
+
+		  if (ch == L'\0' && inbuf[cnt] != '\0')
+		    {
+		      /* This is an illegal character.  */
+		      result = GCONV_ILLEGAL_INPUT;
+		      break;
+		    }
+
+		  *((wchar_t *) (outbuf + outwchars)) = ch;
+		  ++do_write;
+		  outwchars += sizeof (wchar_t);
+		  ++cnt;
+		}
+	      *inbufsize -= cnt;
+	      data->outbufavail = outwchars;
+	    }
+	  else
+	    {
+	      size_t inwchars = *inbufsize;
+	      size_t outchars = data->outbufavail;
+	      char *outbuf = data->outbuf;
+	      size_t cnt = 0;
+
+	      while (inwchars >= cnt + sizeof (wchar_t)
+		     && outchars < data->outbufsize)
+		{
+		  int ch = *((wchar_t *) (inbuf + cnt));
+
+		  if (ch >= sizeof (from_ucs4) / sizeof (from_ucs4[0])
+		      || ch < 0 || (from_ucs4[ch] == '\0' && ch != 0))
+		    break;
+
+		  outbuf[outchars] = from_ucs4[ch];
+		  ++do_write;
+		  ++outchars;
+		  cnt += sizeof (wchar_t);
+		}
+	      *inbufsize -= cnt;
+	      data->outbufavail = outchars;
+
+	      if (outchars < data->outbufsize)
+		{
+		  /* If there is still room in the output buffer something
+		     is wrong with the input.  */
+		  if (inwchars >= cnt + sizeof (wchar_t))
+		    {
+		      /* An error occurred.  */
+		      result = GCONV_ILLEGAL_INPUT;
+		      break;
+		    }
+		  if (inwchars != cnt)
+		    {
+		      /* There are some unprocessed bytes at the end of the
+			 input buffer.  */
+		      result = GCONV_INCOMPLETE_INPUT;
+		      break;
+		    }
+		}
+	    }
+
+	  if (result != GCONV_OK)
+	    break;
+
+	  if (data->is_last)
+	    {
+	      /* This is the last step.  */
+	      result = (*inbufsize > (dir == from_iso8859
+				      ? 0 : sizeof (wchar_t) - 1)
+			? GCONV_FULL_OUTPUT : GCONV_EMPTY_INPUT);
+	      break;
+	    }
+
+	  /* Status so far.  */
+	  result = GCONV_EMPTY_INPUT;
+
+	  if (data->outbufavail > 0)
+	    {
+	      /* Call the functions below in the chain.  */
+	      size_t newavail = data->outbufavail;
+
+	      result = (*fct) (next_step, next_data, data->outbuf, &newavail,
+			       written, 0);
+
+	      /* Correct the output buffer.  */
+	      if (newavail != data->outbufavail && newavail > 0)
+		{
+		  memmove (data->outbuf,
+			   &data->outbuf[data->outbufavail - newavail],
+			   newavail);
+		  data->outbufavail = newavail;
+		}
+	    }
+	}
+      while (*inbufsize > 0 && result == GCONV_EMPTY_INPUT);
+    }
+
+  if (written != NULL && data->is_last)
+    *written = do_write;
+
+  return result;
+}
diff --git a/iconvdata/t61.c b/iconvdata/t61.c
new file mode 100644
index 0000000000..915b672d3e
--- /dev/null
+++ b/iconvdata/t61.c
@@ -0,0 +1,630 @@
+/* Generic conversion to and from T.61.
+   Copyright (C) 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@cygnus.com>, 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
+   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 <gconv.h>
+#include <stdlib.h>
+#include <string.h>
+
+/* Data taken from the WG15 tables.  */
+static const wchar_t to_ucs4[256] =
+{
+  /* 0x00 */ 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007,
+  /* 0x08 */ 0x0008, 0x0009, 0x000a, 0x000b, 0x000c, 0x000d, 0x000e, 0x000f,
+  /* 0x10 */ 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017,
+  /* 0x18 */ 0x0018, 0x0019, 0x001a, 0x001b, 0x001c, 0x001d, 0x001e, 0x001f,
+  /* 0x20 */ 0x0020, 0x0021, 0x0022, 0x0000, 0x0000, 0x0025, 0x0026, 0x0027,
+  /* 0x28 */ 0x0028, 0x0029, 0x002a, 0x002b, 0x002c, 0x002d, 0x002e, 0x002f,
+  /* 0x30 */ 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037,
+  /* 0x38 */ 0x0038, 0x0039, 0x003a, 0x003b, 0x003c, 0x003d, 0x003e, 0x003f,
+  /* 0x40 */ 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047,
+  /* 0x48 */ 0x0048, 0x0049, 0x004a, 0x004b, 0x004c, 0x004d, 0x004e, 0x004f,
+  /* 0x50 */ 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057,
+  /* 0x58 */ 0x0058, 0x0059, 0x005a, 0x005b, 0x0000, 0x005d, 0x0000, 0x005f,
+  /* 0x60 */ 0x0000, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067,
+  /* 0x68 */ 0x0068, 0x0069, 0x006a, 0x006b, 0x006c, 0x006d, 0x006e, 0x006f,
+  /* 0x70 */ 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077,
+  /* 0x78 */ 0x0078, 0x0079, 0x007a, 0x0000, 0x007c, 0x0000, 0x0000, 0x007f,
+  /* 0x80 */ 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087,
+  /* 0x88 */ 0x0088, 0x0089, 0x008a, 0x008b, 0x008c, 0x008d, 0x008e, 0x008f,
+  /* 0x90 */ 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097,
+  /* 0x98 */ 0x0098, 0x0099, 0x009a, 0x009b, 0x009c, 0x009d, 0x009e, 0x009f,
+  /* 0xa0 */ 0x0000, 0x00a1, 0x00a2, 0x00a3, 0x00a4, 0x00a5, 0x00a6, 0x00a7,
+  /* 0xa8 */ 0x00a8, 0x0000, 0x0000, 0x00ab, 0x0000, 0x0000, 0x0000, 0x0000,
+  /* 0xb0 */ 0x00b0, 0x00b1, 0x00b2, 0x00b3, 0x00b4, 0x00b5, 0x00b6, 0x00b7,
+  /* 0xb8 */ 0x00b8, 0x0000, 0x0000, 0x00bb, 0x00bc, 0x00bd, 0x00be, 0x00bf,
+  /* 0xc0 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+  /* 0xc8 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+  /* 0xd0 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+  /* 0xd8 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+  /* 0xe0 */ 0x2126, 0x00c6, 0x00d0, 0x00aa, 0x0126, 0x0000, 0x0132, 0x013f,
+  /* 0xe8 */ 0x0141, 0x00d8, 0x0152, 0x00ba, 0x00de, 0x0166, 0x014a, 0x0149,
+  /* 0xf0 */ 0x0138, 0x00e6, 0x0111, 0x00f0, 0x0127, 0x0131, 0x0133, 0x0140,
+  /* 0xf8 */ 0x0142, 0x00f8, 0x0153, 0x00df, 0x00fe, 0x0167, 0x014b, 0x0000
+};
+
+/* The outer array range runs from 0xc1 to 0xcf, the inner range from 0x20
+   to 0x7f.  */
+static const wchar_t to_ucs4_comb[15][96] =
+{
+  /* 0xc1 */
+  {
+    /* 0x20 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+    /* 0x28 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+    /* 0x30 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+    /* 0x38 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+    /* 0x40 */ 0x0000, 0x00c0, 0x0000, 0x0000, 0x0000, 0x00c8, 0x0000, 0x0000,
+    /* 0x48 */ 0x0000, 0x00cc, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x00d2,
+    /* 0x50 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x00d9, 0x0000, 0x0000,
+    /* 0x58 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+    /* 0x60 */ 0x0000, 0x00e0, 0x0000, 0x0000, 0x0000, 0x00e8, 0x0000, 0x0000,
+    /* 0x68 */ 0x0000, 0x00ec, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x00f2,
+    /* 0x70 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x00f9, 0x0000, 0x0000,
+    /* 0x78 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000
+  },
+  /* 0xc2 */
+  {
+    /* 0x20 */ 0x00b4, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+    /* 0x28 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+    /* 0x30 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+    /* 0x38 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+    /* 0x40 */ 0x0000, 0x00c1, 0x0000, 0x0106, 0x0000, 0x00c9, 0x0000, 0x0000,
+    /* 0x48 */ 0x0000, 0x00cd, 0x0000, 0x0000, 0x0139, 0x0000, 0x0143, 0x00d3,
+    /* 0x50 */ 0x0000, 0x0000, 0x0154, 0x015a, 0x0000, 0x00da, 0x0000, 0x0000,
+    /* 0x58 */ 0x0000, 0x00dd, 0x0179, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+    /* 0x60 */ 0x0000, 0x00e1, 0x0000, 0x0107, 0x0000, 0x00e9, 0x0000, 0x0000,
+    /* 0x68 */ 0x0000, 0x00ed, 0x0000, 0x0000, 0x013a, 0x0000, 0x0144, 0x00f3,
+    /* 0x70 */ 0x0000, 0x0000, 0x0155, 0x015b, 0x0000, 0x00fa, 0x0000, 0x0000,
+    /* 0x78 */ 0x0000, 0x00fd, 0x017a, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000
+  },
+  /* 0xc3 */
+  {
+    /* 0x20 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+    /* 0x28 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+    /* 0x30 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+    /* 0x38 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+    /* 0x40 */ 0x0000, 0x00c2, 0x0000, 0x0108, 0x0000, 0x00ca, 0x0000, 0x011c,
+    /* 0x48 */ 0x0124, 0x00ce, 0x0134, 0x0000, 0x0000, 0x0000, 0x0000, 0x00d4,
+    /* 0x50 */ 0x0000, 0x0000, 0x0000, 0x015c, 0x0000, 0x00db, 0x0000, 0x0174,
+    /* 0x58 */ 0x0000, 0x0176, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+    /* 0x60 */ 0x0000, 0x00e2, 0x0000, 0x0109, 0x0000, 0x00ea, 0x0000, 0x011d,
+    /* 0x68 */ 0x0125, 0x00ee, 0x0135, 0x0000, 0x0000, 0x0000, 0x0000, 0x00f4,
+    /* 0x70 */ 0x0000, 0x0000, 0x0000, 0x015d, 0x0000, 0x00fb, 0x0000, 0x0175,
+    /* 0x78 */ 0x0000, 0x0177, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000
+  },
+  /* 0xc4 */
+  {
+    /* 0x20 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+    /* 0x28 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+    /* 0x30 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+    /* 0x38 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+    /* 0x40 */ 0x0000, 0x00c3, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+    /* 0x48 */ 0x0000, 0x0128, 0x0000, 0x0000, 0x0000, 0x0000, 0x00d1, 0x00d5,
+    /* 0x50 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0168, 0x0000, 0x0000,
+    /* 0x58 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+    /* 0x60 */ 0x0000, 0x00e3, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+    /* 0x68 */ 0x0000, 0x0129, 0x0000, 0x0000, 0x0000, 0x0000, 0x00f1, 0x00f5,
+    /* 0x70 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0169, 0x0000, 0x0000,
+    /* 0x78 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000
+  },
+  /* 0xc5 */
+  {
+    /* 0x20 */ 0x00af, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+    /* 0x28 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+    /* 0x30 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+    /* 0x38 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+    /* 0x40 */ 0x0000, 0x0100, 0x0000, 0x0000, 0x0000, 0x0112, 0x0000, 0x0000,
+    /* 0x48 */ 0x0000, 0x012a, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x014c,
+    /* 0x50 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x016a, 0x0000, 0x0000,
+    /* 0x58 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+    /* 0x60 */ 0x0000, 0x0101, 0x0000, 0x0000, 0x0000, 0x0113, 0x0000, 0x0000,
+    /* 0x68 */ 0x0000, 0x012b, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x014d,
+    /* 0x70 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x016b, 0x0000, 0x0000,
+    /* 0x78 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000
+  },
+  /* 0xc6 */
+  {
+    /* 0x20 */ 0x02d8, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+    /* 0x28 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+    /* 0x30 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+    /* 0x38 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+    /* 0x40 */ 0x0000, 0x0102, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x011e,
+    /* 0x48 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+    /* 0x50 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x016c, 0x0000, 0x0000,
+    /* 0x58 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+    /* 0x60 */ 0x0000, 0x0103, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x011f,
+    /* 0x68 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+    /* 0x70 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x016d, 0x0000, 0x0000,
+    /* 0x78 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000
+  },
+  /* 0xc7 */
+  {
+    /* 0x20 */ 0x02d9, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+    /* 0x28 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+    /* 0x30 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+    /* 0x38 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+    /* 0x40 */ 0x0000, 0x0000, 0x0000, 0x010a, 0x0000, 0x0116, 0x0000, 0x0120,
+    /* 0x48 */ 0x0000, 0x0130, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+    /* 0x50 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+    /* 0x58 */ 0x0000, 0x0000, 0x017b, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+    /* 0x60 */ 0x0000, 0x0000, 0x0000, 0x010b, 0x0000, 0x0117, 0x0000, 0x0121,
+    /* 0x68 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+    /* 0x70 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+    /* 0x78 */ 0x0000, 0x0000, 0x017c, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000
+  },
+  /* 0xc8 */
+  {
+    /* 0x20 */ 0x00a8, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+    /* 0x28 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+    /* 0x30 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+    /* 0x38 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+    /* 0x40 */ 0x0000, 0x00c4, 0x0000, 0x0000, 0x0000, 0x00cb, 0x0000, 0x0000,
+    /* 0x48 */ 0x0000, 0x00cf, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x00d6,
+    /* 0x50 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x00dc, 0x0000, 0x0000,
+    /* 0x58 */ 0x0000, 0x0178, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+    /* 0x60 */ 0x0000, 0x00e4, 0x0000, 0x0000, 0x0000, 0x00eb, 0x0000, 0x0000,
+    /* 0x68 */ 0x0000, 0x00ef, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x00f6,
+    /* 0x70 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x00fc, 0x0000, 0x0000,
+    /* 0x78 */ 0x0000, 0x00ff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000
+  },
+  /* 0xc9 */
+  {
+    0x0000,
+  },
+  /* 0xca */
+  {
+    /* 0x20 */ 0x02da, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+    /* 0x28 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+    /* 0x30 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+    /* 0x38 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+    /* 0x40 */ 0x0000, 0x00c5, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+    /* 0x48 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+    /* 0x50 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x016e, 0x0000, 0x0000,
+    /* 0x58 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+    /* 0x60 */ 0x0000, 0x00e5, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+    /* 0x68 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+    /* 0x70 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x016f, 0x0000, 0x0000,
+    /* 0x78 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000
+  },
+  /* 0xcb */
+  {
+    /* 0x20 */ 0x00b8, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+    /* 0x28 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+    /* 0x30 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+    /* 0x38 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+    /* 0x40 */ 0x0000, 0x0000, 0x0000, 0x00c7, 0x0000, 0x0000, 0x0000, 0x0122,
+    /* 0x48 */ 0x0000, 0x0000, 0x0000, 0x0136, 0x013b, 0x0000, 0x0145, 0x0000,
+    /* 0x50 */ 0x0000, 0x0000, 0x0156, 0x015e, 0x0162, 0x0000, 0x0000, 0x0000,
+    /* 0x58 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+    /* 0x60 */ 0x0000, 0x0000, 0x0000, 0x00e7, 0x0000, 0x0000, 0x0000, 0x0123,
+    /* 0x68 */ 0x0000, 0x0000, 0x0000, 0x0137, 0x013c, 0x0000, 0x0146, 0x0000,
+    /* 0x70 */ 0x0000, 0x0000, 0x0157, 0x015f, 0x0163, 0x0000, 0x0000, 0x0000,
+    /* 0x78 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000
+  },
+  /* 0xcc */
+  {
+    0x0000,
+  },
+  /* 0xcd */
+  {
+    /* 0x20 */ 0x02dd, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+    /* 0x28 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+    /* 0x30 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+    /* 0x38 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+    /* 0x40 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+    /* 0x48 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0150,
+    /* 0x50 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0170, 0x0000, 0x0000,
+    /* 0x58 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+    /* 0x60 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+    /* 0x68 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0151,
+    /* 0x70 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0171, 0x0000, 0x0000,
+    /* 0x78 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000
+  },
+  /* 0xce */
+  {
+    /* 0x20 */ 0x02db, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+    /* 0x28 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+    /* 0x30 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+    /* 0x38 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+    /* 0x40 */ 0x0000, 0x0104, 0x0000, 0x0000, 0x0000, 0x0118, 0x0000, 0x0000,
+    /* 0x48 */ 0x0000, 0x012e, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+    /* 0x50 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0172, 0x0000, 0x0000,
+    /* 0x58 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+    /* 0x60 */ 0x0000, 0x0105, 0x0000, 0x0000, 0x0000, 0x0119, 0x0000, 0x0000,
+    /* 0x68 */ 0x0000, 0x012f, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+    /* 0x70 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0173, 0x0000, 0x0000,
+    /* 0x78 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000
+  },
+  /* 0xcf */
+  {
+    /* 0x20 */ 0x02c7, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+    /* 0x28 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+    /* 0x30 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+    /* 0x38 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+    /* 0x40 */ 0x0000, 0x0000, 0x0000, 0x010c, 0x010e, 0x011a, 0x0000, 0x0000,
+    /* 0x48 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x013d, 0x0000, 0x0147, 0x0000,
+    /* 0x50 */ 0x0000, 0x0000, 0x0158, 0x0160, 0x0164, 0x0000, 0x0000, 0x0000,
+    /* 0x58 */ 0x0000, 0x0000, 0x017d, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+    /* 0x60 */ 0x0000, 0x0000, 0x0000, 0x010d, 0x010f, 0x011b, 0x0000, 0x0000,
+    /* 0x68 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x013e, 0x0000, 0x0148, 0x0000,
+    /* 0x70 */ 0x0000, 0x0000, 0x0159, 0x0161, 0x0165, 0x0000, 0x0000, 0x0000,
+    /* 0x78 */ 0x0000, 0x0000, 0x017e, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000
+  }
+};
+
+
+static const char from_ucs4[][2] =
+{
+  /* 0x0000 */ "\x00\x00", "\x01\x00", "\x02\x00", "\x03\x00", "\x04\x00",
+  /* 0x0005 */ "\x05\x00", "\x06\x00", "\x07\x00", "\x08\x00", "\x09\x00",
+  /* 0x000a */ "\x0a\x00", "\x0b\x00", "\x0c\x00", "\x0d\x00", "\x0e\x00",
+  /* 0x000f */ "\x0f\x00", "\x10\x00", "\x11\x00", "\x12\x00", "\x13\x00",
+  /* 0x0014 */ "\x14\x00", "\x15\x00", "\x16\x00", "\x17\x00", "\x18\x00",
+  /* 0x0019 */ "\x19\x00", "\x1a\x00", "\x1b\x00", "\x1c\x00", "\x1d\x00",
+  /* 0x001e */ "\x1e\x00", "\x1f\x00", "\x20\x00", "\x21\x00", "\x22\x00",
+  /* 0x0023 */ "\x23\x00", "\x24\x00", "\x25\x00", "\x26\x00", "\x27\x00",
+  /* 0x0028 */ "\x28\x00", "\x29\x00", "\x2a\x00", "\x2b\x00", "\x2c\x00",
+  /* 0x002d */ "\x2d\x00", "\x2e\x00", "\x2f\x00", "\x30\x00", "\x31\x00",
+  /* 0x0032 */ "\x32\x00", "\x33\x00", "\x34\x00", "\x35\x00", "\x36\x00",
+  /* 0x0037 */ "\x37\x00", "\x38\x00", "\x39\x00", "\x3a\x00", "\x3b\x00",
+  /* 0x003c */ "\x3c\x00", "\x3d\x00", "\x3e\x00", "\x3f\x00", "\x40\x00",
+  /* 0x0041 */ "\x41\x00", "\x42\x00", "\x43\x00", "\x44\x00", "\x45\x00",
+  /* 0x0046 */ "\x46\x00", "\x47\x00", "\x48\x00", "\x49\x00", "\x4a\x00",
+  /* 0x004b */ "\x4b\x00", "\x4c\x00", "\x4d\x00", "\x4e\x00", "\x4f\x00",
+  /* 0x0050 */ "\x50\x00", "\x51\x00", "\x52\x00", "\x53\x00", "\x54\x00",
+  /* 0x0055 */ "\x55\x00", "\x56\x00", "\x57\x00", "\x58\x00", "\x59\x00",
+  /* 0x005a */ "\x5a\x00", "\x5b\x00", "\x00\x00", "\x5d\x00", "\x00\x00",
+  /* 0x005f */ "\x5f\x00", "\x00\x00", "\x61\x00", "\x62\x00", "\x63\x00",
+  /* 0x0064 */ "\x64\x00", "\x65\x00", "\x66\x00", "\x67\x00", "\x68\x00",
+  /* 0x0069 */ "\x69\x00", "\x6a\x00", "\x6b\x00", "\x6c\x00", "\x6d\x00",
+  /* 0x006e */ "\x6e\x00", "\x6f\x00", "\x70\x00", "\x71\x00", "\x72\x00",
+  /* 0x0073 */ "\x73\x00", "\x74\x00", "\x75\x00", "\x76\x00", "\x77\x00",
+  /* 0x0078 */ "\x78\x00", "\x79\x00", "\x7a\x00", "\x00\x00", "\x7c\x00",
+  /* 0x007d */ "\x00\x00", "\x00\x00", "\x7f\x00", "\x00\x80", "\x00\x81",
+  /* 0x0082 */ "\x82\x00", "\x83\x00", "\x84\x00", "\x85\x00", "\x86\x00",
+  /* 0x0087 */ "\x87\x00", "\x88\x00", "\x89\x00", "\x8a\x00", "\x8b\x00",
+  /* 0x008c */ "\x8c\x00", "\x8d\x00", "\x8e\x00", "\x8f\x00", "\x90\x00",
+  /* 0x0091 */ "\x91\x00", "\x92\x00", "\x93\x00", "\x94\x00", "\x95\x00",
+  /* 0x0096 */ "\x96\x00", "\x97\x00", "\x98\x00", "\x99\x00", "\x9a\x00",
+  /* 0x009b */ "\x9b\x00", "\x9c\x00", "\x9d\x00", "\x9e\x00", "\x9f\x00",
+  /* 0x00a0 */ "\x00\x00", "\xa1\x00", "\xa2\x00", "\xa3\x00", "\xa4\x00",
+  /* 0x00a5 */ "\xa5\x00", "\x00\x00", "\xa7\x00", "\xc8\x20", "\x00\x00",
+  /* 0x00aa */ "\xe3\x00", "\xab\x00", "\x00\x00", "\x00\x00", "\x00\x00",
+  /* 0x00af */ "\xc5\x20", "\xb0\x00", "\xb1\x00", "\xb2\x00", "\xb3\x00",
+  /* 0x00b4 */ "\xc2\x20", "\xb5\x00", "\xb6\x00", "\xb7\x00", "\xcb\x20",
+  /* 0x00b9 */ "\x00\x00", "\xeb\x00", "\x00\x00", "\xbc\x00", "\xbd\x00",
+  /* 0x00be */ "\xbe\x00", "\xbf\x00", "\xc1\x41", "\xc2\x41", "\xc3\x41",
+  /* 0x00c3 */ "\xc4\x41", "\xc8\x41", "\xca\x41", "\xe1\x00", "\xcb\x43",
+  /* 0x00c8 */ "\xc1\x45", "\xc2\x45", "\xc3\x45", "\xc8\x45", "\xc1\x49",
+  /* 0x00cd */ "\xc2\x49", "\xc3\x49", "\xc8\x49", "\xe2\x00", "\xc4\x4e",
+  /* 0x00d2 */ "\xc1\x4f", "\xc2\x4f", "\xc3\x4f", "\xc4\x4f", "\xc8\x4f",
+  /* 0x00d7 */ "\xb4\x00", "\xe9\x00", "\xc1\x55", "\xc2\x55", "\xc3\x55",
+  /* 0x00dc */ "\xc8\x55", "\xc2\x59", "\xec\x00", "\xfb\x00", "\xc1\x61",
+  /* 0x00e1 */ "\xc2\x61", "\xc3\x61", "\xc4\x61", "\xc8\x61", "\xca\x61",
+  /* 0x00e6 */ "\xf1\x00", "\xcb\x63", "\xc1\x65", "\xc2\x65", "\xc3\x65",
+  /* 0x00eb */ "\xc8\x65", "\xc1\x69", "\xc2\xe9", "\xc3\x69", "\xc8\x69",
+  /* 0x00f0 */ "\xf3\x00", "\xc4\x6e", "\xc1\x6f", "\xc2\x6f", "\xc3\x6f",
+  /* 0x00f5 */ "\xc4\x6f", "\xc8\x6f", "\xb8\x00", "\xf9\x00", "\xc1\x75",
+  /* 0x00fa */ "\xc2\x75", "\xc3\x75", "\xc8\x75", "\xc2\x79", "\xfc\x00",
+  /* 0x00ff */ "\xc8\x79", "\xc5\x41", "\xc5\x61", "\xc6\x41", "\xc6\x61",
+  /* 0x0104 */ "\xce\x41", "\xce\x61", "\xc2\x43", "\xc2\x63", "\xc3\x43",
+  /* 0x0109 */ "\xc3\x63", "\xc7\x43", "\xc7\x63", "\xcf\x43", "\xcf\x63",
+  /* 0x010e */ "\xcf\x44", "\xcf\x64", "\x00\x00", "\xf2\x00", "\xc5\x45",
+  /* 0x0113 */ "\xc5\x65", "\x00\x00", "\x00\x00", "\xc7\x45", "\xc7\x65",
+  /* 0x0118 */ "\xce\x45", "\xce\x65", "\xcf\x45", "\xcf\x65", "\xc3\x47",
+  /* 0x011d */ "\xc3\x67", "\xc6\x47", "\xc6\x67", "\xc7\x47", "\xc7\x67",
+  /* 0x0122 */ "\xcb\x47", "\xcb\x67", "\xc3\x48", "\xc3\x68", "\xe4\x00",
+  /* 0x0127 */ "\xf4\x00", "\xc4\x49", "\xc4\x69", "\xc5\x49", "\xc5\x69",
+  /* 0x012c */ "\x00\x00", "\x00\x00", "\xce\x49", "\xce\x69", "\xc7\x49",
+  /* 0x0131 */ "\xf5\x00", "\xe6\x00", "\xf6\x00", "\xc3\x4a", "\xc3\x6a",
+  /* 0x0136 */ "\xcb\x4b", "\xcb\x6b", "\xf0\x00", "\xc2\x4c", "\xc2\x6c",
+  /* 0x013b */ "\xcb\x4c", "\xcb\x6c", "\xcf\x4c", "\xcf\x6c", "\xe7\x00",
+  /* 0x0140 */ "\xf7\x00", "\xe8\x00", "\xf8\x00", "\xc2\x4e", "\xc2\x6e",
+  /* 0x0145 */ "\xcb\x4e", "\xcb\x6e", "\xcf\x4e", "\xcf\x6e", "\xef\x00",
+  /* 0x014a */ "\xee\x00", "\xfe\x00", "\xc5\x4f", "\xc5\x6f", "\x00\x00",
+  /* 0x014f */ "\x00\x00", "\xcd\x4f", "\xcd\x6f", "\xea\x00", "\xfa\x00",
+  /* 0x0154 */ "\xc2\x52", "\xc2\x72", "\xcb\x52", "\xcb\x72", "\xcf\x52",
+  /* 0x0159 */ "\xcf\x72", "\xc2\x53", "\xc2\x73", "\xc3\x53", "\xc3\x73",
+  /* 0x015e */ "\xcb\x53", "\xcb\x73", "\xcf\x53", "\xcf\x73", "\xcb\x54",
+  /* 0x0163 */ "\xcb\x74", "\xcf\x54", "\xcf\x74", "\xed\x00", "\xfd\x00",
+  /* 0x0168 */ "\xc4\x55", "\xc4\x75", "\xc5\x55", "\xc5\x75", "\xc6\x55",
+  /* 0x016d */ "\xc6\x75", "\xca\x55", "\xca\x75", "\xcd\x55", "\xcd\x75",
+  /* 0x0172 */ "\xce\x55", "\xce\x75", "\xc3\x57", "\xc3\x77", "\xc3\x59",
+  /* 0x0177 */ "\xc3\x79", "\xc8\x59", "\xc2\x5a", "\xc2\x7a", "\xc7\x5a",
+  /* 0x017c */ "\xc7\x7a", "\xcf\x5a", "\xcf\x7a"
+/*
+   This table does not cover the following positions:
+
+     0x02c7    "\xcf\x20",
+     ...
+     0x02d8    "\xc6\x20", "\xc7\x20", "\xca\x20", "\xce\x20", "\x00\x00",
+     0x02dd    "\xcd\x20",
+     ...
+     0x2126    "\xe0\x00"
+
+   These would blow up the table and are therefore handled specially in
+   the code.
+*/
+};
+
+/* Direction of the transformation.  */
+enum direction
+{
+  illegal,
+  to_t61,
+  from_t61
+};
+
+struct t61_data
+{
+  enum direction dir;
+};
+
+
+int
+gconv_init (struct gconv_step *step, struct gconv_step_data *data)
+{
+  /* Determine which direction.  */
+  struct t61_data *new_data;
+  enum direction dir;
+  int result;
+
+  if (__strcasestr (step->from_name, "T.61") != NULL)
+    dir = from_t61;
+  else if (__strcasestr (step->to_name, "T.61") != NULL)
+    dir = to_t61;
+  else
+    dir = illegal;
+
+  result = GCONV_NOCONV;
+  if (dir != illegal
+      && ((new_data
+	   = (struct t61_data *) malloc (sizeof (struct t61_data)))
+	  != NULL))
+    {
+      new_data->dir = dir;
+      data->data = new_data;
+      result = GCONV_OK;
+    }
+
+  return result;
+}
+
+
+void
+gconv_end (struct gconv_step_data *data)
+{
+  free (data->data);
+}
+
+
+int
+gconv (struct gconv_step *step, struct gconv_step_data *data,
+       const char *inbuf, size_t *inbufsize, size_t *written, int do_flush)
+{
+  struct gconv_step *next_step = step + 1;
+  struct gconv_step_data *next_data = data + 1;
+  gconv_fct fct = next_step->fct;
+  size_t do_write;
+  int result;
+
+  /* If the function is called with no input this means we have to reset
+     to the initial state.  The possibly partly converted input is
+     dropped.  */
+  if (do_flush)
+    {
+      do_write = 0;
+
+      /* Call the steps down the chain if there are any.  */
+      if (data->is_last)
+	result = GCONV_OK;
+      else
+	{
+	  struct gconv_step *next_step = step + 1;
+	  struct gconv_step_data *next_data = data + 1;
+
+	  result = (*fct) (next_step, next_data, NULL, 0, written, 1);
+
+	  /* Clear output buffer.  */
+	  data->outbufavail = 0;
+	}
+    }
+  else
+    {
+      enum direction dir = ((struct t61_data *) data->data)->dir;
+
+      do_write = 0;
+
+      do
+	{
+	  result = GCONV_OK;
+
+	  if (dir == from_t61)
+	    {
+	      size_t inchars = *inbufsize;
+	      size_t outwchars = data->outbufavail;
+	      char *outbuf = data->outbuf;
+	      size_t cnt = 0;
+
+	      while (cnt < inchars
+		     && (outwchars + sizeof (wchar_t) <= data->outbufsize))
+		{
+		  int inchar = inbuf[cnt];
+		  wchar_t ch;
+
+		  if (inchar >= '\xc1' && inchar <= '\xcf')
+		    {
+		      /* Composed character.  First test whether the next
+			 character is also available.  */
+		      int inchar2;
+
+		      if (cnt + 1 >= inchars)
+			{
+			  /* The second character is not available.  Store
+			     the intermediate result.  */
+			  result = GCONV_INCOMPLETE_INPUT;
+			  break;
+			}
+
+		      inchar2 = inbuf[++cnt];
+
+		      if (inchar2 < '\x20' || inchar2 >= '\x80')
+			/* This is illegal.  */
+			ch = L'\0';
+		      else
+			ch = to_ucs4_comb[inchar - 0xc1][inchar2 - 0x20];
+		    }
+		  else
+		    ch = to_ucs4[inchar];
+
+		  if (ch == L'\0' && inbuf[cnt] != '\0')
+		    {
+		      /* This is an illegal character.  */
+		      result = GCONV_ILLEGAL_INPUT;
+		      break;
+		    }
+
+		  *((wchar_t *) (outbuf + outwchars)) = ch;
+		  ++do_write;
+		  outwchars += sizeof (wchar_t);
+		  ++cnt;
+		}
+	      *inbufsize -= cnt;
+	      data->outbufavail = outwchars;
+	    }
+	  else
+	    {
+	      size_t inwchars = *inbufsize;
+	      size_t outchars = data->outbufavail;
+	      char *outbuf = data->outbuf;
+	      size_t cnt = 0;
+	      int extra = 0;
+
+	      while (inwchars >= cnt + sizeof (wchar_t)
+		     && outchars < data->outbufsize)
+		{
+		  char tmp[2];
+		  int ch = *((wchar_t *) (inbuf + cnt));
+		  const char *cp;
+
+		  if (ch >= sizeof (from_ucs4) / sizeof (from_ucs4[0]))
+		    {
+		      if (ch == 0x2126)
+			cp = "\xe0";
+		      else if (ch == 0x2c7)
+			cp = "\xcf\x20";
+		      else if (ch < 0x2d8 || ch > 0x2dd)
+			/* Illegal characters.  */
+			break;
+		      else
+			{
+			  static const char map[5] = "\xc6\xc7\xca\xce\xcd";
+
+			  tmp[0] = map[ch - 0x2d8];
+			  tmp[1] = ' ';
+			  cp = tmp;
+			}
+		    }
+		  else if (ch < 0 || (from_ucs4[ch][0] == '\0' && ch != 0))
+		    break;
+		  else
+		    cp = from_ucs4[ch];
+
+		  outbuf[outchars] = cp[0];
+		  /* Now test for a possible second byte and write this
+		     if possible.  */
+		  if (cp[1] != '\0')
+		    {
+		      if (outchars + 1 >= data->outbufsize)
+			{
+			  /* The result does not fit into the buffer.  */
+			  extra = 1;
+			  break;
+			}
+		      outbuf[++outchars] = cp[1];
+		    }
+
+		  ++do_write;
+		  ++outchars;
+		  cnt += sizeof (wchar_t);
+		}
+	      *inbufsize -= cnt;
+	      data->outbufavail = outchars;
+
+	      if (outchars + extra < data->outbufsize)
+		{
+		  /* If there is still room in the output buffer something
+		     is wrong with the input.  */
+		  if (inwchars >= cnt + sizeof (wchar_t))
+		    {
+		      /* An error occurred.  */
+		      result = GCONV_ILLEGAL_INPUT;
+		      break;
+		    }
+		  if (inwchars != cnt)
+		    {
+		      /* There are some unprocessed bytes at the end of the
+			 input buffer.  */
+		      result = GCONV_INCOMPLETE_INPUT;
+		      break;
+		    }
+		}
+	    }
+
+	  if (result != GCONV_OK)
+	    break;
+
+	  if (data->is_last)
+	    {
+	      /* This is the last step.  */
+	      result = (*inbufsize > (dir == from_t61
+				      ? 0 : sizeof (wchar_t) - 1)
+			? GCONV_FULL_OUTPUT : GCONV_EMPTY_INPUT);
+	      break;
+	    }
+
+	  /* Status so far.  */
+	  result = GCONV_EMPTY_INPUT;
+
+	  if (data->outbufavail > 0)
+	    {
+	      /* Call the functions below in the chain.  */
+	      size_t newavail = data->outbufavail;
+
+	      result = (*fct) (next_step, next_data, data->outbuf, &newavail,
+			       written, 0);
+
+	      /* Correct the output buffer.  */
+	      if (newavail != data->outbufavail && newavail > 0)
+		{
+		  memmove (data->outbuf,
+			   &data->outbuf[data->outbufavail - newavail],
+			   newavail);
+		  data->outbufavail = newavail;
+		}
+	    }
+	}
+      while (*inbufsize > 0 && result == GCONV_EMPTY_INPUT);
+    }
+
+  if (written != NULL && data->is_last)
+    *written = do_write;
+
+  return result;
+}
diff --git a/io/ftw.h b/io/ftw.h
index f71a86e13f..298e58ed8a 100644
--- a/io/ftw.h
+++ b/io/ftw.h
@@ -26,7 +26,7 @@
 #include <features.h>
 
 #include <sys/types.h>
-#include <bits/stat.h>
+#include <sys/stat.h>
 
 
 __BEGIN_DECLS
diff --git a/login/pty.h b/login/pty.h
index 0005f10e2d..bfd4530730 100644
--- a/login/pty.h
+++ b/login/pty.h
@@ -1,4 +1,4 @@
-/* pty.h - Functions for pseudo TTY handling.
+/* Functions for pseudo TTY handling.
    Copyright (C) 1996, 1997 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
@@ -22,8 +22,8 @@
 
 #include <features.h>
 
-#include <bits/ioctl-types.h>
 #include <termios.h>
+#include <sys/ioctl.h>
 
 
 __BEGIN_DECLS
diff --git a/manual/arith.texi b/manual/arith.texi
index 3e153fcfa7..3a6bb434de 100644
--- a/manual/arith.texi
+++ b/manual/arith.texi
@@ -163,11 +163,11 @@ One can use it to easily construct complex number like in
 @smallexample
 3.0 - _Imaginary_I * 4.0
 @end smallexample
-@end deftypevr
 
 @noindent
 which results in the complex number with a real part of 3.0 and a
 imaginary part -4.0.
+@end deftypevr
 
 @noindent
 A more intuitive approach is to use the following macro.
diff --git a/string/Makefile b/string/Makefile
index 1a1b269845..5b11a5885a 100644
--- a/string/Makefile
+++ b/string/Makefile
@@ -33,7 +33,7 @@ routines	:= strcat strchr strcmp strcoll strcpy strcspn		\
 		   strtok_r strxfrm memchr memcmp memmove memset	\
 		   mempcpy bcopy bzero ffs stpcpy stpncpy		\
 		   strcasecmp strncase strcasecmp_l strncase_l		\
-		   memccpy memcpy wordcopy strsep			\
+		   memccpy memcpy wordcopy strsep strcasestr		\
 		   swab strfry memfrob memmem				\
 		   $(addprefix argz-,append count create ctsep next	\
 			             delete extract insert stringify	\
diff --git a/string/string.h b/string/string.h
index e95d7cac96..8bf4a87098 100644
--- a/string/string.h
+++ b/string/string.h
@@ -154,6 +154,15 @@ extern size_t strspn __P ((__const char *__s, __const char *__accept));
 extern char *strpbrk __P ((__const char *__s, __const char *__accept));
 /* Find the first occurrence of NEEDLE in HAYSTACK.  */
 extern char *strstr __P ((__const char *__haystack, __const char *__needle));
+
+#ifdef __USE_GNU
+/* Similar to `strstr' but this function ignores the case of both strings.  */
+extern char *__strcasestr __P ((__const char *__haystack,
+				__const char *__needle));
+extern char *strcasestr __P ((__const char *__haystack,
+			      __const char *__needle));
+#endif
+
 /* Divide S into tokens separated by characters in DELIM.  */
 extern char *strtok __P ((char *__restrict __s,
 			  __const char *__restrict __delim));
diff --git a/sysdeps/alpha/bits/endian.h b/sysdeps/alpha/bits/endian.h
index e873d2123c..8a16e14e24 100644
--- a/sysdeps/alpha/bits/endian.h
+++ b/sysdeps/alpha/bits/endian.h
@@ -1,3 +1,7 @@
 /* Alpha is little-endian.  */
 
+#ifndef _ENDIAN_H
+# error "Never use <bits/endian.h> directly; include <endian.h> instead."
+#endif
+
 #define __BYTE_ORDER __LITTLE_ENDIAN
diff --git a/sysdeps/alpha/bits/setjmp.h b/sysdeps/alpha/bits/setjmp.h
index 9aa30463d6..de37019218 100644
--- a/sysdeps/alpha/bits/setjmp.h
+++ b/sysdeps/alpha/bits/setjmp.h
@@ -17,6 +17,10 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
+#ifndef _SETJMP_H
+# error "Never include <bits/setjmp.h> directly; use <setjmp.h> instead."
+#endif
+
 /* The previous bits/setjmp.h had __jmp_buf defined as a structure.
    We use an array of 'long int' instead, to make writing the
    assembler easier. Naturally, user code should not depend on
@@ -48,24 +52,24 @@
  * registers.
  */
 
-#if defined(__USE_MISC) || defined(__ASSEMBLY__)
-#define JB_S0  0
-#define JB_S1  1
-#define JB_S2  2
-#define JB_S3  3
-#define JB_S4  4
-#define JB_S5  5
-#define JB_PC  6
-#define JB_FP  7
-#define JB_SP  8
-#define JB_F2  9
-#define JB_F3  10
-#define JB_F4  11
-#define JB_F5  12
-#define JB_F6  13
-#define JB_F7  14
-#define JB_F8  15
-#define JB_F9  16
+#if defined __USE_MISC || defined __ASSEMBLY__
+# define JB_S0  0
+# define JB_S1  1
+# define JB_S2  2
+# define JB_S3  3
+# define JB_S4  4
+# define JB_S5  5
+# define JB_PC  6
+# define JB_FP  7
+# define JB_SP  8
+# define JB_F2  9
+# define JB_F3  10
+# define JB_F4  11
+# define JB_F5  12
+# define JB_F6  13
+# define JB_F7  14
+# define JB_F8  15
+# define JB_F9  16
 #endif
 
 #ifndef __ASSEMBLY__
diff --git a/sysdeps/alpha/fpu/bits/fenv.h b/sysdeps/alpha/fpu/bits/fenv.h
index 7cb0e3e543..4482f0a2dd 100644
--- a/sysdeps/alpha/fpu/bits/fenv.h
+++ b/sysdeps/alpha/fpu/bits/fenv.h
@@ -1,6 +1,5 @@
 /* Copyright (C) 1997 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
-   Contributed by Richard Henderson <rth@tamu.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
@@ -18,7 +17,7 @@
    Boston, MA 02111-1307, USA.  */
 
 #ifndef _FENV_H
-#error "Never use <bits/fenv.h> directly; include <fenv.h> instead."
+# error "Never use <bits/fenv.h> directly; include <fenv.h> instead."
 #endif
 
 
@@ -51,20 +50,20 @@ enum
 
     FE_INVALID =	1UL << 17,
 #define FE_INVALID	FE_INVALID
-    
+
     FE_ALL_EXCEPT =
 	(FE_INEXACT | FE_DIVBYZERO | FE_UNDERFLOW | FE_OVERFLOW | FE_INVALID)
-#define FE_ALL_EXCEPT	FE_ALL_EXCEPT 
+#define FE_ALL_EXCEPT	FE_ALL_EXCEPT
   };
 
 
-/* Alpha chips support all four defined rouding modes. 
+/* Alpha chips support all four defined rouding modes.
 
    Note that code must be compiled to use dynamic rounding (/d) instructions
    to see these changes.  For gcc this is -mfp-rounding-mode=d; for DEC cc
-   this is -fprm d.  The default for both is static rounding to nearest. 
+   this is -fprm d.  The default for both is static rounding to nearest.
 
-   These are shifted down 58 bits from the hardware fpcr because the 
+   These are shifted down 58 bits from the hardware fpcr because the
    functions are declared to take integers.  */
 
 enum
@@ -100,5 +99,5 @@ typedef unsigned long fenv_t;
 #endif
 
 /* The system calls to talk to the kernel's FP code.  */
-extern unsigned long __ieee_get_fp_control(void);
-extern void __ieee_set_fp_control(unsigned long);
+extern unsigned long int __ieee_get_fp_control __P ((void));
+extern void __ieee_set_fp_control __P ((unsigned long int __value));
diff --git a/sysdeps/arm/bits/endian.h b/sysdeps/arm/bits/endian.h
index 32f8489df2..ad3b5393bc 100644
--- a/sysdeps/arm/bits/endian.h
+++ b/sysdeps/arm/bits/endian.h
@@ -1,3 +1,7 @@
 /* ARM is little-endian.  */
 
+#ifndef _ENDIAN_H
+# error "Never use <bits/endian.h> directly; include <endian.h> instead."
+#endif
+
 #define __BYTE_ORDER __LITTLE_ENDIAN
diff --git a/sysdeps/arm/bits/setjmp.h b/sysdeps/arm/bits/setjmp.h
index 93b0f5f916..5cf9cd75c7 100644
--- a/sysdeps/arm/bits/setjmp.h
+++ b/sysdeps/arm/bits/setjmp.h
@@ -1,10 +1,14 @@
 /* Define the machine-dependent type `jmp_buf'.  ARM version. */
 
+#ifndef _SETJMP_H
+# error "Never include <bits/setjmp.h> directly; use <setjmp.h> instead."
+#endif
+
 #ifndef _ASM
 /* Jump buffer contains v1-v6, sl, fp, sp, pc and (f4-f7) if we do FP. */
-#if __ARM_USES_FP
+# if __ARM_USES_FP
 typedef int __jmp_buf[22];
-#else
+# else
 typedef int __jmp_buf[10];
-#endif
+# endif
 #endif
diff --git a/sysdeps/generic/bits/byteswap.h b/sysdeps/generic/bits/byteswap.h
index 9404cc452e..04a5efe9f0 100644
--- a/sysdeps/generic/bits/byteswap.h
+++ b/sysdeps/generic/bits/byteswap.h
@@ -17,8 +17,9 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-#ifndef _BITS_BYTESWAP_H
-#define _BITS_BYTESWAP_H	1
+#if !defined _BYTESWAP_H && !defined _NETINET_IN_H
+# error "Never use <bits/byteswap.h> directly; include <byteswap.h> instead."
+#endif
 
 /* Swap bytes in 16 bit value.  */
 #define __bswap_16(x) \
@@ -39,5 +40,3 @@
 	__r.__l[1] = __bswap_32 (__v.__l[0]);				      \
 	__r.__ll; })
 #endif
-
-#endif /* bits/byteswap.h */
diff --git a/sysdeps/generic/bits/confname.h b/sysdeps/generic/bits/confname.h
index 40228e11ed..4653887468 100644
--- a/sysdeps/generic/bits/confname.h
+++ b/sysdeps/generic/bits/confname.h
@@ -17,6 +17,10 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
+#ifndef _UNISTD_H
+# error "Never use <bits/confname.h> directly; include <unistd.h> instead."
+#endif
+
 /* Values for the NAME argument to `pathconf' and `fpathconf'.  */
 enum
   {
diff --git a/sysdeps/generic/bits/dirent.h b/sysdeps/generic/bits/dirent.h
index 2f7dca78aa..366cdf8ce2 100644
--- a/sysdeps/generic/bits/dirent.h
+++ b/sysdeps/generic/bits/dirent.h
@@ -1,5 +1,5 @@
 /* Directory entry structure `struct dirent'.  Stub version.
-   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
@@ -17,6 +17,10 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
+#ifndef _DIRENT_H
+# error "Never use <bits/dirent.h> directly; include <dirent.h> instead."
+#endif
+
 struct dirent
   {
     char d_name[1];		/* Variable length.  */
diff --git a/sysdeps/generic/bits/dlfcn.h b/sysdeps/generic/bits/dlfcn.h
index 79604fe8ff..7c33694018 100644
--- a/sysdeps/generic/bits/dlfcn.h
+++ b/sysdeps/generic/bits/dlfcn.h
@@ -17,8 +17,9 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-#ifndef	_BITS_DLFCN_H
-#define	_BITS_DLFCN_H 1
+#ifndef _DLFCN_H
+# error "Never use <bits/dlfcn.h> directly; include <dlfcn.h> instead."
+#endif
 
 /* The MODE argument to `dlopen' contains one of the following: */
 #define RTLD_LAZY	0x001	/* Lazy function call binding.  */
@@ -29,5 +30,3 @@
    the symbols of the loaded object and its dependencies are made
    visible as if the object were linked directly into the program.  */
 #define RTLD_GLOBAL	0x100
-
-#endif	/* bits/dlfcn.h */
diff --git a/sysdeps/generic/bits/endian.h b/sysdeps/generic/bits/endian.h
index 597f079a0f..45afd4ae47 100644
--- a/sysdeps/generic/bits/endian.h
+++ b/sysdeps/generic/bits/endian.h
@@ -6,4 +6,8 @@
    So if cross-compiling to a machine with a different byte order,
    the bits/endian.h file for that machine must exist.  */
 
+#ifndef _ENDIAN_H
+# error "Never use <bits/endian.h> directly; include <endian.h> instead."
+#endif
+
 #error Machine byte order unknown.
diff --git a/sysdeps/generic/bits/fenv.h b/sysdeps/generic/bits/fenv.h
index f45deb07c1..c42540fa61 100644
--- a/sysdeps/generic/bits/fenv.h
+++ b/sysdeps/generic/bits/fenv.h
@@ -17,7 +17,7 @@
    Boston, MA 02111-1307, USA.  */
 
 #ifndef _FENV_H
-#error "Never use <bits/fenv.h> directly; include <fenv.h> instead."
+# error "Never use <bits/fenv.h> directly; include <fenv.h> instead."
 #endif
 
 
diff --git a/sysdeps/generic/bits/huge_val.h b/sysdeps/generic/bits/huge_val.h
index 8f137d1734..0c30c86f33 100644
--- a/sysdeps/generic/bits/huge_val.h
+++ b/sysdeps/generic/bits/huge_val.h
@@ -1,6 +1,6 @@
 /* Stub `HUGE_VAL' constant.
    Used by <stdlib.h> and <math.h> functions for overflow.
-   Copyright (C) 1992, 1996 Free Software Foundation, Inc.
+   Copyright (C) 1992, 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
@@ -19,7 +19,7 @@
    Boston, MA 02111-1307, USA.  */
 
 #ifndef _MATH_H
-#error "Never use <bits/huge_val.h> directly; include <math.h> instead."
+# error "Never use <bits/huge_val.h> directly; include <math.h> instead."
 #endif
 
 
diff --git a/sysdeps/generic/bits/in.h b/sysdeps/generic/bits/in.h
index 7241bd24c3..83d7ae6b10 100644
--- a/sysdeps/generic/bits/in.h
+++ b/sysdeps/generic/bits/in.h
@@ -18,8 +18,9 @@
 
 /* Generic version.  */
 
-#ifndef _NETINET_INBITS_H
-#define _NETINET_INBITS_H 1
+#ifndef _NETINET_IN_H
+# error "Never use <bits/in.h> directly; include <netinet/in.h> instead."
+#endif
 
 /* Link numbers.  */
 #define	IMPLINK_IP		155
@@ -55,10 +56,10 @@ struct ip_opts
 
 /* Structure used for IP_ADD_MEMBERSHIP and IP_DROP_MEMBERSHIP. */
 struct ip_mreq
-{
-  struct in_addr imr_multiaddr;	/* IP multicast address of group */
-  struct in_addr imr_interface;	/* local IP address of interface */
-};
+  {
+    struct in_addr imr_multiaddr;	/* IP multicast address of group */
+    struct in_addr imr_interface;	/* local IP address of interface */
+  };
 
 /* IPV6 socket options.  */
 #define IPV6_ADDRFORM		1
@@ -80,5 +81,3 @@ struct ip_mreq
 #define IPV6_MULTICAST_LOOP	19
 #define IPV6_ADD_MEMBERSHIP	20
 #define IPV6_DROP_MEMBERSHIP	21
-
-#endif	/* netinet/inbits.h */
diff --git a/sysdeps/generic/bits/ioctl-types.h b/sysdeps/generic/bits/ioctl-types.h
index 1d5c8a002f..26283a0f10 100644
--- a/sysdeps/generic/bits/ioctl-types.h
+++ b/sysdeps/generic/bits/ioctl-types.h
@@ -1,5 +1,5 @@
 /* Structure types for pre-termios terminal ioctls.  Generic Unix version.
-   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
@@ -17,15 +17,11 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-/*
- * Never include this file directly; use <sys/ioctl.h> instead.
- */
-
-#ifndef _BITS_IOCTL_TYPES_H
-#define _BITS_IOCTL_TYPES_H 1
-
+#ifndef _SYS_IOCTL_H
+# error "Never use <bits/ioctl-types.h> directly; include <sys/ioctl.h> instead."
+#endif
 
-#if	defined(TIOCGETC) || defined(TIOCSETC)
+#if defined TIOCGETC || defined TIOCSETC
 /* Type of ARG for TIOCGETC and TIOCSETC requests.  */
 struct tchars
 {
@@ -41,7 +37,7 @@ struct tchars
   _IOT (_IOTS (char), 6, 0, 0, 0, 0)
 #endif
 
-#if	defined(TIOCGLTC) || defined(TIOCSLTC)
+#if defined TIOCGLTC || defined TIOCSLTC
 /* Type of ARG for TIOCGLTC and TIOCSLTC requests.  */
 struct ltchars
 {
@@ -70,7 +66,7 @@ struct sgttyb
 #define	_IOT_sgttyb	/* Hurd ioctl type field.  */ \
   _IOT (_IOTS (char), 6, _IOTS (short int), 1, 0, 0)
 
-#if	defined(TIOCGWINSZ) || defined(TIOCSWINSZ)
+#if defined TIOCGWINSZ || defined TIOCSWINSZ
 /* Type of ARG for TIOCGWINSZ and TIOCSWINSZ requests.  */
 struct winsize
 {
@@ -86,13 +82,13 @@ struct winsize
   _IOT (_IOTS (unsigned short int), 4, 0, 0, 0, 0)
 #endif
 
-#if	defined (TIOCGSIZE) || defined (TIOCSSIZE)
+#if defined TIOCGSIZE || defined TIOCSSIZE
 /* The BSD-style ioctl constructor macros use `sizeof', which can't be used
    in a preprocessor conditional.  Since the commands are always unique
    regardless of the size bits, we can safely define away `sizeof' for the
    purpose of the conditional.  */
 #  define sizeof(type) 0
-#  if defined (TIOCGWINSZ) && TIOCGSIZE == TIOCGWINSZ
+#  if defined TIOCGWINSZ && TIOCGSIZE == TIOCGWINSZ
 /* Many systems that have TIOCGWINSZ define TIOCGSIZE for source
    compatibility with Sun; they define `struct ttysize' to have identical
    layout as `struct winsize' and #define TIOCGSIZE to be TIOCGWINSZ
@@ -116,6 +112,3 @@ struct ttysize
 #  endif
 #  undef sizeof			/* See above.  */
 #endif
-
-
-#endif /* bits/ioctl-types.h */
diff --git a/sysdeps/generic/bits/ioctls.h b/sysdeps/generic/bits/ioctls.h
index 3b6178bfae..d3ecad9515 100644
--- a/sysdeps/generic/bits/ioctls.h
+++ b/sysdeps/generic/bits/ioctls.h
@@ -1 +1,5 @@
+#ifndef _SYS_IOCTL_H
+# error "Never use <bits/ioctls.h> directly; include <sys/ioctl.h> instead."
+#endif
+
 /* This space intentionally left blank.  */
diff --git a/sysdeps/generic/bits/ipc.h b/sysdeps/generic/bits/ipc.h
index a5ecbd90b7..58f419be1d 100644
--- a/sysdeps/generic/bits/ipc.h
+++ b/sysdeps/generic/bits/ipc.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.
 
@@ -17,10 +17,9 @@
    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>
+#ifndef _SYS_IPC_H
+# error "Never use <bits/ipc.h> directly; include <sys/ipc.h> instead."
+#endif
 
 #include <sys/types.h>
 
@@ -34,23 +33,16 @@
 #define IPC_SET		1		/* set `ipc_perm' options */
 #define IPC_STAT	2		/* get `ipc_perm' options */
 
-
-__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
-{
-  __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 */
-};
-
-__END_DECLS
-
-#endif /* _SYS_IPC_BUF_H */
+  {
+    __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 */
+  };
diff --git a/sysdeps/generic/bits/msq.h b/sysdeps/generic/bits/msq.h
index 37daa9bf8c..a263869a0e 100644
--- a/sysdeps/generic/bits/msq.h
+++ b/sysdeps/generic/bits/msq.h
@@ -1,6 +1,5 @@
 /* Copyright (C) 1995, 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
@@ -21,14 +20,11 @@
 #error "Never use <bits/msq.h> directly; include <sys/msg.h> instead."
 #endif
 
-
-#include <features.h>
 #include <sys/types.h>
 
 /* Define options for message queue functions.  */
 #define MSG_NOERROR	010000	/* no error if message is too big */
 
-__BEGIN_DECLS
 
 /* Structure of record for one message inside the kernel.
    The type `struct __msg' is opaque.  */
@@ -43,5 +39,3 @@ struct msqid_ds
   __pid_t msg_lspid;		/* pid of last msgsnd() */
   __pid_t msg_lrpid;		/* pid of last msgrcv() */
 };
-
-__END_DECLS
diff --git a/sysdeps/generic/bits/poll.h b/sysdeps/generic/bits/poll.h
index 55ec70e363..68f611a428 100644
--- a/sysdeps/generic/bits/poll.h
+++ b/sysdeps/generic/bits/poll.h
@@ -16,6 +16,9 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
+#ifndef _SYS_POLL_H
+# error "Never use <bits/poll.h> directly; include <sys/poll.h> instead."
+#endif
 
 /* Event types that can be polled for.  These bits may be set in `events'
    to indicate the interesting event types; they will appear in `revents'
diff --git a/sysdeps/generic/bits/resource.h b/sysdeps/generic/bits/resource.h
index 46cf9a7af5..d0ebeb56c8 100644
--- a/sysdeps/generic/bits/resource.h
+++ b/sysdeps/generic/bits/resource.h
@@ -17,6 +17,10 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
+#ifndef _SYS_RESOURCE_H
+# error "Never use <bits/resource.h> directly; include <sys/resource.h> instead."
+#endif
+
 /* These are the values for 4.4 BSD and GNU.  Earlier BSD systems have a
    subset of these kinds of resource limit.  In systems where `getrlimit'
    and `setrlimit' are not system calls, these are the values used by the C
@@ -107,7 +111,8 @@ enum __rusage_who
 #define RUSAGE_CHILDREN RUSAGE_CHILDREN
   };
 
-#include <sys/time.h>           /* For `struct timeval'.  */
+#define __need_timeval
+#include <bits/time.h>           /* For `struct timeval'.  */
 
 /* Structure which says how much of each resource has been used.  */
 struct rusage
diff --git a/sysdeps/generic/bits/sched.h b/sysdeps/generic/bits/sched.h
index bb5da5676f..0c246c8f9a 100644
--- a/sysdeps/generic/bits/sched.h
+++ b/sysdeps/generic/bits/sched.h
@@ -1,6 +1,6 @@
 /* Definitions of constants and data structure for POSIX 1003.1b-1993
    scheduling interface.
-   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
@@ -19,7 +19,7 @@
    Suite 330, Boston, MA 02111-1307, USA.  */
 
 #ifndef _SCHED_H
-#error "Never use <bits/sched.h> directly; include <sched.h> instead."
+# error "Never include <bits/sched.h> directly; use <sched.h> instead."
 #endif
 
 
diff --git a/sysdeps/generic/bits/sem.h b/sysdeps/generic/bits/sem.h
index 1d3e41bd56..8b9f97c62a 100644
--- a/sysdeps/generic/bits/sem.h
+++ b/sysdeps/generic/bits/sem.h
@@ -1,6 +1,5 @@
 /* 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
@@ -18,11 +17,9 @@
    Boston, MA 02111-1307, USA.  */
 
 #ifndef _SYS_SEM_H
-#error "Never use <bits/sem.h> directly; include <sys/sem.h> instead."
+# error "Never include <bits/sem.h> directly; use <sys/sem.h> instead."
 #endif
 
-
-#include <features.h>
 #include <sys/types.h>
 
 /* Flags for `semop'.  */
@@ -38,8 +35,6 @@
 #define SETALL		17		/* set all semval's */
 
 
-__BEGIN_DECLS
-
 /* Data structure describing a set of semaphores.  */
 struct semid_ds
 {
@@ -57,5 +52,3 @@ union semun
   unsigned short int *array;		/* array for GETALL & SETALL */
   struct seminfo *__buf;		/* buffer for IPC_INFO */
  };
-
-__END_DECLS
diff --git a/sysdeps/generic/bits/setjmp.h b/sysdeps/generic/bits/setjmp.h
index 6620e5ab15..9150d8d764 100644
--- a/sysdeps/generic/bits/setjmp.h
+++ b/sysdeps/generic/bits/setjmp.h
@@ -1,3 +1,7 @@
 /* Define the machine-dependent type `jmp_buf'.  Stub version.  */
 
+#ifndef _SETJMP_H
+# error "Never include <bits/setjmp.h> directly; use <setjmp.h> instead."
+#endif
+
 typedef int __jmp_buf[1];
diff --git a/sysdeps/generic/bits/shm.h b/sysdeps/generic/bits/shm.h
index b41d0c1e86..8c97999626 100644
--- a/sysdeps/generic/bits/shm.h
+++ b/sysdeps/generic/bits/shm.h
@@ -1,6 +1,5 @@
 /* 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
@@ -18,11 +17,9 @@
    Boston, MA 02111-1307, USA.  */
 
 #ifndef _SYS_SHM_H
-#error "Never use <bits/shm.h> directly; include <sys/shm.h> instead."
+# error "Never include <bits/shm.h> directly; use <sys/shm.h> instead."
 #endif
 
-
-#include <features.h>
 #include <sys/types.h>
 
 /* Flags for `shmat'.  */
@@ -35,19 +32,15 @@
 #define SHM_UNLOCK	12		/* unlock segment (root only) */
 
 
-__BEGIN_DECLS
-
 /* Data structure describing a set of semaphores.  */
 struct shmid_ds
-{
-  struct ipc_perm sem_perm;		/* operation permission struct */
-  int shm_segsz;			/* size of segment in bytes */
-  __time_t sem_atime;			/* time of last shmat() */
-  __time_t sem_dtime;			/* time of last shmdt() */
-  __time_t sem_ctime;			/* time of last change by shmctl() */
-  __pid_t shm_cpid;			/* pid of creator */
-  __pid_t shm_lpid;			/* pid of last shmop */
-  unsigned short int shm_nattch;	/* number of current attaches */
-};
-
-__END_DECLS
+  {
+    struct ipc_perm sem_perm;		/* operation permission struct */
+    int shm_segsz;			/* size of segment in bytes */
+    __time_t sem_atime;			/* time of last shmat() */
+    __time_t sem_dtime;			/* time of last shmdt() */
+    __time_t sem_ctime;			/* time of last change by shmctl() */
+    __pid_t shm_cpid;			/* pid of creator */
+    __pid_t shm_lpid;			/* pid of last shmop */
+    unsigned short int shm_nattch;	/* number of current attaches */
+  };
diff --git a/sysdeps/generic/bits/sigaction.h b/sysdeps/generic/bits/sigaction.h
index e89479bd1c..4499517b1a 100644
--- a/sysdeps/generic/bits/sigaction.h
+++ b/sysdeps/generic/bits/sigaction.h
@@ -16,6 +16,10 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
+#ifndef _SIGNAL_H
+# error "Never include <bits/sigaction.h> directly; use <signal.h> instead."
+#endif
+
 /* These definitions match those used by the 4.4 BSD kernel.
    If the operating system has a `sigaction' system call that correctly
    implements the POSIX.1 behavior, there should be a system-dependent
diff --git a/sysdeps/generic/bits/sigcontext.h b/sysdeps/generic/bits/sigcontext.h
index 46e4df8c64..576fd30c37 100644
--- a/sysdeps/generic/bits/sigcontext.h
+++ b/sysdeps/generic/bits/sigcontext.h
@@ -17,6 +17,10 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
+#ifndef _SIGNAL_H
+# error "Never use <bits/sigcontext.h> directly; include <signal.h> instead."
+#endif
+
 /* State of this thread when the signal was taken.  */
 struct sigcontext
   {
diff --git a/sysdeps/generic/bits/socket.h b/sysdeps/generic/bits/socket.h
index af42dfac78..a2858b8de8 100644
--- a/sysdeps/generic/bits/socket.h
+++ b/sysdeps/generic/bits/socket.h
@@ -18,17 +18,12 @@
    Boston, MA 02111-1307, USA.  */
 
 #ifndef _SYS_SOCKET_H
-#error "Never include <bits/socket.h> directly; use <sys/socket.h> instead."
+# error "Never include <bits/socket.h> directly; use <sys/socket.h> instead."
 #endif
 
-
-#include <features.h>
-
 #define	__need_size_t
 #include <stddef.h>
 
-__BEGIN_DECLS
-
 /* Type for length arguments in socket calls.  */
 typedef unsigned int socklen_t;
 
@@ -201,5 +196,3 @@ struct linger
     int l_onoff;		/* Nonzero to linger on close.  */
     int l_linger;		/* Time to linger.  */
   };
-
-__END_DECLS
diff --git a/sysdeps/generic/bits/stat.h b/sysdeps/generic/bits/stat.h
index 3648fed738..a0edf2be52 100644
--- a/sysdeps/generic/bits/stat.h
+++ b/sysdeps/generic/bits/stat.h
@@ -16,16 +16,13 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-/*
- * Never include this file directly; use <sys/stat.h> instead.
- */
+#ifndef _SYS_STAT_H
+# error "Never include <bits/stat.h> directly; use <sys/stat.h> instead."
+#endif
 
 /* This structure needs to be defined in accordance with the
    implementation of __stat, __fstat, and __lstat.  */
 
-#ifndef	_BITS_STAT_H
-#define	_BITS_STAT_H	1
-
 #include <bits/types.h>
 
 /* Structure describing file characteristics.  */
@@ -73,20 +70,17 @@ struct stat
 #ifdef __USE_LARGEFILE64
 struct stat64
   {
-    __dev_t st_dev;			/* Device.  */
-
-    __ino64_t st_ino;			/* File serial number.	*/
-    __mode_t st_mode;			/* File mode.  */
-    __nlink_t st_nlink;			/* Link count.  */
-    __uid_t st_uid;			/* User ID of the file's owner.	*/
-    __gid_t st_gid;			/* Group ID of the file's group.*/
-    __off64_t st_size;			/* Size of file, in bytes.  */
-
-    __time_t st_atime;			/* Time of last access.  */
-    __time_t st_mtime;			/* Time of last modification.  */
-    __time_t st_ctime;			/* Time of last status change.  */
-  };
-#endif
+    __dev_t st_dev;		/* Device.  */
 
+    __ino64_t st_ino;		/* File serial number.	*/
+    __mode_t st_mode;		/* File mode.  */
+    __nlink_t st_nlink;		/* Link count.  */
+    __uid_t st_uid;		/* User ID of the file's owner.	*/
+    __gid_t st_gid;		/* Group ID of the file's group.*/
+    __off64_t st_size;		/* Size of file, in bytes.  */
 
-#endif /* bits/stat.h */
+    __time_t st_atime;		/* Time of last access.  */
+    __time_t st_mtime;		/* Time of last modification.  */
+    __time_t st_ctime;		/* Time of last status change.  */
+  };
+#endif
diff --git a/sysdeps/generic/bits/statfs.h b/sysdeps/generic/bits/statfs.h
index 9fa3388801..a92cf52315 100644
--- a/sysdeps/generic/bits/statfs.h
+++ b/sysdeps/generic/bits/statfs.h
@@ -17,12 +17,9 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-/*
- * Never include this file directly; use <sys/statfs.h> instead.
- */
-
-#ifndef	_BITS_STATFS_H
-#define	_BITS_STATFS_H	1
+#ifndef _SYS_STATFS_H
+# error "Never include <bits/statfs.h> directly; use <sys/statfs.h> instead."
+#endif
 
 #include <bits/types.h>
 
@@ -47,6 +44,3 @@ struct statfs
     unsigned int f_namelen;
     unsigned int f_spare[6];
   };
-
-
-#endif /* bits/statfs.h */
diff --git a/sysdeps/generic/bits/stdio_lim.h b/sysdeps/generic/bits/stdio_lim.h
index ef873777c9..d9b8fbc749 100644
--- a/sysdeps/generic/bits/stdio_lim.h
+++ b/sysdeps/generic/bits/stdio_lim.h
@@ -1,4 +1,5 @@
-/* Copyright (C) 1994, 1997 Free Software Foundation, Inc.
+/* Stdio limits for non-POSIX systems.
+   Copyright (C) 1994, 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,22 +17,17 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-/* <bits/stdio_lim.h>: stdio limits for non-POSIX systems.
- * Never include this file directly; use <stdio.h> instead.
- */
-
-#ifndef _BITS_STDIO_LIM_H
-#define _BITS_STDIO_LIM_H
+#ifndef _STDIO_H
+# error "Never include <bits/stdio_lim.h> directly; use <stdio.h> instead."
+#endif
 
 #define	L_tmpnam	1
 #define	TMP_MAX		0
 
 #ifdef __USE_POSIX
-#define	L_ctermid	1
-#define	L_cuserid	1
+# define L_ctermid	1
+# define L_cuserid	1
 #endif
 
 #define	FOPEN_MAX	16
 #define	FILENAME_MAX	14
-
-#endif
diff --git a/sysdeps/generic/bits/termios.h b/sysdeps/generic/bits/termios.h
index 9a6aed2bba..da059cbf06 100644
--- a/sysdeps/generic/bits/termios.h
+++ b/sysdeps/generic/bits/termios.h
@@ -1,5 +1,5 @@
 /* termios type and macro definitions.  4.4 BSD/generic GNU version.
-   Copyright (C) 1993, 1994, 1996 Free Software Foundation, Inc.
+   Copyright (C) 1993, 1994, 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
@@ -17,31 +17,35 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
+#ifndef _TERMIOS_H
+# error "Never include <bits/termios.h> directly; use <termios.h> instead."
+#endif
+
 /* These macros are also defined in some <bits/ioctls.h> files (with
    numerically identical values), but this serves to shut up cpp's
    complaining. */
 #ifdef __USE_BSD
 
-#ifdef MDMBUF
-#undef MDMBUF
-#endif
-#ifdef FLUSHO
-#undef FLUSHO
-#endif
-#ifdef PENDIN
-#undef PENDIN
-#endif
+# ifdef MDMBUF
+#  undef MDMBUF
+# endif
+# ifdef FLUSHO
+#  undef FLUSHO
+# endif
+# ifdef PENDIN
+#  undef PENDIN
+# endif
 
 #endif /* __USE_BSD */
 
 #ifdef ECHO
-#undef ECHO
+# undef ECHO
 #endif
 #ifdef TOSTOP
-#undef TOSTOP
+# undef TOSTOP
 #endif
 #ifdef NOFLSH
-#undef NOFLSH
+# undef NOFLSH
 #endif
 
 
@@ -85,15 +89,15 @@ struct termios
   tcflag_t c_oflag;
 #define	OPOST	(1 << 0)	/* Perform output processing.  */
 #ifdef	__USE_BSD
-#define	ONLCR	(1 << 1)	/* Map NL to CR-NL on output.  */
-#define	OXTABS	(1 << 2)	/* Expand tabs to spaces.  */
-#define	ONOEOT	(1 << 8)	/* Discard EOT (^D) on output.  */
+# define ONLCR	(1 << 1)	/* Map NL to CR-NL on output.  */
+# define OXTABS	(1 << 2)	/* Expand tabs to spaces.  */
+# define ONOEOT	(1 << 8)	/* Discard EOT (^D) on output.  */
 #endif
 
   /* Control modes.  */
   tcflag_t c_cflag;
 #ifdef	__USE_BSD
-#define	CIGNORE	(1 << 0)	/* Ignore these control flags.  */
+# define CIGNORE	(1 << 0)	/* Ignore these control flags.  */
 #endif
 #define	CSIZE	(CS5|CS6|CS7|CS8)	/* Number of bits per byte (mask).  */
 #define	CS5	0		/* 5 bits per byte.  */
@@ -107,15 +111,15 @@ struct termios
 #define	HUPCL	(1 << 14)	/* Hang up on last close.  */
 #define	CLOCAL	(1 << 15)	/* Ignore modem status lines.  */
 #ifdef	__USE_BSD
-#define	CCTS_OFLOW	(1 << 16)	/* CTS flow control of output.  */
-#define	CRTS_IFLOW	(1 << 17)	/* RTS flow control of input.  */
-#define	MDMBUF		(1 << 20)	/* Carrier flow control of output.  */
+# define CCTS_OFLOW	(1 << 16)	/* CTS flow control of output.  */
+# define CRTS_IFLOW	(1 << 17)	/* RTS flow control of input.  */
+# define MDMBUF		(1 << 20)	/* Carrier flow control of output.  */
 #endif
 
   /* Local modes.  */
   tcflag_t c_lflag;
 #ifdef	__USE_BSD
-#define	ECHOKE	(1 << 0)	/* Visual erase for KILL.  */
+# define ECHOKE	(1 << 0)	/* Visual erase for KILL.  */
 #endif
 #define	_ECHOE	(1 << 1)	/* Visual erase for ERASE.  */
 #define	ECHOE	_ECHOE
@@ -126,15 +130,15 @@ struct termios
 #define	_ECHONL	(1 << 4)	/* Echo NL even if ECHO is off.  */
 #define	ECHONL	_ECHONL
 #ifdef	__USE_BSD
-#define	ECHOPRT	(1 << 5)	/* Hardcopy visual erase.  */
-#define	ECHOCTL	(1 << 6)	/* Echo control characters as ^X.  */
+# define ECHOPRT	(1 << 5)	/* Hardcopy visual erase.  */
+# define ECHOCTL	(1 << 6)	/* Echo control characters as ^X.  */
 #endif
 #define	_ISIG	(1 << 7)	/* Enable signals.  */
 #define	ISIG	_ISIG
 #define	_ICANON	(1 << 8)	/* Do erase and kill processing.  */
 #define	ICANON	_ICANON
 #ifdef	__USE_BSD
-#define	ALTWERASE (1 << 9)	/* Alternate WERASE algorithm.  */
+# define ALTWERASE (1 << 9)	/* Alternate WERASE algorithm.  */
 #endif
 #define	_IEXTEN	(1 << 10)	/* Enable DISCARD and LNEXT.  */
 #define	IEXTEN	_IEXTEN
@@ -142,9 +146,9 @@ struct termios
 #define	_TOSTOP	(1 << 22)	/* Send SIGTTOU for background output.  */
 #define	TOSTOP	_TOSTOP
 #ifdef	__USE_BSD
-#define	FLUSHO	(1 << 23)	/* Output being flushed (state).  */
-#define	NOKERNINFO (1 << 25)	/* Disable VSTATUS.  */
-#define	PENDIN	(1 << 29)	/* Retype pending input (state).  */
+# define FLUSHO	(1 << 23)	/* Output being flushed (state).  */
+# define NOKERNINFO (1 << 25)	/* Disable VSTATUS.  */
+# define PENDIN	(1 << 29)	/* Retype pending input (state).  */
 #endif
 #define	_NOFLSH	(1 << 31)	/* Disable flush after interrupt.  */
 #define	NOFLSH	_NOFLSH
@@ -153,32 +157,32 @@ struct termios
 #define	VEOF	0		/* End-of-file character [ICANON].  */
 #define	VEOL	1		/* End-of-line character [ICANON].  */
 #ifdef	__USE_BSD
-#define	VEOL2	2		/* Second EOL character [ICANON].  */
+# define VEOL2	2		/* Second EOL character [ICANON].  */
 #endif
 #define	VERASE	3		/* Erase character [ICANON].  */
 #ifdef	__USE_BSD
-#define	VWERASE	4		/* Word-erase character [ICANON].  */
+# define VWERASE	4		/* Word-erase character [ICANON].  */
 #endif
 #define	VKILL	5		/* Kill-line character [ICANON].  */
 #ifdef	__USE_BSD
-#define	VREPRINT 6		/* Reprint-line character [ICANON].  */
+# define VREPRINT 6		/* Reprint-line character [ICANON].  */
 #endif
 #define	VINTR	8		/* Interrupt character [ISIG].  */
 #define	VQUIT	9		/* Quit character [ISIG].  */
 #define	VSUSP	10		/* Suspend character [ISIG].  */
 #ifdef	__USE_BSD
-#define	VDSUSP	11		/* Delayed suspend character [ISIG].  */
+# define VDSUSP	11		/* Delayed suspend character [ISIG].  */
 #endif
 #define	VSTART	12		/* Start (X-ON) character [IXON, IXOFF].  */
 #define	VSTOP	13		/* Stop (X-OFF) character [IXON, IXOFF].  */
 #ifdef	__USE_BSD
-#define	VLNEXT	14		/* Literal-next character [IEXTEN].  */
-#define	VDISCARD 15		/* Discard character [IEXTEN].  */
+# define VLNEXT	14		/* Literal-next character [IEXTEN].  */
+# define VDISCARD 15		/* Discard character [IEXTEN].  */
 #endif
 #define	VMIN	16		/* Minimum number of bytes read at once [!ICANON].  */
 #define	VTIME	17		/* Time-out value (tenths of a second) [!ICANON].  */
 #ifdef	__USE_BSD
-#define	VSTATUS	18		/* Status character [ICANON].  */
+# define VSTATUS	18		/* Status character [ICANON].  */
 #endif
 #define	NCCS	20		/* Value duplicated in <hurd/tioctl.defs>.  */
   cc_t c_cc[NCCS];
@@ -202,8 +206,8 @@ struct termios
 #define	B19200	19200		/* 19200 baud.  */
 #define	B38400	38400		/* 38400 baud.  */
 #ifdef	__USE_BSD
-#define	EXTA	19200
-#define	EXTB	38400
+# define EXTA	19200
+# define EXTB	38400
 #endif
 };
 
@@ -215,7 +219,7 @@ struct termios
 #define	TCSADRAIN	1	/* Change when pending output is written.  */
 #define	TCSAFLUSH	2	/* Flush pending input before changing.  */
 #ifdef	__USE_BSD
-#define	TCSASOFT	0x10	/* Flag: Don't alter hardware state.  */
+# define TCSASOFT	0x10	/* Flag: Don't alter hardware state.  */
 #endif
 
 /* Values for the QUEUE_SELECTOR argument to `tcflush'.  */
diff --git a/sysdeps/generic/bits/time.h b/sysdeps/generic/bits/time.h
index e41a991b44..cdbd39f91d 100644
--- a/sysdeps/generic/bits/time.h
+++ b/sysdeps/generic/bits/time.h
@@ -21,6 +21,16 @@
  * Never include this file directly; use <time.h> instead.
  */
 
+#ifndef __need_timeval
+# ifndef _BITS_TIME_H
+#  define _BITS_TIME_H	1
+
+#  define CLOCKS_PER_SEC 60
+
+# endif	/* bits/time.h */
+#endif
+
+
 #ifdef __need_timeval
 # undef __need_timeval
 # ifndef _STRUCT_TIMEVAL
@@ -34,11 +44,3 @@ struct timeval
   };
 # endif	/* struct timeval */
 #endif	/* need timeval */
-
-
-#ifndef _BITS_TIME_H
-#define	_BITS_TIME_H	1
-
-#define CLOCKS_PER_SEC 60
-
-#endif	/* bits/time.h */
diff --git a/sysdeps/generic/bits/uio.h b/sysdeps/generic/bits/uio.h
index 1a12697008..56533c1c58 100644
--- a/sysdeps/generic/bits/uio.h
+++ b/sysdeps/generic/bits/uio.h
@@ -17,7 +17,7 @@
    Boston, MA 02111-1307, USA.  */
 
 #ifndef _SYS_UIO_H
-#error "Never use <bits/uio.h> directly; include <sys/uio.h> instead."
+# error "Never include <bits/uio.h> directly; use <sys/uio.h> instead."
 #endif
 
 
diff --git a/sysdeps/generic/bits/utmp.h b/sysdeps/generic/bits/utmp.h
index ccc318bfa1..62817d36d1 100644
--- a/sysdeps/generic/bits/utmp.h
+++ b/sysdeps/generic/bits/utmp.h
@@ -17,12 +17,9 @@
    Boston, MA 02111-1307, USA.  */
 
 #ifndef _UTMP_H
-# error "Never use <bits/utmp.h> directly; include <utmp.h> instead."
+# error "Never include <bits/utmp.h> directly; use <utmp.h> instead."
 #endif
 
-
-#include <features.h>
-
 #include <paths.h>
 #include <time.h>
 
@@ -31,7 +28,6 @@
 #define	UT_LINESIZE	8
 #define	UT_HOSTSIZE	16
 
-__BEGIN_DECLS
 
 struct lastlog
   {
@@ -51,5 +47,3 @@ struct utmp
 
 
 #define _HAVE_UT_HOST 1		/* We have the ut_host field.  */
-
-__END_DECLS
diff --git a/sysdeps/generic/bits/utmpx.h b/sysdeps/generic/bits/utmpx.h
index f85fce0052..e22660f6d6 100644
--- a/sysdeps/generic/bits/utmpx.h
+++ b/sysdeps/generic/bits/utmpx.h
@@ -17,7 +17,7 @@
    Boston, MA 02111-1307, USA.  */
 
 #ifndef _UTMPX_H
-#error "Never use <bits/utmpx.h> directly; include <utmpx.h> instead."
+# error "Never include <bits/utmpx.h> directly; use <utmpx.h> instead."
 #endif
 
 
@@ -26,9 +26,9 @@
 #define	__UT_HOSTSIZE	16
 
 struct utmpx
-{
-  char ut_line[__UT_LINESIZE];
-  char ut_name[__UT_NAMESIZE];
-  char ut_host[__UT_HOSTSIZE];
-  long ut_time;
-};
+  {
+    char ut_line[__UT_LINESIZE];
+    char ut_name[__UT_NAMESIZE];
+    char ut_host[__UT_HOSTSIZE];
+    long int ut_time;
+  };
diff --git a/sysdeps/generic/bits/utsname.h b/sysdeps/generic/bits/utsname.h
index 5594bcc4da..ea3f163cef 100644
--- a/sysdeps/generic/bits/utsname.h
+++ b/sysdeps/generic/bits/utsname.h
@@ -1,3 +1,25 @@
+/* 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.  */
+
+#ifndef _UTSNAME_H
+# error "Never include <bits/utsname.h> directly; use <sys/utsname.h> instead."
+#endif
+
 /* The size of the character arrays used to hold the information
    in a `struct utsname'.  Enlarge this as necessary.  */
 #define	_UTSNAME_LENGTH	1024
diff --git a/sysdeps/generic/bits/waitflags.h b/sysdeps/generic/bits/waitflags.h
index 127eb6ce4c..596df932b7 100644
--- a/sysdeps/generic/bits/waitflags.h
+++ b/sysdeps/generic/bits/waitflags.h
@@ -18,7 +18,7 @@
    Boston, MA 02111-1307, USA.  */
 
 #ifndef _SYS_WAIT_H
-#error "Never use <bits/waitflags.h> directly; include <sys/wait.h> instead."
+# error "Never include <bits/waitflags.h> directly; use <sys/wait.h> instead."
 #endif
 
 
diff --git a/sysdeps/generic/bits/waitstatus.h b/sysdeps/generic/bits/waitstatus.h
index 8e97f2702c..1ec55107f9 100644
--- a/sysdeps/generic/bits/waitstatus.h
+++ b/sysdeps/generic/bits/waitstatus.h
@@ -18,7 +18,7 @@
    Boston, MA 02111-1307, USA.  */
 
 #ifndef _SYS_WAIT_H
-#error "Never use <bits/waitstatus.h> directly; include <sys/wait.h> instead."
+# error "Never include <bits/waitstatus.h> directly; use <sys/wait.h> instead."
 #endif
 
 
@@ -39,11 +39,11 @@
 
 /* Nonzero if STATUS indicates termination by a signal.  */
 #ifdef	__GNUC__
-#define	__WIFSIGNALED(status)						      \
+# define __WIFSIGNALED(status) \
   (__extension__ ({ int __status = (status);				      \
 		    !__WIFSTOPPED(__status) && !__WIFEXITED(__status); }))
 #else	/* Not GCC.  */
-#define	__WIFSIGNALED(status)	(!__WIFSTOPPED(status) && !__WIFEXITED(status))
+# define __WIFSIGNALED(status)	(!__WIFSTOPPED(status) && !__WIFEXITED(status))
 #endif	/* GCC.  */
 
 /* Nonzero if STATUS indicates the child is stopped.  */
@@ -60,45 +60,45 @@
 
 #ifdef	__USE_BSD
 
-#include <endian.h>
+# include <endian.h>
 
 union wait
   {
     int w_status;
     struct
       {
-#if	__BYTE_ORDER == __LITTLE_ENDIAN
+# if	__BYTE_ORDER == __LITTLE_ENDIAN
 	unsigned int __w_termsig:7; /* Terminating signal.  */
 	unsigned int __w_coredump:1; /* Set if dumped core.  */
 	unsigned int __w_retcode:8; /* Return code if exited normally.  */
 	unsigned int:16;
-#endif				/* Little endian.  */
-#if	__BYTE_ORDER == __BIG_ENDIAN
+# endif				/* Little endian.  */
+# if	__BYTE_ORDER == __BIG_ENDIAN
 	unsigned int:16;
 	unsigned int __w_retcode:8;
 	unsigned int __w_coredump:1;
 	unsigned int __w_termsig:7;
-#endif				/* Big endian.  */
+# endif				/* Big endian.  */
       } __wait_terminated;
     struct
       {
-#if	__BYTE_ORDER == __LITTLE_ENDIAN
+# if	__BYTE_ORDER == __LITTLE_ENDIAN
 	unsigned int __w_stopval:8; /* W_STOPPED if stopped.  */
 	unsigned int __w_stopsig:8; /* Stopping signal.  */
 	unsigned int:16;
-#endif				/* Little endian.  */
-#if	__BYTE_ORDER == __BIG_ENDIAN
+# endif				/* Little endian.  */
+# if	__BYTE_ORDER == __BIG_ENDIAN
 	unsigned int:16;
 	unsigned int __w_stopsig:8; /* Stopping signal.  */
 	unsigned int __w_stopval:8; /* W_STOPPED if stopped.  */
-#endif				/* Big endian.  */
+# endif				/* Big endian.  */
       } __wait_stopped;
   };
 
-#define	w_termsig	__wait_terminated.__w_termsig
-#define	w_coredump	__wait_terminated.__w_coredump
-#define	w_retcode	__wait_terminated.__w_retcode
-#define	w_stopsig	__wait_stopped.__w_stopsig
-#define	w_stopval	__wait_stopped.__w_stopval
+# define w_termsig	__wait_terminated.__w_termsig
+# define w_coredump	__wait_terminated.__w_coredump
+# define w_retcode	__wait_terminated.__w_retcode
+# define w_stopsig	__wait_stopped.__w_stopsig
+# define w_stopval	__wait_stopped.__w_stopval
 
 #endif	/* Use BSD.  */
diff --git a/sysdeps/generic/strcasestr.c b/sysdeps/generic/strcasestr.c
new file mode 100644
index 0000000000..ec8727d268
--- /dev/null
+++ b/sysdeps/generic/strcasestr.c
@@ -0,0 +1,129 @@
+/* Return the offset of one string within another.
+   Copyright (C) 1994, 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.  */
+
+/*
+ * My personal strstr() implementation that beats most other algorithms.
+ * Until someone tells me otherwise, I assume that this is the
+ * fastest implementation of strstr() in C.
+ * I deliberately chose not to comment it.  You should have at least
+ * as much fun trying to understand it, as I had to write it :-).
+ *
+ * Stephen R. van den Berg, berg@pool.informatik.rwth-aachen.de	*/
+
+#if HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <ctype.h>
+
+#if defined _LIBC || defined HAVE_STRING_H
+# include <string.h>
+#endif
+
+typedef unsigned chartype;
+
+#undef strstr
+
+char *
+__strcasestr (phaystack, pneedle)
+     const char *phaystack;
+     const char *pneedle;
+{
+  register const unsigned char *haystack, *needle;
+  register chartype b, c;
+
+  haystack = (const unsigned char *) phaystack;
+  needle = (const unsigned char *) pneedle;
+
+  b = tolower (*needle);
+  if (b != '\0')
+    {
+      haystack--;				/* possible ANSI violation */
+      do
+	{
+	  c = *++haystack;
+	  if (c == '\0')
+	    goto ret0;
+	}
+      while (tolower (c) != b);
+
+      c = tolower (*++needle);
+      if (c == '\0')
+	goto foundneedle;
+      ++needle;
+      goto jin;
+
+      for (;;)
+        {
+          register chartype a;
+	  register const unsigned char *rhaystack, *rneedle;
+
+	  do
+	    {
+	      a = *++haystack;
+	      if (a == '\0')
+		goto ret0;
+	      if (tolower (a) == b)
+		break;
+	      a = *++haystack;
+	      if (a == '\0')
+		goto ret0;
+shloop:	    }
+          while (tolower (a) != b);
+
+jin:	  a = *++haystack;
+	  if (a == '\0')
+	    goto ret0;
+
+	  if (tolower (a) != c)
+	    goto shloop;
+
+	  rhaystack = haystack-- + 1;
+	  rneedle = needle;
+	  a = tolower (*rneedle);
+
+	  if (tolower (*rhaystack) == a)
+	    do
+	      {
+		if (a == '\0')
+		  goto foundneedle;
+		++rhaystack;
+		a = tolower (*++needle);
+		if (tolower (*rhaystack) != a)
+		  break;
+		if (a == '\0')
+		  goto foundneedle;
+		++rhaystack;
+		a = tolower (*++needle);
+	      }
+	    while (tolower (*rhaystack) == a);
+
+	  needle = rneedle;		/* took the register-poor approach */
+
+	  if (a == '\0')
+	    break;
+        }
+    }
+foundneedle:
+  return (char*) haystack;
+ret0:
+  return 0;
+}
+
+weak_alias (__strcasestr, strcasestr)
diff --git a/sysdeps/gnu/bits/utmp.h b/sysdeps/gnu/bits/utmp.h
index 163f6427ec..6a0beb61a9 100644
--- a/sysdeps/gnu/bits/utmp.h
+++ b/sysdeps/gnu/bits/utmp.h
@@ -17,7 +17,7 @@
    Boston, MA 02111-1307, USA.  */
 
 #ifndef _UTMP_H
-#error "Never use <bits/utmp.h> directly; include <utmpx.h> instead."
+# error "Never include <bits/utmp.h> directly; use <utmpx.h> instead."
 #endif
 
 #include <paths.h>
@@ -33,38 +33,38 @@
 /* The structure describing an entry in the database of
    previous logins.  */
 struct lastlog
-{
-  time_t ll_time;
-  char ll_line[UT_LINESIZE];
-  char ll_host[UT_HOSTSIZE];
-};
+  {
+    __time_t ll_time;
+    char ll_line[UT_LINESIZE];
+    char ll_host[UT_HOSTSIZE];
+  };
 
 
 /* The structure describing the status of a terminated process.  This
    type is used in `struct utmp' below.  */
 struct exit_status
-{
-  short int e_termination;	/* Process termination status.  */
-  short int e_exit;		/* Process exit status.  */
-};
+  {
+    short int e_termination;	/* Process termination status.  */
+    short int e_exit;		/* Process exit status.  */
+  };
 
 
 /* The structure describing an entry in the user accounting database.  */
 struct utmp
-{
-  short int ut_type;		/* Type of login.  */
-  pid_t ut_pid;			/* Process ID of login process.  */
-  char ut_line[UT_LINESIZE];	/* Devicename.  */
-  char ut_id[4];		/* Inittab ID.  */
-  char ut_user[UT_NAMESIZE];	/* Username.  */
-  char ut_host[UT_HOSTSIZE];	/* Hostname for remote login.  */
-  struct exit_status ut_exit;	/* Exit status of a process marked
+  {
+    short int ut_type;		/* Type of login.  */
+    pid_t ut_pid;		/* Process ID of login process.  */
+    char ut_line[UT_LINESIZE];	/* Devicename.  */
+    char ut_id[4];		/* Inittab ID.  */
+    char ut_user[UT_NAMESIZE];	/* Username.  */
+    char ut_host[UT_HOSTSIZE];	/* Hostname for remote login.  */
+    struct exit_status ut_exit;	/* Exit status of a process marked
 				   as DEAD_PROCESS.  */
-  long ut_session;		/* Session ID, used for windowing.  */
-  struct timeval ut_tv;		/* Time entry was made.  */
-  int32_t ut_addr_v6[4];	/* Internet address of remote host.  */
-  char pad[20];			/* Reserved for future use.  */
-};
+    long ut_session;		/* Session ID, used for windowing.  */
+    struct timeval ut_tv;	/* Time entry was made.  */
+    int32_t ut_addr_v6[4];	/* Internet address of remote host.  */
+    char pad[20];		/* Reserved for future use.  */
+  };
 
 /* Backwards compatibility hacks.  */
 #define ut_name		ut_user
diff --git a/sysdeps/gnu/bits/utmpx.h b/sysdeps/gnu/bits/utmpx.h
index 4f1a876d0a..4ecbb3a026 100644
--- a/sysdeps/gnu/bits/utmpx.h
+++ b/sysdeps/gnu/bits/utmpx.h
@@ -1,6 +1,5 @@
 /* Structures and defenitions for the user accounting database.  GNU version.
    Copyright (C) 1997 Free Software Foundation, Inc.
-   Contributed by Mark Kettenis <kettenis@phys.uva.nl>, 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
@@ -18,7 +17,7 @@
    Boston, MA 02111-1307, USA.  */
 
 #ifndef _UTMPX_H
-#error "Never use <bits/utmpx.h> directly; include <utmpx.h> instead."
+# error "Never include <bits/utmpx.h> directly; use <utmpx.h> instead."
 #endif
 
 #include <bits/types.h>
@@ -29,14 +28,14 @@
 #define __UT_NAMESIZE	32
 #define __UT_HOSTSIZE	256
 
-   
+
 /* The structure describing the status of a terminated process.  This
    type is used in `struct utmpx' below.  */
 struct __exit_status
-{
-  short int e_termination;	/* Process termination status.  */
-  short int e_exit;		/* Process exit status.  */
-};
+  {
+    short int e_termination;	/* Process termination status.  */
+    short int e_exit;		/* Process exit status.  */
+  };
 
 
 /* The structure describing an entry in the user accounting database.  */
@@ -50,7 +49,7 @@ struct utmpx
   char ut_host[__UT_HOSTSIZE];	/* Hostname for remote login.  */
   struct __exit_status ut_exit;	/* Exit status of a process marked
 				   as DEAD_PROCESS.  */
-  long ut_session;		/* Session ID, used for windowing.  */
+  long int ut_session;		/* Session ID, used for windowing.  */
   struct timeval ut_tv;		/* Time entry was made.  */
   __int32_t ut_addr_v6[4];	/* Internet address of remote host.  */
   char pad[20];			/* Reserved for future use.  */
@@ -69,11 +68,3 @@ struct utmpx
 #define LOGIN_PROCESS	6	/* Session leader of a logged in user.  */
 #define USER_PROCESS	7	/* Normal process.  */
 #define DEAD_PROCESS	8	/* Terminated process.  */
-
-
-
-
-
-
-
-
diff --git a/sysdeps/i386/__longjmp.S b/sysdeps/i386/__longjmp.S
index 0ec5d26a38..7e039deb8f 100644
--- a/sysdeps/i386/__longjmp.S
+++ b/sysdeps/i386/__longjmp.S
@@ -19,6 +19,7 @@
 
 #include <sysdep.h>
 #define _ASM
+#define _SETJMP_H
 #include <bits/setjmp.h>
 
 ENTRY (__longjmp)
diff --git a/sysdeps/i386/bits/byteswap.h b/sysdeps/i386/bits/byteswap.h
index 326962e621..bf55c890ba 100644
--- a/sysdeps/i386/bits/byteswap.h
+++ b/sysdeps/i386/bits/byteswap.h
@@ -17,8 +17,9 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-#ifndef _BITS_BYTESWAP_H
-#define _BITS_BYTESWAP_H	1
+#if !defined _BYTESWAP_H && !defined _NETINET_IN_H
+# error "Never use <bits/byteswap.h> directly; include <byteswap.h> instead."
+#endif
 
 /* Swap bytes in 16 bit value.  */
 #define __bswap_constant_16(x) \
@@ -88,5 +89,3 @@
 	__r.__l[1] = __bswap_32 (__v.__l[0]);				      \
 	__r.__ll; })
 #endif
-
-#endif /* bits/byteswap.h */
diff --git a/sysdeps/i386/bits/endian.h b/sysdeps/i386/bits/endian.h
index a5d6c5ea92..54bd9d14bb 100644
--- a/sysdeps/i386/bits/endian.h
+++ b/sysdeps/i386/bits/endian.h
@@ -1,3 +1,7 @@
 /* i386 is little-endian.  */
 
+#ifndef _ENDIAN_H
+# error "Never use <bits/endian.h> directly; include <endian.h> instead."
+#endif
+
 #define __BYTE_ORDER __LITTLE_ENDIAN
diff --git a/sysdeps/i386/bits/huge_val.h b/sysdeps/i386/bits/huge_val.h
index 65a06d8f3c..23127b4031 100644
--- a/sysdeps/i386/bits/huge_val.h
+++ b/sysdeps/i386/bits/huge_val.h
@@ -19,12 +19,10 @@
    Boston, MA 02111-1307, USA.  */
 
 #ifndef _MATH_H
-#error "Never use <bits/huge_val.h> directly; include <math.h> instead."
+# error "Never use <bits/huge_val.h> directly; include <math.h> instead."
 #endif
 
-
 #include <features.h>
-#include <sys/cdefs.h>
 
 /* IEEE positive infinity (-HUGE_VAL is negative infinity).  */
 
@@ -32,11 +30,11 @@
 
 #define __huge_val_t	union { unsigned char __c[8]; double __d; }
 #ifdef	__GNUC__
-#define	HUGE_VAL	(__extension__ \
+# define HUGE_VAL	(__extension__ \
 			 ((__huge_val_t) { __c: __HUGE_VAL_bytes }).__d)
 #else	/* Not GCC.  */
 static __huge_val_t __huge_val = { __HUGE_VAL_bytes };
-#define	HUGE_VAL	(__huge_val.__d)
+# define HUGE_VAL	(__huge_val.__d)
 #endif	/* GCC.  */
 
 
@@ -44,27 +42,27 @@ static __huge_val_t __huge_val = { __HUGE_VAL_bytes };
 
 #ifdef __USE_ISOC9X
 
-#define	__HUGE_VALF_bytes	{ 0, 0, 0x80, 0x7f }
+# define __HUGE_VALF_bytes	{ 0, 0, 0x80, 0x7f }
 
-#define __huge_valf_t	union { unsigned char __c[4]; float __f; }
-#ifdef	__GNUC__
-#define	HUGE_VALF	(__extension__ \
+# define __huge_valf_t	union { unsigned char __c[4]; float __f; }
+# ifdef	__GNUC__
+#  define HUGE_VALF	(__extension__ \
 			 ((__huge_valf_t) { __c: __HUGE_VALF_bytes }).__f)
-#else	/* Not GCC.  */
+# else	/* Not GCC.  */
 static __huge_valf_t __huge_valf = { __HUGE_VALF_bytes };
-#define	HUGE_VALF	(__huge_valf.__f)
-#endif	/* GCC.  */
+#  define HUGE_VALF	(__huge_valf.__f)
+# endif	/* GCC.  */
 
 
-#define	__HUGE_VALL_bytes	{ 0, 0, 0, 0, 0, 0, 0, 0x80, 0xff, 0x7f, 0, 0 }
+# define __HUGE_VALL_bytes	{ 0, 0, 0, 0, 0, 0, 0, 0x80, 0xff, 0x7f, 0, 0 }
 
-#define __huge_vall_t	union { unsigned char __c[12]; long double __ld; }
-#ifdef	__GNUC__
-#define	HUGE_VALL	(__extension__ \
+# define __huge_vall_t	union { unsigned char __c[12]; long double __ld; }
+# ifdef	__GNUC__
+#  define HUGE_VALL	(__extension__ \
 			 ((__huge_vall_t) { __c: __HUGE_VALL_bytes }).__ld)
-#else	/* Not GCC.  */
+# else	/* Not GCC.  */
 static __huge_vall_t __huge_vall = { __HUGE_VALL_bytes };
-#define	HUGE_VALL	(__huge_vall.__ld)
-#endif	/* GCC.  */
+#  define HUGE_VALL	(__huge_vall.__ld)
+# endif	/* GCC.  */
 
 #endif	/* __USE_ISOC9X.  */
diff --git a/sysdeps/i386/bits/setjmp.h b/sysdeps/i386/bits/setjmp.h
index 0c03073b36..5cb60a8c7d 100644
--- a/sysdeps/i386/bits/setjmp.h
+++ b/sysdeps/i386/bits/setjmp.h
@@ -1,12 +1,16 @@
 /* Define the machine-dependent type `jmp_buf'.  Intel 386 version.  */
 
-#if	defined (__USE_MISC) || defined (_ASM)
-#define	JB_BX	0
-#define	JB_SI	1
-#define	JB_DI	2
-#define	JB_BP	3
-#define	JB_SP	4
-#define	JB_PC	5
+#ifndef _SETJMP_H
+# error "Never include <bits/setjmp.h> directly; use <setjmp.h> instead."
+#endif
+
+#if defined __USE_MISC || defined _ASM
+# define JB_BX	0
+# define JB_SI	1
+# define JB_DI	2
+# define JB_BP	3
+# define JB_SP	4
+# define JB_PC	5
 #endif
 
 #ifndef	_ASM
diff --git a/sysdeps/i386/elf/setjmp.S b/sysdeps/i386/elf/setjmp.S
index d73e84364f..bc4890c215 100644
--- a/sysdeps/i386/elf/setjmp.S
+++ b/sysdeps/i386/elf/setjmp.S
@@ -19,6 +19,7 @@
 
 #include <sysdep.h>
 #define _ASM
+#define _SETJMP_H
 #include <bits/setjmp.h>
 
 	/* We include the BSD entry points here as well but we make
diff --git a/sysdeps/i386/fpu/bits/fenv.h b/sysdeps/i386/fpu/bits/fenv.h
index 63f3e52958..4d06b01be3 100644
--- a/sysdeps/i386/fpu/bits/fenv.h
+++ b/sysdeps/i386/fpu/bits/fenv.h
@@ -17,7 +17,7 @@
    Boston, MA 02111-1307, USA.  */
 
 #ifndef _FENV_H
-#error "Never use <bits/fenv.h> directly; include <fenv.h> instead."
+# error "Never use <bits/fenv.h> directly; include <fenv.h> instead."
 #endif
 
 
@@ -61,7 +61,8 @@ enum
 typedef unsigned short int fexcept_t;
 
 
-/* Type representing floating-point environment.  This function corresponds to the layout of the block written by the `fstenv'.  */
+/* Type representing floating-point environment.  This function corresponds
+   to the layout of the block written by the `fstenv'.  */
 typedef struct
   {
     unsigned short int control_word;
diff --git a/sysdeps/ieee754/bits/huge_val.h b/sysdeps/ieee754/bits/huge_val.h
index fe0144c734..f49d65661a 100644
--- a/sysdeps/ieee754/bits/huge_val.h
+++ b/sysdeps/ieee754/bits/huge_val.h
@@ -19,37 +19,35 @@
    Boston, MA 02111-1307, USA.  */
 
 #ifndef _MATH_H
-#error "Never use <bits/huge_val.h> directly; include <math.h> instead."
+# error "Never use <bits/huge_val.h> directly; include <math.h> instead."
 #endif
 
-
 #include <features.h>
 
 /* IEEE positive infinity (-HUGE_VAL is negative infinity).  */
 
 #ifdef	__GNUC__
 
-#define HUGE_VAL                                                            \
-  (__extension__                                                            \
-   ((union { unsigned __l __attribute__((__mode__(__DI__))); double __d; }) \
+# define HUGE_VAL \
+  (__extension__							      \
+   ((union { unsigned __l __attribute__((__mode__(__DI__))); double __d; })   \
     { __l: 0x7ff0000000000000ULL }).__d)
 
 #else /* not GCC */
 
-#include <sys/cdefs.h>
-#include <endian.h>
+# include <endian.h>
 
 typedef union { unsigned char __c[8]; double __d; } __huge_val_t;
 
-#if __BYTE_ORDER == __BIG_ENDIAN
-#define	__HUGE_VAL_bytes	{ 0x7f, 0xf0, 0, 0, 0, 0, 0, 0 }
-#endif
-#if __BYTE_ORDER == __LITTLE_ENDIAN
-#define	__HUGE_VAL_bytes	{ 0, 0, 0, 0, 0, 0, 0xf0, 0x7f }
-#endif
+# if __BYTE_ORDER == __BIG_ENDIAN
+#  define __HUGE_VAL_bytes	{ 0x7f, 0xf0, 0, 0, 0, 0, 0, 0 }
+# endif
+# if __BYTE_ORDER == __LITTLE_ENDIAN
+#  define __HUGE_VAL_bytes	{ 0, 0, 0, 0, 0, 0, 0xf0, 0x7f }
+# endif
 
 static __huge_val_t __huge_val = { __HUGE_VAL_bytes };
-#define	HUGE_VAL	(__huge_val.__d)
+# define HUGE_VAL	(__huge_val.__d)
 
 #endif	/* GCC.  */
 
@@ -58,32 +56,32 @@ static __huge_val_t __huge_val = { __HUGE_VAL_bytes };
 
 #ifdef __USE_ISOC9X
 
-#ifdef __GNUC__
+# ifdef __GNUC__
 
-#define HUGE_VALF                                                           \
-  (__extension__                                                            \
-   ((union { unsigned __l __attribute__((__mode__(__SI__))); float __d; })  \
+#  define HUGE_VALF \
+  (__extension__							      \
+   ((union { unsigned __l __attribute__((__mode__(__SI__))); float __d; })    \
     { __l: 0x7f800000UL }).__d)
 
-#else /* not GCC */
+# else /* not GCC */
 
 typedef union { unsigned char __c[4]; float __f; } __huge_valf_t;
 
-#if __BYTE_ORDER == __BIG_ENDIAN
-#define	__HUGE_VALF_bytes	{ 0x7f, 0x80, 0, 0 }
-#endif
-#if __BYTE_ORDER == __LITTLE_ENDIAN
-#define	__HUGE_VALF_bytes	{ 0, 0, 0x80, 0x7f }
-#endif
+#  if __BYTE_ORDER == __BIG_ENDIAN
+#   define __HUGE_VALF_bytes	{ 0x7f, 0x80, 0, 0 }
+#  endif
+#  if __BYTE_ORDER == __LITTLE_ENDIAN
+#   define __HUGE_VALF_bytes	{ 0, 0, 0x80, 0x7f }
+#  endif
 
 static __huge_valf_t __huge_valf = { __HUGE_VALF_bytes };
-#define	HUGE_VALF	(__huge_valf.__f)
+#  define HUGE_VALF	(__huge_valf.__f)
 
-#endif	/* GCC.  */
+# endif	/* GCC.  */
 
 
 /* Generally there is no separate `long double' format and it is the
    same as `double'.  */
-#define HUGE_VALL HUGE_VAL
+# define HUGE_VALL HUGE_VAL
 
 #endif /* __USE_ISOC9X.  */
diff --git a/sysdeps/m68k/bits/byteswap.h b/sysdeps/m68k/bits/byteswap.h
index 54ec0d1920..41bbe59782 100644
--- a/sysdeps/m68k/bits/byteswap.h
+++ b/sysdeps/m68k/bits/byteswap.h
@@ -17,8 +17,9 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-#ifndef _BITS_BYTESWAP_H
-#define _BITS_BYTESWAP_H	1
+#if !defined _BYTESWAP_H && !defined _NETINET_IN_H
+# error "Never use <bits/byteswap.h> directly; include <byteswap.h> instead."
+#endif
 
 /* Swap bytes in 16 bit value.  We don't provide an assembler version
    because GCC is smart enough to generate optimal assembler output, and
@@ -32,7 +33,7 @@
    (((x) & 0x0000ff00) <<  8) | (((x) & 0x000000ff) << 24))
 
 #if defined __GNUC__ && __GNUC__ >= 2
-#define __bswap_32(x) \
+# define __bswap_32(x) \
   __extension__					\
   ({ unsigned int __v;				\
      if (__builtin_constant_p (x))		\
@@ -45,12 +46,12 @@
 			     : "0" (x));	\
      __v; })
 #else
-#define __bswap_32(x) __bswap_constant_32 (x)
+# define __bswap_32(x) __bswap_constant_32 (x)
 #endif
 
 #if defined __GNUC__ && __GNUC__ >= 2
 /* Swap bytes in 64 bit value.  */
-#define __bswap_64(x) \
+# define __bswap_64(x) \
   __extension__						\
   ({ union { unsigned long long int __ll;		\
 	     unsigned long int __l[2]; } __v, __r;	\
@@ -59,5 +60,3 @@
      __r.__l[1] = __bswap_32 (__v.__l[0]);		\
      __r.__ll; })
 #endif
-
-#endif /* bits/byteswap.h */
diff --git a/sysdeps/m68k/bits/endian.h b/sysdeps/m68k/bits/endian.h
index 6f985293f2..bf4ecb60a4 100644
--- a/sysdeps/m68k/bits/endian.h
+++ b/sysdeps/m68k/bits/endian.h
@@ -1,3 +1,7 @@
 /* m68k is big-endian.  */
 
+#ifndef _ENDIAN_H
+# error "Never use <bits/endian.h> directly; include <endian.h> instead."
+#endif
+
 #define __BYTE_ORDER __BIG_ENDIAN
diff --git a/sysdeps/m68k/bits/setjmp.h b/sysdeps/m68k/bits/setjmp.h
index 96240f0d8e..2991232915 100644
--- a/sysdeps/m68k/bits/setjmp.h
+++ b/sysdeps/m68k/bits/setjmp.h
@@ -1,5 +1,9 @@
 /* Define the machine-dependent type `jmp_buf'.  m68k version.  */
 
+#ifndef _SETJMP_H
+# error "Never include <bits/setjmp.h> directly; use <setjmp.h> instead."
+#endif
+
 typedef struct
   {
     /* There are eight 4-byte data registers, but D0 is not saved.  */
@@ -7,10 +11,10 @@ typedef struct
 
     /* There are six 4-byte address registers, plus the FP and SP.  */
     int *__aregs[6];
-    int * __fp;
-    int * __sp;
+    int *__fp;
+    int *__sp;
 
-#if defined(__HAVE_68881__) || defined(__HAVE_FPU__)
+#if defined __HAVE_68881__ || defined __HAVE_FPU__
     /* There are eight floating point registers which
        are saved in IEEE 96-bit extended format.  */
     char __fpregs[8 * (96 / 8)];
diff --git a/sysdeps/m68k/fpu/bits/fenv.h b/sysdeps/m68k/fpu/bits/fenv.h
index ce071b93ff..a11e0724f1 100644
--- a/sysdeps/m68k/fpu/bits/fenv.h
+++ b/sysdeps/m68k/fpu/bits/fenv.h
@@ -17,7 +17,7 @@
    Boston, MA 02111-1307, USA.  */
 
 #ifndef _FENV_H
-#error "Never use <bits/fenv.h> directly; include <fenv.h> instead."
+# error "Never use <bits/fenv.h> directly; include <fenv.h> instead."
 #endif
 
 
diff --git a/sysdeps/mach/hurd/alpha/bits/sigcontext.h b/sysdeps/mach/hurd/alpha/bits/sigcontext.h
index 3b17a4ada8..a2c8163599 100644
--- a/sysdeps/mach/hurd/alpha/bits/sigcontext.h
+++ b/sysdeps/mach/hurd/alpha/bits/sigcontext.h
@@ -17,6 +17,10 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
+#ifndef _SIGNAL_H
+# error "Never use <bits/sigcontext.h> directly; include <signal.h> instead."
+#endif
+
 /* Signal handlers are actually called:
    void handler (int sig, int code, struct sigcontext *scp);  */
 
diff --git a/sysdeps/mach/hurd/bits/ioctls.h b/sysdeps/mach/hurd/bits/ioctls.h
index b04438bcca..a5dc446c67 100644
--- a/sysdeps/mach/hurd/bits/ioctls.h
+++ b/sysdeps/mach/hurd/bits/ioctls.h
@@ -16,32 +16,29 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-/*
- * Never include this file directly; use <sys/ioctl.h> instead.
- */
-
-#ifndef	_BITS_IOCTLS_H
-#define	_BITS_IOCTLS_H	1
+#ifndef _SYS_IOCTL_H
+# error "Never use <bits/ioctls.h> directly; include <sys/ioctl.h> instead."
+#endif
 
 /* These macros are also defined in <bits/termios.h> (with numerically
    identical values) but this serves to shut up cpp's complaining. */
 #ifdef MDMBUF
-#undef MDMBUF
+# undef MDMBUF
 #endif
 #ifdef ECHO
-#undef ECHO
+# undef ECHO
 #endif
 #ifdef TOSTOP
-#undef TOSTOP
+# undef TOSTOP
 #endif
 #ifdef FLUSHO
-#undef FLUSHO
+# undef FLUSHO
 #endif
 #ifdef PENDIN
-#undef PENDIN
+# undef PENDIN
 #endif
 #ifdef NOFLSH
-#undef NOFLSH
+# undef NOFLSH
 #endif
 
 /* Hurd ioctl request are made up of several fields:
@@ -331,23 +328,20 @@ enum __ioctl_datum { IOC_8, IOC_16, IOC_32, IOC_64 };
 
 /* From 4.4 <sys/ttydev.h>.   */
 #ifdef USE_OLD_TTY
-#define B0	0
-#define B50	1
-#define B75	2
-#define B110	3
-#define B134	4
-#define B150	5
-#define B200	6
-#define B300	7
-#define B600	8
-#define B1200	9
-#define	B1800	10
-#define B2400	11
-#define B4800	12
-#define B9600	13
-#define EXTA	14
-#define EXTB	15
+# define B0	0
+# define B50	1
+# define B75	2
+# define B110	3
+# define B134	4
+# define B150	5
+# define B200	6
+# define B300	7
+# define B600	8
+# define B1200	9
+# define B1800	10
+# define B2400	11
+# define B4800	12
+# define B9600	13
+# define EXTA	14
+# define EXTB	15
 #endif /* USE_OLD_TTY */
-
-
-#endif /* bits/ioctls.h */
diff --git a/sysdeps/mach/hurd/bits/stat.h b/sysdeps/mach/hurd/bits/stat.h
index 4679c589ee..df50a0901f 100644
--- a/sysdeps/mach/hurd/bits/stat.h
+++ b/sysdeps/mach/hurd/bits/stat.h
@@ -16,12 +16,9 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-/*
- * Never include this file directly; use <sys/stat.h> instead.
- */
-
-#ifndef	_BITS_STAT_H
-#define	_BITS_STAT_H	1
+#ifndef _SYS_STAT_H
+# error "Never include <bits/stat.h> directly; use <sys/stat.h> instead."
+#endif
 
 #include <bits/types.h>
 
@@ -189,6 +186,3 @@ struct stat64
 #ifdef	__USE_BSD
 #define	CMASK		0022
 #endif
-
-
-#endif /* bits/stat.h */
diff --git a/sysdeps/mach/hurd/hppa/bits/sigcontext.h b/sysdeps/mach/hurd/hppa/bits/sigcontext.h
index f450125463..f0b4ff7a9b 100644
--- a/sysdeps/mach/hurd/hppa/bits/sigcontext.h
+++ b/sysdeps/mach/hurd/hppa/bits/sigcontext.h
@@ -17,6 +17,10 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
+#ifndef _SIGNAL_H
+# error "Never use <bits/sigcontext.h> directly; include <signal.h> instead."
+#endif
+
 /* Signal handlers are actually called:
    void handler (int sig, int code, struct sigcontext *scp);  */
 
diff --git a/sysdeps/mach/hurd/i386/bits/sigcontext.h b/sysdeps/mach/hurd/i386/bits/sigcontext.h
index 6539cf97d6..c5edb3119e 100644
--- a/sysdeps/mach/hurd/i386/bits/sigcontext.h
+++ b/sysdeps/mach/hurd/i386/bits/sigcontext.h
@@ -17,6 +17,10 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
+#ifndef _SIGNAL_H
+# error "Never use <bits/sigcontext.h> directly; include <signal.h> instead."
+#endif
+
 /* Signal handlers are actually called:
    void handler (int sig, int code, struct sigcontext *scp);  */
 
diff --git a/sysdeps/mach/hurd/mips/bits/sigcontext.h b/sysdeps/mach/hurd/mips/bits/sigcontext.h
index 64a57ab086..910618e32a 100644
--- a/sysdeps/mach/hurd/mips/bits/sigcontext.h
+++ b/sysdeps/mach/hurd/mips/bits/sigcontext.h
@@ -16,6 +16,10 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
+#ifndef _SIGNAL_H
+# error "Never use <bits/sigcontext.h> directly; include <signal.h> instead."
+#endif
+
 /* Signal handlers are actually called:
    void handler (int sig, int code, struct sigcontext *scp);  */
 
diff --git a/sysdeps/mips/bits/dlfcn.h b/sysdeps/mips/bits/dlfcn.h
index 636da5662d..c105537dfd 100644
--- a/sysdeps/mips/bits/dlfcn.h
+++ b/sysdeps/mips/bits/dlfcn.h
@@ -17,8 +17,9 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-#ifndef	_BITS_DLFCN_H
-#define	_BITS_DLFCN_H 1
+#ifndef _DLFCN_H
+# error "Never use <bits/dlfcn.h> directly; include <dlfcn.h> instead."
+#endif
 
 /* The MODE argument to `dlopen' contains one of the following: */
 #define RTLD_LAZY	0x001	/* Lazy function call binding.  */
@@ -33,10 +34,9 @@
 __BEGIN_DECLS
 
 /* Some SGI specific calls that aren't implemented yet.  */
-extern void *sgidladd __P ((const char *, int));
-extern void *sgidlopen_version __P ((const char *, int, const char *, int));
-extern char *sgigetdsoversion __P ((const char *));
+extern void *sgidladd __P ((__const char *, int));
+extern void *sgidlopen_version __P ((__const char *, int, __const char *,
+				     int));
+extern char *sgigetdsoversion __P ((__const char *));
 
 __END_DECLS
-
-#endif	/* bits/dlfcn.h */
diff --git a/sysdeps/mips/bits/endian.h b/sysdeps/mips/bits/endian.h
index ba555cd76e..40321a2866 100644
--- a/sysdeps/mips/bits/endian.h
+++ b/sysdeps/mips/bits/endian.h
@@ -1,4 +1,8 @@
 /* The MIPS architecture has selectable endianness.
    This file is for a machine using big-endian mode.  */
 
+#ifndef _ENDIAN_H
+# error "Never use <bits/endian.h> directly; include <endian.h> instead."
+#endif
+
 #define __BYTE_ORDER __BIG_ENDIAN
diff --git a/sysdeps/mips/bits/setjmp.h b/sysdeps/mips/bits/setjmp.h
index 7e570c6bff..ff3d75f821 100644
--- a/sysdeps/mips/bits/setjmp.h
+++ b/sysdeps/mips/bits/setjmp.h
@@ -1,6 +1,5 @@
 /* Define the machine-dependent type `jmp_buf'.  MIPS version.
    Copyright (C) 1992, 1993, 1995, 1997 Free Software Foundation, Inc.
-   Contributed by Brendan Kehoe (brendan@zen.org).
 
    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
@@ -17,6 +16,10 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
+#ifndef _SETJMP_H
+# error "Never include <bits/setjmp.h> directly; use <setjmp.h> instead."
+#endif
+
 typedef struct
   {
     /* Program counter.  */
diff --git a/sysdeps/mips/dec/bits/endian.h b/sysdeps/mips/dec/bits/endian.h
index 157bc44d06..0bdb378944 100644
--- a/sysdeps/mips/dec/bits/endian.h
+++ b/sysdeps/mips/dec/bits/endian.h
@@ -1,4 +1,8 @@
 /* The MIPS architecture has selectable endianness.
    The DECstation uses little-endian mode.  */
 
+#ifndef _ENDIAN_H
+# error "Never use <bits/endian.h> directly; include <endian.h> instead."
+#endif
+
 #define __BYTE_ORDER __LITTLE_ENDIAN
diff --git a/sysdeps/mips/mips64/bits/setjmp.h b/sysdeps/mips/mips64/bits/setjmp.h
index b108540505..9f08f4e1af 100644
--- a/sysdeps/mips/mips64/bits/setjmp.h
+++ b/sysdeps/mips/mips64/bits/setjmp.h
@@ -1,7 +1,6 @@
 /* Define the machine-dependent type `jmp_buf'.  MIPS version.
    Copyright (C) 1996, 1997 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
-   Contributed by Brendan Kehoe (brendan@zen.org).
 
    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
@@ -18,6 +17,10 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
+#ifndef _SETJMP_H
+# error "Never include <bits/setjmp.h> directly; use <setjmp.h> instead."
+#endif
+
 typedef struct
   {
     /* Program counter.  */
diff --git a/sysdeps/mips/mipsel/bits/endian.h b/sysdeps/mips/mipsel/bits/endian.h
index 5da5965cb2..2241190a70 100644
--- a/sysdeps/mips/mipsel/bits/endian.h
+++ b/sysdeps/mips/mipsel/bits/endian.h
@@ -1,4 +1,8 @@
 /* The MIPS architecture has selectable endianness.
    This file is for a machine using little-endian mode.  */
 
+#ifndef _ENDIAN_H
+# error "Never use <bits/endian.h> directly; include <endian.h> instead."
+#endif
+
 #define __BYTE_ORDER __LITTLE_ENDIAN
diff --git a/sysdeps/mips/p40/bits/endian.h b/sysdeps/mips/p40/bits/endian.h
index e4b0119433..f6cdde2cb3 100644
--- a/sysdeps/mips/p40/bits/endian.h
+++ b/sysdeps/mips/p40/bits/endian.h
@@ -1,4 +1,8 @@
 /* The MIPS has selectable endianness.
    The Japanese homebrew P40 architecture uses big-endian mode.  */
 
+#ifndef _ENDIAN_H
+# error "Never use <bits/endian.h> directly; include <endian.h> instead."
+#endif
+
 #define __BYTE_ORDER __BIG_ENDIAN
diff --git a/sysdeps/posix/getcwd.c b/sysdeps/posix/getcwd.c
index d40d8d6822..c7fda3eb2c 100644
--- a/sysdeps/posix/getcwd.c
+++ b/sysdeps/posix/getcwd.c
@@ -217,6 +217,7 @@ __getcwd (buf, size)
   char *path;
   register char *pathp;
   struct stat st;
+  int prev_errno = errno;
 
   if (size == 0)
     {
@@ -310,6 +311,9 @@ __getcwd (buf, size)
       dirstream = __opendir (dotp);
       if (dirstream == NULL)
 	goto lose;
+      /* Clear errno to distinguish EOF from error if readdir returns
+	 NULL.  */
+      __set_errno (0);
       while ((d = __readdir (dirstream)) != NULL)
 	{
 	  if (d->d_name[0] == '.' &&
@@ -343,6 +347,10 @@ __getcwd (buf, size)
 	{
 	  int save = errno;
 	  (void) __closedir (dirstream);
+	  if (save == 0)
+	    /* EOF on dirstream, which means that the current directory
+	       has been removed.  */
+	    save = ENOENT;
 	  __set_errno (save);
 	  goto lose;
 	}
@@ -393,6 +401,10 @@ __getcwd (buf, size)
     free ((__ptr_t) dotlist);
 
   memmove (path, pathp, path + size - pathp);
+
+  /* Restore errno on successful return.  */
+  __set_errno (prev_errno);
+
   return path;
 
  lose:
diff --git a/sysdeps/posix/mk-stdiolim.c b/sysdeps/posix/mk-stdiolim.c
index 7009c4ef10..c268b642de 100644
--- a/sysdeps/posix/mk-stdiolim.c
+++ b/sysdeps/posix/mk-stdiolim.c
@@ -21,6 +21,32 @@
 int
 main()
 {
+  /* Print copyright message.  */
+  printf ("\
+/* Stdio limits for POSIX systems.\n\
+   Copyright (C) 1994, 1997 Free Software Foundation, Inc.\n\
+   This file is part of the GNU C Library.\n\
+\n\
+   The GNU C Library is free software; you can redistribute it and/or\n\
+   modify it under the terms of the GNU Library General Public License as\n\
+   published by the Free Software Foundation; either version 2 of the\n\
+   License, or (at your option) any later version.\n\
+\n\
+   The GNU C Library is distributed in the hope that it will be useful,\n\
+   but WITHOUT ANY WARRANTY; without even the implied warranty of\n\
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n\
+   Library General Public License for more details.\n\
+\n\
+   You should have received a copy of the GNU Library General Publicn\n\
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,\n\
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,\n\
+   Boston, MA 02111-1307, USA.  */\n\
+\n\
+#ifndef _STDIO_H\n\
+# error \"Never include <bits/stdio_lim.h> directly; use <stdio.h> instead.\"\n\
+#endif\n\
+\n");
+
   /* These values correspond to the code in sysdeps/posix/tempname.c.
      Change the values here if you change that code.  */
   printf ("#define L_tmpnam %u\n", sizeof ("/usr/tmp/") + 9);
diff --git a/sysdeps/powerpc/bits/endian.h b/sysdeps/powerpc/bits/endian.h
index d3ff74f12f..9259da8039 100644
--- a/sysdeps/powerpc/bits/endian.h
+++ b/sysdeps/powerpc/bits/endian.h
@@ -18,6 +18,10 @@
 
 /* PowerPC can be little or big endian.  Hopefully gcc will know...  */
 
+#ifndef _ENDIAN_H
+# error "Never use <bits/endian.h> directly; include <endian.h> instead."
+#endif
+
 #if defined __BIG_ENDIAN__ || defined _BIG_ENDIAN
 # if defined __LITTLE_ENDIAN__ || defined _LITTLE_ENDIAN
 #  error Please fix sysdeps/powerpc/bits/endian.h (compiling bi-endian?).
diff --git a/sysdeps/powerpc/bits/fenv.h b/sysdeps/powerpc/bits/fenv.h
index 9bb6600324..14fbda8db0 100644
--- a/sysdeps/powerpc/bits/fenv.h
+++ b/sysdeps/powerpc/bits/fenv.h
@@ -52,44 +52,44 @@ enum
 
     /* Operation with SNaN. */
     FE_INVALID_SNAN = 1 << 31-7,
-#define FE_INVALID_SNAN	FE_INVALID_SNAN
+# define FE_INVALID_SNAN	FE_INVALID_SNAN
 
     /* Inf - Inf */
     FE_INVALID_ISI = 1 << 31-8,
-#define FE_INVALID_ISI	FE_INVALID_ISI
+# define FE_INVALID_ISI		FE_INVALID_ISI
 
     /* Inf / Inf */
     FE_INVALID_IDI = 1 << 31-9,
-#define FE_INVALID_IDI	FE_INVALID_IDI
+# define FE_INVALID_IDI		FE_INVALID_IDI
 
     /* 0 / 0 */
     FE_INVALID_ZDZ = 1 << 31-10,
-#define FE_INVALID_ZDZ	FE_INVALID_ZDZ
+# define FE_INVALID_ZDZ		FE_INVALID_ZDZ
 
     /* Inf * 0 */
     FE_INVALID_IMZ = 1 << 31-11,
-#define FE_INVALID_IMZ	FE_INVALID_IMZ
+# define FE_INVALID_IMZ		FE_INVALID_IMZ
 
     /* Comparison with NaN or SNaN.  */
     FE_INVALID_COMPARE = 1 << 31-12,
-#define FE_INVALID_COMPARE	FE_INVALID_COMPARE
+# define FE_INVALID_COMPARE	FE_INVALID_COMPARE
 
     /* Invalid operation flag for software (not set by hardware).  */
     /* Note that some chips don't have this implemented, presumably
        because no-one expected anyone to write software for them %-).  */
     FE_INVALID_SOFTWARE = 1 << 31-21,
-#define FE_INVALID_SOFTWARE	FE_INVALID_SOFTWARE
+# define FE_INVALID_SOFTWARE	FE_INVALID_SOFTWARE
 
     /* Square root of negative number (including -Inf).  */
     /* Note that some chips don't have this implemented.  */
     FE_INVALID_SQRT = 1 << 31-22,
-#define FE_INVALID_SQRT	FE_INVALID_SQRT
+# define FE_INVALID_SQRT	FE_INVALID_SQRT
 
     /* Conversion-to-integer of a NaN or a number too large or too small.  */
     FE_INVALID_INTEGER_CONVERSION = 1 << 31-23,
-#define FE_INVALID_INTEGER_CONVERSION	FE_INVALID_INTEGER_CONVERSION
+# define FE_INVALID_INTEGER_CONVERSION	FE_INVALID_INTEGER_CONVERSION
 
-#define FE_ALL_INVALID \
+# define FE_ALL_INVALID \
         (FE_INVALID_SNAN | FE_INVALID_ISI | FE_INVALID_IDI | FE_INVALID_ZDZ \
 	 | FE_INVALID_IMZ | FE_INVALID_COMPARE | FE_INVALID_SOFTWARE \
 	 | FE_INVALID_SQRT | FE_INVALID_INTEGER_CONVERSION)
diff --git a/sysdeps/powerpc/bits/setjmp.h b/sysdeps/powerpc/bits/setjmp.h
index a9cab03fc6..7bb654c0bc 100644
--- a/sysdeps/powerpc/bits/setjmp.h
+++ b/sysdeps/powerpc/bits/setjmp.h
@@ -1,17 +1,21 @@
 /* Define the machine-dependent type `jmp_buf'.  PowerPC version.  */
 
+#ifndef _SETJMP_H
+# error "Never include <bits/setjmp.h> directly; use <setjmp.h> instead."
+#endif
+
 /* The previous bits/setjmp.h had __jmp_buf defined as a structure.
    We use an array of 'long int' instead, to make writing the
    assembler easier. Naturally, user code should not depend on
    either representation. */
 
-#if	defined (__USE_MISC) || defined (_ASM)
-#define JB_GPR1  0   /* also known as the stack pointer */
-#define JB_GPR2  1
-#define JB_LR    2
-#define JB_GPRS  3   /* GPRs 14 through 31 are saved, 18 in total */
-#define JB_UNUSED 21 /* it's sometimes faster to store doubles word-aligned */
-#define JB_FPRS  22  /* FPRs 14 through 31 are saved, 18*2 words total */
+#if defined __USE_MISC || defined _ASM
+# define JB_GPR1   0   /* also known as the stack pointer */
+# define JB_GPR2   1
+# define JB_LR     2
+# define JB_GPRS   3  /* GPRs 14 through 31 are saved, 18 in total */
+# define JB_UNUSED 21 /* it's sometimes faster to store doubles word-aligned */
+# define JB_FPRS   22 /* FPRs 14 through 31 are saved, 18*2 words total */
 #endif
 
 #ifndef	_ASM
diff --git a/sysdeps/sparc/sparc32/bits/endian.h b/sysdeps/sparc/sparc32/bits/endian.h
index f1a75c0652..68fc68de6a 100644
--- a/sysdeps/sparc/sparc32/bits/endian.h
+++ b/sysdeps/sparc/sparc32/bits/endian.h
@@ -1,3 +1,7 @@
 /* SPARC is big-endian.  */
 
+#ifndef _ENDIAN_H
+# error "Never use <bits/endian.h> directly; include <endian.h> instead."
+#endif
+
 #define __BYTE_ORDER __BIG_ENDIAN
diff --git a/sysdeps/sparc/sparc32/bits/setjmp.h b/sysdeps/sparc/sparc32/bits/setjmp.h
index 43bae1a496..0e61fe7805 100644
--- a/sysdeps/sparc/sparc32/bits/setjmp.h
+++ b/sysdeps/sparc/sparc32/bits/setjmp.h
@@ -1,9 +1,13 @@
 /* Define the machine-dependent type `jmp_buf'.  SPARC version.  */
 
-#if	defined (__USE_MISC) || defined (_ASM)
-#define	JB_SP	0
-#define	JB_FP	1
-#define	JB_PC	2
+#ifndef _SETJMP_H
+# error "Never include <bits/setjmp.h> directly; use <setjmp.h> instead."
+#endif
+
+#if defined __USE_MISC || defined _ASM
+# define JB_SP	0
+# define JB_FP	1
+# define JB_PC	2
 #endif
 
 #ifndef	_ASM
diff --git a/sysdeps/sparc/sparc32/fpu/bits/fenv.h b/sysdeps/sparc/sparc32/fpu/bits/fenv.h
index 6a76795d6a..9fb33cef28 100644
--- a/sysdeps/sparc/sparc32/fpu/bits/fenv.h
+++ b/sysdeps/sparc/sparc32/fpu/bits/fenv.h
@@ -17,7 +17,7 @@
    Boston, MA 02111-1307, USA.  */
 
 #ifndef _FENV_H
-#error "Never use <bits/fenv.h> directly; include <fenv.h> instead."
+# error "Never use <bits/fenv.h> directly; include <fenv.h> instead."
 #endif
 
 
@@ -72,5 +72,5 @@ typedef unsigned int fenv_t;
 #endif
 
 /* For internal use only: access the fp state register.  */
-#define __fenv_stfsr(X)   __asm__("st %%fsr,%0" : "=m"(X))
-#define __fenv_ldfsr(X)   __asm__ __volatile__("ld %0,%%fsr" : : "m"(X))
+#define __fenv_stfsr(X)   __asm__ ("st %%fsr,%0" : "=m" (X))
+#define __fenv_ldfsr(X)   __asm__ __volatile__ ("ld %0,%%fsr" : : "m" (X))
diff --git a/sysdeps/sparc/sparc64/bits/endian.h b/sysdeps/sparc/sparc64/bits/endian.h
index a2ab07249a..8acfdf5df6 100644
--- a/sysdeps/sparc/sparc64/bits/endian.h
+++ b/sysdeps/sparc/sparc64/bits/endian.h
@@ -1,8 +1,12 @@
 /* Sparc is big-endian, but v9 supports endian conversion on loads/stores
    and GCC supports such a mode.  Be prepared.  */
 
+#ifndef _ENDIAN_H
+# error "Never use <bits/endian.h> directly; include <endian.h> instead."
+#endif
+
 #ifdef __LITTLE_ENDIAN__
-#define __BYTE_ORDER __LITTLE_ENDIAN
+# define __BYTE_ORDER __LITTLE_ENDIAN
 #else
-#define __BYTE_ORDER __BIG_ENDIAN
+# define __BYTE_ORDER __BIG_ENDIAN
 #endif
diff --git a/sysdeps/sparc/sparc64/fpu/bits/fenv.h b/sysdeps/sparc/sparc64/fpu/bits/fenv.h
index 802c58bdce..5728e2b588 100644
--- a/sysdeps/sparc/sparc64/fpu/bits/fenv.h
+++ b/sysdeps/sparc/sparc64/fpu/bits/fenv.h
@@ -17,7 +17,7 @@
    Boston, MA 02111-1307, USA.  */
 
 #ifndef _FENV_H
-#error "Never use <bits/fenv.h> directly; include <fenv.h> instead."
+# error "Never use <bits/fenv.h> directly; include <fenv.h> instead."
 #endif
 
 
@@ -72,5 +72,5 @@ typedef unsigned long fenv_t;
 #endif
 
 /* For internal use only: access the fp state register.  */
-#define __fenv_stfsr(X)   __asm__("stx %%fsr,%0" : "=m"(X))
-#define __fenv_ldfsr(X)   __asm__ __volatile__("ldx %0,%%fsr" : : "m"(X))
+#define __fenv_stfsr(X)   __asm__ ("stx %%fsr,%0" : "=m" (X))
+#define __fenv_ldfsr(X)   __asm__ __volatile__ ("ldx %0,%%fsr" : : "m" (X))
diff --git a/sysdeps/unix/bsd/bits/dirent.h b/sysdeps/unix/bsd/bits/dirent.h
index 6f88661694..642c79183e 100644
--- a/sysdeps/unix/bsd/bits/dirent.h
+++ b/sysdeps/unix/bsd/bits/dirent.h
@@ -17,6 +17,10 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
+#ifndef _DIRENT_H
+# error "Never use <bits/dirent.h> directly; include <dirent.h> instead."
+#endif
+
 struct dirent
   {
     unsigned int d_fileno;	/* 32 bits.  */
diff --git a/sysdeps/unix/bsd/bits/stat.h b/sysdeps/unix/bsd/bits/stat.h
index 71130f3fcb..8722fa0249 100644
--- a/sysdeps/unix/bsd/bits/stat.h
+++ b/sysdeps/unix/bsd/bits/stat.h
@@ -16,12 +16,9 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-/*
- * Never include this file directly; use <sys/stat.h> instead.
- */
-
-#ifndef	_STATBUF_H
-#define	_STATBUF_H	1
+#ifndef _SYS_STAT_H
+# error "Never include <bits/stat.h> directly; use <sys/stat.h> instead."
+#endif
 
 #include <bits/types.h>
 
@@ -82,6 +79,3 @@ struct stat
 #define	__S_IREAD	0400	/* Read by owner.  */
 #define	__S_IWRITE	0200	/* Write by owner.  */
 #define	__S_IEXEC	0100	/* Execute by owner.  */
-
-
-#endif /* bits/stat.h */
diff --git a/sysdeps/unix/bsd/bits/waitflags.h b/sysdeps/unix/bsd/bits/waitflags.h
index ca952f90b4..47fc6ea1b7 100644
--- a/sysdeps/unix/bsd/bits/waitflags.h
+++ b/sysdeps/unix/bsd/bits/waitflags.h
@@ -18,7 +18,7 @@
    Boston, MA 02111-1307, USA.  */
 
 #ifndef _SYS_WAIT_H
-#error "Never use <bits/waitflags.h> directly; include <sys/wait.h> instead."
+# error "Never include <bits/waitflags.h> directly; use <sys/wait.h> instead."
 #endif
 
 
@@ -26,5 +26,5 @@
 #define	WNOHANG		1	/* Don't block waiting.  */
 #define	WUNTRACED	2	/* Report status of stopped children.  */
 #ifdef  __USE_GNU
-#define WNOREAP		4	/* Don't remove record of child reported.  */
+# define WNOREAP	4	/* Don't remove record of child reported.  */
 #endif
diff --git a/sysdeps/unix/bsd/bsd4.4/bits/dirent.h b/sysdeps/unix/bsd/bsd4.4/bits/dirent.h
index b9e0d7277e..e29dac4806 100644
--- a/sysdeps/unix/bsd/bsd4.4/bits/dirent.h
+++ b/sysdeps/unix/bsd/bsd4.4/bits/dirent.h
@@ -17,6 +17,10 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
+#ifndef _DIRENT_H
+# error "Never use <bits/dirent.h> directly; include <dirent.h> instead."
+#endif
+
 struct dirent
   {
     __ino_t d_fileno;		/* File serial number.  */
diff --git a/sysdeps/unix/bsd/osf/alpha/bits/stat.h b/sysdeps/unix/bsd/osf/alpha/bits/stat.h
index ab0fa48f68..7084b4e534 100644
--- a/sysdeps/unix/bsd/osf/alpha/bits/stat.h
+++ b/sysdeps/unix/bsd/osf/alpha/bits/stat.h
@@ -1,6 +1,5 @@
 /* Copyright (C) 1993, 1996, 1997 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
-   Contributed by Brendan Kehoe (brendan@zen.org).
 
    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
@@ -17,12 +16,9 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-/*
- * Never include this file directly; use <sys/stat.h> instead.
- */
-
-#ifndef	_BITS_STAT_H
-#define	_BITS_STAT_H
+#ifndef _SYS_STAT_H
+# error "Never include <bits/stat.h> directly; use <sys/stat.h> instead."
+#endif
 
 #include <bits/types.h>
 
@@ -76,5 +72,3 @@ struct stat
 #define	__S_IREAD	0400	/* Read by owner.  */
 #define	__S_IWRITE	0200	/* Write by owner.  */
 #define	__S_IEXEC	0100	/* Execute by owner.  */
-
-#endif	/* bits/stat.h */
diff --git a/sysdeps/unix/bsd/osf/bits/sigaction.h b/sysdeps/unix/bsd/osf/bits/sigaction.h
index 56e28a04fb..6bf030793e 100644
--- a/sysdeps/unix/bsd/osf/bits/sigaction.h
+++ b/sysdeps/unix/bsd/osf/bits/sigaction.h
@@ -18,6 +18,10 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
+#ifndef _SIGNAL_H
+# error "Never include <bits/sigaction.h> directly; use <signal.h> instead."
+#endif
+
 /* Structure describing the action to be taken when a signal arrives.  */
 struct sigaction
   {
diff --git a/sysdeps/unix/bsd/sun/m68k/bits/sigcontext.h b/sysdeps/unix/bsd/sun/m68k/bits/sigcontext.h
index 61481cc6a2..f637efa6cd 100644
--- a/sysdeps/unix/bsd/sun/m68k/bits/sigcontext.h
+++ b/sysdeps/unix/bsd/sun/m68k/bits/sigcontext.h
@@ -17,6 +17,10 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
+#ifndef _SIGNAL_H
+# error "Never use <bits/sigcontext.h> directly; include <signal.h> instead."
+#endif
+
 struct sigcontext
   {
     int sc_onstack;
diff --git a/sysdeps/unix/bsd/sun/sparc/bits/sigcontext.h b/sysdeps/unix/bsd/sun/sparc/bits/sigcontext.h
index e1cdd416a1..29d2d87b26 100644
--- a/sysdeps/unix/bsd/sun/sparc/bits/sigcontext.h
+++ b/sysdeps/unix/bsd/sun/sparc/bits/sigcontext.h
@@ -17,6 +17,10 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
+#ifndef _SIGNAL_H
+# error "Never use <bits/sigcontext.h> directly; include <signal.h> instead."
+#endif
+
 struct sigcontext
   {
     int sc_onstack;
diff --git a/sysdeps/unix/bsd/sun/sunos4/bits/resource.h b/sysdeps/unix/bsd/sun/sunos4/bits/resource.h
index f51262d92d..6978c87dd2 100644
--- a/sysdeps/unix/bsd/sun/sunos4/bits/resource.h
+++ b/sysdeps/unix/bsd/sun/sunos4/bits/resource.h
@@ -17,6 +17,10 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
+#ifndef _SYS_RESOURCE_H
+# error "Never use <bits/resource.h> directly; include <sys/resource.h> instead."
+#endif
+
 /* These are the values for 4.4 BSD and GNU.  Earlier BSD systems have a
    subset of these kinds of resource limit.  In systems where `getrlimit'
    and `setrlimit' are not system calls, these are the values used by the C
@@ -110,7 +114,8 @@ enum __rusage_who
 #define RUSAGE_CHILDREN RUSAGE_CHILDREN
   };
 
-#include <sys/time.h>           /* For `struct timeval'.  */
+#define __need_timeval
+#include <bits/time.h>           /* For `struct timeval'.  */
 
 /* Structure which says how much of each resource has been used.  */
 struct rusage
diff --git a/sysdeps/unix/bsd/sun/sunos4/bits/termios.h b/sysdeps/unix/bsd/sun/sunos4/bits/termios.h
index dc0a007208..15aaab795a 100644
--- a/sysdeps/unix/bsd/sun/sunos4/bits/termios.h
+++ b/sysdeps/unix/bsd/sun/sunos4/bits/termios.h
@@ -1,5 +1,5 @@
 /* termios type and macro definitions.  SunOS 4 version.
-   Copyright (C) 1993, 1994, 1996 Free Software Foundation, Inc.
+   Copyright (C) 1993, 1994, 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
@@ -17,6 +17,10 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
+#ifndef _TERMIOS_H
+# error "Never include <bits/termios.h> directly; use <termios.h> instead."
+#endif
+
 /* Type of terminal control flag masks.  */
 typedef unsigned long int tcflag_t;
 
@@ -41,51 +45,51 @@ struct termios
 #define	IGNCR	0x0080		/* Ignore CR.  */
 #define	ICRNL	0x0100		/* Map CR to NL on input.  */
 #ifdef __USE_BSD
-#define	IUCLC	0x0200		/* Map upper case to lower case on input.  */
+# define IUCLC	0x0200		/* Map upper case to lower case on input.  */
 #endif
 #define	IXON	0x0400		/* Enable start/stop output control.  */
 #define	IXOFF	0x1000		/* Enable start/stop input control.  */
 #ifdef	__USE_BSD
-#define	IXANY	0x0800		/* Any character will restart after stop.  */
-#define	IMAXBEL	0x2000		/* Ring bell when input queue is full.  */
+# define IXANY	0x0800		/* Any character will restart after stop.  */
+# define IMAXBEL	0x2000		/* Ring bell when input queue is full.  */
 #endif
 
   /* Output modes.  */
   tcflag_t c_oflag;
 #define	OPOST	0x0001		/* Perform output processing.  */
 #ifdef	__USE_BSD
-#define	OLCUC	0x00000002	/* Map lower case to upper case on output.  */
-#define	ONLCR	0x00000004	/* Map NL to CR-NL on output.  */
-#define	OCRNL	0x00000008
-#define	ONOCR	0x00000010
-#define	ONLRET	0x00000020
-#define	OFILL	0x00000040
-#define	OFDEL	0x00000080
-#define	NLDLY	0x00000100
-#define	NL0	0
-#define	NL1	0x00000100
-#define	CRDLY	0x00000600
-#define	CR0	0
-#define	CR1	0x00000200
-#define	CR2	0x00000400
-#define	CR3	0x00000600
-#define	TABDLY	0x00001800
-#define	TAB0	0
-#define	TAB1	0x00000800
-#define	TAB2	0x00001000
-#define	XTABS	0x00001800
-#define	TAB3	XTABS
-#define	BSDLY	0x00002000
-#define	BS0	0
-#define	BS1	0x00002000
-#define	VTDLY	0x00004000
-#define	VT0	0
-#define	VT1	0x00004000
-#define	FFDLY	0x00008000
-#define	FF0	0
-#define	FF1	0x00008000
-#define	PAGEOUT	0x00010000
-#define	WRAP	0x00020000
+# define OLCUC	0x00000002	/* Map lower case to upper case on output.  */
+# define ONLCR	0x00000004	/* Map NL to CR-NL on output.  */
+# define OCRNL	0x00000008
+# define ONOCR	0x00000010
+# define ONLRET	0x00000020
+# define OFILL	0x00000040
+# define OFDEL	0x00000080
+# define NLDLY	0x00000100
+# define NL0	0
+# define NL1	0x00000100
+# define CRDLY	0x00000600
+# define CR0	0
+# define CR1	0x00000200
+# define CR2	0x00000400
+# define CR3	0x00000600
+# define TABDLY	0x00001800
+# define TAB0	0
+# define TAB1	0x00000800
+# define TAB2	0x00001000
+# define XTABS	0x00001800
+# define TAB3	XTABS
+# define BSDLY	0x00002000
+# define BS0	0
+# define BS1	0x00002000
+# define VTDLY	0x00004000
+# define VT0	0
+# define VT1	0x00004000
+# define FFDLY	0x00008000
+# define FF0	0
+# define FF1	0x00008000
+# define PAGEOUT 0x00010000
+# define WRAP	0x00020000
 #endif
 
   /* Control modes.  */
@@ -102,11 +106,11 @@ struct termios
 #define	HUPCL	0x00000400	/* Hang up on last close.  */
 #define	CLOCAL	0x00000800	/* Ignore modem status lines.  */
 #ifdef	__USE_BSD
-#define	LOBLK	0x00001000
-#define	CRTSCTS	0x80000000
-#define	CIBAUD	0x000f0000	/* Mask for input speed from c_cflag.  */
-#define	CBAUD	0x0000000f	/* Mask for output speed from c_cflag.  */
-#define	IBSHIFT	16		/* Bits to shift for input speed.  */
+# define LOBLK	0x00001000
+# define CRTSCTS	0x80000000
+# define CIBAUD	0x000f0000	/* Mask for input speed from c_cflag.  */
+# define CBAUD	0x0000000f	/* Mask for output speed from c_cflag.  */
+# define IBSHIFT	16		/* Bits to shift for input speed.  */
 #endif
 
   /* Input and output baud rates.  These are encoded in c_cflag.  */
@@ -127,29 +131,29 @@ struct termios
 #define B19200  14
 #define B38400  15
 #ifdef __USE_BSD
-#define EXTA    14
-#define EXTB    15
+# define EXTA   14
+# define EXTB   15
 #endif
 
   /* Local modes.  */
   tcflag_t c_lflag;
 #ifdef	__USE_BSD
-#define	ECHOKE	0x00000800	/* Visual erase for KILL.  */
+# define ECHOKE	0x00000800	/* Visual erase for KILL.  */
 #endif
 #define	ECHOE	0x00000010	/* Visual erase for ERASE.  */
 #define	ECHOK	0x00000020	/* Echo NL after KILL.  */
 #define	ECHO	0x00000008	/* Enable echo.  */
 #define	ECHONL	0x00000040	/* Echo NL even if ECHO is off.  */
 #ifdef	__USE_BSD
-#define	ECHOPRT	0x00000400	/* Hardcopy visual erase.  */
-#define	ECHOCTL	0x00000200	/* Echo control characters as ^X.  */
+# define ECHOPRT	0x00000400	/* Hardcopy visual erase.  */
+# define ECHOCTL	0x00000200	/* Echo control characters as ^X.  */
 #endif
 #define	ISIG	0x00000001	/* Enable signals.  */
 #define	ICANON	0x00000002	/* Do erase and kill processing.  */
 #define	IEXTEN	0x00008000	/* Enable DISCARD and LNEXT.  */
 #define	TOSTOP	0x00000100	/* Send SIGTTOU for background output.  */
 #ifdef	__USE_BSD
-#define	PENDIN	0x00004000	/* Retype pending input (state).  */
+# define PENDIN	0x00004000	/* Retype pending input (state).  */
 #endif
 #define	NOFLSH	0x00000080	/* Disable flush after interrupt.  */
 
@@ -159,28 +163,28 @@ struct termios
 #define	VEOF	4		/* End-of-file character [ICANON].  */
 #define	VEOL	5		/* End-of-line character [ICANON].  */
 #ifdef	__USE_BSD
-#define	VEOL2	6		/* Second EOL character [ICANON].  */
-#define	VSWTCH	7		/* ??? */
+# define VEOL2	6		/* Second EOL character [ICANON].  */
+# define VSWTCH	7		/* ??? */
 #endif
 #define	VERASE	2		/* Erase character [ICANON].  */
 #ifdef	__USE_BSD
-#define	VWERASE	14		/* Word-erase character [ICANON].  */
+# define VWERASE	14		/* Word-erase character [ICANON].  */
 #endif
 #define	VKILL	3		/* Kill-line character [ICANON].  */
 #ifdef	__USE_BSD
-#define	VREPRINT 12		/* Reprint-line character [ICANON].  */
+# define VREPRINT 12		/* Reprint-line character [ICANON].  */
 #endif
 #define	VINTR	0		/* Interrupt character [ISIG].  */
 #define	VQUIT	1		/* Quit character [ISIG].  */
 #define	VSUSP	10		/* Suspend character [ISIG].  */
 #ifdef	__USE_BSD
-#define	VDSUSP	11		/* Delayed suspend character [ISIG].  */
+# define VDSUSP	11		/* Delayed suspend character [ISIG].  */
 #endif
 #define	VSTART	8		/* Start (X-ON) character [IXON, IXOFF].  */
 #define	VSTOP	9		/* Stop (X-OFF) character [IXON, IXOFF].  */
 #ifdef	__USE_BSD
-#define	VLNEXT	15		/* Literal-next character [IEXTEN].  */
-#define	VDISCARD 13		/* Discard character [IEXTEN].  */
+# define VLNEXT	15		/* Literal-next character [IEXTEN].  */
+# define VDISCARD 13		/* Discard character [IEXTEN].  */
 #endif
 #define	VMIN	VEOF		/* Minimum number of bytes read at once [!ICANON].  */
 #define	VTIME	VEOL		/* Time-out value (tenths of a second) [!ICANON].  */
diff --git a/sysdeps/unix/bsd/sun/sunos4/bits/utsname.h b/sysdeps/unix/bsd/sun/sunos4/bits/utsname.h
index e9111b6504..5a03bab0c2 100644
--- a/sysdeps/unix/bsd/sun/sunos4/bits/utsname.h
+++ b/sysdeps/unix/bsd/sun/sunos4/bits/utsname.h
@@ -1,2 +1,24 @@
+/* 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.  */
+
+#ifndef _UTSNAME_H
+# error "Never include <bits/utsname.h> directly; use <sys/utsname.h> instead."
+#endif
+
 #define _UTSNAME_LENGTH 9
 #define _UTSNAME_NODENAME_LENGTH 65
diff --git a/sysdeps/unix/bsd/ultrix4/bits/utsname.h b/sysdeps/unix/bsd/ultrix4/bits/utsname.h
index ad4389ab02..a9f36ab3d1 100644
--- a/sysdeps/unix/bsd/ultrix4/bits/utsname.h
+++ b/sysdeps/unix/bsd/ultrix4/bits/utsname.h
@@ -1 +1,23 @@
+/* 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.  */
+
+#ifndef _UTSNAME_H
+# error "Never include <bits/utsname.h> directly; use <sys/utsname.h> instead."
+#endif
+
 #define _UTSNAME_LENGTH 32
diff --git a/sysdeps/unix/bsd/ultrix4/mips/bits/sigcontext.h b/sysdeps/unix/bsd/ultrix4/mips/bits/sigcontext.h
index 72b29e5649..cb66517eef 100644
--- a/sysdeps/unix/bsd/ultrix4/mips/bits/sigcontext.h
+++ b/sysdeps/unix/bsd/ultrix4/mips/bits/sigcontext.h
@@ -1,6 +1,5 @@
 /* Copyright (C) 1992, 1994, 1997 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
-   Contributed by Brendan Kehoe (brendan@zen.org).
 
    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
@@ -17,6 +16,10 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
+#ifndef _SIGNAL_H
+# error "Never use <bits/sigcontext.h> directly; include <signal.h> instead."
+#endif
+
 /* Note that ANY change to this instantly implies a change to __handler.S.  */
 
 struct sigcontext
diff --git a/sysdeps/unix/common/bits/dirent.h b/sysdeps/unix/common/bits/dirent.h
index 5ba1054049..e32f7f03c8 100644
--- a/sysdeps/unix/common/bits/dirent.h
+++ b/sysdeps/unix/common/bits/dirent.h
@@ -1,4 +1,4 @@
-/* Directory entry structure `struct dirent'.  SVR4/Linux version.
+/* Directory entry structure `struct dirent'.  SVR4 version.
    Copyright (C) 1996, 1997 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
@@ -17,6 +17,10 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
+#ifndef _DIRENT_H
+# error "Never use <bits/dirent.h> directly; include <dirent.h> instead."
+#endif
+
 struct dirent
   {
     unsigned int d_fileno;
diff --git a/sysdeps/unix/sysv/bits/dirent.h b/sysdeps/unix/sysv/bits/dirent.h
index d10417d507..ca4b050296 100644
--- a/sysdeps/unix/sysv/bits/dirent.h
+++ b/sysdeps/unix/sysv/bits/dirent.h
@@ -17,6 +17,10 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
+#ifndef _DIRENT_H
+# error "Never use <bits/dirent.h> directly; include <dirent.h> instead."
+#endif
+
 struct dirent
   {
     unsigned short int d_fileno;
diff --git a/sysdeps/unix/sysv/bits/stat.h b/sysdeps/unix/sysv/bits/stat.h
index 56f4544594..8334feaa2e 100644
--- a/sysdeps/unix/sysv/bits/stat.h
+++ b/sysdeps/unix/sysv/bits/stat.h
@@ -16,12 +16,9 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-/*
- * Never include this file directly; use <sys/stat.h> instead.
- */
-
-#ifndef	_BITS_STAT_H
-#define	_BITS_STAT_H	1
+#ifndef _SYS_STAT_H
+# error "Never include <bits/stat.h> directly; use <sys/stat.h> instead."
+#endif
 
 struct stat
   {
@@ -61,5 +58,3 @@ struct stat
 #define	__S_IREAD	0400	/* Read by owner.  */
 #define	__S_IWRITE	0200	/* Write by owner.  */
 #define	__S_IEXEC	0100	/* Execute by owner.  */
-
-#endif	/* bits/stat.h */
diff --git a/sysdeps/unix/sysv/bits/utmp.h b/sysdeps/unix/sysv/bits/utmp.h
index 1bb1a55873..9304013d32 100644
--- a/sysdeps/unix/sysv/bits/utmp.h
+++ b/sysdeps/unix/sysv/bits/utmp.h
@@ -18,7 +18,7 @@
    Boston, MA 02111-1307, USA.  */
 
 #ifndef _UTMP_H
-#error "Never use <bits/utmp.h> directly; include <utmp.h> instead."
+# error "Never include <bits/utmp.h> directly; use <utmp.h> instead."
 #endif
 
 
@@ -28,7 +28,6 @@
 #define _PATH_WTMP      "/var/adm/wtmp"
 #define _PATH_LASTLOG   "/var/adm/lastlog"
 
-__BEGIN_DECLS
 
 struct utmp
   {
@@ -36,14 +35,14 @@ struct utmp
     char ut_user[8];
     char ut_id[4];
     char ut_line[12];
-    short ut_pid;
-    short ut_type;
+    short int ut_pid;
+    short int ut_type;
     struct exit_status
       {
-	short e_termination;
-	short e_exit;
+	short int e_termination;
+	short int e_exit;
       } ut_exit;
-    time_t ut_time;
+    __time_t ut_time;
   };
 
 
@@ -53,5 +52,3 @@ struct utmp
 #define _HAVE_UT_ID	1
 #define _HAVE_UT_TV	1
 #define _HAVE_UT_HOST	1
-
-__END_DECLS
diff --git a/sysdeps/unix/sysv/bits/utsname.h b/sysdeps/unix/sysv/bits/utsname.h
index 31473cf4ea..fb11e4f029 100644
--- a/sysdeps/unix/sysv/bits/utsname.h
+++ b/sysdeps/unix/sysv/bits/utsname.h
@@ -1 +1,23 @@
+/* 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.  */
+
+#ifndef _UTSNAME_H
+# error "Never include <bits/utsname.h> directly; use <sys/utsname.h> instead."
+#endif
+
 #define _UTSNAME_LENGTH 9
diff --git a/sysdeps/unix/sysv/irix4/bits/confname.h b/sysdeps/unix/sysv/irix4/bits/confname.h
index c185f22adf..89fca07fe5 100644
--- a/sysdeps/unix/sysv/irix4/bits/confname.h
+++ b/sysdeps/unix/sysv/irix4/bits/confname.h
@@ -17,6 +17,10 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
+#ifndef _UNISTD_H
+# error "Never use <bits/confname.h> directly; include <unistd.h> instead."
+#endif
+
 /* Values for the NAME argument to `pathconf' and `fpathconf'.  */
 enum
   {
diff --git a/sysdeps/unix/sysv/irix4/bits/stat.h b/sysdeps/unix/sysv/irix4/bits/stat.h
index 0dab45cfa0..633f2618ec 100644
--- a/sysdeps/unix/sysv/irix4/bits/stat.h
+++ b/sysdeps/unix/sysv/irix4/bits/stat.h
@@ -16,12 +16,9 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-/*
- * Never include this file directly; use <sys/stat.h> instead.
- */
-
-#ifndef	_BITS_STAT_H
-#define	_BITS_STAT_H	1
+#ifndef _SYS_STAT_H
+# error "Never include <bits/stat.h> directly; use <sys/stat.h> instead."
+#endif
 
 struct stat
   {
@@ -61,5 +58,3 @@ struct stat
 #define	__S_IREAD	0400	/* Read by owner.  */
 #define	__S_IWRITE	0200	/* Write by owner.  */
 #define	__S_IEXEC	0100	/* Execute by owner.  */
-
-#endif	/* bits/stat.h */
diff --git a/sysdeps/unix/sysv/linux/alpha/bits/ioctls.h b/sysdeps/unix/sysv/linux/alpha/bits/ioctls.h
index 8a14f99f43..dcbf9f4402 100644
--- a/sysdeps/unix/sysv/linux/alpha/bits/ioctls.h
+++ b/sysdeps/unix/sysv/linux/alpha/bits/ioctls.h
@@ -16,12 +16,9 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-/*
- * Never include this file directly; use <sys/ioctl.h> instead.
- */
-
-#ifndef _BITS_IOCTLS_H
-#define _BITS_IOCTLS_H 1
+#ifndef _SYS_IOCTL_H
+# error "Never use <bits/ioctls.h> directly; include <sys/ioctl.h> instead."
+#endif
 
 /* Use the definitions from the kernel header files.  */
 #include <asm/ioctls.h>
@@ -39,5 +36,3 @@
 #define TCSETSF	_IOW ('t', 22, struct __kernel_termios)
 
 #include <linux/sockios.h>
-
-#endif /* bits/ioctls.h  */
diff --git a/sysdeps/unix/sysv/linux/alpha/bits/ipc.h b/sysdeps/unix/sysv/linux/alpha/bits/ipc.h
index 57830daae1..ec116f6114 100644
--- a/sysdeps/unix/sysv/linux/alpha/bits/ipc.h
+++ b/sysdeps/unix/sysv/linux/alpha/bits/ipc.h
@@ -1,6 +1,5 @@
 /* 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
@@ -17,10 +16,9 @@
    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>
+#ifndef _SYS_IPC_H
+# error "Never use <bits/ipc.h> directly; include <sys/ipc.h> instead."
+#endif
 
 #include <sys/types.h>
 
@@ -35,9 +33,6 @@
 #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.  */
 
@@ -63,10 +58,14 @@ struct ipc_kludge
     long int msgtyp;
   };
 
+__BEGIN_DECLS
+
 /* The actual system call: all functions are multiplexed by this.  */
 extern int __ipc __P ((int __call, int __first, int __second, int __third,
 		       void *__ptr));
 
+__END_DECLS
+
 /* The codes for the functions to use the multiplexer `__ipc'.  */
 #define IPCOP_semop	 1
 #define IPCOP_semget	 2
@@ -79,7 +78,3 @@ extern int __ipc __P ((int __call, int __first, int __second, int __third,
 #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/bits/mman.h b/sysdeps/unix/sysv/linux/alpha/bits/mman.h
index 1bef0cb525..081a00441e 100644
--- a/sysdeps/unix/sysv/linux/alpha/bits/mman.h
+++ b/sysdeps/unix/sysv/linux/alpha/bits/mman.h
@@ -1,4 +1,4 @@
-/* Definitions for POSIX memory map inerface.  Linux/Alpha version.
+/* Definitions for POSIX memory map interface.  Linux/Alpha version.
    Copyright (C) 1997 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
@@ -18,7 +18,7 @@
    Boston, MA 02111-1307, USA.  */
 
 #ifndef _SYS_MMAN_H
-# error "Never include this file directly.  Use <sys/mman.h> instead"
+# error "Never use <bits/mman.h> directly; include <sys/mman.h> instead."
 #endif
 
 /* The following definitions basically come from the kernel headers.
diff --git a/sysdeps/unix/sysv/linux/alpha/bits/sigaction.h b/sysdeps/unix/sysv/linux/alpha/bits/sigaction.h
index f28b6f256c..274531f270 100644
--- a/sysdeps/unix/sysv/linux/alpha/bits/sigaction.h
+++ b/sysdeps/unix/sysv/linux/alpha/bits/sigaction.h
@@ -17,6 +17,10 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
+#ifndef _SIGNAL_H
+# error "Never include <bits/sigaction.h> directly; use <signal.h> instead."
+#endif
+
 /* Structure describing the action to be taken when a signal arrives.  */
 struct sigaction
   {
diff --git a/sysdeps/unix/sysv/linux/alpha/bits/stat.h b/sysdeps/unix/sysv/linux/alpha/bits/stat.h
index de8752ea8b..319ff96c51 100644
--- a/sysdeps/unix/sysv/linux/alpha/bits/stat.h
+++ b/sysdeps/unix/sysv/linux/alpha/bits/stat.h
@@ -16,12 +16,9 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-/*
- * Never include this file directly; use <sys/stat.h> instead.
- */
-
-#ifndef	_BITS_STAT_H
-#define	_BITS_STAT_H	1
+#ifndef _SYS_STAT_H
+# error "Never include <bits/stat.h> directly; use <sys/stat.h> instead."
+#endif
 
 /* Versions of the `struct stat' data structure.  */
 #define _STAT_VER_KERNEL	0
@@ -112,5 +109,3 @@ struct stat64
 #define	__S_IREAD	0400	/* Read by owner.  */
 #define	__S_IWRITE	0200	/* Write by owner.  */
 #define	__S_IEXEC	0100	/* Execute by owner.  */
-
-#endif	/* bits/stat.h */
diff --git a/sysdeps/unix/sysv/linux/alpha/bits/termios.h b/sysdeps/unix/sysv/linux/alpha/bits/termios.h
index d0932c1cd7..0d57c489d9 100644
--- a/sysdeps/unix/sysv/linux/alpha/bits/termios.h
+++ b/sysdeps/unix/sysv/linux/alpha/bits/termios.h
@@ -17,8 +17,9 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-#ifndef _TERMBITS_H
-#define _TERMBITS_H 1
+#ifndef _TERMIOS_H
+# error "Never include <bits/termios.h> directly; use <termios.h> instead."
+#endif
 
 typedef unsigned char	cc_t;
 typedef unsigned int	speed_t;
@@ -189,5 +190,3 @@ struct termios
 
 #define _IOT_termios /* Hurd ioctl type field.  */ \
   _IOT (_IOTS (cflag_t), 4, _IOTS (cc_t), NCCS, _IOTS (speed_t), 2)
-
-#endif /* _TERMBITS_H */
diff --git a/sysdeps/unix/sysv/linux/alpha/bits/time.h b/sysdeps/unix/sysv/linux/alpha/bits/time.h
index 7475b68f5b..d32f4d30e9 100644
--- a/sysdeps/unix/sysv/linux/alpha/bits/time.h
+++ b/sysdeps/unix/sysv/linux/alpha/bits/time.h
@@ -21,23 +21,9 @@
  * Never include this file directly; use <time.h> instead.
  */
 
-#ifdef __need_timeval
-# undef __need_timeval
-# ifndef _STRUCT_TIMEVAL
-#  define _STRUCT_TIMEVAL	1
-/* A time value that is accurate to the nearest
-   microsecond but also has a range of years.  */
-struct timeval
-  {
-    int tv_sec;			/* Seconds.  */
-    int tv_usec;		/* Microseconds.  */
-  };
-# endif	/* struct timeval */
-#endif	/* need timeval */
-
-
-#ifndef _BITS_TIME_H
-#define _BITS_TIME_H	1
+#ifndef __need_timeval
+# ifndef _BITS_TIME_H
+#  define _BITS_TIME_H	1
 
 /* ISO/IEC 9899:1990 7.12.1: <time.h>
    The macro `CLOCKS_PER_SEC' is the number per second of the value
@@ -45,10 +31,23 @@ struct timeval
 /* CAE XSH, Issue 4, Version 2: <time.h>
    The value of CLOCKS_PER_SEC is required to be 1 million on all
    XSI-conformant systems. */
-# define CLOCKS_PER_SEC  1000000
+#  define CLOCKS_PER_SEC  1000000
 
 /* Even though CLOCKS_PER_SEC has such a strange value CLK_TCK
    presents the real value for clock ticks per second for the system.  */
-# define CLK_TCK 1024
+#  define CLK_TCK 1024
 
-#endif	/* bits/time.h */
+# endif	/* bits/time.h */
+#endif /* !__need_timeval */
+
+
+#ifndef _STRUCT_TIMEVAL
+# define _STRUCT_TIMEVAL	1
+/* A time value that is accurate to the nearest
+   microsecond but also has a range of years.  */
+struct timeval
+  {
+    int tv_sec;			/* Seconds.  */
+    int tv_usec;		/* Microseconds.  */
+  };
+#endif	/* struct timeval */
diff --git a/sysdeps/unix/sysv/linux/bits/dirent.h b/sysdeps/unix/sysv/linux/bits/dirent.h
index 1f8ff1e3d0..30e0203289 100644
--- a/sysdeps/unix/sysv/linux/bits/dirent.h
+++ b/sysdeps/unix/sysv/linux/bits/dirent.h
@@ -16,8 +16,9 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-#ifndef _BITS_DIRENT_H
-#define _BITS_DIRENT_H	1
+#ifndef _DIRENT_H
+# error "Never use <bits/dirent.h> directly; include <dirent.h> instead."
+#endif
 
 struct dirent
   {
@@ -50,5 +51,3 @@ struct dirent64
 #define _DIRENT_HAVE_D_RECLEN
 #define _DIRENT_HAVE_D_OFF
 #define _DIRENT_HAVE_D_TYPE
-
-#endif /* bits/dirent.h */
diff --git a/sysdeps/unix/sysv/linux/bits/in.h b/sysdeps/unix/sysv/linux/bits/in.h
index 0dd94bef96..1d3817f68d 100644
--- a/sysdeps/unix/sysv/linux/bits/in.h
+++ b/sysdeps/unix/sysv/linux/bits/in.h
@@ -18,8 +18,9 @@
 
 /* Linux version.  */
 
-#ifndef _NETINET_INBITS_H
-#define _NETINET_INBITS_H 1
+#ifndef _NETINET_IN_H
+# error "Never use <bits/in.h> directly; include <netinet/in.h> instead."
+#endif
 
 /* Options for use with `getsockopt' and `setsockopt' at the IP level.
    The first word in the comment at the right is the data type used;
@@ -71,5 +72,3 @@ struct ip_mreq
 #define IPV6_MULTICAST_LOOP	19
 #define IPV6_ADD_MEMBERSHIP	20
 #define IPV6_DROP_MEMBERSHIP	21
-
-#endif	/* netinet/inbits.h */
diff --git a/sysdeps/unix/sysv/linux/bits/ioctl-types.h b/sysdeps/unix/sysv/linux/bits/ioctl-types.h
index af988a3c9d..4413dacdb4 100644
--- a/sysdeps/unix/sysv/linux/bits/ioctl-types.h
+++ b/sysdeps/unix/sysv/linux/bits/ioctl-types.h
@@ -17,12 +17,9 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-/*
- * Never include this file directly; use <sys/ioctl.h> instead.
- */
-
-#ifndef _BITS_IOCTL_TYPES_H
-#define _BITS_IOCTL_TYPES_H 1
+#ifndef _SYS_IOCTL_H
+# error "Never use <bits/ioctl-types.h> directly; include <sys/ioctl.h> instead."
+#endif
 
 /* Get definition of constants for use with `ioctl'.  */
 #include <asm/ioctls.h>
@@ -69,6 +66,3 @@ struct termio
 #define N_PPP		3
 #define N_STRIP		4
 #define N_AX25		5
-
-
-#endif /* bits/ioctl-types.h */
diff --git a/sysdeps/unix/sysv/linux/bits/ioctls.h b/sysdeps/unix/sysv/linux/bits/ioctls.h
index 265c857f92..a89724cd71 100644
--- a/sysdeps/unix/sysv/linux/bits/ioctls.h
+++ b/sysdeps/unix/sysv/linux/bits/ioctls.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
@@ -16,15 +16,10 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-/*
- * Never include this file directly; use <sys/ioctl.h> instead.
- */
-
-#ifndef _BITS_IOCTLS_H
-#define _BITS_IOCTLS_H 1
+#ifndef _SYS_IOCTL_H
+# error "Never use <bits/ioctls.h> directly; include <sys/ioctl.h> instead."
+#endif
 
 /* Use the definitions from the kernel header files.  */
 #include <asm/ioctls.h>
 #include <linux/sockios.h>
-
-#endif /* bits/ioctls.h  */
diff --git a/sysdeps/unix/sysv/linux/bits/ipc.h b/sysdeps/unix/sysv/linux/bits/ipc.h
index c01a81a83f..8b5db4add6 100644
--- a/sysdeps/unix/sysv/linux/bits/ipc.h
+++ b/sysdeps/unix/sysv/linux/bits/ipc.h
@@ -1,6 +1,5 @@
 /* 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
@@ -17,10 +16,9 @@
    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>
+#ifndef _SYS_IPC_H
+# error "Never use <bits/ipc.h> directly; include <sys/ipc.h> instead."
+#endif
 
 #include <sys/types.h>
 
@@ -35,9 +33,6 @@
 #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.  */
 
@@ -63,10 +58,15 @@ struct ipc_kludge
     long int msgtyp;
   };
 
+
+__BEGIN_DECLS
+
 /* The actual system call: all functions are multiplexed by this.  */
 extern int __ipc __P ((int __call, int __first, int __second, int __third,
 		       void *__ptr));
 
+__END_DECLS
+
 /* The codes for the functions to use the multiplexer `__ipc'.  */
 #define IPCOP_semop	 1
 #define IPCOP_semget	 2
@@ -79,7 +79,3 @@ extern int __ipc __P ((int __call, int __first, int __second, int __third,
 #define IPCOP_shmdt	22
 #define IPCOP_shmget	23
 #define IPCOP_shmctl	24
-
-__END_DECLS
-
-#endif /* bits/ipc_buf.h */
diff --git a/sysdeps/unix/sysv/linux/bits/msq.h b/sysdeps/unix/sysv/linux/bits/msq.h
index 59559a31c3..9d0b9a9afa 100644
--- a/sysdeps/unix/sysv/linux/bits/msq.h
+++ b/sysdeps/unix/sysv/linux/bits/msq.h
@@ -1,6 +1,5 @@
 /* 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
@@ -17,10 +16,9 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-#ifndef _SYS_MSQ_BUF_H
-
-#define _SYS_MSQ_BUF_H	1
-#include <features.h>
+#ifndef _SYS_MSG_H
+#error "Never use <bits/msq.h> directly; include <sys/msg.h> instead."
+#endif
 
 #include <sys/types.h>
 
@@ -29,8 +27,6 @@
 #define MSG_EXCEPT	020000	/* recv any msg except of specified type */
 
 
-__BEGIN_DECLS
-
 /* Structure of record for one message inside the kernel.
    The type `struct __msg' is opaque.  */
 struct msqid_ds
@@ -60,19 +56,15 @@ struct msqid_ds
 
 /* buffer for msgctl calls IPC_INFO, MSG_INFO */
 struct msginfo
-{
-  int msgpool;
-  int msgmap;
-  int msgmax;
-  int msgmnb;
-  int msgmni;
-  int msgssz;
-  int msgtql;
-  ushort  msgseg;
-};
+  {
+    int msgpool;
+    int msgmap;
+    int msgmax;
+    int msgmnb;
+    int msgmni;
+    int msgssz;
+    int msgtql;
+    ushort  msgseg;
+  };
 
 #endif /* __USE_MISC */
-
-__END_DECLS
-
-#endif /* bits/msq_buf.h */
diff --git a/sysdeps/unix/sysv/linux/bits/poll.h b/sysdeps/unix/sysv/linux/bits/poll.h
index c6b1d2324a..4aec021fed 100644
--- a/sysdeps/unix/sysv/linux/bits/poll.h
+++ b/sysdeps/unix/sysv/linux/bits/poll.h
@@ -16,6 +16,9 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
+#ifndef _SYS_POLL_H
+# error "Never use <bits/poll.h> directly; include <sys/poll.h> instead."
+#endif
 
 /* Event types that can be polled for.  These bits may be set in `events'
    to indicate the interesting event types; they will appear in `revents'
diff --git a/sysdeps/unix/sysv/linux/bits/resource.h b/sysdeps/unix/sysv/linux/bits/resource.h
index 9ee6ea5b27..f825cba929 100644
--- a/sysdeps/unix/sysv/linux/bits/resource.h
+++ b/sysdeps/unix/sysv/linux/bits/resource.h
@@ -17,6 +17,10 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
+#ifndef _SYS_RESOURCE_H
+# error "Never use <bits/resource.h> directly; include <sys/resource.h> instead."
+#endif
+
 #include <asm/resource.h>
 #include <bits/types.h>
 
@@ -148,7 +152,8 @@ enum __rusage_who
 #define RUSAGE_BOTH RUSAGE_BOTH
 };
 
-#include <sys/time.h>		/* For `struct timeval'.  */
+#define __need_timeval
+#include <bits/time.h>		/* For `struct timeval'.  */
 
 /* Structure which says how much of each resource has been used.  */
 struct rusage
diff --git a/sysdeps/unix/sysv/linux/bits/sched.h b/sysdeps/unix/sysv/linux/bits/sched.h
index 521bbb7177..0ac5409172 100644
--- a/sysdeps/unix/sysv/linux/bits/sched.h
+++ b/sysdeps/unix/sysv/linux/bits/sched.h
@@ -19,12 +19,10 @@
    Boston, MA 02111-1307, USA.  */
 
 #ifndef _SCHED_H
-#error "Never use <bits/sched.h> directly; include <sched.h> instead."
+# error "Never include <bits/sched.h> directly; use <sched.h> instead."
 #endif
 
 
-#include <features.h>
-
 /* Scheduling algorithms.  */
 #define SCHED_OTHER	0
 #define SCHED_FIFO	1
@@ -36,15 +34,19 @@ struct sched_param
     int sched_priority;
   };
 
+#ifdef __USE_MISC
 /* Cloning flags.  */
-#define	CSIGNAL	      0x000000ff  /* Signal mask to be sent at exit.  */
-#define	CLONE_VM      0x00000100  /* Set if VM shared between processes.  */
-#define	CLONE_FS      0x00000200  /* Set if fs info shared between processes.*/
-#define CLONE_FILES   0x00000400  /* Set if open files shared between processes*/
-#define CLONE_SIGHAND 0x00000800  /* Set if signal handlers shared.  */
-#define CLONE_PID     0x00001000  /* Set if pid shared.  */
+# define CSIGNAL       0x000000ff /* Signal mask to be sent at exit.  */
+# define CLONE_VM      0x00000100 /* Set if VM shared between processes.  */
+# define CLONE_FS      0x00000200 /* Set if fs info shared between processes.*/
+# define CLONE_FILES   0x00000400 /* Set if open files shared between processes*/
+# define CLONE_SIGHAND 0x00000800 /* Set if signal handlers shared.  */
+# define CLONE_PID     0x00001000 /* Set if pid shared.  */
+#endif
 
 
+__BEGIN_DECLS
+
 /* Clone current process.  */
 extern int __clone __P ((int (*__fn) (void *__arg), void *__child_stack,
 			 int __flags, void *__arg));
@@ -52,3 +54,5 @@ extern int __clone __P ((int (*__fn) (void *__arg), void *__child_stack,
 extern int clone __P ((int (*__fn) (void *__arg), void *__child_stack,
 		       int __flags, void *__arg));
 #endif
+
+__END_DECLS
diff --git a/sysdeps/unix/sysv/linux/bits/sem.h b/sysdeps/unix/sysv/linux/bits/sem.h
index 87951efea1..f3bbd89a12 100644
--- a/sysdeps/unix/sysv/linux/bits/sem.h
+++ b/sysdeps/unix/sysv/linux/bits/sem.h
@@ -1,6 +1,5 @@
 /* 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
@@ -17,10 +16,9 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-#ifndef _SYS_SEM_BUF_H
-
-#define _SYS_SEM_BUF_H	1
-#include <features.h>
+#ifndef _SYS_SEM_H
+# error "Never include <bits/sem.h> directly; use <sys/sem.h> instead."
+#endif
 
 #include <sys/types.h>
 
@@ -37,8 +35,6 @@
 #define SETALL		17		/* set all semval's */
 
 
-__BEGIN_DECLS
-
 /* Data structure describing a set of semaphores.  */
 struct semid_ds
 {
@@ -64,8 +60,8 @@ union semun
 #ifdef __USE_MISC
 
 /* ipcs ctl cmds */
-#define SEM_STAT 18
-#define SEM_INFO 19
+# define SEM_STAT 18
+# define SEM_INFO 19
 
 struct  seminfo
 {
@@ -82,7 +78,3 @@ struct  seminfo
 };
 
 #endif /* __USE_MISC */
-
-__END_DECLS
-
-#endif /* bits/sem_buf.h */
diff --git a/sysdeps/unix/sysv/linux/bits/shm.h b/sysdeps/unix/sysv/linux/bits/shm.h
index 6db01dd4a2..6f5f840909 100644
--- a/sysdeps/unix/sysv/linux/bits/shm.h
+++ b/sysdeps/unix/sysv/linux/bits/shm.h
@@ -1,6 +1,5 @@
 /* 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
@@ -17,10 +16,9 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-#ifndef _SYS_SHM_BUF_H
-
-#define _SYS_SHM_BUF_H	1
-#include <features.h>
+#ifndef _SYS_SHM_H
+# error "Never include <bits/shm.h> directly; use <sys/shm.h> instead."
+#endif
 
 #include <sys/types.h>
 
@@ -38,55 +36,49 @@
 #define SHM_UNLOCK	12		/* unlock segment (root only) */
 
 
-__BEGIN_DECLS
-
 /* Data structure describing a set of semaphores.  */
 struct shmid_ds
-{
-  struct ipc_perm shm_perm;		/* operation permission struct */
-  int shm_segsz;			/* size of segment in bytes */
-  __time_t shm_atime;			/* time of last shmat() */
-  __time_t shm_dtime;			/* time of last shmdt() */
-  __time_t shm_ctime;			/* time of last change by shmctl() */
-  int shm_cpid;				/* pid of creator */
-  int shm_lpid;				/* pid of last shmop */
-  unsigned short int shm_nattch;	/* number of current attaches */
-  unsigned short int __shm_npages;	/* size of segment (pages) */
-  unsigned long int *__shm_pages;	/* array of ptrs to frames -> SHMMAX */
-  struct vm_area_struct *__attaches;	/* descriptors for attaches */
-};
+  {
+    struct ipc_perm shm_perm;		/* operation permission struct */
+    int shm_segsz;			/* size of segment in bytes */
+    __time_t shm_atime;			/* time of last shmat() */
+    __time_t shm_dtime;			/* time of last shmdt() */
+    __time_t shm_ctime;			/* time of last change by shmctl() */
+    int shm_cpid;			/* pid of creator */
+    int shm_lpid;			/* pid of last shmop */
+    unsigned short int shm_nattch;	/* number of current attaches */
+    unsigned short int __shm_npages;	/* size of segment (pages) */
+    unsigned long int *__shm_pages;	/* array of ptrs to frames -> SHMMAX */
+    struct vm_area_struct *__attaches;	/* descriptors for attaches */
+  };
 
 #ifdef __USE_MISC
 
 /* ipcs ctl commands */
-#define SHM_STAT 	13
-#define SHM_INFO 	14
+# define SHM_STAT 	13
+# define SHM_INFO 	14
 
 /* shm_mode upper byte flags */
-#define	SHM_DEST	01000	/* segment will be destroyed on last detach */
-#define SHM_LOCKED      02000   /* segment will not be swapped */
+# define SHM_DEST	01000	/* segment will be destroyed on last detach */
+# define SHM_LOCKED	02000   /* segment will not be swapped */
 
 struct	shminfo
-{
-  int shmmax;
-  int shmmin;
-  int shmmni;
-  int shmseg;
-  int shmall;
-};
+  {
+    int shmmax;
+    int shmmin;
+    int shmmni;
+    int shmseg;
+    int shmall;
+  };
 
 struct shm_info
-{
-  int   used_ids;
-  ulong shm_tot;	/* total allocated shm */
-  ulong shm_rss;	/* total resident shm */
-  ulong shm_swp;	/* total swapped shm */
-  ulong swap_attempts;
-  ulong swap_successes;
-};
+  {
+    int   used_ids;
+    ulong shm_tot;	/* total allocated shm */
+    ulong shm_rss;	/* total resident shm */
+    ulong shm_swp;	/* total swapped shm */
+    ulong swap_attempts;
+    ulong swap_successes;
+  };
 
 #endif /* __USE_MISC */
-
-__END_DECLS
-
-#endif /* bits/shm_buf.h */
diff --git a/sysdeps/unix/sysv/linux/bits/sigaction.h b/sysdeps/unix/sysv/linux/bits/sigaction.h
index 247b53499e..1806bb2e92 100644
--- a/sysdeps/unix/sysv/linux/bits/sigaction.h
+++ b/sysdeps/unix/sysv/linux/bits/sigaction.h
@@ -17,6 +17,10 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
+#ifndef _SIGNAL_H
+# error "Never include <bits/sigaction.h> directly; use <signal.h> instead."
+#endif
+
 /* Structure describing the action to be taken when a signal arrives.  */
 struct sigaction
   {
diff --git a/sysdeps/unix/sysv/linux/bits/sigcontext.h b/sysdeps/unix/sysv/linux/bits/sigcontext.h
index fb8bc5fc57..08960b6824 100644
--- a/sysdeps/unix/sysv/linux/bits/sigcontext.h
+++ b/sysdeps/unix/sysv/linux/bits/sigcontext.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
@@ -17,7 +17,7 @@
    Boston, MA 02111-1307, USA.  */
 
 #ifndef _SIGNAL_H
-#error "Never use <bits/sigcontext.h> directly; include <signal.h> instead."
+# error "Never use <bits/sigcontext.h> directly; include <signal.h> instead."
 #endif
 
 
diff --git a/sysdeps/unix/sysv/linux/bits/socket.h b/sysdeps/unix/sysv/linux/bits/socket.h
index 8f859d2e3e..f48f2d1403 100644
--- a/sysdeps/unix/sysv/linux/bits/socket.h
+++ b/sysdeps/unix/sysv/linux/bits/socket.h
@@ -18,20 +18,15 @@
    Boston, MA 02111-1307, USA.  */
 
 #ifndef _SYS_SOCKET_H
-#error "Never include <bits/socket.h> directly; use <sys/socket.h> instead."
+# error "Never include <bits/socket.h> directly; use <sys/socket.h> instead."
 #endif
 
-
-#include <features.h>
-
 #define	__need_size_t
 #define __need_NULL
 #include <stddef.h>
 
 #include <sys/types.h>
 
-__BEGIN_DECLS
-
 /* Type for length arguments in socket calls.  */
 typedef unsigned int socklen_t;
 
@@ -216,5 +211,3 @@ struct linger
     int l_onoff;		/* Nonzero to linger on close.  */
     int l_linger;		/* Time to linger.  */
   };
-
-__END_DECLS
diff --git a/sysdeps/unix/sysv/linux/bits/stat.h b/sysdeps/unix/sysv/linux/bits/stat.h
index 1b98448ff4..18432fd09e 100644
--- a/sysdeps/unix/sysv/linux/bits/stat.h
+++ b/sysdeps/unix/sysv/linux/bits/stat.h
@@ -16,12 +16,9 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-/*
- * Never include this file directly; use <sys/stat.h> instead.
- */
-
-#ifndef	_BITS_STAT_H
-#define	_BITS_STAT_H	1
+#ifndef _SYS_STAT_H
+# error "Never include <bits/stat.h> directly; use <sys/stat.h> instead."
+#endif
 
 /* Versions of the `struct stat' data structure.  */
 #define _STAT_VER_LINUX_OLD	1
@@ -126,5 +123,3 @@ struct stat64
 #define	__S_IREAD	0400	/* Read by owner.  */
 #define	__S_IWRITE	0200	/* Write by owner.  */
 #define	__S_IEXEC	0100	/* Execute by owner.  */
-
-#endif	/* bits/stat.h */
diff --git a/sysdeps/unix/sysv/linux/bits/statfs.h b/sysdeps/unix/sysv/linux/bits/statfs.h
index c79c80e84c..a56ed79e7c 100644
--- a/sysdeps/unix/sysv/linux/bits/statfs.h
+++ b/sysdeps/unix/sysv/linux/bits/statfs.h
@@ -16,12 +16,9 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-/*
- * Never include this file directly; use <sys/statfs.h> instead.
- */
-
-#ifndef _BITS_STATFS_H
-#define _BITS_STATFS_H
+#ifndef _SYS_STATFS_H
+# error "Never include <bits/statfs.h> directly; use <sys/statfs.h> instead."
+#endif
 
 #include <bits/types.h>  /* for __fsid_t and __fsblkcnt_t*/
 
@@ -62,5 +59,3 @@ struct statfs64
     int f_spare[6];
   };
 #endif
-
-#endif	/* bits/statfs.h */
diff --git a/sysdeps/unix/sysv/linux/bits/termios.h b/sysdeps/unix/sysv/linux/bits/termios.h
index dd42012374..926c3f32f4 100644
--- a/sysdeps/unix/sysv/linux/bits/termios.h
+++ b/sysdeps/unix/sysv/linux/bits/termios.h
@@ -17,13 +17,9 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-/*
- * Never include this file directly; use <termios.h> instead.
- */
-
-
-#ifndef _BITS_TERMIOS_H
-#define _BITS_TERMIOS_H	1
+#ifndef _TERMIOS_H
+# error "Never include <bits/termios.h> directly; use <termios.h> instead."
+#endif
 
 typedef unsigned char	cc_t;
 typedef unsigned int	speed_t;
@@ -185,5 +181,3 @@ struct termios
 
 #define _IOT_termios /* Hurd ioctl type field.  */ \
   _IOT (_IOTS (cflag_t), 4, _IOTS (cc_t), NCCS, _IOTS (speed_t), 2)
-
-#endif /* bits/termios.h */
diff --git a/sysdeps/unix/sysv/linux/bits/time.h b/sysdeps/unix/sysv/linux/bits/time.h
index 509cb2ce32..3c1b27a1bb 100644
--- a/sysdeps/unix/sysv/linux/bits/time.h
+++ b/sysdeps/unix/sysv/linux/bits/time.h
@@ -21,23 +21,9 @@
  * Never include this file directly; use <time.h> instead.
  */
 
-#ifdef __need_timeval
-# undef __need_timeval
-# ifndef _STRUCT_TIMEVAL
-#  define _STRUCT_TIMEVAL	1
-/* A time value that is accurate to the nearest
-   microsecond but also has a range of years.  */
-struct timeval
-  {
-    time_t tv_sec;		/* Seconds.  */
-    time_t tv_usec;		/* Microseconds.  */
-  };
-# endif	/* struct timeval */
-#endif	/* need timeval */
-
-
-#ifndef _BITS_TIME_H
-#define _BITS_TIME_H	1
+#ifndef __need_timeval
+# ifndef _BITS_TIME_H
+#  define _BITS_TIME_H	1
 
 /* ISO/IEC 9899:1990 7.12.1: <time.h>
    The macro `CLOCKS_PER_SEC' is the number per second of the value
@@ -45,12 +31,26 @@ struct timeval
 /* CAE XSH, Issue 4, Version 2: <time.h>
    The value of CLOCKS_PER_SEC is required to be 1 million on all
    XSI-conformant systems. */
-# define CLOCKS_PER_SEC  1000000
+#  define CLOCKS_PER_SEC  1000000
 
-# ifndef __STRICT_ANSI__
+#  ifndef __STRICT_ANSI__
 /* Even though CLOCKS_PER_SEC has such a strange value CLK_TCK
    presents the real value for clock ticks per second for the system.  */
-#  define CLK_TCK 100
-# endif
+#   define CLK_TCK 100
+#  endif
 
-#endif	/* bits/time.h */
+# endif	/* bits/time.h */
+#endif
+
+#ifndef _STRUCT_TIMEVAL
+# define _STRUCT_TIMEVAL	1
+# include <bits/types.h>
+
+/* A time value that is accurate to the nearest
+   microsecond but also has a range of years.  */
+struct timeval
+  {
+    __time_t tv_sec;		/* Seconds.  */
+    __time_t tv_usec;		/* Microseconds.  */
+  };
+#endif	/* struct timeval */
diff --git a/sysdeps/unix/sysv/linux/bits/uio.h b/sysdeps/unix/sysv/linux/bits/uio.h
index 3f1dc01c73..38ac17baa9 100644
--- a/sysdeps/unix/sysv/linux/bits/uio.h
+++ b/sysdeps/unix/sysv/linux/bits/uio.h
@@ -17,7 +17,7 @@
    Boston, MA 02111-1307, USA.  */
 
 #ifndef _SYS_UIO_H
-#error "Never use <bits/uio.h> directly; include <sys/uio.h> instead."
+# error "Never include <bits/uio.h> directly; use <sys/uio.h> instead."
 #endif
 
 
diff --git a/sysdeps/unix/sysv/linux/bits/utsname.h b/sysdeps/unix/sysv/linux/bits/utsname.h
index 64e2ab5bbc..8f4bf16f5a 100644
--- a/sysdeps/unix/sysv/linux/bits/utsname.h
+++ b/sysdeps/unix/sysv/linux/bits/utsname.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.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -16,6 +16,10 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
+#ifndef _SYS_UTSNAME_H
+# error "Never include <bits/utsname.h> directly; use <sys/utsname.h> instead."
+#endif
+
 /* Length of the entries in `struct utsname' is 65.  */
 #define _UTSNAME_LENGTH 65
 
diff --git a/sysdeps/unix/sysv/linux/bits/waitflags.h b/sysdeps/unix/sysv/linux/bits/waitflags.h
index ba3528b709..e5945051ed 100644
--- a/sysdeps/unix/sysv/linux/bits/waitflags.h
+++ b/sysdeps/unix/sysv/linux/bits/waitflags.h
@@ -18,7 +18,7 @@
    Boston, MA 02111-1307, USA.  */
 
 #ifndef _SYS_WAIT_H
-#error "Never use <bits/waitflags.h> directly; include <sys/wait.h> instead."
+# error "Never include <bits/waitflags.h> directly; use <sys/wait.h> instead."
 #endif
 
 
diff --git a/sysdeps/unix/sysv/linux/i386/bits/mman.h b/sysdeps/unix/sysv/linux/i386/bits/mman.h
index e70b220f9f..8738e98c30 100644
--- a/sysdeps/unix/sysv/linux/i386/bits/mman.h
+++ b/sysdeps/unix/sysv/linux/i386/bits/mman.h
@@ -1,4 +1,4 @@
-/* Definitions for POSIX memory map inerface.  Linux/i386 version.
+/* Definitions for POSIX memory map interface.  Linux/i386 version.
    Copyright (C) 1997 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
@@ -18,7 +18,7 @@
    Boston, MA 02111-1307, USA.  */
 
 #ifndef _SYS_MMAN_H
-# error "Never include this file directly.  Use <sys/mman.h> instead"
+# error "Never use <bits/mman.h> directly; include <sys/mman.h> instead."
 #endif
 
 /* The following definitions basically come from the kernel headers.
diff --git a/sysdeps/unix/sysv/linux/kernel_termios.h b/sysdeps/unix/sysv/linux/kernel_termios.h
index 78c6f4aa2f..09504cc97e 100644
--- a/sysdeps/unix/sysv/linux/kernel_termios.h
+++ b/sysdeps/unix/sysv/linux/kernel_termios.h
@@ -20,9 +20,6 @@
 #define _KERNEL_TERMIOS_H 1
 /* The following corresponds to the values from the Linux 2.1.20 kernel.  */
 
-/* We need the definition of tcflag_t, cc_t, and speed_t.  */
-#include <bits/termios.h>
-
 #define __KERNEL_NCCS 19
 
 struct __kernel_termios
diff --git a/sysdeps/unix/sysv/linux/m68k/bits/mman.h b/sysdeps/unix/sysv/linux/m68k/bits/mman.h
index d6c29d2176..bca1dae960 100644
--- a/sysdeps/unix/sysv/linux/m68k/bits/mman.h
+++ b/sysdeps/unix/sysv/linux/m68k/bits/mman.h
@@ -1,4 +1,4 @@
-/* Definitions for POSIX memory map inerface.  Linux/m68k version.
+/* Definitions for POSIX memory map interface.  Linux/m68k version.
    Copyright (C) 1997 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
@@ -18,7 +18,7 @@
    Boston, MA 02111-1307, USA.  */
 
 #ifndef _SYS_MMAN_H
-# error "Never include this file directly.  Use <sys/mman.h> instead"
+# error "Never use <bits/mman.h> directly; include <sys/mman.h> instead."
 #endif
 
 /* The following definitions basically come from the kernel headers.
diff --git a/sysdeps/unix/sysv/linux/m68k/bits/poll.h b/sysdeps/unix/sysv/linux/m68k/bits/poll.h
index 8fea43924a..2d4e6f6f01 100644
--- a/sysdeps/unix/sysv/linux/m68k/bits/poll.h
+++ b/sysdeps/unix/sysv/linux/m68k/bits/poll.h
@@ -16,6 +16,9 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
+#ifndef _SYS_POLL_H
+# error "Never use <bits/poll.h> directly; include <sys/poll.h> instead."
+#endif
 
 /* Event types that can be polled for.  These bits may be set in `events'
    to indicate the interesting event types; they will appear in `revents'
diff --git a/sysdeps/unix/sysv/linux/mips/bits/endian.h b/sysdeps/unix/sysv/linux/mips/bits/endian.h
index 9f60758f36..0a3d2fabe3 100644
--- a/sysdeps/unix/sysv/linux/mips/bits/endian.h
+++ b/sysdeps/unix/sysv/linux/mips/bits/endian.h
@@ -3,10 +3,14 @@
    want to be able to share the installed headerfiles between both,
    so we define __BYTE_ORDER based on GCC's predefines.  */
 
+#ifndef _ENDIAN_H
+# error "Never use <bits/endian.h> directly; include <endian.h> instead."
+#endif
+
 #ifdef __MIPSEB__
-#define __BYTE_ORDER __BIG_ENDIAN
+# define __BYTE_ORDER __BIG_ENDIAN
 #else
-#ifdef __MIPSEL__
-#define __BYTE_ORDER __LITTLE_ENDIAN
-#endif
+# ifdef __MIPSEL__
+#  define __BYTE_ORDER __LITTLE_ENDIAN
+# endif
 #endif
diff --git a/sysdeps/unix/sysv/linux/mips/bits/ioctl-types.h b/sysdeps/unix/sysv/linux/mips/bits/ioctl-types.h
index 486022e6d9..4f5c2b0d3e 100644
--- a/sysdeps/unix/sysv/linux/mips/bits/ioctl-types.h
+++ b/sysdeps/unix/sysv/linux/mips/bits/ioctl-types.h
@@ -17,12 +17,9 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-/*
- * Never include this file directly; use <sys/ioctl.h> instead.
- */
-
-#ifndef _BITS_IOCTL_TYPES_H
-#define _BITS_IOCTL_TYPES_H 1
+#ifndef _SYS_IOCTL_H
+# error "Never use <bits/ioctl-types.h> directly; include <sys/ioctl.h> instead."
+#endif
 
 /* Get definition of constants for use with `ioctl'.  */
 #include <asm/ioctls.h>
@@ -67,5 +64,3 @@ struct termio
 #define N_PPP		3
 #define N_STRIP		4
 #define N_AX25		5
-
-#endif /* bits/ioctl-types.h */
diff --git a/sysdeps/unix/sysv/linux/mips/bits/ipc.h b/sysdeps/unix/sysv/linux/mips/bits/ipc.h
index c5a3cd0049..2841e6a5e2 100644
--- a/sysdeps/unix/sysv/linux/mips/bits/ipc.h
+++ b/sysdeps/unix/sysv/linux/mips/bits/ipc.h
@@ -1,6 +1,5 @@
 /* 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
@@ -17,10 +16,9 @@
    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>
+#ifndef _SYS_IPC_H
+# error "Never use <bits/ipc.h> directly; include <sys/ipc.h> instead."
+#endif
 
 #include <sys/types.h>
 
@@ -36,8 +34,6 @@
 #define IPC_INFO	3		/* See ipcs.  */
 
 
-__BEGIN_DECLS
-
 /* Special key values.  */
 #define IPC_PRIVATE	((__key_t) 0)	/* Private key.  */
 
@@ -46,11 +42,11 @@ __BEGIN_DECLS
 struct ipc_perm
   {
     __key_t __key;			/* Key.  */
-    long uid;				/* Owner's user ID.  */
-    long gid;				/* Owner's group ID.  */
-    long cuid;				/* Creator's user ID.  */
-    long cgid;				/* Creator's group ID.  */
-    unsigned long mode;			/* Read/write permission.  */
+    long int uid;			/* Owner's user ID.  */
+    long int gid;			/* Owner's group ID.  */
+    long int cuid;			/* Creator's user ID.  */
+    long int cgid;			/* Creator's group ID.  */
+    unsigned long int mode;		/* Read/write permission.  */
     unsigned short int __seq;		/* Sequence number.  */
   };
 
@@ -63,10 +59,14 @@ struct ipc_kludge
     long int msgtyp;
   };
 
+__BEGIN_DECLS
+
 /* The actual system call: all functions are multiplexed by this.  */
 extern int __ipc __P ((int __call, int __first, int __second, int __third,
 		       void *__ptr));
 
+__END_DECLS
+
 /* The codes for the functions to use the multiplexer `__ipc'.  */
 #define IPCOP_semop	 1
 #define IPCOP_semget	 2
@@ -79,7 +79,3 @@ extern int __ipc __P ((int __call, int __first, int __second, int __third,
 #define IPCOP_shmdt	22
 #define IPCOP_shmget	23
 #define IPCOP_shmctl	24
-
-__END_DECLS
-
-#endif /* bits/ipc_buf.h */
diff --git a/sysdeps/unix/sysv/linux/mips/bits/mman.h b/sysdeps/unix/sysv/linux/mips/bits/mman.h
index 15a343ff76..be460ab6c6 100644
--- a/sysdeps/unix/sysv/linux/mips/bits/mman.h
+++ b/sysdeps/unix/sysv/linux/mips/bits/mman.h
@@ -1,4 +1,4 @@
-/* Definitions for POSIX memory map inerface.  Linux/PowerPC version.
+/* Definitions for POSIX memory map interface.  Linux/PowerPC version.
    Copyright (C) 1997 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
@@ -18,7 +18,7 @@
    Boston, MA 02111-1307, USA.  */
 
 #ifndef _SYS_MMAN_H
-# error "Never include this file directly.  Use <sys/mman.h> instead"
+# error "Never use <bits/mman.h> directly; include <sys/mman.h> instead."
 #endif
 
 /* The following definitions basically come from the kernel headers.
diff --git a/sysdeps/unix/sysv/linux/mips/bits/poll.h b/sysdeps/unix/sysv/linux/mips/bits/poll.h
index c1c9a6b392..9b7826af6c 100644
--- a/sysdeps/unix/sysv/linux/mips/bits/poll.h
+++ b/sysdeps/unix/sysv/linux/mips/bits/poll.h
@@ -16,6 +16,9 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
+#ifndef _SYS_POLL_H
+# error "Never use <bits/poll.h> directly; include <sys/poll.h> instead."
+#endif
 
 /* Event types that can be polled for.  These bits may be set in `events'
    to indicate the interesting event types; they will appear in `revents'
diff --git a/sysdeps/unix/sysv/linux/mips/bits/shm.h b/sysdeps/unix/sysv/linux/mips/bits/shm.h
index 9d4b20bb53..20e75e009b 100644
--- a/sysdeps/unix/sysv/linux/mips/bits/shm.h
+++ b/sysdeps/unix/sysv/linux/mips/bits/shm.h
@@ -1,6 +1,5 @@
 /* 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
@@ -17,10 +16,9 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-#ifndef _SYS_SHM_BUF_H
-
-#define _SYS_SHM_BUF_H	1
-#include <features.h>
+#ifndef _SYS_SHM_H
+# error "Never include <bits/shm.h> directly; use <sys/shm.h> instead."
+#endif
 
 #include <sys/types.h>
 
@@ -38,55 +36,49 @@
 #define SHM_UNLOCK	12		/* unlock segment (root only) */
 
 
-__BEGIN_DECLS
-
 /* Data structure describing a set of semaphores.  */
 struct shmid_ds
-{
-  struct ipc_perm shm_perm;		/* operation permission struct */
-  int shm_segsz;			/* size of segment in bytes */
-  __time_t shm_atime;			/* time of last shmat() */
-  __time_t shm_dtime;			/* time of last shmdt() */
-  __time_t shm_ctime;			/* time of last change by shmctl() */
-  long shm_cpid;			/* pid of creator */
-  long shm_lpid;			/* pid of last shmop */
-  unsigned short int shm_nattch;	/* number of current attaches */
-  unsigned short int __shm_npages;	/* size of segment (pages) */
-  unsigned long int *__shm_pages;	/* array of ptrs to frames -> SHMMAX */
-  struct vm_area_struct *__attaches;	/* descriptors for attaches */
-};
+  {
+    struct ipc_perm shm_perm;		/* operation permission struct */
+    int shm_segsz;			/* size of segment in bytes */
+    __time_t shm_atime;			/* time of last shmat() */
+    __time_t shm_dtime;			/* time of last shmdt() */
+    __time_t shm_ctime;			/* time of last change by shmctl() */
+    long int shm_cpid;			/* pid of creator */
+    long int shm_lpid;			/* pid of last shmop */
+    unsigned short int shm_nattch;	/* number of current attaches */
+    unsigned short int __shm_npages;	/* size of segment (pages) */
+    unsigned long int *__shm_pages;	/* array of ptrs to frames -> SHMMAX */
+    struct vm_area_struct *__attaches;	/* descriptors for attaches */
+  };
 
 #ifdef __USE_MISC
 
 /* ipcs ctl commands */
-#define SHM_STAT 	13
-#define SHM_INFO 	14
+# define SHM_STAT 	13
+# define SHM_INFO 	14
 
 /* shm_mode upper byte flags */
-#define	SHM_DEST	01000	/* segment will be destroyed on last detach */
-#define SHM_LOCKED      02000   /* segment will not be swapped */
+# define SHM_DEST	01000	/* segment will be destroyed on last detach */
+# define SHM_LOCKED	02000   /* segment will not be swapped */
 
 struct	shminfo
-{
-  int shmmax;
-  int shmmin;
-  int shmmni;
-  int shmseg;
-  int shmall;
-};
+  {
+    int shmmax;
+    int shmmin;
+    int shmmni;
+    int shmseg;
+    int shmall;
+  };
 
 struct shm_info
-{
-  int   used_ids;
-  ulong shm_tot;	/* total allocated shm */
-  ulong shm_rss;	/* total resident shm */
-  ulong shm_swp;	/* total swapped shm */
-  ulong swap_attempts;
-  ulong swap_successes;
-};
+  {
+    int   used_ids;
+    ulong shm_tot;	/* total allocated shm */
+    ulong shm_rss;	/* total resident shm */
+    ulong shm_swp;	/* total swapped shm */
+    ulong swap_attempts;
+    ulong swap_successes;
+  };
 
 #endif /* __USE_MISC */
-
-__END_DECLS
-
-#endif /* bits/shm_buf.h */
diff --git a/sysdeps/unix/sysv/linux/mips/bits/sigaction.h b/sysdeps/unix/sysv/linux/mips/bits/sigaction.h
index d6f70f2a2e..71ca8846eb 100644
--- a/sysdeps/unix/sysv/linux/mips/bits/sigaction.h
+++ b/sysdeps/unix/sysv/linux/mips/bits/sigaction.h
@@ -17,6 +17,10 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
+#ifndef _SIGNAL_H
+# error "Never include <bits/sigaction.h> directly; use <signal.h> instead."
+#endif
+
 /* Structure describing the action to be taken when a signal arrives.  */
 struct sigaction
   {
@@ -33,7 +37,7 @@ struct sigaction
     /* Restore handler.  */
     void (*sa_restorer) __P ((void));
 
-#if (_MIPS_ISA == _MIPS_ISA_MIPS1) || (_MIPS_ISA == _MIPS_ISA_MIPS2)
+#if _MIPS_ISA == _MIPS_ISA_MIPS1 || _MIPS_ISA == _MIPS_ISA_MIPS2
     int sa_resv[1];
 #endif
   };
diff --git a/sysdeps/unix/sysv/linux/mips/bits/socket.h b/sysdeps/unix/sysv/linux/mips/bits/socket.h
index 02f1d22a6c..f56f6269db 100644
--- a/sysdeps/unix/sysv/linux/mips/bits/socket.h
+++ b/sysdeps/unix/sysv/linux/mips/bits/socket.h
@@ -17,19 +17,14 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-#ifndef _SYS_SOCKET_H
-#error "Never include <bits/socket.h> directly; use <sys/socket.h> instead."
+#ifndef _SYS_STAT_H
+# error "Never include <bits/socket.h> directly; use <sys/socket.h> instead."
 #endif
 
-
-#include <features.h>
-
 #define	__need_size_t
 #define __need_NULL
 #include <stddef.h>
 
-__BEGIN_DECLS
-
 /* Type for length arguments in socket calls.  */
 typedef unsigned int socklen_t;
 
@@ -173,5 +168,3 @@ struct linger
     int l_onoff;		/* Nonzero to linger on close.  */
     int l_linger;		/* Time to linger.  */
   };
-
-__END_DECLS
diff --git a/sysdeps/unix/sysv/linux/mips/bits/stat.h b/sysdeps/unix/sysv/linux/mips/bits/stat.h
index f27a75eb9a..cd586d4433 100644
--- a/sysdeps/unix/sysv/linux/mips/bits/stat.h
+++ b/sysdeps/unix/sysv/linux/mips/bits/stat.h
@@ -16,12 +16,9 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-/*
- * Never include this file directly; use <sys/stat.h> instead.
- */
-
-#ifndef _BITS_STAT_H
-#define _BITS_STAT_H	1
+#ifndef _SYS_STAT_H
+# error "Never include <bits/stat.h> directly; use <sys/stat.h> instead."
+#endif
 
 /* Versions of the `struct stat' data structure.  */
 #define _STAT_VER_LINUX_OLD	1
@@ -140,5 +137,3 @@ struct stat64
 #define	__S_IREAD	0400	/* Read by owner.  */
 #define	__S_IWRITE	0200	/* Write by owner.  */
 #define	__S_IEXEC	0100	/* Execute by owner.  */
-
-#endif	/* bits/stat.h */
diff --git a/sysdeps/unix/sysv/linux/mips/bits/statfs.h b/sysdeps/unix/sysv/linux/mips/bits/statfs.h
index 2727b27257..36d9996a69 100644
--- a/sysdeps/unix/sysv/linux/mips/bits/statfs.h
+++ b/sysdeps/unix/sysv/linux/mips/bits/statfs.h
@@ -16,12 +16,9 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-/*
- * Never include this file directly; use <sys/statfs.h> instead.
- */
-
-#ifndef _BITS_STATFS_H
-#define _BITS_STATFS_H
+#ifndef _SYS_STATFS_H
+# error "Never include <bits/statfs.h> directly; use <sys/statfs.h> instead."
+#endif
 
 #include <bits/types.h>  /* for __fsid_t and __fsblkcnt_t*/
 
@@ -70,5 +67,3 @@ struct statfs64
     long int f_spare[6];
   };
 #endif
-
-#endif	/* bits/statfs.h */
diff --git a/sysdeps/unix/sysv/linux/mips/bits/termios.h b/sysdeps/unix/sysv/linux/mips/bits/termios.h
index c8a24694d9..de21ee1775 100644
--- a/sysdeps/unix/sysv/linux/mips/bits/termios.h
+++ b/sysdeps/unix/sysv/linux/mips/bits/termios.h
@@ -17,20 +17,16 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-/*
- * Never include this file directly; use <termios.h> instead.
- */
-
-
-#ifndef _BITS_TERMIOS_H
-#define _BITS_TERMIOS_H 1
+#ifndef _TERMIOS_H
+# error "Never include <bits/termios.h> directly; use <termios.h> instead."
+#endif
 
 typedef unsigned char	cc_t;
 typedef unsigned int	speed_t;
 typedef unsigned int	tcflag_t;
 
 
-#if defined __USE_BSD
+#ifdef __USE_BSD
 
 struct sgttyb
   {
@@ -83,10 +79,10 @@ struct termios
 #define VKILL		 3		/* Kill-line character [ICANON].  */
 #define VMIN		 4		/* Minimum number of bytes read at once [!ICANON].  */
 #define VTIME		 5		/* Time-out value (tenths of a second) [!ICANON].  */
-#if defined (__USE_BSD)
-#define VEOL2		 6		/* Second EOL character [ICANON].  */
+#ifdef __USE_BSD
+# define VEOL2		 6		/* Second EOL character [ICANON].  */
 /* The next two are guesses ... */
-#define VSWTC		 7		/* ??? */
+# define VSWTC		 7		/* ??? */
 #endif
 #define VSWTCH		VSWTC
 #define VSTART		 8		/* Start (X-ON) character [IXON, IXOFF].  */
@@ -96,17 +92,17 @@ struct termios
 /*
  * VDSUSP is not supported
  */
-#if defined (__USE_BSD)
+#if defined __USE_BSD
 #define VDSUSP		11		/* Delayed suspend character [ISIG].  */
 #endif
 #endif
-#if defined (__USE_BSD)
-#define VREPRINT	12		/* Reprint-line character [ICANON].  */
+#ifdef __USE_BSD
+# define VREPRINT	12		/* Reprint-line character [ICANON].  */
 #endif
-#if defined (__USE_BSD)
-#define VDISCARD	13		/* Discard character [IEXTEN].  */
-#define VWERASE		14		/* Word-erase character [ICANON].  */
-#define VLNEXT		15		/* Literal-next character [IEXTEN].  */
+#ifdef __USE_BSD
+# define VDISCARD	13		/* Discard character [IEXTEN].  */
+# define VWERASE	14		/* Word-erase character [ICANON].  */
+# define VLNEXT		15		/* Literal-next character [IEXTEN].  */
 #endif
 #define VEOF		16		/* End-of-file character [ICANON].  */
 #define VEOL		17		/* End-of-line character [ICANON].  */
@@ -121,51 +117,51 @@ struct termios
 #define INLCR	0000100		/* Map NL to CR on input.  */
 #define IGNCR	0000200		/* Ignore CR.  */
 #define ICRNL	0000400		/* Map CR to NL on input.  */
-#if defined (__USE_BSD)
-#define IUCLC	0001000		/* Map upper case to lower case on input.  */
+#ifdef __USE_BSD
+# define IUCLC	0001000		/* Map upper case to lower case on input.  */
 #endif
 #define IXON	0002000		/* Enable start/stop output control.  */
-#if defined (__USE_BSD)
-#define IXANY	0004000		/* Any character will restart after stop.  */
+#ifdef __USE_BSD
+# define IXANY	0004000		/* Any character will restart after stop.  */
 #endif
 #define IXOFF	0010000		/* Enable start/stop input control.  */
-#if defined (__USE_BSD)
-#define IMAXBEL	0020000		/* Ring bell when input queue is full.  */
+#ifdef __USE_BSD
+# define IMAXBEL 0020000	/* Ring bell when input queue is full.  */
 #endif
 
 /* c_oflag bits */
 #define OPOST	0000001		/* Perform output processing.  */
-#if defined (__USE_BSD)
-#define OLCUC	0000002		/* Map lower case to upper case on output.  */
-#define ONLCR	0000004		/* Map NL to CR-NL on output.  */
-#define OCRNL	0000010
-#define ONOCR	0000020
-#define ONLRET	0000040
-#define OFILL	0000100
-#define OFDEL	0000200
-#define NLDLY	0000400
-#define   NL0	0000000
-#define   NL1	0000400
-#define CRDLY	0003000
-#define   CR0	0000000
-#define   CR1	0001000
-#define   CR2	0002000
-#define   CR3	0003000
-#define TABDLY	0014000
-#define   TAB0	0000000
-#define   TAB1	0004000
-#define   TAB2	0010000
-#define   TAB3	0014000
-#define   XTABS	0014000
-#define BSDLY	0020000
-#define   BS0	0000000
-#define   BS1	0020000
-#define VTDLY	0040000
-#define   VT0	0000000
-#define   VT1	0040000
-#define FFDLY	0100000
-#define   FF0	0000000
-#define   FF1	0100000
+#ifdef __USE_BSD
+# define OLCUC	0000002		/* Map lower case to upper case on output.  */
+# define ONLCR	0000004		/* Map NL to CR-NL on output.  */
+# define OCRNL	0000010
+# define ONOCR	0000020
+# define ONLRET	0000040
+# define OFILL	0000100
+# define OFDEL	0000200
+# define NLDLY	0000400
+# define   NL0	0000000
+# define   NL1	0000400
+# define CRDLY	0003000
+# define   CR0	0000000
+# define   CR1	0001000
+# define   CR2	0002000
+# define   CR3	0003000
+# define TABDLY	0014000
+# define   TAB0	0000000
+# define   TAB1	0004000
+# define   TAB2	0010000
+# define   TAB3	0014000
+# define  XTABS	0014000
+# define BSDLY	0020000
+# define   BS0	0000000
+# define   BS1	0020000
+# define VTDLY	0040000
+# define   VT0	0000000
+# define   VT1	0040000
+# define FFDLY	0100000
+# define   FF0	0000000
+# define   FF1	0100000
 /*
 #define PAGEOUT ???
 #define WRAP    ???
@@ -203,14 +199,14 @@ struct termios
 #define PARODD	0001000		/* Odd parity instead of even.  */
 #define HUPCL	0002000		/* Hang up on last close.  */
 #define CLOCAL	0004000		/* Ignore modem status lines.  */
-#if defined (__USE_BSD)
-#define CBAUDEX 0010000
-#define  B57600  0010001
-#define  B115200 0010002
-#define  B230400 0010003
-#define  B460800 0010004
-#define CIBAUD	  002003600000	/* input baud rate (not used) */
-#define CRTSCTS	  020000000000		/* flow control */
+#ifdef __USE_BSD
+# define CBAUDEX  0010000
+# define  B57600  0010001
+# define  B115200 0010002
+# define  B230400 0010003
+# define  B460800 0010004
+# define CIBAUD	  002003600000	/* input baud rate (not used) */
+# define CRTSCTS  020000000000		/* flow control */
 #endif
 
 /* c_lflag bits */
@@ -223,14 +219,14 @@ struct termios
 #define ECHONL	0000100		/* Echo NL even if ECHO is off.  */
 #define NOFLSH	0000200		/* Disable flush after interrupt.  */
 #define IEXTEN	0000400		/* Enable DISCARD and LNEXT.  */
-#if defined (__USE_BSD)
-#define ECHOCTL	0001000		/* Echo control characters as ^X.  */
-#define ECHOPRT	0002000		/* Hardcopy visual erase.  */
-#define ECHOKE	0004000		/* Visual erase for KILL.  */
+#ifdef __USE_BSD
+# define ECHOCTL 0001000	/* Echo control characters as ^X.  */
+# define ECHOPRT 0002000	/* Hardcopy visual erase.  */
+# define ECHOKE	 0004000	/* Visual erase for KILL.  */
 #endif
 #define FLUSHO	0020000
-#if defined (__USE_BSD)
-#define PENDIN	0040000		/* Retype pending input (state).  */
+#ifdef __USE_BSD
+# define PENDIN	0040000		/* Retype pending input (state).  */
 #endif
 #define TOSTOP	0100000		/* Send SIGTTOU for background output.  */
 #define ITOSTOP	TOSTOP
@@ -256,5 +252,3 @@ struct termios
 
 #define _IOT_termios /* Hurd ioctl type field.  */ \
   _IOT (_IOTS (cflag_t), 4, _IOTS (cc_t), NCCS, _IOTS (speed_t), 2)
-
-#endif /* bits/termios.h */
diff --git a/sysdeps/unix/sysv/linux/mips/bits/time.h b/sysdeps/unix/sysv/linux/mips/bits/time.h
index 5fcef0fb8c..a7b268d0f8 100644
--- a/sysdeps/unix/sysv/linux/mips/bits/time.h
+++ b/sysdeps/unix/sysv/linux/mips/bits/time.h
@@ -21,23 +21,9 @@
  * Never include this file directly; use <time.h> instead.
  */
 
-#ifdef __need_timeval
-# undef __need_timeval
-# ifndef _STRUCT_TIMEVAL
-#  define _STRUCT_TIMEVAL	1
-/* A time value that is accurate to the nearest
-   microsecond but also has a range of years.  */
-struct timeval
-  {
-    long tv_sec;			/* Seconds.  */
-    long tv_usec;		/* Microseconds.  */
-  };
-# endif	/* struct timeval */
-#endif	/* need timeval */
-
-
-#ifndef _BITS_TIME_H
-#define _BITS_TIME_H	1
+#ifndef __need_timeval
+# ifndef _BITS_TIME_H
+#  define _BITS_TIME_H	1
 
 /* ISO/IEC 9899:1990 7.12.1: <time.h>
    The macro `CLOCKS_PER_SEC' is the number per second of the value
@@ -45,10 +31,22 @@ struct timeval
 /* CAE XSH, Issue 4, Version 2: <time.h>
    The value of CLOCKS_PER_SEC is required to be 1 million on all
    XSI-conformant systems. */
-# define CLOCKS_PER_SEC  1000000
+#  define CLOCKS_PER_SEC  1000000
 
 /* Even though CLOCKS_PER_SEC has such a strange value CLK_TCK
    presents the real value for clock ticks per second for the system.  */
-# define CLK_TCK 100		/* XXX not correct for all systems.  */
+#  define CLK_TCK 100		/* XXX not correct for all systems.  */
 
-#endif  /* bits/time.h */
+# endif  /* bits/time.h */
+#endif
+
+#ifndef _STRUCT_TIMEVAL
+# define _STRUCT_TIMEVAL	1
+/* A time value that is accurate to the nearest
+   microsecond but also has a range of years.  */
+struct timeval
+  {
+    long int tv_sec;		/* Seconds.  */
+    long int tv_usec;		/* Microseconds.  */
+  };
+#endif	/* struct timeval */
diff --git a/sysdeps/unix/sysv/linux/powerpc/bits/ioctl-types.h b/sysdeps/unix/sysv/linux/powerpc/bits/ioctl-types.h
index 9e2695652e..87b8265afd 100644
--- a/sysdeps/unix/sysv/linux/powerpc/bits/ioctl-types.h
+++ b/sysdeps/unix/sysv/linux/powerpc/bits/ioctl-types.h
@@ -1 +1,5 @@
+#ifndef _SYS_IOCTL_H
+# error "Never use <bits/ioctl-types.h> directly; include <sys/ioctl.h> instead."
+#endif
+
 #include <termios.h>
diff --git a/sysdeps/unix/sysv/linux/powerpc/bits/mman.h b/sysdeps/unix/sysv/linux/powerpc/bits/mman.h
index 6d240c4b7a..d863f0955b 100644
--- a/sysdeps/unix/sysv/linux/powerpc/bits/mman.h
+++ b/sysdeps/unix/sysv/linux/powerpc/bits/mman.h
@@ -1,4 +1,4 @@
-/* Definitions for POSIX memory map inerface.  Linux/PowerPC version.
+/* Definitions for POSIX memory map interface.  Linux/PowerPC version.
    Copyright (C) 1997 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
@@ -18,7 +18,7 @@
    Boston, MA 02111-1307, USA.  */
 
 #ifndef _SYS_MMAN_H
-# error "Never include this file directly.  Use <sys/mman.h> instead"
+# error "Never use <bits/mman.h> directly; iclude <sys/mman.h> instead."
 #endif
 
 /* The following definitions basically come from the kernel headers.
diff --git a/sysdeps/unix/sysv/linux/powerpc/bits/termios.h b/sysdeps/unix/sysv/linux/powerpc/bits/termios.h
index 4c6073bfc2..d1a40be33c 100644
--- a/sysdeps/unix/sysv/linux/powerpc/bits/termios.h
+++ b/sysdeps/unix/sysv/linux/powerpc/bits/termios.h
@@ -16,8 +16,9 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-#ifndef _TERMBITS_H
-#define _TERMBITS_H	1
+#ifndef _TERMIOS_H
+# error "Never include <bits/termios.h> directly; use <termios.h> instead."
+#endif
 
 typedef unsigned char	cc_t;
 typedef unsigned int	speed_t;
@@ -73,7 +74,7 @@ struct termios {
 #define ICRNL	0000400
 #define IXON	0001000
 #define IXOFF	0002000
-#if !defined(KERNEL) || defined(__USE_BSD)
+#if !defined KERNEL || defined __USE_BSD
   /* POSIX.1 doesn't want these... */
 # define IXANY		0004000
 # define IUCLC		0010000
@@ -276,5 +277,3 @@ struct termio {
 #define N_SLIP		1
 #define N_MOUSE		2
 #define N_PPP		3
-
-#endif /* _TERMBITS_H */
diff --git a/sysdeps/unix/sysv/linux/sparc/bits/ioctls.h b/sysdeps/unix/sysv/linux/sparc/bits/ioctls.h
index b33493ee46..1a8d5f6f81 100644
--- a/sysdeps/unix/sysv/linux/sparc/bits/ioctls.h
+++ b/sysdeps/unix/sysv/linux/sparc/bits/ioctls.h
@@ -16,12 +16,9 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-/*
- * Never include this file directly; use <sys/ioctl.h> instead.
- */
-
-#ifndef _BITS_IOCTLS_H
-#define _BITS_IOCTLS_H 1
+#ifndef _SYS_IOCTL_H
+# error "Never use <bits/ioctls.h> directly; include <sys/ioctl.h> instead."
+#endif
 
 /* Use the definitions from the kernel header files.  */
 #include <asm/ioctls.h>
@@ -39,5 +36,3 @@
 #define TCSETSF	_IOW ('T', 11, char[36])
 
 #include <linux/sockios.h>
-
-#endif /* bits/ioctls.h  */
diff --git a/sysdeps/unix/sysv/linux/sparc/bits/poll.h b/sysdeps/unix/sysv/linux/sparc/bits/poll.h
index 8fea43924a..2d4e6f6f01 100644
--- a/sysdeps/unix/sysv/linux/sparc/bits/poll.h
+++ b/sysdeps/unix/sysv/linux/sparc/bits/poll.h
@@ -16,6 +16,9 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
+#ifndef _SYS_POLL_H
+# error "Never use <bits/poll.h> directly; include <sys/poll.h> instead."
+#endif
 
 /* Event types that can be polled for.  These bits may be set in `events'
    to indicate the interesting event types; they will appear in `revents'
diff --git a/sysdeps/unix/sysv/linux/sparc/bits/sigaction.h b/sysdeps/unix/sysv/linux/sparc/bits/sigaction.h
index 13471995b9..1858ef4857 100644
--- a/sysdeps/unix/sysv/linux/sparc/bits/sigaction.h
+++ b/sysdeps/unix/sysv/linux/sparc/bits/sigaction.h
@@ -17,6 +17,10 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
+#ifndef _SIGNAL_H
+# error "Never include <bits/sigaction.h> directly; use <signal.h> instead."
+#endif
+
 /* Structure describing the action to be taken when a signal arrives.  */
 struct sigaction
   {
@@ -30,7 +34,7 @@ struct sigaction
     unsigned long sa_flags;
 
     /* Not used by Linux/Sparc yet.  */
-    void (*sa_restorer)(void);
+    void (*sa_restorer) __P ((void));
   };
 
 
diff --git a/sysdeps/unix/sysv/linux/sparc/bits/termios.h b/sysdeps/unix/sysv/linux/sparc/bits/termios.h
index 54ac773b70..7047e47a02 100644
--- a/sysdeps/unix/sysv/linux/sparc/bits/termios.h
+++ b/sysdeps/unix/sysv/linux/sparc/bits/termios.h
@@ -17,8 +17,9 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-#ifndef _SPARC_TERMBITS_H
-#define _SPARC_TERMBITS_H	1
+#ifndef _TERMIOS_H
+# error "Never include <bits/termios.h> directly; use <termios.h> instead."
+#endif
 
 typedef unsigned char cc_t;
 typedef unsigned int speed_t;
@@ -34,7 +35,7 @@ struct termios
     cc_t c_line;		/* line discipline */
     cc_t c_cc[NCCS];		/* control characters */
 #ifdef __KERNEL__
-#define SIZEOF_USER_TERMIOS sizeof (struct termios) - (2*sizeof (cc_t))
+# define SIZEOF_USER_TERMIOS sizeof (struct termios) - (2*sizeof (cc_t))
     cc_t _x_cc[2];		/* We need them to hold vmin/vtime */
 #endif
   };
@@ -64,11 +65,11 @@ struct termios
  * shared with eof/eol
  */
 #ifdef __KERNEL__
-#define VMIN     16
-#define VTIME    17
+# define VMIN     16
+# define VTIME    17
 #else
-#define VMIN     VEOF
-#define VTIME    VEOL
+# define VMIN     VEOF
+# define VTIME    VEOL
 #endif
 
 /* c_iflag bits */
@@ -213,5 +214,3 @@ struct termios
 #define	TCSANOW		0
 #define	TCSADRAIN	1
 #define	TCSAFLUSH	2
-
-#endif /* !(_SPARC_TERMBITS_H) */
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/bits/mman.h b/sysdeps/unix/sysv/linux/sparc/sparc32/bits/mman.h
index 3e7f2900fa..bc70a58e24 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc32/bits/mman.h
+++ b/sysdeps/unix/sysv/linux/sparc/sparc32/bits/mman.h
@@ -1,4 +1,4 @@
-/* Definitions for POSIX memory map inerface.  Linux/SPARC version.
+/* Definitions for POSIX memory map interface.  Linux/SPARC version.
    Copyright (C) 1997 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
@@ -18,7 +18,7 @@
    Boston, MA 02111-1307, USA.  */
 
 #ifndef _SYS_MMAN_H
-# error "Never include this file directly.  Use <sys/mman.h> instead"
+# error "Never use <bits/mman.h> directly; include <sys/mman.h> instead."
 #endif
 
 /* The following definitions basically come from the kernel headers.
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/bits/mman.h b/sysdeps/unix/sysv/linux/sparc/sparc64/bits/mman.h
index 3e7f2900fa..bc70a58e24 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc64/bits/mman.h
+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/bits/mman.h
@@ -1,4 +1,4 @@
-/* Definitions for POSIX memory map inerface.  Linux/SPARC version.
+/* Definitions for POSIX memory map interface.  Linux/SPARC version.
    Copyright (C) 1997 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
@@ -18,7 +18,7 @@
    Boston, MA 02111-1307, USA.  */
 
 #ifndef _SYS_MMAN_H
-# error "Never include this file directly.  Use <sys/mman.h> instead"
+# error "Never use <bits/mman.h> directly; include <sys/mman.h> instead."
 #endif
 
 /* The following definitions basically come from the kernel headers.
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/bits/setjmp.h b/sysdeps/unix/sysv/linux/sparc/sparc64/bits/setjmp.h
index ab850e5301..b200b718d2 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc64/bits/setjmp.h
+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/bits/setjmp.h
@@ -16,11 +16,11 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-#ifndef _JMP_BUF_H 
-#define _JMP_BUF_H 1
+
+#ifndef _SETJMP_H
+# error "Never include <bits/setjmp.h> directly; use <setjmp.h> instead."
+#endif
 
 #include <ucontext.h>
 
 typedef ucontext_t __jmp_buf[1];
-
-#endif /* jmp_buf.h */
diff --git a/sysdeps/unix/sysv/linux/stdio_lim.h.in b/sysdeps/unix/sysv/linux/stdio_lim.h.in
index 9d6a957028..7fa98f7733 100644
--- a/sysdeps/unix/sysv/linux/stdio_lim.h.in
+++ b/sysdeps/unix/sysv/linux/stdio_lim.h.in
@@ -1,8 +1,33 @@
+/* Stdio limits for Linux.
+   Copyright (C) 1994, 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 _STDIO_H
+# error "Never include <bits/stdio_lim.h> directly; use <stdio.h> instead."
+#endif
+
 #define L_tmpnam 19
 #define TMP_MAX 238328
+
 #ifdef __USE_POSIX
-#define L_ctermid 9
-#define L_cuserid 9
+# define L_ctermid 9
+# define L_cuserid 9
 #endif
-#define FOPEN_MAX DEFAULT_FOPEN_MAX
-#define FILENAME_MAX DEFAULT_FILENAME_MAX
+
+#define FOPEN_MAX	DEFAULT_FOPEN_MAX
+#define FILENAME_MAX	DEFAULT_FILENAME_MAX
diff --git a/sysdeps/unix/sysv/linux/sys/mman.h b/sysdeps/unix/sysv/linux/sys/mman.h
index ea326e2cd9..e2434f135f 100644
--- a/sysdeps/unix/sysv/linux/sys/mman.h
+++ b/sysdeps/unix/sysv/linux/sys/mman.h
@@ -18,10 +18,9 @@
    Boston, MA 02111-1307, USA.  */
 
 #ifndef	_SYS_MMAN_H
-
 #define	_SYS_MMAN_H	1
-#include <features.h>
 
+#include <features.h>
 #include <bits/types.h>
 #define __need_size_t
 #include <stddef.h>
diff --git a/sysdeps/unix/sysv/minix/bits/sigaction.h b/sysdeps/unix/sysv/minix/bits/sigaction.h
index 732befc630..96f14d17af 100644
--- a/sysdeps/unix/sysv/minix/bits/sigaction.h
+++ b/sysdeps/unix/sysv/minix/bits/sigaction.h
@@ -16,6 +16,10 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
+#ifndef _SIGNAL_H
+# error "Never include <bits/sigaction.h> directly; use <signal.h> instead."
+#endif
+
 /* Structure describing the action to be taken when a signal arrives.  */
 struct sigaction
   {
diff --git a/sysdeps/unix/sysv/sco3.2.4/bits/confname.h b/sysdeps/unix/sysv/sco3.2.4/bits/confname.h
index 3af9377ded..3c549dd4b3 100644
--- a/sysdeps/unix/sysv/sco3.2.4/bits/confname.h
+++ b/sysdeps/unix/sysv/sco3.2.4/bits/confname.h
@@ -17,6 +17,10 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
+#ifndef _UNISTD_H
+# error "Never use <bits/confname.h> directly; include <unistd.h> instead."
+#endif
+
 /* Values for the NAME argument to `pathconf' and `fpathconf'.  */
 #define _PC_LINK_MAX		0
 #define _PC_MAX_CANON		1
diff --git a/sysdeps/unix/sysv/sco3.2.4/bits/sigaction.h b/sysdeps/unix/sysv/sco3.2.4/bits/sigaction.h
index f66877da0b..eaa52bee2f 100644
--- a/sysdeps/unix/sysv/sco3.2.4/bits/sigaction.h
+++ b/sysdeps/unix/sysv/sco3.2.4/bits/sigaction.h
@@ -17,6 +17,10 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
+#ifndef _SIGNAL_H
+# error "Never include <bits/sigaction.h> directly; use <signal.h> instead."
+#endif
+
 /* Structure describing the action to be taken when a signal arrives.  */
 struct sigaction
   {
diff --git a/sysdeps/unix/sysv/sysv4/bits/sigaction.h b/sysdeps/unix/sysv/sysv4/bits/sigaction.h
index ce3ab5e60c..07d5554921 100644
--- a/sysdeps/unix/sysv/sysv4/bits/sigaction.h
+++ b/sysdeps/unix/sysv/sysv4/bits/sigaction.h
@@ -17,6 +17,10 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
+#ifndef _SIGNAL_H
+# error "Never include <bits/sigaction.h> directly; use <signal.h> instead."
+#endif
+
 /* Structure describing the action to be taken when a signal arrives.  */
 struct sigaction
   {
diff --git a/sysdeps/unix/sysv/sysv4/bits/utsname.h b/sysdeps/unix/sysv/sysv4/bits/utsname.h
index 9dcc618068..bf2c0a8da5 100644
--- a/sysdeps/unix/sysv/sysv4/bits/utsname.h
+++ b/sysdeps/unix/sysv/sysv4/bits/utsname.h
@@ -1 +1,23 @@
+/* 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 _UTSNAME_H
+# error "Never include <bits/utsname.h> directly; use <sys/utsname.h> instead."
+#endif
+
 #define _UTSNAME_LENGTH 257
diff --git a/sysdeps/unix/sysv/sysv4/bits/waitflags.h b/sysdeps/unix/sysv/sysv4/bits/waitflags.h
index 29ff566342..e99dc00511 100644
--- a/sysdeps/unix/sysv/sysv4/bits/waitflags.h
+++ b/sysdeps/unix/sysv/sysv4/bits/waitflags.h
@@ -19,7 +19,7 @@
    Boston, MA 02111-1307, USA.  */
 
 #ifndef _SYS_WAIT_H
-#error "Never use <bits/waitflags.h> directly; include <sys/wait.h> instead."
+# error "Never include <bits/waitflags.h> directly; use <sys/wait.h> instead."
 #endif
 
 
@@ -28,7 +28,7 @@
 #define	WUNTRACED	4	/* Report status of stopped children.  */
 
 #ifdef __USE_SVID
-#define WEXITED		1	/* Look for children that have exited.  */
-#define WTRAPPED	2	/* Look for processes that stopped
+# define WEXITED	1	/* Look for children that have exited.  */
+# define WTRAPPED	2	/* Look for processes that stopped
 				   while tracing.  */
 #endif
diff --git a/sysdeps/unix/sysv/sysv4/i386/bits/stat.h b/sysdeps/unix/sysv/sysv4/i386/bits/stat.h
index f3f4473032..104ad2f247 100644
--- a/sysdeps/unix/sysv/sysv4/i386/bits/stat.h
+++ b/sysdeps/unix/sysv/sysv4/i386/bits/stat.h
@@ -1,6 +1,5 @@
 /* Copyright (C) 1993, 1996, 1997 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
-   Contributed by Brendan Kehoe (brendan@zen.org).
 
    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
@@ -17,12 +16,9 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-/*
- * Never include this file directly; use <sys/stat.h> instead.
- */
-
-#ifndef	_BITS_STAT_H
-#define	_BITS_STAT_H	1
+#ifndef _SYS_STAT_H
+# error "Never include <bits/stat.h> directly; use <sys/stat.h> instead."
+#endif
 
 #include <bits/types.h>
 
@@ -34,37 +30,37 @@
 /* Structure describing file characteristics.  */
 struct stat
   {
-    unsigned long st_dev;	/* Device.  */
-    long st_filler1[3];
-    unsigned long st_ino;		/* File serial number.		*/
-    unsigned long st_mode;	/* File mode.  */
-    unsigned long st_nlink;	/* Link count.  */
-    long st_uid;		/* User ID of the file's owner.	*/
-    long st_gid;		/* Group ID of the file's group.*/
-    unsigned long st_rdev;	/* Device number, if device.  */
-    long st_filler2[2];
-
-    long st_size;		/* Size of file, in bytes.  */
+    unsigned long itn st_dev;	/* Device.  */
+    long int st_filler1[3];
+    unsigned long int st_ino;	/* File serial number.		*/
+    unsigned long int st_mode;	/* File mode.  */
+    unsigned long int st_nlink;	/* Link count.  */
+    long int st_uid;		/* User ID of the file's owner.	*/
+    long int st_gid;		/* Group ID of the file's group.*/
+    unsigned long int st_rdev;	/* Device number, if device.  */
+    long int st_filler2[2];
+
+    long int st_size;		/* Size of file, in bytes.  */
     /* SVR4 added this extra long to allow for expansion of off_t.  */
-    long st_filler3;
+    long int st_filler3;
 
-    long st_atime;		/* Time of last access.  */
-    unsigned long st_atime_usec;
-    long st_mtime;		/* Time of last modification.  */
-    unsigned long st_mtime_usec;
-    long st_ctime;		/* Time of last status change.  */
-    unsigned long st_ctime_usec;
+    long int st_atime;		/* Time of last access.  */
+    unsigned long int st_atime_usec;
+    long int st_mtime;		/* Time of last modification.  */
+    unsigned long int st_mtime_usec;
+    long int st_ctime;		/* Time of last status change.  */
+    unsigned long int st_ctime_usec;
 
-    long st_blksize;		/* Optimal block size for I/O.  */
+    long int st_blksize;	/* Optimal block size for I/O.  */
 #define	_STATBUF_ST_BLKSIZE	/* Tell code we have this member.  */
 
     __blkcnt_t st_blocks;	/* Number of 512-byte blocks allocated.  */
     char st_fstype[16];		/* The type of this filesystem.  */
     int st_aclcnt;
-    unsigned long st_level;
-    unsigned long st_flags;
-    unsigned long st_cmwlevel;
-    long st_filler4[4];
+    unsigned long int st_level;
+    unsigned long int st_flags;
+    unsigned long int st_cmwlevel;
+    long int st_filler4[4];
   };
 
 /* Encoding of the file mode.  */
@@ -90,5 +86,3 @@ struct stat
 #define	__S_IREAD	0400	/* Read by owner.  */
 #define	__S_IWRITE	0200	/* Write by owner.  */
 #define	__S_IEXEC	0100	/* Execute by owner.  */
-
-#endif	/* bits/stat.h */
diff --git a/sysdeps/unix/sysv/sysv4/solaris2/bits/stat.h b/sysdeps/unix/sysv/sysv4/solaris2/bits/stat.h
index 82ab37fd93..c6048a9277 100644
--- a/sysdeps/unix/sysv/sysv4/solaris2/bits/stat.h
+++ b/sysdeps/unix/sysv/sysv4/solaris2/bits/stat.h
@@ -1,6 +1,5 @@
 /* Copyright (C) 1993, 1996, 1997 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
-   Contributed by Brendan Kehoe (brendan@zen.org).
 
    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
@@ -17,12 +16,9 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-/*
- * Never include this file directly; use <sys/stat.h> instead.
- */
-
-#ifndef	_BITS_STAT_H
-#define	_BITS_STAT_H	1
+#ifndef _SYS_STAT_H
+# error "Never include <bits/stat.h> directly; use <sys/stat.h> instead."
+#endif
 
 #include <bits/types.h>
 
@@ -30,7 +26,7 @@
 struct stat
   {
     unsigned long int st_dev;
-    long st_filler1[3];
+    long int st_filler1[3];
     __ino_t st_ino;		/* File serial number.		*/
     unsigned long int st_mode;	/* File mode.  */
     /* This is unsigned long instead of __nlink_t, since SVR4 has
@@ -39,11 +35,11 @@ struct stat
     __uid_t st_uid;		/* User ID of the file's owner.	*/
     __gid_t st_gid;		/* Group ID of the file's group.*/
     unsigned long int st_rdev;	/* Device number, if device.  */
-    long st_filler2[2];
+    long int st_filler2[2];
 
     __off_t st_size;		/* Size of file, in bytes.  */
     /* SVR4 added this extra long to allow for expansion of off_t.  */
-    long st_filler3;
+    long int st_filler3;
 
     __time_t st_atime;		/* Time of last access.  */
     unsigned long int st_atime_usec;
@@ -55,9 +51,9 @@ struct stat
     __blkcnt_t st_blksize;	/* Optimal block size for I/O.  */
 #define	_STATBUF_ST_BLKSIZE	/* Tell code we have this member.  */
 
-    long st_blocks;		/* Number of 512-byte blocks allocated.  */
+    long int st_blocks;		/* Number of 512-byte blocks allocated.  */
     char st_fstype[16];
-    long st_filler4[8];
+    long int st_filler4[8];
   };
 
 /* Encoding of the file mode.  */
@@ -83,5 +79,3 @@ struct stat
 #define	__S_IREAD	0400	/* Read by owner.  */
 #define	__S_IWRITE	0200	/* Write by owner.  */
 #define	__S_IEXEC	0100	/* Execute by owner.  */
-
-#endif	/* bits/stat.h */
diff --git a/sysdeps/unix/sysv/sysv4/solaris2/sparc/bits/sigcontext.h b/sysdeps/unix/sysv/sysv4/solaris2/sparc/bits/sigcontext.h
index 7402704864..29d2d87b26 100644
--- a/sysdeps/unix/sysv/sysv4/solaris2/sparc/bits/sigcontext.h
+++ b/sysdeps/unix/sysv/sysv4/solaris2/sparc/bits/sigcontext.h
@@ -1 +1,34 @@
-#include <sysdeps/unix/bsd/sun/sparc/bits/sigcontext.h>
+/* Structure describing state saved while handling a signal.  Sparc version.
+   Copyright (C) 1992, 1994, 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 _SIGNAL_H
+# error "Never use <bits/sigcontext.h> directly; include <signal.h> instead."
+#endif
+
+struct sigcontext
+  {
+    int sc_onstack;
+    __sigset_t sc_mask;
+
+#define	SPARC_MAXREGWINDOW 31	/* Maximum usable register windows.  */
+    int sc_sp, sc_pc, sc_npc, sc_psr, sc_g1, sc_o0;
+    int sc_wbcnt;		/* Number of outstanding windows.  */
+    __ptr_t sc_spbuf[SPARC_MAXREGWINDOW]; /* SP's for each window.  */
+    int sc_wbuf[SPARC_MAXREGWINDOW][16]; /* Saved register windows.  */
+  };
diff --git a/sysdeps/vax/bits/huge_val.h b/sysdeps/vax/bits/huge_val.h
index f323049d83..74930be56a 100644
--- a/sysdeps/vax/bits/huge_val.h
+++ b/sysdeps/vax/bits/huge_val.h
@@ -1,6 +1,6 @@
 /* `HUGE_VAL' constant for Vaxen.
    Used by <stdlib.h> and <math.h> functions for overflow.
-   Copyright (C) 1992, 1996 Free Software Foundation, Inc.
+   Copyright (C) 1992, 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
@@ -19,7 +19,7 @@
    Boston, MA 02111-1307, USA.  */
 
 #ifndef _MATH_H
-#error "Never use <bits/huge_val.h> directly; include <math.h> instead."
+# error "Never use <bits/huge_val.h> directly; include <math.h> instead."
 #endif
 
 
diff --git a/sysdeps/vax/bits/setjmp.h b/sysdeps/vax/bits/setjmp.h
index 7adecd9a17..10ca170a2a 100644
--- a/sysdeps/vax/bits/setjmp.h
+++ b/sysdeps/vax/bits/setjmp.h
@@ -1,5 +1,9 @@
 /* Define the machine-dependent type `jmp_buf'.  Vax version.  */
 
+#ifndef _SETJMP_H
+# error "Never include <bits/setjmp.h> directly; use <setjmp.h> instead."
+#endif
+
 typedef struct
   {
     PTR __fp;
diff --git a/sysdeps/wordsize-32/bits/elfclass.h b/sysdeps/wordsize-32/bits/elfclass.h
index 49411d66f3..7d9ea28695 100644
--- a/sysdeps/wordsize-32/bits/elfclass.h
+++ b/sysdeps/wordsize-32/bits/elfclass.h
@@ -2,4 +2,8 @@
    the ELF file class used for executables and shared objects on this
    machine.  */
 
+#ifndef _LINK_H
+# error "Never use <bits/elfclass.h> directly; include <link.h> instead."
+#endif
+
 #define __ELF_NATIVE_CLASS 32
diff --git a/sysdeps/wordsize-64/bits/elfclass.h b/sysdeps/wordsize-64/bits/elfclass.h
index ac52904886..bf76faf418 100644
--- a/sysdeps/wordsize-64/bits/elfclass.h
+++ b/sysdeps/wordsize-64/bits/elfclass.h
@@ -2,4 +2,8 @@
    the ELF file class used for executables and shared objects on this
    machine.  */
 
+#ifndef _LINK_H
+# error "Never use <bits/elfclass.h> directly; include <link.h> instead."
+#endif
+
 #define __ELF_NATIVE_CLASS 64
diff --git a/sysvipc/sys/ipc.h b/sysvipc/sys/ipc.h
index c36dd79b33..f1ba7ff188 100644
--- a/sysvipc/sys/ipc.h
+++ b/sysvipc/sys/ipc.h
@@ -1,6 +1,5 @@
 /* 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
@@ -20,7 +19,7 @@
 #ifndef _SYS_IPC_H
 #define _SYS_IPC_H	1
 
-#include <sys/cdefs.h>
+#include <features.h>
 
 /* Get system dependent definition of `struct ipc_perm' and more.  */
 #include <bits/ipc.h>
diff --git a/sysvipc/sys/msg.h b/sysvipc/sys/msg.h
index b6fe7a77cf..56938bf613 100644
--- a/sysvipc/sys/msg.h
+++ b/sysvipc/sys/msg.h
@@ -1,6 +1,5 @@
-/* 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.
 
    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
@@ -29,19 +28,19 @@
 /* Get system dependent definition of `struct msqid_ds' and more.  */
 #include <bits/msq.h>
 
-__BEGIN_DECLS
-
 /* The following System V style IPC functions implement a message queue
    system.  The definition is found in XPG2.  */
 
 /* Template for struct to be used as argument for `msgsnd' and `msgrcv'.  */
 struct msgbuf
-{
-  long int mtype;		/* type of received/sent message */
-  char mtext[1];		/* text of the message */
-};
+  {
+    long int mtype;		/* type of received/sent message */
+    char mtext[1];		/* text of the message */
+  };
 
 
+__BEGIN_DECLS
+
 /* Message queue control operation.  */
 extern int msgctl __P ((int __msqid, int __cmd, struct msqid_ds *__buf));
 
diff --git a/sysvipc/sys/sem.h b/sysvipc/sys/sem.h
index 84bcc5a0fc..f509d9b4a2 100644
--- a/sysvipc/sys/sem.h
+++ b/sysvipc/sys/sem.h
@@ -1,6 +1,5 @@
-/* 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.
 
    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
@@ -30,8 +29,6 @@
 /* Get system dependent definition of `struct semid_ds' and more.  */
 #include <bits/sem.h>
 
-__BEGIN_DECLS
-
 /* The following System V style IPC functions implement a semaphore
    handling.  The definition is found in XPG2.  */
 
@@ -44,6 +41,8 @@ struct sembuf
 };
 
 
+__BEGIN_DECLS
+
 /* Semaphore control operation.  */
 extern int semctl __P ((int __semid, int __semnum, int __cmd,
 			union semun __arg));
diff --git a/sysvipc/sys/shm.h b/sysvipc/sys/shm.h
index 56883b787b..6a3a34247b 100644
--- a/sysvipc/sys/shm.h
+++ b/sysvipc/sys/shm.h
@@ -1,6 +1,5 @@
 /* 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
@@ -35,11 +34,11 @@
 /* Segment low boundary address multiple.  */
 #define SHMLBA		getpagesize ()
 
-__BEGIN_DECLS
-
 /* The following System V style IPC functions implement a shared memory
    facility.  The definition is found in XPG4.2.  */
 
+__BEGIN_DECLS
+
 /* Shared memory control operation.  */
 extern int shmctl __P ((int __shmid, int __cmd, struct shmid_ds *__buf));
 
diff --git a/time/strftime.c b/time/strftime.c
index e09d0fd26f..7bb0810547 100644
--- a/time/strftime.c
+++ b/time/strftime.c
@@ -375,14 +375,6 @@ static char const month_name[][10] =
 
 #ifdef emacs
 # define my_strftime emacs_strftime
- /* Emacs 20.2 uses `-Dstrftime=emacs_strftime' when compiling,
-    because that's how strftime used to be configured.
-    Undo this, since it gets in the way of accessing the underlying strftime,
-    which is needed for things like %Ec in Solaris.
-    The following two lines can be removed once Emacs stops compiling with
-    `-Dstrftime=emacs_strftime'.  */
-# undef strftime
-size_t strftime __P ((char *, size_t, const char *, const struct tm *));
 #else
 # define my_strftime strftime
 #endif
@@ -1173,14 +1165,14 @@ my_strftime (s, maxsize, format, tp)
 		   valid time_t value.  Check whether an error really
 		   occurred.  */
 		struct tm tm;
-		localtime_r (&lt, &tm);
-
-		if ((ltm.tm_sec ^ tm.tm_sec)
-		    | (ltm.tm_min ^ tm.tm_min)
-		    | (ltm.tm_hour ^ tm.tm_hour)
-		    | (ltm.tm_mday ^ tm.tm_mday)
-		    | (ltm.tm_mon ^ tm.tm_mon)
-		    | (ltm.tm_year ^ tm.tm_year))
+
+		if (! localtime_r (&lt, &tm)
+		    || ((ltm.tm_sec ^ tm.tm_sec)
+			| (ltm.tm_min ^ tm.tm_min)
+			| (ltm.tm_hour ^ tm.tm_hour)
+			| (ltm.tm_mday ^ tm.tm_mday)
+			| (ltm.tm_mon ^ tm.tm_mon)
+			| (ltm.tm_year ^ tm.tm_year)))
 		  break;
 	      }
 
diff --git a/wcsmbs/mbrtowc.c b/wcsmbs/mbrtowc.c
index 8b4dbe2912..cf0bbd6ce2 100644
--- a/wcsmbs/mbrtowc.c
+++ b/wcsmbs/mbrtowc.c
@@ -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.
    Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1996.
 
@@ -38,9 +38,8 @@ __mbrtowc (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps)
   if (s == NULL)
     {
       /* See first paragraph of description in 7.16.6.3.2.  */
-      pwc = NULL;
-      s = "";
-      n = 1;
+      ps->count = 0;
+      return 0;
     }
 
   if (n > 0)
diff --git a/wcsmbs/mbsnrtowcs.c b/wcsmbs/mbsnrtowcs.c
index bb79a30ed2..db67d5c1bb 100644
--- a/wcsmbs/mbsnrtowcs.c
+++ b/wcsmbs/mbsnrtowcs.c
@@ -43,10 +43,16 @@ __mbsnrtowcs (dst, src, nmc, len, ps)
   size_t written = 0;
   const char *run = *src;
   const char *last = run + nmc;
+  wchar_t value;
+  size_t count;
 
   if (ps == NULL)
     ps = &internal;
 
+  /* Get information from last use of this state.  */
+  count = ps->count;
+  value = ps->value;
+
   if (dst == NULL)
     /* The LEN parameter has to be ignored if we don't actually write
        anything.  */
@@ -55,57 +61,66 @@ __mbsnrtowcs (dst, src, nmc, len, ps)
   /* Copy all words.  */
   while (written < len && run < last)
     {
-      wchar_t value;
-      size_t count;
-      unsigned char byte = *run++;
+      unsigned char byte;
 
-      /* We expect a start of a new multibyte character.  */
-      if (byte < 0x80)
-	{
-	  /* One byte sequence.  */
-	  count = 0;
-	  value = byte;
-	}
-      else if ((byte & 0xe0) == 0xc0)
-	{
-	  count = 1;
-	  value = byte & 0x1f;
-	}
-      else if ((byte & 0xf0) == 0xe0)
-	{
-	  /* We expect three bytes.  */
-	  count = 2;
-	  value = byte & 0x0f;
-	}
-      else if ((byte & 0xf8) == 0xf0)
-	{
-	  /* We expect four bytes.  */
-	  count = 3;
-	  value = byte & 0x07;
-	}
-      else if ((byte & 0xfc) == 0xf8)
-	{
-	  /* We expect five bytes.  */
-	  count = 4;
-	  value = byte & 0x03;
-	}
-      else if ((byte & 0xfe) == 0xfc)
-	{
-	  /* We expect six bytes.  */
-	  count = 5;
-	  value = byte & 0x01;
-	}
-      else
+      /* Store address of next byte to process.  */
+      *src = run;
+
+      /* Start reading a new character only if we are in the initial
+	 state.  */
+      if (count == 0)
 	{
-	  /* This is an illegal encoding.  */
-	  __set_errno (EILSEQ);
-	  return (size_t) -1;
+	  byte = *run++;
+
+	  /* We expect a start of a new multibyte character.  */
+	  if (byte < 0x80)
+	    {
+	      /* One byte sequence.  */
+	      count = 0;
+	      value = byte;
+	    }
+	  else if ((byte & 0xe0) == 0xc0)
+	    {
+	      count = 1;
+	      value = byte & 0x1f;
+	    }
+	  else if ((byte & 0xf0) == 0xe0)
+	    {
+	      /* We expect three bytes.  */
+	      count = 2;
+	      value = byte & 0x0f;
+	    }
+	  else if ((byte & 0xf8) == 0xf0)
+	    {
+	      /* We expect four bytes.  */
+	      count = 3;
+	      value = byte & 0x07;
+	    }
+	  else if ((byte & 0xfc) == 0xf8)
+	    {
+	      /* We expect five bytes.  */
+	      count = 4;
+	      value = byte & 0x03;
+	    }
+	  else if ((byte & 0xfe) == 0xfc)
+	    {
+	      /* We expect six bytes.  */
+	      count = 5;
+	      value = byte & 0x01;
+	    }
+	  else
+	    {
+	      /* This is an illegal encoding.  */
+	      __set_errno (EILSEQ);
+	      return (size_t) -1;
+	    }
 	}
 
       /* Read the possible remaining bytes.  */
-      while (count-- > 0)
+      while (run < last && count > 0)
 	{
 	  byte = *run++;
+	  --count;
 
 	  if ((byte & 0xc0) != 0x80)
 	    {
@@ -118,6 +133,14 @@ __mbsnrtowcs (dst, src, nmc, len, ps)
 	  value |= byte & 0x3f;
 	}
 
+      /* If this character is only partially available remember this.  */
+      if (run == last && count != 0)
+	{
+	  ps->count = count;
+	  ps->value = value;
+	  break;
+	}
+
       /* Store value is required.  */
       if (dst != NULL)
 	*dst++ = value;
@@ -128,6 +151,7 @@ __mbsnrtowcs (dst, src, nmc, len, ps)
 	{
 	  /* Found the end of the string.  */
 	  *src = NULL;
+	  ps->count = 0;
 	  return written;
 	}
 
diff --git a/wcsmbs/mbsrtowcs.c b/wcsmbs/mbsrtowcs.c
index 7ae30b4870..84d4cbf66d 100644
--- a/wcsmbs/mbsrtowcs.c
+++ b/wcsmbs/mbsrtowcs.c
@@ -52,7 +52,12 @@ __mbsrtowcs (dst, src, len, ps)
     {
       wchar_t value;
       size_t count;
-      unsigned char byte = *run++;
+      unsigned char byte;
+
+      /* Store address of next byte to process.  */
+      *src = run;
+
+      byte = *run++;
 
       /* We expect a start of a new multibyte character.  */
       if (byte < 0x80)
diff --git a/wcsmbs/wcrtomb.c b/wcsmbs/wcrtomb.c
index c5b887dce9..69c67705c3 100644
--- a/wcsmbs/wcrtomb.c
+++ b/wcsmbs/wcrtomb.c
@@ -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.
    Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1996.
 
@@ -48,8 +48,10 @@ __wcrtomb (char *s, wchar_t wc, mbstate_t *ps)
 
   if (s == NULL)
     {
-      s = fake;
-      wc = L'\0';
+      /* This is equivalent to wcrtomb (<<internal>, L'\0', ps).  We
+	 only have to reset the state.  */
+      ps->count = 0;
+      return 1;
     }
 
   /* Store the UTF8 representation of WC.  */
@@ -65,6 +67,7 @@ __wcrtomb (char *s, wchar_t wc, mbstate_t *ps)
       /* It's a one byte sequence.  */
       if (s != NULL)
 	*s = (char) wc;
+      ps->count = 0;
       return 1;
     }
 
diff --git a/wcsmbs/wcsnrtombs.c b/wcsmbs/wcsnrtombs.c
index ddd4e95057..f6c8048295 100644
--- a/wcsmbs/wcsnrtombs.c
+++ b/wcsmbs/wcsnrtombs.c
@@ -63,7 +63,12 @@ __wcsnrtombs (dst, src, nwc, len, ps)
 
   while (written < len && nwc-- > 0)
     {
-      wchar_t wc = *run++;
+      wchar_t wc;
+
+      /* Store position of first unprocessed word.  */
+      *src = run;
+
+      wc = *run++;
 
       if (wc < 0 || wc > 0x7fffffff)
 	{
diff --git a/wcsmbs/wcsrtombs.c b/wcsmbs/wcsrtombs.c
index b2c0c73778..cc21a51eb3 100644
--- a/wcsmbs/wcsrtombs.c
+++ b/wcsmbs/wcsrtombs.c
@@ -59,7 +59,12 @@ __wcsrtombs (dst, src, len, ps)
 
   while (written < len)
     {
-      wchar_t wc = *run++;
+      wchar_t wc;
+
+      /* Store position of first unprocessed word.  */
+      *src = run;
+
+      wc = *run++;
 
       if (wc < 0 || wc > 0x7fffffff)
 	{
@@ -73,6 +78,7 @@ __wcsrtombs (dst, src, len, ps)
 	  /* Found the end.  */
 	  if (dst != NULL)
 	    *dst = '\0';
+	  ps->count = 0;
 	  *src = NULL;
 	  return written;
 	}
@@ -120,6 +126,9 @@ __wcsrtombs (dst, src, len, ps)
   /* Store position of first unprocessed word.  */
   *src = run;
 
+  /* Signal that we finished correctly.  */
+  ps->count = 0;
+
   return written;
 }
 weak_alias (__wcsrtombs, wcsrtombs)
diff --git a/wcsmbs/wmemrtombs.c b/wcsmbs/wmemrtombs.c
index 2bbd66788e..5b8e39cbe3 100644
--- a/wcsmbs/wmemrtombs.c
+++ b/wcsmbs/wmemrtombs.c
@@ -63,7 +63,12 @@ __wmemrtombs (dst, src, nwc, len, ps)
 
   while (written < len && nwc-- > 0)
     {
-      wchar_t wc = *run++;
+      wchar_t wc;
+
+      /* Store position of first unprocessed word.  */
+      *src = run;
+
+      wc = *run++;
 
       if (wc < 0 || wc > 0x7fffffff)
 	{
diff --git a/wcsmbs/wmemrtowcs.c b/wcsmbs/wmemrtowcs.c
index 1686229b8f..4efdd72d2e 100644
--- a/wcsmbs/wmemrtowcs.c
+++ b/wcsmbs/wmemrtowcs.c
@@ -43,10 +43,16 @@ __wmemrtowcs (dst, src, nmc, len, ps)
   size_t written = 0;
   const char *run = *src;
   const char *last = run + nmc;
+  wchar_t value;
+  size_t count;
 
   if (ps == NULL)
     ps = &internal;
 
+  /* Get information from last use of this state.  */
+  count = ps->count;
+  value = ps->value;
+
   if (dst == NULL)
     /* The LEN parameter has to be ignored if we don't actually write
        anything.  */
@@ -55,57 +61,66 @@ __wmemrtowcs (dst, src, nmc, len, ps)
   /* Copy all words.  */
   while (written < len && run < last)
     {
-      wchar_t value;
-      size_t count;
-      unsigned char byte = *run++;
+      unsigned char byte;
 
-      /* We expect a start of a new multibyte character.  */
-      if (byte < 0x80)
-	{
-	  /* One byte sequence.  */
-	  count = 0;
-	  value = byte;
-	}
-      else if ((byte & 0xe0) == 0xc0)
-	{
-	  count = 1;
-	  value = byte & 0x1f;
-	}
-      else if ((byte & 0xf0) == 0xe0)
-	{
-	  /* We expect three bytes.  */
-	  count = 2;
-	  value = byte & 0x0f;
-	}
-      else if ((byte & 0xf8) == 0xf0)
-	{
-	  /* We expect four bytes.  */
-	  count = 3;
-	  value = byte & 0x07;
-	}
-      else if ((byte & 0xfc) == 0xf8)
-	{
-	  /* We expect five bytes.  */
-	  count = 4;
-	  value = byte & 0x03;
-	}
-      else if ((byte & 0xfe) == 0xfc)
-	{
-	  /* We expect six bytes.  */
-	  count = 5;
-	  value = byte & 0x01;
-	}
-      else
+      /* Store address of next byte to process.  */
+      *src = run;
+
+      /* Start reading a new character only if we are in the initial
+	 state.  */
+      if (count == 0)
 	{
-	  /* This is an illegal encoding.  */
-	  __set_errno (EILSEQ);
-	  return (size_t) -1;
+	  byte = *run++;
+
+	  /* We expect a start of a new multibyte character.  */
+	  if (byte < 0x80)
+	    {
+	      /* One byte sequence.  */
+	      count = 0;
+	      value = byte;
+	    }
+	  else if ((byte & 0xe0) == 0xc0)
+	    {
+	      count = 1;
+	      value = byte & 0x1f;
+	    }
+	  else if ((byte & 0xf0) == 0xe0)
+	    {
+	      /* We expect three bytes.  */
+	      count = 2;
+	      value = byte & 0x0f;
+	    }
+	  else if ((byte & 0xf8) == 0xf0)
+	    {
+	      /* We expect four bytes.  */
+	      count = 3;
+	      value = byte & 0x07;
+	    }
+	  else if ((byte & 0xfc) == 0xf8)
+	    {
+	      /* We expect five bytes.  */
+	      count = 4;
+	      value = byte & 0x03;
+	    }
+	  else if ((byte & 0xfe) == 0xfc)
+	    {
+	      /* We expect six bytes.  */
+	      count = 5;
+	      value = byte & 0x01;
+	    }
+	  else
+	    {
+	      /* This is an illegal encoding.  */
+	      __set_errno (EILSEQ);
+	      return (size_t) -1;
+	    }
 	}
 
       /* Read the possible remaining bytes.  */
-      while (count-- > 0)
+      while (run < last && count > 0)
 	{
 	  byte = *run++;
+	  --count;
 
 	  if ((byte & 0xc0) != 0x80)
 	    {
@@ -118,6 +133,14 @@ __wmemrtowcs (dst, src, nmc, len, ps)
 	  value |= byte & 0x3f;
 	}
 
+      /* If this character is only partially available remember this.  */
+      if (run == last && count != 0)
+	{
+	  ps->count = count;
+	  ps->value = value;
+	  break;
+	}
+
       /* Store value is required.  */
       if (dst != NULL)
 	*dst++ = value;