about summary refs log tree commit diff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1998-02-16 17:42:46 +0000
committerUlrich Drepper <drepper@redhat.com>1998-02-16 17:42:46 +0000
commit880f421fc30003d1626429e8796d43b91d71cab9 (patch)
treedd3aff8b9397dd9177ed24a32d4e6fd2f841ebdd
parentf565518e7e393419f99457792971ce71215d02cc (diff)
downloadglibc-880f421fc30003d1626429e8796d43b91d71cab9.tar.gz
glibc-880f421fc30003d1626429e8796d43b91d71cab9.tar.xz
glibc-880f421fc30003d1626429e8796d43b91d71cab9.zip
Update.
1998-02-16 17:33  Ulrich Drepper  <drepper@cygnus.com>

	* elf/rtld.c (dl_main): Recognize --library-path parameter and
	pass value (or NULL) to _dl_init_paths.
	* elf/dl-load.c (_dl_init_paths): Change to take one parameter,
	replacing local variable llp.  If llp is NULL examine LD_LIBRARY_PATH
	environment variable.
	* elf/link.h: Change prototype for _dl_init_paths.
	* elf/dl-support.c: Pass NULL in _dl_init_paths call.

	* localedata/Makefile (distribute): Add test files.

1998-02-17  Andreas Jaeger  <aj@arthur.rhein-neckar.de>

	* localedata/tests/{test1.cm, test2.cm, test3.cm, test4.cm,
	test1.def, test2.def, test3.def, test4.def}: Simple input files
	for localedef. Contributed by Yung-Ching Hsiao
	<yhsiao@cae.wisc.edu>.

	* localedata/Makefile (tests): Call tst-locale.sh.

	* localedata/tst-locale.sh: New file, regression tests for some
	localedef problems.

1998-02-15  Thorsten Kukuk  <kukuk@vt.uni-paderborn.de>

	* nis/nss_nisplus/nisplus-alias.c: Use __stpncpy.

	* nis/nss_nisplus/nisplus-hosts.c: Make sure buffer is always NUL
	terminated.
	* nis/nss_nisplus/nisplus-network.c: Likewise.
	* nis/nss_nisplus/nisplus-proto.c: Likewise.
	* nis/nss_nisplus/nisplus-rpc.c: Likewise.
	* nis/nss_nisplus/nisplus-service.c: Likewise.

	Add more changes from TI-RPC 2.3 for rpcgen to fix include/C++ bug
	and support generating thread safe RPC code.
	* sunrpc/rpc_main.c: Add changes.
	* sunrpc/rpc_clntout.c: Likewise.
	* sunrpc/rpc_cout.c: Likewise.
	* sunrpc/rpc_hout.c: Likewise.
	* sunrpc/rpc_parse.c: Likewise.
	* sunrpc/rpc_sample.c: Likewise.
	* sunrpc/rpc_scan.c: Likewise.
	* sunrpc/rpc_svcout.c: Likewise.
	* sunrpc/rpc_util.c: Likewise.
	* sunrpc/rpc_util.h: Add new structs and prototypes.
	* sunrpc/proto.h: Remove prototypes for static functions.

1998-02-15  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>

	* locale/programs/ld-messages.c (messages_finish): Don't skip
	error checking when being quiet.
	* locale/programs/ld-ctype.c (ctype_finish): Likewise.
	(set_class_defaults): Likewise.
	* locale/programs/charmap.c (parse_charmap): Likewise.
	* locale/programs/ld-collate.c (collate_finish): Likewise.
	* locale/programs/ld-monetary.c (monetary_finish): Likewise.
	* locale/programs/ld-time.c (time_finish): Likewise.
	* locale/programs/locfile.c (write_locale_data): Likewise.

	* locale/programs/ld-ctype.c (ctype_class_to): Silently ignore
	unknown characters and empty ranges.
	* locale/programs/ld-collate.c (collate_order_elem): When
	processing an ellipsis properly form a linked list in the result
	table, fix typo when allocating ordering array.
	[PR libc/419]

1998-02-13  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>

	* elf/Makefile (ld-map): Define.
	(rtld-ldscript): Define.  Change all `$(objpfx)rtld-ldscript' to
	`$(rtld-ldscript)'.
	($(objpfx)ld.so): Combine the two versions of this rule.  Depend
	on $(ld-map).
	(rtld-link): Combine the two versions of this definition.  Fixed
	to make it work when no symbol versioning is used.

1998-02-16  Ulrich Drepper  <drepper@cygnus.com>

	* Makeconfig (build-program-cmd): Use --library-path parameter to
	ld.so instead of environment variable.

	* sunrpc/Makefile (rpcgen-cmd): Don't use -$ parameter.
	* sunrpc/rpc_main.c: Remove support for -$$ option again.

1998-02-16  Andreas Jaeger  <aj@arthur.rhein-neckar.de>

	* Make-dist: Respect with-cvs setting.
	* MakeTAGS (all-pot): Likewise.
	* sysdeps/sparc/sparc32/Makefile: Likewise.
	* sysdeps/mach/hurd/Makefile: Likewise.
	* stdlib/Makefile: Likewise.
	* posix/Makefile: Likewise.
	* intl/Makefile: Likewise.
	* po/Makefile (linguas): Likewise
-rw-r--r--ChangeLog97
-rw-r--r--Make-dist9
-rw-r--r--MakeTAGS2
-rw-r--r--Makeconfig5
-rw-r--r--elf/Makefile30
-rw-r--r--elf/dl-load.c13
-rw-r--r--elf/dl-support.c4
-rw-r--r--elf/link.h4
-rw-r--r--elf/rtld.c12
-rw-r--r--intl/Makefile8
-rw-r--r--locale/programs/charmap.c7
-rw-r--r--locale/programs/ld-collate.c23
-rw-r--r--locale/programs/ld-ctype.c145
-rw-r--r--locale/programs/ld-messages.c22
-rw-r--r--locale/programs/ld-monetary.c13
-rw-r--r--locale/programs/ld-time.c96
-rw-r--r--locale/programs/locfile.c16
-rw-r--r--localedata/Makefile7
-rw-r--r--localedata/locales/tr_TR1049
-rw-r--r--localedata/tests/test1.cm73
-rw-r--r--localedata/tests/test1.def9
-rw-r--r--localedata/tests/test2.cm73
-rw-r--r--localedata/tests/test2.def9
-rw-r--r--localedata/tests/test3.cm73
-rw-r--r--localedata/tests/test3.def9
-rw-r--r--localedata/tests/test4.cm12
-rw-r--r--localedata/tests/test4.def7
-rwxr-xr-xlocaledata/tst-locale.sh51
-rw-r--r--manual/arith.texi167
-rw-r--r--nis/nss_nisplus/nisplus-alias.c13
-rw-r--r--nis/nss_nisplus/nisplus-hosts.c9
-rw-r--r--nis/nss_nisplus/nisplus-network.c85
-rw-r--r--nis/nss_nisplus/nisplus-proto.c6
-rw-r--r--nis/nss_nisplus/nisplus-rpc.c19
-rw-r--r--nis/nss_nisplus/nisplus-service.c6
-rw-r--r--po/Makefile2
-rw-r--r--posix/Makefile6
-rw-r--r--stdlib/Makefile2
-rw-r--r--sunrpc/Makefile2
-rw-r--r--sunrpc/proto.h7
-rw-r--r--sunrpc/rpc_clntout.c223
-rw-r--r--sunrpc/rpc_cout.c1185
-rw-r--r--sunrpc/rpc_hout.c859
-rw-r--r--sunrpc/rpc_main.c1861
-rw-r--r--sunrpc/rpc_parse.c965
-rw-r--r--sunrpc/rpc_sample.c170
-rw-r--r--sunrpc/rpc_scan.c18
-rw-r--r--sunrpc/rpc_svcout.c303
-rw-r--r--sunrpc/rpc_util.c13
-rw-r--r--sunrpc/rpc_util.h31
-rw-r--r--sysdeps/mach/hurd/Makefile4
-rw-r--r--sysdeps/sparc/sparc32/Makefile4
52 files changed, 5146 insertions, 2692 deletions
diff --git a/ChangeLog b/ChangeLog
index 45926c44fd..2912ce6b6b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,100 @@
+1998-02-16 17:33  Ulrich Drepper  <drepper@cygnus.com>
+
+	* elf/rtld.c (dl_main): Recognize --library-path parameter and
+	pass value (or NULL) to _dl_init_paths.
+	* elf/dl-load.c (_dl_init_paths): Change to take one parameter,
+	replacing local variable llp.  If llp is NULL examine LD_LIBRARY_PATH
+	environment variable.
+	* elf/link.h: Change prototype for _dl_init_paths.
+	* elf/dl-support.c: Pass NULL in _dl_init_paths call.
+
+	* localedata/Makefile (distribute): Add test files.
+
+1998-02-17  Andreas Jaeger  <aj@arthur.rhein-neckar.de>
+
+	* localedata/tests/{test1.cm, test2.cm, test3.cm, test4.cm,
+	test1.def, test2.def, test3.def, test4.def}: Simple input files
+	for localedef. Contributed by Yung-Ching Hsiao
+	<yhsiao@cae.wisc.edu>.
+
+	* localedata/Makefile (tests): Call tst-locale.sh.
+
+	* localedata/tst-locale.sh: New file, regression tests for some
+	localedef problems.
+
+1998-02-15  Thorsten Kukuk  <kukuk@vt.uni-paderborn.de>
+
+	* nis/nss_nisplus/nisplus-alias.c: Use __stpncpy.
+
+	* nis/nss_nisplus/nisplus-hosts.c: Make sure buffer is always NUL
+	terminated.
+	* nis/nss_nisplus/nisplus-network.c: Likewise.
+	* nis/nss_nisplus/nisplus-proto.c: Likewise.
+	* nis/nss_nisplus/nisplus-rpc.c: Likewise.
+	* nis/nss_nisplus/nisplus-service.c: Likewise.
+
+	Add more changes from TI-RPC 2.3 for rpcgen to fix include/C++ bug
+	and support generating thread safe RPC code.
+	* sunrpc/rpc_main.c: Add changes.
+	* sunrpc/rpc_clntout.c: Likewise.
+	* sunrpc/rpc_cout.c: Likewise.
+	* sunrpc/rpc_hout.c: Likewise.
+	* sunrpc/rpc_parse.c: Likewise.
+	* sunrpc/rpc_sample.c: Likewise.
+	* sunrpc/rpc_scan.c: Likewise.
+	* sunrpc/rpc_svcout.c: Likewise.
+	* sunrpc/rpc_util.c: Likewise.
+	* sunrpc/rpc_util.h: Add new structs and prototypes.
+	* sunrpc/proto.h: Remove prototypes for static functions.
+
+1998-02-15  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>
+
+	* locale/programs/ld-messages.c (messages_finish): Don't skip
+	error checking when being quiet.
+	* locale/programs/ld-ctype.c (ctype_finish): Likewise.
+	(set_class_defaults): Likewise.
+	* locale/programs/charmap.c (parse_charmap): Likewise.
+	* locale/programs/ld-collate.c (collate_finish): Likewise.
+	* locale/programs/ld-monetary.c (monetary_finish): Likewise.
+	* locale/programs/ld-time.c (time_finish): Likewise.
+	* locale/programs/locfile.c (write_locale_data): Likewise.
+
+	* locale/programs/ld-ctype.c (ctype_class_to): Silently ignore
+	unknown characters and empty ranges.
+	* locale/programs/ld-collate.c (collate_order_elem): When
+	processing an ellipsis properly form a linked list in the result
+	table, fix typo when allocating ordering array.
+	[PR libc/419]
+
+1998-02-13  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>
+
+	* elf/Makefile (ld-map): Define.
+	(rtld-ldscript): Define.  Change all `$(objpfx)rtld-ldscript' to
+	`$(rtld-ldscript)'.
+	($(objpfx)ld.so): Combine the two versions of this rule.  Depend
+	on $(ld-map).
+	(rtld-link): Combine the two versions of this definition.  Fixed
+	to make it work when no symbol versioning is used.
+
+1998-02-16  Ulrich Drepper  <drepper@cygnus.com>
+
+	* Makeconfig (build-program-cmd): Use --library-path parameter to
+	ld.so instead of environment variable.
+
+	* sunrpc/Makefile (rpcgen-cmd): Don't use -$ parameter.
+	* sunrpc/rpc_main.c: Remove support for -$$ option again.
+
+1998-02-16  Andreas Jaeger  <aj@arthur.rhein-neckar.de>
+
+	* Make-dist: Respect with-cvs setting.
+	* MakeTAGS (all-pot): Likewise.
+	* sysdeps/sparc/sparc32/Makefile: Likewise.
+	* sysdeps/mach/hurd/Makefile: Likewise.
+	* stdlib/Makefile: Likewise.
+	* posix/Makefile: Likewise.
+	* intl/Makefile: Likewise.
+	* po/Makefile (linguas): Likewise
+
 1998-02-15  Thorsten Kukuk  <kukuk@vt.uni-paderborn.de>
 
 	* nis/ypclnt.c (yp_all): Remove error message, user should print it.
diff --git a/Make-dist b/Make-dist
index c4e10180bf..0d61f490ae 100644
--- a/Make-dist
+++ b/Make-dist
@@ -185,11 +185,18 @@ foo:=$(shell echo '+sysdep-dist=$(+sysdep-dist)' >&2)
 
 +tsrcs := $(+tsrcs) $(+sysdep-tsrcs)
 
+ifeq ($(with-cvs),yes)
 define autoconf-it
 autoconf $(ACFLAGS) $< > $@.new
 mv -f $@.new $@
 test ! -d CVS || cvs $(CVSOPTS) commit -m'Regenerated: autoconf $(ACFLAGS) $<' $@
 endef
+else
+define autoconf-it
+autoconf $(ACFLAGS) $< > $@.new
+mv -f $@.new $@
+endef
+endif
 
 configure: configure.in aclocal.m4; $(autoconf-it)
 %/configure: %/configure.in aclocal.m4; $(autoconf-it)
@@ -225,7 +232,9 @@ README: README.template version.h
 	sed -e 's/RELEASE/$(release)/' -e 's/VERSION/$(version)/' < $< > $@
 # Make it unwritable so I won't change it by mistake.
 	chmod 444 $@
+ifeq ($(with-cvs),yes)
 	test ! -d CVS || cvs $(CVSOPTS) commit -m'Remade for $(release)-$(version)' $@
+endif
 
 
 endif	# Subdirectory vs. parent makefile
diff --git a/MakeTAGS b/MakeTAGS
index 8bc587a02c..57d7a5b766 100644
--- a/MakeTAGS
+++ b/MakeTAGS
@@ -176,7 +176,9 @@ $P/libc.pot: $(all-pot)
 	    po/header.pot > $@.new
 	$(XGETTEXT) -d - --omit-header -n -s $^ >> $@.new
 	mv -f $@.new $@
+ifeq ($(with-cvs),yes)
 	test ! -d CVS || cvs $(CVSOPTS) ci -m'Regenerated from source files' $@
+endif
 
 $(subdirs:%=$P/%.pot): $P/%.pot: FORCE
 	$(MAKE) -C $* no_deps=t ../$@
diff --git a/Makeconfig b/Makeconfig
index ab01f95df8..f4c5573087 100644
--- a/Makeconfig
+++ b/Makeconfig
@@ -467,8 +467,9 @@ $(subst $(empty) ,:,$(strip $(patsubst -Wl$(comma)-rpath-link=%, %,\
 				       $(filter -Wl$(comma)-rpath-link=%,\
 						$(sysdep-LDFLAGS)))))
 define built-program-cmd
-LD_LIBRARY_PATH=$(rpath-link)$(patsubst %,:%,$(sysdep-library-path)) \
-$(elf-objpfx)$(rtld-installed-name) $(built-program-file)
+$(elf-objpfx)$(rtld-installed-name) \
+	--library-path $(rpath-link)$(patsubst %,:%,$(sysdep-library-path)) \
+	$(built-program-file)
 endef
 endif
 
diff --git a/elf/Makefile b/elf/Makefile
index 093fc09369..739c230608 100644
--- a/elf/Makefile
+++ b/elf/Makefile
@@ -35,6 +35,7 @@ elide-routines.os = $(dl-routines) dl-support enbl-secure
 # ld.so uses those routines, plus some special stuff for being the program
 # interpreter and operating independent of libc.
 rtld-routines	:= rtld $(dl-routines) dl-sysdep dl-minimal
+ld-map		= $(libc-map)
 distribute	= $(rtld-routines:=.c) dynamic-link.h do-rel.h dl-machine.h \
 		  dl-hash.h soinit.c sofini.c ldd.sh.in ldd.bash.in eval.c \
 		  genrtldtbl.awk atomicity.h dl-procinfo.h
@@ -88,22 +89,22 @@ $(objpfx)librtld.os: $(objpfx)dl-allobjs.os $(common-objpfx)libc_pic.a
 # Do we need a linker script?
 rtld-ldscript-in := $(firstword $(wildcard $(+sysdep_dirs:%=%/rtld-ldscript.in)))
 
-ifeq ($(versioning),yes)
-RTLD-VERSIONS = -Wl,--version-script=$(libc-map)
-endif
-
 ifneq (,$(rtld-ldscript-in))
-LDFLAGS-rtld = -T $(objpfx)rtld-ldscript
+rtld-ldscript = $(objpfx)rtld-ldscript
+generated += rtld-ldscript
+
+LDFLAGS-rtld = -T $(rtld-ldscript)
+before-compile += $(rtld-ldscript)
 
-before-compile += $(objpfx)rtld-ldscript
 rtld-parms = $(wildcard $(+sysdep_dirs:%=%/rtld-parms))
 include $(rtld-parms)
-generated += rtld-ldscript
-$(objpfx)rtld-ldscript: $(rtld-ldscript-in) $(rtld-parms)
+
+$(rtld-ldscript): $(rtld-ldscript-in) $(rtld-parms)
 	sed -e 's#@@rtld-oformat@@#$(rtld-oformat)#' \
 	    -e 's#@@rtld-arch@@#$(rtld-arch)#' \
 	    -e 's#@@rtld-entry@@#$(rtld-entry)#' \
 	    -e 's#@@rtld-base@@#$(rtld-base)#' $< >$@
+endif
 
 $(objpfx)ld.so: $(objpfx)librtld.os $(objpfx)rtld-ldscript
 	$(rtld-link) -Wl,-soname=$(rtld-installed-name)
@@ -111,18 +112,9 @@ $(objpfx)ld.so: $(objpfx)librtld.os $(objpfx)rtld-ldscript
 define rtld-link
 $(LINK.o) -nostdlib -nostartfiles -shared -o $@ \
 	  -Wl,-rpath=$(default-rpath) $(LDFLAGS-rtld) \
-	  $(filter-out $(objpfx)rtld-ldscript,$^) \
-	  $(RTLD-VERSIONS)
+	  $(filter-out $(rtld-ldscript) $($(@F:.so=)-map),$^) \
+	  $(load-map-file:%=-Wl,--version-script=%)
 endef
-else
-$(objpfx)ld.so: $(objpfx)librtld.os
-	$(rtld-link) -Wl,-soname=$(rtld-installed-name)
-
-define rtld-link
-$(LINK.o) -nostdlib -nostartfiles -shared -o $@ \
-	  -Wl,-rpath=$(default-rpath) $^ $(RTLD-VERSIONS)
-endef
-endif
 
 # The dl code in the static libc needs a default library path.
 CFLAGS-dl-support.c = -D'DEFAULT_RPATH="$(default-rpath)"'
diff --git a/elf/dl-load.c b/elf/dl-load.c
index 91b8c2a48d..73cafcca37 100644
--- a/elf/dl-load.c
+++ b/elf/dl-load.c
@@ -1,5 +1,5 @@
 /* Map in a shared object's segments from the file.
-   Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
+   Copyright (C) 1995, 1996, 1997, 1998 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
@@ -309,7 +309,7 @@ decompose_rpath (const char *rpath, size_t additional_room)
 
 
 void
-_dl_init_paths (void)
+_dl_init_paths (const char *llp)
 {
   static const char *trusted_dirs[] =
   {
@@ -325,10 +325,15 @@ _dl_init_paths (void)
      variable.  */
   struct link_map *l;
 
-  /* First determine how many elements the LD_LIBRARY_PATH contents has.  */
-  const char *llp = getenv ("LD_LIBRARY_PATH");
+  /* Number of elements in the library path.  */
   size_t nllp;
 
+  /* If the user has not specified a library path consider the environment
+     variable.  */
+  if (llp == NULL)
+    llp = getenv ("LD_LIBRARY_PATH");
+
+  /* First determine how many elements the LD_LIBRARY_PATH contents has.  */
   if (llp != NULL && *llp != '\0')
     {
       /* Simply count the number of colons.  */
diff --git a/elf/dl-support.c b/elf/dl-support.c
index c103d0e42e..5868656c4e 100644
--- a/elf/dl-support.c
+++ b/elf/dl-support.c
@@ -1,5 +1,5 @@
 /* Support for dynamic linking code in static libc.
-   Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+   Copyright (C) 1996, 1997, 1998 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
@@ -58,7 +58,7 @@ non_dynamic_init (void)
 
   /* Initialize the data structures for the search paths for shared
      objects.  */
-  _dl_init_paths ();
+  _dl_init_paths (NULL);
 
 #ifdef DL_PLATFORM_INIT
   DL_PLATFORM_INIT;
diff --git a/elf/link.h b/elf/link.h
index c74e240492..7f2dc674db 100644
--- a/elf/link.h
+++ b/elf/link.h
@@ -1,5 +1,5 @@
 /* Run-time dynamic linker data structures for loaded ELF shared objects.
-   Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
+   Copyright (C) 1995, 1996, 1997, 1998 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
@@ -443,7 +443,7 @@ extern void _dl_debug_state (void);
 extern struct r_debug *_dl_debug_initialize (ElfW(Addr) ldbase);
 
 /* Initialize the basic data structure for the search paths.  */
-extern void _dl_init_paths (void);
+extern void _dl_init_paths (const char *library_path);
 
 /* Gather the information needed to install the profiling tables and start
    the timers.  */
diff --git a/elf/rtld.c b/elf/rtld.c
index f1b45de1e0..9529b9c14e 100644
--- a/elf/rtld.c
+++ b/elf/rtld.c
@@ -264,6 +264,7 @@ dl_main (const ElfW(Phdr) *phdr,
   size_t file_size;
   char *file;
   int has_interp = 0;
+  const char *library_path = NULL; /* Overwrites LD_LIBRARY_PATH if given.  */
 
   /* Test whether we want to see the content of the auxiliary array passed
      up from the kernel.  */
@@ -343,6 +344,15 @@ dl_main (const ElfW(Phdr) *phdr,
 	    --_dl_argc;
 	    ++_dl_argv;
 	  }
+	else if (! strcmp (_dl_argv[1], "--library-path")
+		 && _dl_argc > 2)
+	  {
+	    library_path = _dl_argv[2];
+
+	    _dl_skip_args += 2;
+	    _dl_argc -= 2;
+	    _dl_argv += 2;
+	  }
 	else
 	  break;
 
@@ -484,7 +494,7 @@ of this helper program; chances are you did not intend to run this program.\n",
 
   /* Initialize the data structures for the search paths for shared
      objects.  */
-  _dl_init_paths ();
+  _dl_init_paths (library_path);
 
   preloadlist = getenv ("LD_PRELOAD");
   if (preloadlist)
diff --git a/intl/Makefile b/intl/Makefile
index bb2c7bedf0..9ee9ba4ed4 100644
--- a/intl/Makefile
+++ b/intl/Makefile
@@ -42,12 +42,20 @@ ifdef gettext-srcdir
 %.h:: ../gpl2lgpl.sed $(gettext-srcdir)/intl/%.h; $(copysrc)
 locale.alias:: ../gpl2lgpl.sed $(gettext-srcdir)/misc/locale.alias; $(copysrc)
 
+ifeq ($(with-cvs),yes)
 define copysrc
 sed -f $^ > $@.new
 chmod a-w $@.new
 mv -f $@.new $@
 test ! -d CVS || cvs $(CVSOPTS) commit -m'Updated from $<' $@
 endef
+else
+define copysrc
+sed -f $^ > $@.new
+chmod a-w $@.new
+mv -f $@.new $@
+endef
+endif
 
 endif
 
diff --git a/locale/programs/charmap.c b/locale/programs/charmap.c
index 1573d6c002..0cd62fbfd4 100644
--- a/locale/programs/charmap.c
+++ b/locale/programs/charmap.c
@@ -253,11 +253,12 @@ parse_charmap (const char *filename)
 		result->mb_cur_max = 1;
 	      if (result->mb_cur_min == 0)
 		result->mb_cur_min = result->mb_cur_max;
-	      if (result->mb_cur_min > result->mb_cur_max && !be_quiet)
+	      if (result->mb_cur_min > result->mb_cur_max)
 		{
-		  error (0, 0, _("\
+		  if (!be_quiet)
+		    error (0, 0, _("\
 %s: <mb_cur_max> must be greater than <mb_cur_min>\n"),
-			 cmfile->fname);
+			   cmfile->fname);
 
 		  result->mb_cur_min = result->mb_cur_max;
 		}
diff --git a/locale/programs/ld-collate.c b/locale/programs/ld-collate.c
index 78a9cd92ac..57b97767af 100644
--- a/locale/programs/ld-collate.c
+++ b/locale/programs/ld-collate.c
@@ -239,9 +239,13 @@ collate_finish (struct localedef_t *locale, struct charset_t *charset)
       else
 	value = 0;
 
-      if (value == 0 && !be_quiet)
-	error_at_line (0, 0, patch->fname, patch->lineno,
-		       _("no weight defined for symbol `%s'"), patch->token);
+      if (value == 0)
+	{
+	  if (!be_quiet)
+	    error_at_line (0, 0, patch->fname, patch->lineno,
+			   _("no weight defined for symbol `%s'"),
+			   patch->token);
+	}
       else
 	*patch->where.pos = value;
     }
@@ -1477,7 +1481,7 @@ line after ellipsis must contain character definition"));
 	      pelem->ordering
 		= (unsigned int *) obstack_copy (&collate->element_mem, data,
 						 (collate->nrules
-						  * pelem->ordering_len)
+						  + pelem->ordering_len)
 						 * sizeof (unsigned int));
 
 	      /* `...' weights need to be adjusted.  */
@@ -1490,13 +1494,16 @@ line after ellipsis must contain character definition"));
 			      (void *) &pelem->next) >= 0)
 		{
 		  if (set_entry (&collate->result, name, sizeof (wchar_t),
-				 (void *) pelem->next) < 0)
+				 (void *) pelem) < 0)
 		    error (4, 0, _("cannot insert into result table"));
 		}
 	      else
-		if (insert_entry (&collate->result, name, sizeof (wchar_t),
-				  (void *) pelem->next) < 0)
-		  error (4, 0, _("cannot insert into result table"));
+		{
+		  pelem->next = NULL;
+		  if (insert_entry (&collate->result, name, sizeof (wchar_t),
+				    (void *) pelem) < 0)
+		    error (4, 0, _("cannot insert into result table"));
+		}
 
 	      /* Increment counter.  */
 	      ++name[0];
diff --git a/locale/programs/ld-ctype.c b/locale/programs/ld-ctype.c
index 8ab70abb5a..f2f32cc214 100644
--- a/locale/programs/ld-ctype.c
+++ b/locale/programs/ld-ctype.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.
 
@@ -309,27 +309,34 @@ character %s'%s' in class `%s' must not be in class `%s'"),
 
   /* ... and now test <SP> as a special case.  */
   space_value = charset_find_value (charset, "SP", 2);
-  if ((wchar_t) space_value == ILLEGAL_CHAR_VALUE && !be_quiet)
-    error (0, 0, _("character <SP> not defined in character map"));
+  if ((wchar_t) space_value == ILLEGAL_CHAR_VALUE)
+    {
+      if (!be_quiet)
+	error (0, 0, _("character <SP> not defined in character map"));
+    }
   else if (((cnt = BITPOS (tok_space),
 	     (ELEM (ctype, class_collection, , space_value)
 	      & BIT (tok_space)) == 0)
 	    || (cnt = BITPOS (tok_blank),
 		(ELEM (ctype, class_collection, , space_value)
-		 & BIT (tok_blank)) == 0))
-	   && !be_quiet)
-    error (0, 0, _("<SP> character not in class `%s'"),
-           valid_table[cnt].name);
+		 & BIT (tok_blank)) == 0)))
+    {
+      if (!be_quiet)
+	error (0, 0, _("<SP> character not in class `%s'"),
+	       valid_table[cnt].name);
+    }
   else if (((cnt = BITPOS (tok_punct),
 	     (ELEM (ctype, class_collection, , space_value)
 	      & BIT (tok_punct)) != 0)
 	    || (cnt = BITPOS (tok_graph),
 		(ELEM (ctype, class_collection, , space_value)
 		 & BIT (tok_graph))
-		!= 0))
-	   && !be_quiet)
-    error (0, 0, _("<SP> character must not be in class `%s'"),
-           valid_table[cnt].name);
+		!= 0)))
+    {
+      if (!be_quiet)
+	error (0, 0, _("<SP> character must not be in class `%s'"),
+	       valid_table[cnt].name);
+    }
   else
     ELEM (ctype, class_collection, , space_value) |= BIT (tok_print);
 
@@ -651,12 +658,14 @@ ctype_class_to (struct linereader *lr, struct localedef_t *locale,
 
   value = charset_find_value (charset, code->val.str.start, code->val.str.len);
 
-  assert (value >= ctype->last_class_char);
-
-  for (cnt = ctype->last_class_char + 1; cnt <= value; ++cnt)
-    *find_idx (ctype, &ctype->class_collection, &ctype->class_collection_max,
-	       &ctype->class_collection_act, cnt)
-      |= ctype->current_class_mask;
+  /* In the LC_CTYPE category it is no error when a character is
+     not found.  This has to be ignored silently.  */
+  if ((wchar_t) ctype->last_class_char != ILLEGAL_CHAR_VALUE
+      && (wchar_t) value != ILLEGAL_CHAR_VALUE)
+    for (cnt = ctype->last_class_char + 1; cnt <= value; ++cnt)
+      *find_idx (ctype, &ctype->class_collection, &ctype->class_collection_max,
+		 &ctype->class_collection_act, cnt)
+	|= ctype->current_class_mask;
 
   ctype->last_class_char = ILLEGAL_CHAR_VALUE;
 }
@@ -940,11 +949,12 @@ set_class_defaults (struct locale_ctype_t *ctype, struct charset_t *charset)
 	  tmp[0] = ch;
 
 	  value = charset_find_value (charset, tmp, 1);
-	  if ((wchar_t) value == ILLEGAL_CHAR_VALUE && !be_quiet)
+	  if ((wchar_t) value == ILLEGAL_CHAR_VALUE)
 	    {
-	      error (0, 0, _("\
+	      if (!be_quiet)
+		error (0, 0, _("\
 character `%s' not defined while needed as default value"),
-		     tmp);
+		       tmp);
 	      continue;
 	    }
 	  else
@@ -1004,50 +1014,68 @@ character `%s' not defined while needed as default value"),
       unsigned int value;
 
       value = charset_find_value (charset, "space", 5);
-      if ((wchar_t) value == ILLEGAL_CHAR_VALUE && !be_quiet)
-	error (0, 0, _("\
+      if ((wchar_t) value == ILLEGAL_CHAR_VALUE)
+	{
+	  if (!be_quiet)
+	    error (0, 0, _("\
 character `%s' not defined while needed as default value"),
-	       "<space>");
+		   "<space>");
+	}
       else
 	ELEM (ctype, class_collection, , value) |= BIT (tok_space);
 
       value = charset_find_value (charset, "form-feed", 9);
-      if ((wchar_t) value == ILLEGAL_CHAR_VALUE && !be_quiet)
-	error (0, 0, _("\
+      if ((wchar_t) value == ILLEGAL_CHAR_VALUE)
+	{
+	  if (!be_quiet)
+	    error (0, 0, _("\
 character `%s' not defined while needed as default value"),
-	       "<form-feed>");
+		   "<form-feed>");
+	}
       else
 	ELEM (ctype, class_collection, , value) |= BIT (tok_space);
 
       value = charset_find_value (charset, "newline", 7);
-      if ((wchar_t) value == ILLEGAL_CHAR_VALUE && !be_quiet)
-	error (0, 0, _("\
+      if ((wchar_t) value == ILLEGAL_CHAR_VALUE)
+	{
+	  if (!be_quiet)
+	    error (0, 0, _("\
 character `%s' not defined while needed as default value"),
-	       "<newline>");
+		   "<newline>");
+	}
       else
 	ELEM (ctype, class_collection, , value) |= BIT (tok_space);
 
       value = charset_find_value (charset, "carriage-return", 15);
-      if ((wchar_t) value == ILLEGAL_CHAR_VALUE && !be_quiet)
-	error (0, 0, _("\
+      if ((wchar_t) value == ILLEGAL_CHAR_VALUE)
+	{
+	  if (!be_quiet)
+	    error (0, 0, _("\
 character `%s' not defined while needed as default value"),
-	       "<carriage-return>");
+		   "<carriage-return>");
+	}
       else
 	ELEM (ctype, class_collection, , value) |= BIT (tok_space);
 
       value = charset_find_value (charset, "tab", 3);
-      if ((wchar_t) value == ILLEGAL_CHAR_VALUE && !be_quiet)
-	error (0, 0, _("\
+      if ((wchar_t) value == ILLEGAL_CHAR_VALUE)
+	{
+	  if (!be_quiet)
+	    error (0, 0, _("\
 character `%s' not defined while needed as default value"),
-	       "<tab>");
+		   "<tab>");
+	}
       else
 	ELEM (ctype, class_collection, , value) |= BIT (tok_space);
 
       value = charset_find_value (charset, "vertical-tab", 12);
-      if ((wchar_t) value == ILLEGAL_CHAR_VALUE && !be_quiet)
-	error (0, 0, _("\
+      if ((wchar_t) value == ILLEGAL_CHAR_VALUE)
+	{
+	  if (!be_quiet)
+	    error (0, 0, _("\
 character `%s' not defined while needed as default value"),
-	       "<vertical-tab>");
+		   "<vertical-tab>");
+	}
       else
 	ELEM (ctype, class_collection, , value) |= BIT (tok_space);
     }
@@ -1070,18 +1098,24 @@ character `%s' not defined while needed as default value"),
       unsigned int value;
 
       value = charset_find_value (charset, "space", 5);
-      if ((wchar_t) value == ILLEGAL_CHAR_VALUE && !be_quiet)
-	error (0, 0, _("\
+      if ((wchar_t) value == ILLEGAL_CHAR_VALUE)
+	{
+	  if (!be_quiet)
+	    error (0, 0, _("\
 character `%s' not defined while needed as default value"),
-	       "<space>");
+		   "<space>");
+	}
       else
 	ELEM (ctype, class_collection, , value) |= BIT (tok_blank);
 
       value = charset_find_value (charset, "tab", 3);
-      if ((wchar_t) value == ILLEGAL_CHAR_VALUE && !be_quiet)
-	error (0, 0, _("\
+      if ((wchar_t) value == ILLEGAL_CHAR_VALUE)
+	{
+	  if (!be_quiet)
+	    error (0, 0, _("\
 character `%s' not defined while needed as default value"),
-	       "<tab>");
+		   "<tab>");
+	}
       else
 	ELEM (ctype, class_collection, , value) |= BIT (tok_blank);
     }
@@ -1116,10 +1150,13 @@ character `%s' not defined while needed as default value"),
 	  ctype->class_collection[cnt] |= BIT (tok_print);
 
       space = charset_find_value (charset, "space", 5);
-      if (space == ILLEGAL_CHAR_VALUE && !be_quiet)
-	error (0, 0, _("\
+      if (space == ILLEGAL_CHAR_VALUE)
+	{
+	  if (!be_quiet)
+	    error (0, 0, _("\
 character `%s' not defined while needed as default value"),
-	       "<space>");
+		   "<space>");
+	}
       else
 	ELEM (ctype, class_collection, , space) |= BIT (tok_print);
     }
@@ -1142,22 +1179,24 @@ character `%s' not defined while needed as default value"),
 	  tmp[1] = (char) ch;
 
 	  value_from = charset_find_value (charset, &tmp[1], 1);
-	  if ((wchar_t) value_from == ILLEGAL_CHAR_VALUE && !be_quiet)
+	  if ((wchar_t) value_from == ILLEGAL_CHAR_VALUE)
 	    {
-	      error (0, 0, _("\
+	      if (!be_quiet)
+		error (0, 0, _("\
 character `%s' not defined while needed as default value"),
-		     tmp);
+		       tmp);
 	      continue;
 	    }
 
 	  /* This conversion is implementation defined.  */
 	  tmp[1] = (char) (ch + ('A' - 'a'));
 	  value_to = charset_find_value (charset, &tmp[1], 1);
-	  if ((wchar_t) value_to == ILLEGAL_CHAR_VALUE && !be_quiet)
+	  if ((wchar_t) value_to == ILLEGAL_CHAR_VALUE)
 	    {
-	      error (0, 0, _("\
+	      if (!be_quiet)
+		error (0, 0, _("\
 character `%s' not defined while needed as default value"),
-		     tmp);
+		       tmp);
 	      continue;
 	    }
 
diff --git a/locale/programs/ld-messages.c b/locale/programs/ld-messages.c
index 31edb47a60..9353e1e49e 100644
--- a/locale/programs/ld-messages.c
+++ b/locale/programs/ld-messages.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.
 
@@ -41,7 +41,7 @@
 #include "localeinfo.h"
 
 
-void *xmalloc (size_t __n);
+extern void *xmalloc (size_t __n);
 
 
 /* The real definition of the struct for the LC_MESSAGES locale.  */
@@ -77,9 +77,12 @@ messages_finish (struct localedef_t *locale)
     = locale->categories[LC_MESSAGES].messages;
 
   /* The fields YESSTR and NOSTR are optional.  */
-  if (messages->yesexpr == NULL && !be_quiet)
-    error (0, 0, _("field `%s' in category `%s' undefined"),
-	   "yesexpr", "LC_MESSAGES");
+  if (messages->yesexpr == NULL)
+    {
+      if (!be_quiet)
+	error (0, 0, _("field `%s' in category `%s' undefined"),
+	       "yesexpr", "LC_MESSAGES");
+    }
   else
     {
       int result;
@@ -98,9 +101,12 @@ no correct regular expression for field `%s' in category `%s': %s"),
 	}
     }
 
-  if (messages->noexpr == NULL && !be_quiet)
-    error (0, 0, _("field `%s' in category `%s' undefined"),
-	   "noexpr", "LC_MESSAGES");
+  if (messages->noexpr == NULL)
+    {
+      if (!be_quiet)
+	error (0, 0, _("field `%s' in category `%s' undefined"),
+	       "noexpr", "LC_MESSAGES");
+    }
   else
     {
       int result;
diff --git a/locale/programs/ld-monetary.c b/locale/programs/ld-monetary.c
index cd30125a5a..d202d76399 100644
--- a/locale/programs/ld-monetary.c
+++ b/locale/programs/ld-monetary.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.
 
@@ -35,8 +35,8 @@
 #include "localeinfo.h"
 #include "stringtrans.h"
 
-void *xmalloc (size_t __n);
-void *xrealloc (void *__ptr, size_t __n);
+extern void *xmalloc (size_t __n);
+extern void *xrealloc (void *__ptr, size_t __n);
 
 
 /* The real definition of the struct for the LC_NUMERIC locale.  */
@@ -129,9 +129,12 @@ monetary_finish (struct localedef_t *locale)
   /* The international currency symbol must come from ISO 4217.  */
   if (monetary->int_curr_symbol != NULL)
     {
-      if (strlen (monetary->int_curr_symbol) != 4 && !be_quiet)
-	error (0, 0, _("\
+      if (strlen (monetary->int_curr_symbol) != 4)
+	{
+	  if (!be_quiet)
+	    error (0, 0, _("\
 value of field `int_curr_symbol' in category `LC_MONETARY' has wrong length"));
+	}
       else if (bsearch (monetary->int_curr_symbol, valid_int_curr,
 			NR_VALID_INT_CURR, sizeof (const char *),
 			(comparison_fn_t) curr_strcmp) == NULL
diff --git a/locale/programs/ld-time.c b/locale/programs/ld-time.c
index 60c54deb3a..e16a247430 100644
--- a/locale/programs/ld-time.c
+++ b/locale/programs/ld-time.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.
 
@@ -37,8 +37,8 @@
   (((w) << 24) | (((w) & 0xff00) << 8) | (((w) >> 8) & 0xff00) | ((w) >> 24))
 
 
-void *xmalloc (size_t __n);
-void *xrealloc (void *__p, size_t __n);
+extern void *xmalloc (size_t __n);
+extern void *xrealloc (void *__p, size_t __n);
 
 
 /* Entry describing an entry of the era specification.  */
@@ -154,21 +154,23 @@ time_finish (struct localedef_t *locale)
 	  memcpy (str, time->era[idx], era_len + 1);
 
 	  /* First character must be + or - for the direction.  */
-	  if (*str != '+' && *str != '-' && !be_quiet)
+	  if (*str != '+' && *str != '-')
 	    {
-	      error (0, 0, _("direction flag in string %d in `era' field"
-			     " in category `%s' is not '+' nor '-'"),
-		     idx + 1, "LC_TIME");
+	      if (!be_quiet)
+		error (0, 0, _("direction flag in string %d in `era' field"
+			       " in category `%s' is not '+' nor '-'"),
+		       idx + 1, "LC_TIME");
 	      /* Default arbitrarily to '+'.  */
 	      time->era_entries[idx].direction = '+';
 	    }
 	  else
 	    time->era_entries[idx].direction = *str;
-	  if (*++str != ':' && !be_quiet)
+	  if (*++str != ':')
 	    {
-	      error (0, 0, _("direction flag in string %d in `era' field"
-			     " in category `%s' is not a single character"),
-		     idx + 1, "LC_TIME");
+	      if (!be_quiet)
+		error (0, 0, _("direction flag in string %d in `era' field"
+			       " in category `%s' is not a single character"),
+		       idx + 1, "LC_TIME");
 	      (void) strsep (&str, ":");
 	    }
 	  else
@@ -176,18 +178,20 @@ time_finish (struct localedef_t *locale)
 
 	  /* Now the offset year.  */
 	  time->era_entries[idx].offset = strtol (str, &endp, 10);
-	  if (endp == str && !be_quiet)
+	  if (endp == str)
 	    {
-	      error (0, 0, _("illegal number for offset in string %d in"
-			     " `era' field in category `%s'"),
-		     idx + 1, "LC_TIME");
+	      if (!be_quiet)
+		error (0, 0, _("illegal number for offset in string %d in"
+			       " `era' field in category `%s'"),
+		       idx + 1, "LC_TIME");
 	      (void) strsep (&str, ":");
 	    }
-	  else if (*endp != ':' && !be_quiet)
+	  else if (*endp != ':')
 	    {
-	      error (0, 0, _("garbage at end of offset value in string %d in"
-			     " `era' field in category `%s'"),
-		     idx + 1, "LC_TIME");
+	      if (!be_quiet)
+		error (0, 0, _("garbage at end of offset value in string %d in"
+			       " `era' field in category `%s'"),
+		       idx + 1, "LC_TIME");
 	      (void) strsep (&str, ":");
 	    }
 	  else
@@ -229,20 +233,23 @@ time_finish (struct localedef_t *locale)
 	      time->era_entries[idx].start_date[1] -= 1;
 
 	      time->era_entries[idx].start_date[2] = strtol (str, &endp, 10);
-	      if (endp == str && !be_quiet)
+	      if (endp == str)
 		{
 		invalid_start_date:
-		  error (0, 0, _("illegal starting date in string %d in"
-				 " `era' field in category `%s'"),
-			 idx + 1, "LC_TIME");
+		  if (!be_quiet)
+		    error (0, 0, _("illegal starting date in string %d in"
+				   " `era' field in category `%s'"),
+			   idx + 1, "LC_TIME");
 		  (void) strsep (&str, ":");
 		}
-	      else if (*endp != ':' && !be_quiet)
+	      else if (*endp != ':')
 		{
 		garbage_start_date:
-		  error (0, 0, _("garbage at end of starting date in string %d"
-				 " in `era' field in category `%s'"),
-			 idx + 1, "LC_TIME");
+		  if (!be_quiet)
+		    error (0, 0, _("garbage at end of starting date "
+				   "in string %d in `era' field "
+				   "in category `%s'"),
+			   idx + 1, "LC_TIME");
 		  (void) strsep (&str, ":");
 		}
 	      else
@@ -302,20 +309,23 @@ time_finish (struct localedef_t *locale)
 	      time->era_entries[idx].stop_date[1] -= 1;
 
 	      time->era_entries[idx].stop_date[2] = strtol (str, &endp, 10);
-	      if (endp == str && !be_quiet)
+	      if (endp == str)
 		{
 		invalid_stop_date:
-		  error (0, 0, _("illegal stopping date in string %d in"
-				 " `era' field in category `%s'"),
-			 idx + 1, "LC_TIME");
+		  if (!be_quiet)
+		    error (0, 0, _("illegal stopping date in string %d in"
+				   " `era' field in category `%s'"),
+			   idx + 1, "LC_TIME");
 		  (void) strsep (&str, ":");
 		}
-	      else if (*endp != ':' && !be_quiet)
+	      else if (*endp != ':')
 		{
 		garbage_stop_date:
-		  error (0, 0, _("garbage at end of stopping date in string %d"
-				 " in `era' field in category `%s'"),
-			 idx + 1, "LC_TIME");
+		  if (!be_quiet)
+		    error (0, 0, _("garbage at end of stopping date "
+				   "in string %d in `era' field "
+				   "in category `%s'"),
+			   idx + 1, "LC_TIME");
 		  (void) strsep (&str, ":");
 		}
 	      else
@@ -339,10 +349,11 @@ time_finish (struct localedef_t *locale)
 		}
 	    }
 
-	  if ((str == NULL || *str == '\0') && !be_quiet)
+	  if (str == NULL || *str == '\0')
 	    {
-	      error (0, 0, _("missing era name in string %d in `era' field"
-			     " in category `%s'"), idx + 1, "LC_TIME");
+	      if (!be_quiet)
+		error (0, 0, _("missing era name in string %d in `era' field"
+			       " in category `%s'"), idx + 1, "LC_TIME");
 	      time->era_entries[idx].name =
 		time->era_entries[idx].format = "";
 	    }
@@ -350,11 +361,12 @@ time_finish (struct localedef_t *locale)
 	    {
 	      time->era_entries[idx].name = strsep (&str, ":");
 
-	      if ((str == NULL || *str == '\0') && !be_quiet)
+	      if (str == NULL || *str == '\0')
 		{
-		  error (0, 0, _("missing era format in string %d in `era'"
-				 " field in category `%s'"),
-			 idx + 1, "LC_TIME");
+		  if (!be_quiet)
+		    error (0, 0, _("missing era format in string %d in `era'"
+				   " field in category `%s'"),
+			   idx + 1, "LC_TIME");
 		  time->era_entries[idx].name =
 		    time->era_entries[idx].format = "";
 		}
diff --git a/locale/programs/locfile.c b/locale/programs/locfile.c
index 6385df47e8..ad7e9d5fb4 100644
--- a/locale/programs/locfile.c
+++ b/locale/programs/locfile.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1996.
 
@@ -1015,11 +1015,12 @@ write_locale_data (const char *output_path, const char *category,
 	    save_err = errno;
 	}
 
-      if (fd == -1 && !be_quiet)
+      if (fd == -1)
 	{
-	  error (0, save_err, _("\
+	  if (!be_quiet)
+	    error (0, save_err, _("\
 cannot open output file `%s' for category `%s'"),
-		 fname, category);
+		   fname, category);
 	  return;
 	}
     }
@@ -1039,10 +1040,11 @@ cannot open output file `%s' for category `%s'"),
       if (maxiov > 0)
 	step = MIN (maxiov, step);
 
-      if (writev (fd, &vec[cnt], step) < 0 && !be_quiet)
+      if (writev (fd, &vec[cnt], step) < 0)
 	{
-	  error (0, errno, _("failure while writing data for category `%s'"),
-		 category);
+	  if (!be_quiet)
+	    error (0, errno, _("failure while writing data for category `%s'"),
+		   category);
 	  break;
 	}
     }
diff --git a/localedata/Makefile b/localedata/Makefile
index ff3e9f07a0..2d45558eb1 100644
--- a/localedata/Makefile
+++ b/localedata/Makefile
@@ -37,9 +37,13 @@ test-output := $(foreach s, .out .xout, \
 generated := $(test-input) $(test-output)
 generated-dirs := $(basename $(test-input)) en_US
 
+test-names := test1 test2 test3 test4
+test-srcs := $(addprefix tests/,$(addsuffix .cm,$(test-names)) \
+				$(addsuffix .def,$(test-names)))
+
 distribute := CHECKSUMS tst-fmon.sh tst-fmon.data ChangeLog sort-test.sh \
 	      README mnemonic.ds fr_CA,2.13.in de_DE.in da_DK.in	 \
-	      $(charmaps) $(locales)
+	      $(charmaps) $(locales) $(test-srcs)
 
 # Get $(inst_i18ndir) defined.
 include ../Makeconfig
@@ -58,4 +62,5 @@ ifeq (no,$(cross-compiling))
 tests: $(objpfx)collate-test $(objpfx)xfrm-test $(objpfx)tst-fmon
 	$(SHELL) -e sort-test.sh $(common-objpfx) $(test-input)
 	$(SHELL) -e tst-fmon.sh $(common-objpfx) tst-fmon.data
+	$(SHELL) -e tst-locale.sh $(common-objpfx)
 endif
diff --git a/localedata/locales/tr_TR b/localedata/locales/tr_TR
index db94a83a1b..8de6ea6d4a 100644
--- a/localedata/locales/tr_TR
+++ b/localedata/locales/tr_TR
@@ -20,6 +20,11 @@ escape_char  /
 % Distribution and use is free, also
 % for commercial purposes.
 
+% Corrections by:
+%   1998-01-11T15:54:39
+%   Onur Tolga Sehitoglu <onur@ceng.metu.edu.tr>,
+%   Dept. of Comp. Eng. METU/Ankara   Turkey
+
 LC_COLLATE
 
 % Base collation scheme: 1994-03-22
@@ -34,7 +39,7 @@ LC_COLLATE
 %     members of equivalence classes
 %  3. A distinction is made with regards
 %     to case as noted below.
-%  4. Special characters are ignored 
+%  4. Special characters are ignored
 %     when comparing letters, but then
 %     they are considered
 %  5. The alphabets are sorted in order
@@ -62,10 +67,10 @@ collating-symbol <SMALL>
 % and Spanish <C><h> being treated
 % as one letter.
 
-% The <a8> ...... <z8> collating 
+% The <a8> ...... <z8> collating
 % symbols have defined weights as
 % the last character in a group of
-% Latin letters. They are used 
+% Latin letters. They are used
 % to specify deltas by locales using
 % a locale as the default ordering
 % and by "replace-after" statements
@@ -987,7 +992,7 @@ UNDEFINED	IGNORE;IGNORE;IGNORE
 <a->	<A>;<MACRON>;<SMALL>;IGNORE
 <A7>	<A>;<MACRON+DOT>;<CAPITAL>;IGNORE
 <a7>	<A>;<MACRON+DOT>;<SMALL>;IGNORE
-<a8>	
+<a8>
 <AE>	"<A><E>";"<AE><AE>";"<CAPITAL><CAPITAL>";IGNORE
 <ae>	"<A><E>";"<AE><AE>";"<SMALL><SMALL>";IGNORE
 <AE'>	"<A><E>";"<AE'><AE'>";"<CAPITAL><CAPITAL>";IGNORE
@@ -1002,7 +1007,7 @@ UNDEFINED	IGNORE;IGNORE;IGNORE
 <b-.>	<B>;<DOT-BELOW>;<SMALL>;IGNORE
 <B_>	<B>;<LINE-BELOW>;<CAPITAL>;IGNORE
 <b_>	<B>;<LINE-BELOW>;<SMALL>;IGNORE
-<b8>	
+<b8>
 <C>	<C>;<NONE>;<CAPITAL>;IGNORE
 <c>	<C>;<NONE>;<SMALL>;IGNORE
 <C'>	<C>;<ACUTE>;<CAPITAL>;IGNORE
@@ -1017,7 +1022,7 @@ UNDEFINED	IGNORE;IGNORE;IGNORE
 <c.>	<C>;<DOT>;<SMALL>;IGNORE
 <C,'>	<C>;<CEDILLA+ACUTE>;<CAPITAL>;IGNORE
 <c,'>	<C>;<CEDILLA+ACUTE>;<SMALL>;IGNORE
-<c8>	
+<c8>
 <C,>	<C,>;<NONE>;<CAPITAL>;IGNORE
 <c,>	<C,>;<NONE>;<SMALL>;IGNORE
 <D>	<D>;<NONE>;<CAPITAL>;IGNORE
@@ -1036,7 +1041,7 @@ UNDEFINED	IGNORE;IGNORE;IGNORE
 <d-/>>	<D>;<MACRON+CIRCUMFLEX>;<SMALL>;IGNORE
 <D_>	<D>;<LINE-BELOW>;<CAPITAL>;IGNORE
 <d_>	<D>;<LINE-BELOW>;<SMALL>;IGNORE
-<d8>	
+<d8>
 <E>	<E>;<NONE>;<CAPITAL>;IGNORE
 <e>	<E>;<NONE>;<SMALL>;IGNORE
 <E'>	<E>;<ACUTE>;<CAPITAL>;IGNORE
@@ -1087,14 +1092,14 @@ UNDEFINED	IGNORE;IGNORE;IGNORE
 <e-!>	<E>;<MACRON+GRAVE>;<SMALL>;IGNORE
 <E-/>>	<E>;<MACRON+CIRCUMFLEX>;<CAPITAL>;IGNORE
 <e-/>>	<E>;<MACRON+CIRCUMFLEX>;<SMALL>;IGNORE
-<e8>	
+<e8>
 <F>	<F>;<NONE>;<CAPITAL>;IGNORE
 <f>	<F>;<NONE>;<SMALL>;IGNORE
 <F2>	<F>;<HOOK>;<CAPITAL>;IGNORE
 <f2>	<F>;<HOOK>;<SMALL>;IGNORE
 <F.>	<F>;<DOT>;<CAPITAL>;IGNORE
 <f.>	<F>;<DOT>;<SMALL>;IGNORE
-<f8>	
+<f8>
 <ff>	"<F><F>";"<NONE><NONE>";"<ff><ff>";IGNORE
 <fi>	"<F><I>";"<NONE><NONE>";"<fi><fi>";IGNORE
 <fl>	"<F><L>";"<NONE><NONE>";"<fl><fl>";IGNORE
@@ -1117,7 +1122,7 @@ UNDEFINED	IGNORE;IGNORE;IGNORE
 <g,>	<G>;<CEDILLA>;<SMALL>;IGNORE
 <G->	<G>;<MACRON>;<CAPITAL>;IGNORE
 <g->	<G>;<MACRON>;<SMALL>;IGNORE
-<g8>	
+<g8>
 <G(>	<G(>;<NONE>;<CAPITAL>;IGNORE
 <g(>	<G(>;<NONE>;<SMALL>;IGNORE
 <H>	<H>;<NONE>;<CAPITAL>;IGNORE
@@ -1136,7 +1141,7 @@ UNDEFINED	IGNORE;IGNORE;IGNORE
 <h//>	<H>;<STROKE>;<SMALL>;IGNORE
 <H,>	<H>;<CEDILLA>;<CAPITAL>;IGNORE
 <h,>	<H>;<CEDILLA>;<SMALL>;IGNORE
-<h8>	
+<h8>
 <I>	<i.>;<NONE>;<CAPITAL>;IGNORE
 <i.>	<i.>;<NONE>;<SMALL>;IGNORE
 <I.>	<I>;<NONE>;<CAPITAL>;IGNORE
@@ -1171,14 +1176,14 @@ UNDEFINED	IGNORE;IGNORE;IGNORE
 <i;>	<I>;<OGONEK>;<SMALL>;IGNORE
 <I->	<I>;<MACRON>;<CAPITAL>;IGNORE
 <i->	<I>;<MACRON>;<SMALL>;IGNORE
-<i8>	
+<i8>
 <IJ>	"<I><J>";"<IJ><IJ>";"<CAPITAL><CAPITAL>";IGNORE
 <ij>	"<I><J>";"<IJ><IJ>";"<SMALL><SMALL>";IGNORE
 <J>	<J>;<NONE>;<CAPITAL>;IGNORE
 <j>	<J>;<NONE>;<SMALL>;IGNORE
 <J/>>	<J>;<CIRCUMFLEX>;<CAPITAL>;IGNORE
 <j/>>	<J>;<CIRCUMFLEX>;<SMALL>;IGNORE
-<j8>	
+<j8>
 <K>	<K>;<NONE>;<CAPITAL>;IGNORE
 <k>	<K>;<NONE>;<SMALL>;IGNORE
 <K'>	<K>;<ACUTE>;<CAPITAL>;IGNORE
@@ -1193,7 +1198,7 @@ UNDEFINED	IGNORE;IGNORE;IGNORE
 <k,>	<K>;<CEDILLA>;<SMALL>;IGNORE
 <K_>	<K>;<LINE-BELOW>;<CAPITAL>;IGNORE
 <k_>	<K>;<LINE-BELOW>;<SMALL>;IGNORE
-<k8>	
+<k8>
 <kk>	<K>;<kk>;<SMALL>;IGNORE
 <L>	<L>;<NONE>;<CAPITAL>;IGNORE
 <l>	<L>;<NONE>;<SMALL>;IGNORE
@@ -1215,7 +1220,7 @@ UNDEFINED	IGNORE;IGNORE;IGNORE
 <l-/>>	<L>;<MACRON+CIRCUMFLEX>;<SMALL>;IGNORE
 <L_>	<L>;<LINE-BELOW>;<CAPITAL>;IGNORE
 <l_>	<L>;<LINE-BELOW>;<SMALL>;IGNORE
-<l8>	
+<l8>
 <M>	<M>;<NONE>;<CAPITAL>;IGNORE
 <m>	<M>;<NONE>;<SMALL>;IGNORE
 <M'>	<M>;<ACUTE>;<CAPITAL>;IGNORE
@@ -1224,7 +1229,7 @@ UNDEFINED	IGNORE;IGNORE;IGNORE
 <m.>	<M>;<DOT>;<SMALL>;IGNORE
 <M-.>	<M>;<DOT-BELOW>;<CAPITAL>;IGNORE
 <m-.>	<M>;<DOT-BELOW>;<SMALL>;IGNORE
-<m8>	
+<m8>
 <N>	<N>;<NONE>;<CAPITAL>;IGNORE
 <n>	<N>;<NONE>;<SMALL>;IGNORE
 <N'>	<N>;<ACUTE>;<CAPITAL>;IGNORE
@@ -1244,7 +1249,7 @@ UNDEFINED	IGNORE;IGNORE;IGNORE
 <N_>	<N>;<LINE-BELOW>;<CAPITAL>;IGNORE
 <n_>	<N>;<LINE-BELOW>;<SMALL>;IGNORE
 <'n>	<N>;<PRECEDED-BY-APOSTROPHE>;<SMALL>;IGNORE
-<n8>	
+<n8>
 <NG>	"<N><G>";"<NG><NG>";"<CAPITAL><CAPITAL>";IGNORE
 <ng>	"<N><G>";"<NG><NG>";"<SMALL><SMALL>";IGNORE
 <O>	<O>;<NONE>;<CAPITAL>;IGNORE
@@ -1312,7 +1317,7 @@ UNDEFINED	IGNORE;IGNORE;IGNORE
 <o9?>	<O>;<HORN+TILDE>;<SMALL>;IGNORE
 <O9-.>	<O>;<HORN+DOT-BELOW>;<CAPITAL>;IGNORE
 <o9-.>	<O>;<HORN+DOT-BELOW>;<SMALL>;IGNORE
-<o8>	
+<o8>
 <O:>	<O:>;<NONE>;<CAPITAL>;IGNORE
 <o:>	<O:>;<NONE>;<SMALL>;IGNORE
 <OE>	"<O><E>";"<OE><OE>";"<CAPITAL><CAPITAL>";IGNORE
@@ -1323,10 +1328,10 @@ UNDEFINED	IGNORE;IGNORE;IGNORE
 <p'>	<P>;<ACUTE>;<SMALL>;IGNORE
 <P.>	<P>;<DOT>;<CAPITAL>;IGNORE
 <p.>	<P>;<DOT>;<SMALL>;IGNORE
-<p8>	
+<p8>
 <Q>	<Q>;<NONE>;<CAPITAL>;IGNORE
 <q>	<Q>;<NONE>;<SMALL>;IGNORE
-<q8>	
+<q8>
 <R>	<R>;<NONE>;<CAPITAL>;IGNORE
 <r>	<R>;<NONE>;<SMALL>;IGNORE
 <R'>	<R>;<ACUTE>;<CAPITAL>;IGNORE
@@ -1347,7 +1352,7 @@ UNDEFINED	IGNORE;IGNORE;IGNORE
 <r--.>	<R>;<MACRON+DOT-BELOW>;<SMALL>;IGNORE
 <R_>	<R>;<LINE-BELOW>;<CAPITAL>;IGNORE
 <r_>	<R>;<LINE-BELOW>;<SMALL>;IGNORE
-<r8>	
+<r8>
 <S>	<S>;<NONE>;<CAPITAL>;IGNORE
 <s>	<S>;<NONE>;<SMALL>;IGNORE
 <st>	"<S><T>";"<NONE><NONE>";"<st><st>";IGNORE
@@ -1367,7 +1372,7 @@ UNDEFINED	IGNORE;IGNORE;IGNORE
 <s-.>	<S>;<DOT-BELOW>;<SMALL>;IGNORE
 <S.-.>	<S>;<DOT+DOT-BELOW>;<CAPITAL>;IGNORE
 <s.-.>	<S>;<DOT+DOT-BELOW>;<SMALL>;IGNORE
-<s8>	
+<s8>
 <S,>	<S,>;<NONE>;<CAPITAL>;IGNORE
 <s,>	<S,>;<NONE>;<SMALL>;IGNORE
 <s1>	<S>;<s1>;<SMALL>;IGNORE
@@ -1388,7 +1393,7 @@ UNDEFINED	IGNORE;IGNORE;IGNORE
 <t-/>>	<T>;<MACRON+CIRCUMFLEX>;<SMALL>;IGNORE
 <T_>	<T>;<LINE-BELOW>;<CAPITAL>;IGNORE
 <t_>	<T>;<LINE-BELOW>;<SMALL>;IGNORE
-<t8>	
+<t8>
 <TH>	"<T><H>";"<TH><TH>";"<CAPITAL><CAPITAL>";IGNORE
 <th>	"<T><H>";"<TH><TH>";"<SMALL><SMALL>";IGNORE
 <U>	<U>;<NONE>;<CAPITAL>;IGNORE
@@ -1451,7 +1456,7 @@ UNDEFINED	IGNORE;IGNORE;IGNORE
 <u9?>	<U>;<HORN+TILDE>;<SMALL>;IGNORE
 <U9-.>	<U>;<HORN+DOT-BELOW>;<CAPITAL>;IGNORE
 <u9-.>	<U>;<HORN+DOT-BELOW>;<SMALL>;IGNORE
-<u8>	
+<u8>
 <U:>	<U:>;<NONE>;<CAPITAL>;IGNORE
 <u:>	<U:>;<NONE>;<SMALL>;IGNORE
 <V>	<V>;<NONE>;<CAPITAL>;IGNORE
@@ -1460,7 +1465,7 @@ UNDEFINED	IGNORE;IGNORE;IGNORE
 <v?>	<V>;<TILDE>;<SMALL>;IGNORE
 <V-.>	<V>;<DOT-BELOW>;<CAPITAL>;IGNORE
 <v-.>	<V>;<DOT-BELOW>;<SMALL>;IGNORE
-<v8>	
+<v8>
 <W>	<W>;<NONE>;<CAPITAL>;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>);(<dz>,<DZ>);/
+	(<e=>,<E=>);(<f3>,<F3>);/
+	(<f=>,<F=>);(<g%>,<G%>);/
+	(<g3>,<G3>);(<g=>,<G=>);/
+	(<h=>,<H=>);(<i=>,<I=>);/
+	(<ie>,<IE>);(<ii>,<II>);/
+	(<io>,<IO>);(<j%>,<J%>);/
+	(<j=>,<J=>);(<ja>,<JA>);/
+	(<je>,<JE>);(<ju>,<JU>);/
+	(<k=>,<K=>);(<kj>,<KJ>);/
+	(<l=>,<L=>);(<lj>,<LJ>);/
+	(<m=>,<M=>);(<n=>,<N=>);/
+	(<nj>,<NJ>);(<o3>,<O3>);/
+	(<o=>,<O=>);(<p=>,<P=>);/
+	(<r=>,<R=>);(<s%>,<S%>);/
+	(<s=>,<S=>);(<sc>,<Sc>);/
+	(<t=>,<T=>);(<ts>,<Ts>);/
+	(<u=>,<U=>);(<v3>,<V3>);/
+	(<v=>,<V=>);(<y3>,<Y3>);/
+	(<y=>,<Y=>);(<yi>,<YI>);/
+	(<z%>,<Z%>);(<z=>,<Z=>);/
+	(<*s>,<S*>)
+
 END LC_CTYPE
 
 LC_MESSAGES
-yesexpr "<<(><I><i><i.><I.><Y><y><)/>><.><*>"
-noexpr  "<<(><n><N><)/>><.><*>"
+yesexpr	"<<(><e><E><)/>><.><*>"
+noexpr	"<<(><h><H><)/>><.><*>"
+yesstr	"<e><v><e><t>"
+nostr	"<h><a><y><i.><r>"
 END LC_MESSAGES
 
 LC_MONETARY
 int_curr_symbol           "<T><R><L><SP>"
-currency_symbol           "<L>"
+currency_symbol           "<T><L>"
 mon_decimal_point         "<,>"
 mon_thousands_sep         "<.>"
-mon_grouping              3;3
+mon_grouping              3
 positive_sign             ""
 negative_sign             "<->"
 int_frac_digits           2
 frac_digits               2
-p_cs_precedes             1
+p_cs_precedes             0
 p_sep_by_space            1
-n_cs_precedes             1
+n_cs_precedes             0
 n_sep_by_space            1
 p_sign_posn               1
 n_sign_posn               1
 END LC_MONETARY
 
 LC_NUMERIC
-decimal_point             "<,>"
+decimal_point             "<.>"
 thousands_sep             ""
-grouping                  0;0
+grouping                  -1
 END LC_NUMERIC
 
 LC_TIME
-abday   "<P><a>";"<P><t>";"<S><a>";/
-        "<C,><a>";"<P><e>";"<C><u>";"<C><t>"
+abday   "<P><a><z>";"<P><z><t>";"<S><a><l>";/
+        "<C,><r><s,>";"<P><r><s,>";"<C><u><m>";"<C><t><s>"
 day     "<P><a><z><a><r>";/
-        "<P><a><z><a><r><t><e><s><i>";/
-        "<S><a><l><i.>";/
-        "<C,><a><r><s,><a><m><b><a>";/
-        "<P><e><r><s,><e><m><b><e>";/
-        "<C><u><m><a>";/
-        "<C><u><m><a><r><t><e><s><i>"
+	"<P><a><z><a><r><t><e><s><i>";/
+	"<S><a><l><i.>";/
+	"<C,><a><r><s,><a><m><b><a>";/
+	"<P><e><r><s,><e><m><b><e>";/
+	"<C><u><m><a>";/
+	"<C><u><m><a><r><t><e><s><i>"
 abmon   "<O><c><a>";"<S,><u><b>";/
-        "<M><a><r>";"<N><i><s>";/
-        "<M><a><y>";"<M><a><z>";/
-        "<F><e><m>";"<A><g(><u>";/
-        "<E><y><l>";"<E><r><i>";/
-        "<K><a><s>";"<A><r><a>"
+	"<M><a><r>";"<N><i><s>";/
+        "<M><a><y>";"<H><a><z>";/
+        "<T><e><m>";"<A><g(><u>";/
+        "<E><y><l>";"<E><k><i>";/
+	"<K><a><s>";"<A><r><a>"
 mon     "<O><c><a><k>";/
-        "<S,><u><b><a><t>";/
-        "<M><a><r><t>";/
-        "<N><i><s><a><n>";/
-        "<M><a><y><i.><s>";/
-        "<M><a><z><i><r><a><n>";/
-        "<F><e><m><m><u><s>";/
-        "<A><g(><u><s><t><o><s>";/
-        "<E><y><l><u><l>";/
-        "<E><r><i><m>";/
-        "<K><a><s><i.><m>";/
-        "<A><r><a><l><i.><k>"
+	"<S,><u><b><a><t>";/
+	"<M><a><r><t>";/
+	"<N><i><s><a><n>";/
+	"<M><a><y><i.><s>";/
+        "<H><a><z><i><r><a><n>";/
+        "<T><e><m><m><u><z>";/
+	"<A><g(><u><s><t><o><s>";/
+        "<E><y><l><u:><l>";/
+        "<E><k><i><m>";/
+	"<K><a><s><i.><m>";/
+	"<A><r><a><l><i.><k>"
 d_t_fmt "<%><a><SP><%><d><SP><%><b><SP><%><Y><SP><%><T><SP><%><Z>"
-d_fmt   "<%><Y><-><%><m><-><%><d>"
+d_fmt   "<%><d><-><%><m><-><%><Y>"
 t_fmt   "<%><T>"
-am_pm   "";""
-t_fmt_ampm ""
+am_pm   "<O:><O:>";"<O:><S>"
+t_fmt_ampm "<%><I><:><%><M><:><%><S><SP><%><p>"
 END LC_TIME
diff --git a/localedata/tests/test1.cm b/localedata/tests/test1.cm
new file mode 100644
index 0000000000..1e0ca8329e
--- /dev/null
+++ b/localedata/tests/test1.cm
@@ -0,0 +1,73 @@
+<code_set_name> BIG5
+<comment_char> %
+<escape_char> /
+<mb_cur_max>  2
+<mb_cur_min>  1
+CHARMAP
+<A>                    /x41
+<B>                    /x42
+<C>                    /x43
+<D>                    /x44
+<E>                    /x45
+<F>                    /x46
+<G>                    /x47
+<H>                    /x48
+<I>                    /x49
+<J>                    /x4A
+<K>                    /x4B
+<L>                    /x4C
+<M>                    /x4D
+<N>                    /x4E
+<O>                    /x4F
+<P>                    /x50
+<Q>                    /x51
+<R>                    /x52
+<S>                    /x53
+<T>                    /x54
+<U>                    /x55
+<V>                    /x56
+<W>                    /x57
+<X>                    /x58
+<Y>                    /x59
+<Z>                    /x5A
+
+<a>                    /x61
+<b>                    /x62
+<c>                    /x63
+<d>                    /x64
+<e>                    /x65
+<f>                    /x66
+<g>                    /x67
+<h>                    /x68
+<i>                    /x69
+<j>                    /x6a
+<k>                    /x6b
+<l>                    /x6c
+<m>                    /x6d
+<n>                    /x6e
+<o>                    /x6f
+<p>                    /x70
+<q>                    /x71
+<r>                    /x72
+<s>                    /x73
+<t>                    /x74
+<u>                    /x75
+<v>                    /x76
+<w>                    /x77
+<x>                    /x78
+<y>                    /x79
+<z>                    /x7a
+<SP>			/x20
+<space>			/x20
+<0>                    /x30
+<1>                    /x31
+<2>                    /x32
+<3>                    /x33
+<4>                    /x34
+<5>                    /x35
+<6>                    /x36
+<7>                    /x37
+<8>                    /x38
+<9>                    /x39
+<B1>...<B3>	/xa1/x40
+END CHARMAP
diff --git a/localedata/tests/test1.def b/localedata/tests/test1.def
new file mode 100644
index 0000000000..56dea5c4bb
--- /dev/null
+++ b/localedata/tests/test1.def
@@ -0,0 +1,9 @@
+LC_CTYPE
+
+upper	<A>
+lower   <a>
+space	<SP>
+blank	<SP>
+alpha	<A>;<a>;<b1>;...;<b3>
+
+END LC_CTYPE
diff --git a/localedata/tests/test2.cm b/localedata/tests/test2.cm
new file mode 100644
index 0000000000..e7e83a7418
--- /dev/null
+++ b/localedata/tests/test2.cm
@@ -0,0 +1,73 @@
+<code_set_name> BIG5
+<comment_char> %
+<escape_char> /
+<mb_cur_max>  2
+<mb_cur_min>  1
+CHARMAP
+<A>                    /x41
+<B>                    /x42
+<C>                    /x43
+<D>                    /x44
+<E>                    /x45
+<F>                    /x46
+<G>                    /x47
+<H>                    /x48
+<I>                    /x49
+<J>                    /x4A
+<K>                    /x4B
+<L>                    /x4C
+<M>                    /x4D
+<N>                    /x4E
+<O>                    /x4F
+<P>                    /x50
+<Q>                    /x51
+<R>                    /x52
+<S>                    /x53
+<T>                    /x54
+<U>                    /x55
+<V>                    /x56
+<W>                    /x57
+<X>                    /x58
+<Y>                    /x59
+<Z>                    /x5A
+
+<a>                    /x61
+<b>                    /x62
+<c>                    /x63
+<d>                    /x64
+<e>                    /x65
+<f>                    /x66
+<g>                    /x67
+<h>                    /x68
+<i>                    /x69
+<j>                    /x6a
+<k>                    /x6b
+<l>                    /x6c
+<m>                    /x6d
+<n>                    /x6e
+<o>                    /x6f
+<p>                    /x70
+<q>                    /x71
+<r>                    /x72
+<s>                    /x73
+<t>                    /x74
+<u>                    /x75
+<v>                    /x76
+<w>                    /x77
+<x>                    /x78
+<y>                    /x79
+<z>                    /x7a
+<SP>			/x20
+<space>			/x20
+<0>                    /x30
+<1>                    /x31
+<2>                    /x32
+<3>                    /x33
+<4>                    /x34
+<5>                    /x35
+<6>                    /x36
+<7>                    /x37
+<8>                    /x38
+<9>                    /x39
+<b01>...<b03>	/xa1/x40
+END CHARMAP
diff --git a/localedata/tests/test2.def b/localedata/tests/test2.def
new file mode 100644
index 0000000000..995daf1776
--- /dev/null
+++ b/localedata/tests/test2.def
@@ -0,0 +1,9 @@
+LC_CTYPE
+
+upper	<A>
+lower   <a>
+space	<SP>
+blank	<SP>
+alpha	<A>;<a>;<b01>;...;<b03>
+
+END LC_CTYPE
diff --git a/localedata/tests/test3.cm b/localedata/tests/test3.cm
new file mode 100644
index 0000000000..4dc88ea919
--- /dev/null
+++ b/localedata/tests/test3.cm
@@ -0,0 +1,73 @@
+<code_set_name> BIG5
+<comment_char> %
+<escape_char> /
+<mb_cur_max>  2
+<mb_cur_min>  1
+CHARMAP
+<A>                    /x41
+<B>                    /x42
+<C>                    /x43
+<D>                    /x44
+<E>                    /x45
+<F>                    /x46
+<G>                    /x47
+<H>                    /x48
+<I>                    /x49
+<J>                    /x4A
+<K>                    /x4B
+<L>                    /x4C
+<M>                    /x4D
+<N>                    /x4E
+<O>                    /x4F
+<P>                    /x50
+<Q>                    /x51
+<R>                    /x52
+<S>                    /x53
+<T>                    /x54
+<U>                    /x55
+<V>                    /x56
+<W>                    /x57
+<X>                    /x58
+<Y>                    /x59
+<Z>                    /x5A
+
+<a>                    /x61
+<b>                    /x62
+<c>                    /x63
+<d>                    /x64
+<e>                    /x65
+<f>                    /x66
+<g>                    /x67
+<h>                    /x68
+<i>                    /x69
+<j>                    /x6a
+<k>                    /x6b
+<l>                    /x6c
+<m>                    /x6d
+<n>                    /x6e
+<o>                    /x6f
+<p>                    /x70
+<q>                    /x71
+<r>                    /x72
+<s>                    /x73
+<t>                    /x74
+<u>                    /x75
+<v>                    /x76
+<w>                    /x77
+<x>                    /x78
+<y>                    /x79
+<z>                    /x7a
+<SP>			/x20
+<space>			/x20
+<0>                    /x30
+<1>                    /x31
+<2>                    /x32
+<3>                    /x33
+<4>                    /x34
+<5>                    /x35
+<6>                    /x36
+<7>                    /x37
+<8>                    /x38
+<9>                    /x39
+<b1>...<b3>	/xa1/x40
+END CHARMAP
diff --git a/localedata/tests/test3.def b/localedata/tests/test3.def
new file mode 100644
index 0000000000..56dea5c4bb
--- /dev/null
+++ b/localedata/tests/test3.def
@@ -0,0 +1,9 @@
+LC_CTYPE
+
+upper	<A>
+lower   <a>
+space	<SP>
+blank	<SP>
+alpha	<A>;<a>;<b1>;...;<b3>
+
+END LC_CTYPE
diff --git a/localedata/tests/test4.cm b/localedata/tests/test4.cm
new file mode 100644
index 0000000000..f0cdf93bd8
--- /dev/null
+++ b/localedata/tests/test4.cm
@@ -0,0 +1,12 @@
+<code_set_name> BIG5
+<escape_char> /
+<mb_cur_max>  2
+<mb_cur_min>  1
+CHARMAP
+<b0101>...<b0103>       /xa1/x40
+<B0101>...<B0103>       /xa1/xa1
+<b0901>...<b0903>       /xa1/x40
+<B0901>...<B0903>       /xa1/xa1
+<b1001>...<b1003>       /xaa/x40
+<B1001>...<B1003>       /xaa/xa1
+END CHARMAP
diff --git a/localedata/tests/test4.def b/localedata/tests/test4.def
new file mode 100644
index 0000000000..3d96d3a88f
--- /dev/null
+++ b/localedata/tests/test4.def
@@ -0,0 +1,7 @@
+LC_COLLATE
+order_start forward
+<b1001>
+<B1001>
+UNDEFINED       IGNORE
+order_end
+END LC_COLLATE
diff --git a/localedata/tst-locale.sh b/localedata/tst-locale.sh
new file mode 100755
index 0000000000..f6182e6daf
--- /dev/null
+++ b/localedata/tst-locale.sh
@@ -0,0 +1,51 @@
+#! /bin/sh
+# Testing the implementation of localedata.
+# Copyright (C) 1998 Free Software Foundation, Inc.
+# This file is part of the GNU C Library.
+# Contributed by Andreas Jaeger, <aj@arthur.rhein-neckar.de>, 1998.
+#
+# 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.
+
+common_objpfx=$1; shift
+
+test_locale ()
+{
+    charmap=$1
+    input=$2
+    out=$3
+    I18NPATH=./locales \
+    ${common_objpfx}elf/ld.so --library-path $common_objpfx \
+    ${common_objpfx}locale/localedef --quiet -c -f $charmap -i $input \
+    ${common_objpfx}localedata/$out
+
+    if [ $? -ne 0 ]; then
+	echo "Charmap: \"${charmap}\" Inputfile: \"${input}\"" \
+	     "Outputdir: \"${out}\" failed"
+	exit 1
+    fi
+}
+
+test_locale IBM437 de_DE de_DE.437
+test_locale tests/test1.cm tests/test1.def test1
+test_locale tests/test2.cm tests/test2.def test2
+test_locale tests/test3.cm tests/test3.def test3
+test_locale tests/test4.cm tests/test4.def test4
+
+exit 0
+
+# Local Variables:
+#  mode:shell-script
+# End:
diff --git a/manual/arith.texi b/manual/arith.texi
index 21b6380fca..3b060689a9 100644
--- a/manual/arith.texi
+++ b/manual/arith.texi
@@ -46,6 +46,7 @@ These functions are declared in the header files @file{math.h} and
 				 division.
 * Parsing of Numbers::          Functions for ``reading'' numbers
 			         from strings.
+* Old-style number conversion:: Low-level number to string conversion.
 @end menu
 
 @node Infinity
@@ -1324,3 +1325,169 @@ need not detect overflow and underflow errors.  The @code{atof} function
 is provided mostly for compatibility with existing code; using
 @code{strtod} is more robust.
 @end deftypefun
+
+
+@node Old-style number conversion
+@subsection Old-style way of converting numbers to strings
+
+The @w{System V} library provided three functions to convert numbers to
+strings which have a unusual and hard-to-be-used semantic.  The GNU C
+library also provides these functions together with some useful
+extensions in the same sense.
+
+Generally, you should avoid using these functions unless the really fit
+into the problem you have to to solve.  Otherwise it is almost always
+better to use @code{sprinf} since it's greater availability (it is an
+@w{ISO C} function).
+
+
+@comment stdlib.h
+@comment SVID, Unix98
+@deftypefun {char *} ecvt (double @var{value}, int @var{ndigit}, int *@var{decpt}, int *@var{sign})
+The function @code{ecvt} converts the floating-point number @var{value}
+to a string with at most @var{ndigit} decimal digits.  If @code{ndigit}
+is greater than the accuracy of the @code{double} floating-point type
+the implementation can shorten @var{ndigit} to a reasonable value. The
+returned string neither contains decimal point nor sign. The high-order
+digit of the string is non-zero (unless @var{value} is actually zero)
+and the low-order digit is rounded. The variable pointed to by
+@var{decpt} gets the position of the decimal character relative to the
+start of the string. If @var{value} is negativ, @var{sign} is set to a
+non-zero value, otherwise to 0.
+
+The returned string is statically allocated and overwritten by each call
+to @code{ecvt}.
+
+If @var{value} is zero, it's implementation defined if @var{decpt} is
+@code{0} or @code{1}.
+
+The prototype for this function can be found in @file{stdlib.h}.
+@end deftypefun
+
+As an example @code{ecvt (12.3, 5, &decpt, &sign)} returns @code{"12300"}
+and sets @var{decpt} to @code{2} and @var{sign} to @code{0}.
+
+@comment stdlib.h
+@comment SVID, Unix98
+@deftypefun {char *} fcvt (double @var{value}, int @var{ndigit}, int @var{decpt}, int *@var{sign})
+The function @code{fcvt} is similar to @code{ecvt} with the difference
+that @var{ndigit} specifies the digits after the decimal point.  If
+@var{ndigit} is less than zero, @var{value} is rounded to the left of
+the decimal point upto the reasonable limit (e.g., @math{123.45} is only
+rounded to the third digit before the decimal point, even if
+@var{ndigit} is less than @math{-3}).
+
+The returned string is statically allocated and overwritten by each call
+to @code{fcvt}.
+
+The prototype for this function can be found in @file{stdlib.h}.
+@end deftypefun
+
+@comment stdlib.h
+@comment SVID, Unix98
+@deftypefun {char *} gcvt (double @var{value}, int @var{ndigit}, char *@var{buf})
+The @code{gcvt} function also converts @var{value} to a NUL terminated
+string but does in a way similar to the @code{%g} format of
+@code{printf}.  It also does not use a static buffer but instead uses
+the user-provided buffer starting at @var{buf}.  It is the user's
+responsibility to make sure the buffer is long enough to contain the
+result.  Unlike the @code{ecvt} and @code{fcvt} function @code{gcvt}
+includes the sign and the decimal point character (which is determined
+according to the current locale) in the result.  Therefore there are yet
+less reasons to use this function instead of @code{printf}.
+
+The return value is @var{buf}.
+
+The prototype for this function can be found in @file{stdlib.h}.
+@end deftypefun
+
+
+All these three functions have in common that they use @code{double}
+values as the parameters.  Calling these functions using @code{long
+double} values would mean a loss of precision due to the implicit
+rounding.  Therefore the GNU C library contains three more functions
+with similar semantic which take @code{long double} values.
+
+@comment stdlib.h
+@comment GNU
+@deftypefun {char *} qecvt (long double @var{value}, int @var{ndigit}, int *@var{decpt}, int *@var{sign})
+This function is equivalent to the @code{ecvt} function except that it
+takes an @code{long double} value for the first parameter.
+
+This function is a GNU extension.  The prototype can be found in
+@file{stdlib.h}.
+@end deftypefun
+
+@comment stdlib.h
+@comment GNU
+@deftypefun {char *} qfcvt (long double @var{value}, int @var{ndigit}, int @var{decpt}, int *@var{sign})
+This function is equivalent to the @code{fcvt} function except that it
+takes an @code{long double} value for the first parameter.
+
+This function is a GNU extension.  The prototype can be found in
+@file{stdlib.h}.
+@end deftypefun
+
+@comment stdlib.h
+@comment GNU
+@deftypefun {char *} qgcvt (long double @var{value}, int @var{ndigit}, char *@var{buf})
+This function is equivalent to the @code{gcvt} function except that it
+takes an @code{long double} value for the first parameter.
+
+This function is a GNU extension.  The prototype can be found in
+@file{stdlib.h}.
+@end deftypefun
+
+
+@cindex gcvt_r
+As said above the @code{ecvt} and @code{fcvt} function along with their
+@code{long double} equivalents have the problem that they return a value
+located in a static buffer which is overwritten by the next call of the
+function.  This limitation is lifted in yet another set of functions
+which also are GNU extensions.  These reentrant functions can be
+recognized by the by the conventional @code{_r} ending.  Obviously there
+is no need for a @code{gcvt_r} function.
+
+@comment stdlib.h
+@comment GNU
+@deftypefun {char *} ecvt_r (double @var{value}, int @var{ndigit}, int *@var{decpt}, int *@var{sign}, char *@var{buf}, size_t @var{len})
+The @code{ecvt_r} function is similar to the @code{ecvt} function except
+that it places its result into the user-specified buffer starting at
+@var{buf}.
+
+This function is a GNU extension.  The prototype can be found in
+@file{stdlib.h}.
+@end deftypefun
+
+@comment stdlib.h
+@comment SVID, Unix98
+@deftypefun {char *} fcvt_r (double @var{value}, int @var{ndigit}, int @var{decpt}, int *@var{sign}, char *@var{buf}, size_t @var{len})
+The @code{fcvt_r} function is similar to the @code{fcvt} function except
+that it places its result into the user-specified buffer starting at
+@var{buf}.
+
+This function is a GNU extension.  The prototype can be found in
+@file{stdlib.h}.
+@end deftypefun
+
+@comment stdlib.h
+@comment GNU
+@deftypefun {char *} qecvt_r (long double @var{value}, int @var{ndigit}, int *@var{decpt}, int *@var{sign}, char *@var{buf}, size_t @var{len})
+The @code{qecvt_r} function is similar to the @code{qecvt} function except
+that it places its result into the user-specified buffer starting at
+@var{buf}.
+
+This function is a GNU extension.  The prototype can be found in
+@file{stdlib.h}.
+@end deftypefun
+
+@comment stdlib.h
+@comment GNU
+@deftypefun {char *} qfcvt (long double @var{value}, int @var{ndigit}, int @var{decpt}, int *@var{sign}, char *@var{buf}, size_t @var{len})
+The @code{qfcvt_r} function is similar to the @code{qfcvt} function except
+that it places its result into the user-specified buffer starting at
+@var{buf}.
+
+This function is a GNU extension.  The prototype can be found in
+@file{stdlib.h}.
+@end deftypefun
diff --git a/nis/nss_nisplus/nisplus-alias.c b/nis/nss_nisplus/nisplus-alias.c
index 732c02dbfa..a189d282ca 100644
--- a/nis/nss_nisplus/nisplus-alias.c
+++ b/nis/nss_nisplus/nisplus-alias.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1997, 1998 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997.
 
@@ -93,9 +93,9 @@ _nss_nisplus_parse_aliasent (nis_result *result, unsigned long entry,
 	}
       else
 	{
-	  strncpy (buffer, NISENTRYVAL (entry, 1, result),
-		   NISENTRYLEN (entry, 1, result));
-	  buffer[NISENTRYLEN (entry, 1, result)] = '\0';
+	  cp = __stpncpy (buffer, NISENTRYVAL (entry, 1, result),
+			 NISENTRYLEN (entry, 1, result));
+	  *cp = '\0';
 	}
 
       if (NISENTRYLEN(entry, 0, result) >= room_left)
@@ -105,8 +105,9 @@ _nss_nisplus_parse_aliasent (nis_result *result, unsigned long entry,
       alias->alias_members_len = 0;
       *first_unused = '\0';
       ++first_unused;
-      strcpy (first_unused, NISENTRYVAL (entry, 0, result));
-      first_unused[NISENTRYLEN (entry, 0, result)] = '\0';
+      cp = __stpncpy (first_unused, NISENTRYVAL (entry, 0, result),
+		      NISENTRYLEN (entry, 0, result));
+      *cp = '\0';
       alias->alias_name = first_unused;
 
       /* Terminate the line for any case.  */
diff --git a/nis/nss_nisplus/nisplus-hosts.c b/nis/nss_nisplus/nisplus-hosts.c
index 3b022b6df7..375315b2ed 100644
--- a/nis/nss_nisplus/nisplus-hosts.c
+++ b/nis/nss_nisplus/nisplus-hosts.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1997, 1998 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997.
 
@@ -107,7 +107,7 @@ _nss_nisplus_parse_hostent (nis_result *result, int af, struct hostent *host,
   p = first_unused;
 
   line = p;
-  for (i = 0; i < result->objects.objects_len; i++)
+  for (i = 0; i < result->objects.objects_len; ++i)
     {
       if (strcmp (NISENTRYVAL (i, 1, result), host->h_name) != 0)
 	{
@@ -121,8 +121,9 @@ _nss_nisplus_parse_hostent (nis_result *result, int af, struct hostent *host,
 	  room_left -= (NISENTRYLEN (i, 1, result) + 1);
 	}
     }
-  ++p;
+  *p++ = '\0';
   first_unused = p;
+
   /* Adjust the pointer so it is aligned for
      storing pointers.  */
   first_unused += __alignof__ (char *) - 1;
@@ -142,7 +143,7 @@ _nss_nisplus_parse_hostent (nis_result *result, int af, struct hostent *host,
     {
       /* Skip leading blanks.  */
       while (isspace (*line))
-	line++;
+	++line;
 
       if (*line == '\0')
 	break;
diff --git a/nis/nss_nisplus/nisplus-network.c b/nis/nss_nisplus/nisplus-network.c
index b39a54fe03..f152c49f11 100644
--- a/nis/nss_nisplus/nisplus-network.c
+++ b/nis/nss_nisplus/nisplus-network.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1997, 1998 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997.
 
@@ -79,7 +79,7 @@ _nss_nisplus_parse_netent (nis_result *result, struct netent *network,
   p = first_unused;
 
   line = p;
-  for (i = 0; i < result->objects.objects_len; i++)
+  for (i = 0; i < result->objects.objects_len; ++i)
     {
       if (strcmp (NISENTRYVAL (i, 1, result), network->n_name) != 0)
         {
@@ -93,7 +93,7 @@ _nss_nisplus_parse_netent (nis_result *result, struct netent *network,
           room_left -= (NISENTRYLEN (i, 1, result) + 1);
         }
     }
-  ++p;
+  *p++ = '\0';
   first_unused = p;
 
   /* Adjust the pointer so it is aligned for
@@ -106,7 +106,7 @@ _nss_nisplus_parse_netent (nis_result *result, struct netent *network,
   room_left -= (2 * sizeof (char *));
   network->n_aliases[0] = NULL;
 
-    i = 0;
+  i = 0;
   while (*line != '\0')
     {
       /* Skip leading blanks.  */
@@ -125,17 +125,14 @@ _nss_nisplus_parse_netent (nis_result *result, struct netent *network,
       while (*line != '\0' && *line != ' ')
         ++line;
 
-      if (line != network->n_aliases[i])
-        {
-          if (*line != '\0')
-            {
-              *line = '\0';
-              ++line;
-            }
+      if (*line == ' ')
+	{
+	  *line = '\0';
+	  ++line;
           ++i;
         }
       else
-        network->n_aliases[i] = NULL;
+        network->n_aliases[i+1] = NULL;
     }
 
   return 1;
@@ -385,39 +382,57 @@ _nss_nisplus_getnetbyaddr_r (const unsigned long addr, const int type,
     nis_result *result;
     char buf[1024 + tablename_len];
     struct in_addr in;
+    char buf2[256];
+    int b2len;
 
     in = inet_makeaddr (addr, 0);
-    sprintf (buf, "[addr=%s],%s", inet_ntoa (in), tablename_val);
-
-    result = nis_list (buf, EXPAND_NAME, NULL, NULL);
+    strcpy (buf2, inet_ntoa (in));
+    b2len = strlen (buf2);
 
-    retval = niserr2nss (result->status);
-    if (retval != NSS_STATUS_SUCCESS)
+    while (1)
       {
-	if (retval == NSS_STATUS_TRYAGAIN)
+	sprintf (buf, "[addr=%s],%s", buf2, tablename_val);
+	result = nis_list (buf, EXPAND_NAME, NULL, NULL);
+
+	retval = niserr2nss (result->status);
+	if (retval != NSS_STATUS_SUCCESS)
 	  {
-	    *errnop = errno;
-	    *herrnop = NETDB_INTERNAL;
+	    if (buf2[b2len -2] == '.' && buf2[b2len -1] == '0')
+	      {
+		/* Try again, but with trailing dot(s)
+		   removed (one by one) */
+		buf2[b2len - 2] = '\0';
+		b2len -= 2;
+		continue;
+	      }
+	    else
+	      return NSS_STATUS_NOTFOUND;
+
+	    if (retval == NSS_STATUS_TRYAGAIN)
+	      {
+		*errnop = errno;
+		*herrnop = NETDB_INTERNAL;
+	      }
+	    nis_freeresult (result);
+	    return retval;
 	  }
-	nis_freeresult (result);
-	return retval;
-      }
 
-    parse_res = _nss_nisplus_parse_netent (result, network, buffer, buflen,
-					   errnop);
+	parse_res = _nss_nisplus_parse_netent (result, network, buffer,
+					       buflen, errnop);
 
-    nis_freeresult (result);
+	nis_freeresult (result);
 
-    if (parse_res > 0)
-      return NSS_STATUS_SUCCESS;
+	if (parse_res > 0)
+	  return NSS_STATUS_SUCCESS;
 
-    *herrnop = NETDB_INTERNAL;
-    if (parse_res == -1)
-      {
-	*errnop = ERANGE;
-	return NSS_STATUS_TRYAGAIN;
+	*herrnop = NETDB_INTERNAL;
+	if (parse_res == -1)
+	  {
+	    *errnop = ERANGE;
+	    return NSS_STATUS_TRYAGAIN;
+	  }
+	else
+	  return NSS_STATUS_NOTFOUND;
       }
-    else
-      return NSS_STATUS_NOTFOUND;
   }
 }
diff --git a/nis/nss_nisplus/nisplus-proto.c b/nis/nss_nisplus/nisplus-proto.c
index aa2271c385..d121b2f83c 100644
--- a/nis/nss_nisplus/nisplus-proto.c
+++ b/nis/nss_nisplus/nisplus-proto.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1997, 1998 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997.
 
@@ -79,7 +79,7 @@ _nss_nisplus_parse_protoent (nis_result * result, struct protoent *proto,
   p = first_unused;
 
   line = p;
-  for (i = 0; i < result->objects.objects_len; i++)
+  for (i = 0; i < result->objects.objects_len; ++i)
     {
       if (strcmp (NISENTRYVAL (i, 1, result), proto->p_name) != 0)
         {
@@ -92,7 +92,7 @@ _nss_nisplus_parse_protoent (nis_result * result, struct protoent *proto,
           room_left -= (NISENTRYLEN (i, 1, result) + 1);
         }
     }
-  ++p;
+  *p++ = '\0';
   first_unused = p;
 
   /* Adjust the pointer so it is aligned for
diff --git a/nis/nss_nisplus/nisplus-rpc.c b/nis/nss_nisplus/nisplus-rpc.c
index 105e80241b..9dc412e581 100644
--- a/nis/nss_nisplus/nisplus-rpc.c
+++ b/nis/nss_nisplus/nisplus-rpc.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1997, 1998 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997.
 
@@ -69,13 +69,13 @@ _nss_nisplus_parse_rpcent (nis_result *result, struct rpcent *rpc,
            NISENTRYLEN (0, 0, result));
   first_unused[NISENTRYLEN (0, 0, result)] = '\0';
   rpc->r_name = first_unused;
-  room_left -= strlen (first_unused) + 1;
+  room_left -= (strlen (first_unused) + 1);
   first_unused += strlen (first_unused) + 1;
   rpc->r_number = atoi (NISENTRYVAL (0, 2, result));
   p = first_unused;
 
   line = p;
-  for (i = 0; i < result->objects.objects_len; i++)
+  for (i = 0; i < result->objects.objects_len; ++i)
     {
       if (strcmp (NISENTRYVAL (i, 1, result), rpc->r_name) != 0)
         {
@@ -106,7 +106,7 @@ _nss_nisplus_parse_rpcent (nis_result *result, struct rpcent *rpc,
     {
       /* Skip leading blanks.  */
       while (isspace (*line))
-        line++;
+        ++line;
 
       if (*line == '\0')
         break;
@@ -120,17 +120,14 @@ _nss_nisplus_parse_rpcent (nis_result *result, struct rpcent *rpc,
       while (*line != '\0' && *line != ' ')
         ++line;
 
-      if (line != rpc->r_aliases[i])
+      if (*line == ' ')
         {
-          if (*line != '\0')
-            {
-              *line = '\0';
-              ++line;
-            }
+	  *line = '\0';
+	  ++line;
           ++i;
         }
       else
-        rpc->r_aliases[i] = NULL;
+        rpc->r_aliases[i+1] = NULL;
     }
 
   return 1;
diff --git a/nis/nss_nisplus/nisplus-service.c b/nis/nss_nisplus/nisplus-service.c
index 8f681d3e1c..04fed59808 100644
--- a/nis/nss_nisplus/nisplus-service.c
+++ b/nis/nss_nisplus/nisplus-service.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1997, 1998 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997.
 
@@ -84,7 +84,7 @@ _nss_nisplus_parse_servent (nis_result *result, struct servent *serv,
   p = first_unused;
 
   line = p;
-  for (i = 0; i < result->objects.objects_len; i++)
+  for (i = 0; i < result->objects.objects_len; ++i)
     {
       if (strcmp (NISENTRYVAL (i, 1, result), serv->s_name) != 0)
         {
@@ -97,7 +97,7 @@ _nss_nisplus_parse_servent (nis_result *result, struct servent *serv,
           room_left -= (NISENTRYLEN (i, 1, result) + 1);
         }
     }
-  ++p;
+  *p++ = '\0';
   first_unused = p;
 
   /* Adjust the pointer so it is aligned for
diff --git a/po/Makefile b/po/Makefile
index d0711952b0..4056201c9f 100644
--- a/po/Makefile
+++ b/po/Makefile
@@ -81,7 +81,9 @@ ifneq (,$(pofiles))
 	chmod 444 $@
 
 linguas: $(pofiles:$(podir)/%=%)
+ifeq ($(with-cvs),yes)
 	test ! -d CVS || cvs $(CVSOPTS) commit -m'Copied from $(podir)' $^
+endif
 linguas.mo: $(pofiles:$(podir)/%.po=%.mo)
 
 endif
diff --git a/posix/Makefile b/posix/Makefile
index a055222915..5927f31335 100644
--- a/posix/Makefile
+++ b/posix/Makefile
@@ -77,7 +77,9 @@ lib: $(objpfx)libposix.a
 testcases.h: TESTS TESTS2C.sed
 	sed -f TESTS2C.sed < $< > $@T
 	mv -f $@T $@
+ifeq ($(with-cvs),yes)
 	test ! -d CVS || cvs $(CVSOPTS) commit -mRegenerated $@
+endif
 
 # Make the standalone glob/fnmatch package.
 
@@ -95,13 +97,17 @@ glob/%.h: %.h
 
 glob/configure: glob/configure.in
 	cd glob; autoconf $(ACFLAGS)
+ifeq ($(with-cvs),yes)
 	test ! -d CVS || cvs $(CVSOPTS) commit -m'Regenerated: autoconf $(ACFLAGS) $<' $@
+endif
 
 glob/ChangeLog: ../ChangeLog
 	changelog-extract --regexp 'posix/(glob|fnmatch).*' < $< > $@.new
 	chmod a-w $@.new
 	mv -f $@.new $@
+ifeq ($(with-cvs),yes)
 	test ! -d CVS || cvs $(CVSOPTS) commit -mRegenerated $@
+endif
 
 %.Z: %
 	compress -c $< > $@-tmp
diff --git a/stdlib/Makefile b/stdlib/Makefile
index 6db064d543..85a5347d32 100644
--- a/stdlib/Makefile
+++ b/stdlib/Makefile
@@ -113,7 +113,9 @@ $(mpn-copy): %: $(ignore gmp2glibc.sed) $(gmp-srcdir)/%; $(gmp2glibc)
 .PHONY: copy-mpn clean-mpn mpn-stuff
 mpn-stuff: $(mpn-stuff)
 copy-mpn: $(mpn-stuff)
+ifeq ($(with-cvs),yes)
 	test ! -d CVS || cvs $(CVSOPTS) commit -m'Updated from $(gmp-srcdir)' $+
+endif
 clean-mpn:
 	rm -f $(mpn-stuff)
 
diff --git a/sunrpc/Makefile b/sunrpc/Makefile
index efc826530f..345a23a3dd 100644
--- a/sunrpc/Makefile
+++ b/sunrpc/Makefile
@@ -118,7 +118,7 @@ $(objpfx)rpcgen: $(addprefix $(objpfx),$(rpcgen-objs)) \
 
 # Tell rpcgen that it should unset LD_LIBRARY_PATH before executing the
 # preprocessor.
-rpcgen-cmd = $(built-program-cmd) -$$
+rpcgen-cmd = $(built-program-cmd)
 
 # The proper file name is longer than 14 chars, so we install it under
 # a shorter name.  But if the filesystem can handle it, we want to
diff --git a/sunrpc/proto.h b/sunrpc/proto.h
index 6d2747f728..30ef18856b 100644
--- a/sunrpc/proto.h
+++ b/sunrpc/proto.h
@@ -1,14 +1,12 @@
 /****** rpc_clntout.c ******/
 
 void write_stubs(void);
-void printarglist(proc_list *proc,
+void printarglist(proc_list *proc, const char *result,
 		  const char *addargname, const char *addargtype);
 
 /****** rpc_cout.c ******/
 
-void emit(definition *def);
-void emit_inline(declaration *decl, int flag);
-void emit_single_in_line(declaration *decl, int flag, relation rel);
+void emit (definition *def);
 
 /****** rpc_hout.c ******/
 
@@ -19,6 +17,7 @@ void pprocdef(proc_list *proc, version_list *vp,
 	      const char *addargtype, int server_p, int mode);
 void pdeclaration(const char *name, declaration *dec, int tab,
 		  const char *separator);
+void print_xdr_func_def (char* name, int pointerp, int i);
 
 /****** rpc_main.c ******/
 	/* nil */
diff --git a/sunrpc/rpc_clntout.c b/sunrpc/rpc_clntout.c
index fb086047ba..0b4f645c07 100644
--- a/sunrpc/rpc_clntout.c
+++ b/sunrpc/rpc_clntout.c
@@ -60,9 +60,9 @@ write_stubs (void)
   list *l;
   definition *def;
 
-  f_print (fout,
+  fprintf (fout,
 	   "\n/* Default timeout can be changed using clnt_control() */\n");
-  f_print (fout, "static struct timeval TIMEOUT = { %d, 0 };\n",
+  fprintf (fout, "static struct timeval TIMEOUT = { %d, 0 };\n",
 	   DEFAULT_TIMEOUT);
   for (l = defined; l != NULL; l = l->next)
     {
@@ -84,14 +84,23 @@ write_program (definition * def)
     {
       for (proc = vp->procs; proc != NULL; proc = proc->next)
 	{
-	  f_print (fout, "\n");
-	  ptype (proc->res_prefix, proc->res_type, 1);
-	  f_print (fout, "*\n");
-	  pvname (proc->proc_name, vp->vers_num);
-	  printarglist (proc, "clnt", "CLIENT *");
-	  f_print (fout, "{\n");
+	  fprintf (fout, "\n");
+	  if (mtflag == 0)
+	    {
+	      ptype (proc->res_prefix, proc->res_type, 1);
+	      fprintf (fout, "*\n");
+	      pvname (proc->proc_name, vp->vers_num);
+	      printarglist (proc, RESULT, "clnt", "CLIENT *");
+	    }
+	  else
+	    {
+	      fprintf (fout, "enum clnt_stat \n");
+	      pvname (proc->proc_name, vp->vers_num);
+	      printarglist (proc, RESULT, "clnt", "CLIENT *");
+	    }
+	  fprintf (fout, "{\n");
 	  printbody (proc);
-	  f_print (fout, "}\n");
+	  fprintf (fout, "}\n");
 	}
     }
 }
@@ -104,67 +113,109 @@ write_program (definition * def)
 /* sample addargname = "clnt"; sample addargtype = "CLIENT * " */
 
 void
-printarglist (proc_list * proc,
+printarglist (proc_list * proc,  const char *result,
 	      const char *addargname, const char *addargtype)
 {
 
   decl_list *l;
 
   if (!newstyle)
-    {				/* old style: always pass argument by reference */
+    { /* old style: always pass argument by reference */
       if (Cflag)
 	{			/* C++ style heading */
-	  f_print (fout, "(");
-	  ptype (proc->args.decls->decl.prefix, proc->args.decls->decl.type, 1);
-	  f_print (fout, "*argp, %s%s)\n", addargtype, addargname);
+	  fprintf (fout, "(");
+	  ptype (proc->args.decls->decl.prefix,
+		 proc->args.decls->decl.type, 1);
+
+	  if (mtflag)
+	    {/* Generate result field */
+	      fprintf (fout, "*argp, ");
+	      ptype(proc->res_prefix, proc->res_type, 1);
+	      fprintf (fout, "*%s, %s%s)\n", result, addargtype, addargname);
+	    }
+	  else
+	    fprintf (fout, "*argp, %s%s)\n", addargtype, addargname);
 	}
       else
 	{
-	  f_print (fout, "(argp, %s)\n", addargname);
-	  f_print (fout, "\t");
-	  ptype (proc->args.decls->decl.prefix, proc->args.decls->decl.type, 1);
-	  f_print (fout, "*argp;\n");
+	  if (!mtflag)
+	    fprintf (fout, "(argp, %s)\n", addargname);
+	  else
+	    fprintf (fout, "(argp, %s, %s)\n", result, addargname);
+	  fprintf (fout, "\t");
+	  ptype (proc->args.decls->decl.prefix,
+		 proc->args.decls->decl.type, 1);
+	  fprintf (fout, "*argp;\n");
+	  if (mtflag)
+	    {
+	      fprintf (fout, "\t");
+	      ptype (proc->res_prefix, proc->res_type, 1);
+	      fprintf (fout, "*%s;\n", result);
+	    }
 	}
     }
   else if (streq (proc->args.decls->decl.type, "void"))
     {
       /* newstyle, 0 argument */
-      if (Cflag)
-	f_print (fout, "(%s%s)\n", addargtype, addargname);
+      if (mtflag)
+	{
+	  fprintf (fout, "(");
+	  if (Cflag)
+	    {
+	      ptype(proc->res_prefix, proc->res_type, 1);
+	      fprintf (fout, "*%s, %s%s)\n", result, addargtype, addargname);
+	    }
+	  else
+	    fprintf (fout, "(%s)\n", addargname);
+	}
+      else if (Cflag)
+	fprintf (fout, "(%s%s)\n", addargtype, addargname);
       else
-	f_print (fout, "(%s)\n", addargname);
+	fprintf (fout, "(%s)\n", addargname);
     }
   else
     {
       /* new style, 1 or multiple arguments */
       if (!Cflag)
 	{
-	  f_print (fout, "(");
+	  fprintf (fout, "(");
 	  for (l = proc->args.decls; l != NULL; l = l->next)
-	    f_print (fout, "%s, ", l->decl.name);
-	  f_print (fout, "%s)\n", addargname);
+	    fprintf (fout, "%s, ", l->decl.name);
+	  if (mtflag)
+	    fprintf (fout, "%s, ", result);
+ 	  fprintf (fout, "%s)\n", addargname);
 	  for (l = proc->args.decls; l != NULL; l = l->next)
 	    {
 	      pdeclaration (proc->args.argname, &l->decl, 1, ";\n");
 	    }
+	  if (mtflag)
+	    {
+	      fprintf (fout, "\t");
+	      ptype (proc->res_prefix, proc->res_type, 1);
+	      fprintf (fout, "*%s;\n", result);
+	    }
 	}
       else
 	{			/* C++ style header */
-	  f_print (fout, "(");
+	  fprintf (fout, "(");
 	  for (l = proc->args.decls; l != NULL; l = l->next)
 	    {
 	      pdeclaration (proc->args.argname, &l->decl, 0, ", ");
 	    }
-	  f_print (fout, " %s%s)\n", addargtype, addargname);
+	  if (mtflag)
+	    {
+	      ptype (proc->res_prefix, proc->res_type, 1);
+	      fprintf (fout, "*%s, ", result);
+	    }
+ 	  fprintf (fout, " %s%s)\n", addargtype, addargname);
 	}
     }
 
   if (!Cflag)
-    f_print (fout, "\t%s%s;\n", addargtype, addargname);
+    fprintf (fout, "\t%s%s;\n", addargtype, addargname);
 }
 
 
-
 static
 const char *
 ampr (const char *type)
@@ -190,66 +241,102 @@ printbody (proc_list * proc)
      to stuff the arguments. */
   if (newstyle && args2)
     {
-      f_print (fout, "\t%s", proc->args.argname);
-      f_print (fout, " arg;\n");
-    }
-  f_print (fout, "\tstatic ");
-  if (streq (proc->res_type, "void"))
-    {
-      f_print (fout, "char ");
+      fprintf (fout, "\t%s", proc->args.argname);
+      fprintf (fout, " arg;\n");
     }
-  else
+  if (!mtflag)
     {
-      ptype (proc->res_prefix, proc->res_type, 0);
+      fprintf (fout, "\tstatic ");
+      if (streq (proc->res_type, "void"))
+	{
+	  fprintf (fout, "char ");
+	}
+      else
+	{
+	  ptype (proc->res_prefix, proc->res_type, 0);
+	}
+      fprintf (fout, "%s;\n", RESULT);
+      fprintf (fout, "\n");
+      fprintf (fout, "\tmemset((char *)%s%s, 0, sizeof(%s));\n",
+	       ampr (proc->res_type), RESULT, RESULT);
     }
-  f_print (fout, "%s;\n", RESULT);
-  f_print (fout, "\n");
-  f_print (fout, "\tmemset((char *)%s%s, 0, sizeof(%s));\n",
-	   ampr (proc->res_type), RESULT, RESULT);
   if (newstyle && !args2 && (streq (proc->args.decls->decl.type, "void")))
     {
       /* newstyle, 0 arguments */
-      f_print (fout,
-	       "\tif (clnt_call(clnt, %s, xdr_void", proc->proc_name);
-      f_print (fout,
-	       ", NULL, xdr_%s, %s,%s, TIMEOUT) != RPC_SUCCESS) {\n",
-	       stringfix (proc->res_type), ampr (proc->res_type), RESULT);
+      if (mtflag)
+	fprintf (fout, "\t return ");
+      else
+	fprintf (fout, "\t if ");
+      fprintf (fout,
+	       "(clnt_call (clnt, %s, (xdrproc_t) xdr_void", proc->proc_name);
 
+      fprintf (fout,
+	       "(caddr_t) NULL,\n\t\t(xdrproc_t) xdr_%s, (caddr_t) %s%s,",
+	       stringfix(proc->res_type), (mtflag)?"":ampr(proc->res_type),
+	       RESULT);
+      if (mtflag)
+	fprintf (fout, "\n\t\tTIMEOUT));\n}\n");
+      else
+	fprintf (fout, "\n\t\tTIMEOUT) != RPC_SUCCESS) {\n");
     }
   else if (newstyle && args2)
     {
       /* newstyle, multiple arguments:  stuff arguments into structure */
       for (l = proc->args.decls; l != NULL; l = l->next)
 	{
-	  f_print (fout, "\targ.%s = %s;\n",
+	  fprintf (fout, "\targ.%s = %s;\n",
 		   l->decl.name, l->decl.name);
 	}
-      f_print (fout,
-	       "\tif (clnt_call(clnt, %s, xdr_%s", proc->proc_name,
+      if (mtflag)
+	fprintf (fout, "\treturn ");
+      else
+	fprintf (fout, "\tif ");
+
+      fprintf (fout,
+	       "(clnt_call (clnt, %s, (xdrproc_t) xdr_%s", proc->proc_name,
 	       proc->args.argname);
-      f_print (fout,
-	       ", &arg, xdr_%s, %s%s, TIMEOUT) != RPC_SUCCESS) {\n",
-	       stringfix (proc->res_type), ampr (proc->res_type), RESULT);
+      fprintf (fout,
+	       ", (caddr_t) &arg,\n\t\t(xdrproc_t) xdr_%s, (caddr_t) %s%s,",
+	       stringfix(proc->res_type), (mtflag)?"":ampr(proc->res_type),
+	       RESULT);
+      if (mtflag)
+	fprintf (fout, "\n\t\tTIMEOUT));\n");
+      else
+	fprintf (fout, "\n\t\tTIMEOUT) != RPC_SUCCESS) {\n");
     }
   else
     {				/* single argument, new or old style */
-      f_print (fout,
-	       "\tif (clnt_call(clnt, %s, xdr_%s, %s%s, xdr_%s, %s%s, TIMEOUT) != RPC_SUCCESS) {\n",
-	       proc->proc_name,
-	       stringfix (proc->args.decls->decl.type),
-	       (newstyle ? "&" : ""),
-	       (newstyle ? proc->args.decls->decl.name : "argp"),
-	       stringfix (proc->res_type), ampr (proc->res_type), RESULT);
-    }
-  f_print (fout, "\t\treturn (NULL);\n");
-  f_print (fout, "\t}\n");
-  if (streq (proc->res_type, "void"))
-    {
-      f_print (fout, "\treturn ((void *)%s%s);\n",
-	       ampr (proc->res_type), RESULT);
+      if (!mtflag)
+	fprintf (fout,
+		 "\tif (clnt_call (clnt, %s,\n\t\t(xdrproc_t) xdr_%s, (caddr_t) %s%s,\n\t\t(xdrproc_t) xdr_%s, (caddr_t) %s%s,\n\t\tTIMEOUT) != RPC_SUCCESS) {\n",
+		 proc->proc_name,
+		 stringfix (proc->args.decls->decl.type),
+		 (newstyle ? "&" : ""),
+		 (newstyle ? proc->args.decls->decl.name : "argp"),
+		 stringfix (proc->res_type), ampr (proc->res_type),
+		 RESULT);
+      else
+	fprintf(fout,
+		"\treturn (clnt_call(clnt, %s,\n\t\t(xdrproc_t) xdr_%s, (caddr_t) %s%s,\n\t\t(xdrproc_t) xdr_%s, (caddr_t) %s%s,\n\t\tTIMEOUT));\n",
+		proc->proc_name,
+		stringfix (proc->args.decls->decl.type),
+		(newstyle ? "&" : ""),
+		(newstyle ? proc->args.decls->decl.name : "argp"),
+		stringfix (proc->res_type), "",
+		RESULT);
     }
-  else
+  if (!mtflag)
     {
-      f_print (fout, "\treturn (%s%s);\n", ampr (proc->res_type), RESULT);
+      fprintf (fout, "\t\treturn (NULL);\n");
+      fprintf (fout, "\t}\n");
+      if (streq (proc->res_type, "void"))
+	{
+	  fprintf (fout, "\treturn ((void *)%s%s);\n",
+		   ampr (proc->res_type), RESULT);
+	}
+      else
+	{
+	  fprintf (fout, "\treturn (%s%s);\n", ampr (proc->res_type), RESULT);
+	}
     }
 }
diff --git a/sunrpc/rpc_cout.c b/sunrpc/rpc_cout.c
index 3b1102d2bb..44ff8d59b5 100644
--- a/sunrpc/rpc_cout.c
+++ b/sunrpc/rpc_cout.c
@@ -32,7 +32,7 @@
  * From: @(#)rpc_cout.c 1.13 89/02/22 (C) 1987 SMI
  */
 char cout_rcsid[] =
-  "$Id$";
+"$Id$";
 
 /*
  * rpc_cout.c, XDR routine outputter for the RPC protocol compiler
@@ -44,280 +44,321 @@ char cout_rcsid[] =
 #include "rpc_util.h"
 #include "proto.h"
 
-static void emit_enum(definition *def);
-static void emit_program(const definition *def);
-static void emit_union(const definition *def);
-static void emit_struct(definition *def);
-static void emit_typedef(const definition *def);
-static int findtype(const definition *def, const char *type);
-static int undefined(const char *type);
-static void print_generic_header(const char *procname, int pointerp);
-static void print_ifopen(int indent, const char *name);
-static void print_ifarg(const char *arg);
-static void print_ifsizeof(const char *prefix, const char *type);
-static void print_ifclose(int indent);
-static void print_ifstat(int indent, const char *prefix, const char *type,
-			 relation rel, const char *amax,
-			 const char *objname, const char *name);
-static void print_stat(int indent, const declaration *dec);
-static void print_header(const definition *def);
-static void print_trailer(void);
-static char *upcase(const char *str);
+static void emit_enum (definition * def);
+static void emit_program (const definition * def);
+static void emit_union (const definition * def);
+static void emit_struct (definition * def);
+static void emit_typedef (const definition * def);
+static void emit_inline (int indent, declaration * decl, int flag);
+static void emit_single_in_line (int indent, declaration *decl, int flag,
+				 relation rel);
+static int findtype (const definition * def, const char *type);
+static int undefined (const char *type);
+static void print_generic_header (const char *procname, int pointerp);
+static void print_ifopen (int indent, const char *name);
+static void print_ifarg (const char *arg);
+static void print_ifsizeof (int indent, const char *prefix, const char *type);
+static void print_ifclose (int indent);
+static void print_ifstat (int indent, const char *prefix, const char *type,
+			  relation rel, const char *amax,
+			  const char *objname, const char *name);
+static void print_stat (int indent, const declaration * dec);
+static void print_header (const definition * def);
+static void print_trailer (void);
+static char *upcase (const char *str);
 
 /*
  * Emit the C-routine for the given definition
  */
 void
-emit(definition *def)
+emit (definition * def)
 {
-	if (def->def_kind == DEF_CONST) {
-		return;
-	}
-	if (def->def_kind == DEF_PROGRAM) {
-		emit_program(def);
-		return;
-	}
-	if (def->def_kind == DEF_TYPEDEF)
-	  {
-	  /* now we need to handle declarations like
-		struct typedef foo foo;
-	     since we don't want this to be expanded
-	     into 2 calls to xdr_foo */
-
-	    if (strcmp(def->def.ty.old_type,def->def_name)==0)
-	      return;
-	  };
-
-	print_header(def);
-	switch (def->def_kind) {
-	case DEF_UNION:
-		emit_union(def);
-		break;
-	case DEF_ENUM:
-		emit_enum(def);
-		break;
-	case DEF_STRUCT:
-		emit_struct(def);
-		break;
-	case DEF_TYPEDEF:
-		emit_typedef(def);
-		break;
-	default:
-		/* can't happen */
-		break;
-	}
-	print_trailer();
+  if (def->def_kind == DEF_CONST)
+    {
+      return;
+    }
+  if (def->def_kind == DEF_PROGRAM)
+    {
+      emit_program (def);
+      return;
+    }
+  if (def->def_kind == DEF_TYPEDEF)
+    {
+      /* now we need to handle declarations like
+         struct typedef foo foo;
+         since we don't want this to be expanded
+         into 2 calls to xdr_foo */
+
+      if (strcmp (def->def.ty.old_type, def->def_name) == 0)
+	return;
+    };
+
+  print_header (def);
+  switch (def->def_kind)
+    {
+    case DEF_UNION:
+      emit_union (def);
+      break;
+    case DEF_ENUM:
+      emit_enum (def);
+      break;
+    case DEF_STRUCT:
+      emit_struct (def);
+      break;
+    case DEF_TYPEDEF:
+      emit_typedef (def);
+      break;
+    default:
+      /* can't happen */
+      break;
+    }
+  print_trailer ();
 }
 
 static int
-findtype(const definition *def, const char *type)
+findtype (const definition * def, const char *type)
 {
-	if (def->def_kind == DEF_PROGRAM || def->def_kind == DEF_CONST) {
-		return (0);
-	} else {
-		return (streq(def->def_name, type));
-	}
+  if (def->def_kind == DEF_PROGRAM || def->def_kind == DEF_CONST)
+    {
+      return 0;
+    }
+  else
+    {
+      return (streq (def->def_name, type));
+    }
 }
 
 static int
-undefined(const char *type)
+undefined (const char *type)
 {
-	definition *def;
-	def = (definition *) FINDVAL(defined, type, findtype);
-	return (def == NULL);
+  definition *def;
+  def = (definition *) FINDVAL (defined, type, findtype);
+  return (def == NULL);
 }
 
 
 static void
-print_generic_header(const char *procname, int pointerp)
+print_generic_header (const char *procname, int pointerp)
 {
-	f_print(fout, "\n");
-	f_print(fout, "bool_t\n");
-	if (Cflag) {
-	   f_print(fout, "xdr_%s(", procname);
-	   f_print(fout, "XDR *xdrs, ");
-	   f_print(fout, "%s ", procname);
-	   if( pointerp )
-	     f_print(fout, "*");
-	   f_print(fout, "objp)\n{\n\n");
-	} else {
-	  f_print(fout, "xdr_%s(xdrs, objp)\n", procname);
-	  f_print(fout, "\tXDR *xdrs;\n");
-	  f_print(fout, "\t%s ", procname);
-	  if( pointerp )
-	    f_print(fout, "*");
-	  f_print(fout, "objp;\n{\n\n");
-	}
+  f_print (fout, "\n");
+  f_print (fout, "bool_t\n");
+  if (Cflag)
+    {
+      f_print (fout, "xdr_%s (", procname);
+      f_print (fout, "XDR *xdrs, ");
+      f_print (fout, "%s ", procname);
+      if (pointerp)
+	f_print (fout, "*");
+      f_print (fout, "objp)\n{\n");
+    }
+  else
+    {
+      f_print (fout, "xdr_%s (xdrs, objp)\n", procname);
+      f_print (fout, "\tXDR *xdrs;\n");
+      f_print (fout, "\t%s ", procname);
+      if (pointerp)
+	f_print (fout, "*");
+      f_print (fout, "objp;\n{\n");
+    }
 }
 
 static void
-print_header(const definition *def)
+print_header (const definition * def)
 {
-	print_generic_header(def->def_name,
-			     def->def_kind != DEF_TYPEDEF ||
-			     !isvectordef(def->def.ty.old_type,
-					  def->def.ty.rel));
+  print_generic_header (def->def_name,
+			def->def_kind != DEF_TYPEDEF ||
+			!isvectordef (def->def.ty.old_type,
+				      def->def.ty.rel));
 
-	/* Now add Inline support */
+  /* Now add Inline support */
 
-	if(inlineflag == 0 )
-		return;
-	/*May cause lint to complain. but  ... */
-	f_print(fout, "\t register long *buf;\n\n");
+  if (inlineflag == 0)
+    return;
+  /*May cause lint to complain. but  ... */
+  f_print (fout, "\t register long *buf;\n\n");
 }
 
 static void
-print_prog_header(const proc_list *plist)
+print_prog_header (const proc_list * plist)
 {
-	print_generic_header(plist->args.argname, 1 );
+  print_generic_header (plist->args.argname, 1);
 }
 
 static void
-print_trailer(void)
+print_trailer (void)
 {
-	f_print(fout, "\treturn TRUE;\n");
-	f_print(fout, "}\n");
+  f_print (fout, "\treturn TRUE;\n");
+  f_print (fout, "}\n");
 }
 
 
 static void
-print_ifopen(int indent, const char *name)
+print_ifopen (int indent, const char *name)
 {
-	tabify(fout, indent);
-	f_print(fout, " if (!xdr_%s(xdrs", name);
+  tabify (fout, indent);
+  f_print (fout, " if (!xdr_%s (xdrs", name);
 }
 
 static void
-print_ifarg(const char *arg)
+print_ifarg (const char *arg)
 {
-	f_print(fout, ", %s", arg);
+  f_print (fout, ", %s", arg);
 }
 
 static void
-print_ifsizeof(const char *prefix, const char *type)
+print_ifsizeof (int indent, const char *prefix, const char *type)
 {
-	if (streq(type, "bool")) {
-		f_print(fout, ", sizeof(bool_t), (xdrproc_t)xdr_bool");
-	}
-	else {
-		f_print(fout, ", sizeof(");
-		if (undefined(type) && prefix) {
-			f_print(fout, "%s ", prefix);
-		}
-		f_print(fout, "%s), (xdrproc_t)xdr_%s", type, type);
+  if (indent)
+    {
+      fprintf (fout, ",\n");
+      tabify (fout, indent);
+    }
+  else
+    fprintf (fout, ", ");
+
+  if (streq (type, "bool"))
+    fprintf (fout, "sizeof (bool_t), (xdrproc_t) xdr_bool");
+  else
+    {
+      fprintf (fout, "sizeof (");
+      if (undefined (type) && prefix)
+	{
+	  f_print (fout, "%s ", prefix);
 	}
+      fprintf (fout, "%s), (xdrproc_t) xdr_%s", type, type);
+    }
 }
 
 static void
-print_ifclose(int indent)
+print_ifclose (int indent)
 {
-	f_print(fout, ")) {\n");
-	tabify(fout, indent);
-	f_print(fout, "\t return FALSE;\n");
-	tabify(fout, indent);
-	f_print(fout, " }\n");
+  f_print (fout, "))\n");
+  tabify (fout, indent);
+  f_print (fout, "\t return FALSE;\n");
 }
 
 static void
-print_ifstat(int indent, const char *prefix, const char *type, relation rel,
-	     const char *amax, const char *objname, const char *name)
+print_ifstat (int indent, const char *prefix, const char *type, relation rel,
+	      const char *amax, const char *objname, const char *name)
 {
-	const char *alt = NULL;
-
-	switch (rel) {
-	case REL_POINTER:
-		print_ifopen(indent, "pointer");
-		print_ifarg("(char **)");
-		f_print(fout, "%s", objname);
-		print_ifsizeof(prefix, type);
-		break;
-	case REL_VECTOR:
-		if (streq(type, "string")) {
-			alt = "string";
-		} else if (streq(type, "opaque")) {
-			alt = "opaque";
-		}
-		if (alt) {
-			print_ifopen(indent, alt);
-			print_ifarg(objname);
-		} else {
-			print_ifopen(indent, "vector");
-			print_ifarg("(char *)");
-			f_print(fout, "%s", objname);
-		}
-		print_ifarg(amax);
-		if (!alt) {
-			print_ifsizeof(prefix, type);
-		}
-		break;
-	case REL_ARRAY:
-		if (streq(type, "string")) {
-			alt = "string";
-		} else if (streq(type, "opaque")) {
-			alt = "bytes";
-		}
-		if (streq(type, "string")) {
-			print_ifopen(indent, alt);
-			print_ifarg(objname);
-		} else {
-			if (alt) {
-				print_ifopen(indent, alt);
-			} else {
-				print_ifopen(indent, "array");
-			}
-			print_ifarg("(char **)");
-			if (*objname == '&') {
-				f_print(fout, "%s.%s_val, (u_int *)%s.%s_len",
-					objname, name, objname, name);
-			} else {
-				f_print(fout, "&%s->%s_val, (u_int *)&%s->%s_len",
-					objname, name, objname, name);
-			}
-		}
-		print_ifarg(amax);
-		if (!alt) {
-			print_ifsizeof(prefix, type);
-		}
-		break;
-	case REL_ALIAS:
-		print_ifopen(indent, type);
-		print_ifarg(objname);
-		break;
+  const char *alt = NULL;
+
+  switch (rel)
+    {
+    case REL_POINTER:
+      print_ifopen (indent, "pointer");
+      print_ifarg ("(char **)");
+      f_print (fout, "%s", objname);
+      print_ifsizeof (0, prefix, type);
+      break;
+    case REL_VECTOR:
+      if (streq (type, "string"))
+	{
+	  alt = "string";
+	}
+      else if (streq (type, "opaque"))
+	{
+	  alt = "opaque";
+	}
+      if (alt)
+	{
+	  print_ifopen (indent, alt);
+	  print_ifarg (objname);
+	}
+      else
+	{
+	  print_ifopen (indent, "vector");
+	  print_ifarg ("(char *)");
+	  f_print (fout, "%s", objname);
+	}
+      print_ifarg (amax);
+      if (!alt)
+	{
+	  print_ifsizeof (indent + 1, prefix, type);
+	}
+      break;
+    case REL_ARRAY:
+      if (streq (type, "string"))
+	{
+	  alt = "string";
 	}
-	print_ifclose(indent);
+      else if (streq (type, "opaque"))
+	{
+	  alt = "bytes";
+	}
+      if (streq (type, "string"))
+	{
+	  print_ifopen (indent, alt);
+	  print_ifarg (objname);
+	}
+      else
+	{
+	  if (alt)
+	    {
+	      print_ifopen (indent, alt);
+	    }
+	  else
+	    {
+	      print_ifopen (indent, "array");
+	    }
+	  print_ifarg ("(char **)");
+	  if (*objname == '&')
+	    {
+	      f_print (fout, "%s.%s_val, (u_int *) %s.%s_len",
+		       objname, name, objname, name);
+	    }
+	  else
+	    {
+	      f_print (fout, "&%s->%s_val, (u_int *) &%s->%s_len",
+		       objname, name, objname, name);
+	    }
+	}
+      print_ifarg (amax);
+      if (!alt)
+	{
+	  print_ifsizeof (indent + 1, prefix, type);
+	}
+      break;
+    case REL_ALIAS:
+      print_ifopen (indent, type);
+      print_ifarg (objname);
+      break;
+    }
+  print_ifclose (indent);
 }
 
 static void
-emit_enum(definition *def)
+emit_enum (definition * def)
 {
-	(void)def;
+  (void) def;
 
-	print_ifopen(1, "enum");
-	print_ifarg("(enum_t *)objp");
-	print_ifclose(1);
+  print_ifopen (1, "enum");
+  print_ifarg ("(enum_t *) objp");
+  print_ifclose (1);
 }
 
 static void
-emit_program(const definition *def)
+emit_program (const definition * def)
 {
-	decl_list *dl;
-	version_list *vlist;
-	proc_list *plist;
-
-	for (vlist = def->def.pr.versions; vlist != NULL;vlist = vlist->next)
-	  for(plist = vlist->procs; plist != NULL; plist = plist->next) {
-		  if (!newstyle || plist->arg_num < 2)
-		    continue; /* old style, or single argument */
-		  print_prog_header(plist);
-		  for (dl = plist->args.decls; dl != NULL;
-		       dl = dl->next)
-			  print_stat(1,&dl->decl);
-		  print_trailer();
-	  }
+  decl_list *dl;
+  version_list *vlist;
+  proc_list *plist;
+
+  for (vlist = def->def.pr.versions; vlist != NULL; vlist = vlist->next)
+    for (plist = vlist->procs; plist != NULL; plist = plist->next)
+      {
+	if (!newstyle || plist->arg_num < 2)
+	  continue;		/* old style, or single argument */
+	print_prog_header (plist);
+	for (dl = plist->args.decls; dl != NULL;
+	     dl = dl->next)
+	  print_stat (1, &dl->decl);
+	print_trailer ();
+      }
 }
 
 static void
-emit_union(const definition *def)
+emit_union (const definition * def)
 {
   declaration *dflt;
   case_list *cl;
@@ -326,378 +367,440 @@ emit_union(const definition *def)
   const char *vecformat = "objp->%s_u.%s";
   const char *format = "&objp->%s_u.%s";
 
-  print_stat(1,&def->def.un.enum_decl);
-  f_print(fout, "\tswitch (objp->%s) {\n", def->def.un.enum_decl.name);
-  for (cl = def->def.un.cases; cl != NULL; cl = cl->next) {
-
-    f_print(fout, "\tcase %s:\n", cl->case_name);
-    if(cl->contflag == 1)	/* a continued case statement */
-      continue;
-    cs = &cl->case_decl;
-    if (!streq(cs->type, "void")) {
-      object = alloc(strlen(def->def_name) + strlen(format) +
-		     strlen(cs->name) + 1);
-      if (isvectordef(cs->type, cs->rel)) {
-	s_print(object, vecformat, def->def_name,
-		cs->name);
-      } else {
-	s_print(object, format, def->def_name,
-		cs->name);
-      }
-      print_ifstat(2, cs->prefix, cs->type, cs->rel, cs->array_max,
-		   object, cs->name);
-      free(object);
+  print_stat (1, &def->def.un.enum_decl);
+  f_print (fout, "\tswitch (objp->%s) {\n", def->def.un.enum_decl.name);
+  for (cl = def->def.un.cases; cl != NULL; cl = cl->next)
+    {
+
+      f_print (fout, "\tcase %s:\n", cl->case_name);
+      if (cl->contflag == 1)	/* a continued case statement */
+	continue;
+      cs = &cl->case_decl;
+      if (!streq (cs->type, "void"))
+	{
+	  object = alloc (strlen (def->def_name) + strlen (format) +
+			  strlen (cs->name) + 1);
+	  if (isvectordef (cs->type, cs->rel))
+	    {
+	      s_print (object, vecformat, def->def_name,
+		       cs->name);
+	    }
+	  else
+	    {
+	      s_print (object, format, def->def_name,
+		       cs->name);
+	    }
+	  print_ifstat (2, cs->prefix, cs->type, cs->rel, cs->array_max,
+			object, cs->name);
+	  free (object);
+	}
+      f_print (fout, "\t\tbreak;\n");
     }
-    f_print(fout, "\t\tbreak;\n");
-  }
   dflt = def->def.un.default_decl;
-  if (dflt != NULL) {
-    if (!streq(dflt->type, "void")) {
-      f_print(fout, "\tdefault:\n");
-      object = alloc(strlen(def->def_name) + strlen(format) +
-		     strlen(dflt->name) + 1);
-      if (isvectordef(dflt->type, dflt->rel)) {
-	s_print(object, vecformat, def->def_name,
-		dflt->name);
-      } else {
-	s_print(object, format, def->def_name,
-		dflt->name);
-      }
+  if (dflt != NULL)
+    {
+      if (!streq (dflt->type, "void"))
+	{
+	  f_print (fout, "\tdefault:\n");
+	  object = alloc (strlen (def->def_name) + strlen (format) +
+			  strlen (dflt->name) + 1);
+	  if (isvectordef (dflt->type, dflt->rel))
+	    {
+	      s_print (object, vecformat, def->def_name,
+		       dflt->name);
+	    }
+	  else
+	    {
+	      s_print (object, format, def->def_name,
+		       dflt->name);
+	    }
 
-      print_ifstat(2, dflt->prefix, dflt->type, dflt->rel,
-		   dflt->array_max, object, dflt->name);
-      free(object);
-      f_print(fout, "\t\tbreak;\n");
-    }
+	  print_ifstat (2, dflt->prefix, dflt->type, dflt->rel,
+			dflt->array_max, object, dflt->name);
+	  free (object);
+	  f_print (fout, "\t\tbreak;\n");
+	}
 #ifdef __GNU_LIBRARY__
-    else {
-      f_print(fout, "\tdefault:\n");
-      f_print(fout, "\t\tbreak;\n");
-    }
+      else
+	{
+	  f_print (fout, "\tdefault:\n");
+	  f_print (fout, "\t\tbreak;\n");
+	}
 #endif
-  } else {
-    f_print(fout, "\tdefault:\n");
-    f_print(fout, "\t\treturn FALSE;\n");
-  }
+    }
+  else
+    {
+      f_print (fout, "\tdefault:\n");
+      f_print (fout, "\t\treturn FALSE;\n");
+    }
 
-  f_print(fout, "\t}\n");
+  f_print (fout, "\t}\n");
+}
+
+static void
+inline_struct (definition *def, int flag)
+{
+  decl_list *dl;
+  int i, size;
+  decl_list *cur, *psav;
+  bas_type *ptr;
+  char *sizestr, *plus;
+  char ptemp[256];
+  int indent = 1;
+
+  if (flag == PUT)
+    f_print (fout, "\n\tif (xdrs->x_op == XDR_ENCODE) {\n");
+  else
+    f_print(fout,
+	    "\t\treturn TRUE;\n\t} else if (xdrs->x_op == XDR_DECODE) {\n");
+
+  i = 0;
+  size = 0;
+  sizestr = NULL;
+  for (dl = def->def.st.decls; dl != NULL; dl = dl->next)
+    {			/* xxx */
+      /* now walk down the list and check for basic types */
+      if ((dl->decl.prefix == NULL) &&
+	  ((ptr = find_type (dl->decl.type)) != NULL) &&
+	  ((dl->decl.rel == REL_ALIAS) || (dl->decl.rel == REL_VECTOR)))
+	{
+	  if (i == 0)
+	    cur = dl;
+	  ++i;
+
+	  if (dl->decl.rel == REL_ALIAS)
+	    size += ptr->length;
+	  else
+	    {
+	      /* this is required to handle arrays */
+	      if (sizestr == NULL)
+		plus = "";
+	      else
+		plus = "+ ";
+
+	      if (ptr->length != 1)
+		s_print (ptemp, " %s %s * %d", plus, dl->decl.array_max,
+			 ptr->length);
+	      else
+		s_print (ptemp, " %s%s ", plus, dl->decl.array_max);
+
+	      /*now concatenate to sizestr !!!! */
+	      if (sizestr == NULL)
+		sizestr = strdup (ptemp);
+	      else
+		{
+		  sizestr = realloc (sizestr, strlen (sizestr) +
+				     strlen (ptemp) + 1);
+		  if (sizestr == NULL)
+		    {
+		      f_print (stderr, "Fatal error : no memory \n");
+		      crash ();
+		    };
+		  sizestr = strcat (sizestr, ptemp);
+		  /*build up length of array */
+		}
+	    }
+	}
+      else
+	{
+	  if (i > 0)
+	    if (sizestr == NULL && size < inlineflag)
+	      {
+		/* don't expand into inline code if size < inlineflag */
+		while (cur != dl)
+		  {
+		    print_stat (indent + 1, &cur->decl);
+		    cur = cur->next;
+		  }
+	      }
+	    else
+	      {
+		/* were already looking at a xdr_inlineable structure */
+		tabify (fout, indent + 1);
+		if (sizestr == NULL)
+		  f_print (fout, "buf = XDR_INLINE (xdrs, %d * BYTES_PER_XDR_UNIT);", size);
+		else if (size == 0)
+		  f_print (fout,
+			   "buf = XDR_INLINE (xdrs, %s * BYTES_PER_XDR_UNIT);",
+			   sizestr);
+		else
+		  f_print (fout,
+			   "buf = XDR_INLINE(xdrs, (%d + (%s)) * BYTES_PER_XDR_UNIT);",
+			   size, sizestr);
+		f_print (fout, "\n");
+		tabify (fout, indent + 1);
+		fprintf (fout, "if (buf == NULL) {\n");
+		psav = cur;
+		while (cur != dl)
+		  {
+		    print_stat (indent + 2, &cur->decl);
+		    cur = cur->next;
+		  }
+
+		f_print (fout, "\n\t\t} else {\n");
+		cur = psav;
+		while (cur != dl)
+		  {
+		    emit_inline (indent + 1, &cur->decl, flag);
+		    cur = cur->next;
+		  }
+		tabify (fout, indent + 1);
+		f_print (fout, "}\n");
+	      }
+	  size = 0;
+	  i = 0;
+	  sizestr = NULL;
+	  print_stat (indent + 1, &dl->decl);
+	}
+    }
+  if (i > 0)
+    if (sizestr == NULL && size < inlineflag)
+      {
+	/* don't expand into inline code if size < inlineflag */
+	while (cur != dl)
+	  {
+	    print_stat (indent + 1, &cur->decl);
+	    cur = cur->next;
+	  }
+      }
+    else
+      {
+	/* were already looking at a xdr_inlineable structure */
+	if (sizestr == NULL)
+	  f_print (fout, "\t\tbuf = XDR_INLINE(xdrs,%d * BYTES_PER_XDR_UNIT);",
+		   size);
+	else if (size == 0)
+	  f_print (fout,
+		   "\t\tbuf = XDR_INLINE(xdrs,%s * BYTES_PER_XDR_UNIT);",
+		   sizestr);
+	else
+	  f_print (fout,
+		   "\t\tbuf = XDR_INLINE(xdrs,(%d + %s)* BYTES_PER_XDR_UNIT);",
+		   size, sizestr);
+	f_print (fout, "\n\t\tif (buf == NULL) {\n");
+	psav = cur;
+	while (cur != NULL)
+	  {
+	    print_stat (indent + 2, &cur->decl);
+	    cur = cur->next;
+	  }
+	f_print (fout, "\t\t} else {\n");
+
+	cur = psav;
+	while (cur != dl)
+	  {
+	    emit_inline (indent + 2, &cur->decl, flag);
+	    cur = cur->next;
+	  }
+	f_print (fout, "\t\t}\n");
+      }
 }
 
 /* this may be const.  i haven't traced this one through yet. */
 
 static void
-emit_struct(definition *def)
+emit_struct (definition * def)
 {
-	decl_list *dl;
-	int i,j,size,flag;
-	decl_list *cur = NULL,*psav;
-	bas_type *ptr;
-	char *sizestr;
-	const char *plus;
-	char ptemp[256];
-	int can_inline;
-
-
-	if(inlineflag  == 0)	{
-		for (dl = def->def.st.decls; dl != NULL; dl = dl->next)
-			print_stat(1,&dl->decl);
-	}
+  decl_list *dl;
+  int j, size, flag;
+  bas_type *ptr;
+  int can_inline;
+
+
+  if (inlineflag == 0)
+    {
+      /* No xdr_inlining at all */
+      for (dl = def->def.st.decls; dl != NULL; dl = dl->next)
+	print_stat (1, &dl->decl);
+      return;
+    }
 
-	else	{
-
-		for (dl = def->def.st.decls; dl != NULL; dl = dl->next)
-			if(dl->decl.rel == REL_VECTOR){
-				f_print(fout,"\t int i;\n");
-				break;
-			}
-
-		size=0;can_inline=0;
-		for (dl = def->def.st.decls; dl != NULL; dl = dl->next)
-			if((dl->decl.prefix == NULL) && ((ptr=find_type(dl->decl.type))!= NULL) && 		 ((dl->decl.rel == REL_ALIAS)||(dl->decl.rel == REL_VECTOR))){
-
-				if(dl->decl.rel == REL_ALIAS)
-					size+=ptr->length;
-				else {
-					can_inline=1;
-					break; /* can be inlined */
-				};
-			}
-			else {
-				if(size >= inlineflag){
-					can_inline=1;
-					break; /* can be inlined */
-				}
-				size=0;
-			}
-		if(size > inlineflag)
-			can_inline=1;
-
-		if(can_inline == 0){ /* can not inline, drop back to old mode */
-			for (dl = def->def.st.decls; dl != NULL; dl = dl->next)
-				print_stat(1,&dl->decl);
-			return;
-		};
-
-		flag=PUT;
-		for(j=0; j<2; j++){
-
-			if(flag == PUT)
-				f_print(fout,"\n\t if (xdrs->x_op == XDR_ENCODE) {\n");
-			else
-				f_print(fout,"\n \t return TRUE;\n\t} else if (xdrs->x_op == XDR_DECODE) {\n");
-
-
-			i=0;
-			size=0;
-			sizestr=NULL;
-			for (dl = def->def.st.decls; dl != NULL; dl = dl->next) { /* xxx */
-
-				/* now walk down the list and check for basic types */
-				if((dl->decl.prefix == NULL) && ((ptr=find_type(dl->decl.type))!= NULL) && 		 ((dl->decl.rel == REL_ALIAS)||(dl->decl.rel == REL_VECTOR))){
-					if(i ==0 )
-						cur=dl;
-					i++;
-
-					if(dl->decl.rel == REL_ALIAS)
-						size+=ptr->length;
-					else {
-						/* this is required to handle arrays */
-
-						if(sizestr == NULL)
-							plus = " ";
-						else
-							plus = "+";
-
-						if(ptr->length != 1)
-							s_print(ptemp," %s %s * %d",plus,dl->decl.array_max,ptr->length);
-						else
-							s_print(ptemp," %s %s ",plus,dl->decl.array_max);
-
-						/*now concatenate to sizestr !!!! */
-						if (sizestr == NULL)
-							sizestr=strdup(ptemp);
-						else{
-							sizestr=realloc(sizestr,strlen(sizestr)+strlen(ptemp)+1);
-							if(sizestr == NULL){
-
-								f_print(stderr, "Fatal error : no memory \n");
-								crash();
-							};
-							sizestr=strcat(sizestr,ptemp); /*build up length of array */
-
-						}
-					}
-
-				}
-				else{
-					if(i > 0 )
-						if(sizestr == NULL && size < inlineflag){
-							/* don't expand into inline code if size < inlineflag */
-							while(cur != dl){
-								print_stat(1,&cur->decl);
-								cur=cur->next;
-							}
-						}
-						else{
-
-
-
-							/* were already looking at a xdr_inlineable structure */
-							if(sizestr == NULL)
-								f_print(fout,"\t buf = XDR_INLINE(xdrs,%d * BYTES_PER_XDR_UNIT);",
-									size);
-							else
-								if(size == 0)
-									f_print(fout,
-										"\t buf = XDR_INLINE(xdrs,%s * BYTES_PER_XDR_UNIT);",
-										sizestr);
-								else
-									f_print(fout,
-										"\t buf = XDR_INLINE(xdrs,(%d + %s)* BYTES_PER_XDR_UNIT);",
-										size,sizestr);
-
-							f_print(fout,"\n\t   if (buf == NULL) {\n");
-
-							psav=cur;
-							while(cur != dl){
-								print_stat(2,&cur->decl);
-								cur=cur->next;
-							}
-
-							f_print(fout,"\n\t  }\n\t  else {\n");
-
-							cur=psav;
-							while(cur != dl){
-								emit_inline(&cur->decl,flag);
-								cur=cur->next;
-							}
-
-							f_print(fout,"\t  }\n");
-						}
-					size=0;i=0;sizestr=NULL;
-					print_stat(1,&dl->decl);
-				}
-
-			}
-			if(i > 0 )
-				if(sizestr == NULL && size < inlineflag){
-					/* don't expand into inline code if size < inlineflag */
-					while(cur != dl){
-						print_stat(1,&cur->decl);
-						cur=cur->next;
-					}
-				}
-				else{
-
-					/* were already looking at a xdr_inlineable structure */
-					if(sizestr == NULL)
-						f_print(fout,"\t\tbuf = XDR_INLINE(xdrs,%d * BYTES_PER_XDR_UNIT);",
-							size);
-					else
-						if(size == 0)
-							f_print(fout,
-								"\t\tbuf = XDR_INLINE(xdrs,%s * BYTES_PER_XDR_UNIT);",
-								sizestr);
-						else
-							f_print(fout,
-								"\t\tbuf = XDR_INLINE(xdrs,(%d + %s)* BYTES_PER_XDR_UNIT);",
-								size,sizestr);
-
-					f_print(fout,"\n\t\tif (buf == NULL) {\n");
-
-					psav=cur;
-					while(cur != NULL){
-						print_stat(2,&cur->decl);
-						cur=cur->next;
-					}
-					f_print(fout,"\n\t  }\n\t  else {\n");
-
-					cur=psav;
-					while(cur != dl){
-						emit_inline(&cur->decl,flag);
-						cur=cur->next;
-					}
-
-					f_print(fout,"\t  }\n");
-
-				}
-			flag=GET;
-		}
-		f_print(fout,"\t return TRUE;\n\t}\n\n");
+  for (dl = def->def.st.decls; dl != NULL; dl = dl->next)
+    if (dl->decl.rel == REL_VECTOR)
+      {
+	f_print (fout, "\tint i;\n");
+	break;
+      }
 
-		/* now take care of XDR_FREE case */
+  size = 0;
+  can_inline = 0;
+  /*
+   * Make a first pass and see if inling is possible.
+   */
+  for (dl = def->def.st.decls; dl != NULL; dl = dl->next)
+    if ((dl->decl.prefix == NULL) &&
+	((ptr = find_type (dl->decl.type)) != NULL) &&
+	((dl->decl.rel == REL_ALIAS) || (dl->decl.rel == REL_VECTOR)))
+      {
+	if (dl->decl.rel == REL_ALIAS)
+	  size += ptr->length;
+	else
+	  {
+	    can_inline = 1;
+	    break;		/* can be inlined */
+	  }
+      }
+    else
+      {
+	if (size >= inlineflag)
+	  {
+	    can_inline = 1;
+	    break;		/* can be inlined */
+	  }
+	size = 0;
+      }
+  if (size > inlineflag)
+    can_inline = 1;
+
+  if (can_inline == 0)
+    {			/* can not inline, drop back to old mode */
+      for (dl = def->def.st.decls; dl != NULL; dl = dl->next)
+	print_stat (1, &dl->decl);
+      return;
+    };
+
+  flag = PUT;
+  for (j = 0; j < 2; j++)
+    {
+      inline_struct (def, flag);
+      if (flag == PUT)
+	flag = GET;
+    }
 
-		for (dl = def->def.st.decls; dl != NULL; dl = dl->next)
-			print_stat(1,&dl->decl);
-	}
-}
+  f_print (fout, "\t return TRUE;\n\t}\n\n");
 
+  /* now take care of XDR_FREE case */
+
+  for (dl = def->def.st.decls; dl != NULL; dl = dl->next)
+    print_stat (1, &dl->decl);
+}
 
 static void
-emit_typedef(const definition *def)
+emit_typedef (const definition * def)
 {
-	const char *prefix = def->def.ty.old_prefix;
-	const char *type = def->def.ty.old_type;
-	const char *amax = def->def.ty.array_max;
-	relation rel = def->def.ty.rel;
-
+  const char *prefix = def->def.ty.old_prefix;
+  const char *type = def->def.ty.old_type;
+  const char *amax = def->def.ty.array_max;
+  relation rel = def->def.ty.rel;
 
-	print_ifstat(1, prefix, type, rel, amax, "objp", def->def_name);
+  print_ifstat (1, prefix, type, rel, amax, "objp", def->def_name);
 }
 
 static void
-print_stat(int indent, const declaration *dec)
+print_stat (int indent, const declaration * dec)
 {
-	const char *prefix = dec->prefix;
-	const char *type = dec->type;
-	const char *amax = dec->array_max;
-	relation rel = dec->rel;
-	char name[256];
-
-	if (isvectordef(type, rel)) {
-		s_print(name, "objp->%s", dec->name);
-	} else {
-		s_print(name, "&objp->%s", dec->name);
-	}
-	print_ifstat(indent, prefix, type, rel, amax, name, dec->name);
+  const char *prefix = dec->prefix;
+  const char *type = dec->type;
+  const char *amax = dec->array_max;
+  relation rel = dec->rel;
+  char name[256];
+
+  if (isvectordef (type, rel))
+    {
+      s_print (name, "objp->%s", dec->name);
+    }
+  else
+    {
+      s_print (name, "&objp->%s", dec->name);
+    }
+  print_ifstat (indent, prefix, type, rel, amax, name, dec->name);
 }
 
 
-void
-emit_inline(declaration *decl, int flag)
+static void
+emit_inline (int indent, declaration * decl, int flag)
 {
-
-/*check whether an array or not */
-
-switch(decl->rel)
-  {
- case  REL_ALIAS :
-  emit_single_in_line(decl,flag,REL_ALIAS);
-  break;
- case REL_VECTOR :
-   f_print(fout,"\t\t{ register %s *genp; \n",decl->type);
-   f_print(fout,"\t\t  for ( i = 0,genp=objp->%s;\n \t\t\ti < %s; i++){\n\t\t",
-	   decl->name,decl->array_max);
-  emit_single_in_line(decl,flag,REL_VECTOR);
-    f_print(fout,"\t\t   }\n\t\t };\n");
-
-  default:
-    /* ?... do nothing I guess */
-  }
+  switch (decl->rel)
+    {
+    case REL_ALIAS:
+      emit_single_in_line (indent, decl, flag, REL_ALIAS);
+      break;
+    case REL_VECTOR:
+      tabify (fout, indent);
+      f_print (fout, "{\n");
+      tabify (fout, indent + 1);
+      f_print (fout, "register %s *genp;\n\n", decl->type);
+      tabify (fout, indent + 1);
+      f_print (fout,
+	      "for (i = 0, genp = objp->%s;\n", decl->name);
+      tabify (fout, indent + 2);
+      f_print (fout, "i < %s; ++i) {\n", decl->array_max);
+      emit_single_in_line (indent + 2, decl, flag, REL_VECTOR);
+      tabify (fout, indent + 1);
+      f_print (fout, "}\n");
+      tabify (fout, indent);
+      f_print (fout, "}\n");
+      break;
+    default:
+      /* ?... do nothing I guess */
+    }
 }
 
-void
-emit_single_in_line(declaration *decl, int flag, relation rel)
+static void
+emit_single_in_line (int indent, declaration *decl, int flag, relation rel)
 {
-	char *upp_case1;
-	const char *upp_case;
+  char *upp_case;
+  int freed = 0;
+
+  tabify (fout, indent);
+  if (flag == PUT)
+    f_print (fout, "IXDR_PUT_");
+  else
+    {
+      if (rel == REL_ALIAS)
+	f_print (fout, "objp->%s = IXDR_GET_", decl->name);
+      else
+	f_print (fout, "*genp++ = IXDR_GET_");
+    }
 
-	if (flag == PUT) {
-	    f_print(fout,"\t\t IXDR_PUT_");
-	}
-	else {
-	    if(rel== REL_ALIAS) {
-		f_print(fout, "\t\t objp->%s = IXDR_GET_", decl->name);
-	    }
-	    else {
-		f_print(fout,"\t\t *genp++ = IXDR_GET_");
-	    }
-	}
+  upp_case = upcase (decl->type);
 
-	upp_case1 = upcase(decl->type);
-	upp_case = upp_case1;
+  /* hack  - XX */
+  if (!strcmp (upp_case, "INT"))
+    {
+      free (upp_case);
+      freed = 1;
+      upp_case = "LONG";
+    }
 
-	/* hack  - XX */
-	if (!strcmp(upp_case, "INT")) upp_case="LONG";
-	if (!strcmp(upp_case, "U_INT")) upp_case="U_LONG";
+  if (!strcmp (upp_case, "U_INT"))
+    {
+      free (upp_case);
+      freed = 1;
+      upp_case = "U_LONG";
+    }
 
-	if (flag == PUT) {
-	    if (rel==REL_ALIAS) {
-		f_print(fout,"%s(buf,objp->%s);\n",upp_case,decl->name);
-	    }
-	    else {
-		f_print(fout,"%s(buf,*genp++);\n",upp_case);
-	    }
-	}
-	else {
-	    f_print(fout,"%s(buf);\n",upp_case);
-	}
+  if (flag == PUT)
+    {
+      if (rel == REL_ALIAS)
+	f_print (fout, "%s(buf, objp->%s);\n", upp_case, decl->name);
+      else
+	f_print (fout, "%s(buf, *genp++);\n", upp_case);
+    }
+  else
+    {
+      f_print (fout, "%s(buf);\n", upp_case);
+    }
 
-	free(upp_case1);
+  if (!freed)
+    free (upp_case);
 }
 
 
-static char *upcase(const char *str) {
-    char *ptr, *hptr;
-    ptr = malloc(strlen(str));
-    if (ptr == NULL) {
-	f_print(stderr,"malloc failed\n");
-	exit(1);
-    }
-    hptr=ptr;
-    while (*str != 0) {
-	*ptr++ = toupper(*str++);
+static char *
+upcase (const char *str)
+{
+  char *ptr, *hptr;
+  ptr = malloc (strlen (str));
+  if (ptr == NULL)
+    {
+      f_print (stderr, "malloc failed\n");
+      exit (1);
     }
-    *ptr=0;
-    return hptr;
+  hptr = ptr;
+  while (*str != '\0')
+    *ptr++ = toupper (*str++);
+
+  *ptr = '\0';
+  return hptr;
 }
diff --git a/sunrpc/rpc_hout.c b/sunrpc/rpc_hout.c
index beca27610f..4c49d10bbe 100644
--- a/sunrpc/rpc_hout.c
+++ b/sunrpc/rpc_hout.c
@@ -31,11 +31,11 @@
 /*
  * From: @(#)rpc_hout.c 1.12 89/02/22 (C) 1987 SMI
  */
-char hout_rcsid[] = 
+char hout_rcsid[] =
   "$Id$";
 
 /*
- * rpc_hout.c, Header file outputter for the RPC protocol compiler 
+ * rpc_hout.c, Header file outputter for the RPC protocol compiler
  */
 #include <stdio.h>
 #include <ctype.h>
@@ -43,456 +43,575 @@ char hout_rcsid[] =
 #include "rpc_util.h"
 #include "proto.h"
 
-static void pconstdef(definition *def);
-static void pargdef(definition *def);
-static void pstructdef(definition *def);
-static void puniondef(definition *def);
-static void pdefine(const char *name, const char *num);
-static void puldefine(const char *name, const char *num);
-static int define_printed(proc_list *stop, version_list *start);
-static void pprogramdef(definition *def);
-static void parglist(proc_list *proc, const char *addargtype);
-static void penumdef(definition *def);
-static void ptypedef(definition *def);
-static int undefined2(const char *type, const char *stop);
+static void pconstdef (definition * def);
+static void pargdef (definition * def);
+static void pstructdef (definition * def);
+static void puniondef (definition * def);
+static void pdefine (const char *name, const char *num);
+static void puldefine (const char *name, const char *num);
+static int define_printed (proc_list * stop, version_list * start);
+static void pprogramdef (definition * def);
+static void parglist (proc_list * proc, const char *addargtype);
+static void penumdef (definition * def);
+static void ptypedef (definition * def);
+static int undefined2 (const char *type, const char *stop);
+
+/* store away enough information to allow the XDR functions to be spat
+    out at the end of the file */
+
+void
+storexdrfuncdecl (const char *name, int pointerp)
+{
+  xdrfunc * xdrptr;
+
+  xdrptr = (xdrfunc *) malloc(sizeof (struct xdrfunc));
+
+  xdrptr->name = (char *)name;
+  xdrptr->pointerp = pointerp;
+  xdrptr->next = NULL;
+
+  if (xdrfunc_tail == NULL)
+    {
+      xdrfunc_head = xdrptr;
+      xdrfunc_tail = xdrptr;
+    }
+  else
+    {
+      xdrfunc_tail->next = xdrptr;
+      xdrfunc_tail = xdrptr;
+    }
+}
 
 /*
- * Print the C-version of an xdr definition 
+ * Print the C-version of an xdr definition
  */
 void
-print_datadef(definition *def)
+print_datadef (definition *def)
 {
 
-	if (def->def_kind == DEF_PROGRAM )  /* handle data only */
-	        return;
-
-	if (def->def_kind != DEF_CONST) {
-		f_print(fout, "\n");
-	}
-	switch (def->def_kind) {
-	case DEF_STRUCT:
-		pstructdef(def);
-		break;
-	case DEF_UNION:
-		puniondef(def);
-		break;
-	case DEF_ENUM:
-		penumdef(def);
-		break;
-	case DEF_TYPEDEF:
-		ptypedef(def);
-		break;
-	case DEF_PROGRAM:
-		pprogramdef(def);
-		break;
-	case DEF_CONST:
-		pconstdef(def);
-		break;
-	}
-	if (def->def_kind != DEF_PROGRAM && def->def_kind != DEF_CONST) {
-	  pxdrfuncdecl( def->def_name,
-		       def->def_kind != DEF_TYPEDEF ||
-		       !isvectordef(def->def.ty.old_type, def->def.ty.rel));
-
-	}
+  if (def->def_kind == DEF_PROGRAM)	/* handle data only */
+    return;
+
+  if (def->def_kind != DEF_CONST)
+    {
+      f_print (fout, "\n");
+    }
+  switch (def->def_kind)
+    {
+    case DEF_STRUCT:
+      pstructdef (def);
+      break;
+    case DEF_UNION:
+      puniondef (def);
+      break;
+    case DEF_ENUM:
+      penumdef (def);
+      break;
+    case DEF_TYPEDEF:
+      ptypedef (def);
+      break;
+    case DEF_PROGRAM:
+      pprogramdef (def);
+      break;
+    case DEF_CONST:
+      pconstdef (def);
+      break;
+    }
+  if (def->def_kind != DEF_PROGRAM && def->def_kind != DEF_CONST)
+    {
+      storexdrfuncdecl(def->def_name,
+ 		       def->def_kind != DEF_TYPEDEF ||
+		       !isvectordef(def->def.ty.old_type,
+				    def->def.ty.rel));
+    }
 }
 
 
 void
-print_funcdef(definition *def)
+print_funcdef (definition *def)
 {
-	switch (def->def_kind) {
-	  case DEF_PROGRAM:
-		f_print(fout, "\n");
-		pprogramdef(def);
-		break;
-	  default:
-	    /* ?... shouldn't happen I guess */
-	}
+  switch (def->def_kind)
+    {
+    case DEF_PROGRAM:
+      f_print (fout, "\n");
+      pprogramdef (def);
+      break;
+    default:
+      /* ?... shouldn't happen I guess */
+    }
 }
 
 void
-pxdrfuncdecl(const char *name, int pointerp)
+print_xdr_func_def (char *name, int pointerp, int i)
 {
-
-  f_print(fout,"#ifdef __cplusplus \n");
-    f_print(fout, "extern \"C\" bool_t xdr_%s(XDR *, %s%s);\n", name, name, pointerp ? "*" : "");
-  f_print(fout,"#elif __STDC__ \n");
-    f_print(fout, "extern  bool_t xdr_%s(XDR *, %s%s);\n", name, name, pointerp ? "*" : "");
-  f_print(fout,"#else /* Old Style C */ \n");
-    f_print(fout, "bool_t xdr_%s();\n", name);
-  f_print(fout,"#endif /* Old Style C */ \n\n");
+  if (i == 2)
+    {
+      f_print (fout, "extern bool_t xdr_%s ();\n", name);
+      return;
+    }
+  else
+    f_print(fout, "extern  bool_t xdr_%s (XDR *, %s%s);\n", name,
+	    name, pointerp ? "*" : "");
 }
 
-
 static void
-pconstdef(definition *def)
+pconstdef (definition *def)
 {
-	pdefine(def->def_name, def->def.co);
+  pdefine (def->def_name, def->def.co);
 }
 
-/* print out the definitions for the arguments of functions in the 
-   header file 
-*/
+/* print out the definitions for the arguments of functions in the
+   header file
+ */
 static void
-pargdef(definition *def)
+pargdef (definition * def)
 {
-	decl_list *l;
-	version_list *vers;
-	const char *name;
-	proc_list *plist;
-
-	
-	for (vers = def->def.pr.versions; vers != NULL; vers = vers->next) {
-			for(plist = vers->procs; plist != NULL; 
-			    plist = plist->next) {
-				
-				if (!newstyle || plist->arg_num < 2) {
-					continue; /* old style or single args */
-				}
-				name = plist->args.argname;
-				f_print(fout, "struct %s {\n", name);
-				for (l = plist->args.decls; 
-				     l != NULL; l = l->next) {
-					pdeclaration(name, &l->decl, 1, ";\n" );
-				}
-				f_print(fout, "};\n");
-				f_print(fout, "typedef struct %s %s;\n", name, name);
-				pxdrfuncdecl(name, 0);
-				f_print( fout, "\n" );
-			}
-		}
+  decl_list *l;
+  version_list *vers;
+  const char *name;
+  proc_list *plist;
+
+  for (vers = def->def.pr.versions; vers != NULL; vers = vers->next)
+    {
+      for (plist = vers->procs; plist != NULL;
+	   plist = plist->next)
+	{
+
+	  if (!newstyle || plist->arg_num < 2)
+	    {
+	      continue;		/* old style or single args */
+	    }
+	  name = plist->args.argname;
+	  f_print (fout, "struct %s {\n", name);
+	  for (l = plist->args.decls;
+	       l != NULL; l = l->next)
+	    {
+	      pdeclaration (name, &l->decl, 1, ";\n");
+	    }
+	  f_print (fout, "};\n");
+	  f_print (fout, "typedef struct %s %s;\n", name, name);
+	  storexdrfuncdecl (name, 0);
+	  f_print (fout, "\n");
+	}
+    }
 
 }
 
-
 static void
-pstructdef(definition *def)
+pstructdef (definition *def)
 {
-	decl_list *l;
-	const char *name = def->def_name;
-
-	f_print(fout, "struct %s {\n", name);
-	for (l = def->def.st.decls; l != NULL; l = l->next) {
-		pdeclaration(name, &l->decl, 1, ";\n");
-	}
-	f_print(fout, "};\n");
-	f_print(fout, "typedef struct %s %s;\n", name, name);
+  decl_list *l;
+  const char *name = def->def_name;
+
+  f_print (fout, "struct %s {\n", name);
+  for (l = def->def.st.decls; l != NULL; l = l->next)
+    {
+      pdeclaration (name, &l->decl, 1, ";\n");
+    }
+  f_print (fout, "};\n");
+  f_print (fout, "typedef struct %s %s;\n", name, name);
 }
 
 static void
-puniondef(definition *def)
+puniondef (definition *def)
 {
-	case_list *l;
-	const char *name = def->def_name;
-	declaration *decl;
-
-	f_print(fout, "struct %s {\n", name);
-	decl = &def->def.un.enum_decl;
-	if (streq(decl->type, "bool")) {
-		f_print(fout, "\tbool_t %s;\n", decl->name);
-	} else {
-		f_print(fout, "\t%s %s;\n", decl->type, decl->name);
-	}
-	f_print(fout, "\tunion {\n");
-	for (l = def->def.un.cases; l != NULL; l = l->next) {
-	  if(l->contflag == 0)
-		pdeclaration(name, &l->case_decl, 2, ";\n" );
-	}
-	decl = def->def.un.default_decl;
-	if (decl && !streq(decl->type, "void")) {
-		pdeclaration(name, decl, 2, ";\n" );
-	}
-	f_print(fout, "\t} %s_u;\n", name);
-	f_print(fout, "};\n");
-	f_print(fout, "typedef struct %s %s;\n", name, name);
+  case_list *l;
+  const char *name = def->def_name;
+  declaration *decl;
+
+  f_print (fout, "struct %s {\n", name);
+  decl = &def->def.un.enum_decl;
+  if (streq (decl->type, "bool"))
+    {
+      f_print (fout, "\tbool_t %s;\n", decl->name);
+    }
+  else
+    {
+      f_print (fout, "\t%s %s;\n", decl->type, decl->name);
+    }
+  f_print (fout, "\tunion {\n");
+  for (l = def->def.un.cases; l != NULL; l = l->next)
+    {
+      if (l->contflag == 0)
+	pdeclaration (name, &l->case_decl, 2, ";\n");
+    }
+  decl = def->def.un.default_decl;
+  if (decl && !streq (decl->type, "void"))
+    {
+      pdeclaration (name, decl, 2, ";\n");
+    }
+  f_print (fout, "\t} %s_u;\n", name);
+  f_print (fout, "};\n");
+  f_print (fout, "typedef struct %s %s;\n", name, name);
 }
 
 static void
-pdefine(const char *name, const char *num)
+pdefine (const char *name, const char *num)
 {
-	f_print(fout, "#define %s %s\n", name, num);
+  f_print (fout, "#define %s %s\n", name, num);
 }
 
 static void
-puldefine(const char *name, const char *num)
+puldefine (const char *name, const char *num)
 {
-	f_print(fout, "#define %s ((u_long)%s)\n", name, num);
+  f_print (fout, "#define %s ((u_long)%s)\n", name, num);
 }
 
 static int
-define_printed(proc_list *stop, version_list *start)
+define_printed (proc_list *stop, version_list *start)
 {
-	version_list *vers;
-	proc_list *proc;
-
-	for (vers = start; vers != NULL; vers = vers->next) {
-		for (proc = vers->procs; proc != NULL; proc = proc->next) {
-			if (proc == stop) {
-				return (0);
-			} else if (streq(proc->proc_name, stop->proc_name)) {
-				return (1);
-			}
-		}
+  version_list *vers;
+  proc_list *proc;
+
+  for (vers = start; vers != NULL; vers = vers->next)
+    {
+      for (proc = vers->procs; proc != NULL; proc = proc->next)
+	{
+	  if (proc == stop)
+	    {
+	      return 0;
+	    }
+	  else if (streq (proc->proc_name, stop->proc_name))
+	    {
+	      return 1;
+	    }
 	}
-	abort();
-	/* NOTREACHED */
+    }
+  abort ();
+  /* NOTREACHED */
 }
 
 static void
-pprogramdef(definition *def)
+pfreeprocdef (const char *name, const char *vers, int mode)
 {
-	version_list *vers;
-	proc_list *proc;
-	int i;
-	const char *ext;
-	
-	pargdef(def);
-
-	puldefine(def->def_name, def->def.pr.prog_num);
-	for (vers = def->def.pr.versions; vers != NULL; vers = vers->next) {
-		if (tblflag) {
-			f_print(fout, "extern struct rpcgen_table %s_%s_table[];\n",
-				locase(def->def_name), vers->vers_num);
-			f_print(fout, "extern %s_%s_nproc;\n",
-				locase(def->def_name), vers->vers_num);
+  f_print (fout, "extern int ");
+  pvname (name, vers);
+  if (mode == 1)
+    f_print (fout,"_freeresult (SVCXPRT *, xdrproc_t, caddr_t);\n");
+  else
+    f_print (fout,"_freeresult ();\n");
+}
+
+static void
+pprogramdef (definition *def)
+{
+  version_list *vers;
+  proc_list *proc;
+  int i;
+  const char *ext;
+
+  pargdef (def);
+
+  puldefine (def->def_name, def->def.pr.prog_num);
+  for (vers = def->def.pr.versions; vers != NULL; vers = vers->next)
+    {
+      if (tblflag)
+	{
+	  f_print (fout, "extern struct rpcgen_table %s_%s_table[];\n",
+		   locase (def->def_name), vers->vers_num);
+	  f_print (fout, "extern %s_%s_nproc;\n",
+		   locase (def->def_name), vers->vers_num);
+	}
+      puldefine (vers->vers_name, vers->vers_num);
+
+      /*
+       * Print out 2 definitions, one for ANSI-C, another for
+       * old K & R C
+       */
+
+      if(!Cflag)
+	{
+	  ext = "extern  ";
+	  for (proc = vers->procs; proc != NULL;
+	       proc = proc->next)
+	    {
+	      if (!define_printed(proc, def->def.pr.versions))
+		{
+		  puldefine (proc->proc_name, proc->proc_num);
+		}
+	      f_print (fout, "%s", ext);
+	      pprocdef (proc, vers, NULL, 0, 2);
+
+	      if (mtflag)
+		{
+		  f_print(fout, "%s", ext);
+		  pprocdef (proc, vers, NULL, 1, 2);
+		}
+	    }
+	  pfreeprocdef (def->def_name, vers->vers_num, 2);
+	}
+      else
+	{
+	  for (i = 1; i < 3; i++)
+	    {
+	      if (i == 1)
+		{
+		  f_print (fout, "\n#if defined(__STDC__) || defined(__cplusplus)\n");
+		  ext = "extern  ";
+		}
+	      else
+		{
+		  f_print (fout, "\n#else /* K&R C */\n");
+		  ext = "extern  ";
 		}
-		puldefine(vers->vers_name, vers->vers_num);
-
-		/* 
-		 * Print out 3 definitions, one for ANSI-C, another for C++, 
-		 * a third for old style C 
-		 */
-		   
-		for (i=0;i<3;i++) {
-			if (i==0) {
-				f_print(fout,"\n#ifdef __cplusplus\n");
-				ext="extern \"C\" ";
-			} 
-			else if (i==1) {
-				f_print(fout,"\n#elif __STDC__\n");
-				ext="extern  "  ;
-			} 
-			else {
-				f_print(fout,"\n#else /* Old Style C */ \n");
-				ext="extern  ";
-			}
-			
-			
-			for (proc = vers->procs; proc != NULL; proc = proc->next) {
-				if (!define_printed(proc, def->def.pr.versions)) {
-					puldefine(proc->proc_name, proc->proc_num);
-				}
-				f_print(fout,"%s",ext);
-				pprocdef(proc, vers, "CLIENT *", 0,i);
-				f_print(fout,"%s",ext);
-				pprocdef(proc, vers, "struct svc_req *", 1,i);
-				
-			}
 
+	      for (proc = vers->procs; proc != NULL; proc = proc->next)
+		{
+		  if (!define_printed(proc, def->def.pr.versions))
+		    {
+		      puldefine(proc->proc_name, proc->proc_num);
+		    }
+		  f_print (fout, "%s", ext);
+		  pprocdef (proc, vers, "CLIENT *", 0, i);
+		  f_print (fout, "%s", ext);
+		  pprocdef (proc, vers, "struct svc_req *", 1, i);
 		}
-		f_print(fout,"#endif /* Old Style C */ \n");
+	      pfreeprocdef (def->def_name, vers->vers_num, i);
+	    }
+	  f_print (fout, "#endif /* K&R C */\n");
 	}
+    }
 }
 
 void
-pprocdef(proc_list *proc, version_list *vp, 
-	 const char *addargtype, int server_p, int mode)
+pprocdef (proc_list * proc, version_list * vp,
+	  const char *addargtype, int server_p, int mode)
 {
-
-
-
-
-		ptype( proc->res_prefix, proc->res_type, 1 );
-		f_print( fout, "* " );
-		if( server_p )
-			pvname_svc(proc->proc_name, vp->vers_num);
-		else
-			pvname(proc->proc_name, vp->vers_num);
-
-		/*
-		 * mode  0 == cplusplus, mode  1 = ANSI-C, mode 2 = old style C 
-		 */
-		if(mode == 0 || mode ==1) 
-			parglist(proc, addargtype);
-		else
-			f_print(fout, "();\n");
-
-
-
+  if (mtflag)
+    {/* Print MT style stubs */
+      if (server_p)
+	f_print (fout, "bool_t ");
+      else
+	f_print (fout, "enum clnt_stat ");
+    }
+  else
+    {
+      ptype (proc->res_prefix, proc->res_type, 1);
+      f_print (fout, "* ");
+    }
+  if (server_p)
+    pvname_svc (proc->proc_name, vp->vers_num);
+  else
+    pvname (proc->proc_name, vp->vers_num);
+
+  /*
+   * mode  1 = ANSI-C, mode 2 = K&R C
+   */
+  if (mode == 1)
+    parglist (proc, addargtype);
+  else
+    f_print (fout, "();\n");
 }
 
-
-
 /* print out argument list of procedure */
 static void
-parglist(proc_list *proc, const char *addargtype)
+parglist (proc_list *proc, const char *addargtype)
 {
-	decl_list *dl;
-
-		f_print(fout,"(");
-
-		if( proc->arg_num < 2 && newstyle &&
-		   streq( proc->args.decls->decl.type, "void")) {
-			/* 0 argument in new style:  do nothing */
-		} else {
-			for (dl = proc->args.decls; dl != NULL; dl = dl->next) {
-				ptype( dl->decl.prefix, dl->decl.type, 1 );
-				if( !newstyle )
-					f_print( fout, "*" ); /* old style passes by reference */
-	
-				f_print( fout, ", " );
-			}
-		}
-    
-		f_print(fout, "%s);\n", addargtype);
-
+  decl_list *dl;
+
+  f_print(fout,"(");
+  if (proc->arg_num < 2 && newstyle &&
+      streq (proc->args.decls->decl.type, "void"))
+    {
+      /* 0 argument in new style:  do nothing */
+    }
+  else
+    {
+      for (dl = proc->args.decls; dl != NULL; dl = dl->next)
+	{
+	  ptype (dl->decl.prefix, dl->decl.type, 1);
+	  if (!newstyle)
+	    f_print (fout, "*");	/* old style passes by reference */
+
+	  f_print (fout, ", ");
+	}
+    }
+  if (mtflag)
+    {
+      ptype(proc->res_prefix, proc->res_type, 1);
+      f_print(fout, "*, ");
+    }
+
+  f_print (fout, "%s);\n", addargtype);
 }
 
 static void
-penumdef(definition *def)
+penumdef (definition *def)
 {
-	const char *name = def->def_name;
-	enumval_list *l;
-	const char *last = NULL;
-	int count = 0;
-
-	f_print(fout, "enum %s {\n", name);
-	for (l = def->def.en.vals; l != NULL; l = l->next) {
-		f_print(fout, "\t%s", l->name);
-		if (l->assignment) {
-			f_print(fout, " = %s", l->assignment);
-			last = l->assignment;
-			count = 1;
-		} else {
-			if (last == NULL) {
-				f_print(fout, " = %d", count++);
-			} else {
-				f_print(fout, " = %s + %d", last, count++);
-			}
-		}
-		f_print(fout, ",\n");
+  const char *name = def->def_name;
+  enumval_list *l;
+  const char *last = NULL;
+  int count = 0;
+
+  f_print (fout, "enum %s {\n", name);
+  for (l = def->def.en.vals; l != NULL; l = l->next)
+    {
+      f_print (fout, "\t%s", l->name);
+      if (l->assignment)
+	{
+	  f_print (fout, " = %s", l->assignment);
+	  last = l->assignment;
+	  count = 1;
+	}
+      else
+	{
+	  if (last == NULL)
+	    {
+	      f_print (fout, " = %d", count++);
+	    }
+	  else
+	    {
+	      f_print (fout, " = %s + %d", last, count++);
+	    }
 	}
-	f_print(fout, "};\n");
-	f_print(fout, "typedef enum %s %s;\n", name, name);
+      f_print (fout, ",\n");
+    }
+  f_print (fout, "};\n");
+  f_print (fout, "typedef enum %s %s;\n", name, name);
 }
 
 static void
-ptypedef(definition *def)
+ptypedef (definition *def)
 {
-	const char *name = def->def_name;
-	const char *old = def->def.ty.old_type;
-	char prefix[8];	/* enough to contain "struct ", including NUL */
-	relation rel = def->def.ty.rel;
-
-
-	if (!streq(name, old)) {
-		if (streq(old, "string")) {
-			old = "char";
-			rel = REL_POINTER;
-		} else if (streq(old, "opaque")) {
-			old = "char";
-		} else if (streq(old, "bool")) {
-			old = "bool_t";
-		}
-		if (undefined2(old, name) && def->def.ty.old_prefix) {
-			s_print(prefix, "%s ", def->def.ty.old_prefix);
-		} else {
-			prefix[0] = 0;
-		}
-		f_print(fout, "typedef ");
-		switch (rel) {
-		case REL_ARRAY:
-			f_print(fout, "struct {\n");
-			f_print(fout, "\tu_int %s_len;\n", name);
-			f_print(fout, "\t%s%s *%s_val;\n", prefix, old, name);
-			f_print(fout, "} %s", name);
-			break;
-		case REL_POINTER:
-			f_print(fout, "%s%s *%s", prefix, old, name);
-			break;
-		case REL_VECTOR:
-			f_print(fout, "%s%s %s[%s]", prefix, old, name,
-				def->def.ty.array_max);
-			break;
-		case REL_ALIAS:
-			f_print(fout, "%s%s %s", prefix, old, name);
-			break;
-		}
-		f_print(fout, ";\n");
+  const char *name = def->def_name;
+  const char *old = def->def.ty.old_type;
+  char prefix[8];	  /* enough to contain "struct ", including NUL */
+  relation rel = def->def.ty.rel;
+
+  if (!streq (name, old))
+    {
+      if (streq (old, "string"))
+	{
+	  old = "char";
+	  rel = REL_POINTER;
+	}
+      else if (streq (old, "opaque"))
+	{
+	  old = "char";
+	}
+      else if (streq (old, "bool"))
+	{
+	  old = "bool_t";
+	}
+      if (undefined2 (old, name) && def->def.ty.old_prefix)
+	{
+	  s_print (prefix, "%s ", def->def.ty.old_prefix);
 	}
+      else
+	{
+	  prefix[0] = 0;
+	}
+      f_print (fout, "typedef ");
+      switch (rel)
+	{
+	case REL_ARRAY:
+	  f_print (fout, "struct {\n");
+	  f_print (fout, "\tu_int %s_len;\n", name);
+	  f_print (fout, "\t%s%s *%s_val;\n", prefix, old, name);
+	  f_print (fout, "} %s", name);
+	  break;
+	case REL_POINTER:
+	  f_print (fout, "%s%s *%s", prefix, old, name);
+	  break;
+	case REL_VECTOR:
+	  f_print (fout, "%s%s %s[%s]", prefix, old, name,
+		   def->def.ty.array_max);
+	  break;
+	case REL_ALIAS:
+	  f_print (fout, "%s%s %s", prefix, old, name);
+	  break;
+	}
+      f_print (fout, ";\n");
+    }
 }
 
 void
-pdeclaration(const char *name, declaration *dec, int tab, 
-	     const char *separator)
+pdeclaration (const char *name, declaration * dec, int tab,
+	      const char *separator)
 {
-	char buf[8];	/* enough to hold "struct ", include NUL */
-	const char *prefix;
-	const char *type;
-
-	if (streq(dec->type, "void")) {
-		return;
+  char buf[8];			/* enough to hold "struct ", include NUL */
+  const char *prefix;
+  const char *type;
+
+  if (streq (dec->type, "void"))
+    {
+      return;
+    }
+  tabify (fout, tab);
+  if (streq (dec->type, name) && !dec->prefix)
+    {
+      f_print (fout, "struct ");
+    }
+  if (streq (dec->type, "string"))
+    {
+      f_print (fout, "char *%s", dec->name);
+    }
+  else
+    {
+      prefix = "";
+      if (streq (dec->type, "bool"))
+	{
+	  type = "bool_t";
 	}
-	tabify(fout, tab);
-	if (streq(dec->type, name) && !dec->prefix) {
-		f_print(fout, "struct ");
+      else if (streq (dec->type, "opaque"))
+	{
+	  type = "char";
 	}
-	if (streq(dec->type, "string")) {
-		f_print(fout, "char *%s", dec->name);
-	} else {
-		prefix = "";
-		if (streq(dec->type, "bool")) {
-			type = "bool_t";
-		} else if (streq(dec->type, "opaque")) {
-			type = "char";
-		} else {
-			if (dec->prefix) {
-				s_print(buf, "%s ", dec->prefix);
-				prefix = buf;
-			}
-			type = dec->type;
-		}
-		switch (dec->rel) {
-		case REL_ALIAS:
-			f_print(fout, "%s%s %s", prefix, type, dec->name);
-			break;
-		case REL_VECTOR:
-			f_print(fout, "%s%s %s[%s]", prefix, type, dec->name,
-				dec->array_max);
-			break;
-		case REL_POINTER:
-			f_print(fout, "%s%s *%s", prefix, type, dec->name);
-			break;
-		case REL_ARRAY:
-			f_print(fout, "struct {\n");
-			tabify(fout, tab);
-			f_print(fout, "\tu_int %s_len;\n", dec->name);
-			tabify(fout, tab);
-			f_print(fout, "\t%s%s *%s_val;\n", prefix, type, dec->name);
-			tabify(fout, tab);
-			f_print(fout, "} %s", dec->name);
-			break;
-		}
+      else
+	{
+	  if (dec->prefix)
+	    {
+	      s_print (buf, "%s ", dec->prefix);
+	      prefix = buf;
+	    }
+	  type = dec->type;
+	}
+      switch (dec->rel)
+	{
+	case REL_ALIAS:
+	  f_print (fout, "%s%s %s", prefix, type, dec->name);
+	  break;
+	case REL_VECTOR:
+	  f_print (fout, "%s%s %s[%s]", prefix, type, dec->name,
+		   dec->array_max);
+	  break;
+	case REL_POINTER:
+	  f_print (fout, "%s%s *%s", prefix, type, dec->name);
+	  break;
+	case REL_ARRAY:
+	  f_print (fout, "struct {\n");
+	  tabify (fout, tab);
+	  f_print (fout, "\tu_int %s_len;\n", dec->name);
+	  tabify (fout, tab);
+	  f_print (fout, "\t%s%s *%s_val;\n", prefix, type, dec->name);
+	  tabify (fout, tab);
+	  f_print (fout, "} %s", dec->name);
+	  break;
 	}
-	f_print(fout, separator );
+    }
+  f_print (fout, separator);
 }
 
 static int
-undefined2(const char *type, const char *stop)
+undefined2 (const char *type, const char *stop)
 {
-	list *l;
-	definition *def;
-
-	for (l = defined; l != NULL; l = l->next) {
-		def = (definition *) l->val;
-		if (def->def_kind != DEF_PROGRAM) {
-			if (streq(def->def_name, stop)) {
-				return (1);
-			} else if (streq(def->def_name, type)) {
-				return (0);
-			}
-		}
+  list *l;
+  definition *def;
+
+  for (l = defined; l != NULL; l = l->next)
+    {
+      def = (definition *) l->val;
+      if (def->def_kind != DEF_PROGRAM)
+	{
+	  if (streq (def->def_name, stop))
+	    {
+	      return 1;
+	    }
+	  else if (streq (def->def_name, type))
+	    {
+	      return 0;
+	    }
 	}
-	return (1);
+    }
+  return 1;
 }
diff --git a/sunrpc/rpc_main.c b/sunrpc/rpc_main.c
index a7e18070d0..0b30d6f505 100644
--- a/sunrpc/rpc_main.c
+++ b/sunrpc/rpc_main.c
@@ -31,7 +31,7 @@
 /*
  * From @(#)rpc_main.c 1.30 89/03/30 (C) 1987 SMI;
  */
-char main_rcsid[] =
+const char main_rcsid[] =
   "$Id$";
 
 /*
@@ -52,85 +52,89 @@ char main_rcsid[] =
 #include "rpc_scan.h"
 #include "proto.h"
 
-
 #define EXTEND	1		/* alias for TRUE */
-#define DONT_EXTEND	0		/* alias for FALSE */
-
-#define SVR4_CPP "/usr/ccs/lib/cpp"
-#define SUNOS_CPP "/lib/cpp"
-static int cppDefined = 0;          /* explicit path for C preprocessor */
-
-struct commandline {
-	int cflag;		/* xdr C routines */
-	int hflag;		/* header file */
-	int lflag;		/* client side stubs */
-	int mflag;		/* server side stubs */
-	int nflag;		/* netid flag */
-	int sflag;		/* server stubs for the given transport */
-	int tflag;		/* dispatch Table file */
-	int Ssflag;		/* produce server sample code */
-	int Scflag;		/* produce client sample code */
-	const char *infile;	/* input module name */
-	const char *outfile;	/* output module name */
-};
+#define DONT_EXTEND	0	/* alias for FALSE */
+
+struct commandline
+  {
+    int cflag;			/* xdr C routines */
+    int hflag;			/* header file */
+    int lflag;			/* client side stubs */
+    int mflag;			/* server side stubs */
+    int nflag;			/* netid flag */
+    int sflag;			/* server stubs for the given transport */
+    int tflag;			/* dispatch Table file */
+    int Ssflag;			/* produce server sample code */
+    int Scflag;			/* produce client sample code */
+    int makefileflag;		/* Generate a template Makefile */
+    const char *infile;		/* input module name */
+    const char *outfile;	/* output module name */
+  };
 
 
 static const char *cmdname;
 
+#define SVR4_CPP "/usr/ccs/lib/cpp"
+#define SUNOS_CPP "/lib/cpp"
+
 static const char *svcclosetime = "120";
-static const char *CPP = SVR4_CPP;
+static int cppDefined = 0;	/* explicit path for C preprocessor */
+static const char *CPP = SUNOS_CPP;
 static char CPPFLAGS[] = "-C";
 static char *pathbuf;
-static const char *allv[] = {
-	"rpcgen", "-s", "udp", "-s", "tcp",
+static const char *allv[] =
+{
+  "rpcgen", "-s", "udp", "-s", "tcp",
 };
-static int allc = sizeof(allv)/sizeof(allv[0]);
-static const char *allnv[] = {
-	"rpcgen", "-s", "netpath",
+static int allc = sizeof (allv) / sizeof (allv[0]);
+static const char *allnv[] =
+{
+  "rpcgen", "-s", "netpath",
 };
-static int allnc = sizeof(allnv)/sizeof(allnv[0]);
+static int allnc = sizeof (allnv) / sizeof (allnv[0]);
 
 /*
  * machinations for handling expanding argument list
  */
-static void addarg(const char *);       /* add another argument to the list */
-static void putarg(int, const char *); /* put argument at specified location */
-static void clear_args(void);	        /* clear argument list */
-static void checkfiles(const char *, const char *);
-                                        /* check if out file already exists */
-
-static void clear_args(void);
-static char *extendfile(const char *file, const char *ext);
-static void open_output(const char *infile, const char *outfile);
-static void add_warning(void);
-static void clear_args(void);
-static void find_cpp(void);
-static void open_input(const char *infile, const char *define);
-static int check_nettype(const char *name, const char *list_to_check[]);
-static void c_output(const char *infile, const char *define,
-		     int extend, const char *outfile);
-static void h_output(const char *infile, const char *define,
-		     int extend, const char *outfile);
-static void s_output(int argc, const char *argv[], const char *infile,
-		     const char *define, int extend,
-		     const char *outfile, int nomain, int netflag);
-static void l_output(const char *infile, const char *define,
-		     int extend, const char *outfile);
-static void t_output(const char *infile, const char *define,
-		     int extend, const char *outfile);
-static void svc_output(const char *infile, const char *define,
-		       int extend, const char *outfile);
-static void clnt_output(const char *infile, const char *define,
+static void addarg (const char *);	/* add another argument to the list */
+static void putarg (int, const char *);		/* put argument at specified location */
+static void clear_args (void);	/* clear argument list */
+static void checkfiles (const char *, const char *);
+				       /* check if out file already exists */
+
+static void clear_args (void);
+static char *extendfile (const char *file, const char *ext);
+static void open_output (const char *infile, const char *outfile);
+static void add_warning (void);
+static void clear_args (void);
+static void find_cpp (void);
+static void open_input (const char *infile, const char *define);
+static int check_nettype (const char *name, const char *list_to_check[]);
+static void c_output (const char *infile, const char *define,
+		      int extend, const char *outfile);
+static void h_output (const char *infile, const char *define,
+		      int extend, const char *outfile);
+static void s_output (int argc, const char *argv[], const char *infile,
+		      const char *define, int extend,
+		      const char *outfile, int nomain, int netflag);
+static void l_output (const char *infile, const char *define,
+		      int extend, const char *outfile);
+static void t_output (const char *infile, const char *define,
+		      int extend, const char *outfile);
+static void svc_output (const char *infile, const char *define,
 			int extend, const char *outfile);
-static int do_registers(int argc, const char *argv[]);
-static void addarg(const char *cp);
-static void putarg(int whereto, const char *cp);
-static void checkfiles(const char *infile, const char *outfile);
-static int parseargs(int argc, const char *argv[], struct commandline *cmd);
-static void usage(void);
-static void options_usage(void);
-static void c_initialize(void);
-static char *generate_guard(const char *pathname);
+static void clnt_output (const char *infile, const char *define,
+			 int extend, const char *outfile);
+static void mkfile_output (struct commandline *cmd);
+static int do_registers (int argc, const char *argv[]);
+static void addarg (const char *cp);
+static void putarg (int whereto, const char *cp);
+static void checkfiles (const char *infile, const char *outfile);
+static int parseargs (int argc, const char *argv[], struct commandline *cmd);
+static void usage (void);
+static void options_usage (void);
+static void c_initialize (void);
+static char *generate_guard (const char *pathname);
 
 
 #define ARGLISTLEN	20
@@ -140,235 +144,240 @@ static const char *arglist[ARGLISTLEN];
 static int argcount = FIXEDARGS;
 
 
-int nonfatalerrors;	/* errors */
-int inetdflag/* = 1*/;	/* Support for inetd */ /* is now the default */
-int pmflag;		/* Support for port monitors */
-int logflag;		/* Use syslog instead of fprintf for errors */
-int tblflag;		/* Support for dispatch table file */
+int nonfatalerrors;		/* errors */
+int inetdflag /* = 1 */ ;	/* Support for inetd *//* is now the default */
+int pmflag;			/* Support for port monitors */
+int logflag;			/* Use syslog instead of fprintf for errors */
+int tblflag;			/* Support for dispatch table file */
+int mtflag;			/* Support for MT */
 
 #define INLINE 3
 /*length at which to start doing an inline */
 
-int inlineflag=INLINE; /* length at which to start doing an inline. 3 = default
-		if 0, no xdr_inline code */
+int inlineflag = INLINE;	/* length at which to start doing an inline. 3 = default
+				   if 0, no xdr_inline code */
 
-int indefinitewait;	/* If started by port monitors, hang till it wants */
-int exitnow;		/* If started by port monitors, exit after the call */
-int timerflag;		/* TRUE if !indefinite && !exitnow */
-int newstyle;           /* newstyle of passing arguments (by value) */
+int indefinitewait;		/* If started by port monitors, hang till it wants */
+int exitnow;			/* If started by port monitors, exit after the call */
+int timerflag;			/* TRUE if !indefinite && !exitnow */
+int newstyle;			/* newstyle of passing arguments (by value) */
 #ifdef __GNU_LIBRARY__
-int Cflag = 1 ;         /* ANSI C syntax */
+int Cflag = 1;			/* ANSI C syntax */
 #else
-int Cflag = 0 ;         /* ANSI C syntax */
+int Cflag = 0;			/* ANSI C/C++ syntax */
 #endif
-static int allfiles;   /* generate all files */
+int CCflag = 0;			/* C++ files */
+static int allfiles;		/* generate all files */
 #ifdef __GNU_LIBRARY__
-int tirpcflag = 0;       /* generating code for tirpc, by default */
+int tirpcflag = 0;		/* generating code for tirpc, by default */
 #else
-int tirpcflag = 1;       /* generating code for tirpc, by default */
-#endif
-
-#ifdef __GNU_LIBRARY__
-int building_libc = 0;	/* running as part of libc built process */
+int tirpcflag = 1;		/* generating code for tirpc, by default */
 #endif
+xdrfunc *xdrfunc_head = NULL;	/* xdr function list */
+xdrfunc *xdrfunc_tail = NULL;	/* xdr function list */
 
 int
-main(int argc, const char *argv[])
+main (int argc, const char *argv[])
 {
-	struct commandline cmd;
+  struct commandline cmd;
 
-	(void) memset((char *)&cmd, 0, sizeof (struct commandline));
-	clear_args();
-	if (!parseargs(argc, argv, &cmd))
-		usage();
+  (void) memset ((char *) &cmd, 0, sizeof (struct commandline));
+  clear_args ();
+  if (!parseargs (argc, argv, &cmd))
+    usage ();
 
-	if (cmd.cflag || cmd.hflag || cmd.lflag || cmd.tflag || cmd.sflag ||
-		cmd.mflag || cmd.nflag || cmd.Ssflag || cmd.Scflag ) {
-	  checkfiles(cmd.infile, cmd.outfile);
+  if (cmd.cflag || cmd.hflag || cmd.lflag || cmd.tflag || cmd.sflag ||
+      cmd.mflag || cmd.nflag || cmd.Ssflag || cmd.Scflag)
+    {
+      checkfiles (cmd.infile, cmd.outfile);
+    }
+  else
+    checkfiles (cmd.infile, NULL);
+
+  if (cmd.cflag)
+    c_output (cmd.infile, "-DRPC_XDR", DONT_EXTEND, cmd.outfile);
+  else if (cmd.hflag)
+    h_output (cmd.infile, "-DRPC_HDR", DONT_EXTEND, cmd.outfile);
+  else if (cmd.lflag)
+    l_output (cmd.infile, "-DRPC_CLNT", DONT_EXTEND, cmd.outfile);
+  else if (cmd.sflag || cmd.mflag || (cmd.nflag))
+    s_output (argc, argv, cmd.infile, "-DRPC_SVC", DONT_EXTEND,
+	      cmd.outfile, cmd.mflag, cmd.nflag);
+  else if (cmd.tflag)
+    t_output (cmd.infile, "-DRPC_TBL", DONT_EXTEND, cmd.outfile);
+  else if (cmd.Ssflag)
+    svc_output (cmd.infile, "-DRPC_SERVER", DONT_EXTEND, cmd.outfile);
+  else if (cmd.Scflag)
+    clnt_output (cmd.infile, "-DRPC_CLIENT", DONT_EXTEND, cmd.outfile);
+  else if (cmd.makefileflag)
+    mkfile_output (&cmd);
+  else
+    {
+      /* the rescans are required, since cpp may effect input */
+      c_output (cmd.infile, "-DRPC_XDR", EXTEND, "_xdr.c");
+      reinitialize ();
+      h_output (cmd.infile, "-DRPC_HDR", EXTEND, ".h");
+      reinitialize ();
+      l_output (cmd.infile, "-DRPC_CLNT", EXTEND, "_clnt.c");
+      reinitialize ();
+      if (inetdflag || !tirpcflag)
+	s_output (allc, allv, cmd.infile, "-DRPC_SVC", EXTEND,
+		  "_svc.c", cmd.mflag, cmd.nflag);
+      else
+	s_output (allnc, allnv, cmd.infile, "-DRPC_SVC",
+		  EXTEND, "_svc.c", cmd.mflag, cmd.nflag);
+      if (tblflag)
+	{
+	  reinitialize ();
+	  t_output (cmd.infile, "-DRPC_TBL", EXTEND, "_tbl.i");
 	}
-	else
-	  checkfiles(cmd.infile,NULL);
-
-	if (cmd.cflag) {
-		c_output(cmd.infile, "-DRPC_XDR", DONT_EXTEND, cmd.outfile);
-	} else if (cmd.hflag) {
-		h_output(cmd.infile, "-DRPC_HDR", DONT_EXTEND, cmd.outfile);
-	} else if (cmd.lflag) {
-		l_output(cmd.infile, "-DRPC_CLNT", DONT_EXTEND, cmd.outfile);
-	} else if (cmd.sflag || cmd.mflag || (cmd.nflag)) {
-		s_output(argc, argv, cmd.infile, "-DRPC_SVC", DONT_EXTEND,
-			 cmd.outfile, cmd.mflag, cmd.nflag);
-	} else if (cmd.tflag) {
-		t_output(cmd.infile, "-DRPC_TBL", DONT_EXTEND, cmd.outfile);
-	} else if  (cmd.Ssflag) {
-		  svc_output(cmd.infile, "-DRPC_SERVER", DONT_EXTEND, cmd.outfile);
-	} else if (cmd.Scflag) {
-		  clnt_output(cmd.infile, "-DRPC_CLIENT", DONT_EXTEND, cmd.outfile);
-	} else {
-		/* the rescans are required, since cpp may effect input */
-		c_output(cmd.infile, "-DRPC_XDR", EXTEND, "_xdr.c");
-		reinitialize();
-		h_output(cmd.infile, "-DRPC_HDR", EXTEND, ".h");
-		reinitialize();
-		l_output(cmd.infile, "-DRPC_CLNT", EXTEND, "_clnt.c");
-		reinitialize();
-		if (inetdflag || !tirpcflag )
-			s_output(allc, allv, cmd.infile, "-DRPC_SVC", EXTEND,
-				 "_svc.c", cmd.mflag, cmd.nflag);
-		else
-			s_output(allnc, allnv, cmd.infile, "-DRPC_SVC",
-				 EXTEND, "_svc.c", cmd.mflag, cmd.nflag);
-		if (tblflag) {
-			reinitialize();
-			t_output(cmd.infile, "-DRPC_TBL", EXTEND, "_tbl.i");
-		}
-		if (allfiles) {
-		  reinitialize();
-		  svc_output(cmd.infile, "-DRPC_SERVER", EXTEND, "_server.c");
-		}
-		if (allfiles) {
-		  reinitialize();
-		  clnt_output(cmd.infile, "-DRPC_CLIENT", EXTEND, "_client.c");
-		}
+      if (allfiles)
+	{
+	  reinitialize ();
+	  svc_output (cmd.infile, "-DRPC_SERVER", EXTEND, "_server.c");
+	  reinitialize ();
+	  clnt_output (cmd.infile, "-DRPC_CLIENT", EXTEND, "_client.c");
 	}
-	exit(nonfatalerrors);
-	/* NOTREACHED */
+      if (allfiles || (cmd.makefileflag == 1))
+	{
+	  reinitialize ();
+	  mkfile_output (&cmd);
+	}
+    }
+  exit (nonfatalerrors);
+  /* NOTREACHED */
 }
 
 /*
  * add extension to filename
  */
 static char *
-extendfile(const char *file, const char *ext)
+extendfile (const char *file, const char *ext)
 {
-	char *res;
-	const char *p;
-
-	res = alloc(strlen(file) + strlen(ext) + 1);
-	if (res == NULL) {
-		abort();
-	}
-	p = strrchr(file, '.');
-	if (p == NULL) {
-		p = file + strlen(file);
-	}
-	(void) strcpy(res, file);
-	(void) strcpy(res + (p - file), ext);
-	return (res);
+  char *res;
+  const char *p;
+
+  res = alloc (strlen (file) + strlen (ext) + 1);
+  if (res == NULL)
+    abort ();
+  p = strrchr (file, '.');
+  if (p == NULL)
+    p = file + strlen (file);
+  strcpy (res, file);
+  strcpy (res + (p - file), ext);
+  return res;
 }
 
 /*
  * Open output file with given extension
  */
 static void
-open_output(const char *infile, const char *outfile)
+open_output (const char *infile, const char *outfile)
 {
+  if (outfile == NULL)
+    {
+      fout = stdout;
+      return;
+    }
 
-	if (outfile == NULL) {
-		fout = stdout;
-		return;
-	}
-
-	if (infile != NULL && streq(outfile, infile)) {
-		f_print(stderr, "%s: output would overwrite %s\n", cmdname,
-			infile);
-		crash();
-	}
-	fout = fopen(outfile, "w");
-	if (fout == NULL) {
-		f_print(stderr, "%s: unable to open ", cmdname);
-		perror(outfile);
-		crash();
-	}
-	record_open(outfile);
-}
-
-static void
-add_warning(void)
-{
-	f_print(fout, "/*\n");
-	f_print(fout, " * Please do not edit this file.\n");
-	f_print(fout, " * It was generated using rpcgen.\n");
-	f_print(fout, " */\n\n");
+  if (infile != NULL && streq (outfile, infile))
+    {
+      fprintf (stderr, _ ("%s: output would overwrite %s\n"), cmdname,
+	       infile);
+      crash ();
+    }
+  fout = fopen (outfile, "w");
+  if (fout == NULL)
+    {
+      fprintf (stderr, _ ("%s: unable to open "), cmdname);
+      perror (outfile);
+      crash ();
+    }
+  record_open (outfile);
 }
 
 static void
-add_stdheaders(void)
+add_warning (void)
 {
-	f_print(fout, "#include <rpc/types.h>\n");
-	f_print(fout, "#include <rpc/xdr.h>\n\n");
+  fprintf (fout, "/*\n");
+  fprintf (fout, " * Please do not edit this file.\n");
+  fprintf (fout, " * It was generated using rpcgen.\n");
+  fprintf (fout, " */\n\n");
 }
 
 /* clear list of arguments */
-static void clear_args(void)
+static void
+clear_args (void)
 {
   int i;
-  for( i=FIXEDARGS; i<ARGLISTLEN; i++ )
+  for (i = FIXEDARGS; i < ARGLISTLEN; ++i)
     arglist[i] = NULL;
   argcount = FIXEDARGS;
 }
 
 /* make sure that a CPP exists */
-static void find_cpp(void)
+static void
+find_cpp (void)
 {
   struct stat buf;
 
-  if (stat(CPP, &buf) < 0 )  {	/* SVR4 or explicit cpp does not exist */
-    if (cppDefined) {
-      fprintf( stderr, "cannot find C preprocessor: %s \n", CPP );
-      crash();
-    } else {			/* try the other one */
-      CPP = SUNOS_CPP;
-      if( stat( CPP, &buf ) < 0 ) { /* can't find any cpp */
-	fprintf( stderr, "cannot find any C preprocessor (cpp)\n" );
-	crash();
-      }
+  if (stat (CPP, &buf) < 0)
+    {				/* /lib/cpp or explicit cpp does not exist */
+      if (cppDefined)
+	{
+	  fprintf (stderr, _ ("cannot find C preprocessor: %s \n"), CPP);
+	  crash ();
+	}
+      else
+	{			/* try the other one */
+	  CPP = SVR4_CPP;
+	  if (stat (CPP, &buf) < 0)
+	    {			/* can't find any cpp */
+	      fputs (_ ("cannot find any C preprocessor (cpp)\n"), stdout);
+	      crash ();
+	    }
+	}
     }
-  }
 }
 
 /*
  * Open input file with given define for C-preprocessor
  */
 static void
-open_input(const char *infile, const char *define)
+open_input (const char *infile, const char *define)
 {
-	int pd[2];
-
-	infilename = (infile == NULL) ? "<stdin>" : infile;
-	(void) pipe(pd);
-	switch (fork()) {
-	case 0:
-#ifdef __GNU_LIBRARY__
-		/* While building libc we don't want to use the libc from
-		   the build directory which may be incompatible with the
-		   installed dynamic linker.  */
-		if (building_libc)
-		  unsetenv ("LD_LIBRARY_PATH");
-#endif
-		find_cpp();
-		putarg(0, CPP);
-		putarg(1, CPPFLAGS);
-		addarg(define);
-		addarg(infile);
-		addarg((char *)NULL);
-		(void) close(1);
-		(void) dup2(pd[1], 1);
-		(void) close(pd[0]);
-		execv(arglist[0], (char **)arglist);
-		perror("execv");
-		exit(1);
-	case -1:
-		perror("fork");
-		exit(1);
-	}
-	(void) close(pd[1]);
-	fin = fdopen(pd[0], "r");
-	if (fin == NULL) {
-		f_print(stderr, "%s: ", cmdname);
-		perror(infilename);
-		crash();
-	}
+  int pd[2];
+
+  infilename = (infile == NULL) ? "<stdin>" : infile;
+  pipe (pd);
+  switch (fork ())
+    {
+    case 0:
+      find_cpp ();
+      putarg (0, CPP);
+      putarg (1, CPPFLAGS);
+      addarg (define);
+      if (infile)
+	addarg (infile);
+      addarg ((char *) NULL);
+      close (1);
+      dup2 (pd[1], 1);
+      close (pd[0]);
+      execv (arglist[0], (char **) arglist);
+      perror ("execv");
+      exit (1);
+    case -1:
+      perror ("fork");
+      exit (1);
+    }
+  close (pd[1]);
+  fin = fdopen (pd[0], "r");
+  if (fin == NULL)
+    {
+      fprintf (stderr, "%s: ", cmdname);
+      perror (infilename);
+      crash ();
+    }
 }
 
 /* valid tirpc nettypes */
@@ -384,7 +393,7 @@ static const char *valid_ti_nettypes[] =
   "tcp",
   "raw",
   NULL
-  };
+};
 
 /* valid inetd nettypes */
 static const char *valid_i_nettypes[] =
@@ -394,14 +403,18 @@ static const char *valid_i_nettypes[] =
   NULL
 };
 
-static int check_nettype(const char *name, const char *list_to_check[]) {
+static int
+check_nettype (const char *name, const char *list_to_check[])
+{
   int i;
-  for( i = 0; list_to_check[i] != NULL; i++ ) {
-	  if( strcmp( name, list_to_check[i] ) == 0 ) {
-	    return 1;
-	  }
-  }
-  f_print( stderr, "illegal nettype :\'%s\'\n", name );
+  for (i = 0; list_to_check[i] != NULL; i++)
+    {
+      if (strcmp (name, list_to_check[i]) == 0)
+	{
+	  return 1;
+	}
+    }
+  fprintf (stderr, _ ("illegal nettype :\'%s\'\n"), name);
   return 0;
 }
 
@@ -410,49 +423,49 @@ static int check_nettype(const char *name, const char *list_to_check[]) {
  */
 
 static void
-c_output(const char *infile, const char *define, int extend,
-	 const char *outfile)
+c_output (const char *infile, const char *define, int extend,
+	  const char *outfile)
 {
-	definition *def;
-	char *include;
-	const char *outfilename;
-	long tell;
-
-	c_initialize();
-	open_input(infile, define);
-	outfilename = extend ? extendfile(infile, outfile) : outfile;
-	open_output(infile, outfilename);
-	add_warning();
-	add_stdheaders();
-	if (infile && (include = extendfile(infile, ".h"))) {
-		f_print(fout, "#include \"%s\"\n", include);
-		free(include);
-		/* .h file already contains rpc/rpc.h */
-	} else
-	  f_print(fout, "#include <rpc/rpc.h>\n");
-	tell = ftell(fout);
-	while ((def = get_definition())!=NULL) {
-		emit(def);
-	}
-	if (extend && tell == ftell(fout)) {
-		(void) unlink(outfilename);
-	}
+  definition *def;
+  char *include;
+  const char *outfilename;
+  long tell;
+
+  c_initialize ();
+  open_input (infile, define);
+  outfilename = extend ? extendfile (infile, outfile) : outfile;
+  open_output (infile, outfilename);
+  add_warning ();
+  if (infile && (include = extendfile (infile, ".h")))
+    {
+      fprintf (fout, "#include \"%s\"\n", include);
+      free (include);
+      /* .h file already contains rpc/rpc.h */
+    }
+  else
+    fprintf (fout, "#include <rpc/rpc.h>\n");
+  tell = ftell (fout);
+  while ((def = get_definition ()) != NULL)
+    emit (def);
+
+  if (extend && tell == ftell (fout))
+    unlink (outfilename);
 }
 
 void
-c_initialize(void)
+c_initialize (void)
 {
 
   /* add all the starting basic types */
 
-  add_type(1,"int");
-  add_type(1,"long");
-  add_type(1,"short");
-  add_type(1,"bool");
+  add_type (1, "int");
+  add_type (1, "long");
+  add_type (1, "short");
+  add_type (1, "bool");
 
-  add_type(1,"u_int");
-  add_type(1,"u_long");
-  add_type(1,"u_short");
+  add_type (1, "u_int");
+  add_type (1, "u_long");
+  add_type (1, "u_short");
 
 }
 
@@ -465,23 +478,26 @@ char rpcgen_table_dcl[] = "struct rpcgen_table {\n\
 };\n";
 
 
-static char *generate_guard(const char *pathname) {
-        const char *filename;
-	char *guard, *tmp;
-
-	filename = strrchr(pathname, '/' );  /* find last component */
-	filename = ((filename == NULL) ? pathname : filename+1);
-	guard = strdup(filename);
-	/* convert to upper case */
-	tmp = guard;
-	while (*tmp) {
-		if (islower(*tmp))
-			*tmp = toupper(*tmp);
-		tmp++;
-	}
+static char *
+generate_guard (const char *pathname)
+{
+  const char *filename;
+  char *guard, *tmp;
+
+  filename = strrchr (pathname, '/');	/* find last component */
+  filename = ((filename == NULL) ? pathname : filename + 1);
+  guard = strdup (filename);
+  /* convert to upper case */
+  tmp = guard;
+  while (*tmp)
+    {
+      if (islower (*tmp))
+	*tmp = toupper (*tmp);
+      tmp++;
+    }
 
-	guard = extendfile(guard, "_H_RPCGEN");
-	return guard;
+  guard = extendfile (guard, "_H_RPCGEN");
+  return guard;
 }
 
 /*
@@ -490,256 +506,354 @@ static char *generate_guard(const char *pathname) {
 
 
 static void
-h_output(const char *infile, const char *define, int extend,
-	 const char *outfile)
+h_output (const char *infile, const char *define, int extend,
+	  const char *outfile)
 {
-	definition *def;
-	const char *ifilename;
-	const char *outfilename;
-	long tell;
-	char *guard;
-	list *l;
-
-	open_input(infile, define);
-	outfilename =  extend ? extendfile(infile, outfile) : outfile;
-	open_output(infile, outfilename);
-	add_warning();
-	ifilename = (infile == NULL) ? "STDIN" : infile;
-	guard = generate_guard(  outfilename ? outfilename: ifilename );
-
-	f_print(fout,"#ifndef _%s\n#define _%s\n\n", guard,
-		guard);
-
-	f_print(fout, "#include <rpc/rpc.h>\n\n");
-
-	tell = ftell(fout);
-	/* print data definitions */
-	while ((def = get_definition())!=NULL) {
-		print_datadef(def);
-	}
+  xdrfunc *xdrfuncp;
+  definition *def;
+  const char *ifilename;
+  const char *outfilename;
+  long tell;
+  char *guard;
+  list *l;
 
-	/* print function declarations.
-	   Do this after data definitions because they might be used as
-	   arguments for functions */
-	for (l = defined; l != NULL; l = l->next) {
-		print_funcdef(l->val);
+  open_input (infile, define);
+  outfilename = extend ? extendfile (infile, outfile) : outfile;
+  open_output (infile, outfilename);
+  add_warning ();
+  ifilename = (infile == NULL) ? "STDIN" : infile;
+  guard = generate_guard (outfilename ? outfilename : ifilename);
+
+  fprintf (fout, "#ifndef _%s\n#define _%s\n\n", guard,
+	   guard);
+
+  fprintf (fout, "#include <rpc/rpc.h>\n\n");
+
+  if (mtflag)
+    {
+      fprintf (fout, "#include <pthread.h>\n");
+    }
+
+  /* put the C++ support */
+  if (Cflag && !CCflag)
+    {
+      fprintf (fout, "\n#ifdef __cplusplus\n");
+      fprintf (fout, "extern \"C\" {\n");
+      fprintf (fout, "#endif\n\n");
+    }
+
+  tell = ftell (fout);
+  /* print data definitions */
+  while ((def = get_definition ()) != NULL)
+    {
+      print_datadef (def);
+    }
+
+  /* print function declarations.
+     Do this after data definitions because they might be used as
+     arguments for functions */
+  for (l = defined; l != NULL; l = l->next)
+    {
+      print_funcdef (l->val);
+    }
+  /* Now  print all xdr func declarations */
+  if (xdrfunc_head != NULL)
+    {
+      fprintf (fout, "\n/* the xdr functions */\n");
+      if (CCflag)
+	{
+	  fprintf (fout, "\n#ifdef __cplusplus\n");
+	  fprintf (fout, "extern \"C\" {\n");
+	  fprintf (fout, "#endif\n");
+	}
+      if (!Cflag)
+	{
+	  xdrfuncp = xdrfunc_head;
+	  while (xdrfuncp != NULL)
+	    {
+	      print_xdr_func_def (xdrfuncp->name,
+				  xdrfuncp->pointerp, 2);
+	      xdrfuncp = xdrfuncp->next;
+	    }
 	}
-	if (extend && tell == ftell(fout)) {
-		(void) unlink(outfilename);
-	} else if (tblflag) {
-		f_print(fout, rpcgen_table_dcl);
+      else
+	{
+	  int i;
+
+	  for (i = 1; i < 3; ++i)
+	    {
+	      if (i == 1)
+		fprintf (fout, "\n#if defined(__STDC__) || defined(__cplusplus)\n");
+	      else
+		fprintf (fout, "\n#else /* K&R C */\n");
+
+	      xdrfuncp = xdrfunc_head;
+	      while (xdrfuncp != NULL)
+		{
+		  print_xdr_func_def (xdrfuncp->name,
+				      xdrfuncp->pointerp, i);
+		  xdrfuncp = xdrfuncp->next;
+		}
+	    }
+	  fprintf (fout, "\n#endif /* K&R C */\n");
 	}
-	f_print(fout, "\n#endif /* !_%s */\n", guard);
+    }
+
+  if (extend && tell == ftell (fout))
+    {
+      unlink (outfilename);
+    }
+  else if (tblflag)
+    {
+      fprintf (fout, rpcgen_table_dcl);
+    }
+
+  if (Cflag)
+    {
+      fprintf (fout, "\n#ifdef __cplusplus\n");
+      fprintf (fout, "}\n");
+      fprintf (fout, "#endif\n");
+    }
+
+  fprintf (fout, "\n#endif /* !_%s */\n", guard);
 }
 
 /*
  * Compile into an RPC service
  */
 static void
-s_output(int argc, const char *argv[], const char *infile, const char *define,
-	 int extend, const char *outfile, int nomain, int netflag)
+s_output (int argc, const char *argv[], const char *infile, const char *define,
+	  int extend, const char *outfile, int nomain, int netflag)
 {
-	char *include;
-	definition *def;
-	int foundprogram = 0;
-	const char *outfilename;
-
-	open_input(infile, define);
-	outfilename = extend ? extendfile(infile, outfile) : outfile;
-	open_output(infile, outfilename);
-	add_warning();
-	if (infile && (include = extendfile(infile, ".h"))) {
-		f_print(fout, "#include \"%s\"\n", include);
-		free(include);
-	} else
-	  f_print(fout, "#include <rpc/rpc.h>\n");
-
-	f_print(fout, "#include <stdio.h>\n");
-	f_print(fout, "#include <stdlib.h>/* getenv, exit */\n");
-	if (Cflag) {
-		f_print (fout, "#include <rpc/pmap_clnt.h> /* for pmap_unset */\n");
-		f_print (fout, "#include <string.h> /* strcmp */ \n");
-	}
-	if (strcmp(svcclosetime, "-1") == 0)
-		indefinitewait = 1;
-	else if (strcmp(svcclosetime, "0") == 0)
-		exitnow = 1;
-	else if (inetdflag || pmflag) {
-		f_print(fout, "#include <signal.h>\n");
-	  timerflag = 1;
-	}
+  char *include;
+  definition *def;
+  int foundprogram = 0;
+  const char *outfilename;
+
+  open_input (infile, define);
+  outfilename = extend ? extendfile (infile, outfile) : outfile;
+  open_output (infile, outfilename);
+  add_warning ();
+  if (infile && (include = extendfile (infile, ".h")))
+    {
+      fprintf (fout, "#include \"%s\"\n", include);
+      free (include);
+    }
+  else
+    fprintf (fout, "#include <rpc/rpc.h>\n");
+
+  fprintf (fout, "#include <stdio.h>\n");
+  fprintf (fout, "#include <stdlib.h>\n");
+  if (Cflag)
+    {
+      fprintf (fout, "#include <rpc/pmap_clnt.h>\n");
+      fprintf (fout, "#include <string.h>\n");
+    }
+  if (strcmp (svcclosetime, "-1") == 0)
+    indefinitewait = 1;
+  else if (strcmp (svcclosetime, "0") == 0)
+    exitnow = 1;
+  else if (inetdflag || pmflag)
+    {
+      fprintf (fout, "#include <signal.h>\n");
+      timerflag = 1;
+    }
 
-	if( !tirpcflag && inetdflag )
+  if (!tirpcflag && inetdflag)
 #ifdef __GNU_LIBRARY__
-	  f_print(fout, "#include <sys/ioctl.h> /* ioctl, TIOCNOTTY */\n");
+    fprintf (fout, "#include <sys/ioctl.h> /* ioctl, TIOCNOTTY */\n");
 #else
-	  f_print(fout, "#include <sys/ttycom.h>/* TIOCNOTTY */\n");
+    fprintf (fout, "#include <sys/ttycom.h>/* TIOCNOTTY */\n");
 #endif
-	if( Cflag && (inetdflag || pmflag ) ) {
+  if (Cflag && (inetdflag || pmflag))
+    {
 #ifdef __GNU_LIBRARY__
-	  f_print(fout, "#include <sys/types.h> /* open */\n");
-	  f_print(fout, "#include <sys/stat.h> /* open */\n");
-	  f_print(fout, "#include <fcntl.h> /* open */\n");
-	  f_print(fout, "#include <unistd.h> /* getdtablesize */\n");
+      fprintf (fout, "#include <sys/types.h> /* open */\n");
+      fprintf (fout, "#include <sys/stat.h> /* open */\n");
+      fprintf (fout, "#include <fcntl.h> /* open */\n");
+      fprintf (fout, "#include <unistd.h> /* getdtablesize */\n");
 #else
-	  f_print(fout, "#ifdef __cplusplus\n");
-	  f_print(fout, "#include <sysent.h> /* getdtablesize, open */\n");
-	  f_print(fout, "#endif /* __cplusplus */\n");
+      fprintf (fout, "#ifdef __cplusplus\n");
+      fprintf (fout, "#include <sysent.h> /* getdtablesize, open */\n");
+      fprintf (fout, "#endif /* __cplusplus */\n");
+      if (tirpcflag)
+	fprintf (fout, "#include <unistd.h> /* setsid */\n");
 #endif
-	  if( tirpcflag )
-	    f_print(fout, "#include <unistd.h> /* setsid */\n");
-	}
-	if( tirpcflag )
-	  f_print(fout, "#include <sys/types.h>\n");
+    }
+#ifdef __GNU_LIBRARY__
+  if (tirpcflag && !(Cflag && (inetdflag || pmflag)))
+#else
+  if (tirpcflag)
+#endif
+    fprintf (fout, "#include <sys/types.h>\n");
 
-	f_print(fout, "#include <memory.h>\n");
+  fprintf (fout, "#include <memory.h>\n");
 #ifndef __GNU_LIBRARY__
-	f_print(fout, "#include <stropts.h>\n");
+  fprintf (fout, "#include <stropts.h>\n");
 #endif
-	if (inetdflag || !tirpcflag ) {
-		f_print(fout, "#include <sys/socket.h>\n");
-		f_print(fout, "#include <netinet/in.h>\n");
-	}
+  if (inetdflag || !tirpcflag)
+    {
+      fprintf (fout, "#include <sys/socket.h>\n");
+      fprintf (fout, "#include <netinet/in.h>\n");
+    }
 
-	if ( (netflag || pmflag) && tirpcflag ) {
-		f_print(fout, "#include <netconfig.h>\n");
-	}
-	if (/*timerflag &&*/ tirpcflag)
-		f_print(fout, "#include <sys/resource.h> /* rlimit */\n");
-	if (logflag || inetdflag || pmflag) {
+  if ((netflag || pmflag) && tirpcflag && !nomain)
+    {
+      fprintf (fout, "#include <netconfig.h>\n");
+    }
+  if ( /*timerflag && */ tirpcflag)
+    fprintf (fout, "#include <sys/resource.h> /* rlimit */\n");
+  if (logflag || inetdflag || pmflag)
+    {
 #ifdef __GNU_LIBRARY__
-		f_print(fout, "#include <syslog.h>\n");
+      fprintf (fout, "#include <syslog.h>\n");
 #else
-		f_print(fout, "#ifdef SYSLOG\n");
-		f_print(fout, "#include <syslog.h>\n");
-		f_print(fout, "#else\n");
-		f_print(fout, "#define LOG_ERR 1\n");
-		f_print(fout, "#define openlog(a, b, c)\n");
-		f_print(fout, "#endif\n");
+      fprintf (fout, "#ifdef SYSLOG\n");
+      fprintf (fout, "#include <syslog.h>\n");
+      fprintf (fout, "#else\n");
+      fprintf (fout, "#define LOG_ERR 1\n");
+      fprintf (fout, "#define openlog(a, b, c)\n");
+      fprintf (fout, "#endif\n");
 #endif
-	}
+    }
 
-	/* for ANSI-C */
-	f_print(fout, "\n#ifdef __STDC__\n#define SIG_PF void(*)(int)\n#endif\n");
+  /* for ANSI-C */
+  if (Cflag)
+    fprintf (fout, "\n#ifndef SIG_PF\n#define SIG_PF void(*)(int)\n#endif\n");
 
 #ifndef __GNU_LIBRARY__
-	f_print(fout, "\n#ifdef DEBUG\n#define RPC_SVC_FG\n#endif\n");
+  fprintf (fout, "\n#ifdef DEBUG\n#define RPC_SVC_FG\n#endif\n");
 #endif
-	if (timerflag)
-		f_print(fout, "\n#define _RPCSVC_CLOSEDOWN %s\n", svcclosetime);
-	while ((def = get_definition())!=NULL) {
-		foundprogram |= (def->def_kind == DEF_PROGRAM);
-	}
-	if (extend && !foundprogram) {
-		(void) unlink(outfilename);
-		return;
-	}
-	write_most(infile, netflag, nomain);
-	if (!nomain) {
-		if( !do_registers(argc, argv) ) {
-		  if (outfilename)
-		    (void) unlink(outfilename);
-		  usage();
-		}
-		write_rest();
+  if (timerflag)
+    fprintf (fout, "\n#define _RPCSVC_CLOSEDOWN %s\n", svcclosetime);
+  while ((def = get_definition ()) != NULL)
+    {
+      foundprogram |= (def->def_kind == DEF_PROGRAM);
+    }
+  if (extend && !foundprogram)
+    {
+      unlink (outfilename);
+      return;
+    }
+  write_most (infile, netflag, nomain);
+  if (!nomain)
+    {
+      if (!do_registers (argc, argv))
+	{
+	  if (outfilename)
+	    unlink (outfilename);
+	  usage ();
 	}
+      write_rest ();
+    }
 }
 
 /*
  * generate client side stubs
  */
 static void
-l_output(const char *infile, const char *define, int extend,
-	 const char *outfile)
+l_output (const char *infile, const char *define, int extend,
+	  const char *outfile)
 {
-	char *include;
-	definition *def;
-	int foundprogram = 0;
-	const char *outfilename;
-
-	open_input(infile, define);
-	outfilename = extend ? extendfile(infile, outfile) : outfile;
-	open_output(infile, outfilename);
-	add_warning();
-	if (Cflag)
-	  f_print (fout, "#include <memory.h> /* for memset */\n");
-	if (infile && (include = extendfile(infile, ".h"))) {
-		f_print(fout, "#include \"%s\"\n", include);
-		free(include);
-	} else
-	  f_print(fout, "#include <rpc/rpc.h>\n");
-	while ((def = get_definition())!=NULL) {
-		foundprogram |= (def->def_kind == DEF_PROGRAM);
-	}
-	if (extend && !foundprogram) {
-		(void) unlink(outfilename);
-		return;
-	}
-	write_stubs();
+  char *include;
+  definition *def;
+  int foundprogram = 0;
+  const char *outfilename;
+
+  open_input (infile, define);
+  outfilename = extend ? extendfile (infile, outfile) : outfile;
+  open_output (infile, outfilename);
+  add_warning ();
+  if (Cflag)
+    fprintf (fout, "#include <memory.h> /* for memset */\n");
+  if (infile && (include = extendfile (infile, ".h")))
+    {
+      fprintf (fout, "#include \"%s\"\n", include);
+      free (include);
+    }
+  else
+    fprintf (fout, "#include <rpc/rpc.h>\n");
+  while ((def = get_definition ()) != NULL)
+    {
+      foundprogram |= (def->def_kind == DEF_PROGRAM);
+    }
+  if (extend && !foundprogram)
+    {
+      unlink (outfilename);
+      return;
+    }
+  write_stubs ();
 }
 
 /*
  * generate the dispatch table
  */
 static void
-t_output(const char *infile, const char *define, int extend,
-	 const char *outfile)
+t_output (const char *infile, const char *define, int extend,
+	  const char *outfile)
 {
-	definition *def;
-	int foundprogram = 0;
-	const char *outfilename;
-
-	open_input(infile, define);
-	outfilename = extend ? extendfile(infile, outfile) : outfile;
-	open_output(infile, outfilename);
-	add_warning();
-	while ((def = get_definition())!=NULL) {
-		foundprogram |= (def->def_kind == DEF_PROGRAM);
-	}
-	if (extend && !foundprogram) {
-		(void) unlink(outfilename);
-		return;
-	}
-	write_tables();
+  definition *def;
+  int foundprogram = 0;
+  const char *outfilename;
+
+  open_input (infile, define);
+  outfilename = extend ? extendfile (infile, outfile) : outfile;
+  open_output (infile, outfilename);
+  add_warning ();
+  while ((def = get_definition ()) != NULL)
+    {
+      foundprogram |= (def->def_kind == DEF_PROGRAM);
+    }
+  if (extend && !foundprogram)
+    {
+      unlink (outfilename);
+      return;
+    }
+  write_tables ();
 }
 
 /* sample routine for the server template */
 static void
-svc_output(const char *infile, const char *define, int extend,
-	   const char *outfile)
+svc_output (const char *infile, const char *define, int extend,
+	    const char *outfile)
 {
   definition *def;
   char *include;
   const char *outfilename;
   long tell;
 
-  open_input(infile, define);
-  outfilename = extend ? extendfile(infile, outfile) : outfile;
-  checkfiles(infile,outfilename); /*check if outfile already exists.
-				  if so, print an error message and exit*/
-  open_output(infile, outfilename);
-  add_sample_msg();
-
-  if (infile && (include = extendfile(infile, ".h"))) {
-    f_print(fout, "#include \"%s\"\n", include);
-    free(include);
-  } else
-    f_print(fout, "#include <rpc/rpc.h>\n");
-
-  tell = ftell(fout);
-  while ((def = get_definition())!=NULL) {
-	  write_sample_svc(def);
-  }
-  if (extend && tell == ftell(fout)) {
-	  (void) unlink(outfilename);
-  }
+  open_input (infile, define);
+  outfilename = extend ? extendfile (infile, outfile) : outfile;
+  checkfiles (infile, outfilename);
+  /*check if outfile already exists.
+     if so, print an error message and exit */
+  open_output (infile, outfilename);
+  add_sample_msg ();
+
+  if (infile && (include = extendfile (infile, ".h")))
+    {
+      fprintf (fout, "#include \"%s\"\n", include);
+      free (include);
+    }
+  else
+    fprintf (fout, "#include <rpc/rpc.h>\n");
+
+  tell = ftell (fout);
+  while ((def = get_definition ()) != NULL)
+    {
+      write_sample_svc (def);
+    }
+  if (extend && tell == ftell (fout))
+    {
+      unlink (outfilename);
+    }
 }
 
 
 /* sample main routine for client */
 static void
-clnt_output(const char *infile, const char *define, int extend,
-	    const char *outfile)
+clnt_output (const char *infile, const char *define, int extend,
+	     const char *outfile)
 {
   definition *def;
   char *include;
@@ -747,87 +861,204 @@ clnt_output(const char *infile, const char *define, int extend,
   long tell;
   int has_program = 0;
 
-  open_input(infile, define);
-  outfilename = extend ? extendfile(infile, outfile) : outfile;
-  checkfiles(infile,outfilename); /*check if outfile already exists.
-				  if so, print an error message and exit*/
-
-  open_output(infile, outfilename);
-  add_sample_msg();
-  if (infile && (include = extendfile(infile, ".h"))) {
-    f_print(fout, "#include \"%s\"\n", include);
-    free(include);
-  } else
-    f_print(fout, "#include <rpc/rpc.h>\n");
-  tell = ftell(fout);
-  while ((def = get_definition())!=NULL) {
-    has_program += write_sample_clnt(def);
-  }
-
-  if( has_program )
-    write_sample_clnt_main();
-
-  if (extend && tell == ftell(fout)) {
-    (void) unlink(outfilename);
-  }
+  open_input (infile, define);
+  outfilename = extend ? extendfile (infile, outfile) : outfile;
+  checkfiles (infile, outfilename);
+  /*check if outfile already exists.
+     if so, print an error message and exit */
+
+  open_output (infile, outfilename);
+  add_sample_msg ();
+  if (infile && (include = extendfile (infile, ".h")))
+    {
+      fprintf (fout, "#include \"%s\"\n", include);
+      free (include);
+    }
+  else
+    fprintf (fout, "#include <rpc/rpc.h>\n");
+  tell = ftell (fout);
+  while ((def = get_definition ()) != NULL)
+    {
+      has_program += write_sample_clnt (def);
+    }
+
+  if (has_program)
+    write_sample_clnt_main ();
+
+  if (extend && tell == ftell (fout))
+    {
+      unlink (outfilename);
+    }
+}
+
+static char *
+file_name (const char *file, const char *ext)
+{
+  char *temp;
+  temp = extendfile (file, ext);
+
+  if (access (temp, F_OK) != -1)
+    return (temp);
+  else
+    return ((char *) " ");
+}
+
+static void
+mkfile_output (struct commandline *cmd)
+{
+  char *mkfilename;
+  const char *clientname, *clntname, *xdrname, *hdrname;
+  const char *servername, *svcname, *servprogname, *clntprogname;
+  char *temp;
+
+  svcname = file_name (cmd->infile, "_svc.c");
+  clntname = file_name (cmd->infile, "_clnt.c");
+  xdrname = file_name (cmd->infile, "_xdr.c");
+  hdrname = file_name (cmd->infile, ".h");
+
+  if (allfiles)
+    {
+      servername = extendfile (cmd->infile, "_server.c");
+      clientname = extendfile (cmd->infile, "_client.c");
+    }
+  else
+    {
+      servername = " ";
+      clientname = " ";
+    }
+  servprogname = extendfile (cmd->infile, "_server");
+  clntprogname = extendfile (cmd->infile, "_client");
+
+  if (allfiles)
+    {
+      mkfilename = alloc (strlen ("Makefile.") +
+			  strlen (cmd->infile) + 1);
+      temp = (char *) rindex (cmd->infile, '.');
+      strcat (mkfilename, "Makefile.");
+      strncat (mkfilename, cmd->infile,
+	       (temp - cmd->infile));
+    }
+  else
+    mkfilename = (char *) cmd->outfile;
+
+  checkfiles (NULL, mkfilename);
+  open_output (NULL, mkfilename);
+
+  fprintf (fout, "\n# This is a template Makefile generated by rpcgen\n");
+
+  f_print (fout, "\n# Parameters\n\n");
+
+  f_print (fout, "CLIENT = %s\nSERVER = %s\n\n", clntprogname, servprogname);
+  f_print (fout, "SOURCES_CLNT.c = \nSOURCES_CLNT.h = \n");
+  f_print (fout, "SOURCES_SVC.c = \nSOURCES_SVC.h = \n");
+  f_print (fout, "SOURCES.x = %s\n\n", cmd->infile);
+  f_print (fout, "TARGETS_SVC.c = %s %s %s \n",
+	   svcname, servername, xdrname);
+  f_print (fout, "TARGETS_CLNT.c = %s %s %s \n",
+	   clntname, clientname, xdrname);
+  f_print (fout, "TARGETS = %s %s %s %s %s %s\n\n",
+	   hdrname, xdrname, clntname,
+	   svcname, clientname, servername);
+
+  f_print (fout, "OBJECTS_CLNT = $(SOURCES_CLNT.c:%%.c=%%.o) \
+$(TARGETS_CLNT.c:%%.c=%%.o)");
+
+  f_print (fout, "\nOBJECTS_SVC = $(SOURCES_SVC.c:%%.c=%%.o) \
+$(TARGETS_SVC.c:%%.c=%%.o)");
+
+  f_print (fout, "\n# Compiler flags \n");
+  if (mtflag)
+    fprintf (fout, "\nCPPFLAGS += -D_REENTRANT\nCFLAGS += -g \nLDLIBS \
++= -lnsl -lpthread \n ");
+  else
+    f_print (fout, "\nCFLAGS += -g \nLDLIBS += -lnsl\n");
+  f_print (fout, "RPCGENFLAGS = \n");
+
+  f_print (fout, "\n# Targets \n\n");
+
+  f_print (fout, "all : $(CLIENT) $(SERVER)\n\n");
+  f_print (fout, "$(TARGETS) : $(SOURCES.x) \n");
+  f_print (fout, "\trpcgen $(RPCGENFLAGS) $(SOURCES.x)\n\n");
+  f_print (fout, "$(OBJECTS_CLNT) : $(SOURCES_CLNT.c) $(SOURCES_CLNT.h) \
+$(TARGETS_CLNT.c) \n\n");
+
+  f_print (fout, "$(OBJECTS_SVC) : $(SOURCES_SVC.c) $(SOURCES_SVC.h) \
+$(TARGETS_SVC.c) \n\n");
+  f_print (fout, "$(CLIENT) : $(OBJECTS_CLNT) \n");
+  f_print (fout, "\t$(LINK.c) -o $(CLIENT) $(OBJECTS_CLNT) \
+$(LDLIBS) \n\n");
+  f_print (fout, "$(SERVER) : $(OBJECTS_SVC) \n");
+  f_print (fout, "\t$(LINK.c) -o $(SERVER) $(OBJECTS_SVC) $(LDLIBS)\n\n ");
+  f_print (fout, "clean:\n\t $(RM) core $(TARGETS) $(OBJECTS_CLNT) \
+$(OBJECTS_SVC) $(CLIENT) $(SERVER)\n\n");
 }
 
 /*
  * Perform registrations for service output
  * Return 0 if failed; 1 otherwise.
  */
-static int do_registers(int argc, const char *argv[])
+static int
+do_registers (int argc, const char *argv[])
 {
-	int i;
-
-	if ( inetdflag || !tirpcflag) {
-		for (i = 1; i < argc; i++) {
-			if (streq(argv[i], "-s")) {
-			        if(!check_nettype( argv[i + 1], valid_i_nettypes ))
-				  return 0;
-				write_inetd_register(argv[i + 1]);
-				i++;
-			}
-		}
-	} else {
-		for (i = 1; i < argc; i++)
-		        if (streq(argv[i], "-s")) {
-			        if(!check_nettype( argv[i + 1], valid_ti_nettypes ))
-				  return 0;
-				write_nettype_register(argv[i + 1]);
-				i++;
-			} else if (streq(argv[i], "-n")) {
-				write_netid_register(argv[i + 1]);
-				i++;
-			}
+  int i;
+
+  if (inetdflag || !tirpcflag)
+    {
+      for (i = 1; i < argc; i++)
+	{
+	  if (streq (argv[i], "-s"))
+	    {
+	      if (!check_nettype (argv[i + 1], valid_i_nettypes))
+		return 0;
+	      write_inetd_register (argv[i + 1]);
+	      i++;
+	    }
 	}
-	return 1;
+    }
+  else
+    {
+      for (i = 1; i < argc; i++)
+	if (streq (argv[i], "-s"))
+	  {
+	    if (!check_nettype (argv[i + 1], valid_ti_nettypes))
+	      return 0;
+	    write_nettype_register (argv[i + 1]);
+	    i++;
+	  }
+	else if (streq (argv[i], "-n"))
+	  {
+	    write_netid_register (argv[i + 1]);
+	    i++;
+	  }
+    }
+  return 1;
 }
 
 /*
  * Add another argument to the arg list
  */
 static void
-addarg(const char *cp)
+addarg (const char *cp)
 {
-	if (argcount >= ARGLISTLEN) {
-		f_print(stderr, "rpcgen: too many defines\n");
-		crash();
-		/*NOTREACHED*/
-	}
-	arglist[argcount++] = cp;
-
+  if (argcount >= ARGLISTLEN)
+    {
+      fprintf (stderr, _("rpcgen: too many defines\n"));
+      crash ();
+      /*NOTREACHED */
+    }
+  arglist[argcount++] = cp;
 }
 
 static void
-putarg(int whereto, const char *cp)
+putarg (int whereto, const char *cp)
 {
-	if (whereto >= ARGLISTLEN) {
-		f_print(stderr, "rpcgen: arglist coding error\n");
-		crash();
-		/*NOTREACHED*/
-	}
-	arglist[whereto] = cp;
+  if (whereto >= ARGLISTLEN)
+    {
+      fprintf (stderr, _("rpcgen: arglist coding error\n"));
+      crash ();
+      /*NOTREACHED */
+    }
+  arglist[whereto] = cp;
 }
 
 /*
@@ -837,292 +1068,328 @@ putarg(int whereto, const char *cp)
  */
 
 static void
-checkfiles(const char *infile, const char *outfile)
+checkfiles (const char *infile, const char *outfile)
 {
-
   struct stat buf;
 
-  if(infile)			/* infile ! = NULL */
-    if(stat(infile,&buf) < 0)
+  if (infile)			/* infile ! = NULL */
+    if (stat (infile, &buf) < 0)
       {
-	perror(infile);
-	crash();
-      };
-  if (outfile) {
-    if (stat(outfile, &buf) < 0)
-      return;			/* file does not exist */
-    else {
-      f_print(stderr,
-	      "file '%s' already exists and may be overwritten\n", outfile);
-      crash();
+	perror (infile);
+	crash ();
+      }
+  if (outfile)
+    {
+      if (stat (outfile, &buf) < 0)
+	return;			/* file does not exist */
+      else
+	{
+	  fprintf (stderr,
+		   _("file '%s' already exists and may be overwritten\n"),
+		   outfile);
+	  crash ();
+	}
     }
-  }
 }
 
 /*
  * Parse command line arguments
  */
 static int
-parseargs(int argc, const char *argv[], struct commandline *cmd)
+parseargs (int argc, const char *argv[], struct commandline *cmd)
 {
-	int i;
-	int j;
-	int c;
-	char flag[(1 << 8 * sizeof(char))];
-	int nflags;
-
-	cmdname = argv[0];
-	cmd->infile = cmd->outfile = NULL;
-	if (argc < 2) {
-		return (0);
+  int i;
+  int j;
+  int c;
+  char flag[(1 << 8 * sizeof (char))];
+  int nflags;
+
+  cmdname = argv[0];
+  cmd->infile = cmd->outfile = NULL;
+  if (argc < 2)
+    {
+      return (0);
+    }
+  allfiles = 0;
+  flag['c'] = 0;
+  flag['h'] = 0;
+  flag['l'] = 0;
+  flag['m'] = 0;
+  flag['o'] = 0;
+  flag['s'] = 0;
+  flag['n'] = 0;
+  flag['t'] = 0;
+  flag['S'] = 0;
+  flag['C'] = 0;
+  flag['M'] = 0;
+
+  for (i = 1; i < argc; i++)
+    {
+      if (argv[i][0] != '-')
+	{
+	  if (cmd->infile)
+	    {
+	      fprintf (stderr,
+		       _("Cannot specify more than one input file!\n"));
+	      return 0;
+	    }
+	  cmd->infile = argv[i];
 	}
-	allfiles = 0;
-	flag['c'] = 0;
-	flag['h'] = 0;
-	flag['l'] = 0;
-	flag['m'] = 0;
-	flag['o'] = 0;
-	flag['s'] = 0;
-	flag['n'] = 0;
-	flag['t'] = 0;
-	flag['S'] = 0;
-	flag['C'] = 0;
-	for (i = 1; i < argc; i++) {
-		if (argv[i][0] != '-') {
-			if (cmd->infile) {
-			        f_print( stderr, "Cannot specify more than one input file!\n");
-
-				return (0);
-			}
-			cmd->infile = argv[i];
-		} else {
-			for (j = 1; argv[i][j] != 0; j++) {
-				c = argv[i][j];
-				switch (c) {
-				case 'a':
-					allfiles = 1;
-					break;
-				case 'c':
-				case 'h':
-				case 'l':
-				case 'm':
-				case 't':
-					if (flag[c]) {
-						return (0);
-					}
-					flag[c] = 1;
-					break;
-				case 'S':
-					/* sample flag: Ss or Sc.
-					   Ss means set flag['S'];
-					   Sc means set flag['C']; */
-					c = argv[i][++j];  /* get next char */
-					if( c == 's' )
-					  c = 'S';
-					else if( c == 'c' )
-					  c = 'C';
-					else
-					  return( 0 );
-
-					if (flag[c]) {
-						return (0);
-					}
-					flag[c] = 1;
-					break;
-				case 'C':  /* ANSI C syntax */
-					Cflag = 1;
-					break;
+      else
+	{
+	  for (j = 1; argv[i][j] != 0; j++)
+	    {
+	      c = argv[i][j];
+	      switch (c)
+		{
+		case 'a':
+		  allfiles = 1;
+		  break;
+		case 'c':
+		case 'h':
+		case 'l':
+		case 'm':
+		case 't':
+		  if (flag[c])
+		    return 0;
+		  flag[c] = 1;
+		  break;
+		case 'S':
+		  /* sample flag: Ss or Sc.
+		     Ss means set flag['S'];
+		     Sc means set flag['C'];
+		     Sm means set flag['M']; */
+ 		  c = argv[i][++j];	/* get next char */
+		  if (c == 's')
+		    c = 'S';
+		  else if (c == 'c')
+		    c = 'C';
+		  else if (c == 'm')
+		    c = 'M';
+		  else
+		    return 0;
+
+		  if (flag[c])
+		    return 0;
+		  flag[c] = 1;
+		  break;
+		case 'C':	/* ANSI C syntax */
+		  Cflag = 1;
+		  break;
 
 #ifdef __GNU_LIBRARY__
-				case 'k':  /* K&R C syntax */
-					Cflag = 0;
-					break;
+		case 'k':  /* K&R C syntax */
+		  Cflag = 0;
+		  break;
 
 #endif
-				case 'b':  /* turn TIRPC flag off for
-					    generating backward compatible
-					    */
-					tirpcflag = 0;
-					break;
+		case 'b':  /* turn TIRPC flag off for
+			      generating backward compatible
+			   */
+		  tirpcflag = 0;
+		  break;
 
 #ifdef __GNU_LIBRARY__
-				case '5':  /* turn TIRPC flag on for
-					    generating SysVr4 compatible
-					    */
-					tirpcflag = 1;
-					break;
-				case '$':
-					building_libc = 1;
-					break;
+		case '5':  /* turn TIRPC flag on for
+			      generating SysVr4 compatible
+			   */
+		  tirpcflag = 1;
+		  break;
 #endif
-				case 'I':
-					inetdflag = 1;
-					break;
-				case 'N':
-					newstyle = 1;
-					break;
-				case 'L':
-					logflag = 1;
-					break;
-				case 'K':
-					if (++i == argc) {
-						return (0);
-					}
-					svcclosetime = argv[i];
-					goto nextarg;
-				case 'T':
-					tblflag = 1;
-					break;
-				case 'i' :
-				  	if (++i == argc) {
-						return (0);
-					}
-					inlineflag = atoi(argv[i]);
-					goto nextarg;
-				case 'n':
-				case 'o':
-				case 's':
-					if (argv[i][j - 1] != '-' ||
-					    argv[i][j + 1] != 0) {
-						return (0);
-					}
-					flag[c] = 1;
-					if (++i == argc) {
-						return (0);
-					}
-					if (c == 's') {
-						if (!streq(argv[i], "udp") &&
-						    !streq(argv[i], "tcp")) {
-							return (0);
-						}
-					} else if (c == 'o') {
-						if (cmd->outfile) {
-							return (0);
-						}
-						cmd->outfile = argv[i];
-					}
-					goto nextarg;
-				case 'D':
-					if (argv[i][j - 1] != '-') {
-						return (0);
-					}
-					(void) addarg(argv[i]);
-					goto nextarg;
-				case 'Y':
-					if (++i == argc) {
-						return (0);
-					}
-					{
-						size_t len = strlen (argv[i]);
-						pathbuf = malloc (len + 5);
-						if (pathbuf == NULL) {
-							perror(cmdname);
-							crash();
-						}
-						stpcpy (stpcpy (pathbuf,
-								argv[i]),
-							"/cpp");
-						CPP = pathbuf;
-						cppDefined = 1;
-						goto nextarg;
-					}
-
-
-				default:
-					return (0);
-				}
-			}
-	nextarg:
-			;
+		case 'I':
+		  inetdflag = 1;
+		  break;
+		case 'N':
+		  newstyle = 1;
+		  break;
+		case 'L':
+		  logflag = 1;
+		  break;
+		case 'K':
+		  if (++i == argc)
+		    {
+		      return (0);
+		    }
+		  svcclosetime = argv[i];
+		  goto nextarg;
+		case 'T':
+		  tblflag = 1;
+		  break;
+		case 'M':
+		  mtflag = 1;
+		  break;
+		case 'i':
+		  if (++i == argc)
+		    {
+		      return (0);
+		    }
+		  inlineflag = atoi (argv[i]);
+		  goto nextarg;
+		case 'n':
+		case 'o':
+		case 's':
+		  if (argv[i][j - 1] != '-' ||
+		      argv[i][j + 1] != 0)
+		    {
+		      return (0);
+		    }
+		  flag[c] = 1;
+		  if (++i == argc)
+		    {
+		      return (0);
+		    }
+		  if (c == 's')
+		    {
+		      if (!streq (argv[i], "udp") &&
+			  !streq (argv[i], "tcp"))
+			return 0;
+		    }
+		  else if (c == 'o')
+		    {
+		      if (cmd->outfile)
+			return 0;
+		      cmd->outfile = argv[i];
+		    }
+		  goto nextarg;
+		case 'D':
+		  if (argv[i][j - 1] != '-')
+		    return 0;
+		  addarg (argv[i]);
+		  goto nextarg;
+		case 'Y':
+		  if (++i == argc)
+		    return 0;
+		  {
+		    size_t len = strlen (argv[i]);
+		    pathbuf = malloc (len + 5);
+		    if (pathbuf == NULL)
+		      {
+			perror (cmdname);
+			crash ();
+		      }
+		    stpcpy (stpcpy (pathbuf,
+				    argv[i]),
+			    "/cpp");
+		    CPP = pathbuf;
+		    cppDefined = 1;
+		    goto nextarg;
+		  }
+
+		default:
+		  return 0;
 		}
+	      }
+	nextarg:
+	  ;
 	}
+    }
 
-	cmd->cflag = flag['c'];
-	cmd->hflag = flag['h'];
-	cmd->lflag = flag['l'];
-	cmd->mflag = flag['m'];
-	cmd->nflag = flag['n'];
-	cmd->sflag = flag['s'];
-	cmd->tflag = flag['t'];
-	cmd->Ssflag = flag['S'];
-	cmd->Scflag = flag['C'];
-
-	if( tirpcflag ) {
-	  pmflag = inetdflag ? 0 : 1;	  /* pmflag or inetdflag is always TRUE */
-	  if( (inetdflag && cmd->nflag)) { /* netid not allowed with inetdflag */
-	    f_print(stderr, "Cannot use netid flag with inetd flag!\n");
-	    return (0);
-	  }
-	} else {  /* 4.1 mode */
-	  pmflag = 0;               /* set pmflag only in tirpcmode */
+  cmd->cflag = flag['c'];
+  cmd->hflag = flag['h'];
+  cmd->lflag = flag['l'];
+  cmd->mflag = flag['m'];
+  cmd->nflag = flag['n'];
+  cmd->sflag = flag['s'];
+  cmd->tflag = flag['t'];
+  cmd->Ssflag = flag['S'];
+  cmd->Scflag = flag['C'];
+  cmd->makefileflag = flag['M'];
+
+  if (tirpcflag)
+    {
+      pmflag = inetdflag ? 0 : 1;    /* pmflag or inetdflag is always TRUE */
+      if ((inetdflag && cmd->nflag))
+	{			/* netid not allowed with inetdflag */
+	  fprintf (stderr, _("Cannot use netid flag with inetd flag!\n"));
+	  return 0;
+	}
+    }
+  else
+    {				/* 4.1 mode */
+      pmflag = 0;		/* set pmflag only in tirpcmode */
 #ifndef __GNU_LIBRARY__
-	  inetdflag = 1;            /* inetdflag is TRUE by default */
+      inetdflag = 1;            /* inetdflag is TRUE by default */
 #endif
-	  if( cmd->nflag ) {          /* netid needs TIRPC */
-	    f_print( stderr, "Cannot use netid flag without TIRPC!\n");
-	    return( 0 );
-	  }
+      if (cmd->nflag)
+	{			/* netid needs TIRPC */
+	  f_print (stderr, _("Cannot use netid flag without TIRPC!\n"));
+	  return (0);
 	}
+    }
 
-	if( newstyle && ( tblflag || cmd->tflag) ) {
-	  f_print( stderr, "Cannot use table flags with newstyle!\n");
-	  return( 0 );
-	}
+  if (newstyle && (tblflag || cmd->tflag))
+    {
+      f_print (stderr, _("Cannot use table flags with newstyle!\n"));
+      return (0);
+    }
 
-	/* check no conflicts with file generation flags */
-	nflags = cmd->cflag + cmd->hflag + cmd->lflag + cmd->mflag +
-		cmd->sflag + cmd->nflag + cmd->tflag + cmd->Ssflag + cmd->Scflag;
+  /* check no conflicts with file generation flags */
+  nflags = cmd->cflag + cmd->hflag + cmd->lflag + cmd->mflag +
+    cmd->sflag + cmd->nflag + cmd->tflag + cmd->Ssflag + cmd->Scflag;
 
-	if (nflags == 0) {
-		if (cmd->outfile != NULL || cmd->infile == NULL) {
-			return (0);
-		}
-	} else if (nflags > 1) {
-	        f_print( stderr, "Cannot have more than one file generation flag!\n");
-		return (0);
+  if (nflags == 0)
+    {
+      if (cmd->outfile != NULL || cmd->infile == NULL)
+	{
+	  return (0);
 	}
-	return (1);
+    }
+  else if (cmd->infile == NULL &&
+	   (cmd->Ssflag || cmd->Scflag || cmd->makefileflag))
+    {
+      fprintf (stderr,
+	       _("\"infile\" is required for template generation flags.\n"));
+      return 0;
+    }
+  if (nflags > 1)
+    {
+      fprintf (stderr, _("Cannot have more than one file generation flag!\n"));
+      return 0;
+    }
+  return 1;
 }
 
 static void
-usage(void)
+usage (void)
 {
-	f_print(stderr, "usage:  %s infile\n", cmdname);
-	f_print(stderr, "\t%s [-a][-b][-C][-Dname[=value]] -i size  [-I [-K seconds]] [-L][-N][-T] infile\n",
-			cmdname);
-	f_print(stderr, "\t%s [-c | -h | -l | -m | -t | -Sc | -Ss] [-o outfile] [infile]\n",
-			cmdname);
-	f_print(stderr, "\t%s [-s nettype]* [-o outfile] [infile]\n", cmdname);
-	f_print(stderr, "\t%s [-n netid]* [-o outfile] [infile]\n", cmdname);
-	options_usage();
-	exit(1);
+  fprintf (stderr, _("usage:  %s infile\n"), cmdname);
+  fprintf (stderr, _("\t%s [-abkCLNTM][-Dname[=value]] [-i size] \
+[-I [-K seconds]] [-Y path] infile\n"), cmdname);
+  fprintf (stderr, _("\t%s [-c | -h | -l | -m | -t | -Sc | -Ss | -Sm] \
+[-o outfile] [infile]\n"), cmdname);
+  fprintf (stderr, _("\t%s [-s nettype]* [-o outfile] [infile]\n"), cmdname);
+  fprintf (stderr, _("\t%s [-n netid]* [-o outfile] [infile]\n"), cmdname);
+  options_usage ();
+  exit (1);
 }
 
 static void
-options_usage(void)
+options_usage (void)
 {
-	f_print(stderr, "options:\n");
-	f_print(stderr, "-a\t\tgenerate all files, including samples\n");
-	f_print(stderr, "-b\t\tbackward compatibility mode (generates code for SunOS 4.1)\n");
-	f_print(stderr, "-c\t\tgenerate XDR routines\n");
-	f_print(stderr, "-C\t\tANSI C mode\n");
-	f_print(stderr, "-Dname[=value]\tdefine a symbol (same as #define)\n");
-	f_print(stderr, "-h\t\tgenerate header file\n");
-	f_print(stderr, "-i size\t\tsize at which to start generating inline code\n");
-	f_print(stderr, "-I\t\tgenerate code for inetd support in server (for SunOS 4.1)\n");
-	f_print(stderr, "-K seconds\tserver exits after K seconds of inactivity\n");
-	f_print(stderr, "-l\t\tgenerate client side stubs\n");
-	f_print(stderr, "-L\t\tserver errors will be printed to syslog\n");
-	f_print(stderr, "-m\t\tgenerate server side stubs\n");
-	f_print(stderr, "-n netid\tgenerate server code that supports named netid\n");
-	f_print(stderr, "-N\t\tsupports multiple arguments and call-by-value\n");
-	f_print(stderr, "-o outfile\tname of the output file\n");
-	f_print(stderr, "-s nettype\tgenerate server code that supports named nettype\n");
-	f_print(stderr, "-Sc\t\tgenerate sample client code that uses remote procedures\n");
-	f_print(stderr, "-Ss\t\tgenerate sample server code that defines remote procedures\n");
-	f_print(stderr, "-t\t\tgenerate RPC dispatch table\n");
-	f_print(stderr, "-T\t\tgenerate code to support RPC dispatch tables\n");
-	f_print(stderr, "-Y path\t\tdirectory name to find C preprocessor (cpp)\n");
-
-	exit(1);
+  f_print (stderr, "options:\n");
+  f_print (stderr, "-a\t\tgenerate all files, including samples\n");
+  f_print (stderr, "-b\t\tbackward compatibility mode (generates code for SunOS 4.1)\n");
+  f_print (stderr, "-c\t\tgenerate XDR routines\n");
+  f_print (stderr, "-C\t\tANSI C mode\n");
+  f_print (stderr, "-Dname[=value]\tdefine a symbol (same as #define)\n");
+  f_print (stderr, "-h\t\tgenerate header file\n");
+  f_print (stderr, "-i size\t\tsize at which to start generating inline code\n");
+  f_print (stderr, "-I\t\tgenerate code for inetd support in server (for SunOS 4.1)\n");
+  f_print (stderr, "-K seconds\tserver exits after K seconds of inactivity\n");
+  f_print (stderr, "-l\t\tgenerate client side stubs\n");
+  f_print (stderr, "-L\t\tserver errors will be printed to syslog\n");
+  f_print (stderr, "-m\t\tgenerate server side stubs\n");
+  f_print (stderr, "-M\t\tgenerate MT-safe code\n");
+  f_print (stderr, "-n netid\tgenerate server code that supports named netid\n");
+  f_print (stderr, "-N\t\tsupports multiple arguments and call-by-value\n");
+  f_print (stderr, "-o outfile\tname of the output file\n");
+  f_print (stderr, "-s nettype\tgenerate server code that supports named nettype\n");
+  f_print (stderr, "-Sc\t\tgenerate sample client code that uses remote procedures\n");
+  f_print (stderr, "-Ss\t\tgenerate sample server code that defines remote procedures\n");
+  f_print (stderr, "-Sm \t\tgenerate makefile template \n");
+  f_print (stderr, "-t\t\tgenerate RPC dispatch table\n");
+  f_print (stderr, "-T\t\tgenerate code to support RPC dispatch tables\n");
+  f_print (stderr, "-Y path\t\tdirectory name to find C preprocessor (cpp)\n");
+
+  exit (1);
 }
diff --git a/sunrpc/rpc_parse.c b/sunrpc/rpc_parse.c
index 92f365eeb0..e6c4e4a7aa 100644
--- a/sunrpc/rpc_parse.c
+++ b/sunrpc/rpc_parse.c
@@ -31,11 +31,11 @@
 /*
  * From: @(#)rpc_parse.c 1.8 89/02/22 (C) 1987 SMI
  */
-char parse_rcsid[] = 
+const char parse_rcsid[] =
   "$Id$";
 
 /*
- * rpc_parse.c, Parser for the RPC protocol compiler 
+ * rpc_parse.c, Parser for the RPC protocol compiler
  * Copyright (C) 1987 Sun Microsystems, Inc.
  */
 #include <stdio.h>
@@ -48,241 +48,256 @@ char parse_rcsid[] =
 
 #define ARGNAME "arg"
 
-static void isdefined(definition *defp);
-static void def_struct(definition *defp);
-static void def_program(definition *defp);
-static void def_enum(definition *defp);
-static void def_const(definition *defp);
-static void def_union(definition *defp);
-static void check_type_name(const char *name, int new_type);
-static void def_typedef(definition *defp);
-static void get_declaration(declaration *dec, defkind dkind);
-static void get_prog_declaration(declaration *dec, defkind dkind, int num);
-static void get_type(const char **prefixp, const char **typep, defkind dkind);
-static void unsigned_dec(const char **typep);
+static void isdefined (definition * defp);
+static void def_struct (definition * defp);
+static void def_program (definition * defp);
+static void def_enum (definition * defp);
+static void def_const (definition * defp);
+static void def_union (definition * defp);
+static void check_type_name (const char *name, int new_type);
+static void def_typedef (definition * defp);
+static void get_declaration (declaration * dec, defkind dkind);
+static void get_prog_declaration (declaration * dec, defkind dkind, int num);
+static void get_type (const char **prefixp, const char **typep, defkind dkind);
+static void unsigned_dec (const char **typep);
 
 /*
  * return the next definition you see
  */
 definition *
-get_definition(void)
+get_definition (void)
 {
-	definition *defp;
-	token tok;
-
-	defp = ALLOC(definition);
-	get_token(&tok);
-	switch (tok.kind) {
-	case TOK_STRUCT:
-		def_struct(defp);
-		break;
-	case TOK_UNION:
-		def_union(defp);
-		break;
-	case TOK_TYPEDEF:
-		def_typedef(defp);
-		break;
-	case TOK_ENUM:
-		def_enum(defp);
-		break;
-	case TOK_PROGRAM:
-		def_program(defp);
-		break;
-	case TOK_CONST:
-		def_const(defp);
-		break;
-	case TOK_EOF:
-		return (NULL);
-	default:
-		error("definition keyword expected");
-	}
-	scan(TOK_SEMICOLON, &tok);
-	isdefined(defp);
-	return (defp);
+  definition *defp;
+  token tok;
+
+  defp = ALLOC (definition);
+  get_token (&tok);
+  switch (tok.kind)
+    {
+    case TOK_STRUCT:
+      def_struct (defp);
+      break;
+    case TOK_UNION:
+      def_union (defp);
+      break;
+    case TOK_TYPEDEF:
+      def_typedef (defp);
+      break;
+    case TOK_ENUM:
+      def_enum (defp);
+      break;
+    case TOK_PROGRAM:
+      def_program (defp);
+      break;
+    case TOK_CONST:
+      def_const (defp);
+      break;
+    case TOK_EOF:
+      return (NULL);
+    default:
+      error ("definition keyword expected");
+    }
+  scan (TOK_SEMICOLON, &tok);
+  isdefined (defp);
+  return (defp);
 }
 
 static void
-isdefined(definition *defp)
+isdefined (definition * defp)
 {
-	STOREVAL(&defined, defp);
+  STOREVAL (&defined, defp);
 }
 
 static void
-def_struct(definition *defp)
+def_struct (definition * defp)
 {
-	token tok;
-	declaration dec;
-	decl_list *decls;
-	decl_list **tailp;
-
-	defp->def_kind = DEF_STRUCT;
-
-	scan(TOK_IDENT, &tok);
-	defp->def_name = tok.str;
-	scan(TOK_LBRACE, &tok);
-	tailp = &defp->def.st.decls;
-	do {
-		get_declaration(&dec, DEF_STRUCT);
-		decls = ALLOC(decl_list);
-		decls->decl = dec;
-		*tailp = decls;
-		tailp = &decls->next;
-		scan(TOK_SEMICOLON, &tok);
-		peek(&tok);
-	} while (tok.kind != TOK_RBRACE);
-	get_token(&tok);
-	*tailp = NULL;
+  token tok;
+  declaration dec;
+  decl_list *decls;
+  decl_list **tailp;
+
+  defp->def_kind = DEF_STRUCT;
+
+  scan (TOK_IDENT, &tok);
+  defp->def_name = tok.str;
+  scan (TOK_LBRACE, &tok);
+  tailp = &defp->def.st.decls;
+  do
+    {
+      get_declaration (&dec, DEF_STRUCT);
+      decls = ALLOC (decl_list);
+      decls->decl = dec;
+      *tailp = decls;
+      tailp = &decls->next;
+      scan (TOK_SEMICOLON, &tok);
+      peek (&tok);
+    }
+  while (tok.kind != TOK_RBRACE);
+  get_token (&tok);
+  *tailp = NULL;
 }
 
 static void
-def_program(definition *defp)
+def_program (definition * defp)
 {
-	token tok;
-	declaration dec;
-	decl_list *decls;
-	decl_list **tailp;
-	version_list *vlist;
-	version_list **vtailp;
-	proc_list *plist;
-	proc_list **ptailp;
-	int num_args;
-	bool_t isvoid = FALSE; /* whether first argument is void */
-	defp->def_kind = DEF_PROGRAM;
-	scan(TOK_IDENT, &tok);
-	defp->def_name = tok.str;
-	scan(TOK_LBRACE, &tok);
-	vtailp = &defp->def.pr.versions;
-	tailp = &defp->def.st.decls;
-	scan(TOK_VERSION, &tok);
-	do {
-		scan(TOK_IDENT, &tok);
-		vlist = ALLOC(version_list);
-		vlist->vers_name = tok.str;
-		scan(TOK_LBRACE, &tok);
-		ptailp = &vlist->procs;
-		do {
-			/* get result type */
-			plist = ALLOC(proc_list);
-			get_type(&plist->res_prefix, &plist->res_type, 
-				 DEF_PROGRAM);
-			if (streq(plist->res_type, "opaque")) {
-				error("illegal result type");
-			}
-			scan(TOK_IDENT, &tok);
-			plist->proc_name = tok.str;
-			scan(TOK_LPAREN, &tok);
-			/* get args - first one*/
-			num_args = 1;
-			isvoid = FALSE;
-			/* type of DEF_PROGRAM in the first 
-			 * get_prog_declaration and DEF_STURCT in the next
-			 * allows void as argument if it is the only argument
-			 */
-			get_prog_declaration(&dec, DEF_PROGRAM, num_args);
-			if (streq(dec.type, "void"))
-			  isvoid = TRUE;
-			decls = ALLOC(decl_list);
-			plist->args.decls = decls;
-			decls->decl = dec;
-			tailp = &decls->next;
-			/* get args */
-			while(peekscan(TOK_COMMA, &tok)) {
-			  num_args++;
-			  get_prog_declaration(&dec, DEF_STRUCT, 
-					       num_args);
-			  decls = ALLOC(decl_list);
-			  decls->decl = dec;
-			  *tailp = decls;
-			  if (streq(dec.type, "void"))
-			    isvoid = TRUE;
-			  tailp = &decls->next;
-			}
-			/* multiple arguments are only allowed in newstyle */
-			if( !newstyle && num_args > 1 ) {
-			  error("only one argument is allowed" );
-			}
-			if (isvoid && num_args > 1) { 
-			  error("illegal use of void in program definition");
-			}
-			*tailp = NULL;
-			scan(TOK_RPAREN, &tok);
-			scan(TOK_EQUAL, &tok);
-			scan_num(&tok);
-			scan(TOK_SEMICOLON, &tok);
-			plist->proc_num = tok.str;
-			plist->arg_num = num_args;
-			*ptailp = plist;
-			ptailp = &plist->next;
-			peek(&tok);
-		} while (tok.kind != TOK_RBRACE);
-		*ptailp = NULL;
-		*vtailp = vlist;
-		vtailp = &vlist->next;
-		scan(TOK_RBRACE, &tok);
-		scan(TOK_EQUAL, &tok);
-		scan_num(&tok);
-		vlist->vers_num = tok.str;
-		/* make the argument structure name for each arg*/
-		for(plist = vlist->procs; plist != NULL; 
-		    plist = plist->next) {
-			plist->args.argname = make_argname(plist->proc_name,
-							   vlist->vers_num); 
-			/* free the memory ??*/
-		}
-		scan(TOK_SEMICOLON, &tok);
-		scan2(TOK_VERSION, TOK_RBRACE, &tok);
-	} while (tok.kind == TOK_VERSION);
-	scan(TOK_EQUAL, &tok);
-	scan_num(&tok);
-	defp->def.pr.prog_num = tok.str;
-	*vtailp = NULL;
+  token tok;
+  declaration dec;
+  decl_list *decls;
+  decl_list **tailp;
+  version_list *vlist;
+  version_list **vtailp;
+  proc_list *plist;
+  proc_list **ptailp;
+  int num_args;
+  bool_t isvoid = FALSE;	/* whether first argument is void */
+  defp->def_kind = DEF_PROGRAM;
+  scan (TOK_IDENT, &tok);
+  defp->def_name = tok.str;
+  scan (TOK_LBRACE, &tok);
+  vtailp = &defp->def.pr.versions;
+  tailp = &defp->def.st.decls;
+  scan (TOK_VERSION, &tok);
+  do
+    {
+      scan (TOK_IDENT, &tok);
+      vlist = ALLOC (version_list);
+      vlist->vers_name = tok.str;
+      scan (TOK_LBRACE, &tok);
+      ptailp = &vlist->procs;
+      do
+	{
+	  /* get result type */
+	  plist = ALLOC (proc_list);
+	  get_type (&plist->res_prefix, &plist->res_type,
+		    DEF_PROGRAM);
+	  if (streq (plist->res_type, "opaque"))
+	    {
+	      error ("illegal result type");
+	    }
+	  scan (TOK_IDENT, &tok);
+	  plist->proc_name = tok.str;
+	  scan (TOK_LPAREN, &tok);
+	  /* get args - first one */
+	  num_args = 1;
+	  isvoid = FALSE;
+	  /* type of DEF_PROGRAM in the first
+	   * get_prog_declaration and DEF_STURCT in the next
+	   * allows void as argument if it is the only argument
+	   */
+	  get_prog_declaration (&dec, DEF_PROGRAM, num_args);
+	  if (streq (dec.type, "void"))
+	    isvoid = TRUE;
+	  decls = ALLOC (decl_list);
+	  plist->args.decls = decls;
+	  decls->decl = dec;
+	  tailp = &decls->next;
+	  /* get args */
+	  while (peekscan (TOK_COMMA, &tok))
+	    {
+	      num_args++;
+	      get_prog_declaration (&dec, DEF_STRUCT,
+				    num_args);
+	      decls = ALLOC (decl_list);
+	      decls->decl = dec;
+	      *tailp = decls;
+	      if (streq (dec.type, "void"))
+		isvoid = TRUE;
+	      tailp = &decls->next;
+	    }
+	  /* multiple arguments are only allowed in newstyle */
+	  if (!newstyle && num_args > 1)
+	    {
+	      error ("only one argument is allowed");
+	    }
+	  if (isvoid && num_args > 1)
+	    {
+	      error ("illegal use of void in program definition");
+	    }
+	  *tailp = NULL;
+	  scan (TOK_RPAREN, &tok);
+	  scan (TOK_EQUAL, &tok);
+	  scan_num (&tok);
+	  scan (TOK_SEMICOLON, &tok);
+	  plist->proc_num = tok.str;
+	  plist->arg_num = num_args;
+	  *ptailp = plist;
+	  ptailp = &plist->next;
+	  peek (&tok);
+	}
+      while (tok.kind != TOK_RBRACE);
+      *ptailp = NULL;
+      *vtailp = vlist;
+      vtailp = &vlist->next;
+      scan (TOK_RBRACE, &tok);
+      scan (TOK_EQUAL, &tok);
+      scan_num (&tok);
+      vlist->vers_num = tok.str;
+      /* make the argument structure name for each arg */
+      for (plist = vlist->procs; plist != NULL;
+	   plist = plist->next)
+	{
+	  plist->args.argname = make_argname (plist->proc_name,
+					      vlist->vers_num);
+	  /* free the memory ?? */
+	}
+      scan (TOK_SEMICOLON, &tok);
+      scan2 (TOK_VERSION, TOK_RBRACE, &tok);
+    }
+  while (tok.kind == TOK_VERSION);
+  scan (TOK_EQUAL, &tok);
+  scan_num (&tok);
+  defp->def.pr.prog_num = tok.str;
+  *vtailp = NULL;
 }
 
 
 static void
-def_enum(definition *defp)
+def_enum (definition * defp)
 {
-	token tok;
-	enumval_list *elist;
-	enumval_list **tailp;
-
-	defp->def_kind = DEF_ENUM;
-	scan(TOK_IDENT, &tok);
-	defp->def_name = tok.str;
-	scan(TOK_LBRACE, &tok);
-	tailp = &defp->def.en.vals;
-	do {
-		scan(TOK_IDENT, &tok);
-		elist = ALLOC(enumval_list);
-		elist->name = tok.str;
-		elist->assignment = NULL;
-		scan3(TOK_COMMA, TOK_RBRACE, TOK_EQUAL, &tok);
-		if (tok.kind == TOK_EQUAL) {
-			scan_num(&tok);
-			elist->assignment = tok.str;
-			scan2(TOK_COMMA, TOK_RBRACE, &tok);
-		}
-		*tailp = elist;
-		tailp = &elist->next;
-	} while (tok.kind != TOK_RBRACE);
-	*tailp = NULL;
+  token tok;
+  enumval_list *elist;
+  enumval_list **tailp;
+
+  defp->def_kind = DEF_ENUM;
+  scan (TOK_IDENT, &tok);
+  defp->def_name = tok.str;
+  scan (TOK_LBRACE, &tok);
+  tailp = &defp->def.en.vals;
+  do
+    {
+      scan (TOK_IDENT, &tok);
+      elist = ALLOC (enumval_list);
+      elist->name = tok.str;
+      elist->assignment = NULL;
+      scan3 (TOK_COMMA, TOK_RBRACE, TOK_EQUAL, &tok);
+      if (tok.kind == TOK_EQUAL)
+	{
+	  scan_num (&tok);
+	  elist->assignment = tok.str;
+	  scan2 (TOK_COMMA, TOK_RBRACE, &tok);
+	}
+      *tailp = elist;
+      tailp = &elist->next;
+    }
+  while (tok.kind != TOK_RBRACE);
+  *tailp = NULL;
 }
 
 static void
-def_const(definition *defp)
+def_const (definition * defp)
 {
-	token tok;
-
-	defp->def_kind = DEF_CONST;
-	scan(TOK_IDENT, &tok);
-	defp->def_name = tok.str;
-	scan(TOK_EQUAL, &tok);
-	scan2(TOK_IDENT, TOK_STRCONST, &tok);
-	defp->def.co = tok.str;
+  token tok;
+
+  defp->def_kind = DEF_CONST;
+  scan (TOK_IDENT, &tok);
+  defp->def_name = tok.str;
+  scan (TOK_EQUAL, &tok);
+  scan2 (TOK_IDENT, TOK_STRCONST, &tok);
+  defp->def.co = tok.str;
 }
 
 static void
-def_union(definition *defp)
+def_union (definition *defp)
 {
   token tok;
   declaration dec;
@@ -292,67 +307,71 @@ def_union(definition *defp)
   int flag;
 
   defp->def_kind = DEF_UNION;
-  scan(TOK_IDENT, &tok);
+  scan (TOK_IDENT, &tok);
   defp->def_name = tok.str;
-  scan(TOK_SWITCH, &tok);
-  scan(TOK_LPAREN, &tok);
-  get_declaration(&dec, DEF_UNION);
+  scan (TOK_SWITCH, &tok);
+  scan (TOK_LPAREN, &tok);
+  get_declaration (&dec, DEF_UNION);
   defp->def.un.enum_decl = dec;
   tailp = &defp->def.un.cases;
-  scan(TOK_RPAREN, &tok);
-  scan(TOK_LBRACE, &tok);
-  scan(TOK_CASE, &tok);
-  while (tok.kind == TOK_CASE) {
-    scan2(TOK_IDENT, TOK_CHARCONST, &tok);
-    cases = ALLOC(case_list);
-    cases->case_name = tok.str;
-    scan(TOK_COLON, &tok);
-    /* now peek at next token */
-    flag=0;
-    if(peekscan(TOK_CASE,&tok))
-      {
-
-	do 
-	  {
-	    scan2(TOK_IDENT, TOK_CHARCONST, &tok);
-	    cases->contflag=1;	/* continued case statement */
-	    *tailp = cases;
-	    tailp = &cases->next;
-	    cases = ALLOC(case_list);
-	    cases->case_name = tok.str;
-	    scan(TOK_COLON, &tok);
-      
-	  }while(peekscan(TOK_CASE,&tok));
-      }
-    else
-      if(flag)
+  scan (TOK_RPAREN, &tok);
+  scan (TOK_LBRACE, &tok);
+  scan (TOK_CASE, &tok);
+  while (tok.kind == TOK_CASE)
+    {
+      scan2 (TOK_IDENT, TOK_CHARCONST, &tok);
+      cases = ALLOC (case_list);
+      cases->case_name = tok.str;
+      scan (TOK_COLON, &tok);
+      /* now peek at next token */
+      flag = 0;
+      if (peekscan (TOK_CASE, &tok))
+	{
+
+	  do
+	    {
+	      scan2 (TOK_IDENT, TOK_CHARCONST, &tok);
+	      cases->contflag = 1;	/* continued case statement */
+	      *tailp = cases;
+	      tailp = &cases->next;
+	      cases = ALLOC (case_list);
+	      cases->case_name = tok.str;
+	      scan (TOK_COLON, &tok);
+
+	    }
+	  while (peekscan (TOK_CASE, &tok));
+	}
+      else if (flag)
 	{
 
 	  *tailp = cases;
 	  tailp = &cases->next;
-	  cases = ALLOC(case_list);
+	  cases = ALLOC (case_list);
 	};
 
-    get_declaration(&dec, DEF_UNION);
-    cases->case_decl = dec;
-    cases->contflag=0;		/* no continued case statement */
-    *tailp = cases;
-    tailp = &cases->next;
-    scan(TOK_SEMICOLON, &tok);
+      get_declaration (&dec, DEF_UNION);
+      cases->case_decl = dec;
+      cases->contflag = 0;	/* no continued case statement */
+      *tailp = cases;
+      tailp = &cases->next;
+      scan (TOK_SEMICOLON, &tok);
 
-    scan3(TOK_CASE, TOK_DEFAULT, TOK_RBRACE, &tok);
-  }
+      scan3 (TOK_CASE, TOK_DEFAULT, TOK_RBRACE, &tok);
+    }
   *tailp = NULL;
-  if (tok.kind == TOK_DEFAULT) {
-    scan(TOK_COLON, &tok);
-    get_declaration(&dec, DEF_UNION);
-    defp->def.un.default_decl = ALLOC(declaration);
-    *defp->def.un.default_decl = dec;
-    scan(TOK_SEMICOLON, &tok);
-    scan(TOK_RBRACE, &tok);
-  } else {
-    defp->def.un.default_decl = NULL;
-  }
+  if (tok.kind == TOK_DEFAULT)
+    {
+      scan (TOK_COLON, &tok);
+      get_declaration (&dec, DEF_UNION);
+      defp->def.un.default_decl = ALLOC (declaration);
+      *defp->def.un.default_decl = dec;
+      scan (TOK_SEMICOLON, &tok);
+      scan (TOK_RBRACE, &tok);
+    }
+  else
+    {
+      defp->def.un.default_decl = NULL;
+    }
 }
 
 static const char *reserved_words[] =
@@ -370,253 +389,287 @@ static const char *reserved_words[] =
   "union",
   "vector",
   NULL
-  };
+};
 
 static const char *reserved_types[] =
 {
   "opaque",
   "string",
   NULL
-  };
+};
 
 /*
  * check that the given name is not one that would eventually result in
- * xdr routines that would conflict with internal XDR routines. 
+ * xdr routines that would conflict with internal XDR routines.
  */
-static void check_type_name(const char *name, int new_type)
+static void
+check_type_name (const char *name, int new_type)
 {
   int i;
   char tmp[100];
 
-  for( i = 0; reserved_words[i] != NULL; i++ ) {
-    if( strcmp( name, reserved_words[i] ) == 0 ) {
-      sprintf(tmp, 
-	      "illegal (reserved) name :\'%s\' in type definition", name );
-      error(tmp);
+  for (i = 0; reserved_words[i] != NULL; i++)
+    {
+      if (strcmp (name, reserved_words[i]) == 0)
+	{
+	  sprintf (tmp,
+		"illegal (reserved) name :\'%s\' in type definition", name);
+	  error (tmp);
+	}
     }
-  }
-  if( new_type ) {
-    for( i = 0; reserved_types[i] != NULL; i++ ) {
-      if( strcmp( name, reserved_types[i] ) == 0 ) {
-	sprintf(tmp, 
-		"illegal (reserved) name :\'%s\' in type definition", name );
-	error(tmp);
-      }
+  if (new_type)
+    {
+      for (i = 0; reserved_types[i] != NULL; i++)
+	{
+	  if (strcmp (name, reserved_types[i]) == 0)
+	    {
+	      sprintf (tmp,
+		"illegal (reserved) name :\'%s\' in type definition", name);
+	      error (tmp);
+	    }
+	}
     }
-  }
 }
 
 
 
 static void
-def_typedef(definition *defp)
+def_typedef (definition * defp)
 {
-	declaration dec;
-
-	defp->def_kind = DEF_TYPEDEF;
-	get_declaration(&dec, DEF_TYPEDEF);
-	defp->def_name = dec.name;
-	check_type_name(dec.name, 1);
-	defp->def.ty.old_prefix = dec.prefix;
-	defp->def.ty.old_type = dec.type;
-	defp->def.ty.rel = dec.rel;
-	defp->def.ty.array_max = dec.array_max;
+  declaration dec;
+
+  defp->def_kind = DEF_TYPEDEF;
+  get_declaration (&dec, DEF_TYPEDEF);
+  defp->def_name = dec.name;
+  check_type_name (dec.name, 1);
+  defp->def.ty.old_prefix = dec.prefix;
+  defp->def.ty.old_type = dec.type;
+  defp->def.ty.rel = dec.rel;
+  defp->def.ty.array_max = dec.array_max;
 }
 
 static void
-get_declaration(declaration *dec, defkind dkind)
+get_declaration (declaration * dec, defkind dkind)
 {
-	token tok;
+  token tok;
 
-	get_type(&dec->prefix, &dec->type, dkind);
-	dec->rel = REL_ALIAS;
-	if (streq(dec->type, "void")) {
-		return;
-	}
+  get_type (&dec->prefix, &dec->type, dkind);
+  dec->rel = REL_ALIAS;
+  if (streq (dec->type, "void"))
+    {
+      return;
+    }
 
-	check_type_name(dec->type, 0);
+  check_type_name (dec->type, 0);
 
-	scan2(TOK_STAR, TOK_IDENT, &tok);
-	if (tok.kind == TOK_STAR) {
-		dec->rel = REL_POINTER;
-		scan(TOK_IDENT, &tok);
+  scan2 (TOK_STAR, TOK_IDENT, &tok);
+  if (tok.kind == TOK_STAR)
+    {
+      dec->rel = REL_POINTER;
+      scan (TOK_IDENT, &tok);
+    }
+  dec->name = tok.str;
+  if (peekscan (TOK_LBRACKET, &tok))
+    {
+      if (dec->rel == REL_POINTER)
+	{
+	  error ("no array-of-pointer declarations -- use typedef");
 	}
-	dec->name = tok.str;
-	if (peekscan(TOK_LBRACKET, &tok)) {
-		if (dec->rel == REL_POINTER) {
-			error("no array-of-pointer declarations -- use typedef");
-		}
-		dec->rel = REL_VECTOR;
-		scan_num(&tok);
-		dec->array_max = tok.str;
-		scan(TOK_RBRACKET, &tok);
-	} else if (peekscan(TOK_LANGLE, &tok)) {
-		if (dec->rel == REL_POINTER) {
-			error("no array-of-pointer declarations -- use typedef");
-		}
-		dec->rel = REL_ARRAY;
-		if (peekscan(TOK_RANGLE, &tok)) {
-			dec->array_max = "~0";	/* unspecified size, use max */
-		} else {
-			scan_num(&tok);
-			dec->array_max = tok.str;
-			scan(TOK_RANGLE, &tok);
-		}
+      dec->rel = REL_VECTOR;
+      scan_num (&tok);
+      dec->array_max = tok.str;
+      scan (TOK_RBRACKET, &tok);
+    }
+  else if (peekscan (TOK_LANGLE, &tok))
+    {
+      if (dec->rel == REL_POINTER)
+	{
+	  error ("no array-of-pointer declarations -- use typedef");
 	}
-	if (streq(dec->type, "opaque")) {
-		if (dec->rel != REL_ARRAY && dec->rel != REL_VECTOR) {
-			error("array declaration expected");
-		}
-	} else if (streq(dec->type, "string")) {
-		if (dec->rel != REL_ARRAY) {
-			error("variable-length array declaration expected");
-		}
+      dec->rel = REL_ARRAY;
+      if (peekscan (TOK_RANGLE, &tok))
+	{
+	  dec->array_max = "~0";	/* unspecified size, use max */
 	}
+      else
+	{
+	  scan_num (&tok);
+	  dec->array_max = tok.str;
+	  scan (TOK_RANGLE, &tok);
+	}
+    }
+  if (streq (dec->type, "opaque"))
+    {
+      if (dec->rel != REL_ARRAY && dec->rel != REL_VECTOR)
+	{
+	  error ("array declaration expected");
+	}
+    }
+  else if (streq (dec->type, "string"))
+    {
+      if (dec->rel != REL_ARRAY)
+	{
+	  error ("variable-length array declaration expected");
+	}
+    }
 }
 
-
 static void
-get_prog_declaration(declaration *dec, defkind dkind, int num /* arg number */)
+get_prog_declaration (declaration * dec, defkind dkind, int num /* arg number */ )
 {
-	token tok;
-	char name[10]; /* argument name */
-
-	if (dkind == DEF_PROGRAM) { 
-	  peek(&tok);
-	  if (tok.kind == TOK_RPAREN) { /* no arguments */
-	    	dec->rel = REL_ALIAS;
-		dec->type = "void";
-		dec->prefix = NULL;
-		dec->name = NULL;
-		return;
-	      }
-	}
-	get_type(&dec->prefix, &dec->type, dkind);
-	dec->rel = REL_ALIAS;
-	if (peekscan(TOK_IDENT, &tok))  /* optional name of argument */
-		strcpy(name, tok.str);
-	else 
-		sprintf(name, "%s%d", ARGNAME, num); /* default name of argument */
-
-	dec->name = (char *) strdup(name); 
-	
-	if (streq(dec->type, "void")) {
-		return;
+  token tok;
+  char name[10];		/* argument name */
+
+  if (dkind == DEF_PROGRAM)
+    {
+      peek (&tok);
+      if (tok.kind == TOK_RPAREN)
+	{			/* no arguments */
+	  dec->rel = REL_ALIAS;
+	  dec->type = "void";
+	  dec->prefix = NULL;
+	  dec->name = NULL;
+	  return;
 	}
+    }
+  get_type (&dec->prefix, &dec->type, dkind);
+  dec->rel = REL_ALIAS;
+  if (peekscan (TOK_IDENT, &tok))	/* optional name of argument */
+    strcpy (name, tok.str);
+  else
+    sprintf (name, "%s%d", ARGNAME, num);	/* default name of argument */
+
+  dec->name = (char *) strdup (name);
+
+  if (streq (dec->type, "void"))
+    {
+      return;
+    }
 
-	if (streq(dec->type, "opaque")) {
-		error("opaque -- illegal argument type");
+  if (streq (dec->type, "opaque"))
+    {
+      error ("opaque -- illegal argument type");
+    }
+  if (peekscan (TOK_STAR, &tok))
+    {
+      if (streq (dec->type, "string"))
+	{
+	  error ("pointer to string not allowed in program arguments\n");
 	}
-	if (peekscan(TOK_STAR, &tok)) { 
-	  if (streq(dec->type, "string")) {
-	    error("pointer to string not allowed in program arguments\n");
-	  }
-		dec->rel = REL_POINTER;
-		if (peekscan(TOK_IDENT, &tok))  /* optional name of argument */
-		  dec->name = strdup(tok.str);
-      }
-	  if (peekscan(TOK_LANGLE, &tok)) {
-	    if (!streq(dec->type, "string")) {
-	      error("arrays cannot be declared as arguments to procedures -- use typedef");
-	    }
-		dec->rel = REL_ARRAY;
-		if (peekscan(TOK_RANGLE, &tok)) {
-			dec->array_max = "~0";/* unspecified size, use max */
-		} else {
-			scan_num(&tok);
-			dec->array_max = tok.str;
-			scan(TOK_RANGLE, &tok);
-		}
+      dec->rel = REL_POINTER;
+      if (peekscan (TOK_IDENT, &tok))	/* optional name of argument */
+	dec->name = strdup (tok.str);
+    }
+  if (peekscan (TOK_LANGLE, &tok))
+    {
+      if (!streq (dec->type, "string"))
+	{
+	  error ("arrays cannot be declared as arguments to procedures -- use typedef");
+	}
+      dec->rel = REL_ARRAY;
+      if (peekscan (TOK_RANGLE, &tok))
+	{
+	  dec->array_max = "~0";	/* unspecified size, use max */
 	}
-	if (streq(dec->type, "string")) {
-		if (dec->rel != REL_ARRAY) {  /* .x specifies just string as
-					       * type of argument 
-					       * - make it string<>
-					       */
-			dec->rel = REL_ARRAY;
-			dec->array_max = "~0";/* unspecified size, use max */
-		}
+      else
+	{
+	  scan_num (&tok);
+	  dec->array_max = tok.str;
+	  scan (TOK_RANGLE, &tok);
+	}
+    }
+  if (streq (dec->type, "string"))
+    {
+      if (dec->rel != REL_ARRAY)
+	{			/* .x specifies just string as
+				 * type of argument
+				 * - make it string<>
+				 */
+	  dec->rel = REL_ARRAY;
+	  dec->array_max = "~0";	/* unspecified size, use max */
 	}
+    }
 }
 
-
-
 static void
-get_type(const char **prefixp, const char **typep, defkind dkind)
+get_type (const char **prefixp, const char **typep, defkind dkind)
 {
-	token tok;
-
-	*prefixp = NULL;
-	get_token(&tok);
-	switch (tok.kind) {
-	case TOK_IDENT:
-		*typep = tok.str;
-		break;
-	case TOK_STRUCT:
-	case TOK_ENUM:
-	case TOK_UNION:
-		*prefixp = tok.str;
-		scan(TOK_IDENT, &tok);
-		*typep = tok.str;
-		break;
-	case TOK_UNSIGNED:
-		unsigned_dec(typep);
-		break;
-	case TOK_SHORT:
-		*typep = "short";
-		(void) peekscan(TOK_INT, &tok);
-		break;
-	case TOK_LONG:
-		*typep = "long";
-		(void) peekscan(TOK_INT, &tok);
-		break;
-	case TOK_VOID:
-		if (dkind != DEF_UNION && dkind != DEF_PROGRAM) {
-			error("voids allowed only inside union and program definitions with one argument");
-		}
-		*typep = tok.str;
-		break;
-	case TOK_STRING:
-	case TOK_OPAQUE:
-	case TOK_CHAR:
-	case TOK_INT:
-	case TOK_FLOAT:
-	case TOK_DOUBLE:
-	case TOK_BOOL:
-		*typep = tok.str;
-		break;
-	default:
-		error("expected type specifier");
+  token tok;
+
+  *prefixp = NULL;
+  get_token (&tok);
+  switch (tok.kind)
+    {
+    case TOK_IDENT:
+      *typep = tok.str;
+      break;
+    case TOK_STRUCT:
+    case TOK_ENUM:
+    case TOK_UNION:
+      *prefixp = tok.str;
+      scan (TOK_IDENT, &tok);
+      *typep = tok.str;
+      break;
+    case TOK_UNSIGNED:
+      unsigned_dec (typep);
+      break;
+    case TOK_SHORT:
+      *typep = "short";
+      (void) peekscan (TOK_INT, &tok);
+      break;
+    case TOK_LONG:
+      *typep = "long";
+      (void) peekscan (TOK_INT, &tok);
+      break;
+    case TOK_VOID:
+      if (dkind != DEF_UNION && dkind != DEF_PROGRAM)
+	{
+	  error ("voids allowed only inside union and program definitions with one argument");
 	}
+      *typep = tok.str;
+      break;
+    case TOK_STRING:
+    case TOK_OPAQUE:
+    case TOK_CHAR:
+    case TOK_INT:
+    case TOK_FLOAT:
+    case TOK_DOUBLE:
+    case TOK_BOOL:
+      *typep = tok.str;
+      break;
+    default:
+      error ("expected type specifier");
+    }
 }
 
 static void
-unsigned_dec(const char **typep)
+unsigned_dec (const char **typep)
 {
-	token tok;
-
-	peek(&tok);
-	switch (tok.kind) {
-	case TOK_CHAR:
-		get_token(&tok);
-		*typep = "u_char";
-		break;
-	case TOK_SHORT:
-		get_token(&tok);
-		*typep = "u_short";
-		(void) peekscan(TOK_INT, &tok);
-		break;
-	case TOK_LONG:
-		get_token(&tok);
-		*typep = "u_long";
-		(void) peekscan(TOK_INT, &tok);
-		break;
-	case TOK_INT:
-		get_token(&tok);
-		*typep = "u_int";
-		break;
-	default:
-		*typep = "u_int";
-		break;
-	}
+  token tok;
+
+  peek (&tok);
+  switch (tok.kind)
+    {
+    case TOK_CHAR:
+      get_token (&tok);
+      *typep = "u_char";
+      break;
+    case TOK_SHORT:
+      get_token (&tok);
+      *typep = "u_short";
+      (void) peekscan (TOK_INT, &tok);
+      break;
+    case TOK_LONG:
+      get_token (&tok);
+      *typep = "u_long";
+      (void) peekscan (TOK_INT, &tok);
+      break;
+    case TOK_INT:
+      get_token (&tok);
+      *typep = "u_int";
+      break;
+    default:
+      *typep = "u_int";
+      break;
+    }
 }
diff --git a/sunrpc/rpc_sample.c b/sunrpc/rpc_sample.c
index d1e1277c5b..89bfc7f5a0 100644
--- a/sunrpc/rpc_sample.c
+++ b/sunrpc/rpc_sample.c
@@ -69,14 +69,14 @@ write_sample_clnt (definition * def)
   int count = 0;
 
   if (def->def_kind != DEF_PROGRAM)
-    return (0);
+    return 0;
   /* generate sample code for each version */
   for (vp = def->def.pr.versions; vp != NULL; vp = vp->next)
     {
       write_sample_client (def->def_name, vp);
       ++count;
     }
-  return (count);
+  return count;
 }
 
 
@@ -90,7 +90,7 @@ write_sample_client (const char *program_name, version_list * vp)
   f_print (fout, "\n\nvoid\n");
   pvname (program_name, vp->vers_num);
   if (Cflag)
-    f_print (fout, "( char* host )\n{\n");
+    f_print (fout, "(char *host)\n{\n");
   else
     f_print (fout, "(host)\nchar *host;\n{\n");
   f_print (fout, "\tCLIENT *clnt;\n");
@@ -99,17 +99,33 @@ write_sample_client (const char *program_name, version_list * vp)
   for (proc = vp->procs; proc != NULL; proc = proc->next)
     {
       f_print (fout, "\t");
-      ptype (proc->res_prefix, proc->res_type, 1);
-      f_print (fout, " *result_%d;\n", ++i);
+      ++i;
+      if (mtflag)
+	{
+	  f_print (fout, "enum clnt_stat retval_%d;\n\t", i);
+	  ptype (proc->res_prefix, proc->res_type, 1);
+	  if (!streq (proc->res_type, "void"))
+	    f_print (fout, "result_%d;\n", i);
+	  else
+	    fprintf (fout, "*result_%d;\n", i);
+	}
+      else
+	{
+	  ptype (proc->res_prefix, proc->res_type, 1);
+	  f_print (fout, " *result_%d;\n", i);
+	}
       /* print out declarations for arguments */
       if (proc->arg_num < 2 && !newstyle)
 	{
 	  f_print (fout, "\t");
 	  if (!streq (proc->args.decls->decl.type, "void"))
-	    ptype (proc->args.decls->decl.prefix, proc->args.decls->decl.type, 1);
+	    {
+	      ptype (proc->args.decls->decl.prefix,
+		     proc->args.decls->decl.type, 1);
+	      f_print (fout, " ");
+	    }
 	  else
-	    f_print (fout, "char* ");	/* cannot have "void" type */
-	  f_print (fout, " ");
+	    f_print (fout, "char *");	/* cannot have "void" type */
 	  pvname (proc->proc_name, vp->vers_num);
 	  f_print (fout, "_arg;\n");
 	}
@@ -119,39 +135,50 @@ write_sample_client (const char *program_name, version_list * vp)
 	    {
 	      f_print (fout, "\t");
 	      ptype (l->decl.prefix, l->decl.type, 1);
-	      f_print (fout, " ");
+	      if (strcmp (l->decl.type, "string") == 1)
+		f_print (fout, " ");
 	      pvname (proc->proc_name, vp->vers_num);
 	      f_print (fout, "_%s;\n", l->decl.name);
-/*        pdeclaration(proc->args.argname, &l->decl, 1, ";\n" ); */
 	    }
 	}
     }
 
   /* generate creation of client handle */
-  f_print (fout, "\tclnt = clnt_create(host, %s, %s, \"%s\");\n",
+  f_print(fout, "\n#ifndef\tDEBUG\n");
+  f_print (fout, "\tclnt = clnt_create (host, %s, %s, \"%s\");\n",
 	   program_name, vp->vers_name, tirpcflag ? "netpath" : "udp");
   f_print (fout, "\tif (clnt == NULL) {\n");
-  f_print (fout, "\t\tclnt_pcreateerror(host);\n");
-  f_print (fout, "\t\texit(1);\n\t}\n");
+  f_print (fout, "\t\tclnt_pcreateerror (host);\n");
+  f_print (fout, "\t\texit (1);\n\t}\n");
+  f_print(fout, "#endif\t/* DEBUG */\n\n");
 
   /* generate calls to procedures */
   i = 0;
   for (proc = vp->procs; proc != NULL; proc = proc->next)
     {
-      f_print (fout, "\tresult_%d = ", ++i);
+      if (mtflag)
+	f_print(fout, "\tretval_%d = ",++i);
+      else
+	f_print (fout, "\tresult_%d = ", ++i);
       pvname (proc->proc_name, vp->vers_num);
       if (proc->arg_num < 2 && !newstyle)
 	{
 	  f_print (fout, "(");
-	  if (streq (proc->args.decls->decl.type, "void"))	/* cast to void* */
+	  if (streq (proc->args.decls->decl.type, "void"))/* cast to void* */
 	    f_print (fout, "(void*)");
 	  f_print (fout, "&");
 	  pvname (proc->proc_name, vp->vers_num);
-	  f_print (fout, "_arg, clnt);\n");
+	  if (mtflag)
+	    f_print(fout, "_arg, &result_%d, clnt);\n", i);
+	  else
+	    f_print (fout, "_arg, clnt);\n");
 	}
       else if (streq (proc->args.decls->decl.type, "void"))
 	{
-	  f_print (fout, "(clnt);\n");
+	  if (mtflag)
+	    f_print (fout, "(&result_%d, clnt);\n", i);
+	  else
+	    f_print (fout, "(clnt);\n");
 	}
       else
 	{
@@ -161,14 +188,27 @@ write_sample_client (const char *program_name, version_list * vp)
 	      pvname (proc->proc_name, vp->vers_num);
 	      f_print (fout, "_%s, ", l->decl.name);
 	    }
+	  if (mtflag)
+	    f_print(fout, "&result_%d, ", i);
 	  f_print (fout, "clnt);\n");
 	}
-      f_print (fout, "\tif (result_%d == NULL) {\n", i);
-      f_print (fout, "\t\tclnt_perror(clnt, \"call failed:\");\n");
-      f_print (fout, "\t}\n");
+      if (mtflag)
+	{
+	  f_print(fout, "\tif (retval_%d != RPC_SUCCESS) {\n", i);
+	}
+      else
+	{
+	  f_print(fout, "\tif (result_%d == (", i);
+	  ptype(proc->res_prefix, proc->res_type, 1);
+	  f_print(fout, "*) NULL) {\n");
+	}
+      f_print(fout, "\t\tclnt_perror (clnt, \"call failed\");\n");
+      f_print(fout, "\t}\n");
     }
 
-  f_print (fout, "\tclnt_destroy( clnt );\n");
+  f_print (fout, "#ifndef\tDEBUG\n");
+  f_print (fout, "\tclnt_destroy (clnt);\n");
+  f_print (fout, "#endif\t /* DEBUG */\n");
   f_print (fout, "}\n");
 }
 
@@ -183,34 +223,62 @@ write_sample_server (definition * def)
       for (proc = vp->procs; proc != NULL; proc = proc->next)
 	{
 	  f_print (fout, "\n");
-/*                      if( Cflag )
-   f_print( fout, "extern \"C\"{\n");
- */
-	  return_type (proc);
-	  f_print (fout, "* \n");
-	  if (Cflag)
+	  if (!mtflag)
+	    {
+	      return_type (proc);
+	      f_print (fout, "*\n");
+	    }
+	  else
+	    f_print (fout, "bool_t\n");
+	  if (Cflag || mtflag)
 	    pvname_svc (proc->proc_name, vp->vers_num);
 	  else
-	    pvname (proc->proc_name, vp->vers_num);
-	  printarglist (proc, RQSTP, "struct svc_req *");
+	    pvname(proc->proc_name, vp->vers_num);
+	  printarglist(proc, "result", RQSTP, "struct svc_req *");
+	  f_print(fout, "{\n");
+	  if (!mtflag)
+	    {
+	      f_print(fout, "\tstatic ");
+	      if(!streq(proc->res_type, "void"))
+		return_type(proc);
+	      else
+		f_print(fout, "char *");
+                                /* cannot have void type */
+	      /* f_print(fout, " result;\n", proc->res_type); */
+	      f_print(fout, " result;\n");
+	    }
+	  else
+	    f_print(fout, "\tbool_t retval;\n");
+	  fprintf (fout, "\n\t/*\n\t * insert server code here\n\t */\n\n");
 
-	  f_print (fout, "{\n");
-	  f_print (fout, "\n\tstatic ");
-	  if (!streq (proc->res_type, "void"))
-	    return_type (proc);
+	  if (!mtflag)
+	    if(!streq(proc->res_type, "void"))
+	      f_print(fout, "\treturn &result;\n}\n");
+	    else /* cast back to void * */
+	      f_print(fout, "\treturn (void *) &result;\n}\n");
 	  else
-	    f_print (fout, "char*");	/* cannot have void type */
-	  f_print (fout, " result;\n" /*, proc->res_type *//*? */ );
-	  f_print (fout,
-		   "\n\t/*\n\t * insert server code here\n\t */\n\n");
-	  if (!streq (proc->res_type, "void"))
-	    f_print (fout, "\treturn(&result);\n}\n");
-	  else			/* cast back to void * */
-	    f_print (fout, "\treturn((void*) &result);\n}\n");
-/*                      if( Cflag)
-   f_print( fout, "};\n");
- */
+	    f_print(fout, "\treturn retval;\n}\n");
+	}
 
+      /* put in sample freeing routine */
+      if (mtflag)
+	{
+	  f_print(fout, "\nint\n");
+	  pvname(def->def_name, vp->vers_num);
+	  if (Cflag)
+	    f_print(fout,"_freeresult (SVCXPRT *transp, xdrproc_t xdr_result, caddr_t result)\n");
+	  else
+	    {
+	      f_print(fout,"_freeresult (transp, xdr_result, result)\n");
+	      f_print(fout,"\tSVCXPRT *transp;\n");
+	      f_print(fout,"\txdrproc_t xdr_result;\n");
+	      f_print(fout,"\tcaddr_t result;\n");
+	    }
+	  f_print(fout, "{\n");
+	  f_print(fout, "\txdr_free (xdr_result, result);\n");
+	  f_print(fout,
+		  "\n\t/*\n\t * Insert additional freeing code here, if needed\n\t */\n");
+	  f_print(fout, "\n\treturn 0;\n}\n");
 	}
     }
 }
@@ -242,14 +310,14 @@ write_sample_clnt_main (void)
 
   f_print (fout, "\n\n");
   if (Cflag)
-    f_print (fout, "main( int argc, char* argv[] )\n{\n");
+    f_print (fout, "int\nmain (int argc, char *argv[])\n{\n");
   else
-    f_print (fout, "main(argc, argv)\nint argc;\nchar *argv[];\n{\n");
+    f_print (fout, "int\nmain (argc, argv)\nint argc;\nchar *argv[];\n{\n");
 
   f_print (fout, "\tchar *host;");
-  f_print (fout, "\n\n\tif(argc < 2) {");
-  f_print (fout, "\n\t\tprintf(\"usage: %%s server_host\\n\", argv[0]);\n");
-  f_print (fout, "\t\texit(1);\n\t}");
+  f_print (fout, "\n\n\tif (argc < 2) {");
+  f_print (fout, "\n\t\tprintf (\"usage: %%s server_host\\n\", argv[0]);\n");
+  f_print (fout, "\t\texit (1);\n\t}");
   f_print (fout, "\n\thost = argv[1];\n");
 
   for (l = defined; l != NULL; l = l->next)
@@ -263,8 +331,8 @@ write_sample_clnt_main (void)
 	{
 	  f_print (fout, "\t");
 	  pvname (def->def_name, vp->vers_num);
-	  f_print (fout, "( host );\n");
+	  f_print (fout, " (host);\n");
 	}
     }
-  f_print (fout, "}\n");
+  f_print (fout, "exit (0);\n}\n");
 }
diff --git a/sunrpc/rpc_scan.c b/sunrpc/rpc_scan.c
index 1c486d1715..aa988052b1 100644
--- a/sunrpc/rpc_scan.c
+++ b/sunrpc/rpc_scan.c
@@ -70,9 +70,7 @@ scan (tok_kind expect, token * tokp)
 {
   get_token (tokp);
   if (tokp->kind != expect)
-    {
-      expected1 (expect);
-    }
+    expected1 (expect);
 }
 
 /*
@@ -106,7 +104,7 @@ scan3 (tok_kind expect1, tok_kind expect2, tok_kind expect3, token * tokp)
  * scan expecting a constant, possibly symbolic
  */
 void
-scan_num (token * tokp)
+scan_num (token *tokp)
 {
   get_token (tokp);
   switch (tokp->kind)
@@ -114,7 +112,7 @@ scan_num (token * tokp)
     case TOK_IDENT:
       break;
     default:
-      error ("constant or identifier expected");
+      error (_("constant or identifier expected"));
     }
 }
 
@@ -122,7 +120,7 @@ scan_num (token * tokp)
  * Peek at the next token
  */
 void
-peek (token * tokp)
+peek (token *tokp)
 {
   get_token (tokp);
   unget_token (tokp);
@@ -132,22 +130,22 @@ peek (token * tokp)
  * Peek at the next token and scan it if it matches what you expect
  */
 int
-peekscan (tok_kind expect, token * tokp)
+peekscan (tok_kind expect, token *tokp)
 {
   peek (tokp);
   if (tokp->kind == expect)
     {
       get_token (tokp);
-      return (1);
+      return 1;
     }
-  return (0);
+  return 0;
 }
 
 /*
  * Get the next token, printing out any directive that are encountered.
  */
 void
-get_token (token * tokp)
+get_token (token *tokp)
 {
   int commenting;
 
diff --git a/sunrpc/rpc_svcout.c b/sunrpc/rpc_svcout.c
index 75eb695e87..9b5f1dd0f5 100644
--- a/sunrpc/rpc_svcout.c
+++ b/sunrpc/rpc_svcout.c
@@ -48,6 +48,7 @@ static const char TRANSP[] = "transp";
 static const char ARG[] = "argument";
 static const char RESULT[] = "result";
 static const char ROUTINE[] = "local";
+static char RETVAL[] = "retval";
 
 char _errbuf[256];		/* For all messages */
 
@@ -103,12 +104,31 @@ write_most (const char *infile /* our name */ , int netflag, int nomain)
 #endif
       f_print (fout, "%s int _rpcpmstart;", var_type);
       f_print (fout, "\t\t/* Started by a port monitor ? */\n");
-      f_print (fout, "%s int _rpcfdtype;", var_type);
-      f_print (fout, "\t\t/* Whether Stream or Datagram ? */\n");
+      if (!tirpcflag)
+	{
+	  f_print (fout, "%s int _rpcfdtype;", var_type);
+	  f_print (fout, "\t\t/* Whether Stream or Datagram ? */\n");
+	}
       if (timerflag)
 	{
+#if 0
 	  f_print (fout, "%s int _rpcsvcdirty;", var_type);
 	  f_print (fout, "\t/* Still serving ? */\n");
+#else
+	  f_print(fout, " /* States a server can be in wrt request */\n\n");
+	  f_print(fout, "#define\t_IDLE 0\n");
+	  f_print(fout, "#define\t_SERVED 1\n");
+	  f_print(fout, "#define\t_SERVING 2\n\n");
+	  f_print(fout, "static int _rpcsvcstate = _IDLE;");
+	  f_print(fout, "\t /* Set when a request is serviced */\n");
+
+	  if (mtflag)
+	    {
+	      f_print (fout, "mutex_t _svcstate_lock;");
+	      f_print (fout,
+		       "\t\t\t/* Mutex lock for variable_rpcsvcstate */\n");
+	    }
+#endif
 	}
       write_svc_aux (nomain);
     }
@@ -120,10 +140,10 @@ write_most (const char *infile /* our name */ , int netflag, int nomain)
 
 #ifdef __GNU_LIBRARY__
   if (Cflag)
-    f_print (fout, "\nint\nmain(int argc, char **argv)\n");
+    f_print (fout, "\nint\nmain (int argc, char **argv)\n");
   else
     {
-      f_print (fout, "\nint\nmain(argc, argv)\n");
+      f_print (fout, "\nint\nmain (argc, argv)\n");
       f_print (fout, "\tint argc;\n");
       f_print (fout, "\tchar **argv;\n");
     }
@@ -147,7 +167,12 @@ write_most (const char *infile /* our name */ , int netflag, int nomain)
 	  f_print (fout, "\tpid_t pid;\n");
 	  f_print (fout, "\tint i;\n");
 	  f_print (fout, "\tchar mname[FMNAMESZ + 1];\n\n");
-	  write_pm_most (infile, netflag);
+
+	  if (mtflag & timerflag)
+	    f_print (fout,
+		     "\tmutex_init (&_svcstate_lock, USYNC_THREAD, NULL);\n");
+
+ 	  write_pm_most (infile, netflag);
 	  f_print (fout, "\telse {\n");
 	  write_rpc_svc_fg (infile, "\t\t");
 	  f_print (fout, "\t}\n");
@@ -180,19 +205,19 @@ write_netid_register (const char *transp)
 
   sp = "";
   f_print (fout, "\n");
-  f_print (fout, "%s\tnconf = getnetconfigent(\"%s\");\n", sp, transp);
+  f_print (fout, "%s\tnconf = getnetconfigent (\"%s\");\n", sp, transp);
   f_print (fout, "%s\tif (nconf == NULL) {\n", sp);
   (void) sprintf (_errbuf, "cannot find %s netid.", transp);
   sprintf (tmpbuf, "%s\t\t", sp);
   print_err_message (tmpbuf);
-  f_print (fout, "%s\t\texit(1);\n", sp);
+  f_print (fout, "%s\t\texit (1);\n", sp);
   f_print (fout, "%s\t}\n", sp);
-  f_print (fout, "%s\t%s = svc_tli_create(RPC_ANYFD, nconf, 0, 0, 0);\n",
+  f_print (fout, "%s\t%s = svc_tli_create (RPC_ANYFD, nconf, 0, 0, 0);\n",
 	   sp, TRANSP /*, transp *//* ?!?... */ );
   f_print (fout, "%s\tif (%s == NULL) {\n", sp, TRANSP);
-  (void) sprintf (_errbuf, "cannot create %s service.", transp);
+  sprintf (_errbuf, "cannot create %s service.", transp);
   print_err_message (tmpbuf);
-  f_print (fout, "%s\t\texit(1);\n", sp);
+  f_print (fout, "%s\t\texit (1);\n", sp);
   f_print (fout, "%s\t}\n", sp);
 
   for (l = defined; l != NULL; l = l->next)
@@ -204,22 +229,20 @@ write_netid_register (const char *transp)
 	}
       for (vp = def->def.pr.versions; vp != NULL; vp = vp->next)
 	{
-	  f_print (fout,
-		   "%s\t(void) rpcb_unset(%s, %s, nconf);\n",
+	  f_print (fout, "%s\t(void) rpcb_unset (%s, %s, nconf);\n",
 		   sp, def->def_name, vp->vers_name);
-	  f_print (fout,
-		   "%s\tif (!svc_reg(%s, %s, %s, ",
+	  f_print (fout, "%s\tif (!svc_reg (%s, %s, %s, ",
 		   sp, TRANSP, def->def_name, vp->vers_name);
 	  pvname (def->def_name, vp->vers_num);
 	  f_print (fout, ", nconf)) {\n");
 	  (void) sprintf (_errbuf, "unable to register (%s, %s, %s).",
 			  def->def_name, vp->vers_name, transp);
 	  print_err_message (tmpbuf);
-	  f_print (fout, "%s\t\texit(1);\n", sp);
+	  f_print (fout, "%s\t\texit (1);\n", sp);
 	  f_print (fout, "%s\t}\n", sp);
 	}
     }
-  f_print (fout, "%s\tfreenetconfigent(nconf);\n", sp);
+  f_print (fout, "%s\tfreenetconfigent (nconf);\n", sp);
 }
 
 /*
@@ -241,7 +264,7 @@ write_nettype_register (const char *transp)
 	}
       for (vp = def->def.pr.versions; vp != NULL; vp = vp->next)
 	{
-	  f_print (fout, "\tif (!svc_create(");
+	  f_print (fout, "\tif (!svc_create (");
 	  pvname (def->def_name, vp->vers_num);
 	  f_print (fout, ", %s, %s, \"%s\")) {\n ",
 		   def->def_name, vp->vers_name, transp);
@@ -249,7 +272,7 @@ write_nettype_register (const char *transp)
 			  "unable to create (%s, %s) for %s.",
 			  def->def_name, vp->vers_name, transp);
 	  print_err_message ("\t\t");
-	  f_print (fout, "\t\texit(1);\n");
+	  f_print (fout, "\t\texit (1);\n");
 	  f_print (fout, "\t}\n");
 	}
     }
@@ -267,22 +290,22 @@ write_rest (void)
       f_print (fout, "\tif (%s == (SVCXPRT *)NULL) {\n", TRANSP);
       (void) sprintf (_errbuf, "could not create a handle");
       print_err_message ("\t\t");
-      f_print (fout, "\t\texit(1);\n");
+      f_print (fout, "\t\texit (1);\n");
       f_print (fout, "\t}\n");
       if (timerflag)
 	{
 	  f_print (fout, "\tif (_rpcpmstart) {\n");
 	  f_print (fout,
-		   "\t\t(void) signal(SIGALRM, %s closedown);\n",
+		   "\t\t(void) signal (SIGALRM, %s closedown);\n",
 		   Cflag ? "(SIG_PF)" : "(void(*)())");
-	  f_print (fout, "\t\t(void) alarm(_RPCSVC_CLOSEDOWN);\n");
+	  f_print (fout, "\t\t(void) alarm (_RPCSVC_CLOSEDOWN);\n");
 	  f_print (fout, "\t}\n");
 	}
     }
-  f_print (fout, "\tsvc_run();\n");
+  f_print (fout, "\tsvc_run ();\n");
   (void) sprintf (_errbuf, "svc_run returned");
   print_err_message ("\t");
-  f_print (fout, "\texit(1);\n");
+  f_print (fout, "\texit (1);\n");
   f_print (fout, "\t/* NOTREACHED */\n");
   f_print (fout, "}\n");
 }
@@ -312,8 +335,6 @@ write_programs (const char *storage)
 	  write_program (def, storage);
 	}
     }
-
-
 }
 
 /* write out definition of internal function (e.g. _printmsg_1(...))
@@ -333,25 +354,37 @@ write_real_program (const definition * def)
     {
       for (proc = vp->procs; proc != NULL; proc = proc->next)
 	{
-	  f_print (fout, "\n");
-	  internal_proctype (proc);
+	  fprintf (fout, "\n");
+	  if (!mtflag)
+	    internal_proctype (proc);
+	  else
+	    f_print (fout, "int");
 	  f_print (fout, "\n_");
 	  pvname (proc->proc_name, vp->vers_num);
 	  if (Cflag)
 	    {
-	      f_print (fout, "(");
+	      f_print (fout, " (");
 	      /* arg name */
 	      if (proc->arg_num > 1)
 		f_print (fout, proc->args.argname);
 	      else
 		ptype (proc->args.decls->decl.prefix,
 		       proc->args.decls->decl.type, 0);
-	      f_print (fout, " *argp, struct svc_req *%s)\n",
-		       RQSTP);
+	      if (mtflag)
+		{
+		  f_print(fout, " *argp, void *%s, struct svc_req *%s)\n",
+			  RESULT, RQSTP);
+		}
+	      else
+		f_print (fout, " *argp, struct svc_req *%s)\n",
+			 RQSTP);
 	    }
 	  else
 	    {
-	      f_print (fout, "(argp, %s)\n", RQSTP);
+	      if (mtflag)
+		f_print(fout, " (argp, %s, %s)\n", RESULT, RQSTP);
+	      else
+		f_print (fout, " (argp, %s)\n", RQSTP);
 	      /* arg name */
 	      if (proc->arg_num > 1)
 		f_print (fout, "\t%s *argp;\n", proc->args.argname);
@@ -366,8 +399,8 @@ write_real_program (const definition * def)
 	    }
 
 	  f_print (fout, "{\n");
-	  f_print (fout, "\treturn(");
-	  if (Cflag)
+	  f_print (fout, "\treturn (");
+	  if (Cflag || mtflag)
 	    pvname_svc (proc->proc_name, vp->vers_num);
 	  else
 	    pvname (proc->proc_name, vp->vers_num);
@@ -451,33 +484,65 @@ write_program (const definition * def, const char *storage)
 	  f_print (fout, "\t\tint fill;\n");
 	}
       f_print (fout, "\t} %s;\n", ARG);
-      f_print (fout, "\tchar *%s;\n", RESULT);
+      if (mtflag)
+	{
+	  f_print(fout, "\tunion {\n");
+	  for (proc = vp->procs; proc != NULL; proc = proc->next)
+	    if (!streq (proc->res_type, "void"))
+	      {
+		f_print(fout, "\t\t");
+		ptype(proc->res_prefix, proc->res_type, 0);
+		pvname(proc->proc_name, vp->vers_num);
+		f_print(fout, "_res;\n");
+	      }
+	  f_print(fout, "\t} %s;\n", RESULT);
+	  f_print(fout, "\tbool_t %s;\n", RETVAL);
+
+	} else
+	  f_print (fout, "\tchar *%s;\n", RESULT);
 
       if (Cflag)
 	{
 	  f_print (fout, "\txdrproc_t xdr_%s, xdr_%s;\n", ARG, RESULT);
-	  f_print (fout,
-		   "\tchar *(*%s)(char *, struct svc_req *);\n",
-		   ROUTINE);
+	  if (mtflag)
+	    f_print(fout,
+		    "\tbool_t (*%s)(char *, void *, struct svc_req *);\n",
+		    ROUTINE);
+	  else
+	    f_print (fout, "\tchar *(*%s)(char *, struct svc_req *);\n",
+		     ROUTINE);
 	}
       else
 	{
 	  f_print (fout, "\tbool_t (*xdr_%s)(), (*xdr_%s)();\n", ARG, RESULT);
-	  f_print (fout, "\tchar *(*%s)();\n", ROUTINE);
+	  if (mtflag)
+	    f_print(fout, "\tbool_t (*%s)();\n", ROUTINE);
+	  else
+	    f_print (fout, "\tchar *(*%s)();\n", ROUTINE);
 	}
-
       f_print (fout, "\n");
 
       if (timerflag)
+#if 0
 	f_print (fout, "\t_rpcsvcdirty = 1;\n");
+#else
+      {
+	if (mtflag)
+	  f_print(fout, "\tmutex_lock(&_svcstate_lock);\n");
+	f_print(fout, "\t_rpcsvcstate = _SERVING;\n");
+	if (mtflag)
+	  f_print(fout, "\tmutex_unlock(&_svcstate_lock);\n");
+      }
+#endif
+
       f_print (fout, "\tswitch (%s->rq_proc) {\n", RQSTP);
       if (!nullproc (vp->procs))
 	{
 	  f_print (fout, "\tcase NULLPROC:\n");
 	  f_print (fout,
 		   Cflag
-		   ? "\t\t(void) svc_sendreply(%s, (xdrproc_t) xdr_void, (char *)NULL);\n"
-		: "\t\t(void) svc_sendreply(%s, xdr_void, (char *)NULL);\n",
+		   ? "\t\t(void) svc_sendreply (%s, (xdrproc_t) xdr_void, (char *)NULL);\n"
+		: "\t\t(void) svc_sendreply (%s, xdr_void, (char *)NULL);\n",
 		   TRANSP);
 	  print_return ("\t\t");
 	  f_print (fout, "\n");
@@ -495,17 +560,27 @@ write_program (const definition * def, const char *storage)
 	    }
 	  p_xdrfunc (RESULT, proc->res_type);
 	  if (Cflag)
-	    f_print (fout,
-		     "\t\t%s = (char *(*)(char *, struct svc_req *)) ",
-		     ROUTINE);
+	    {
+	      if (mtflag)
+		f_print(fout,
+			"\t\t%s = (bool_t (*) (char *, void *,  struct svc_req *))",
+			ROUTINE);
+	      else
+		f_print (fout,
+			 "\t\t%s = (char *(*)(char *, struct svc_req *)) ",
+			 ROUTINE);
+	    }
 	  else
-	    f_print (fout, "\t\t%s = (char *(*)()) ", ROUTINE);
+	    if (mtflag)
+	      f_print(fout, "\t\t%s = (bool_t (*)()) ", ROUTINE);
+	    else
+	      f_print (fout, "\t\t%s = (char *(*)()) ", ROUTINE);
 
 	  if (newstyle)
 	    {			/* new style: calls internal routine */
 	      f_print (fout, "_");
 	    }
-	  if (Cflag && !newstyle)
+	  if ((Cflag || mtflag) && !newstyle)
 	    pvname_svc (proc->proc_name, vp->vers_num);
 	  else
 	    pvname (proc->proc_name, vp->vers_num);
@@ -517,7 +592,7 @@ write_program (const definition * def, const char *storage)
       print_return ("\t\t");
       f_print (fout, "\t}\n");
 
-      f_print (fout, "\t(void) memset((char *)&%s, 0, sizeof (%s));\n", ARG, ARG);
+      f_print (fout, "\tmemset ((char *)&%s, 0, sizeof (%s));\n", ARG, ARG);
       if (Cflag)
 	printif ("getargs", TRANSP, "(caddr_t) &", ARG);
       else
@@ -526,15 +601,29 @@ write_program (const definition * def, const char *storage)
       print_return ("\t\t");
       f_print (fout, "\t}\n");
 
-      if (Cflag)
-	f_print (fout, "\t%s = (*%s)((char *)&%s, %s);\n",
-		 RESULT, ROUTINE, ARG, RQSTP);
+      if (!mtflag)
+	if (Cflag)
+	  f_print (fout, "\t%s = (*%s)((char *)&%s, %s);\n",
+		   RESULT, ROUTINE, ARG, RQSTP);
+	else
+	  f_print (fout, "\t%s = (*%s)(&%s, %s);\n",
+		   RESULT, ROUTINE, ARG, RQSTP);
       else
-	f_print (fout, "\t%s = (*%s)(&%s, %s);\n",
-		 RESULT, ROUTINE, ARG, RQSTP);
-      f_print (fout,
-	       "\tif (%s != NULL && !svc_sendreply(%s, xdr_%s, %s)) {\n",
-	       RESULT, TRANSP, RESULT, RESULT);
+	if (Cflag)
+	  f_print(fout, "\t%s = (bool_t) (*%s)((char *)&%s, (void *)&%s, %s);\n",
+		  RETVAL, ROUTINE, ARG, RESULT, RQSTP);
+	else
+	  f_print(fout, "\t%s = (bool_t) (*%s)(&%s, &%s, %s);\n",
+		  RETVAL, ROUTINE, ARG, RESULT, RQSTP);
+      if (mtflag)
+	f_print(fout,
+		"\tif (%s > 0 && !svc_sendreply(%s, xdr_%s, (char *)&%s)) {\n",
+		RETVAL, TRANSP, RESULT, RESULT);
+      else
+	f_print(fout,
+		"\tif (%s != NULL && !svc_sendreply(%s, xdr_%s, %s)) {\n",
+		RESULT, TRANSP, RESULT, RESULT);
+
       printerr ("systemerr", TRANSP);
       f_print (fout, "\t}\n");
 
@@ -542,10 +631,22 @@ write_program (const definition * def, const char *storage)
 	printif ("freeargs", TRANSP, "(caddr_t) &", ARG);
       else
 	printif ("freeargs", TRANSP, "&", ARG);
-      (void) sprintf (_errbuf, "unable to free arguments");
+
+      sprintf (_errbuf, "unable to free arguments");
       print_err_message ("\t\t");
-      f_print (fout, "\t\texit(1);\n");
+      f_print (fout, "\t\texit (1);\n");
       f_print (fout, "\t}\n");
+      /* print out free routine */
+      if (mtflag)
+	{
+	  f_print(fout,"\tif (!");
+	  pvname(def->def_name, vp->vers_num);
+	  f_print(fout,"_freeresult (%s, xdr_%s, (caddr_t) &%s))\n",
+		  TRANSP, RESULT, RESULT);
+	  (void) sprintf(_errbuf, "unable to free results");
+	  print_err_message("\t\t");
+	  f_print(fout, "\n");
+	}
       print_return ("\t");
       f_print (fout, "}\n");
     }
@@ -554,14 +655,14 @@ write_program (const definition * def, const char *storage)
 static void
 printerr (const char *err, const char *transp)
 {
-  f_print (fout, "\t\tsvcerr_%s(%s);\n", err, transp);
+  f_print (fout, "\t\tsvcerr_%s (%s);\n", err, transp);
 }
 
 static void
 printif (const char *proc, const char *transp, const char *prefix,
 	 const char *arg)
 {
-  f_print (fout, "\tif (!svc_%s(%s, xdr_%s, %s%s)) {\n",
+  f_print (fout, "\tif (!svc_%s (%s, xdr_%s, %s%s)) {\n",
 	   proc, transp, arg, prefix, arg);
 }
 
@@ -572,10 +673,10 @@ nullproc (const proc_list * proc)
     {
       if (streq (proc->proc_num, "0"))
 	{
-	  return (1);
+	  return 1;
 	}
     }
-  return (0);
+  return 0;
 }
 
 static void
@@ -588,13 +689,13 @@ write_inetmost (const char *infile)
   f_print (fout, "\tint asize = sizeof (saddr);\n");
   f_print (fout, "\n");
   f_print (fout,
-       "\tif (getsockname(0, (struct sockaddr *)&saddr, &asize) == 0) {\n");
+       "\tif (getsockname (0, (struct sockaddr *)&saddr, &asize) == 0) {\n");
   f_print (fout, "\t\tint ssize = sizeof (int);\n\n");
   f_print (fout, "\t\tif (saddr.sin_family != AF_INET)\n");
-  f_print (fout, "\t\t\texit(1);\n");
-  f_print (fout, "\t\tif (getsockopt(0, SOL_SOCKET, SO_TYPE,\n");
+  f_print (fout, "\t\t\texit (1);\n");
+  f_print (fout, "\t\tif (getsockopt (0, SOL_SOCKET, SO_TYPE,\n");
   f_print (fout, "\t\t\t\t(char *)&_rpcfdtype, &ssize) == -1)\n");
-  f_print (fout, "\t\t\texit(1);\n");
+  f_print (fout, "\t\t\texit (1);\n");
   f_print (fout, "\t\tsock = 0;\n");
   f_print (fout, "\t\t_rpcpmstart = 1;\n");
   f_print (fout, "\t\tproto = 0;\n");
@@ -610,11 +711,21 @@ static void
 print_return (const char *space)
 {
   if (exitnow)
-    f_print (fout, "%sexit(0);\n", space);
+    f_print (fout, "%sexit (0);\n", space);
   else
     {
       if (timerflag)
-	f_print (fout, "%s_rpcsvcdirty = 0;\n", space);
+	{
+#if 0
+	  f_print (fout, "%s_rpcsvcdirty = 0;\n", space);
+#else
+	  if (mtflag)
+	    f_print(fout, "%smutex_lock(&_svcstate_lock);\n", space);
+	  f_print(fout, "%s_rpcsvcstate = _SERVED;\n", space);
+	  if (mtflag)
+	    f_print(fout, "%smutex_unlock(&_svcstate_lock);\n", space);
+#endif
+	}
       f_print (fout, "%sreturn;\n", space);
     }
 }
@@ -634,7 +745,7 @@ print_pmapunset (const char *space)
 	  for (vp = def->def.pr.versions; vp != NULL;
 	       vp = vp->next)
 	    {
-	      f_print (fout, "%s(void) pmap_unset(%s, %s);\n",
+	      f_print (fout, "%spmap_unset (%s, %s);\n",
 		       space, def->def_name, vp->vers_name);
 	    }
 	}
@@ -645,11 +756,11 @@ static void
 print_err_message (const char *space)
 {
   if (logflag)
-    f_print (fout, "%ssyslog(LOG_ERR, \"%s\");\n", space, _errbuf);
+    f_print (fout, "%ssyslog (LOG_ERR, \"%s\");\n", space, _errbuf);
   else if (inetdflag || pmflag)
-    f_print (fout, "%s_msgout(\"%s\");\n", space, _errbuf);
+    f_print (fout, "%s_msgout (\"%s\");\n", space, _errbuf);
   else
-    f_print (fout, "%sfprintf(stderr, \"%s\");\n", space, _errbuf);
+    f_print (fout, "%sfprintf (stderr, \"%s\");\n", space, _errbuf);
 }
 
 /*
@@ -675,22 +786,22 @@ write_msg_out (void)
   f_print (fout, "static\n");
   if (!Cflag)
     {
-      f_print (fout, "void _msgout(msg)\n");
+      f_print (fout, "void _msgout (msg)\n");
       f_print (fout, "\tchar *msg;\n");
     }
   else
     {
-      f_print (fout, "void _msgout(char* msg)\n");
+      f_print (fout, "void _msgout (char* msg)\n");
     }
   f_print (fout, "{\n");
   f_print (fout, "#ifdef RPC_SVC_FG\n");
   if (inetdflag || pmflag)
     f_print (fout, "\tif (_rpcpmstart)\n");
-  f_print (fout, "\t\tsyslog(LOG_ERR, msg);\n");
+  f_print (fout, "\t\tsyslog (LOG_ERR, msg);\n");
   f_print (fout, "\telse\n");
-  f_print (fout, "\t\t(void) fprintf(stderr, \"%%s\\n\", msg);\n");
+  f_print (fout, "\t\tfprintf (stderr, \"%%s\\n\", msg);\n");
   f_print (fout, "#else\n");
-  f_print (fout, "\tsyslog(LOG_ERR, msg);\n");
+  f_print (fout, "\tsyslog (LOG_ERR, msg);\n");
   f_print (fout, "#endif\n");
   f_print (fout, "}\n");
 }
@@ -705,20 +816,23 @@ write_timeout_func (void)
     return;
   f_print (fout, "\n");
   f_print (fout, "static void\n");
-#ifdef __GNU_LIBRARY__
   if (Cflag)
-    f_print (fout, "closedown(int sig)\n");
+    f_print (fout, "closedown (int sig)\n");
   else
-    f_print (fout, "closedown(sig)\n\tint sig;\n");
-#else
-  f_print (fout, "closedown()\n");
-#endif
+    f_print (fout, "closedown (sig)\n\tint sig;\n");
   f_print (fout, "{\n");
-#ifdef __GNU_LIBRARY__
-  f_print (fout, "\t(void) signal(sig, %s closedown);\n",
+
+#if defined (__GNU_LIBRARY__) && 0
+  f_print (fout, "\t(void) signal (sig, %s closedown);\n",
 	   Cflag ? "(SIG_PF)" : "(void(*)())");
 #endif
+  if (mtflag)
+    f_print(fout, "\tmutex_lock(&_svcstate_lock);\n");
+#if 0
   f_print (fout, "\tif (_rpcsvcdirty == 0) {\n");
+#else
+  f_print(fout, "\tif (_rpcsvcstate == _IDLE) {\n");
+#endif
   f_print (fout, "\t\textern fd_set svc_fdset;\n");
   f_print (fout, "\t\tstatic int size;\n");
   f_print (fout, "\t\tint i, openfd;\n");
@@ -731,15 +845,17 @@ write_timeout_func (void)
     {
       f_print (fout, "\n\t\tif (_rpcfdtype == SOCK_DGRAM)\n");
     }
-  f_print (fout, "\t\t\texit(0);\n");
+  f_print (fout, "\t\t\texit (0);\n");
   f_print (fout, "\t\tif (size == 0) {\n");
   if (tirpcflag)
     {
       f_print (fout, "\t\t\tstruct rlimit rl;\n\n");
       f_print (fout, "\t\t\trl.rlim_max = 0;\n");
       f_print (fout, "\t\t\tgetrlimit(RLIMIT_NOFILE, &rl);\n");
-      f_print (fout, "\t\t\tif ((size = rl.rlim_max) == 0)\n");
-      f_print (fout, "\t\t\t\treturn;\n");
+      f_print (fout, "\t\t\tif ((size = rl.rlim_max) == 0) {\n");
+      if (mtflag)
+	f_print(fout, "\t\t\t\tmutex_unlock(&_svcstate_lock);\n");
+       f_print (fout, "\t\t\t\treturn;\n\t\t\t}\n");
     }
   else
     {
@@ -750,9 +866,15 @@ write_timeout_func (void)
   f_print (fout, "\t\t\tif (FD_ISSET(i, &svc_fdset))\n");
   f_print (fout, "\t\t\t\topenfd++;\n");
   f_print (fout, "\t\tif (openfd <= 1)\n");
-  f_print (fout, "\t\t\texit(0);\n");
+  f_print (fout, "\t\t\texit (0);\n");
   f_print (fout, "\t}\n");
-  f_print (fout, "\t(void) alarm(_RPCSVC_CLOSEDOWN);\n");
+  f_print(fout, "\tif (_rpcsvcstate == _SERVED)\n");
+  f_print(fout, "\t\t_rpcsvcstate = _IDLE;\n\n");
+  if (mtflag)
+    f_print(fout, "\tmutex_unlock(&_svcstate_lock);\n");
+  f_print(fout, "\t(void) signal(SIGALRM, %s closedown);\n",
+	  Cflag? "(SIG_PF)" : "(void(*)())");
+  f_print (fout, "\talarm (_RPCSVC_CLOSEDOWN);\n");
   f_print (fout, "}\n");
 }
 
@@ -915,9 +1037,6 @@ open_log_file (const char *infile, const char *sp)
     *s = '.';
 }
 
-
-
-
 /*
  * write a registration for the given transport for Inetd
  */
diff --git a/sunrpc/rpc_util.c b/sunrpc/rpc_util.c
index fd696116c9..4c986040ce 100644
--- a/sunrpc/rpc_util.c
+++ b/sunrpc/rpc_util.c
@@ -95,7 +95,7 @@ streq (const char *a, const char *b)
  * find a value in a list
  */
 definition *
-findval (list * lst, const char *val,
+findval (list *lst, const char *val,
 	 int (*cmp) (const definition *, const char *))
 {
 
@@ -113,7 +113,7 @@ findval (list * lst, const char *val,
  * store a value in a list
  */
 void
-storeval (list ** lstp, definition * val)
+storeval (list **lstp, definition *val)
 {
   list **l;
   list *lst;
@@ -145,7 +145,10 @@ fixit (const char *type, const char *orig)
   switch (def->def.ty.rel)
     {
     case REL_VECTOR:
-      return (def->def.ty.old_type);
+      if (streq (def->def.ty.old_type, "opaque"))
+	return ("char");
+      else
+	return (def->def.ty.old_type);
     case REL_ALIAS:
       return (fixit (def->def.ty.old_type, orig));
     default:
@@ -227,7 +230,7 @@ isvectordef (const char *type, relation rel)
 	case REL_ARRAY:
 	  return 0;
 	case REL_POINTER:
-	  return (0);
+	  return 0;
 	case REL_ALIAS:
 	  def = findval (defined, type, typedefed);
 	  if (def == NULL)
@@ -290,7 +293,7 @@ crash (void)
 
   for (i = 0; i < nfiles; i++)
     {
-      (void) unlink (outfiles[i]);
+      unlink (outfiles[i]);
     }
   exit (1);
 }
diff --git a/sunrpc/rpc_util.h b/sunrpc/rpc_util.h
index bdbe183caa..cb1ceb9921 100644
--- a/sunrpc/rpc_util.h
+++ b/sunrpc/rpc_util.h
@@ -31,7 +31,7 @@
 /*      @(#)rpc_util.h  1.5  90/08/29  (C) 1987 SMI   */
 
 /*
- * rpc_util.h, Useful definitions for the RPC protocol compiler 
+ * rpc_util.h, Useful definitions for the RPC protocol compiler
  */
 
 #include <stdlib.h>
@@ -48,11 +48,18 @@ struct list {
 };
 typedef struct list list;
 
+struct xdrfunc {
+        char *name;
+        int pointerp;
+        struct xdrfunc *next;
+};
+typedef struct xdrfunc xdrfunc;
+
 #define PUT 1
 #define GET 2
 
 /*
- * Global variables 
+ * Global variables
  */
 #define MAXLINESIZE 1024
 extern char curline[MAXLINESIZE];
@@ -65,21 +72,23 @@ extern FILE *fin;
 
 extern list *defined;
 
-
 extern bas_type *typ_list_h;
 extern bas_type *typ_list_t;
+extern xdrfunc *xdrfunc_head, *xdrfunc_tail;
 
 /*
  * All the option flags
  */
 extern int inetdflag;
-extern int pmflag;   
+extern int pmflag;
 extern int tblflag;
 extern int logflag;
 extern int newstyle;
-extern int Cflag;     /* C++ flag */
-extern int tirpcflag; /* flag for generating tirpc code */
+extern int Cflag;      /* C++ flag */
+extern int CCflag;     /* C++ flag */
+extern int tirpcflag;  /* flag for generating tirpc code */
 extern int inlineflag; /* if this is 0, then do not generate inline code */
+extern int mtflag;
 
 /*
  * Other flags related with inetd jumpstart.
@@ -91,12 +100,12 @@ extern int timerflag;
 extern int nonfatalerrors;
 
 /*
- * rpc_util routines 
+ * rpc_util routines
  */
 void storeval(list **lstp, definition *val);
 #define STOREVAL(list,item) storeval(list,item)
 
-definition *findval(list *lst, const char *val, 
+definition *findval(list *lst, const char *val,
 		    int (*cmp)(const definition *, const char *));
 #define FINDVAL(list,item,finder) findval(list, item, finder)
 
@@ -115,18 +124,18 @@ bas_type *find_type(const char *type);
 
 
 /*
- * rpc_cout routines 
+ * rpc_cout routines
  */
 void emit(definition *def);
 
 /*
- * rpc_hout routines 
+ * rpc_hout routines
  */
 void print_datadef(definition *def);
 void print_funcdef(definition *def);
 
 /*
- * rpc_svcout routines 
+ * rpc_svcout routines
  */
 void write_most(const char *infile, int netflag, int nomain);
 void write_register(void);
diff --git a/sysdeps/mach/hurd/Makefile b/sysdeps/mach/hurd/Makefile
index bf1c3b02bc..9f1ce74eb1 100644
--- a/sysdeps/mach/hurd/Makefile
+++ b/sysdeps/mach/hurd/Makefile
@@ -1,4 +1,4 @@
-# Copyright (C) 1993, 1994, 1995, 1996, 1997 Free Software Foundation, Inc.
+# Copyright (C) 1993, 94, 95, 96, 97, 98 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
@@ -91,8 +91,10 @@ $(common-objpfx)stamp-errnos: $(hurd)/errnos.awk $(errno.texinfo) \
 # Make it unwritable so noone will edit it by mistake.
 	-chmod a-w $(hurd)/errnos.h-tmp
 	./$(..)move-if-change $(hurd)/errnos.h-tmp $(hurd)/errnos.h
+ifeq ($(with-cvs),yes)
 	test ! -d CVS || \
 	  (cd $(hurd); cvs commit -m'Regenerated from $^' errnos.h)
+endif
 	touch $@
 
 common-generated += errnos.d stamp-errnos
diff --git a/sysdeps/sparc/sparc32/Makefile b/sysdeps/sparc/sparc32/Makefile
index c7c867ef22..00a39602a2 100644
--- a/sysdeps/sparc/sparc32/Makefile
+++ b/sysdeps/sparc/sparc32/Makefile
@@ -1,4 +1,4 @@
-# Copyright (C) 1991, 92, 93, 94, 95, 96, 97 Free Software Foundation, Inc.
+# Copyright (C) 1991, 92, 93, 94, 95, 96, 97, 98 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
@@ -46,6 +46,8 @@ $(divrem:%=$(sysdep_dir)/sparc/sparc32/%.S): $(sysdep_dir)/sparc/sparc32/divrem.
 # Make it unwritable so noone will edit it by mistake.
 	-chmod a-w $@-tmp
 	mv -f $@-tmp $@
+ifeq ($(with-cvs),yes)
 	test ! -d CVS || cvs commit -m'Regenerated from $<' $@
+endif
 
 sysdep-realclean := $(sysdep-realclean) $(divrem:%=sysdeps/sparc/sparc32/%.S)