www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/1996/03/29/21:21:01

Date: Fri, 29 Mar 1996 21:13:41 -0500
From: dj (DJ Delorie)
Message-Id: <199603300213.VAA21760@delorie.com>
To: djgpp-workers
Subject: [Broeker AT physik DOT rwth-aachen DOT de: Re: offer: improvements to patch.exe]

Comments, anyone?  These claim to handle .orig and .rej files better
than the existing one.

From: Broeker AT physik DOT rwth-aachen DOT de
Subject: Re: offer: improvements to patch.exe
To: dj AT delorie DOT com (DJ Delorie)
Date: Fri, 29 Mar 1996 18:01:02 +0100 (MET)
In-Reply-To: <199603280324 DOT WAA27385 AT delorie DOT com> from "DJ Delorie" at Mar 27, 96 10:24:08 pm
X-Mailer: ELM [version 2.4 PL23]
Content-Type: text
Content-Length: 9582      

(For the context: I had offered changes to fix patch.exe)
> 
> 
> Please make diffs against the sources djgpp uses, as we made a lot of
> changes to make reject and backup files work.  I do recursive patches
> all the time.

OK. So here they are. This time I built the changes relative to the
DJGPP sources (pat21s.zip, dated Feb 5, 1996). I also ran configure
before generating the diffs, so there's a makefile and generated
config.h in the patch set this time.

Feel free to do with these whatever you want to.

(BTW, are you interested in experiences I made with the pentium-optimized
version of gcc272, as done by the 'pentium compiler group'?)

Hans-Bernhard Broeker (Aachen, Germany)

P.S.: sorry if the DOS-style line ends below bother you. I thought I
had run dtou over the sources before building the diffs, but that
seems to have been a false assumption.

diff -ubr patch-2.1.dj/config.h patch-2.1.hbb/config.h
--- patch-2.1.dj/config.h	Sat Nov 25 01:27:18 1995
+++ patch-2.1.hbb/config.h	Fri Mar 29 17:43:02 1996
@@ -1,5 +1,56 @@
-#include <sys/config.h>
+/* config.h.  Generated automatically by configure.  */
+/* Portability variables.  -*- C -*- */
 
