* Sync comment with code's reality.
[dragonfly.git] / contrib / patch / ChangeLog
1 1997-08-31  Paul Eggert  <eggert@twinsun.com>
2
3         * configure.in (VERSION): Version 2.5 released.
4
5 1997-07-21  Paul Eggert  <eggert@twinsun.com>
6
7         * configure.in (VERSION): Bump to 2.4.4.
8         * pch.c (there_is_another_patch), NEWS: Report an error if the patch
9         input contains garbage but no patches.
10
11         * pch.c (open_patch_file):
12         Check for patch file too long (i.e., its size
13         doesn't fit in a `long', and LFS isn't available).
14
15         * inp.c (plan_a):
16         Cast malloc return value, in case malloc returns char *.
17
18 1997-07-16  Paul Eggert  <eggert@twinsun.com>
19
20         * configure.in (VERSION): Bump to 2.4.3.
21
22         * NEWS, patch.man, pch.c (intuit_diff_type, get_line, pget_line):
23         Now demangles RFC 934 encapsulation.
24         * pch.c (p_rfc934_nesting): New var.
25
26         * pch.c (intuit_diff_type): Don't bother to check file names carefully
27         if we're going to return NO_DIFF.
28
29         * inp.c (plan_a): Count the number of lines before allocating
30         pointer-to-line buffer; this reduces memory requirements
31         considerably (roughly by a factor of 5 on 32-bit hosts).
32         Decrease `size' only when read unexpectedly reports EOF.
33         (i_buffer): New var.
34         (too_many_lines): New fn.
35         (re_input): Free i_buffer if using plan A.
36         Free buffers unconditionally; they can't be zero.
37
38         * inp.c (plan_a, plan_b): Check for overflow of line counter.
39
40         * pch.c (malformed), util.h (memory_fatal, read_fatal, write_fatal):
41         Declare as noreturn.
42
43 1997-07-10  Paul Eggert  <eggert@twinsun.com>
44
45         * configure.in (VERSION): Bump to 2.4.2.
46
47         * util.c (ok_to_reverse), NEWS: The default answer is now `n';
48         this is better for Emacs.
49
50         * Makefile.in (dist): Use cp -p, not ln;
51         some hosts do the wrong thing with ln if the source is a symbolic link.
52
53         * patch.man: Fix typo: -y -> -Y.
54
55 1997-07-05  Paul Eggert  <eggert@twinsun.com>
56
57         * configure.in (VERSION): Bump to 2.4.1.
58
59         * patch.c: (main, get_some_switches), NEWS, patch.man:
60         Version control is now independent of whether backups are made.
61         * patch.c (option_help): Put version control options together.
62         (get_some_switches): With CVS 1.9 hack, treat -b foo like -b -z foo,
63         not just -z foo.  This change is needed due to recent change in -z.
64         * backupfile.c (find_backup_file_name):
65         backup_type == none causes undefined behavior;
66         this undoes the previous change to this file.
67
68         * patch.c (locate_hunk): Fix bug when locating context diff hunks
69         near end of file with nonzero fuzz.
70
71         * util.c (move_file): Don't assume that ENOENT is reported when both
72         ENOENT and EXDEV apply; this isn't true with DJGPP, and
73         Posix doesn't require it.
74
75         * pch.c (there_is_another_patch):
76         Suggest -p when we can't intuit a file.
77
78 1997-06-19  Paul Eggert  <eggert@twinsun.com>
79
80         * configure.in (VERSION): Version 2.4 released.
81         * NEWS: Patch is now verbose when patches do not match exactly.
82
83 1997-06-17  Paul Eggert  <eggert@twinsun.com>
84
85         * pc/djgpp/configure.sed (config.h): Remove redundant $(srcdir).
86
87         * configure.in (VERSION): Bump to 2.3.9.
88         * patch.c (main): By default, warn about hunks that succeed
89         with nonzero offset.
90         * patch.man: Add LC_ALL=C advice for making patches.
91         * pc/djgpp/configure.sed (config.h): Fix paths to dependent files.
92
93 1997-06-17  Paul Eggert  <eggert@twinsun.com>
94
95         * configure.in (VERSION): Bump to 2.3.8.
96
97         * pch.c (open_patch_file): Test stdin for fseekability.
98         (intuit_diff_type): Missing context diff headers are now warnings,
99         not errors; some people use patches with them (e.g. when retrying
100         rejects).
101
102         * patch.c (struct outstate):
103         New type, collecting together some output state vars.
104         (apply_hunk, copy_till, spew_output, init_output): Use it.
105         Keep track of whether some output has been generated.
106         (backup_if_mismatch): New var.
107         (ofp): Remove, in favor of local struct outstate vars.
108         (main): Use struct outstate.  Initialize backup_if_mismatch to
109         be the inverse of posixly_correct.  Keep track of whether mismatches
110         occur, and use this to implement backup_if_mismatch.
111         Report files that are not empty after patching, but should be.
112         (longopts, option_help, get_some_switches): New options
113         --backup-if-mismatch, --no-backup-if-mismatch.
114         (get_some_switches): -B, -Y, -z no longer set backup_type.
115         * backupfile.c (find_backup_file_name):
116         Treat backup_type == none like simple.
117
118         * Makefile.in (CONFIG_HDRS):
119         Remove var; no longer needed by djgpp port.
120         (DISTFILES_PC_DJGPP): Rename pc/djgpp/config.sed to
121         pc/djgpp/configure.sed; remove pc/djgpp/config.h in favor of
122         new file that edits it, called pc/djgpp/config.sed.
123         * pc/djgpp/configure.bat: Rename config.sed to configure.sed.
124         * pc/djgpp/configure.sed (CONFIG_HDRS): Remove.
125         (config.h): Add rule to build this from config.hin and
126         pc/djgpp/config.sed.
127         * pc/djgpp/config.sed:
128         Convert from .h file to .sed script that generates .h file.
129
130         * NEWS: Describe --backup-if-mismatch, --no-backup-if-mismatch.
131         * patch.man:
132         Describe new options --backup-if-mismatch, --no-backup-if-mismatch
133         and their ramifications.  Use unreadable backup to represent
134         nonexistent file.
135
136 1997-06-12  Paul Eggert  <eggert@twinsun.com>
137
138         * configure.in (VERSION): Bump to 2.3.7.
139         (AC_CHECK_FUNCS): Add `raise'.
140
141         * Makefile.in (inp.o): No longer depends on quotearg.h.
142
143         * common.h (outfile): New decl (was private var named `output').
144         (invc): New decl.
145         (GENERIC_OBJECT): Renamed from VOID.
146         (NULL_DEVICE, TTY_DEVICE): New macros.
147
148         * patch.c (output): Remove; renamed to `outfile' and moved to common.h.
149         (main): `failed' is count, not boolean.
150         Say "Skipping patch." when deciding to skip patch.
151         (get_some_switches): Set invc when setting inname.
152
153         * inp.c: Do not include <quotearg.h>.
154         (SCCSPREFIX, GET, GET_LOCKED, SCCSDIFF1, SCCSDIFF2, SCCSDIFF3,
155         RCSSUFFIX, CHECKOUT, CHECKOUT_LOCKED, RCSDIFF1, RCSDIFF2):
156         Move to util.c.
157         (get_input_file): Invoke new functions version_controller and
158         version_get to simplify this code.
159         (plan_b): "/dev/tty" -> NULL_DEVICE
160
161         * pch.h (pch_timestamp): New decl.
162         * pch.c (p_timestamp): New var; takes over from global timestamp array.
163         (pch_timestamp): New function to export p_timestamp.
164         (there_is_another_patch): Use blander wording when you can't intuit
165         the file name.
166         Say "Skipping patch." when deciding to skip patch.
167         (intuit_diff_type): Look for version-controlled but nonexistent files
168         when intuiting file names; set invc accordingly.
169         Ignore Index: line if either old or new line is present, and if
170         POSIXLY_CORRECT is not set.
171         (do_ed_script): Flush stdout before invoking popen, since it may
172         send output to stdout.
173
174         * util.h (version_controller, version_get): New decls.
175         * util.c: Include <quotearg.h> earlier.
176         (raise): New macro, if ! HAVE_RAISE.
177         (move_file): Create empty unreadable file when backing up a nonexistent
178         file.
179         (DEV_NULL): New constant.
180         (SCCSPREFIX, GET. GET_LOCKED, SCCSDIFF1, SCCSDIFF2,
181         RCSSUFFIX, CHECKOUT, CHECKOUT_LOCKED, RCSDIFF1): Moved here from inp.c.
182         (version_controller, version_get): New functions.
183         (ask): Look only at /dev/tty for answers; and when standard output is
184         not a terminal and ! posixly_correct, don't even look there.
185         Remove unnecessary fflushes of stdout.
186         (ok_to_reverse): Say "Skipping patch." when deciding to skip patch..
187         (sigs): SIGPIPE might not be defined.
188         (exit_with_signal): Use `raise' instead of `kill'.
189         (systemic): fflush stdout before invoking subsidiary command.
190
191         * patch.man: Document recent changes.
192         Add "COMPATIBILITY ISSUES" section.
193
194         * NEWS: New COMPATIBILITY ISSUES for man page.
195         Changed verbosity when fuzz is found.
196         File name intuition is changed, again.
197         Backups are made unreadable when the file did not exist.
198
199         * pc/djgpp/config.h (HAVE_STRUCT_UTIMBUF): Define.
200         (HAVE_RAISE): New macro.
201         (HAVE_UTIME_H): Define.
202         (TZ_is_unset): Do not define; it's not a serious problem with `patch'
203         to have TZ be unset in DOS.
204
205 1997-06-08  Paul Eggert  <eggert@twinsun.com>
206
207         * configure.in (VERSION): Bump to 2.3.6.
208         (AC_CHECK_HEADERS): Add utime.h.
209         * acconfig.h, configure.in, pc/djgpp/config.h (HAVE_STRUCT_UTIMBUF):
210         New macro.
211         * pc/djgpp/config.h (HAVE_UTIME_H, TZ_is_unset): New macros.
212
213         * NEWS, patch.man: Describe new -Z, -T options, new numeric
214         option for -G, retired -G, and more verbose default behavior
215         with fuzz.
216
217         * pch.c (intuit_diff_type): Record times reported for files in headers.
218         Remove head_says_nonexistent[x], since it's now equivalent to
219         !timestamp[x].
220         * util.h (fetchname): Change argument head_says_nonexistent to
221         timestamp.
222         * util.c: #include <partime.h> for TM_LOCAL_ZONE.
223         Don't include <time.h> since common.h now includes it.
224         (ok_to_reverse): noreverse and batch cases now output regardless of
225         verbosity.
226         (fetchname): Change argument head_says_nonexistent to pstamp, and
227         store header timestamp into *pstamp.
228         If -T or -Z option is given, match time stamps more precisely.
229         (ask): Remove unnecessary close of ttyfd.
230         When there is no terminal at all, output a newline to make the
231         output look nicer.  After reporting EOF, flush stdout;
232         when an input error, report the error type.
233
234         * inp.c (get_input_file):
235         Ask user whether to get file if patch_get is negative.
236
237         * Makefile.in (clean): Don't clean */*.o; clean core* and *core.
238
239 1997-06-04  Paul Eggert  <eggert@twinsun.com>
240
241         * configure.in (VERSION): Bump to 2.3.5.
242
243         * util.c (ok_to_reverse):
244         Be less chatty if verbosity is SILENT and we don't
245         have to ask the user.  If force is nonzero, apply the patch anyway.
246
247         * pch.c (there_is_another_patch):
248         Before skipping rest of patch, skip to
249         the patch start, so that another_hunk can skip it properly.
250         (intuit_diff_type): Slight wording change for missing headers, to
251         regularize with other diagnostics.  Fix off-by-one error when setting
252         p_input_line when scanning the first hunk to check for deleted files.
253
254 1997-06-03  Paul Eggert  <eggert@twinsun.com>
255
256         * configure.in (VERSION): Bump to 2.3.4.
257
258         * NEWS: Now matches more generously against nonexistent or empty files.
259
260         * pch.c (there_is_another_patch): Move warning about not being
261         able to intuit file names here from skip_to.
262         (intuit_diff_type): Fatal error if we find a headless unified
263         or context diff.
264
265         * util.c (ask): Null-terminate buffer properly even if it grew.
266         (fetchname): No need to test for null first argument.
267
268 1997-06-02  Paul Eggert  <eggert@twinsun.com>
269
270         * configure.in (VERSION): Bump to 2.3.3.
271         * pch.c (p_says_nonexistent, pch_says_nonexistent): Is now 1 for empty,
272         2 for nonexistent.
273         (intuit_diff_type): Set p_says_nonexistent according to new meaning.
274         Treat empty files like nonexistent files when reversing.
275         (skip_to): Output better diagnostic when we can't intuit a file name.
276         * patch.c (main):
277         Count bytes, not lines, when testing whether a file is empty,
278         since it may contain only non-newline chars.
279         pch_says_nonexistent now returns 2 for nonexistent files.
280
281 1997-06-01  Paul Eggert  <eggert@twinsun.com>
282
283         * configure.in (VERSION): Bump to 2.3.2.
284         * pch.c (open_patch_file):
285         Fix bug when computing size of patch read from a pipe.
286
287 1997-05-30  Paul Eggert  <eggert@twinsun.com>
288
289         * configure.in (VERSION): Bump to 2.3.1.
290
291         * Makefile.in (transform, patch_name): New vars,
292         for proper implementation of AC_ARG_PROGRAM.
293         (install, uninstall): Use them.
294         (install-strip): New rule.
295         * pc/djgpp/config.sed (program_transform_name): Set to empty.
296
297 1997-05-30  Paul Eggert  <eggert@twinsun.com>
298
299         * configure.in (VERSION), NEWS: Version 2.3 released.
300         * patch.man: Fix two font typos.
301         * util.c (doprogram): Fix misspelled decl.
302
303 1997-05-26  Paul Eggert  <eggert@twinsun.com>
304
305         * configure.in (VERSION): Bump to 2.2.93.
306
307         * pch.c (open_patch_file):
308         Fatal error if binary_transput and stdin is a tty.
309
310         * pc/djgpp/config.sed (chdirsaf.c):
311         Use sed instead of cp, since cp might not be installed.
312         * pc/djgpp/configure.bat:
313         Prepend %srcdir% to pathname of config.sed, for crosscompiles.
314
315 1997-05-25  Paul Eggert  <eggert@twinsun.com>
316
317         * configure.in (VERSION): Bump to 2.2.92.
318         (D_INO_IN_DIRENT): New macro.
319         * pc/djgpp/config.h, acconfig.h (D_INO_IN_DIRENT): New macro.
320         * backupfile.c (REAL_DIR_ENTRY):
321         Depend on D_INO_IN_DIRENT, not _POSIX_VERSION.
322
323         * addext.c (addext): Adjust slen when adjusting s for DOS 8.3 limit.
324         Do not use xxx.h -> xxxh~ hack.
325
326         * util.c: (move_file): Avoid makedirs test when possible even
327         if FILESYSTEM_PREFIX_LEN (p) is nonzero.  Don't play
328         case-changing tricks to come up with backup file name; it's
329         not portable to case-insensitive file systems.
330         * common.h (ISLOWER): Remove.
331
332         * inp.c (scan_input): Don't use Plan A if (debug & 16).
333
334         * patch.c (shortopts): Add -g, -G.
335         (longopts): --help now maps to 132, not 'h', to avoid confusion.
336         (get_some_switches): Likewise.
337         Don't invoke setmode on input if --binary; wait until needed.
338         Don't ever invoke setmode on stdout.
339         * pch.c (open_patch_file): Setmode stdin to binary if binary_transput.
340
341         * patch.man: Fix documentation of backup file name to match behavior.
342         Add advice for ordering of patches of derived files.
343         Add /dev/tty to list of files used.
344         * README: Adjust instructions for building on DOS.
345         * pc/djgpp/README: Remove tentative wording.
346         * NEWS: The DOS port is now tested.
347         Backup file names are no longer computed by switching case.
348
349         * pc/chdirsaf.c (ERANGE): Include <errno.h> to define it.
350         (restore_wd): chdir unconditionally.
351         (chdir_safer): Invoke atexit successfully at most once.
352         * pc/djgpp/config.sed: Use chdirsaf.o, not pc/chdirsaf.o.
353         Replace CONFIG_HDRS, don't append.
354         Use $(srcdir) in CONFIG_STATUS.
355         Don't apply $(SHELL) to $(CONFIG_STATUS).
356         Append rules for chdirsaf.o, chdirsaf.c; clean chdirsaf.c at the end.
357         * pc/djgpp/configure.bat: Append CR to each line; DOS needs this.
358         Don't use | as sed s delimiter; DOS can't handle it.
359
360 1997-05-21  Paul Eggert  <eggert@twinsun.com>
361
362         * configure.in (VERSION): Bump to 2.2.91.
363
364         * pch.c (another_hunk):
365         Fix bug with computing size of prefix and suffix context
366         with ordinary context diffs.  Report malformed patch if a unified diff
367         has nothing but context.
368
369         * inp.c (get_input_file):
370         Use patch_get, not backup_type, to decide whether to
371         get from RCS or SCCS.  Use the word `get' in diagnostics.
372         * patch.c (main): Initialize patch_get from PATCH_GET.
373         Omit DEFAULT_VERSION_CONTROL hook; it just leads to nonstandarization.
374         (longopts, option_help, get_some_switches): Add support for -g, -G.
375         (option_help): Add bug report address.
376         * common.h (patch_get): New decl.
377         * patch.man: Add -g and -G options; use `get' instead of `check out'.
378         Add PATCH_GET.  Recommend -Naur instead of -raNU2 for diff.
379         * NEWS: Describe -g, -G, PATCH_GET.
380
381         * version.c (copyright_string): Use only most recent copyright year,
382         as per GNU standards.
383
384         * Makefile.in (DISTFILES_PC): Remove pc/quotearg.c.
385         * pc/djgpp/config.sed: Remove unnecessary hooks for quotearg and SHELL.
386
387 1997-05-18  Paul Eggert  <eggert@twinsun.com>
388
389         * configure.in (VERSION): Increase to 2.2.9.
390         (AC_TYPE_MODE_T): Add.
391
392         * pch.h (another_hunk): New parameter REV.
393         * pch.c (hunkmax): Now of type LINENUM.
394         (malformed): Add decl.
395         (there_is_another_patch): Skip inname-detection if skip_rest_of_patch.
396         (intuit_diff_type): To determine whether file appears to have been
397         deleted, look at replacement, not pattern.
398         If there is a mismatch between existence of file and whether the
399         patch claims to change whether the file exists, ask whether to
400         reverse the patch.
401         (another_hunk): New parameter REV specifying whether to reverse the
402         hunk.  All callers changed.
403         (do_ed_script): Add assertion to ensure input file exists.
404
405         * util.h (create_file): New function.
406         (copy_file): Now takes mode, not struct stat.
407         (makedirs): No longer exported.
408         (move_file): Now takes mode, not struct stat.
409         * util.c (makedirs): No longer exported.
410         (move_file): Accept mode of destination, not struct stat.
411         All callers changed.
412         Quote file names in diagnostics.
413         Create parent dir of destination if necessary.
414         Don't use ENOTDIR.
415         Don't unlink source; it will be unlinked later.
416         Unlink destination if FROM is zero.
417         (create_file): New function.
418         (copy_file): Accept mode of destination, not struct stat.
419         All callers changed.
420         Use create_file to create file.
421         (ok_to_reverse): Moved here from patch.c.  Now accepts format and args;
422         all callers changed.
423         (mkdir): 2nd arg is now mode_t, for better compatibility.
424         (replace_slashes): Ignore slashes at the end of the filename.
425
426         * common.h (noreverse): New decl.
427         (ok_to_reverse): Remove decl.
428
429         * patch.c (noreverse): Now extern.
430         (main): New environment var PATCH_VERSION_CONTROL overrides VERSION_CONTROL.
431         Don't assert(hunk) if we're skipping the patch; we may not have any hunks.
432         When removing a file, back it up if backups are desired.
433         Don't chmod output file if input file did not exist.
434         chmod rej file to input file's mode minus executable bits.
435         (locate_hunk): Go back to old way of a single fuzz parameter, but
436         handle it more precisely: context diffs with partial contexts
437         can only match file ends, since the partial context can occur
438         only at the start or end of file.
439         All callers changed.
440         (create_output_file): Use create_file to create files.
441         (ok_to_reverse): Move to util.c.
442
443         * inp.c (scan_input, get_input_file): Quote file names in diagnostics.
444         (get_input_file): Set inerrno if it's not already set.
445         Don't create file; it's now the caller's responsibility.
446         (plan_b): Use /dev/null if input size is zero, since it might not exist.
447         Use create_file to create temporary file.
448
449         * NEWS: Add PATCH_VERSION_CONTROL; DOS port is untested.
450
451         * pc/djgpp/config.h: Add comment for mode_t.
452
453         * pc/djgpp/README: Note that it's not tested.
454
455         * patch.man: PATCH_VERSION_CONTROL overrides VERSION_CONTROL.
456
457 1997-05-15  Paul Eggert  <eggert@twinsun.com>
458
459         * configure.in: Add AC_PREREQ(2.12).
460         (VERSION): Bump to 2.2.8.
461         (ed_PROGRAM): Rename from ED_PROGRAM.
462
463         * pch.c (prefix_components): Support DOS file names better.
464         Fix typo that caused fn to almost always yield 0.
465
466         * util.c (<time.h>, <maketime.h>): Include.
467         (move_file, copy_file): Add support for DOS filenames.
468         Preserve mode of input files when creating temp files.
469         Add binary file support.
470         (doprogram, rmdir): New functions.
471         (mkdir): Use doprogram.
472         (replace_slashes): Add support for DOS filenames.
473         (removedirs): New function.
474         (init_time)): New function.
475         (initial_time): New var.
476         (fetchname): Add support for deleted files, DOS filenames.
477
478         * basename.c (FILESYSTEM_PREFIX_LEN, ISSLASH):
479         New macros, for DOS port.
480         (base_name): Use them.
481
482         * addext.c (HAVE_DOS_FILE_NAMES): New macro.
483         <limits.h>: Include if HAVE_LIMITS_H.
484         (addext): Handle hosts with DOS file name limits.
485
486         * common.h (LONG_MIN): New macro.
487         (FILESYSTEM_PREFIX_LEN, ISSLASH): New macros, for DOS port.
488         (ok_to_create_file): Remove.
489         (reverse): Now int.
490         (ok_to_reverse): New function decl.
491         (O_WRONLY, _O_BINARY, O_BINARY, O_CREAT, O_TRUNC): New macros.
492         (binary_transput): New var decl.
493
494         * Makefile.in (ed_PROGRAM): Renamed from ED_PROGRAM.
495         (CONFIG_HDRS, CONFIG_STATUS): New vars.
496         (SRCS): Add maketime.c, partime.c.
497         (OBJS): Likewise.
498         (HDRS): Add maketime.h, partime.h.
499         (DISTFILES_PC, DISTFILES_PC_DJGPP): New vars.
500         (Makefile, config.status): Use CONFIG_STATUS, not config.status.
501         (clean): Remove */*.o.
502         (dist): Add pc and pc/djgpp subdirectories.
503         ($(OBJS)): Depend on $(CONFIG_HDRS) instead of config.h.
504         (maketime.o, partime.o): New rules.
505         (util.o): Depend on maketime.h.
506
507         * patch.c (main):
508         Call init_time.  Add DEFAULT_VERSION_CONTROL hook for people who
509         prefer the old ways.  Build temp file names before we might invoke cleanup.
510         Add support for deleted files and clean up the patch-swapping code a bit.
511         Delete empty ancestors of deleted files.
512         When creating temporaries, use file modes of original files.
513         (longopts, get_some_switches): New option --binary.
514         (get_some_switches): Report non-errno errors with `fatal', not `pfatal'.
515         (create_output_file): New function, which preserves modes of original files
516         and supports binary transput.
517         (init_output, init_reject): Use it.
518         (ok_to_reverse): New function.
519         (TMPDIR): New macro.
520         (make_temp): Use $TMPDIR, $TMP, $TEMP, or TMPDIR, whichever comes first.
521
522         * pch.c (p_says_nonexistent): New var.
523         (open_patch_file): Add binary transput support.
524         Apply stat to file names retrieved from user.
525         Reject them if they don't exist.
526         (intuit_diff_type): Add support for deleting files.
527         Don't treat trivial directories any differently.
528         Avoid stating the same file twice in common case of context diffs.
529         (prefix_components): Don't treat trivial directories any differently.
530         Add support for DOS filenames.
531         (pch_says_nonexistent): New function.
532         (do_ed_script): Preserve mode of input files when creating temp files.
533         Add support for binary transput.
534
535         * pch.h (pch_says_nonexistent): New decl.
536
537         * util.h (replace_slashes): No longer exported.
538         (fetchname): Add support for deleted files.
539         (copy_file, move_file): Add support for preserving file modes.
540         (init_time, removedirs): New functions.
541
542         * argmatch.c: Converge with fileutils.
543
544         * backupfile.c: Converge with fileutils.
545         (find_backup_file_name): Treat .~N~ suffix just like any other suffix
546         when handling file names that are too long.
547
548         * inp.c:
549         In messages, put quotes around file names and spaces around "--".
550         (get_input_file): Allow files to be deleted.  Do the expense of
551         makedirs only if we can't create the file.
552         (plan_a, plan_b): Add support for binary transput.
553
554         * pc/chdirsaf.c, pc/djgpp/README, pc/djgpp/config.h, pc/djgpp/config.sed, pc/djgpp/configure.bat, pc/quotearg.c:
555         New file.
556
557         * NEWS:
558         New methods for removing files; adjust file name intuition again.
559         Add description of MS-DOS and MS-Windows ports.
560
561         * patch.man:
562         Simplify file name intuition slightly (no distinction for trivial dirs).
563         Add --binary.  Describe how files and directories are deleted.
564         Suggest diff -a.  Include caveats about what context diffs cannot represent.
565
566 1997-05-06  Paul Eggert  <eggert@twinsun.com>
567
568         * configure.in (VERSION): Now 2.2.7.
569         (CPPFLAGS, LDFLAGS, LIBS): If the user has not set any of these vars,
570         prefer support for large files if available.
571
572         * common.h (_LARGEFILE_SOURCE): Define.
573         (file_offset): New typedef.
574         (file_seek, file_tell): New macros.
575
576         * patch.c (main):
577         Remove empty files by default unless POSIXLY_CORRECT is set.
578
579         * util.c, util.h (Fseek):
580         Use file_offset instead of long, for portability to large-file hosts.
581
582         * pch.c: (p_base, p_start, next_intuit_at, skip_to, open_patch_file,
583         intuit_diff_type, another_hunk, incomplete_line, do_ed_script):
584         Use file_offset instead of long, for portability to large-file hosts.
585         (prefix_components): Renamed from path_name_components; count only
586         nontrivial prefix components, and take a 2nd EXISTING arg.
587         (existing_prefix_components): Remove; subsumed by prefix_components.
588         (intuit_diff_type): When creating files, try for the creation of the
589         fewest directories.
590
591         * configure.in (VERSION): Now 2.2.6.
592
593         * pch.c (existing_prefix_components): New function.
594         (intuit_diff_type): When creating a file, use a name whose existing
595         directory prefix contains the most nontrivial path name components.
596         (best_name): Don't check for null 2nd arg.
597
598         * util.h (replace_slashes): New decl.
599
600         * util.c (replace_slashes): Now external.
601         (fetchname): Don't assume chars are nonnegative.
602
603         * patch.man:
604         When creating a file, use a name whose existing directory prefix
605         contains the most nontrivial path name components.
606         Add advice for creating patches and applying them.
607
608 1997-05-06  Paul Eggert  <eggert@twinsun.com>
609
610         * configure.in (VERSION): Now 2.2.6.
611
612         * pch.c (existing_prefix_components): New function.
613         (intuit_diff_type): When creating a file, use a name whose existing
614         directory prefix contains the most nontrivial path name components.
615         (best_name): Don't check for null 2nd arg.
616
617         * util.h (replace_slashes): New decl.
618         * util.c (replace_slashes): Now external.
619         (fetchname): Don't assume chars are nonnegative.
620
621         * patch.man:  Describe above change to pch.c.
622         Add advice for creating patches and applying them.
623
624 1997-05-05  Paul Eggert  <eggert@twinsun.com>
625
626         * configure.in (VERSION): Update to 2.2.5.
627
628         * quotearg.h, quotearg.c: New files.
629         * Makefile.in (SRCS, OBJS, HDRS): Mention new files.
630         (inp.o, util.o): Now depends on quotearg.h.
631         (quotearg.o): New makefile rule.
632
633         * common.h (posixly_correct): New var.
634         * patch.c (main): Initialize it.
635         If ! posixly_correct, default backup type is now `existing'.
636         SIMPLE_BACKUP_SUFFIX no longer affects backup type.
637         (backup): Remove var.
638
639         * util.h: (countdirs): Remove.
640         (systemic): New decl.
641         * util.c (move_file): Try making the parent directory of TO
642         if backup prefix or suffix contain a slash.
643         (ask): Remove arbitrary limit on size of result.
644         (systemic): New function.
645         (mkdir): Work even if arg contains shell metacharacters.
646         (replace_slashes): Return 0 if none were replaced.
647         Don't replace slash after . or .. since it's redundant.
648         (countdirs): Remove.
649         (makedirs): Ignore mkdir failures.
650
651         * NEWS, patch.man: More POSIXLY_CORRECT adjustments.
652         Describe new rules for how file names are intuited.
653
654 1997-04-17  Paul Eggert  <eggert@twinsun.com>
655
656         * configure.in (VERSION): Version 2.2 released.
657
658         * Makefile.in (config.hin):
659         Remove before building; we always want the timestamp updated.
660
661         * inp.c (get_input_file):
662         Look for RCS files only if backup_type == numbered_existing.
663
664         * NEWS, patch.man:
665         Remove mention of never-implemented -V rcs and -V sccs options.
666         * patch.man: `pathname' -> `file name'
667         Correct the description of how file names are found in diff headers.
668         Clarify the distinction between ordinary and unified context diffs.
669
670 1997-04-13  Paul Eggert  <eggert@twinsun.com>
671
672         * configure.in (VERSION): Update to 2.1.7.
673
674         * patch.c (numeric_optarg): New function.
675         (get_some_switches): Use it.
676
677         * pch.c (intuit_diff_type): When creating a file, prefer a name whose
678         existing dir prefix is the longest.
679
680         * util.h (countdirs): New function.
681         * util.c (replace_slashes, countdirs): New functions.
682         (makedirs): Use replace_slashes, to be more like countdirs.
683
684         * patch.man: Explain -pN vs -p N.  Recommend --new-file.
685         Explain possible incompatibility with strip count.
686
687 1997-04-10  Paul Eggert  <eggert@twinsun.com>
688
689         * configure.in (VERSION): Bump to 2.1.6.
690         (AC_CHECK_HEADERS): Remove stdlib.h (i.e. remove HAVE_STDLIB_H).
691
692         * Makefile.in: (HDRS, patchlevel.h, TAGS, distclean, maintainer-clean):
693         Don't distribute patchlevel.h; let the user do it.
694         This works around some obscure (possibly nonexistent?) `make' bugs.
695
696         * common.h (program_name): extern, not XTERN.
697         (<stdlib.h>): Include if STDC_HEADERS, not if HAVE_STDLIB_H.
698         (atol, getenv, malloc, realloc): Don't worry whether they're #defined.
699
700         * patch.c (get_some_switches):
701         Add special hack for backwards compatibility with CVS 1.9.
702         (-B, -Y, -z): Now set backup_type = simple.
703
704         * NEWS: Fix misspellings; minor reformatting.
705         * README: Report POSIX.2 compliance.
706
707 1997-04-06  Paul Eggert  <eggert@twinsun.com>
708
709         Move all old RCS $Log entries into ChangeLog.
710         #include all files with < >, not " ".
711
712         * addext.c, argmatch.c, argmatch.h, memchr.c, install-sh:
713         New files.
714         * EXTERN.h, INTERN.h: Removed.
715         * config.hin: Renamed from config.h.in.
716
717         * acconfig.h (NODIR): Remove.
718         (HAVE_MEMCHR): Add.
719
720         * configure.in (AC_ARG_PROGRAM, AC_PROG_MAKE_SET, HAVE_MEMCHR): Add.
721         (AC_CHECK_HEADERS): Replaces obsolescent AC_HAVE_HEADERS.
722         Add stdlib.h, string.h, unistd.h, varargs.h.
723         Delete obsolete call to AC_UNISTD_H.
724         (AC_CONFIG_HEADER): Rename config.h.in to config.hin.
725         (AC_C_CONST): Replaces obsolescent AC_CONST.
726         (AC_CHECK_FUNC): Check for getopt_long; define LIBOBJS and substitute
727         for it accordingly.
728         (AC_CHECK_FUNCS): Replaces obsolescent AC_HAVE_FUNCS.
729         Add _doprintf, isascii, mktemp, sigaction, sigprocmask, sigsetmask.
730         Remove strerror.
731         (AC_FUNC_CLOSEDIR_VOID, AC_FUNC_VPRINTF): Add.
732         (AC_HEADER_DIRENT): Replaces obsolescent AC_DIR_HEADER.
733         (AC_HEADER_STDC): Replaces obsolescent AC_STDC_HEADERS.
734         (AC_SYS_LONG_FILE_NAMES): Replaces obsolescent AC_LONG_FILE_NAMES.
735         (AC_TYPE_OFF_T): Replaces obsolescent AC_OFF_T.
736         (AC_TYPE_SIGNAL): Replaces obsolescent AC_RETSIGTYPE.
737         (AC_TYPE_SIZE_T): Replaces obsolescent AC_SIZE_T.
738         (AC_XENIX_DIR): Remove.
739         (ED_PROGRAM): New var.
740         (NODIR): Remove.
741         (PACKAGE, VERSION): New vars; substitute them with AC_SUBST.
742
743         * Makefile.in: Conform to current GNU build standards.
744         Redo dependencies.  Use library getopt_long if available.
745         Use `&&' instead of `;' inside shell commands where applicable;
746         GNU make requires this.
747         Use double-colon rules for actions that do not build files.
748         (@SET_MAKE@): Added.
749         (CFLAGS, LDFLAGS, prefix, exec_prefix): Base on @ versions of symbols.
750         (COMPILE, CPPFLAGS, DEFS, ED_PROGRAM, LIBOBJS, LIBSRCS, PACKAGE,
751         VERSION): New symbols.
752         (SRCS, OBJS, HDRS, MISC): Add new files.
753         (man1dir): Renamed from mandir.
754         (man1ext): Renamed from manext.
755         (patch): Put -o first.
756         (install): Use $(transform) to allow program to be renamed by configure.
757         (patchlevel.h): Build from $(VERSION).
758         (dist): Get version number from $(VERSION) and package name from
759         $(PACKAGE).
760         (TAGS): Scan $(HDRS).
761         (maintainer-clean): Renamed from realclean.  Remove patchlevel.h.
762
763         * backupfile.h (simple_backup_suffix): Now const *.
764         (find_backup_file_name, base_name, get_version): Args are now const *.
765         (base_name): New decl.
766         * backupfile.c (<config.h>): Include only if HAVE_CONFIG_H.
767         (<argmatch.h>): Include.
768         (<string.h>): Include if HAVE_STRING_H, not if STDC_HEADERS.
769         (<strings.h>): Include if !HAVE_STRING_H.
770         (<unistd.h>): Do not include.
771         (<dirent.h>): Redo include as per current autoconf standards.
772         (<limits.h>): Include if HAVE_LIMITS_H. Define CHAR_BIT if not defined.
773         (NLENGTH): Now returns size_t.
774         (CLOSEDIR, INT_STRLEN_BOUND): New macros.
775         (ISDIGIT): Use faster method.
776         (find_backup_file_name): No longer depends on NODIR.
777         Remove redundant code.
778         (make_version_name): Remove; do it more portably.
779         (max_backup_version): Args are now const *.
780         (version_number): Simplify digit checking.
781         (basename, concat, dirname): Remove.
782         (argmatch, invalid_arg): Move to argmatch.c.  Simplify test for
783         ambiguous args.  When reporting an error, use program_name not "patch".
784         (addext): Move to addext.c.  Treat all negative values from pathconf
785         like -1.  Always use long extension if it fits, even if the filesystem
786         does not support long file names.
787         (backup_types): Now const.
788
789         * common.h, inp.h (XTERN): Renamed from EXT to avoid collision
790         with errno.h reserved name space.
791
792         * common.h (DEBUGGING): Now an integer; default is 1.
793         (enum diff): New type.
794         (diff_type): Use it instead of small integers.
795         (CONTEXT_DIFF, NORMAL_DIFF, ED_DIFF, NEW_CONTEXT_DIFF, UNI_DIFF):
796         Now enumerated values instead of macros.
797         (NO_DIFF): New enumerated value (used instead of 0).
798         (volatile): Default to the empty string if __STDC__ is not defined.
799         (<signal.h>): Do not include.
800         (Chmod, Close, Fclose, Fflush, Fputc, Signal, Sprintf, Strcat,
801         Strcpy, Unlink, Write): Remove these macros; casts to void are
802         not needed for GNU coding standards.
803         (INITHUNKMAX): Move to pch.c.
804         (malloc, realloc, INT_MIN, MAXLINELEN, strNE, strnNE,
805         Reg1, Reg2, Reg3, Reg4, Reg5, Reg6, Reg7, Reg8, Reg9, Reg10, Reg11,
806         Reg12, Reg13, Reg14, Reg15, Reg16): Remove these macros.
807         (S_IXOTH, S_IWOTH, S_IROTH, S_IXGRP, S_IWGRP,
808         S_IRGRP, S_IXUSR, S_IWUSR, S_IRUSR, O_RDONLY, O_RDWR):
809         Define these macros, if not defined.
810         (CTYPE_DOMAIN, ISLOWER, ISSPACE, ISDIGIT, PARAMS): New macros.
811         (instat): Renamed from filestat; used for input file now.
812         (bufsize, using_plan_a, debug, strippath): Not statically initialized.
813         (debug): #define to 0 if not DEBUGGING, so that users of `debug'
814         no longer need to be surrounded by `#if DEBUGGING'.
815         (out_of_mem, filec, filearg, outname, toutkeep, trejkeep): Remove.
816         (inname, inerrno, dry_run, origbase): New variables.
817         (origprae): Now const*.
818         (TMPOUTNAME, TMPINNAME, TMPPATNAME): Now const*volatile.
819         (verbosity): New variable; subsumes `verbose'.
820         (DEFAULT_VERBOSITY, SILENT, VERBOSE): Values in a new enum.
821         (verbose): Removed.
822         (VOID): Use `#ifdef __STDC__' instead of`#if __STDC__',
823         for consistency elsewhere.
824         (__attribute__): New macro (empty if not a recent GCC).
825         (fatal_exit): Renamed from my_exit.
826         (errno): Don't define if STDC_HEADERS.
827         (<string.h>): Include if either STDC_HEADERS or HAVE_STRING_H.
828         (memcmp, memcpy): Define if !STDC_HEADERS && !HAVE_STRING_H
829         && !HAVE_MEMCHR.
830         (<stdlib.h>): Include if HAVE_STDLIB_H, not if STDC_HEADERS.
831         (atol, getenv, malloc, realloc, lseek): Declare only if not defined
832         as a macro.
833         (popen, strcpy, strcat, mktemp): Do not declare.
834         (lseek): Declare to yield off_t, not long.
835         (<fcntl.h>): Include only if HAVE_FCNTL_H.
836
837         * inp.h (get_input_file): New decl.
838         * inp.c (SCCSPREFIX, GET, GET_LOCKED, SCCSDIFF, RCSSUFFIX, CHECKOUT,
839         CHECKOUT_LOCKED, RCSDIFF): Moved here from common.h.
840         (i_ptr): Now char const **.
841         (i_size): Remove.
842         (TIBUFSIZE_MINIMUM): Define only if not already defined.
843         (plan_a, plan_b): Arg is now const *.
844         (report_revision): Declare before use.  It's now the caller's
845         responsibility to test whether revision is 0.
846         (scan_input, report_revision, get_input_file):
847         Be less chatty unless --verbose.
848         (get_input_file): New function, split off from plan_a.
849         Reuse file status gotten by pch if possible.  Allow for dry run.
850         Use POSIX bits for creat, not number.  Check for creation and
851         close failure, and use fstat not stat.  Use memcpy not strncpy.
852         (plan_a): Rewrite for speed.
853         Caller now assigns result to using_plan_a.
854         Don't bother reading empty files; during dry runs they might not exist.
855         Use ISSPACE, not isspace.
856         (plan_b): Allow for dry runs.  Use ISSPACE, and handle sign extension
857         correctly on arg.  Use POSIX symbol for open arg.
858
859         * patch.c (backup, output, patchname, program_name): New vars.
860         (last_frozen_line): Moved here from inp.h.
861         (TMPREJNAME): Moved here from common.h.
862         (optind_last): Removed.
863         (do_defines, if_defined, not_defined, else_defined, end_defined):
864         Now char const.  Prepend with \n (except for not_defined) to
865         allow for files ending in non-newline.
866         (Argv): Now char*const*.
867         (main, get_some_switches): Exit status 0 means success,
868         1 means hunks were rejected, 2 means trouble.
869         (main, locate_hunk, patch_match): Keep track of patch prefix context
870         separately from suffix context; this fixes several bugs.
871         (main): Initialize bufsize, strippath.
872         Be less chatty unless --verbose.
873         No more NODIR; always have version control available.
874         Require environment variables to be nonempty to have effect.
875         Add support for --dry-run, --output, --verbose.
876         Invoke get_input_file first, before deciding among do_ed_script,
877         plan_a, or plan_b.
878         Clear ofp after closing it, to keep discipline that ofp is either
879         0 or open, to avoid file descriptor leaks.  Conversely, rejfp doesn't
880         need this trick since static analysis is enough to show when it
881         needs to be closed.
882         Don't allow file-creation patches to be applied to existing files.
883         Misordered hunks are now not fatal errors; just go on to the next file.
884         It's a fatal error to fall back on plan B when --output is given,
885         since the moving hand has writ.
886         Add support for binary files.
887         Check for I/O errors.
888         chmod output file ourselves, rather than letting move_file do it;
889         this saves global state.
890         Use better grammar when outputting hunks messages, e.g. avoid
891         `1 hunks'.
892         (main, reinitialize_almost_everything):
893         Remove support for multiple file arguments.
894         Move get_some_switches call from reinitialize_almost_everything
895         to main.
896         (reinitialize_almost_everything): No need to reinitialize things
897         that are no longer global variables, e.g. outname.
898         (shortopts): Remove leading "-"; it's no longer important to
899         return options and arguments in order.  '-b' no longer takes operand.
900         -p's operand is no longer optional.  Add -i, -Y, -z.  Remove -S.
901         (longopts): --suffix is now pared with -z, not -b.  --backup now
902         means -b.  Add --input, --basename-prefix, --dry-run, --verbose.
903         Remove --skip.  --strip's operand is now required.
904         (option_help): New variable.  Use style of current coding standards.
905         Change to match current option set.
906         (usage): Use it.
907         (get_some_switches): Get all switches, since `+' is defunct.
908         New options -i, -Y, -z, --verbose, --dry-run.
909         Option -S removed.
910         -b now means backup (backup_type == simple), not simple_backup_suffix.
911         -B now implies backup, and requires nonempty operand.
912         -D no longer requires first char of argument to be an identifier.
913         `-o -' is now disallowed (formerly output to regular file named "-").
914         -p operand is now required.
915         -v no longer needs to cleanup (no temp files can exist at that point).
916         -V now implies backup.
917         Set inname, patchname from file name arguments, if any;
918         do not set filearg.  It's now an error if extra operands are given.
919         (abort_junk): Check for write errors in reject file.
920         (apply_hunk, copy_till): Return error flag, so that failure to apply
921         out-of-order hunk is no longer fatal.
922         (apply_hunk): New arg after_newline,
923         for patching files not ending in newline.
924         Cache ofp for speed.  Check for write errors.
925         (OUTSIDE, IN_IFNDEF, IN_IFDEF, IN_ELSE): Now part of an enumerated type
926         instead of being #defined to small integers.
927         Change while-do to do-while when copying !-part for R_do_defines,
928         since condition is always true the first time through the loop.
929         (init_output, init_reject): Arg is now const *.
930         (copy_till, spew_output): Do not insert ``missing'' newlines;
931         propagate them via new after_newline argument.
932         (spew_output): Nothing to copy if last_frozen_line == input lines.
933         Do not close (ofp) if it's null.
934         (dump_line): Remove.
935         (similar): Ignore presence or absence of trailing newlines.
936         Check for only ' ' or '\t', not isspace (as per POSIX.2).
937         (make_temp): Use tmpnam if mktemp is not available.
938         (cleanup): New function.
939         (fatal_exit): Use it.  Renamed from my_exit.
940         Take signal to exit with, not exit status (which is now always 2).
941
942         * pch.h, pch.c (pch_prefix_context, pch_suffix_context):
943         New fns replacing pch_context.
944         (another_hunk): Now yields int, not bool; -1 means out of memory.
945         Now takes difftype as argument.
946         (pch_write_line): Now returns boolean indicating whether we're after
947         a newline just after the write, for supporting non-text files.
948         * pch.c (isdigit): Remove; use ISDIGIT instead.
949         (INITHUNKMAX): Moved here from common.h.
950         (p_context): Removed.  We need to keep track of the pre- and post-
951         context separately, in:
952         (p_prefix_context, p_suffix_context): New variables.
953         (bestguess): Remove.
954         (open_patch_file): Arg is now char const *.
955         Copy file a buffer at a time, not a char at a time, for speed.
956         (grow_hunkmax): Now returns success indicator.
957         (there_is_another_patch, skip_to, another_hunk, do_ed_script):
958         Be less chatty unless --verbose.
959         (there_is_another_patch):
960         Avoid infinite loop if user input keeps yielding EOF.
961         (intuit_diff_type): New returns enum diff, not int.
962         Strip paths as they're being fetched.
963         Set ok_to_create_file correctly even if patch is reversed.
964         Set up file names correctly with unidiff output.
965         Use algorithm specified by POSIX 1003.2b/D11 to deduce
966         name of file to patch, with the exception of patches
967         that can create files.
968         (skip_to): Be verbose if !inname, since we're about to ask the
969         user for a file name and the context will help the user choose.
970         (another_hunk): Keep context as LINENUM, not int.
971         If the replacement is missing, calculate its context correctly.
972         Don't assume input ends in newline.
973         Keep track of patch prefix context separately from suffix context;
974         this fixes several bugs.
975         Don't assume blank lines got chopped if the replacement is missing.
976         Report poorly-formed hunks instead of aborting.
977         Do not use strcpy on overlapping strings; it's not portable.
978         Work even if lines are incomplete.
979         Fix bugs associated with context-less context hunks,
980         particularly when patching in reverse.
981         (pget_line): Now takes just 1 arg; instead of second arg,
982         just examine using_plan_a global.  Return -1 if we ran out
983         of memory.
984         (do_ed_script): Now takes output FILE * argument.
985         Take name of editor from ED_PROGRAM instead of hardwiring /bin/ed.
986         Don't bother unlinking TMPOUTNAME.
987         Check for popen failure.
988         Flush pipe to check for output errors.
989         If ofp is nonzero, copy result to it, instead of trying to
990         move the result.
991
992         * util.h, util.c (say1, say2, say3, say4, fatal1, fatal2, fatal3,
993         fatal4, pfatal1, pfatal2, pfatal3, pfatal4, ask1, ask2, ask3, ask4):
994         Remove; replaced with following.
995         (ask, say, fatal, pfatal): New stdarg functions.
996         (fetchname): Remove last, `assume_exists' parameter.
997         (savebuf, savestr, move_file, copy_file): Args are now const *.
998         (exit_with_signal): New function, for proper process status if
999         a signal is received as per POSIX.2.
1000         (basename): Rename to `base_name' and move to backupfile.
1001         * util.c (<signal.h>): Include here, not in common.h.
1002         (vararg_start): New macro.
1003         (va_dcl, va_start, va_arg, va_end): Define if neither <stdarg.h>
1004         nor <varargs.h> are available.
1005         (SIGCHLD): Define to SIGCLD if SIGCLD is defined and
1006         SIGCHLD isn't.
1007         (private_strerror): Remove.
1008         (move_file): Remove option of moving to stdout.
1009         Add support for -Y, -z.
1010         Don't assume chars in file name are nonnegative.
1011         Use copy_file if rename fails due to EXDEV;
1012         report failure if rename fails for any other reason.
1013         (copy_file, makedirs): Use POSIX symbols for permissions.
1014         (copy_file): Open source before destination.
1015         (remove_prefix): New function.
1016         (vfprintf): New function, if !HAVE_VPRINTF.
1017         (afatal, apfatal, zfatal, zpfatal, errnum): Remove.
1018         (fatal, pfatal, say): New functions that use stdarg.
1019         All callers changed.
1020         (zask): Renamed from `ask'.  Now uses stdarg.  Output to stdout,
1021         and read from /dev/tty, or if that cannot be opened, from
1022         stderr, stdout, stdin, whichever is first a tty.
1023         Print "EOF" when an EOF is read.  Do not echo input.
1024         (sigs): New array.
1025         (sigset_t, sigemptyset, sigmask, sigaddset, sigismember, SIG_BLOCK,
1026         SIG_UNBLOCK, SIG_SETMASK, sigprocmask, sigblock, sigsetmask):
1027         Define substitutes if not available.
1028         (initial_signal_mask, signals_to_block): New vars.
1029         (fatal_exit_handler): New function, if !HAVE_SIGACTION.
1030         (set_signals, ignore_signals): Use sigaction and sigprocmask style
1031         signal-handling if possible; it doesn't lose signals.
1032         (set_signals): Default SIGCHLD to work around SysV fork+wait bug.
1033         (mkdir): First arg is now const *.
1034         (makedirs): Handle multiple adjacent slashes correctly.
1035         (fetchname): Do not worry about whether the file exists
1036         (that is now the caller's responsibility).
1037         Treat a sequence of one or more slashes like one slash.
1038         Do not unstrip leading directories if they all exist and if
1039         no -p option was given; POSIX doesn't allow this.
1040         (memcmp): Remove (now a macro in common.h).
1041
1042         * version.c (copyright_string, free_software_msgid, authorship_msgid):
1043         New constants.
1044         (version): Use them.  Use program_name instead of hardwiring it.
1045
1046         * patch.man: Generate date from RCS Id.
1047         Rewrite to match the above changes.
1048
1049 Fri Jul 30 02:02:51 1993  Paul Eggert  (eggert@twinsun.com)
1050
1051         * configure.in (AC_HAVE_FUNCS): Add mkdir.
1052
1053         * common.h (Chmod, Fputc, Write, VOID): New macros.
1054         (malloc, realloc): Yield `VOID *', not `char *'.
1055
1056         * util.h (makedirs): Omit `striplast' argument.  Remove `aask'.
1057
1058         * inp.c (plan_a): Remove fixed internal buffer.  Remove lint.
1059
1060         * util.c (set_signals, ignore_signals): Trap SIGTERM, too.
1061         (makedirs): Removed fixed internal buffer.  Omit `striplast' argument.
1062         (mkdir): New function, if !HAVE_MKDIR.
1063         (fetchname): Remove fixed internal buffer.
1064         Remove lint from various functions.
1065
1066         * patch.c, pch.c: Remove lint.
1067
1068 Thu Jul 29 20:52:07 1993  David J. MacKenzie  (djm@wookumz.gnu.ai.mit.edu)
1069
1070         * Makefile.in (config.status): Run config.status --recheck, not
1071         configure, to get the right args passed.
1072
1073 Thu Jul 29 07:46:16 1993  Paul Eggert  (eggert@twinsun.com)
1074
1075         * The following changes remove all remaining fixed limits on memory,
1076         and fix bugs in patch's handling of null bytes and files that do not
1077         end in newline.  `Patch' now works on binary files.
1078
1079         * backupfile.c (find_backup_file_name): Don't dump core if malloc fails.
1080
1081         * EXTERN.h, INTERN.h (EXITING): New macro.
1082         * backupfile.[ch], patch.c, pch.c: Add PARAMS to function declarations.
1083
1084         * common.h (bool): Change to int, so ANSI C prototype promotion works.
1085         (CANVARARG): Remove varargs hack; it wasn't portable.
1086         (filearg): Now a pointer, not an array, so that it can be reallocated.
1087         (GET*, SCCSDIFF, CHECKOUT*, RCSDIFF): Quote operands to commands.
1088         (my_exit): Declare here.
1089         (BUFFERSIZE, Ctl, filemode, Fseek, Fstat, Lseek, MAXFILEC, MAXHUNKSIZE,
1090         Mktemp, myuid, Null, Nullch, Nullfp, Nulline, Pclose, VOIDUSED): Remove.
1091         All invokers changed.
1092         (Argc, Argv, *define[sd], last_offset, maxfuzz, noreverse, ofp,
1093         optind_last, rejfp, rejname): No longer externally visible; all
1094         definers changed.
1095         (INT_MAX, INT_MIN, STD*_FILENO, SEEK_SET): Define if the underlying
1096         system doesn't.  Include <limits.h> for this.
1097
1098         * configure.in: Add limits.h, memcmp.  Delete getline.
1099
1100         * inp.c (tibufsize): New variable; buffers grow as needed.
1101         (TIBUFSIZE_MINIMUM): New macro.
1102         (report_revision): New function.
1103         (plan_a): Do not search patch as a big string, since that fails
1104         if it contains null bytes.
1105         Prepend `./' to filenames starting with `-', for RCS and SCCS.
1106         If file does not match default RCS/SCCS version, go ahead and patch
1107         it anyway; warn about the problem but do not report a fatal error.
1108         (plan_b): Do not use a fixed buffer to read lines; read byte by byte
1109         instead, so that the lines can be arbitrarily long.  Do not search
1110         lines as strings, since they may contain null bytes.
1111         (plan_a, plan_b): Report I/O errors.
1112
1113         * inp.c, inp.h (rev_in_string): Remove.
1114         (ifetch): Yield size of line too, since strlen no longer applies.
1115         (plan_a, plan_b): No longer exported.
1116
1117         * patch.c (abort_hunk, apply_hunk, patch_match, similar):
1118         Lines may contain NUL and need not end in newline.
1119         (copy_till, dump_line): Insert newline if appending after partial line.
1120         All invokers changed.
1121         (main, get_some_switches, apply_hunk): Allocate *_define[ds], filearg,
1122         rejname dynamically.
1123         (make_temp): New function.
1124         (main): Use it.
1125         (main, spew_output, dump_line) Check for I/O errors.
1126
1127         * pch.c (open_patch_file): Don't copy stdin to a temporary file if
1128         it's a regular file, since we can seek on it directly.
1129         (open_patch_file, skip_to, another_hunk): The patch file may contain
1130         NULs.
1131         (another_hunk): The patch file may contain lines starting with '\',
1132         which means the preceding line lacked a trailing newline.
1133         (pgetline): Rename to pget_line.
1134         (get_line, incomplete_line, pch_write_line): New functions.
1135         (pch_line_len): Return size_t, not short; lines may be very long.
1136         (do_ed_script): Check for I/O errors.  Allow scripts to contain
1137         'i' and 's' commands, too.
1138
1139         * pch.h (pfp, grow_hunkmax, intuit_diff_type, next_intuit_at, skip_to,
1140         pfetch, pgetline): No longer exported.
1141         (pch_write_line): New declaration.
1142         (getline): Removed.
1143
1144         * util.c (move_file, fetchname): Use private stat buffer, so that
1145         filestat isn't lost.  Check for I/O errors.
1146         (savestr): Use savebuf.
1147         (zask): Use STD*_FILENO instead of 0, 1, 2.
1148         (fetchname): strip_leading defaults to INT_MAX instead of 957 (!).
1149         (memcmp): Define if !HAVE_MEMCMP.
1150
1151         * util.c, util.h (say*, fatal*, pfatal*, ask*): Delete; these
1152         pseudo-varargs functions weren't ANSI C.  Replace by macros
1153         that invoke [fs]printf directly, and invoke new functions
1154         [az]{say,fatal,pfatal,ask} before and after.
1155         (savebuf, read_fatal, write_fatal, memory_fatal, Fseek): New functions.
1156         (fatal*): Output trailing newline after message.  All invokers changed.
1157
1158         * version.c (version): Don't exit.
1159
1160         * Makefile.in (SRCS): Remove getline.c.
1161
1162 Thu Jul 22 15:24:24 1993  David J. MacKenzie  (djm@goldman.gnu.ai.mit.edu)
1163
1164         * EXTERN.h, INTERN.h (PARAMS): Define.
1165         * backupfile.h, common.h, inp.h, pch.h, util.h: Use.
1166         * backupfile.c: Include EXTERN.h.
1167
1168 Wed Jul 21 13:14:05 1993  David J. MacKenzie  (djm@goldman.gnu.ai.mit.edu)
1169
1170         * getline.c: New file.
1171         * configure.in: Check for getline (GNU libc has it).
1172         * pch.c: Use it instead of fgets.
1173         (pgetline): Renamed from pgets.  Change callers.
1174         * pch.h: Change decl.
1175
1176         * pch.c (pgets): Tab adjusts by 8 - (indent % 8), not % 7.
1177         Be consistent with similar code in pch.c::intuit_diff_type.
1178
1179         * common.h (MEM): Typedef removed.
1180         inp.c, pch.c, util.c: Use size_t instead of MEM.
1181         inp.c, pch.c: Use off_t.
1182         configure.in: Add AC_SIZE_T and AC_OFF_T.
1183
1184         * common.h: Make buf a pointer and add a bufsize variable.
1185         * util.c, pch.c, inp.c: Replace sizeof buf with bufsize.
1186         * patch.c: malloc buf to bufsize bytes.
1187
1188 Tue Jul 20 20:40:03 1993  Paul Eggert  (eggert@twinsun.com)
1189
1190         * common.h (BUFFERSIZE): Grow it to 8k too, just in case.
1191         (buf): Turn `buf' back into an array; making it a pointer broke
1192         things seriously.
1193         * patch.c (main): Likewise.
1194
1195 Tue Jul 20 20:02:40 1993  David J. MacKenzie  (djm@goldman.gnu.ai.mit.edu)
1196
1197         * Move Reg[1-16] and CANVARARG decls from config.h.in to common.h.
1198         * acconfig.h: New file.
1199         * Makefile (HDRS): Add it.
1200
1201 Tue Jul 20 16:35:27 1993  Paul Eggert  (eggert@twinsun.com)
1202
1203         * Makefile.in: Remove alloca.[co]; getopt no longer needs it.
1204         * configure.in (AC_ALLOCA): Remove.
1205
1206         * util.c (set_signals, ignore_signals): Do nothing if SIGHUP
1207         and SIGINT aren't defined.
1208
1209 Tue Jul 20 17:59:56 1993  David J. MacKenzie  (djm@goldman.gnu.ai.mit.edu)
1210
1211         * patch.c (main): Call xmalloc, not malloc.  xmalloc buf.
1212         * common.h: Declare xmalloc.  Make buf a pointer, not an array.
1213
1214         * util.c (xmalloc): Call fatal1, not fatal.
1215
1216         * common.h [MAXLINELEN]: Bump from 1k to 8k.
1217
1218 Thu Jul  8 19:56:16 1993  David J. MacKenzie  (djm@goldman.gnu.ai.mit.edu)
1219
1220         * Makefile.in (installdirs): New target.
1221         (install): Use it.
1222         (Makefile, config.status, configure): New targets.
1223
1224 Wed Jul  7 13:25:40 1993  David J. MacKenzie  (djm@goldman.gnu.ai.mit.edu)
1225
1226         * patch.c (get_some_switches, longopts): Recognize --help
1227         option, and call usage.
1228         (usage): New function.
1229
1230 Fri Jun 25 07:49:45 1993  Paul Eggert  (eggert@twinsun.com)
1231
1232         * backupfile.c (find_backup_file_name): Don't use .orig if
1233         numbered_existing with no existing numbered backup.
1234         (addext):  Don't use ext if !HAVE_LONG_FILE_NAMES,
1235         even if it would fit.  This matches patch's historical behavior.
1236         (simple_backup_suffix): Default to ".orig".
1237         * patch.c (main): Just use that default.
1238
1239 Tue Jun 15 22:32:14 1993  Paul Eggert  (eggert@twinsun.com)
1240
1241         * config.h.in (HAVE_ALLOCA_H): This #undef was missing.
1242         * Makefile.in (info, check, installcheck): New rules.
1243
1244 Sun Jun 13 14:31:29 1993  Paul Eggert  (eggert@twinsun.com)
1245
1246         * config.h.in (index, rindex): Remove unused macro
1247         definitions; they get in the way when porting to AIX.
1248         * config.h.in, configure.in (HAVE_STRING_H): Remove unused defn.
1249
1250 Thu Jun 10 21:13:47 1993  Paul Eggert  (eggert@twinsun.com)
1251
1252         * patchlevel.h: PATCH_VERSION 2.1.
1253         (The name `patch-2.0.12g12' is too long for traditional Unix.)
1254
1255         * patchlevel.h (PATCH_VERSION): Renamed from PATCHLEVEL.
1256         Now contains the entire patch version number.
1257         * version.c (version): Use it.
1258
1259 Wed Jun  9 21:43:23 1993  Paul Eggert  (eggert@twinsun.com)
1260
1261         * common.h: Remove declarations of index and rindex.
1262         * backupfile.c: Likewise.
1263         (addext, basename, dirname): Avoid rindex.
1264
1265 Tue Jun  8 15:24:14 1993  Paul Eggert  (eggert@twinsun.com)
1266
1267         * inp.c (plan_a): Check that RCS and working files are not the
1268         same.  This check is needed on hosts that do not report file
1269         name length limits and have short limits.
1270
1271 Sat Jun  5 22:56:07 1993  Paul Eggert  (eggert@twinsun.com)
1272
1273         * Makefile.in (.c.o): Put $(CFLAGS) after other options.
1274         (dist): Switch from .z to .gz.
1275
1276 Wed Jun  2 10:37:15 1993  Paul Eggert  (eggert@twinsun.com)
1277
1278         * backupfile.c (find_backup_file_name): Initialize copy of
1279         file name properly.
1280
1281 Mon May 31 21:55:21 1993  Paul Eggert  (eggert@twinsun.com)
1282
1283         * patchlevel.h: Patch level 12g11.
1284
1285         * pch.c (p_Char): Renamed from p_char, which is a system type
1286         in Tex XD88's <sys/types.h>.
1287
1288         * backupfile.c: Include "config.h" first, so that `const' is
1289         treated consistently in system headers.
1290
1291 Mon May 31 16:06:23 1993  Paul Eggert  (eggert@twinsun.com)
1292
1293         * patchlevel.h: Patch level 12g10.
1294
1295         * configure.in: Add AC_CONST.
1296         * config.h.in: Add `const'.
1297         * Makefile.in (.c.o): Add -DHAVE_CONFIG_H.
1298         (getopt.o getopt1.o): Depend on config.h.
1299
1300         * util.c (xmalloc): New function; alloca.c needs this.
1301
1302 Mon May 31 00:49:40 1993  Paul Eggert  (eggert@twinsun.com)
1303
1304         * patchlevel.h: PATCHLEVEL 12g9.
1305
1306         * backupfile.c, backupfile.h (addext): New function.
1307         It uses pathconf(), if available, to determine maximum file
1308         name length.
1309         * patch.c (main): Use it for reject file name.
1310         * common.h (ORIGEXT): Moved to patch.c.
1311         * config.h.in (HAVE_PATHCONF): New macro.
1312         * configure.in: Define it.
1313
1314         * Makefile.in (dist): Use gzip, not compress.
1315
1316 Sat May 29 09:42:18 1993  Paul Eggert  (eggert@twinsun.com)
1317
1318         * patch.c (main): Use pathconf to decide reject file name.
1319         * common.h (REJEXT): Remove.
1320
1321         * inp.c (plan_a): Don't lock the checked-out file if `patch -o'
1322         redirected the output elsewhere.
1323         * common.h (CHECKOUT_LOCKED, GET_LOCKED): New macros.  GET and
1324         CHECKOUT now just checkout unlocked copies.
1325
1326 Fri May 28 08:44:50 1993  Paul Eggert  (eggert@twinsun.com)
1327
1328         * backupfile.c (basename): Define even if NODIR isn't defined.
1329         * patch.c (main): Ask just once to apply a reversed patch.
1330
1331 Tue Nov 24 08:09:04 1992  David J. MacKenzie  (djm@goldman.gnu.ai.mit.edu)
1332
1333         * config.h.in, common.h: Use HAVE_FCNTL_H and HAVE_STRING_H
1334         instead of USG.
1335
1336         * backupfile.c: Use SYSDIR and NDIR instead of USG.
1337         Define direct as dirent, not vice-versa.
1338
1339 Wed Sep 16 17:11:48 1992  David J. MacKenzie  (djm@nutrimat.gnu.ai.mit.edu)
1340
1341         * patch.c (get_some_switches): optc should be int, not char.
1342
1343 Tue Sep 15 00:36:46 1992  David J. MacKenzie  (djm@nutrimat.gnu.ai.mit.edu)
1344
1345         * patchlevel.h: PATCHLEVEL 12g8.
1346
1347 Mon Sep 14 22:01:23 1992  David J. MacKenzie  (djm@nutrimat.gnu.ai.mit.edu)
1348
1349         * Makefile.in: Add uninstall target.
1350
1351         * util.c (fatal, pfatal): Add some asterisks to make fatal
1352         messages stand out more.
1353
1354 Tue Aug 25 22:13:36 1992  David J. MacKenzie  (djm@nutrimat.gnu.ai.mit.edu)
1355
1356         * patch.c (main, get_some_switches), common.h, inp.c (plan_a,
1357         plan_b), pch.c (there_is_another_patch): Add -t --batch
1358         option, similar to -f --force.
1359
1360 Mon Jul 27 11:27:07 1992  David J. MacKenzie  (djm@nutrimat.gnu.ai.mit.edu)
1361
1362         * common.h: Define SCCSDIFF and RCSDIFF.
1363         * inp.c (plan_a): Use them to make sure it's safe to check out
1364         the default RCS or SCCS version.
1365         From Paul Eggert.
1366
1367 Mon Jul 20 14:10:32 1992  David J. MacKenzie  (djm@nutrimat.gnu.ai.mit.edu)
1368
1369         * util.h: Declare basename.
1370         * inp.c (plan_a), util.c (fetchname): Use it to isolate the
1371         leading path when testing for RCS and SCCS files.
1372
1373 Fri Jul 10 16:03:23 1992  David J. MacKenzie  (djm@nutrimat.gnu.ai.mit.edu)
1374
1375         * util.c (makedirs): Only make the directories that don't exist.
1376         From chip@tct.com (Chip Salzenberg).
1377
1378 Wed Jul  8 01:20:56 1992  David J. MacKenzie  (djm@nutrimat.gnu.ai.mit.edu)
1379
1380         * patch.c (main): Open ofp after checking for ed script.
1381         Close ofp and rejfp before trying plan B.
1382         From epang@sfu.ca (Eugene Pang).
1383
1384         * util.c (fatal, pfatal): Print "patch: " before message.
1385         * pch.c, inp.c, patch.c, util.c: Remove "patch: " from the
1386         callers that had it.
1387
1388         * common.h (myuid): New variable.
1389         * patch.c (main): Initialize it.
1390         * inp.c (myuid): Function removed.
1391         (plan_a): Use the variable, not the function.
1392
1393         * patch.c: Add back -E --remove-empty-files option.
1394
1395 Tue Jul  7 23:19:28 1992  David J. MacKenzie  (djm@nutrimat.gnu.ai.mit.edu)
1396
1397         * inp.c (myuid): New function.
1398         (plan_a): Call it.  Optimize stat calls.  Be smarter about
1399         detecting checked out RCS and SCCS files.
1400         From Paul Eggert (eggert@twinsun.com).
1401
1402         * inp.c, util.c, patch.c: Don't bother checking for stat() > 0.
1403
1404 Mon Jul  6 13:01:52 1992  David J. MacKenzie  (djm@nutrimat.gnu.ai.mit.edu)
1405
1406         * util.c (move_file): Use rename instead of link and copying.
1407
1408         * util.c (pfatal): New function.
1409         * util.h: Declare it and pfatal[1-4] macros.
1410         * various files: Use it instead of fatal where appropriate.
1411
1412         * common.h, patch.c: Replace Arg[cv]_last with optind_last.
1413
1414         * patch.c (main, get_some_switches): Use getopt_long.  Update
1415         usage message.
1416         (nextarg): Function removed.
1417
1418         * Rename FLEXFILENAMES to HAVE_LONG_FILE_NAMES,
1419         VOIDSIG to RETSIGTYPE.
1420
1421         * backupfile.c, common.h: Use STDC header files if available.
1422         backupfile.h: Declare get_version.
1423
1424         * COPYING, COPYING.LIB, INSTALL, Makefile.in, alloca.c,
1425         config.h.in, configure, configure.in, getopt.[ch], getopt1.c,
1426         rename.c: New files.
1427         * Configure, MANIFEST, Makefile.SH, config.H, config.h.SH,
1428         malloc.c: Files removed.
1429
1430         * version.c (version): Don't print the RCS stuff, since we're
1431         not updating it regularly.
1432
1433         * patchlevel.h: PATCHLEVEL 12u7.
1434
1435         * Makefile.SH (dist): New target.
1436         Makedist: File removed.
1437
1438         * inp.c (plan_a): Check whether the user can write to the
1439         file, not whether anyone can write to the file.
1440
1441 Sat Jul  4 00:06:58 1992  David J. MacKenzie  (djm@nutrimat.gnu.ai.mit.edu)
1442
1443         * inp.c (plan_a): Try to check out read-only files from RCS or SCCS.
1444
1445         * util.c (move_file): If backing up by linking fails, try copying.
1446         From cek@sdc.boeing.com (Conrad Kimball).
1447
1448         * patch.c (get_some_switches): Eliminate -E option; always
1449         remove empty output files.
1450
1451         * util.c (fetchname): Only undo slash removal for relative
1452         paths if -p was not given.
1453
1454         * Makefile.sh: Add mostlyclean target.
1455
1456 Fri Jul  3 23:48:14 1992  David J. MacKenzie  (djm@nutrimat.gnu.ai.mit.edu)
1457
1458         * util.c (fetchname): Accept whitespace between `Index:' and filename.
1459         Also plug a small memory leak for diffs against /dev/null.
1460         From eggert@twinsun.com (Paul Eggert).
1461
1462         * common.h: Don't define TRUE and FALSE if already defined.
1463         From phk@data.fls.dk (Poul-Henning Kamp).
1464
1465 Wed Apr 29 10:19:33 1992  David J. MacKenzie  (djm@churchy.gnu.ai.mit.edu)
1466
1467         * backupfile.c (get_version): Exit if given a bad backup type.
1468
1469 Fri Mar 27 09:57:14 1992  Karl Berry  (karl at hayley)
1470
1471         * common.h (S_ISDIR, S_ISREG): define these.
1472         * inp.c (plan_a): use S_ISREG, not S_IFREG.
1473         * util.c (fetchname): use S_ISDIR, not S_IFDIR.
1474
1475 Mon Mar 16 14:10:42 1992  David J. MacKenzie  (djm@wookumz.gnu.ai.mit.edu)
1476
1477         * patchlevel.h: PATCHLEVEL 12u6.
1478
1479 Sat Mar 14 13:13:29 1992  David J. MacKenzie  (djm at frob.eng.umd.edu)
1480
1481         * Configure, config.h.SH: Check for directory header and unistd.h.
1482
1483         * patch.c (main): If -E was given and output file is empty after
1484         patching, remove it.
1485         (get_some_switches): Recognize -E option.
1486
1487         * patch.c (copy_till): Make garbled output an error, not a warning
1488         that doesn't change the exit status.
1489
1490         * common.h: Protect against system declarations of malloc and realloc.
1491
1492         * Makedist: Add backupfile.[ch].
1493
1494         * Configure: Look for C library where NeXT and SVR4 put it.
1495         Look in /usr/ucb after /bin and /usr/bin for utilities,
1496         and look in /usr/ccs/bin, to make SVR4 happier.
1497         Recognize m68k predefine.
1498
1499         * util.c (fetchname): Test of stat return value was backward.
1500         From csss@scheme.cs.ubc.ca.
1501
1502         * version.c (version): Exit with status 0, not 1.
1503
1504         * Makefile.SH: Add backupfile.[cho].
1505         * patch.c (main): Initialize backup file generation.
1506         (get_some_switches): Add -V option.
1507         * common.h, util,c, patch.c: Replace origext with simple_backup_suffix.
1508         * util.c (move_file): Use find_backup_file_name.
1509
1510 Tue Dec  3 11:27:16 1991  David J. MacKenzie  (djm at wookumz.gnu.ai.mit.edu)
1511
1512         * patchlevel.h: PATCHLEVEL 12u5.
1513
1514         * Makefile.SH: Change clean, distclean, and realclean targets a
1515         little so they agree with the GNU coding standards.
1516         Add Makefile to addedbyconf, so distclean removes it.
1517
1518         * Configure: Recognize Domain/OS C library in /lib/libc.
1519         From mmuegel@mot.com (Michael S. Muegel).
1520
1521         * pch.c: Fixes from Wayne Davison:
1522         Patch now accepts no-context context diffs that are
1523         specified with an assumed one line hunk (e.g.  "*** 10 ****").
1524         Fixed a bug in both context and unified diff processing that would
1525         put a zero-context hunk in the wrong place (one line too soon).
1526         Fixed a minor problem with p_max in unified diffs where it would
1527         set p_max to hunkmax unnecessarily (the only adverse effect was to
1528         not supply empty lines at eof by assuming they were truncated).
1529
1530 Tue Jul  2 03:25:51 1991  David J. MacKenzie  (djm at geech.gnu.ai.mit.edu)
1531
1532         * Configure: Check for signal declaration in
1533         /usr/include/sys/signal.h as well as /usr/include/signal.h.
1534
1535         * Configure, common.h, config.h.SH: Comment out the sprintf
1536         declaration and tests to determine its return value type.  It
1537         conflicts with ANSI C systems' prototypes in stdio.h and the
1538         return value of sprintf is never used anyway -- it's always cast
1539         to void.
1540
1541 Thu Jun 27 13:05:32 1991  David J. MacKenzie  (djm at churchy.gnu.ai.mit.edu)
1542
1543         * patchlevel.h: PATCHLEVEL 12u4.
1544
1545 Thu Feb 21 15:18:14 1991  David J. MacKenzie  (djm at geech.ai.mit.edu)
1546
1547         * pch.c (another_hunk): Fix off by 1 error.  From
1548         iverson@xstor.com (Tim Iverson).
1549
1550 Sun Jan 20 20:18:58 1991  David J. MacKenzie  (djm at geech.ai.mit.edu)
1551
1552         * Makefile.SH (all): Don't make a dummy `all' file.
1553
1554         * patchlevel.h: PATCHLEVEL 12u3.
1555
1556         * patch.c (nextarg): New function.
1557         (get_some_switches): Use it, to prevent dereferencing a null
1558         pointer if an option that takes an arg is not given one (is last
1559         on the command line).  From Paul Eggert.
1560
1561         * pch.c (another_hunk): Fix from Wayne Davison to recognize
1562         single-line hunks in unified diffs (with a single line number
1563         instead of a range).
1564
1565         * inp.c (rev_in_string): Don't use `s' before defining it.  From
1566         Wayne Davison.
1567
1568 Mon Jan  7 06:25:11 1991  David J. MacKenzie  (djm at geech.ai.mit.edu)
1569
1570         * patchlevel.h: PATCHLEVEL 12u2.
1571
1572         * pch.c (intuit_diff_type): Recognize `+++' in diff headers, for
1573         unified diff format.  From unidiff patch 1.
1574
1575 Mon Dec  3 00:14:25 1990  David J. MacKenzie  (djm at albert.ai.mit.edu)
1576
1577         * patch.c (get_some_switches): Make the usage message more
1578         informative.
1579
1580 Sun Dec  2 23:20:18 1990  David J. MacKenzie  (djm at albert.ai.mit.edu)
1581
1582         * Configure: When checking for C preprocessor, look for 'abc.*xyz'
1583         instead of 'abc.xyz', so ANSI C preprocessors work.
1584
1585         * Apply fix for -D from ksb@mentor.cc.purdue.edu (Kevin Braunsdorf).
1586
1587 1990-05-01  Wayne Davison  <davison@dri.com>
1588         * patch.c, pch.c: unidiff support added
1589
1590 Wed Mar  7 23:47:25 1990  Jim Kingdon  (kingdon at pogo.ai.mit.edu)
1591
1592         * pch.c: Call malformed instead of goto malformed
1593         (just allows easier debugging).
1594
1595 Tue Jan 23 21:27:00 1990  Jim Kingdon  (kingdon at pogo.ai.mit.edu)
1596
1597         * common.h (TMP*NAME): Make these char *, not char [].
1598         patch.c (main): Use TMPDIR (if present) to set TMP*NAME.
1599         common.h: Declare getenv.
1600
1601 Sun Dec 17 17:29:48 1989  Jim Kingdon  (kingdon at hobbes.ai.mit.edu)
1602
1603         * patch.c (reverse_flag_specified): New variable.
1604         (get_some_switches, reinitialize_almost_everything): Use it.
1605
1606 1988-06-22  Larry Wall  <sdcrdcf!lwall>
1607         patch12:
1608         * common.h: sprintf was declared wrong
1609         * patch.c: rindex() wasn't declared
1610         * patch.man: now avoids Bell System Logo
1611
1612 1988-06-03  Larry Wall  <sdcrdcf!lwall>
1613         patch10:
1614         * common.h: support for shorter extensions.
1615         * inp.c: made a little smarter about sccs files
1616         * patch.c: exit code improved.
1617         better support for non-flexfilenames.
1618         * patch.man: -B switch was contributed.
1619         * pch.c: Can now find patches in shar scripts.
1620         Hunks that swapped and then swapped back could core dump.
1621
1622 1987-06-04  Larry Wall  <sdcrdcf!lwall>
1623         * pch.c: pch_swap didn't swap p_bfake and p_efake.
1624
1625 1987-02-16  Larry Wall  <sdcrdcf!lwall>
1626         * patch.c: Short replacement caused spurious "Out of sync" message.
1627
1628 1987-01-30  Larry Wall  <sdcrdcf!lwall>
1629         * patch.c: Improved diagnostic on sync error.
1630         Moved do_ed_script() to pch.c.
1631         * pch.c: Improved responses to mangled patches.
1632         * pch.h: Added do_ed_script().
1633
1634 1987-01-05  Larry Wall  <sdcrdcf!lwall>
1635         * pch.c: New-style context diffs caused double call to free().
1636
1637 1986-11-21  Larry Wall  <sdcrdcf!lwall>
1638         * patch.c: Fuzz factor caused offset of installed lines.
1639
1640 1986-11-14  Larry Wall  <sdcrdcf!lwall>
1641         * pch.c: Fixed problem where a long pattern wouldn't grow the hunk.
1642         Also restored p_input_line when backtracking so error messages are
1643         right.
1644
1645 1986-11-03  Larry Wall  <sdcrdcf!lwall>
1646         * pch.c: New-style delete triggers spurious assertion error.
1647
1648 1986-10-29  Larry Wall  <sdcrdcf!lwall>
1649         * patch.c: Backwards search could terminate prematurely.
1650         * pch.c: Could falsely report new-style context diff.
1651
1652 1986-09-17  Larry Wall  <sdcrdcf!lwall>
1653         * common.h, inp.c, inp.h, patch.c, patch.man, pch.c, pch.h,
1654         util.h, version.c, version.h:  Baseline for netwide release.
1655
1656 1986-08-01  Larry Wall  <sdcrdcf!lwall>
1657         * patch.c: Fixes for machines that can't vararg.
1658         Added fuzz factor.  Generalized -p.  General cleanup.
1659         Changed some %d's to %ld's.  Linted.
1660         * patch.man: Documented -v, -p, -F.
1661         Added notes to patch senders.
1662
1663 1985-08-15  van%ucbmonet@berkeley
1664         Changes for 4.3bsd diff -c.
1665
1666 1985-03-26  Larry Wall  <sdcrdcf!lwall>
1667         * patch.c: Frozen.
1668         * patch.man: Frozen.
1669
1670 1985-03-12  Larry Wall  <sdcrdcf!lwall>
1671         * patch.c: Now checks for normalness of file to patch.
1672         Check i_ptr and i_womp to make sure they aren't null before freeing.
1673         Also allow ed output to be suppressed.
1674         Changed pfp->_file to fileno(pfp).
1675         Added -p option from jromine@uci-750a.
1676         Added -D (#ifdef) option from joe@fluke.
1677         * patch.man: Documented -p, -D.
1678
1679 1984-12-06  Larry Wall  <sdcrdcf!lwall>
1680         * patch.c: Made smarter about SCCS subdirectories.
1681
1682 1984-12-05  Larry Wall  <sdcrdcf!lwall>
1683         * patch.c: Added -l switch to do loose string comparison.
1684         * patch.man: Added -l switch, and noted bistability bug.
1685
1686 1984-12-04  Larry Wall  <sdcrdcf!lwall>
1687         Branch for sdcrdcf changes.
1688         * patch.c: Failed hunk count not reset on multiple patch file.
1689         * patch.man: Baseline version.
1690
1691 1984-11-29  Larry Wall  <sdcrdcf!lwall>
1692         * patch.c: Linted.  Identifiers uniquified.  Fixed i_ptr malloc() bug.
1693         Fixed multiple calls to mktemp().  Will now work on machines that can
1694         only read 32767 chars.  Added -R option for diffs with new and old
1695         swapped.  Various cosmetic changes.
1696
1697 1984-11-09  Larry Wall  <sdcrdcf!lwall>
1698         * patch.c: Initial revision
1699 \f
1700 Local Variables:
1701 mode: indented-text
1702 left-margin: 8
1703 version-control: never
1704 end: