about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog27
-rw-r--r--config.h.in22
-rw-r--r--config.make.in1
-rwxr-xr-xconfigure147
-rw-r--r--configure.in73
-rw-r--r--inet/arpa/inet.h11
-rw-r--r--inet/inet_lnaof.c4
-rw-r--r--inet/inet_mkadr.c4
-rw-r--r--inet/inet_net.c6
-rw-r--r--inet/inet_netof.c4
-rw-r--r--inet/netinet/in.h18
-rw-r--r--inet/netinet/tcp.h2
-rw-r--r--inet/protocols/rwhod.h4
-rw-r--r--inet/protocols/talkd.h8
-rw-r--r--inet/rcmd.c20
-rw-r--r--libc-symbols.h52
-rw-r--r--resolv/inet_addr.c4
-rw-r--r--sunrpc/rpc/auth.h8
-rw-r--r--sunrpc/svc_authux.c2
-rw-r--r--sunrpc/xdr_rec.c174
20 files changed, 385 insertions, 206 deletions
diff --git a/ChangeLog b/ChangeLog
index 305dff71e6..7c9aa2de19 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,9 +1,30 @@
 Tue Mar 19 14:18:42 1996  Roland McGrath  <roland@charlie-brown.gnu.ai.mit.edu>
 
+	* config.make.in (weak-symbols): Variable removed.
+	* configure.in (--with-weak-symbols): Option removed.
+	(NO_UNDERSCORES, HAVE_ASM_WEAK_DIRECTIVE, HAVE_ASM_WEAKEXT_DIRECTIVE):
+	New tests.
+	* config.h.in (HAVE_WEAK_SYMBOLS): #undef removed.
+	(NO_UNDERSCORES, HAVE_ASM_WEAK_DIRECTIVE, HAVE_ASM_WEAKEXT_DIRECTIVE):
+	New #undefs.
+	* libc-symbols.h: Use them instead of HAVE_WEAK_SYMBOLS.
+
 	* sysdeps/unix/bsd/pause.c: Moved to sysdeps/unix/common/pause.c.
 
 Mon Mar  4 20:17:28 1996  David Mosberger-Tang  <davidm@azstarnet.com>
 
+	* inet/inet_lnaof.c: Use u_int32_t instead of u_long.
+	* inet/inet_mkadr.c: Likewise.
+	* inet/inet_net.c: Likewise.
+	* inet/inet_netof.c: Likewise.
+	* inet/rcmd.c: Likewise.
+	* inet/arpa/inet.h: Likewise.
+	* inet/netinet/in.h: Likewise.
+	* inet/netinet/tcp.h: Likewise.
+	* inet/protocols/rwhod.h: Likewise.
+	* inet/protocols/talkd.h: Likewise.
+	* resolv/inet_addr.c: Likewise.
+
 	* sysdeps/unix/sysv/linux/adjtime.c: Use INT_MAX instead of LONG_MAX.
 
 	* sysdeps/unix/sysv/Makefile (sysdep_routines): Don't add s_getdents.
@@ -190,13 +211,13 @@ Wed Feb 14 00:21:17 1996  David Mosberger-Tang  <davidm@azstarnet.com>
 
 	* sunrpc/svc.c (maskp): changed from u_long* to u_int32*.
 
+	* sunrpc/rpc/xdr.h (IXDR_GET_LONG, IXDR_PUT_LONG): change casts to
+ 	u_int32_t (instead of u_long).
+
 	* sunrpc/rpc_cmsg.c (xdr_callmsg), sunrpc/svc_authux.c: increment
 	"buf" pointer by casting it to a char* first since a long* may be 8
  	bytes or more and oa->oa_length may be any multiple of 4.
 
-	* sunrpc/rpc/xdr.h (IXDR_GET_LONG, IXDR_PUT_LONG): change casts to
- 	u_int32_t (instead of u_long).
-
 	* sunrpc/clnt_udp.c (clntudp_call): replaced sizeof(u_long) by 4
 	since it really is testing for 32 bits.  Fixed casts to use
 	u_int32 instead of u_long.
diff --git a/config.h.in b/config.h.in
index 52332beda2..35d865b24c 100644
--- a/config.h.in
+++ b/config.h.in
@@ -4,12 +4,19 @@
 #undef	HAVE_GNU_LD
 
 /* Define if using ELF, which supports weak symbols.
-   This implies HAVE_WEAK_SYMBOLS; set by --with-elf.  */
+   This implies HAVE_ASM_WEAK_DIRECTIVE and NO_UNDERSCORES; set by
+   --with-elf.  */
 #undef	HAVE_ELF
 
-/* Define if weak symbols are available in the assembler and
-   linker being used.  Set by --with-weak-symbols.  */
-#undef	HAVE_WEAK_SYMBOLS
+/* Define if C symbols are asm symbols.  Don't define if C symbols
+   have a `_' prepended to make the asm symbol.  */
+#undef	NO_UNDERSCORES
+
+/* Define if weak symbols are available via the `.weak' directive.  */
+#undef	HAVE_ASM_WEAK_DIRECTIVE
+
+/* Define if weak symbols are available via the `.weakext' directive.  */
+#undef	HAVE_ASM_WEAKEXT_DIRECTIVE
 
 /* Define if not using ELF, but `.init' and `.fini' sections are available.  */
 #undef	HAVE_INITFINI