+/* Define if the system does not support the `const' keyword.  */
+/* #undef const */
+
+/* Define if the system supports file names longer than 14 characters.  */
+/* #undef HAVE_LONG_FILE_NAMES */
+
+/* Define if the system has pathconf().  */
+#define HAVE_PATHCONF 1
+
+/* Define if the system has strerror().  */
+#define HAVE_STRERROR 1
+
+/* Define if the system has ANSI C header files and library functions.  */
+#define STDC_HEADERS 1
+
+/* Define if the system uses strchr instead of index
+   and strrchr instead of rindex.  */
+#define HAVE_STRING_H 1
+
+#if defined(STDC_HEADERS) || defined(HAVE_STRING_H)
+#define index strchr
+#define rindex strrchr
+#endif
+
+/* Define if the system has unistd.h.  */
+#define HAVE_UNISTD_H 1
+
+/* Define if the system has fcntl.h.  */
+#define HAVE_FCNTL_H 1
+
+/* Define as either int or void -- the type that signal handlers return.  */
+#define RETSIGTYPE void
+
+#ifndef RETSIGTYPE
+#define RETSIGTYPE void
+#endif
+
+/*  Which directory library header to use.  */
+#define DIRENT 1			/* dirent.h */
+/* #undef SYSNDIR */			/* sys/ndir.h */
+/* #undef SYSDIR */			/* sys/dir.h */
+/* #undef NDIR */			/* ndir.h */
+#define NODIR 1			/* none -- don't make numbered backup files */
+
+/* Define if the system lets you pass fewer arguments to a function
+   than the function actually accepts (in the absence of a prototype).
+   Defining it makes I/O calls slightly more efficient.
+   You need not bother defining it unless your C preprocessor chokes on
+   multi-line arguments to macros.  */
+/* #undef CANVARARG */
 
 /* Define Reg* as either `register' or nothing, depending on whether
    the C compiler pays attention to this many register declarations.
Only in patch-2.1.dj: configh.dos
Only in patch-2.1.dj: configur.bat
diff -ubr patch-2.1.dj/configur.in patch-2.1.hbb/configur.in
--- patch-2.1.dj/configur.in	Mon May 31 19:39:02 1993
+++ patch-2.1.hbb/configur.in	Fri Mar 29 17:43:02 1996
@@ -1,6 +1,6 @@
 dnl Process this file with autoconf to produce a configure script.
 AC_INIT(patch.c)
-AC_CONFIG_HEADER(config.h)
+AC_CONFIG_HEADER(config.h:config.h-in)
 AC_PROG_CC
 AC_PROG_CPP
 AC_AIX
diff -ubr patch-2.1.dj/makefile patch-2.1.hbb/makefile
--- patch-2.1.dj/makefile	Sat Nov 25 01:27:18 1995
+++ patch-2.1.hbb/makefile	Fri Mar 29 17:43:03 1996
@@ -1,15 +1,15 @@
+# Generated automatically from Makefile.in by configure.
 # Makefile for GNU patch.
 
 #### Start of system configuration section. ####
 
 srcdir = .
-VPATH = .
 
 CC = gcc
 
-INSTALL = @INSTALL@
-INSTALL_PROGRAM = @INSTALL_PROGRAM@
-INSTALL_DATA = @INSTALL_DATA@
+INSTALL = install.exe
+INSTALL_PROGRAM = ${INSTALL}
+INSTALL_DATA = ${INSTALL} -m 644
 
 LIBS = 
 
@@ -22,7 +22,7 @@
 bindir = $(exec_prefix)/bin
 
 # Where to put the manual pages.
-mandir = $(prefix)/man/man1
+mandir = ${prefix}/man/man1
 # Extension (not including `.') for the manual page filenames.
 manext = 1
 
@@ -40,31 +40,33 @@
 	configure configure.in config.h.in patch.man
 DISTFILES = $(MISC) $(SRCS) $(HDRS)
 
-all: patch
+all: patch.exe
 
 .c.o:
 	$(CC) -c -DHAVE_CONFIG_H -I. $(CPPFLAGS) $(CFLAGS) $<
 
-patch: $(OBJS)
+patch.exe: $(OBJS)
 	$(CC) $(LDFLAGS) $(OBJS) $(LIBS) -o $@
 
 install: all
-	$(INSTALL_PROGRAM) patch $(bindir)/patch
+	-$(INSTALL) -d $(bindir)
+	-$(INSTALL) -d $(mandir)
+	$(INSTALL_PROGRAM) patch.exe $(bindir)/patch.exe
 	-$(INSTALL_DATA) $(srcdir)/patch.man $(mandir)/patch.$(manext)
 
 uninstall:
-	rm -f $(bindir)/patch $(mandir)/patch.$(manext)
+	rm -f $(bindir)/patch.exe $(mandir)/patch.$(manext)
 
 TAGS: $(SRCS)
 	etags $(SRCS)
 
 clean:
-	rm -f patch *.o core
+	rm -f patch.exe *.o core
 
 mostlyclean: clean
 
 distclean: clean
-	rm -f Makefile config.status config.h
+	rm -f Makefile config.status config.h config.cache config.log
 
 realclean: distclean
 	rm -f TAGS
diff -ubr patch-2.1.dj/makefile.in patch-2.1.hbb/makefile.in
--- patch-2.1.dj/makefile.in	Fri Jun 11 04:25:46 1993
+++ patch-2.1.hbb/makefile.in	Fri Mar 29 17:43:03 1996
@@ -16,13 +16,13 @@
 CFLAGS = -g
 LDFLAGS = -g
 
-prefix = /usr/local
+prefix = @prefix@
 exec_prefix = $(prefix)
 
 bindir = $(exec_prefix)/bin
 
 # Where to put the manual pages.
-mandir = $(prefix)/man/man1
+mandir = @mandir@/man1
 # Extension (not including `.') for the manual page filenames.
 manext = 1
 
@@ -40,31 +40,33 @@
 	configure configure.in config.h.in patch.man
 DISTFILES = $(MISC) $(SRCS) $(HDRS)
 
-all: patch
+all: patch.exe
 
 .c.o:
 	$(CC) -c -DHAVE_CONFIG_H -I. $(CPPFLAGS) $(CFLAGS) $<
 
-patch: $(OBJS)
+patch.exe: $(OBJS)
 	$(CC) $(LDFLAGS) $(OBJS) $(LIBS) -o $@
 
 install: all
-	$(INSTALL_PROGRAM) patch $(bindir)/patch
+	-$(INSTALL) -d $(bindir)
+	-$(INSTALL) -d $(mandir)
+	$(INSTALL_PROGRAM) patch.exe $(bindir)/patch.exe
 	-$(INSTALL_DATA) $(srcdir)/patch.man $(mandir)/patch.$(manext)
 
 uninstall:
-	rm -f $(bindir)/patch $(mandir)/patch.$(manext)
+	rm -f $(bindir)/patch.exe $(mandir)/patch.$(manext)
 
 TAGS: $(SRCS)
 	etags $(SRCS)
 
 clean:
-	rm -f patch *.o core
+	rm -f patch.exe *.o core
 
 mostlyclean: clean
 
 distclean: clean
-	rm -f Makefile config.status config.h
+	rm -f Makefile config.status config.h config.cache config.log
 
 realclean: distclean
 	rm -f TAGS
diff -ubr patch-2.1.dj/patch.c patch-2.1.hbb/patch.c
--- patch-2.1.dj/patch.c	Sat Nov 25 01:25:08 1995
+++ patch-2.1.hbb/patch.c	Fri Mar 29 17:43:04 1996
@@ -153,6 +153,12 @@
       int tmpname_len;
 
       tmpdir = getenv ("TMPDIR");
+#ifdef __MSDOS__ /* HBB: even if TMPDIR isn't defined, TMP or TEMP often is */
+      if (!tmpdir)
+      	tmpdir = getenv ("TMP");
+      if (!tmpdir)
+      	tmpdir = getenv ("TEMP");
+#endif
       if (tmpdir == NULL) {
 	tmpdir = "/tmp";
       }
