🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.utils.bug
Article #1083

removing USG tests from diff

#1083
From: david d `zoo' zuhn
Date: Wed, 11 Nov 1992 07:22
221 lines
6880 bytes
In a never ending crusade for cleaner code, I have removed all tests for
USG from the code for GNU diff 2.0.  This is done since unequivocably
testing for USG isn't really possible, and generally not the right thing to
do anyway.  But you already knew that....

Unidiffs to diff 2.0 follow....

  david d 'zoo' zuhn |    There is great disorder under the heavens,
    cygnus support   |         and the situation is excellent.
    zoo@cygnus.com   |    




---------- slice 'n' dice --------------------------------- file: diff-usg-pxs
diff -ru2 diff-2.0/ChangeLog diff-2.0-zoo/ChangeLog
--- diff-2.0/ChangeLog	Tue Sep 15 11:27:28 1992
+++ diff-2.0-zoo/ChangeLog	Tue Nov 10 21:11:56 1992
@@ -1,2 +1,10 @@
+Tue Nov 10 20:57:18 1992  david d `zoo' zuhn  (zoo at cirdan.cygnus.com)
+
+	* regex.c: change #ifdef USG to #ifdef HAVE_STRING_H
+
+	* system.h: get rid of tests for USG, change to the correct feature test
+
+	* configure.in: check for some header files (string.h, time.h, sys/wait.h)
+
 Tue Sep 15 14:27:25 1992  David J. MacKenzie  (djm@nutrimat.gnu.ai.mit.edu)
 
diff -ru2 diff-2.0/configure diff-2.0-zoo/configure
--- diff-2.0/configure	Mon Sep 14 18:23:42 1992
+++ diff-2.0-zoo/configure	Tue Nov 10 21:12:07 1992
@@ -81,5 +81,5 @@
   # Try the directory containing this script, then `..'.
   prog=$0
-  confdir=`echo $prog|sed 's,/[^/][^/]*$,,'`
+  confdir=`echo $prog|sed 's%/[^/][^/]*$%%'`
   test "X$confdir" = "X$prog" && confdir=.
   srcdir=$confdir
@@ -148,5 +148,5 @@
 # Make sure to not get the incompatible SysV /etc/install and
 # /usr/sbin/install, which might be in PATH before a BSD-like install,
-# or the SunOS /usr/etc/install directory.
+# or the SunOS /usr/etc/install directory, or the AIX /bin/install.
 if test -z "$INSTALL"; then
   echo checking for install
@@ -158,8 +158,12 @@
     *)
       if test -f $dir/install; then
-	INSTALL="$dir/install -c"
-	INSTALL_PROGRAM='$(INSTALL)'
-	INSTALL_DATA='$(INSTALL) -m 644'
-	break
+	if grep dspmsg $dir/install >/dev/null 2>&1; then
+	  : # AIX
+	else
+	  INSTALL="$dir/install -c"
+	  INSTALL_PROGRAM='$(INSTALL)'
+	  INSTALL_DATA='$(INSTALL) -m 644'
+	  break
+	fi
       fi
       ;;
@@ -262,4 +266,5 @@
 #include <stdarg.h>
 #include <string.h>
+#include <float.h>
 #include <limits.h>
 EOF
@@ -281,13 +286,18 @@
 rm -f conftest*
 
-echo checking for BSD string and memory functions
-echo "#include <strings.h>
-main() { exit(0); } t() { rindex(0, 0); bzero(0, 0); }" > conftest.c
-if eval $compile; then
-  :
-else
-  DEFS="$DEFS -DUSG=1"
+for hdr in sys/wait.h time.h string.h
+do
+trfrom='[a-z]./' trto='[A-Z]__'
+echo checking for $hdr
+cat <<EOF > conftest.c
+
+#include <$hdr>
+EOF
+err=`eval "$CPP $DEFS conftest.c 2>&1 >/dev/null"`
+if test -z "$err"; then
+  DEFS="$DEFS -DHAVE_`echo $hdr|tr "$trfrom" "$trto"`=1"
 fi
 rm -f conftest*
+done
 
 echo checking for pid_t in sys/types.h
@@ -496,9 +506,9 @@
 if test -n "$prefix"; then
   test -z "$exec_prefix" && exec_prefix='$(prefix)'
-  prsub="s,^prefix[ 	]*=.*$,prefix = $prefix,"
+  prsub="s%^prefix[ 	]*=.*$%prefix = $prefix%"
 fi
 if test -n "$exec_prefix"; then
   prsub="$prsub
-s,^exec_prefix[ 	]*=.*$,exec_prefix = $exec_prefix,"
+s%^exec_prefix[ 	]*=.*$%exec_prefix = $exec_prefix%"
 fi
 
@@ -540,5 +550,5 @@
   srcdir=$top_srcdir
   # Remove last slash and all that follows it.  Not all systems have dirname.
-  dir=`echo $file|sed 's,/[^/][^/]*$,,'`
+  dir=`echo $file|sed 's%/[^/][^/]*$%%'`
   if test "$dir" != "$file"; then
     test "$top_srcdir" != . && srcdir=$top_srcdir/$dir
@@ -550,13 +560,13 @@
   sed -e "
 $prsub
