[comp.sys.sgi] getting GNU Diff V1.07 running on Iris 4D

pwolfe@kailand.kai.com (Patrick Wolfe) (08/17/89)

Enclosed are the few changes I made to gnu diff V1.07 to get it working on our
sgi iris 4d machines.  Gnu diff works like bsd 4.3's, except it's missing the
"-D" command line option.  I found gnu diff was required to get RCS V4
working.

You will also need a copy of the "alloca.c" file.  Since I've posted that twice
in the recent few weeks (in the diffs for GNU Make and GNU Tar), I saw no
reason to consume any more network bandwidth.

The patches are short, and are to be made to the files "Makefile", "diff.h",
"diff3.c", and "util.c".  Be sure to save any original versions before
installing any patches.

GNU software can be ftp'd anonymously from prep.ai.mit.edu.  It can also be
anonymously uucp'd from tut.cis.ohio-state.edu.  I believe you can find
detailed information in comp.sources.{bugs,d} or comp.archives on setting up
a UUCP link to them.

        Patrick Wolfe   pat@kai.com    {uunet,uiucuxc,sgi}!kailand!pat
        System Manager, Kuck & Associates, Inc.


The following context diffs are suitable food for the "patch" utility:

===================================================================
RCS file: RCS/diff.h,v
retrieving revision 1.1
diff -c -r1.1 diff.h
*** /tmp/,RCSt1021606	Wed Aug 16 11:36:10 1989
--- diff.h	Thu Jul 20 11:20:06 1989
***************
*** 309,317 ****
  
  /* Declare various functions.  */
  
! void *xmalloc ();
! void *xrealloc ();
! void *xcalloc();
  char *concat ();
  void free ();
  char *rindex ();
--- 309,317 ----
  
  /* Declare various functions.  */
  
! char *xmalloc ();
! char *xrealloc ();
! char *xcalloc();
  char *concat ();
  void free ();
  char *rindex ();
===================================================================
RCS file: RCS/util.c,v
retrieving revision 1.1
diff -c -r1.1 util.c
*** /tmp/,RCSt1021612	Wed Aug 16 11:36:25 1989
--- util.c	Thu Jul 20 11:20:26 1989
***************
*** 565,577 ****
  
  /* malloc a block of memory, with fatal error message if we can't do it. */
  
! void *
  xmalloc (size)
       unsigned size;
  {
!   register void *value = (void *) malloc (size);
! 
!   if (!value)
      fatal ("virtual memory exhausted");
    return value;
  }
--- 565,576 ----
  
  /* malloc a block of memory, with fatal error message if we can't do it. */
  
! char *
  xmalloc (size)
       unsigned size;
  {
!   register char *value = (char *) malloc (size);
!   if (value == NULL)
      fatal ("virtual memory exhausted");
    return value;
  }
***************
*** 578,602 ****
  
  /* realloc a block of memory, with fatal error message if we can't do it. */
  
! void *
  xrealloc (old, size)
!      void *old;
       unsigned int size;
  {
!   register void *value = (void *) realloc (old, size);
! 
!   if (!value)
      fatal ("virtual memory exhausted");
    return value;
  }
  
! void *
  xcalloc (nitems, size)
       int nitems, size;
  {
!   void *value = (void *) calloc (nitems, size);
  
!   if (! value)
      fatal ("virtual memory exhausted");
    return value;
  }
--- 577,600 ----
  
  /* realloc a block of memory, with fatal error message if we can't do it. */
  
! char *
  xrealloc (old, size)
!      char *old;
       unsigned int size;
  {
!   register char *value = (char *) realloc (old, size);
!   if (value == NULL)
      fatal ("virtual memory exhausted");
    return value;
  }
  
! char *
  xcalloc (nitems, size)
       int nitems, size;
  {
!   char *value = (char *) calloc (nitems, size);
  
!   if (value == NULL)
      fatal ("virtual memory exhausted");
    return value;
  }
===================================================================
RCS file: RCS/diff3.c,v
retrieving revision 1.1
diff -c -r1.1 diff3.c
*** /tmp/,RCSt1021618	Wed Aug 16 11:36:38 1989
--- diff3.c	Wed Aug 16 11:35:21 1989
***************
*** 31,36 ****
--- 31,37 ----
  #define bcmp(s1,s2,n)	memcmp((s1),(s2),(n))
  #define bzero(s,n)	memset((s),0,(n))
  
+ #include <fcntl.h>
  #define dup2(f,t)	(close(t),fcntl((f),F_DUPFD,(t)))
  
  #define vfork	fork