@@ -160,22 +166,38 @@
 
       TMPOUTNAME = (char *) malloc (tmpname_len);
       strcpy (TMPOUTNAME, tmpdir);
+#ifdef __MSDOS__ /* HBB: the 8.3 limit strikes back... */
+      strcat (TMPOUTNAME, "/poXXXXXX");
+#else
       strcat (TMPOUTNAME, "/patchoXXXXXX");
+#endif
       Mktemp(TMPOUTNAME);
 
       TMPINNAME = (char *) malloc (tmpname_len);
       strcpy (TMPINNAME, tmpdir);
+#ifdef __MSDOS__
+      strcat (TMPINNAME, "/piXXXXXX");
+#else
       strcat (TMPINNAME, "/patchiXXXXXX");
+#endif
       Mktemp(TMPINNAME);
 
       TMPREJNAME = (char *) malloc (tmpname_len);
       strcpy (TMPREJNAME, tmpdir);
+#ifdef __MSDOS__
+      strcat (TMPREJNAME, "/prXXXXXX");
+#else
       strcat (TMPREJNAME, "/patchrXXXXXX");
+#endif
       Mktemp(TMPREJNAME);
 
       TMPPATNAME = (char *) malloc (tmpname_len);
       strcpy (TMPPATNAME, tmpdir);
+#ifdef __MSDOS__
+      strcat (TMPPATNAME, "/ppXXXXXX");
+#else
       strcat (TMPPATNAME, "/patchpXXXXXX");
+#endif
       Mktemp(TMPPATNAME);
     }
 
@@ -377,7 +399,23 @@
 	    failtotal += failed;
 	    if (!*rejname) {
 		Strcpy(rejname, outname);
+#ifdef __MSDOS__ /* HBB */
+/*
+ * if you have a three-letter extension, the source file gets
+ * silently hosed, so put the # at the beginning
+ * And if there's a pathname in it, you have to keep that!
+ */
+                {
+                  char *p=rejname+strlen(rejname);
+                  while (p>=rejname && *p != '/') {
+                    p[1]=p[0];
+                    p--;
+                  }
+                  p[1]='#';
+                }
+#else /* __MSDOS__ */
 		addext(rejname, ".rej", '#');
+#endif
 	    }
 	    if (skip_rest_of_patch) {
 		say4("%d out of %d hunks ignored--saving rejects to %s\n",
diff -ubr patch-2.1.dj/util.c patch-2.1.hbb/util.c
--- patch-2.1.dj/util.c	Sat Nov 25 01:25:14 1995
+++ patch-2.1.hbb/util.c	Fri Mar 29 17:43:05 1996
@@ -62,9 +62,22 @@
 #else /* NODIR */
 #ifdef __MSDOS__
 	/* if you have a three-letter extension, the source file gets
-	   silently hosed, so put the ~ a the beginning */
+	   silently hosed, so put the ~ at the beginning */
+	/* HBB: BUT, if there's a pathname in it, you have to keep that! */
+#if 1 	/* HBB's version */
+	Strcpy(bakname,to);
+        {
+          char *p=bakname+strlen(bakname);
+          while (p>=bakname && *p != '/') {
+            p[1]=p[0];
+            p--;
+          }
+          p[1]='~';
+        }
+#else /* DJ's previous version: */
     	Strcpy(bakname, simple_backup_suffix);
 	Strcat(bakname, to);
+#endif
 #else /* __MSDOS__ */
 	Strcpy(bakname, to);
     	Strcat(bakname, simple_backup_suffix);


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019