@@ -24,13 +31,6 @@
    declaring a symbol global (default `.globl').  */
 #undef	ASM_GLOBAL_DIRECTIVE
 
-/* ELF has weak symbols, and with GNU ld a.out does too.  */
-#ifndef HAVE_WEAK_SYMBOLS
-#if defined (HAVE_ELF) || defined (HAVE_GNU_LD)
-#define HAVE_WEAK_SYMBOLS
-#endif
-#endif
-
 /* Define to use GNU libio instead of GNU stdio.
    This is defined by configure under --enable-libio.  */
 #undef	USE_IN_LIBIO
diff --git a/config.make.in b/config.make.in
index 2af925da48..50571745d0 100644
--- a/config.make.in
+++ b/config.make.in
@@ -15,7 +15,6 @@ config-sysdirs = @sysnames@
 config-defines = @DEFS@
 
 elf = @elf@
-weak-symbols = @weak@
 have-initfini = @libc_cv_have_initfini@
 
 # Configuration options.
diff --git a/configure b/configure
index ce9930e964..dc70be001c 100755
--- a/configure
+++ b/configure
@@ -2,8 +2,8 @@
 
 # From configure.in CVSid
 # Guess values for system-dependent variables and create Makefiles.
-# Generated automatically using autoconf version 2.7 
-# Copyright (C) 1992, 1993, 1994 Free Software Foundation, Inc.
+# Generated automatically using autoconf version 2.9 
+# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc.
 #
 # This configure script is free software; the Free Software Foundation
 # gives unlimited permission to copy, distribute and modify it.
@@ -27,8 +27,6 @@ ac_help="$ac_help
 ac_help="$ac_help
   --with-elf		  if using the ELF object format"
 ac_help="$ac_help
-  --with-weak-symbols	  if weak symbols are available in as and ld"
-ac_help="$ac_help
   --enable-libio          build in GNU libio instead of GNU stdio"
 ac_help="$ac_help
   --enable-shared         build shared library [default=yes if GNU ld & ELF]"
@@ -355,7 +353,7 @@ EOF
     verbose=yes ;;
 
   -version | --version | --versio | --versi | --vers)
-    echo "configure generated by autoconf version 2.7"
+    echo "configure generated by autoconf version 2.9"
     exit 0 ;;
 
   -with-* | --with-*)
@@ -620,14 +618,6 @@ else
   elf=no
 fi
 
-# Check whether --with-weak-symbols or --without-weak-symbols was given.
-if test "${with_weak_symbols+set}" = set; then
-  withval="$with_weak_symbols"
-  weak=$withval
-else
-  weak=no
-fi
-
 
 # Check whether --enable-libio or --disable-libio was given.
 if test "${enable_libio+set}" = set; then
@@ -1147,13 +1137,13 @@ else
   # On the NeXT, cc -E runs the code through the compiler's parser,
   # not just through cpp.
   cat > conftest.$ac_ext <<EOF
-#line 1151 "configure"
+#line 1141 "configure"
 #include "confdefs.h"
 #include <assert.h>
 Syntax Error
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1157: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1147: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   :
@@ -1162,13 +1152,13 @@ else
   rm -rf conftest*
   CPP="${CC-cc} -E -traditional-cpp"
   cat > conftest.$ac_ext <<EOF
-#line 1166 "configure"
+#line 1156 "configure"
 #include "confdefs.h"
 #include <assert.h>
 Syntax Error
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1172: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1162: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   :
@@ -1217,7 +1207,7 @@ if eval "test \"`echo '$''{'libc_cv_friendly_stddef'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&4
 else
   cat > conftest.$ac_ext <<EOF
-#line 1221 "configure"
+#line 1211 "configure"
 #include "confdefs.h"
 #define __need_size_t
 #define __need_wchar_t
@@ -1233,7 +1223,7 @@ size_t size; wchar_t wchar;
 if (&size == NULL || &wchar == NULL) abort ();
 ; return 0; }
 EOF