***************
*** 204,211 ****
  
  struct diff3_block *reverse_diff3_blocklist ();
  
! void *xmalloc ();
! void *xrealloc ();
  
  /*
   * No options take arguments.  "i" is my own addition; it stands for
--- 205,212 ----
  
  struct diff3_block *reverse_diff3_blocklist ();
  
! char *xmalloc ();
! char *xrealloc ();
  
  /*
   * No options take arguments.  "i" is my own addition; it stands for
***************
*** 1450,1472 ****
    return result;
  }
  
! void *
  xmalloc (size)
       int size;
  {
!   void *result = (void *) malloc (size);
!   if (!result)
      fatal ("Malloc failed");
    return result;
  }
  
! void *
  xrealloc (ptr, size)
!      void *ptr;
       int size;
  {
!   void *result = (void *) realloc (ptr, size);
!   if (!result)
      fatal ("Malloc failed");
    return result;
  }
--- 1451,1473 ----
    return result;
  }
  
! char *
  xmalloc (size)
       int size;
  {
!   char *result = (char *) malloc (size);
!   if (result == NULL)
      fatal ("Malloc failed");
    return result;
  }
  
! char *
  xrealloc (ptr, size)
!      char *ptr;
       int size;
  {
!   char *result = (char *) realloc (ptr, size);
!   if (result == NULL)
      fatal ("Malloc failed");
    return result;
  }
===================================================================
RCS file: RCS/Makefile,v
retrieving revision 1.1
diff -c -r1.1 Makefile
*** /tmp/,RCSt1021625	Wed Aug 16 11:36:49 1989
--- Makefile	Sun Aug  6 18:00:17 1989
***************
*** 21,34 ****
  # You can compile this with ordinary cc as well,
  # but gcc makes it faster.
  # Also, gcc supports -O and -g together.
! CC=gcc -O
! CFLAGS = -g
! INSTALL = install
  
  # On system V, enable these three lines:
! # CFLAGS = -g -DUSG
! # LIBS = -lPW
! # INSTALL = cp
  
  bindir=/usr/local/bin
  prefix=
--- 21,38 ----
  # You can compile this with ordinary cc as well,
  # but gcc makes it faster.
  # Also, gcc supports -O and -g together.
! #CC=gcc -O
! #CFLAGS = -g
! CC = cc
! #CFLAGS = -O
! #	uses getopt
! #LIBS = -lpd
! #INSTALL = install
  
  # On system V, enable these three lines:
! CFLAGS = -g -DUSG
! LIBS = -lPW
! INSTALL = install
  
  bindir=/usr/local/bin
  prefix=
***************
*** 35,43 ****
  
  # All source files
  srcs=diff.c analyze.c io.c context.c ed.c normal.c util.c dir.c diff.h \
! 	regex.c regex.h limits.h diff3.c
  # Object files for diff only.
! objs=diff.o analyze.o io.o context.o ed.o normal.o util.o dir.o regex.o
  tapefiles = $(srcs) README diagmeet.note Makefile COPYING
  
  all: diff diff3
--- 39,47 ----
  
  # All source files
  srcs=diff.c analyze.c io.c context.c ed.c normal.c util.c dir.c diff.h \
! 	regex.c regex.h limits.h diff3.c alloca.c
  # Object files for diff only.
! objs=diff.o analyze.o io.o context.o ed.o normal.o util.o dir.o regex.o alloca.o
  tapefiles = $(srcs) README diagmeet.note Makefile COPYING
  
  all: diff diff3
***************
*** 63,74 ****
  install-diff: $(prefix)$(bindir)/diff
  
  $(prefix)$(bindir)/diff: diff
! 	$(INSTALL) diff $(prefix)$(bindir)/diff
  
  install-diff3: $(prefix)$(bindir)/diff3
  
  $(prefix)$(bindir)/diff3: diff3
! 	$(INSTALL) diff3 $(prefix)$(bindir)/diff3
  
  diff.tar: $(tapefiles)
  	mkdir tmp
--- 67,78 ----
  install-diff: $(prefix)$(bindir)/diff
  
  $(prefix)$(bindir)/diff: diff
! 	$(INSTALL) -c -s -m 711 diff $(prefix)$(bindir)/diff
  
  install-diff3: $(prefix)$(bindir)/diff3
  
  $(prefix)$(bindir)/diff3: diff3
! 	$(INSTALL) -c -s -m 711 diff3 $(prefix)$(bindir)/diff3
  
  diff.tar: $(tapefiles)
  	mkdir tmp



-- 

        Patrick Wolfe   (pat@kai.com, kailand!pat)
        System Manager, Kuck & Associates, Inc.