Date: Thu, 25 Apr 1996 12:19:37 +0200 (IST) From: Eli Zaretskii To: DJ Delorie Cc: djgpp-workers AT delorie DOT com, Broeker AT physik DOT rwth-aachen DOT de Subject: Re: [Broeker AT physik DOT rwth-aachen DOT de: Re: offer: improvements to patch.exe] In-Reply-To: <199603300213.VAA21760@delorie.com> Message-Id: Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII On Fri, 29 Mar 1996, DJ Delorie wrote: > Comments, anyone? These claim to handle .orig and .rej files better > than the existing one. It *is* better. (I only applied the patches to sources, didn't try the patches to configure and Makefile.) I tested this with a complicated patch to Texinfo, and a long patch to Emacs which I knew would fail in some places (because the diffs were taken relative to old sources). The patched version passed the test with flying colors, correctly creating reject file where it should. The original version failed to create reject file (it tried to create it with a name that's illegal under DOS) and also eat up the first character of some files when producing backup files (e.g., the backup for "makefile.dj" would be called "akefile.dj~"). I suggest to also apply the following simple patch. It isn't strictly required to have a working program, but it's nice to end up in the same directory when `patch' finishes, even if you give -d switch. There is also a couple of patches to `patch' posted lately to bug-gnu-utils that I think should be applied when the new port is built. If anybody wants, I can mail those additional patches. *** patch-2.1/patch.c~1 Sat Apr 20 16:30:04 1996 --- patch-2.1/patch.c Wed Apr 24 16:42:24 1996 *************** *** 123,128 **** --- 123,133 ---- /* TRUE if -R was specified on command line. */ static int reverse_flag_specified = FALSE; + #ifdef __MSDOS__ + /* Remember where we started to end up there. */ + static char *origwd; + #endif + /* Apply a set of diffs as appropriate. */ int *************** *** 430,435 **** --- 435,445 ---- } set_signals(1); } + #ifdef __MSDOS__ + /* In case -d was given, return to where we started. */ + if (origwd) + chdir (origwd); + #endif my_exit(failtotal); } *************** *** 535,540 **** --- 545,553 ---- diff_type = CONTEXT_DIFF; break; case 'd': + #ifdef __MSDOS__ + origwd = getcwd (0, FILENAME_MAX); + #endif if (chdir(optarg) < 0) pfatal2("can't cd to %s", optarg); break;