-s,@CC@,$CC,g
-s,@CPP@,$CPP,g
-s,@INSTALL@,$INSTALL,g
-s,@INSTALL_PROGRAM@,$INSTALL_PROGRAM,g
-s,@INSTALL_DATA@,$INSTALL_DATA,g
-s,@ALLOCA@,$ALLOCA,g
-s,@LIBS@,$LIBS,g
-s,@srcdir@,$srcdir,g
-s,@DEFS@,$DEFS," $top_srcdir/${file}.in >> $file
+s%@CC@%$CC%g
+s%@CPP@%$CPP%g
+s%@INSTALL@%$INSTALL%g
+s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g
+s%@INSTALL_DATA@%$INSTALL_DATA%g
+s%@ALLOCA@%$ALLOCA%g
+s%@LIBS@%$LIBS%g
+s%@srcdir@%$srcdir%g
+s%@DEFS@%$DEFS%" $top_srcdir/${file}.in >> $file
 done
 
diff -ru2 diff-2.0/configure.in diff-2.0-zoo/configure.in
--- diff-2.0/configure.in	Sun Sep  6 15:58:43 1992
+++ diff-2.0-zoo/configure.in	Tue Nov 10 21:11:56 1992
@@ -9,5 +9,5 @@
 AC_STDC_HEADERS
 AC_UNISTD_H
-AC_USG
+AC_HAVE_HEADERS(sys/wait.h time.h string.h)
 AC_PID_T
 AC_HAVE_FUNCS(dup2 memchr strerror waitpid)
diff -ru2 diff-2.0/regex.c diff-2.0-zoo/regex.c
--- diff-2.0/regex.c	Thu Sep 10 21:57:41 1992
+++ diff-2.0-zoo/regex.c	Tue Nov 10 21:11:57 1992
@@ -46,5 +46,5 @@
 /* We used to test for `BSTRING' here, but only GCC and Emacs define
    `BSTRING', as far as I know, and neither of them use this code.  */
-#if USG || STDC_HEADERS
+#if HAVE_STRING_H || STDC_HEADERS
 #include <string.h>
 #define bcmp(s1, s2, n)	memcmp ((s1), (s2), (n))
diff -ru2 diff-2.0/system.h diff-2.0-zoo/system.h
--- diff-2.0/system.h	Fri Sep 11 22:33:21 1992
+++ diff-2.0-zoo/system.h	Tue Nov 10 21:11:58 1992
@@ -32,11 +32,15 @@
 #endif
 
-#if defined (USG) || defined (_POSIX_VERSION)
+#if HAVE_TIME_H
 #include <time.h>
-#include <fcntl.h>
 #else
 #include <sys/time.h>
+#endif /* HAVE_TIME_H */
+
+#if HAVE_FCNTL_H
+#include <fcntl.h>
+#else
 #include <sys/file.h>
-#endif
+#endif /* HAVE_FCNTL_H */
 
 #ifndef HAVE_DUP2
@@ -48,5 +52,5 @@
 #endif
 
-#if !defined (USG) || defined (_POSIX_VERSION)
+#if HAVE_SYS_WAIT_H
 #include <sys/wait.h>
 #endif
@@ -73,13 +77,15 @@
 #define direct dirent
 #else /* not (DIRENT or _POSIX_VERSION) */
-#ifdef USG
-#ifdef SYSNDIR
+
+#if defined(SYSNDIR)
 #include <sys/ndir.h>
 #else /* !SYSNDIR */
+#ifdef SYSDIR
+#include <sys/dir.h>
+#else /* !SYSDIR */
 #include <ndir.h>
+#endif /* SYSDIR */
 #endif /* SYSNDIR */
-#else /* !USG */
-#include <sys/dir.h>
-#endif /* USG */
+
 #endif /* DIRENT or _POSIX_VERSION */
 
@@ -88,5 +94,5 @@
 #endif
 
-#if defined (USG) || defined (STDC_HEADERS)
+#if defined (HAVE_STRING_H) || defined (STDC_HEADERS)
 #include <string.h>
 #define index	strchr
@@ -98,5 +104,5 @@
 #include <strings.h>
 #endif
-#if !HAVE_MEMCHR || (!STDC_HEADERS && !USG)
+#if !HAVE_MEMCHR || (!STDC_HEADERS)
 char *memchr ();
 #endif
Technical Details
Message-ID: <9211110722.AA09333@cygnus.com>
Path: arc1-ca.pugleaf.net!sparky!uunet!charon.amdahl.com!pacbell.com!iggy.GW.Vitalink.COM!cs.widener.edu!eff!sol.ctr.columbia.edu!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!cygnus.com!zoo

Show Full Headers
Complete Article Headers
Newsgroups: gnu.utils.bug
Path: arc1-ca.pugleaf.net!sparky!uunet!charon.amdahl.com!pacbell.com!iggy.GW.Vitalink.COM!cs.widener.edu!eff!sol.ctr.columbia.edu!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!cygnus.com!zoo
From: zoo@cygnus.com (david d `zoo' zuhn)
Subject: removing USG tests from diff
Message-ID: <9211110722.AA09333@cygnus.com>
Sender: gnulists@ai.mit.edu
Organization: Cygnus Support -- +1 415 903 1434
Distribution: gnu
Date: Wed, 11 Nov 1992 07:22:28 GMT
Approved: bug-gnu-utils@prep.ai.mit.edu
Lines: 222