[gnu.utils.bug] Patches for GNU diff 1.7 for OS/2

rommel@lan.informatik.tu-muenchen.dbp.de (01/19/90)

Date: Thu, 18 Jan 90 15:41:07 +0100

I have ported GNU diff 1.7 to OS/2. The (family mode) excutable can
be used on MS-DOS too. There is no new Makefile because I use my own
compiler shell. See diff.cs for files needed to compile and link.
Because of the 16-bit architecture of MS-DOS and (at this time :-) OS/2
machines there are limitations in file size (about 2000 lines).

I had patches to 1.4 from another person but they were incomplete and
did not work. Part of them is integrated into this patches to 1.7 now.

Kai Uwe Rommel
Munich
rommel@lan.informatik.tu-muenchen.dbp.de

---- Cut Here and unpack ----
#!/bin/sh
# shar:	Shell Archiver  (v1.23)
#
#	Run the following text with /bin/sh to create:
#	  diff.cs
#	  diff.def
#	  patches.os2
#
echo "x - extracting diff.cs (Text)"
sed 's/^X//' << 'SHAR_EOF' > diff.cs &&
X(-W1 -DUSG
Xanalyze.c context.c diff.c dir_os2.c ed.c
Xgetopt.c io.c normal.c regex.c util.c
X)
Xsetargv.obj
Xdiff.def
Xdiff.exe
X-AH -LB -S0x8000
SHAR_EOF
chmod 0640 diff.cs || echo "restore of diff.cs fails"
echo "x - extracting diff.def (Text)"
sed 's/^X//' << 'SHAR_EOF' > diff.def &&
XNAME DIFF WINDOWCOMPAT
XDESCRIPTION 'GNU diff version 1.7 - for MS-DOS and OS/2'
SHAR_EOF
chmod 0640 diff.def || echo "restore of diff.def fails"
echo "x - extracting patches.os2 (Text)"
sed 's/^X//' << 'SHAR_EOF' > patches.os2 &&
Xdiff -cwbB UNIX/analyze.c OS2/analyze.c
X*** UNIX/analyze.c	Tue Jan 02 23:59:30 1990
X--- OS2/analyze.c	Tue Jan 02 22:48:56 1990
X***************
X*** 385,392 ****
X--- 385,400 ----
X  	      }
X
X  	    /* Cancel provisional discards at the end, and shrink the run.  */
X+ #if   defined(MSC_BUG)
X              while (j > i && discards[j - 1] == 2)
X                discards[j - 1] = 0, --provisional;
X+ #else
X+             {
X+               int index = j - 1;
X+               while (j > i && discards[index] == 2)
X+                 discards[index] = 0, --provisional;
X+             }
X+ #endif
X
X  	    /* Now we have the length of a run of discardable lines
X  	       whose first and last are not provisional.  */
X***************
X*** 650,658 ****
X--- 658,672 ----
X    /* See if the two named files are actually the same physical file.
X       If so, we know they are identical without actually reading them.  */
X
X+ #if !defined(MSDOS)
X+       /*
X+       ** since MSC always sets the inode and dev fields to zero under DOS
X+       ** this test will always think two files are the same.
X+       */
X    if (filevec[0].stat.st_ino == filevec[1].stat.st_ino
X        && filevec[0].stat.st_dev == filevec[1].stat.st_dev)
X      return 0;
X+ #endif /* MSDOS */
X
X    binary = read_files (filevec);
X
X***************
X*** 662,670 ****
X--- 676,710 ----
X
X    if (binary)
X      {
X+ #if !defined(MSDOS)
X        int differs = (filevec[0].buffered_chars != filevec[1].buffered_chars
X                     || bcmp (filevec[0].buffer, filevec[1].buffer,
X                              filevec[1].buffered_chars));
X+ #else
X+       int differs;
X+       if(filevec[0].buffered_chars != filevec[1].buffered_chars)
X+               differs = 1;
X+       else {
X+               /*
X+               ** we've got to do it in chunks because of our
X+               ** poor 16 bit processor
X+               */
X+               char huge *b0 = filevec[0].buffer,
X+                         *b1 = filevec[1].buffer;
X+               long int count;
X+               unsigned int delta;
X+               count = filevec[0].buffered_chars;
X+               while(count > 0) {
X+                       delta = (unsigned)(count > 65000 ? 65000 : count);
X+                       if(bcmp(b0,b1,delta) != 0)
X+                               break;
X+                       count -= delta;
X+                       b0 += delta;
X+                       b1 += delta;
X+               }
X+               differs = count != 0;
X+       }
X+ #endif
X        if (differs)
X  	message ("Binary files %s and %s differ\n",
X  		 filevec[0].name, filevec[1].name);
X***************
X*** 671,677 ****
X--- 711,721 ----
X
X        for (i = 0; i < 2; ++i)
X  	if (filevec[i].buffer)
X+ #ifndef MSDOS
X            free (filevec[i].buffer);
X+ #else
X+           hfree (filevec[i].buffer);
X+ #endif
X        return differs;
X      }
X
X***************
X*** 782,789 ****
X--- 826,838 ----
X
X    for (i = 0; i < 2; ++i)
X      {
X+ #if !defined(MSDOS)
X        if (filevec[i].buffer != 0)
X          free (filevec[i].buffer);
X+ #else /* MSDOS */
X+       if (filevec[i].buffer != 0)
X+         hfree (filevec[i].buffer);
X+ #endif
X        free (filevec[i].linbuf);
X      }
X
Xdiff -cwbB UNIX/diff.c OS2/diff.c
X*** UNIX/diff.c	Tue Jan 02 23:59:30 1990
X--- OS2/diff.c	Tue Jan 02 23:51:24 1990
X***************
X*** 34,39 ****
X--- 34,93 ----
X
X  int no_discards;
X
X+ usage()
X+ {
X+   printf("\nGNU diff, version 1.7.\n");
X+
X+   printf("\nUsage: %s [-options] file1 file2\n\n", program);
X+   printf(
X+   "  -[0-9]  digits combined into decimal to specify the context-size.\n"
X+   "  -a      Treat all files as text files; never treat as binary.\n"
X+   "  -b      Ignore changes in amount of whitespace.\n"
X+   "  -B      Ignore changes affecting only blank lines.\n"
X+   "  -c      Make context-style output.\n"
X+   );
X+   printf(
X+   "  -C n    Make context-style output and show name of last C function.\n"
X+   "          Define context size to be n lines.\n"
X+   "  -d      Don't discard lines. This makes things slower (sometimes much\n"
X+   "          slower) but will find a guaranteed minimal set of changes.\n"
X+   "  -e      Make output that is a valid `ed' script.\n"
X+   "  -f      Make output that looks vaguely like an `ed' script\n"
X+   "          but has changes in the order they appear in the file.\n"
X+   );
X+   printf(
X+   "  -F re   Show, for each set of changes, the previous line that matches the\n"
X+   "          specified regexp. Currently affects only context-style output.\n"
X+   "  -h      Split the files into chunks of around 1500 lines\n"
X+   "          for faster processing. Usually does not change the result.\n"
X+   "  -H      Use heuristic.\n"
X+   "  -i      Ignore changes in case.\n"
X+   "  -I re   Ignore changes affecting only lines that match the specified regexp.\n"
X+   "  -l      Pass the output through `pr' to paginate it.\n"
X+   );
X+   printf(
X+   "  -n      Output RCS-style diffs, like `-f' except that each command\n"
X+   "          specifies the number of lines affected.\n"
X+   "  -N      When comparing directories, if a file appears only in one\n"
X+   "          directory, treat it as present but empty in the other.\n"
X+   "  -r      When comparing directories, recursively compare subdir's found.\n"
X+   "  -s      Print a message if the files are the same.\n"
X+   );
X+   printf(
X+   "  -S file When comparing directories, start with the specified\n"
X+   "          file name. This is used for resuming an aborted comparison.\n"
X+   "  -t      Expand tabs to spaces in the output so that it preserves\n"
X+   "          the alignment of the input files.\n"
X+   "  -T      Use a tab in the output, rather than a space, before the\n"
X+   "          text of an input line, so as to keep the proper alignment\n"
X+   "          in the input line without changing the characters in it.\n"
X+   "  -w      Ignore horizontal whitespace when comparing lines.\n"
X+   );
X+
X+   exit(1);
X+ }
X+
X+
X  /* Return a string containing the command options with which diff was invoked.
X     Spaces appear between what were separate ARGV-elements.
X     There is a space at the beginning but none at the end.
X***************
X*** 66,72 ****
X    return result;
X  }
X  
X! main (argc, argv)
X       int argc;
X       char *argv[];
X  {
X--- 120,126 ----
X    return result;
X  }
X  
X! void main (argc, argv)
X       int argc;
X       char *argv[];
X  {
X***************
X*** 276,282 ****
X      }
X
X    if (optind != argc - 2)
X!     fatal ("requires two file names.  Usage: diff [-options] file1 file2");
X
X    /*
X     * @@ need more complicated usage string for directory options??
X--- 330,337 ----
X      }
X
X    if (optind != argc - 2)
X!     usage();
X!     /*fatal ("requires two file names.\nUsage: diff [-options] file1 file2");*/
X
X    /*
X     * @@ need more complicated usage string for directory options??
X***************
X*** 405,410 ****
X--- 460,472 ----
X  	}
X      }
X
X+ #if !defined(MSDOS)
X+       /*
X+       ** this stuff is real bad idea under MSDOS, at least for MSC 5.1
X+       ** because the st_ino and st_dev fields are not supported by
X+       ** MSDOS, and so stat sets them to zero; therefore
X+       ** this test always succeeds.
X+       */
X    /* See if the two named files are actually the same physical file.
X       If so, we know they are identical without actually reading them.  */
X
X***************
X*** 416,421 ****
X--- 478,484 ----
X        val = 0;
X        goto done;
X      }
X+ #endif        /* MSDOS */
X
X    if (name0 == 0)
X      inf[0].dir_p = inf[1].dir_p;
X***************
X*** 434,443 ****
X  	  inf[i].name = "Standard Input";
X  	}
X        /* Don't bother opening if stat already failed.  */
X!       else if (stat_result[i] == 0 && ! inf[i].dir_p)
X  	{
X  	  char *filename = inf[i].name;
X!
X  	  inf[i].desc = open (filename, O_RDONLY, 0);
X  	  if (0 > inf[i].desc)
X  	    {
X--- 497,515 ----
X  	  inf[i].name = "Standard Input";
X  	}
X        /* Don't bother opening if stat already failed.  */
X!       else if (stat_result[i] == 0)
X  	{
X  	  char *filename = inf[i].name;
X! #if !defined(MSDOS)
X! 	  inf[i].desc = open (filename, O_RDONLY, 0);
X! 	  if (0 > inf[i].desc)
X! 	    {
X! 	      perror_with_name (filename);
X! 	      errorcount = 1;
X! 	    }
X! #else
X!           if(inf[i].dir_p == 0)
X!           {
X              inf[i].desc = open (filename, O_RDONLY, 0);
X              if (0 > inf[i].desc)
X              {
X***************
X*** 444,451 ****
X--- 516,531 ----
X                  perror_with_name (filename);
X                  errorcount = 1;
X              }
X+           } else
X+                 inf[i].desc = 0;
X+ #endif	/* MSDOS */
X  	}
X      }
X+
X+   if (name0 == 0)
X+     inf[0].dir_p = inf[1].dir_p;
X+   if (name1 == 0)
X+     inf[1].dir_p = inf[0].dir_p;
X
X    if (errorcount)
X      {
Xdiff -cwbB UNIX/diff.h OS2/diff.h
X*** UNIX/diff.h	Tue Jan 02 23:59:30 1990
X--- OS2/diff.h	Tue Jan 02 23:48:48 1990
X***************
X*** 23,34 ****
X--- 23,38 ----
X  #include <sys/types.h>
X  #include <sys/stat.h>
X
X+ #include <string.h>
X+
X  #ifdef USG
X  #include <time.h>
X  #ifdef hp9000s800
X  #include <ndir.h>
X  #else
X+ #if !defined(MSDOS)
X  #include <dirent.h>
X+ #endif /* MSDOS */
X  #endif
X  #include <fcntl.h>
X  #define direct dirent
X***************
X*** 45,51 ****
X--- 49,57 ----
X  #define bcmp(s1,s2,n)	memcmp((s1),(s2),(n))
X  #define bzero(s,n)	memset((s),0,(n))
X
X+ #if !defined(MSDOS)
X  #define dup2(f,t)       (close(t),fcntl((f),F_DUPFD,(t)))
X+ #endif
X
X  #define vfork	fork
X  #define index	strchr
X***************
X*** 52,68 ****
X--- 58,83 ----
X  #define rindex	strrchr
X  #endif
X
X+ #ifdef MSDOS
X+ #include <process.h>
X+ #include <stdlib.h>
X+ #endif /* MSDOS */
X+
X  #include <errno.h>
X+ #if !defined(MSDOS)
X  extern int      errno;
X  extern int      sys_nerr;
X  extern char    *sys_errlist[];
X+ #endif
X
X  #define	EOS		(0)
X  #define	FALSE		(0)
X  #define TRUE		1
X
X+ #if !defined(min)
X  #define min(a,b) ((a) <= (b) ? (a) : (b))
X  #define max(a,b) ((a) >= (b) ? (a) : (b))
X+ #endif /* MSDOS */
X
X  #ifndef PR_FILE_NAME
X  #define PR_FILE_NAME "/bin/pr"
X***************
X*** 70,83 ****
X
X  /* Support old-fashioned C compilers.  */
X  #if defined (__STDC__) || defined (__GNUC__)
X  #include "limits.h"
X  #else
X  #define INT_MAX 2147483647
X  #define CHAR_BIT 8
X  #endif
X
X  /* Support old-fashioned C compilers.  */
X! #if !defined (__STDC__) && !defined (__GNUC__)
X  #define const
X  #endif
X  
X--- 85,116 ----
X
X  /* Support old-fashioned C compilers.  */
X  #if defined (__STDC__) || defined (__GNUC__)
X+ #if !defined(MSDOS)
X  #include "limits.h"
X  #else
X+ #include <limits.h>
X+ #endif        /* MSDOS */
X+ #else
X  #define INT_MAX 2147483647
X  #define CHAR_BIT 8
X  #endif
X
X+ #if defined(MSDOS)
X+ #ifdef INT_MAX
X+ #undef INT_MAX
X+ #include <limits.h>
X+ #endif
X+ #if !defined(MAKING_PROTO_H)
X+ #include "proto.h"
X+ #endif
X+ #include <malloc.h>
X+ #include <io.h>
X+ #include <memory.h>
X+ extern int getopt(int nargc,char **nargv,char *ostr);
X+ #endif
X+
X  /* Support old-fashioned C compilers.  */
X! #if !defined (__STDC__) && !defined (__GNUC__) || defined(MSDOS)
X  #define const
X  #endif
X  
X***************
X*** 216,227 ****
X      struct stat     stat;	/* File status from fstat()  */
X      int             dir_p;	/* 1 if file is a directory  */
X
X      /* Buffer in which text of file is read.  */
X      char *	    buffer;
X      /* Allocated size of buffer.  */
X      int		    bufsize;
X      /* Number of valid characters now in the buffer. */
X!     int		    buffered_chars;
X
X      /* Array of data on analyzed lines of this chunk of this file.  */
X      struct line_def *linbuf;
X--- 249,269 ----
X      struct stat     stat;	/* File status from fstat()  */
X      int             dir_p;	/* 1 if file is a directory  */
X
X+ #if !defined(MSDOS)
X      /* Buffer in which text of file is read.  */
X      char *        buffer;
X      /* Allocated size of buffer.  */
X      int                   bufsize;
X      /* Number of valid characters now in the buffer. */
X!     long int              buffered_chars;
X! #else /* MSDOS */
X!     /* Buffer in which text of file is read.  */
X!     char huge *buffer;
X!     /* Allocated size of buffer.  */
X!     long int      bufsize;
X!     /* Number of valid characters now in the buffer. */
X!     long int              buffered_chars;
X! #endif        /* MSDOS */
X
X      /* Array of data on analyzed lines of this chunk of this file.  */
X      struct line_def *linbuf;
Xdiff -cwbB UNIX/dir.c OS2/dir.c
X*** UNIX/dir.c	Tue Jan 02 23:59:32 1990
X--- OS2/dir.c	Tue Jan 02 23:13:50 1990
X***************
X*** 31,36 ****
X--- 31,95 ----
X    char **files;			/* Sorted names of files in the dir */
X  };
X
X+ #if defined(MSDOS)
X+ /*
X+ ** due to difference of opinion btw gnu and microsoft about what
X+ ** const means, const is defined away in diff.h, which causes warnings
X+ ** when compiling the headers.  This ugliness is avoided here.
X+ */
X+ #ifdef const
X+ #undef const
X+ #endif
X+ #include <string.h>
X+ #include <dos.h>
X+
X+ struct direct {
X+ 	char d_name[14];
X+ };
X+
X+ typedef struct _dir {
X+ 	int first;
X+ 	struct find_t dta;
X+ 	struct direct current;
X+ } DIR;
X+
X+
X+ DIR *
X+ opendir(char *name) {
X+ 	char localname[65];
X+ 	DIR *rval = malloc(sizeof(DIR));
X+ 	strcpy(localname,name);
X+ 	strcat(localname,"/*.*");
X+ 	if(rval == NULL ||
X+ 		_dos_findfirst(localname,_A_NORMAL|_A_SUBDIR,&rval->dta) != 0)
X+ 		return NULL;
X+ 	rval->first = 1;
X+ 	return rval;
X+ }
X+
X+ void
X+ closedir(DIR *x) {
X+ 	free(x);
X+ }
X+
X+ struct direct *
X+ readdir(DIR *thisdir) {
X+ 	/*
X+ 	** first time through, we don't need to look for a file
X+ 	*/
X+ 	if(!thisdir->first) {
X+ 		if(_dos_findnext(&thisdir->dta) != 0)
X+ 			return NULL;
X+ 	} else
X+ 		thisdir->first = 0;
X+ 	strncpy(thisdir->current.d_name,thisdir->dta.name,13);
X+ 	thisdir->current.d_name[13] = '\0';
X+ 	strlwr(thisdir->current.d_name);
X+ 	return &thisdir->current;
X+ }
X+
X+ #endif /* MSDOS */
X+
X  static struct dirdata
X  dir_sort (dirname, nonex)
X       char *dirname;
X***************
X*** 136,142 ****
X--- 195,209 ----
X  int
X  diff_dirs (name1, name2, handle_file, depth, nonex1, nonex2)
X       char *name1, *name2;
X+ #if !defined(MSDOS)
X       int (*handle_file) ();
X+ #else
X+       /* sorry, rms, I can't live with the assumption that
X+       ** sizeof(char *) == sizeof(int)
X+       */
X+       int (*handle_file)(char *dir0,char *name0,
X+               char *dir1,char *name1,int depth);
X+ #endif
X       int nonex1, nonex2;
X  {
X    struct dirdata data1, data2;
Xdiff -cwbB UNIX/io.c OS2/io.c
X*** UNIX/io.c	Tue Jan 02 23:59:32 1990
X--- OS2/io.c	Tue Jan 02 23:23:40 1990
X***************
X*** 20,27 ****
X--- 20,31 ----
X  #include "diff.h"
X
X  /* Rotate a value n bits to the left. */
X+ #if !defined(MSDOS)
X  #define UINT_BIT (sizeof (unsigned) * CHAR_BIT)
X  #define ROL(v, n) ((v) << (n) | (v) >> UINT_BIT - (n))
X+ #else
X+ #define ROL(v,n)  ((v) << (n) | (v) >> (sizeof(v) * CHAR_BIT) - (n))
X+ #endif
X
X  /* Given a hash value and a new character, return a new hash value. */
X  #define HASH(h, c) ((c) + ROL (h, 7))
X***************
X*** 39,47 ****
X--- 43,53 ----
X       char *buf;
X       int size;
X  {
X+ #ifndef MSDOS
X    while (--size >= 0)
X      if (*buf++ & 0200)
X        return 1;
X+ #endif
X    return 0;
X  }
X
X***************
X*** 66,71 ****
X--- 72,78 ----
X       beyond those that current->bufsize describes:
X       one for a newline (in case the text does not end with one)
X       and one for a sentinel in find_identical_ends.  */
X+ #if !defined(MSDOS)
X    else if ((current->stat.st_mode & S_IFMT) == S_IFREG)
X      {
X        current->bufsize = current->stat.st_size;
X***************
X*** 72,80 ****
X--- 79,103 ----
X        current->buffer = (char *) xmalloc (current->bufsize + 2);
X        current->buffered_chars
X  	= read (current->desc, current->buffer, current->bufsize);
X+ #else /* MSDOS */
X+   else {
X+       current->bufsize = current->stat.st_size + 1;
X+       if((current->buffer =
X+               (char huge *)halloc(current->bufsize + 2,sizeof(char))) == NULL)
X+               fatal("virtual memory exhausted");
X+       {
X+               int count;
X+               current->buffered_chars = 0;
X+               while((count = read(current->desc,
X+                       current->buffer+current->buffered_chars,
X+                               32000)) > 0)
X+                       current->buffered_chars += count;
X+       }
X+ #endif        /* MSDOS */
X        if (current->buffered_chars < 0)
X  	pfatal_with_name (current->name);
X      }
X+ #if !defined(MSDOS)
X    else
X      {
X        int cc;
X***************
X*** 101,106 ****
X--- 124,130 ----
X        if (cc < 0)
X  	pfatal_with_name (current->name);
X      }
X+ #endif /* MSDOS */
X
X    /* Check first part of file to see if it's a binary file.  */
X    if (! always_text_flag
X***************
X*** 133,141 ****
X--- 157,175 ----
X    unsigned char *p = (unsigned char *) current->prefix_end, *ip, c;
X
X    /* Attempt to get a good initial guess as to the number of lines. */
X+ #if !defined(MSDOS)
X    current->linbufsize = current->buffered_chars / 50 + 5;
X    current->linbuf
X      = (struct line_def *) xmalloc (current->linbufsize * sizeof (struct line_def));
X+ #else
X+       long int buffersize;
X+       current->linbufsize = (int)
X+               (buffersize = (long int)(current->buffered_chars / 50 + 5));
X+       buffersize *= sizeof(struct line_def);
X+       if(buffersize > 65535L)
X+               fatal("Too many lines to compare");
X+       current->linbuf = (struct line_def *) xmalloc((size_t)buffersize);
X+ #endif
X
X    if (function_regexp)
X      {
X***************
X*** 445,450 ****
X--- 479,485 ----
X    16381,
X    32749,
X    65521,
X+ #if !defined MSDOS
X    131071,
X    262139,
X    524287,
X***************
X*** 456,461 ****
X--- 491,497 ----
X    33554393,
X    67108859,			/* Preposterously large . . . */
X    -1
X+ #endif
X  };
X
X  /* Index of current nbuckets in primes. */
Xdiff -cwbB UNIX/regex.c OS2/regex.c
X*** UNIX/regex.c	Tue Jan 02 23:59:34 1990
X--- OS2/regex.c	Tue Jan 02 23:30:34 1990
X***************
X*** 55,60 ****
X--- 55,66 ----
X  #endif
X  #endif
X
X+ #ifdef MSDOS
X+ #include <memory.h>
X+ #include <malloc.h>
X+ #include "diff.h"
X+ #endif
X+
X  /*
X   * Define the syntax stuff, so we can do the \<...\> things.
X   */
X***************
X*** 165,170 ****
X--- 171,177 ----
X
X  #define PATUNFETCH p--
X
X+ #if !defined(MSDOS)
X  #define EXTEND_BUFFER \
X    { char *old_buffer = bufp->buffer; \
X      if (bufp->allocated == (1<<16)) goto too_big; \
X***************
X*** 182,187 ****
X--- 189,213 ----
X      if (pending_exact) \
X        pending_exact += c; \
X    }
X+ #else
X+ #define EXTEND_BUFFER \
X+   { char *old_buffer = bufp->buffer; \
X+     if (bufp->allocated == (1<<15)) goto too_big; \
X+     bufp->allocated *= 2; \
X+     if (bufp->allocated > (1<<15)) bufp->allocated = (1<<15); \
X+     if (!(bufp->buffer = (char *) realloc (bufp->buffer, bufp->allocated))) \
X+       goto memory_exhausted; \
X+     c = bufp->buffer - old_buffer; \
X+     b += c; \
X+     if (fixup_jump) \
X+       fixup_jump += c; \
X+     if (laststart) \
X+       laststart += c; \
X+     begalt += c; \
X+     if (pending_exact) \
X+       pending_exact += c; \
X+   }
X+ #endif
X
X  static int store_jump (), insert_jump ();
X
X***************
X*** 264,270 ****
X--- 290,300 ----
X  	bufp->buffer = (char *) realloc (bufp->buffer, 28);
X        else
X  	/* Caller did not allocate a buffer.  Do it for him */
X+ #if !defined(MSDOS)
X  	bufp->buffer = (char *) malloc (28);
X+ #else
X+         bufp->buffer = (char *) xmalloc(28);
X+ #endif
X        if (!bufp->buffer) goto memory_exhausted;
X        begalt = b = bufp->buffer;
X      }
X***************
X*** 1580,1590 ****
X
X    if (!re_comp_buf.buffer)
X      {
X        if (!(re_comp_buf.buffer = (char *) malloc (200)))
X  	return "Memory exhausted";
X-       re_comp_buf.allocated = 200;
X        if (!(re_comp_buf.fastmap = (char *) malloc (1 << BYTEWIDTH)))
X  	return "Memory exhausted";
X      }
X    return re_compile_pattern (s, strlen (s), &re_comp_buf);
X  }
X--- 1610,1625 ----
X
X    if (!re_comp_buf.buffer)
X      {
X+ #if !defined(MSDOS)
X        if (!(re_comp_buf.buffer = (char *) malloc (200)))
X  	return "Memory exhausted";
X        if (!(re_comp_buf.fastmap = (char *) malloc (1 << BYTEWIDTH)))
X  	return "Memory exhausted";
X+ #else
X+       re_comp_buf.buffer = (char *) xmalloc(200);
X+       re_comp_buf.fastmap = (char *) xmalloc(1 << BYTEWIDTH);
X+ #endif
X+       re_comp_buf.allocated = 200;
X      }
X    return re_compile_pattern (s, strlen (s), &re_comp_buf);
X  }
Xdiff -cwbB UNIX/util.c OS2/util.c
X*** UNIX/util.c	Tue Jan 02 23:59:34 1990
X--- OS2/util.c	Tue Jan 02 23:32:44 1990
X***************
X*** 51,57 ****
X       char *arg;
X       char *arg1;
X  {
X!   fprintf (stderr, "%s: ", program);
X    fprintf (stderr, format, arg, arg1);
X    fprintf (stderr, "\n");
X  }
X--- 51,57 ----
X       char *arg;
X       char *arg1;
X  {
X!   fprintf (stderr, "\n%s: ", program);
X    fprintf (stderr, format, arg, arg1);
X    fprintf (stderr, "\n");
X  }
X***************
X*** 129,134 ****
X--- 129,135 ----
X    strcat (name, " ");
X    strcat (name, name1);
X
X+ #if !defined(MSDOS)
X    if (paginate_flag)
X      {
X        int pipes[2];
X***************
X*** 161,166 ****
X--- 162,168 ----
X  	}
X      }
X    else
X+ #endif
X      {
X
X        /* If -l was not specified, output the diff straight to `stdout'.  */
X***************
X*** 185,191 ****
X--- 187,195 ----
X    if (outfile != stdout)
X      {
X        fclose (outfile);
X+ #if !defined(MSDOS)
X        wait (0);
X+ #endif
X      }
X  }
X  
SHAR_EOF
chmod 0640 patches.os2 || echo "restore of patches.os2 fails"
exit 0