-if { (eval echo configure:1237: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1227: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   libc_cv_friendly_stddef=yes
 else
@@ -1340,7 +1330,7 @@ if eval "test \"`echo '$''{'libc_cv_have_initfini'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&4
 else
   cat > conftest.$ac_ext <<EOF
-#line 1344 "configure"
+#line 1334 "configure"
 #include "confdefs.h"
 
 int main() { return 0; }
@@ -1349,7 +1339,7 @@ asm (".section .init");
 				    asm (".section .fini");
 ; return 0; }
 EOF
-if { (eval echo configure:1353: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1343: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   libc_cv_have_initfini=yes
 else
@@ -1369,6 +1359,108 @@ EOF
   fi
 fi
 
+if test $elf = yes; then
+  libc_cv_asm_underscores=no
+else
+  echo $ac_n "checking for _ prefix on C symbol names""... $ac_c" 1>&4
+if eval "test \"`echo '$''{'libc_cv_asm_underscores'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&4
+else
+  cat > conftest.$ac_ext <<EOF
+#line 1371 "configure"
+#include "confdefs.h"
+asm ("_glibc_foobar:");
+int main() { return 0; }
+int t() {
+glibc_foobar ();
+; return 0; }
+EOF
+if { (eval echo configure:1379: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  libc_cv_asm_underscores=yes
+else
+  rm -rf conftest*
+  libc_cv_asm_underscores=no
+fi
+rm -f conftest*
+
+fi
+
+echo "$ac_t""$libc_cv_asm_underscores" 1>&4
+fi
+if test $libc_cv_asm_underscores = no; then
+  cat >> confdefs.h <<\EOF
+#define NO_UNDERSCORES 1
+EOF
+
+fi
+
+if test $elf = yes; then
+  libc_cv_weak_symbols=yes
+  libc_cv_asm_weak_directive=yes
+  libc_cv_asm_weakext_directive=no
+else
+  echo $ac_n "checking for assembler .weak directive""... $ac_c" 1>&4
+if eval "test \"`echo '$''{'libc_cv_asm_weak_directive'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&4
+else
+  cat > conftest.s <<EOF
+.text
+${libc_cv_asm_global_directive} foo
+foo: .long 0
+.weak foo
+.weak bar; bar = foo
+EOF
+  if ${CC-cc} $CFLAGS -c conftest.s 2>/dev/null; then
+    libc_cv_asm_weak_directive=yes
+  else
+    libc_cv_asm_weak_directive=no
+  fi
+  rm -f conftest*
+fi
+
+echo "$ac_t""$libc_cv_asm_weak_directive" 1>&4
+
+if $libc_cv_asm_weak_directive = no; then
+  echo $ac_n "checking for assembler .weakext directive""... $ac_c" 1>&4
+if eval "test \"`echo '$''{'libc_cv_asm_weakext_directive'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&4
+else
+  cat > conftest.s <<EOF
+.text
+${libc_cv_asm_global_directive} foo
+foo: .long 0
+.weakext foo
+.weak bar, foo
+EOF
+  if ${CC-cc} $CFLAGS -c conftest.s 2>/dev/null; then
+    libc_cv_asm_weakext_directive=yes
+  else
+    libc_cv_asm_weakext_directive=no
+  fi
+  rm -f conftest*
+fi
+
+echo "$ac_t""$libc_cv_asm_weakext_directive" 1>&4
+
+  fi # no .weak
+fi # not ELF
+
+if test $libc_cv_asm_weak_directive; then
+  cat >> confdefs.h <<\EOF
+#define HAVE_ASM_WEAK_DIRECTIVE 1
+EOF
+
+elif test $libc_cv_asm_weakext_directive; then
+  cat >> confdefs.h <<\EOF
+#define HAVE_ASM_WEAKEXT_DIRECTIVE 1
+EOF
+
+fi
+
+### End of automated tests.
+### Now run sysdeps configure fragments.
+
 # sysdeps configure fragments may set these with files to be linked below.
 libc_link_dests=
 libc_link_sources=
@@ -1456,7 +1548,7 @@ default) stdio=stdio ;;
 esac
 echo "$ac_t""$stdio" 1>&4
 
-   
+  
 if test $gnu_ld = yes; then
   cat >> confdefs.h <<\EOF
 #define HAVE_GNU_LD 1
@@ -1475,12 +1567,6 @@ if test $elf = yes; then
 EOF
 
 fi
-if test $weak = yes; then
-  cat >> confdefs.h <<\EOF
-#define HAVE_WEAK_SYMBOLS 1
-EOF
-
-fi
 
 
 if test $shared = default; then
@@ -1573,7 +1659,7 @@ do
     echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion"
     exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;;
   -version | --version | --versio | --versi | --vers | --ver | --ve | --v)
-    echo "$CONFIG_STATUS generated by autoconf version 2.7"
+    echo "$CONFIG_STATUS generated by autoconf version 2.9"
     exit 0 ;;
   -help | --help | --hel | --he | --h)
     echo "\$ac_cs_usage"; exit 0 ;;
@@ -1639,7 +1725,6 @@ s%@stdio@%$stdio%g
 s%@gnu_ld@%$gnu_ld%g
 s%@gnu_as@%$gnu_as%g
 s%@elf@%$elf%g
-s%@weak@%$weak%g
 s%@shared@%$shared%g
 s%@profile@%$profile%g
 s%@omitfp@%$omitfp%g
@@ -1747,7 +1832,7 @@ rm -f conftest.vals
 cat > conftest.hdr <<\EOF
 s/[\\&%]/\\&/g
 s%[\\$`]%\\&%g
-s%#define \([A-Za-z_][A-Za-z0-9_]*\) \(.*\)%${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD}%gp
+s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD}%gp
 s%ac_d%ac_u%gp
 s%ac_u%ac_e%gp
 EOF
diff --git a/configure.in b/configure.in
index 4c9d881100..d124e49964 100644
--- a/configure.in
+++ b/configure.in
@@ -1,6 +1,6 @@
 Dnl Process this file with autoconf to produce a configure script.
 AC_REVISION([$CVSid$])
-AC_PREREQ(2.4.2)dnl		dnl Minimum Autoconf version required.
+AC_PREREQ(2.9)dnl		dnl Minimum Autoconf version required.
 AC_INIT(features.h)
 AC_CONFIG_HEADER(config.h)
 
@@ -49,9 +49,6 @@ test $gnu_binutils = yes && gnu_as=yes gnu_ld=yes
 AC_ARG_WITH(elf, dnl
   --with-elf		  if using the ELF object format,
 	    elf=$withval, elf=no)
-AC_ARG_WITH(weak-symbols, dnl
-  --with-weak-symbols	  if weak symbols are available in as and ld,
-	    weak=$withval, weak=no)
 
 AC_ARG_ENABLE(libio, dnl
 [  --enable-libio          build in GNU libio instead of GNU stdio],
@@ -406,6 +403,69 @@ if test $elf != yes; then
   fi
 fi
 
+if test $elf = yes; then
+  libc_cv_asm_underscores=no
+else
+  AC_CACHE_CHECK(for _ prefix on C symbol names, libc_cv_asm_underscores,
+		 [AC_TRY_COMPILE([asm ("_glibc_foobar:");], [glibc_foobar ();],
+				 libc_cv_asm_underscores=yes,
+				 libc_cv_asm_underscores=no)])
+fi
+if test $libc_cv_asm_underscores = no; then
+  AC_DEFINE(NO_UNDERSCORES)
+fi
+
+if test $elf = yes; then
+  libc_cv_weak_symbols=yes
+  libc_cv_asm_weak_directive=yes
+  libc_cv_asm_weakext_directive=no
+else
+  AC_CACHE_CHECK(for assembler .weak directive, libc_cv_asm_weak_directive,
+		 [dnl
+cat > conftest.s <<EOF
+.text
+${libc_cv_asm_global_directive} foo
+foo: .long 0
+.weak foo
+.weak bar; bar = foo
+EOF
+  if ${CC-cc} $CFLAGS -c conftest.s 2>/dev/null; then
+    libc_cv_asm_weak_directive=yes
+  else
+    libc_cv_asm_weak_directive=no
+  fi
+  rm -f conftest*])
+
+if $libc_cv_asm_weak_directive = no; then
+  AC_CACHE_CHECK(for assembler .weakext directive,
+		 libc_cv_asm_weakext_directive,
+		 [dnl
+cat > conftest.s <<EOF
+.text
+${libc_cv_asm_global_directive} foo
+foo: .long 0
+.weakext foo
+.weak bar, foo
+EOF
+  if ${CC-cc} $CFLAGS -c conftest.s 2>/dev/null; then
+    libc_cv_asm_weakext_directive=yes
+  else
+    libc_cv_asm_weakext_directive=no
+  fi
+  rm -f conftest*])
+
+  fi # no .weak
+fi # not ELF
+
+if test $libc_cv_asm_weak_directive; then
+  AC_DEFINE(HAVE_ASM_WEAK_DIRECTIVE)
+elif test $libc_cv_asm_weakext_directive; then
+  AC_DEFINE(HAVE_ASM_WEAKEXT_DIRECTIVE)
+fi
+
+### End of automated tests.
+### Now run sysdeps configure fragments.
+
 # sysdeps configure fragments may set these with files to be linked below.
 libc_link_dests=
 libc_link_sources=
@@ -498,7 +558,7 @@ default) stdio=stdio ;;
 esac
 AC_MSG_RESULT($stdio)
 
-AC_SUBST(gnu_ld) AC_SUBST(gnu_as) AC_SUBST(elf) AC_SUBST(weak)
+AC_SUBST(gnu_ld) AC_SUBST(gnu_as) AC_SUBST(elf)
 if test $gnu_ld = yes; then
   AC_DEFINE(HAVE_GNU_LD)
 fi
@@ -508,9 +568,6 @@ fi
 if test $elf = yes; then
   AC_DEFINE(HAVE_ELF)
 fi
-if test $weak = yes; then
-  AC_DEFINE(HAVE_WEAK_SYMBOLS)
-fi
 
 AC_SUBST(shared)
 if test $shared = default; then
diff --git a/inet/arpa/inet.h b/inet/arpa/inet.h
index a231484642..2413dcf76e 100644
--- a/inet/arpa/inet.h
+++ b/inet/arpa/inet.h
@@ -39,14 +39,15 @@
 /* External definitions for functions in inet(3) */
 
 #include <sys/cdefs.h>
+#include <sys/types.h>
 
 __BEGIN_DECLS
-unsigned long	 inet_addr __P((const char *));
+u_int32_t	 inet_addr __P((const char *));
 int		 inet_aton __P((const char *, struct in_addr *));
-unsigned long	 inet_lnaof __P((struct in_addr));
-struct in_addr	 inet_makeaddr __P((u_long , u_long));
-unsigned long	 inet_netof __P((struct in_addr));
-unsigned long	 inet_network __P((const char *));
+u_int32_t	 inet_lnaof __P((struct in_addr));
+struct in_addr	 inet_makeaddr __P((u_int32_t , u_int32_t));
+u_int32_t	 inet_netof __P((struct in_addr));
+u_int32_t	 inet_network __P((const char *));
 char		*inet_ntoa __P((struct in_addr));
 __END_DECLS
 
diff --git a/inet/inet_lnaof.c b/inet/inet_lnaof.c
index 406be30034..cd5ef29c5d 100644
--- a/inet/inet_lnaof.c
+++ b/inet/inet_lnaof.c
@@ -44,11 +44,11 @@ static char sccsid[] = "@(#)inet_lnaof.c	8.1 (Berkeley) 6/4/93";
  * internet address; handles class a/b/c network
  * number formats.
  */
-u_long
+u_int32_t
 inet_lnaof(in)
 	struct in_addr in;
 {
-	register u_long i = ntohl(in.s_addr);
+	register u_int32_t i = ntohl(in.s_addr);
 
 	if (IN_CLASSA(i))
 		return ((i)&IN_CLASSA_HOST);
diff --git a/inet/inet_mkadr.c b/inet/inet_mkadr.c
index 7976188ea5..7f260744e9 100644
--- a/inet/inet_mkadr.c
+++ b/inet/inet_mkadr.c
@@ -45,9 +45,9 @@ static char sccsid[] = "@(#)inet_makeaddr.c	8.1 (Berkeley) 6/4/93";
  */
 struct in_addr
 inet_makeaddr(net, host)
-	u_long net, host;
+	u_int32_t net, host;
 {
-	u_long addr;
+	u_int32_t addr;
 
 	if (net < 128)
 		addr = (net << IN_CLASSA_NSHIFT) | (host & IN_CLASSA_HOST);
diff --git a/inet/inet_net.c b/inet/inet_net.c
index fda53b6ecc..cfaadd7949 100644
--- a/inet/inet_net.c
+++ b/inet/inet_net.c
@@ -45,13 +45,13 @@ static char sccsid[] = "@(#)inet_network.c	8.1 (Berkeley) 6/4/93";
  * The library routines call this routine to interpret
  * network numbers.
  */
-u_long
+u_int32_t
 inet_network(cp)
 	register const char *cp;
 {
-	register u_long val, base, n;
+	register u_int32_t val, base, n;
 	register char c;
-	u_long parts[4], *pp = parts;
+	u_int32_t parts[4], *pp = parts;
 	register int i;
 
 again:
diff --git a/inet/inet_netof.c b/inet/inet_netof.c
index d6de694243..40cbc0ea97 100644
--- a/inet/inet_netof.c
+++ b/inet/inet_netof.c
@@ -43,11 +43,11 @@ static char sccsid[] = "@(#)inet_netof.c	8.1 (Berkeley) 6/4/93";
  * Return the network number from an internet
  * address; handles class a/b/c network #'s.
  */
-u_long
+u_int32_t
 inet_netof(in)
 	struct in_addr in;
 {
-	register u_long i = ntohl(in.s_addr);
+	register u_int32_t i = ntohl(in.s_addr);
 
 	if (IN_CLASSA(i))
 		return (((i)&IN_CLASSA_NET) >> IN_CLASSA_NSHIFT);
diff --git a/inet/netinet/in.h b/inet/netinet/in.h
index 609edf8184..a135cf25b2 100644
--- a/inet/netinet/in.h
+++ b/inet/netinet/in.h
@@ -89,7 +89,7 @@ enum
 /* Internet address.  */
 struct in_addr
   {
-    unsigned long int s_addr;
+    unsigned int s_addr;
   };
 
 
@@ -98,33 +98,33 @@ struct in_addr
    On subnets, host and network parts are found according to
    the subnet mask, not these masks.  */
 
-#define	IN_CLASSA(a)		((((long int) (a)) & 0x80000000) == 0)
+#define	IN_CLASSA(a)		((((unsigned) (a)) & 0x80000000) == 0)
 #define	IN_CLASSA_NET		0xff000000
 #define	IN_CLASSA_NSHIFT	24
 #define	IN_CLASSA_HOST		(0xffffffff & ~IN_CLASSA_NET)
 #define	IN_CLASSA_MAX		128
 
-#define	IN_CLASSB(a)		((((long int) (a)) & 0xc0000000) == 0x80000000)
+#define	IN_CLASSB(a)		((((unsigned) (a)) & 0xc0000000) == 0x80000000)
 #define	IN_CLASSB_NET		0xffff0000
 #define	IN_CLASSB_NSHIFT	16
 #define	IN_CLASSB_HOST		(0xffffffff & ~IN_CLASSB_NET)
 #define	IN_CLASSB_MAX		65536
 
-#define	IN_CLASSC(a)		((((long int) (a)) & 0xc0000000) == 0xc0000000)
+#define	IN_CLASSC(a)		((((unsigned) (a)) & 0xc0000000) == 0xc0000000)
 #define	IN_CLASSC_NET		0xffffff00
 #define	IN_CLASSC_NSHIFT	8
 #define	IN_CLASSC_HOST		(0xffffffff & ~IN_CLASSC_NET)
 
-#define	IN_CLASSD(a)		((((long int) (a)) & 0xf0000000) == 0xe0000000)
+#define	IN_CLASSD(a)		((((unsigned) (a)) & 0xf0000000) == 0xe0000000)
 #define	IN_MULTICAST(a)		IN_CLASSD(a)
 
-#define	IN_EXPERIMENTAL(a)	((((long int) (a)) & 0xe0000000) == 0xe0000000)
-#define	IN_BADCLASS(a)		((((long int) (a)) & 0xf0000000) == 0xf0000000)
+#define	IN_EXPERIMENTAL(a)	((((unsigned) (a)) & 0xe0000000) == 0xe0000000)
+#define	IN_BADCLASS(a)		((((unsigned) (a)) & 0xf0000000) == 0xf0000000)
 
 /* Address to accept any incoming messages.  */
-#define	INADDR_ANY		((unsigned long int) 0x00000000)
+#define	INADDR_ANY		((unsigned) 0x00000000)
 /* Address to send to all hosts.  */
-#define	INADDR_BROADCAST	((unsigned long int) 0xffffffff)
+#define	INADDR_BROADCAST	((unsigned) 0xffffffff)
 /* Address indicating an error return.  */
 #define	INADDR_NONE		0xffffffff
 
diff --git a/inet/netinet/tcp.h b/inet/netinet/tcp.h
index 6b77ff663a..bc821e173e 100644
--- a/inet/netinet/tcp.h
+++ b/inet/netinet/tcp.h
@@ -33,7 +33,7 @@
  *	@(#)tcp.h	8.1 (Berkeley) 6/10/93
  */
 
-typedef	u_long	tcp_seq;
+typedef	unsigned int	tcp_seq;
 /*
  * TCP header.
  * Per RFC 793, September, 1981.
diff --git a/inet/protocols/rwhod.h b/inet/protocols/rwhod.h
index 93008a4181..4ce44906a0 100644
--- a/inet/protocols/rwhod.h
+++ b/inet/protocols/rwhod.h
@@ -36,13 +36,15 @@
 #ifndef _RWHOD_H_
 #define	_RWHOD_H_
 
+#include <sys/types.h>
+
 /*
  * rwho protocol packet format.
  */
 struct	outmp {
 	char	out_line[8];		/* tty name */
 	char	out_name[8];		/* user id */
-	long	out_time;		/* time on */
+	int32_t	out_time;		/* time on */
 };
 
 struct	whod {
diff --git a/inet/protocols/talkd.h b/inet/protocols/talkd.h
index 0d30d5bfa3..c523bf590d 100644
--- a/inet/protocols/talkd.h
+++ b/inet/protocols/talkd.h
@@ -54,6 +54,8 @@
  * stream connection through which the conversation takes place.
  */
 
+#include <sys/types.h>
+
 /*
  * Client->server request message format.
  */
@@ -62,10 +64,10 @@ typedef struct {
 	u_char	type;		/* request type, see below */
 	u_char	answer;		/* not used */
 	u_char	pad;
-	u_long	id_num;		/* message id */
+	u_int32_t id_num;	/* message id */
 	struct	osockaddr addr;		/* old (4.3) style */
 	struct	osockaddr ctl_addr;	/* old (4.3) style */
-	long	pid;		/* caller's process id */
+	int32_t	pid;		/* caller's process id */
 #define	NAME_SIZE	12
 	char	l_name[NAME_SIZE];/* caller's name */
 	char	r_name[NAME_SIZE];/* callee's name */
@@ -81,7 +83,7 @@ typedef struct {
 	u_char	type;		/* type of request message, see below */
 	u_char	answer;		/* respose to request message, see below */
 	u_char	pad;
-	u_long	id_num;		/* message id */
+	u_int32_t id_num;	/* message id */
 	struct	osockaddr addr;	/* address for establishing conversation */
 } CTL_RESPONSE;
 
diff --git a/inet/rcmd.c b/inet/rcmd.c
index ae6e0b65c7..7a29db2155 100644
--- a/inet/rcmd.c
+++ b/inet/rcmd.c
@@ -52,8 +52,8 @@ static char sccsid[] = "@(#)rcmd.c	8.3 (Berkeley) 3/26/94";
 #include <ctype.h>
 #include <string.h>
 
-int	__ivaliduser __P((FILE *, u_long, const char *, const char *));
-static int __icheckhost __P((u_long, char *));
+int	__ivaliduser __P((FILE *, u_int32_t, const char *, const char *));
+static int __icheckhost __P((u_int32_t, char *));
 
 int
 rcmd(ahost, rport, locuser, remuser, cmd, fd2p)
@@ -65,7 +65,7 @@ rcmd(ahost, rport, locuser, remuser, cmd, fd2p)
 	struct hostent *hp;
 	struct sockaddr_in sin, from;
 	fd_set reads;
-	long oldmask;
+	int32_t oldmask;
 	pid_t pid;
 	int s, lport, timo;
 	char c;
@@ -242,7 +242,7 @@ ruserok(rhost, superuser, ruser, luser)
 	int superuser;
 {
 	struct hostent *hp;
-	u_long addr;
+	u_int32_t addr;
 	char **ap;
 
 	if ((hp = gethostbyname(rhost)) == NULL)
@@ -266,7 +266,7 @@ ruserok(rhost, superuser, ruser, luser)
  */
 int
 iruserok(raddr, superuser, ruser, luser)
-	u_long raddr;
+	u_int32_t raddr;
 	int superuser;
 	const char *ruser, *luser;
 {
@@ -347,7 +347,7 @@ again:
 int
 __ivaliduser(hostf, raddr, luser, ruser)
 	FILE *hostf;
-	u_long raddr;
+	u_int32_t raddr;
 	const char *luser, *ruser;
 {
 	register char *user, *p;
@@ -389,15 +389,15 @@ __ivaliduser(hostf, raddr, luser, ruser)
  */
 static int
 __icheckhost(raddr, lhost)
-	u_long raddr;
+	u_int32_t raddr;
 	register char *lhost;
 {
 	register struct hostent *hp;
-	register u_long laddr;
+	register u_int32_t laddr;
 	register char **pp;
 
 	/* Try for raw ip address first. */
-	if (isdigit(*lhost) && (long)(laddr = inet_addr(lhost)) != -1)
+	if (isdigit(*lhost) && (int32_t)(laddr = inet_addr(lhost)) != -1)
 		return (raddr == laddr);
 
 	/* Better be a hostname. */
@@ -406,7 +406,7 @@ __icheckhost(raddr, lhost)
 
 	/* Spin through ip addresses. */
 	for (pp = hp->h_addr_list; *pp; ++pp)
-		if (!bcmp(&raddr, *pp, sizeof(u_long)))
+		if (!bcmp(&raddr, *pp, sizeof(u_int32_t)))
 			return (1);
 
 	/* No match. */
diff --git a/libc-symbols.h b/libc-symbols.h
index bb5f54e16c..f7231f9c7c 100644
--- a/libc-symbols.h
+++ b/libc-symbols.h
@@ -27,14 +27,13 @@ Cambridge, MA 02139, USA.  */
    We include config.h which is generated by configure.
    It should define for us the following symbols:
 
+   * HAVE_ASM_SET_DIRECTIVE if we have `.set B, A' instead of `A = B'.
+   * ASM_GLOBAL_DIRECTIVE with `.globl' or `.global'.
    * HAVE_GNU_LD if using GNU ld, with support for weak symbols in a.out,
    and for symbol set and warning messages extensions in a.out and ELF.
-   This implies HAVE_WEAK_SYMBOLS; set by --with-gnu-ld.
-   * HAVE_ELF if using ELF, which supports weak symbols.
-   This implies HAVE_WEAK_SYMBOLS; set by --with-elf.
-
-   * HAVE_WEAK_SYMBOLS if weak symbols are available in the assembler and
-   linker being used.  Set by --with-weak-symbols.
+   * HAVE_ELF if using ELF, which supports weak symbols using `.weak'.
+   * HAVE_ASM_WEAK_DIRECTIVE if we have weak symbols using `.weak'.
+   * HAVE_ASM_WEAKEXT_DIRECTIVE if we have weak symbols using `.weakext'.
 
    */
 
@@ -79,23 +78,14 @@ extern const char _libc_intl_domainname[];
 /*
 
 */
-/* The symbols in all the user (non-_) macros are C symbols.  Predefined
-   should be HAVE_WEAK_SYMBOLS and/or HAVE_ELF and/or HAVE_GNU_LD.
-   HAVE_WEAK_SYMBOLS is implied by the other two.  HAVE_GNU_LD without
-   HAVE_ELF implies a.out.  */
+/* The symbols in all the user (non-_) macros are C symbols.
+   HAVE_GNU_LD without HAVE_ELF implies a.out.  */
 
-#ifndef HAVE_WEAK_SYMBOLS
-#if defined (HAVE_ELF) || defined (HAVE_GNU_LD)
+#if defined (HAVE_ASM_WEAK_DIRECTIVE) || defined (HAVE_ASM_WEAKEXT_DIRECTIVE)
 #define HAVE_WEAK_SYMBOLS
 #endif
-#endif
 
 #ifndef __SYMBOL_PREFIX
-#ifdef HAVE_ELF
-#define NO_UNDERSCORES
-#else
-#include <sysdep.h>		/* Should define NO_UNDERSCORES.  */
-#endif
 #ifdef NO_UNDERSCORES
 #define __SYMBOL_PREFIX
 #else
@@ -143,8 +133,21 @@ extern const char _libc_intl_domainname[];
 
 
 #ifdef HAVE_WEAK_SYMBOLS
+
 #ifdef ASSEMBLER
 
+#ifdef HAVE_ASM_WEAKEXT_DIRECTIVE
+
+/* Define ALIAS as a weak alias for ORIGINAL.
+   If weak aliases are not available, this defines a strong alias.  */
+#define weak_alias(original, alias)	\
+  .weakext C_SYMBOL_NAME (alias), C_SYMBOL_NAME (original)
+
+/* Declare SYMBOL to be weak.  */
+#define weak_symbol(symbol)	.weakext C_SYMBOL_NAME (symbol)
+
+#else /* ! HAVE_ASM_WEAKEXT_DIRECTIVE */
+
 /* Define ALIAS as a weak alias for ORIGINAL.
    If weak aliases are not available, this defines a strong alias.  */
 #define weak_alias(original, alias)	\
@@ -154,12 +157,21 @@ extern const char _libc_intl_domainname[];
 /* Declare SYMBOL to be weak.  */
 #define weak_symbol(symbol)	.weak C_SYMBOL_NAME (symbol)
 
-#else
+#endif /* ! HAVE_ASM_WEAKEXT_DIRECTIVE */
+
+#else /* ! ASSEMBLER */
+
+#ifdef HAVE_ASM_WEAKEXT_DIRECTIVE
+#define weak_symbol(symbol)	asm (".weakext " __SYMBOL_PREFIX #symbol);
+#define weak_alias(original, alias) \
+  asm (".weakext " __SYMBOL_PREFIX #alias ", " __SYMBOL_PREFIX #original);
+#else /* ! HAVE_ASM_WEAKEXT_DIRECTIVE */
 #define weak_symbol(symbol)	asm (".weak " __SYMBOL_PREFIX #symbol);
 #define weak_alias(original, alias) \
   asm (".weak " __SYMBOL_PREFIX #alias "\n" \
        __SYMBOL_PREFIX #alias " = " __SYMBOL_PREFIX #original);
-#endif
+#endif /* ! HAVE_ASM_WEAKEXT_DIRECTIVE */
+#endif /* ! ASSEMBLER */
 #else
 #define	weak_alias(original, alias) strong_alias(original, alias)
 #define weak_symbol(symbol)	/* Do nothing.  */
diff --git a/resolv/inet_addr.c b/resolv/inet_addr.c
index 01a38e6a00..bcf7f0d336 100644
--- a/resolv/inet_addr.c
+++ b/resolv/inet_addr.c
@@ -70,7 +70,7 @@ static char rcsid[] = "$Id$";
  * Ascii internet address interpretation routine.
  * The value returned is in network order.
  */
-u_long
+u_int32_t
 inet_addr(cp)
 	register const char *cp;
 {
@@ -93,7 +93,7 @@ inet_aton(cp, addr)
 	register const char *cp;
 	struct in_addr *addr;
 {
-	register u_long val;
+	register u_int32_t val;
 	register int base, n;
 	register char c;
 	u_int parts[4];
diff --git a/sunrpc/rpc/auth.h b/sunrpc/rpc/auth.h
index cb19555472..5f7c7f88b1 100644
--- a/sunrpc/rpc/auth.h
+++ b/sunrpc/rpc/auth.h
@@ -62,14 +62,10 @@ enum auth_stat {
 	AUTH_FAILED=7			/* some unknown reason */
 };
 
-#if 1 /* (mc68000 || sparc || vax || i386) --roland@gnu */
-typedef u_long u_int32;	/* 32-bit unsigned integers */
-#endif
-
 union des_block {
 	struct {
-		u_int32 high;
-		u_int32 low;
+		u_int32_t high;
+		u_int32_t low;
 	} key;
 	char c[8];
 };
diff --git a/sunrpc/svc_authux.c b/sunrpc/svc_authux.c
index ea00b7895f..1b766d49f6 100644
--- a/sunrpc/svc_authux.c
+++ b/sunrpc/svc_authux.c
@@ -83,7 +83,7 @@ _svcauth_unix(rqst, msg)
 		bcopy((caddr_t)buf, aup->aup_machname, (u_int)str_len);
 		aup->aup_machname[str_len] = 0;
 		str_len = RNDUP(str_len);
-		buf += str_len / sizeof (long);
+		buf = (u_long *) ((char *) buf + str_len);
 		aup->aup_uid = IXDR_GET_LONG(buf);
 		aup->aup_gid = IXDR_GET_LONG(buf);
 		gid_len = IXDR_GET_U_LONG(buf);
diff --git a/sunrpc/xdr_rec.c b/sunrpc/xdr_rec.c
index 4d0d4ecfb3..45435951d0 100644
--- a/sunrpc/xdr_rec.c
+++ b/sunrpc/xdr_rec.c
@@ -42,7 +42,7 @@ static char sccsid[] = "@(#)xdr_rec.c 1.21 87/08/11 Copyr 1984 Sun Micro";
  * and the tcp transport level.  A record is composed on one or more
  * record fragments.  A record fragment is a thirty-two bit header followed
  * by n bytes of data, where n is contained in the header.  The header
- * is represented as a htonl(u_long).  Thegh order bit encodes
+ * is represented as a htonl(u_long).  The high order bit encodes
  * whether or not the fragment is the last fragment of the record
  * (1 => fragment is last, 0 => more fragments to follow. 
  * The other 31 bits encode the byte length of the fragment.
@@ -90,7 +90,7 @@ static struct  xdr_ops xdrrec_ops = {
  * meet the needs of xdr and rpc based on tcp.
  */
 
-#define LAST_FRAG ((u_long)(1 << 31))
+#define LAST_FRAG (1UL << 31)
 
 typedef struct rec_strm {
 	caddr_t tcp_handle;
@@ -102,7 +102,7 @@ typedef struct rec_strm {
 	caddr_t out_base;	/* output buffer (points to frag header) */
 	caddr_t out_finger;	/* next output position */
 	caddr_t out_boundry;	/* data cannot up to this address */
-	u_long *frag_header;	/* beginning of curren fragment */
+	u_int32_t *frag_header;	/* beginning of curren fragment */
 	bool_t frag_sent;	/* true if buffer sent in middle of record */
 	/*
 	 * in-coming bits
@@ -171,8 +171,8 @@ xdrrec_create(xdrs, sendsize, recvsize, tcp_handle, readit, writeit)
 	rstrm->readit = readit;
 	rstrm->writeit = writeit;
 	rstrm->out_finger = rstrm->out_boundry = rstrm->out_base;
-	rstrm->frag_header = (u_long *)rstrm->out_base;
-	rstrm->out_finger += sizeof(u_long);
+	rstrm->frag_header = (u_int32_t *)rstrm->out_base;
+	rstrm->out_finger += 4;
 	rstrm->out_boundry += sendsize;
 	rstrm->frag_sent = FALSE;
 	rstrm->in_size = recvsize;
@@ -193,22 +193,24 @@ xdrrec_getlong(xdrs, lp)
 	XDR *xdrs;
 	long *lp;
 {
-	register RECSTREAM *rstrm = (RECSTREAM *)(xdrs->x_private);
-	register long *buflp = (long *)(rstrm->in_finger);
-	long mylong;
+	register RECSTREAM *rstrm = (RECSTREAM *) xdrs->x_private;
+	register int32_t *buflp = (int32_t *) rstrm->in_finger;
+	int32_t mylong;
 
 	/* first try the inline, fast case */
-	if ((rstrm->fbtbc >= sizeof(long)) &&
-		(((int)rstrm->in_boundry - (int)buflp) >= sizeof(long))) {
-		*lp = (long)ntohl((u_long)(*buflp));
-		rstrm->fbtbc -= sizeof(long);
-		rstrm->in_finger += sizeof(long);
+	if (rstrm->fbtbc >= BYTES_PER_XDR_UNIT &&
+	    rstrm->in_boundry - (char *) buflp >= BYTES_PER_XDR_UNIT)
+	{
+		*lp = ntohl(*buflp);
+		rstrm->fbtbc -= BYTES_PER_XDR_UNIT;
+		rstrm->in_finger += BYTES_PER_XDR_UNIT;
 	} else {
-		if (! xdrrec_getbytes(xdrs, (caddr_t)&mylong, sizeof(long)))
-			return (FALSE);
-		*lp = (long)ntohl((u_long)mylong);
+		if (! xdrrec_getbytes(xdrs, (caddr_t) &mylong,
+				      BYTES_PER_XDR_UNIT))
+			return FALSE;
+		*lp = ntohl(mylong);
 	}
-	return (TRUE);
+	return TRUE;
 }
 
 static bool_t
@@ -216,23 +218,23 @@ xdrrec_putlong(xdrs, lp)
 	XDR *xdrs;
 	long *lp;
 {
-	register RECSTREAM *rstrm = (RECSTREAM *)(xdrs->x_private);
-	register long *dest_lp = ((long *)(rstrm->out_finger));
+	register RECSTREAM *rstrm = (RECSTREAM *) xdrs->x_private;
+	register int32_t *dest_lp = (int32_t *) rstrm->out_finger;
 
-	if ((rstrm->out_finger += sizeof(long)) > rstrm->out_boundry) {
+	if ((rstrm->out_finger += BYTES_PER_XDR_UNIT) > rstrm->out_boundry) {
 		/*
 		 * this case should almost never happen so the code is
 		 * inefficient
 		 */
-		rstrm->out_finger -= sizeof(long);
+		rstrm->out_finger -= BYTES_PER_XDR_UNIT;
 		rstrm->frag_sent = TRUE;
 		if (! flush_out(rstrm, FALSE))
-			return (FALSE);
-		dest_lp = ((long *)(rstrm->out_finger));
-		rstrm->out_finger += sizeof(long);
+			return FALSE;
+		dest_lp = (int32_t *) rstrm->out_finger;
+		rstrm->out_finger += BYTES_PER_XDR_UNIT;
 	}
-	*dest_lp = (long)htonl((u_long)(*lp));
-	return (TRUE);
+	*dest_lp = htonl(*lp);
+	return TRUE;
 }
 
 static bool_t  /* must manage buffers, fragments, and records */
@@ -241,26 +243,26 @@ xdrrec_getbytes(xdrs, addr, len)
 	register caddr_t addr;
 	register u_int len;
 {
-	register RECSTREAM *rstrm = (RECSTREAM *)(xdrs->x_private);
+	register RECSTREAM *rstrm = (RECSTREAM *) xdrs->x_private;
 	register int current;
 
 	while (len > 0) {
 		current = rstrm->fbtbc;
 		if (current == 0) {
 			if (rstrm->last_frag)
-				return (FALSE);
+				return FALSE;
 			if (! set_input_fragment(rstrm))
-				return (FALSE);
+				return FALSE;
 			continue;
 		}
 		current = (len < current) ? len : current;
 		if (! get_input_bytes(rstrm, addr, current))
-			return (FALSE);
+			return FALSE;
 		addr += current; 
 		rstrm->fbtbc -= current;
 		len -= current;
 	}
-	return (TRUE);
+	return TRUE;
 }
 
 static bool_t
@@ -269,11 +271,11 @@ xdrrec_putbytes(xdrs, addr, len)
 	register caddr_t addr;
 	register u_int len;
 {
-	register RECSTREAM *rstrm = (RECSTREAM *)(xdrs->x_private);
+	register RECSTREAM *rstrm = (RECSTREAM *) xdrs->x_private;
 	register int current;
 
 	while (len > 0) {
-		current = (u_int)rstrm->out_boundry - (u_int)rstrm->out_finger;
+		current = rstrm->out_boundry - rstrm->out_finger;
 		current = (len < current) ? len : current;
 		bcopy(addr, rstrm->out_finger, current);
 		rstrm->out_finger += current;
@@ -282,10 +284,10 @@ xdrrec_putbytes(xdrs, addr, len)
 		if (rstrm->out_finger == rstrm->out_boundry) {
 			rstrm->frag_sent = TRUE;
 			if (! flush_out(rstrm, FALSE))
-				return (FALSE);
+				return FALSE;
 		}
 	}
-	return (TRUE);
+	return TRUE;
 }
 
 static u_int
@@ -319,7 +321,7 @@ xdrrec_setpos(xdrs, pos)
 	register XDR *xdrs;
 	u_int pos;
 {
-	register RECSTREAM *rstrm = (RECSTREAM *)xdrs->x_private;
+	register RECSTREAM *rstrm = (RECSTREAM *) xdrs->x_private;
 	u_int currpos = xdrrec_getpos(xdrs);
 	int delta = currpos - pos;
 	caddr_t newpos;
@@ -329,10 +331,11 @@ xdrrec_setpos(xdrs, pos)
 
 		case XDR_ENCODE:
 			newpos = rstrm->out_finger - delta;
-			if ((newpos > (caddr_t)(rstrm->frag_header)) &&
-				(newpos < rstrm->out_boundry)) {
+			if (newpos > (caddr_t) rstrm->frag_header &&
+			    newpos < rstrm->out_boundry)
+			{
 				rstrm->out_finger = newpos;
-				return (TRUE);
+				return TRUE;
 			}
 			break;
 
@@ -343,11 +346,11 @@ xdrrec_setpos(xdrs, pos)
 				(newpos >= rstrm->in_base)) {
 				rstrm->in_finger = newpos;
 				rstrm->fbtbc -= delta;
-				return (TRUE);
+				return TRUE;
 			}
 			break;
 		}
-	return (FALSE);
+	return FALSE;
 }
 
 static long *
@@ -355,7 +358,7 @@ xdrrec_inline(xdrs, len)
 	register XDR *xdrs;
 	int len;
 {
-	register RECSTREAM *rstrm = (RECSTREAM *)xdrs->x_private;
+	register RECSTREAM *rstrm = (RECSTREAM *) xdrs->x_private;
 	long * buf = NULL;
 
 	switch (xdrs->x_op) {
@@ -376,7 +379,7 @@ xdrrec_inline(xdrs, len)
 		}
 		break;
 	}
-	return (buf);
+	return buf;
 }
 
 static void
@@ -403,17 +406,17 @@ bool_t
 xdrrec_skiprecord(xdrs)
 	XDR *xdrs;
 {
-	register RECSTREAM *rstrm = (RECSTREAM *)(xdrs->x_private);
+	register RECSTREAM *rstrm = (RECSTREAM *) xdrs->x_private;
 
 	while (rstrm->fbtbc > 0 || (! rstrm->last_frag)) {
 		if (! skip_input_bytes(rstrm, rstrm->fbtbc))
-			return (FALSE);
+			return FALSE;
 		rstrm->fbtbc = 0;
 		if ((! rstrm->last_frag) && (! set_input_fragment(rstrm)))
-			return (FALSE);
+			return FALSE;
 	}
 	rstrm->last_frag = FALSE;
-	return (TRUE);
+	return TRUE;
 }
 
 /*
@@ -425,18 +428,18 @@ bool_t
 xdrrec_eof(xdrs)
 	XDR *xdrs;
 {
-	register RECSTREAM *rstrm = (RECSTREAM *)(xdrs->x_private);
+	register RECSTREAM *rstrm = (RECSTREAM *) xdrs->x_private;
 
 	while (rstrm->fbtbc > 0 || (! rstrm->last_frag)) {
 		if (! skip_input_bytes(rstrm, rstrm->fbtbc))
-			return (TRUE);
+			return TRUE;
 		rstrm->fbtbc = 0;
 		if ((! rstrm->last_frag) && (! set_input_fragment(rstrm)))
-			return (TRUE);
+			return TRUE;
 	}
 	if (rstrm->in_finger == rstrm->in_boundry)
-		return (TRUE);
-	return (FALSE);
+		return TRUE;
+	return FALSE;
 }
 
 /*
@@ -450,21 +453,21 @@ xdrrec_endofrecord(xdrs, sendnow)
 	XDR *xdrs;
 	bool_t sendnow;
 {
-	register RECSTREAM *rstrm = (RECSTREAM *)(xdrs->x_private);
+	register RECSTREAM *rstrm = (RECSTREAM *) xdrs->x_private;
 	register u_long len;  /* fragment length */
 
-	if (sendnow || rstrm->frag_sent ||
-		((u_long)rstrm->out_finger + sizeof(u_long) >=
-		(u_long)rstrm->out_boundry)) {
+	if (sendnow || rstrm->frag_sent
+	    || rstrm->out_finger + BYTES_PER_XDR_UNIT >= rstrm->out_boundry)
+	{
 		rstrm->frag_sent = FALSE;
-		return (flush_out(rstrm, TRUE));
+		return flush_out(rstrm, TRUE);
 	}
-	len = (u_long)(rstrm->out_finger) - (u_long)(rstrm->frag_header) -
-	   sizeof(u_long);
-	*(rstrm->frag_header) = htonl((u_long)len | LAST_FRAG);
-	rstrm->frag_header = (u_long *)rstrm->out_finger;
-	rstrm->out_finger += sizeof(u_long);
-	return (TRUE);
+	len = (rstrm->out_finger - (char *) rstrm->frag_header
+	       - BYTES_PER_XDR_UNIT);
+	*rstrm->frag_header = htonl((u_long)len | LAST_FRAG);
+	rstrm->frag_header = (u_int32_t *) rstrm->out_finger;
+	rstrm->out_finger += BYTES_PER_XDR_UNIT;
+	return TRUE;
 }
 
 
@@ -477,17 +480,18 @@ flush_out(rstrm, eor)
 	bool_t eor;
 {
 	register u_long eormask = (eor == TRUE) ? LAST_FRAG : 0;
-	register u_long len = (u_long)(rstrm->out_finger) - 
-		(u_long)(rstrm->frag_header) - sizeof(u_long);
+	register u_long len = (rstrm->out_finger
+			       - (char *) rstrm->frag_header
+			       - BYTES_PER_XDR_UNIT);
 
-	*(rstrm->frag_header) = htonl(len | eormask);
-	len = (u_long)(rstrm->out_finger) - (u_long)(rstrm->out_base);
+	*rstrm->frag_header = htonl(len | eormask);
+	len = rstrm->out_finger - rstrm->out_base;
 	if ((*(rstrm->writeit))(rstrm->tcp_handle, rstrm->out_base, (int)len)
 		!= (int)len)
-		return (FALSE);
-	rstrm->frag_header = (u_long *)rstrm->out_base;
-	rstrm->out_finger = (caddr_t)rstrm->out_base + sizeof(u_long);
-	return (TRUE);
+		return FALSE;
+	rstrm->frag_header = (u_int32_t *) rstrm->out_base;
+	rstrm->out_finger = (caddr_t) rstrm->out_base + BYTES_PER_XDR_UNIT;
+	return TRUE;
 }
 
 static bool_t  /* knows nothing about records!  Only about input buffers */
@@ -503,11 +507,11 @@ fill_input_buf(rstrm)
 	where += i;
 	len = rstrm->in_size - i;
 	if ((len = (*(rstrm->readit))(rstrm->tcp_handle, where, len)) == -1)
-		return (FALSE);
+		return FALSE;
 	rstrm->in_finger = where;
 	where += len;
 	rstrm->in_boundry = where;
-	return (TRUE);
+	return TRUE;
 }
 
 static bool_t  /* knows nothing about records!  Only about input buffers */
@@ -519,10 +523,10 @@ get_input_bytes(rstrm, addr, len)
 	register int current;
 
 	while (len > 0) {
-		current = (int)rstrm->in_boundry - (int)rstrm->in_finger;
+		current = rstrm->in_boundry - rstrm->in_finger;
 		if (current == 0) {
 			if (! fill_input_buf(rstrm))
-				return (FALSE);
+				return FALSE;
 			continue;
 		}
 		current = (len < current) ? len : current;
@@ -531,7 +535,7 @@ get_input_bytes(rstrm, addr, len)
 		addr += current;
 		len -= current;
 	}
-	return (TRUE);
+	return TRUE;
 }
 
 static bool_t  /* next two bytes of the input stream are treated as a header */
@@ -540,12 +544,12 @@ set_input_fragment(rstrm)
 {
 	u_long header;
 
-	if (! get_input_bytes(rstrm, (caddr_t)&header, sizeof(header)))
-		return (FALSE);
-	header = (long)ntohl(header);
+	if (! get_input_bytes(rstrm, (caddr_t)&header, BYTES_PER_XDR_UNIT))
+		return FALSE;
+	header = ntohl(header);
 	rstrm->last_frag = ((header & LAST_FRAG) == 0) ? FALSE : TRUE;
-	rstrm->fbtbc = header & (~LAST_FRAG);
-	return (TRUE);
+	rstrm->fbtbc = header & ~LAST_FRAG;
+	return TRUE;
 }
 
 static bool_t  /* consumes input bytes; knows nothing about records! */
@@ -556,17 +560,17 @@ skip_input_bytes(rstrm, cnt)
 	register int current;
 
 	while (cnt > 0) {
-		current = (int)rstrm->in_boundry - (int)rstrm->in_finger;
+		current = rstrm->in_boundry - rstrm->in_finger;
 		if (current == 0) {
 			if (! fill_input_buf(rstrm))
-				return (FALSE);
+				return FALSE;
 			continue;
 		}
 		current = (cnt < current) ? cnt : current;
 		rstrm->in_finger += current;
 		cnt -= current;
 	}
-	return (TRUE);
+	return TRUE;
 }
 
 static u_int
@@ -576,5 +580,5 @@ fix_buf_size(s)
 
 	if (s < 100)
 		s = 4000;
-	return (RNDUP(s));
+	return RNDUP(s);
 }