source: vendor/patch/2.5.9/ChangeLog

Last change on this file was 3444, checked in by bird, 18 years ago

patch 2.5.9

File size: 85.8 KB
Line 
12003-05-20 Paul Eggert <eggert@twinsun.com>
2
3 * NEWS, configure.ac (AC_INIT): Version 2.5.9 released.
4
5 * Makefile.in (HDRS): Add gettext.h.
6
7 Use bool, not int, for booleans.
8
9 * pch.c (pch_says_nonexistent): Returns int, not bool.
10
11 * configure.ac: Add AM_STDBOOL_H.
12
13 * Makefile.in (MISC): Add stdbool.h.in.
14 (stdbool.h): New rule.
15 (ACINCLUDE_INPUTS): Add stdbool.m4.
16 (mostlyclean): Remove stdbool.h.
17 (COMMON): New macro; use it instead of common.h for dependencies.
18
19 * common.h: Include <stdbool.h>.
20 Remove TRUE, FALSE, bool. All uses changed to standard names.
21
22 * common.h (reverse, set_time, set_utc):
23 Use bool, not int, for booleans.
24 * pch.c (p_strip_trailing_cr, p_pass_comments_through,
25 prefix_components, pget_line, re_patch,
26 there_is_another_patch, intuit_diff_type, scan_linenum,
27 another_hunk, pget_line, pch_timestamp): Likewise.
28 * inp.h (ifetch): Likewise.
29 * util.c (move_file, version_controller, version_get, ok_to_reverse,
30 set_signals): Likewise.
31 * inp.c (report_revision, get_input_file, plan_a, plan_b, ifetch):
32 Likewise.
33 * util.h (ok_to_reverse, version_controller, version_get,
34 move_file, set_signals): Likewise.
35 * pch.h (another_hunk, pch_says_nonexistent, pch_timestamp):
36 Likewise.
37 * patch.c (struct outstate, numeric_string, make_backups,
38 backup_if_mismatch, remove_empty_files,
39 reverse_flag_specified, main, reinitialize_almost_everything,
40 get_some_switches, apply_hunk, init_output, copy_till):
41 Likewise.
42
432003-05-18 Paul Eggert <eggert@twinsun.com>
44
45 * pch.c (p_pass_comments_through): New var.
46 (pget_line): Accept new arg for pass_comments_through.
47 All callers changed.
48 (there_is_another_patch): Do not suggest -p for ed diffs.
49 (intuit_diff_type): Check ed command for correct syntax.
50 Do not set p_strip_trailing_cr merely because a -p line contains a CR.
51 (get_ed_command_letter): New function.
52 (do_ed_script): Use it. Do not treat '#' data lines as comments in ed
53 scripts.
54
55 * util.c (move_file):
56 Don't assume that when 'rename(A,B)' succeeds then A no
57 longer exists. This is not true of POSIX 1003.1-2001 rename when A
58 and B are links to the same file.
59 (fetchname): Fix test for file names with internal spaces.
60
61 * version.c: Don't include patchlevel.h.
62 (version): Use PACKAGE_NAME and PACKAGE_VERSION instead of obsolete
63 PROGRAM_NAME and PATCH_VERSION.
64 (copyright_string): Bump to 2003.
65
66 * common.h (FILESYSTEM_PREFIX_LEN, ISSLASH):
67 Remove; now done by 'configure'.
68 (PROGRAM_NAME): Remove; now done by 'configure' as PACKAGE_NAME.
69
70 * patch.c: Do not include <exitfail.h>.
71 (main): Set xalloc_exit_failure, not exit_failure.
72 Add "&& !skip_rest_of_patch" when deciding to continue ed scripts.
73 (option_help): Use PACKAGE_BUGREPORT rather than hardcoding.
74
75 * configure.ac (AC_PREREQ): Bump to 2.57.
76 (AC_GNU_SOURCE): Add, early on.
77 (gl_BACKUPFILE, gl_DIRNAME, gl_ERROR, gl_FUNC_MEMCHR, gl_FUNC_RMDIR,
78 gl_GETOPT, gl_PREREQ_XMALLOC, gl_QUOTE, gl_QUOTEARG): Add.
79 (jm_PREREQ_ADDEXT): Add, with definition.
80 (jm_PREREQ_DIRNAME, jm_PREREQ_ERROR, jm_PREREQ_MEMCHR,
81 jm_PREREQ_QUOTEARG): Remove.
82 (AC_REPLACE_FUNCS): Remove memchr, rename, rmdir).
83 (jm_FUNC_GLIBC_UNLOCKED_IO, jm_AC_DOS): Add.
84 (jm_CHECK_TYPE_STRUCT_DIRENT_D_INO): Do not call directly.
85 (AC_OUTPUT): Use new style, with AC_CONFIG_FILES.
86
87 Update to current CVS gnulib.
88
89 * exitfail.c, exitfail.h, patchlevel.h, rename.c, m4/c-bs-a.m4,
90 m4/jm-glibc-io.m4, m4/prereq.m4: Remove.
91 * m4/backupfile.m4, m4/dirname.m4, m4/dos.m4, m4/getopt.m4,
92 m4/memchr.m4, m4/onceonly.m4, m4/quote.m4, m4/quotearg.m4,
93 m4/rmdir.m4, m4/unlocked-io.m4, m4/xalloc.m4: New files.
94 * Makefile.in (LIBSRCS): Move error.c here from SRCS.
95 Remove rename.c.
96 (OBJS): Remove error.$(OBJEXT).
97 (HDRS): Remove exitfail.h, patchlevel.h.
98 (ACINCLUDE_INPUTS): Remove c-bs-a.m4, jm-glibc-io.m4, prereq.m4.
99 Add backupfile.m4, dirname.m4, dos.m4, getopt.m4, memchr.m4,
100 onceonly.m4, quote.m4, quotearg.m4, rmdir.m4, unlocked-io.m4,
101 xalloc.m4.
102 (patchlevel.h): Remove. All uses removed.
103 (argmatch.$(OBJEXT), error.$(OBJEXT), quotesys.$(OBJEXT)),
104 xmalloc.$(OBJEXT)): Depend on gettext.h.
105 (dirname.$(OBJEXT), quote.$(OBJEXT), strncasecmp.$(OBJEXT)): New rules.
106 (patch.$(OBJEXT), xmalloc.$(OBJEXT)): Remove exitfail.h.
107 (rename.$(OBJEXT)): Remove.
108 (version.$(OBJEXT)): Remove util.h.
109 (xmalloc.$(OBJEXT)): Add error.h.
110
1112002-11-23 Paul Eggert <eggert@twinsun.com>
112
113 * patch.c (main): Don't check for zero-sized file after 'ed'
114 when skipping patch. From Michael Fedrowitz.
115
1162002-06-03 Paul Eggert <eggert@twinsun.com>
117
118 * configure.ac (AC_OUTPUT): Use new form, with AC_CONFIG_FILES,
119 instead of obsolescent form. Patch from Art Haas.
120
121 * pch.c (intuit_diff_type): Do not warn about trailing white space
122 after Prereq: word. Bug reported by Mike Castle.
123
1242002-06-02 Paul Eggert <eggert@twinsun.com>
125
126 * NEWS, configure.ac (AC_INIT): Version 2.5.8 released.
127
128 * README: POSIX.2 -> POSIX.
129 * inp.c (report_revision): Don't modify 'revision', since
130 it gets freed later. Bug reported by Mike Castle.
131
1322002-05-30 Paul Eggert <eggert@twinsun.com>
133
134 * NEWS, configure.ac (AC_INIT): Version 2.5.7 released.
135
136 * Makefile.in (MISC): Remove README-alpha.
137 (patchlevel.h): Depend on configure, not configure.ac.
138
139 * INSTALL: Upgrade to Autoconf 2.53 version.
140
1412002-05-28 Paul Eggert <eggert@twinsun.com>
142
143 * patch.c (end_defined, apply_hunk): Output #endif without
144 the comment, as POSIX 1003.1-2001 requires.
145
146 * pch.c (there_is_another_patch): Flush stderr after perror.
147
148 * NEWS, configure.ac (AC_INIT): Version 2.5.6 released.
149
150 * strcasecmp.c, strncasecmp.c: New files, taken from fileutils.
151 * config.guess, config.sub: Remove.
152 * Makefile.in (LIBSRCS): Add strcasecmp.c, strncasecmp.c.
153 (MISC): Remove config.guess, config.sub.
154
155 The code already assumes C89 or better, so remove K&R stuff.
156 * common.h (volatile): Remove.
157 (GENERIC_OBJECT): Remove; all uses changed to 'void'.
158 (PARAMS): Remove; all uses changed to prototypes.
159 * configure.ac (AC_PROG_CC_STDC): Add.
160 * util.c (vararg_start): Remove. All uses changed to va_start.
161 Always include <stdarg.h>.
162
163 * configure.ac (AC_CANONICAL_HOST): Remove.
164 (AC_REPLACE_FUNCS): Add strncasecmp.
165 (AC_CHECK_DECLS): Add mktemp.
166
167 * patch.c (main): Remove useless prototype decl.
168 (mktemp): Don't declare if HAVE_DECL_MKTEMP || defined mktemp.
169 (make_temp): Now accepts char, not int.
170
1712002-05-26 Paul Eggert <eggert@twinsun.com>
172
173 * patch.c (not_defined): Prepend newline. All uses changed.
174 (apply_hunk): Fix bug: -D was outputting #ifdef when it should
175 have been outputting #ifndef. Bug report and partial fix by
176 Jason Short.
177
178 * pch.c (intuit_diff_type): When reading an ed diff, don't use
179 indent and trailing-CR-ness of "." line; instead, use that of the
180 command. Bug reported by Anthony Towns; partial fix by Michael
181 Fedrowitz.
182 (intuit_diff_type): If the index line exists, don't report a
183 missing header. Fix by Chip Salzenberg.
184
1852002-05-26 Alessandro Rubini <rubini@gnu.org>
186
187 * patch.c (locate_hunk): Fixed updating of last_offset.
188
1892002-05-25 Paul Eggert <eggert@twinsun.com>
190
191 * NEWS, README: Diffutils doc is up to date now.
192 Bug reporting address is now <bug-patch@gnu.org>.
193 * README: Describe '--disable-largefile'.
194
195 * NEWS-alpha, dirname.c, dirname.h, exitfail.c, exitfail.h,
196 quote.c, quote.h, unlocked-io.h: New files, taken from diffutils
197 and fileutils.
198
199 * argmatch.c: [STDC_HEADERS]: Include stdlib.h, for 'exit'.
200
201 * addext.c, argmatch.c, argmatch.h, backupfile.c, basename.c:
202 Update from diffutils and fileutils.
203
204 * ansi2knr.1, ansi2knr.c: Remove.
205
206 * common.h: HAVE_SETMODE && O_BINARY -> HAVE_SETMODE_DOS.
207 * patch.c (usage): Likewise.
208 * pch.c (open_patch_file): Likewise.
209
210 * configure.ac: Renamed from configure.in. Add copyright notice.
211 (AC_PREREQ): Bump to 2.53.
212 (AC_INIT): Use 2.5x style.
213 (AC_CONFIG_SRCDIR): Add.
214 (PACKAGE, VERSION): Remove.
215 (AC_C_PROTOTYPES): Use this instead of AM_C_PROTOTYPES.
216 (jm_CHECK_TYPE_STRUCT_UTIMBUF): Use this instead of jm_STRUCT_UTIMBUF.
217 (jm_PREREQ_ADDEXT, jm_PREREQ_DIRNAME, jm_PREREQ_ERROR,
218 jm_PREREQ_MEMCHR, jm_PREREQ_QUOTEARG): Add.
219 (AC_CHECK_DECLS): Add free, getenv, malloc.
220 (AC_CHECK_FUNCS): Remove setmode.
221 (AC_FUNC_SETMODE_DOS): Add.
222 (jm_CHECK_TYPE_STRUCT_DIRENT_D_INO): Use this instead of
223 jm_STRUCT_DIRENT_D_INO.
224
225 * Makefile.in (OBJEXT): New var.
226 (PACKAGE_NAME): Renamed from PACKAGE. All uses changed.
227 (PACKAGE_VERSION): Renamed from VERSION. All uses changed.
228 (U): Remove. All uses of "$U.o" changed to ".$(OBJEXT)".
229 (LIBSRCS): REmove getopt.c getopt1.c. Add mkdir.c, rmdir.c.
230 (SRCS): Add dirname.c, exitfail.c, getopt.c, getopt1.c, quote.c.
231 Remove mkdir.c.
232 (OBJS): Keep in sync with SRCS.
233 (HDRS): Remove basename.h.
234 Add dirname.h, exitfail.h, quote.h, unlocked-io.h.
235 (MISC, configure, config.hin, patchlevel.h):
236 configure.ac renamed from configure.in.
237 (MISC): Add README-alpha. Remove ansi2knr.1, ansi2knr.c.
238 (.c.$(OBJEXT)): Renamed from .c.o.
239 (ACINCLUDE_INPUTS): Add c-bs-a.m4, error.m4, jm-glibc-io.m4,
240 mbstate_t.m4, mkdir.m4, mbrtowc.m4, prereq.m4, setmode.m4.
241 Remove ccstdc.m4, inttypes_h.m4, largefile.m4, protos.m4.
242 (mostlyclean): Don't clean ansi2knr.
243 (ansi2knr.o, ansi2knr): Remove.
244 Redo dependencies.
245
246 * patch.c: Include <exitfail.h>.
247 (main): Initialize exit_failure.
248
249 * patch.man: Update copyright notice.
250
251 * pch.c, util.c: Include <dirname.h>, not <basename.h>.
252
253 * version.c (copyright_string): Update copyright notice.
254
2552002-02-17 Paul Eggert <eggert@twinsun.com>
256
257 * partime.c (parse_pattern_letter): Don't overrun buffer if it
258 contains only alphanumerics. Bug reported by Winni
259 <Winni470@gmx.net>.
260
2612001-07-28 Paul Eggert <eggert@sic.twinsun.com>
262
263 * util.c (fetchname), NEWS:
264 Allow file names with internal spaces, so long as they
265 don't contain tabs.
266
267 * pch.c (intuit_diff_type): Do not allow Prereq with multiple words.
268
269 * configure.in (AC_PREREQ): Bump to 2.50.
270 (AC_CHECK_FUNCS): Remove fseeko.
271 (AC_FUNC_FSEEKO): Add.
272 * Makefile.in (ACINCLUDE_INPUTS):
273 Remove largefile.m4; no longer needed with Autoconf 2.50.
274
2752001-02-07 "Tony E. Bennett" <tbennett@nvidia.com>
276
277 * util.c (PERFORCE_CO): New var.
278 (version_controller): Support Perforce.
279 * patch.man: Document this.
280
2812000-06-30 Paul Eggert <eggert@sic.twinsun.com>
282
283 * patch.man: Ignore comment lines.
284
285 * NEWS, pch.c: Ignore lines beginning with "#".
286
2871999-10-24 Paul Eggert <eggert@twinsun.com>
288
289 * pch.c (another_hunk): Report a fatal error if a regular
290 context hunk's pattern has a different number of unchanged
291 lines than the replacement.
292
2931999-10-18 Paul Eggert <eggert@twinsun.com>
294
295 * patch.c (main): If we skipped an ed patch, exit with nonzero status.
296
2971999-10-17 Paul Eggert <eggert@twinsun.com>
298
299 * patch.c (main): Apply do_ed_script even if dry_run, because
300 we need to make progress on the patch file.
301 * pch.c (do_ed_script): If skip_rest_of_patch is nonzero,
302 gobble up the patch without any other side effect.
303
3041999-10-12 Paul Eggert <eggert@twinsun.com>
305
306 * NEWS, README: New bug reporting address.
307 * NEWS: Report change in 2.5.4 that we forgot to document.
308 * README: Document `configure --disable-largefile'.
309
310 * basename.c, COPYING, getopt.c, getopt.h, getopt1.c, m4/largefile.m4:
311 Update to latest version.
312 * Makefile.in (basename$U.o): Depend on basename.h.
313 (config.hin): Depend on $(srcdir)/aclocal.m4.
314
315 * ansi2knr.c, maketime.c, mkinstalldirs, partime.c: Fix $Id.
316
317 FreeBSD has an unrelated setmode function; work around this.
318 * common.h (binary_transput): Don't declare unless O_BINARY.
319 * patch.c (option_help, get_some_switches):
320 Don't use setmode unless O_BINARY.
321 * pch.c (open_patch_file): Don't invoke setmode unless O_BINARY.
322
323 Fix incompatiblities with error.c.
324 * common.h (program_name): Now XTERN char *, for compatibility
325 with error.c. All uses changed.
326 (PROGRAM_NAME): New macro.
327 (PARAMS): Use ANSI C version only if defined PROTOTYPES
328 || (defined __STDC__ && __STDC__), for compatibilty with error.c.
329 * util.c (vararg_start): Likewise.
330 * patch.c (program_name): Remove.
331 (main): Initialize program_name.
332 * version.c (version): Print PROGRAM_NAME, not program_name.
333
334 Accommodate mingw32 port, which has one-argument mkdir (yuck!)
335 and no geteuid.
336 * m4/mkdir.m4: New file.
337 * Makefile.in (ACINCLUDE_INPUTS): Add $(M4DIR)/mkdir.m4.
338 * configure.in (AC_CHECK_FUNCS): Add geteuid, getuid.
339 (PATCH_FUNC_MKDIR_TAKES_ONE_ARG): Add.
340 * common.h (mkdir): Define if mkdir takes one arg.
341 (geteuid): New macro, if not already defined.
342
3431999-10-11 Christopher R. Gabriel <cgabriel@tin.it>
344
345 * patch.c (option_help): Updated bug report address
346 * configure.in (VERSION): Version 2.5.5 released.
347
3481999-09-01 Paul Eggert <eggert@twinsun.com>
349
350 * patch.c (main): Default simple_backup_suffix to ".orig".
351
3521999-10-08 Paul Eggert <eggert@twinsun.com>
353
354 * patch.man: Make it clear that `patch -o F' should not be
355 used if F is one of the files to be patched.
356
3571999-08-30 Paul Eggert <eggert@twinsun.com>
358
359 Version 2.5.4 fixes a few minor bugs, converts C sources to
360 ANSI prototypes, and modernizes auxiliary sources and autoconf
361 scripts.
362
363 * configure.in (VERSION): Version 2.5.4 released.
364 (AC_CANONICAL_HOST): Add.
365 (AC_SYS_LARGEFILE): Add, replacing inline code.
366 (AC_EXEEXT): Add.
367 (jm_AC_HEADER_INTTYPES_H): Add, replacing inline code.
368 (AC_TYPE_PID_T): Add.
369 (jm_STRUCT_UTIMBUF): Add, replacing inline code.
370 (HAVE_MEMCHR): Remove obsolescent test; nobody uses NetBSD 1.0 now.
371 (getopt_long): Append $U to object file basenames.
372 (AC_CHECK_FUNCS): Add fseeko, setmode. Remove mkdir.
373 (AC_REPLACE_FUNCS): Add mkdir, rmdir.
374 (jm_STRUCT_DIRENT_D_INO): Add, replacing inline code.
375
376 * Makefile.in (EXEEXT): New macro.
377 (mandir): New macro.
378 (man1dir): Define in terms of mandir.
379 (SRCS): Add mkdir.c, rmdir.c.
380 (OBJS): Change .o to $U.o for addext, argmatch, backupfile, basename,
381 error, inp, patch ,,pch, quotearg, util, version, xmalloc.
382 (HDRS): Add basename.h, patchlevel.h.
383 (MISC): Add ansi2knr.1, config.guess, config.sub.
384 (MISC, config.hin): Remove acconfig.h; no longer needed.
385 (DISTFILES_M4): New macro.
386 (all): patch -> patch$(EXEEXT).
387 (patch$(EXEEXT)): Renamed from patch. All uses changed.
388 (uninstall): Remove manual page.
389 (configure): Depend on aclocal.m4.
390 (M4DIR, ACINCLUDE_INPUTS): New macros.
391 ($(srcdir)/aclocal.m4): New rule.
392 (patchlevel.h): Depend on configure.in, not Makefile,
393 since we now distribute it.
394 (distclean): Don't remove patchlevel.h.
395 (dist): Distribute $(DISTFILES_M4).
396 (addext_.c argmatch_.c backupfile_.c basename_.c error_.c
397 getopt_.c getopt1_.c inp_.c malloc_.c mkdir_.c patch_.c pch_.c
398 rename_.c util_.c version_.c xmalloc_.c): Depend on ansi2knr.
399 Update dependencies to match sources.
400
401 * common.h (_LARGEFILE_SOURCE): Remove; now autoconfigured.
402 (file_offset): Depend on HAVE_FSEEKO, not _LFS_LARGEFILE.
403
404 * patch.c (version_control_context): New variable.
405 Convert to ANSI prototypes.
406 Adjust to new argmatch calling convention.
407 Similarly for get_version.
408 Complain about creating an existing file only if
409 pch_says_nonexistent returns 2 (not merely nonzero).
410 Similarly for time mismatch check.
411 (get_some_switches): Adjust to new get_version calling convention.
412 Similarly for argmatch.
413
414 * pch.c (<basename.h>): Include.
415 (intuit_diff_type): Improve quality of test for empty file.
416 (another_hunk): Don't assume off_t is no longer than long.
417
418 * util.h (backup_type): New decl.
419 * util.c (<basename.h>): Include.
420 (move_file): Adjust to new find_backup_file_name convention.
421 (doprogram, mkdir, rmdir): Remove; now in separate files.
422 (fetchame): Match "/dev/null", not NULL_DEVICE.
423 Ignore names that don't have enough slashes to strip off.
424
425 * version.c: Update copyright notice.
426
4271998-03-20 Paul Eggert <eggert@twinsun.com>
428
429 * configure.in (VERSION): Bump to 2.5.3.
430 * quotearg.h (quotearg_quoting_options):
431 Remove; it ran afoul of the Borland C compiler.
432 Its address is now represented by the null pointer.
433 * quotearg.c (default_quoting_options):
434 Renamed from quotearg_quoting_options,
435 and now static instead of extern.
436 (clone_quoting_options, get_quoting_style, set_quoting_style,
437 set_char_quoting, quotearg_buffer):
438 Use default_quoting_options when passed a null pointer.
439 * patch.c (main, get_some_switches):
440 Pass a null pointer instead of address of quotearg_quoting_options.
441
4421998-03-17 Paul Eggert <eggert@twinsun.com>
443
444 * patch.c (option_help): Update bug reporting address to gnu.org.
445 * patch.man: Fix copyright and bug reporting address.
446
4471998-03-16 Paul Eggert <eggert@twinsun.com>
448
449 * configure.in (VERSION): Bump to 2.5.2.
450 (AC_CHECK_FUNCS): Add strerror.
451 (jm_FUNC_MALLOC, jm_FUNC_REALLOC): Add.
452 (AM_C_PROTOTYPES): Add.
453
454 * NEWS, patch.c (longopts, get_some_switches), patch.man:
455 Add --quoting-style, --posix options.
456
457 * Makefile.in (LIBSRCS): Add malloc.c, realloc.c.
458 (SRCS): Add error.c, quotesys.c, xmalloc.c.
459 (OBJS): Likewise.
460 (HDRS): Add error.h, quotesys.h, xalloc.h.
461 (MISC): Add AUTHORS, aclocal.m4, ansi2knr.c.
462 (clean): Use mostlyclean rule.
463 (argmatch.o, inp.o, patch.o, pch.o): Now also depends on quotearg.h.
464 (inp.o, patch.o, util.o): Now also depends on xalloc.h.
465 (error.o, quotearg.o, quotesys.o, xmalloc.o,
466 ansi2knr.o, ansi2knr, quotearg_.c, .c_.c): New rules.
467 (U): New macro.
468 (OBJS, quotearg$U.o): Rename quotearg.o to quotearg$U.o.
469 (mostlyclean): Remove ansi2knr, *_.c.
470 (.SUFFIXES): Add _.c.
471
472 * acconfig.h (PROTOTYPES): New undef.
473
474 * acconfig.h, configure.in (HAVE_INTTYPES_H, malloc, realloc):
475 New macros.
476
477 * aclocal.m4, error.c, error.h, malloc.c,
478 quotearg.h, quotearg.c, realloc.c, xalloc.h, xmalloc.c: New files.
479
480 * argmatch.c: Include <sys/types.h> before <argmatch.h>.
481 Include <quotearg.h>.
482
483 * argmatch.c (invalid_arg),
484 inp.c (scan_input, report_revision, too_many_lines, get_input_file,
485 plan_a),
486 patch.c (main, get_some_switches, numeric_string),
487 pch.c (open_patch_file, intuit_diff_type, do_ed_script):
488 util.c (move_file, create_file, copy_file, version_get, removedirs):
489 Quote output operands properly.
490
491 * common.h: Include <inttypes.h> if available.
492 (CHAR_BIT, TYPE_SIGNED, TYPE_MINIMUM, TYPE_MAXIMUM,
493 CHAR_MAX, INT_MAX, LONG_MIN, SIZE_MAX, O_EXCL): New macros.
494 (TMPINNAME_needs_removal, TMPOUTNAME_needs_removal,
495 TMPPATNAME_needs_removal): New variables.
496 (xmalloc): Remove decl; now in xalloc.h.
497
498 * inp.c: Include <quotearg.h>, <xalloc.h>.
499
500 * inp.c (get_input_file),
501 pch.c (intuit_diff_type),
502 util.c (version_controller):
503 Don't do diff operation if diffbuf is null; used by ClearCase support.
504
505 * inp.c (plan_b),
506 patch.c (init_reject),
507 pch.c (open_patch_file, do_ed_script):
508 Create temporary file with O_EXCL to avoid races.
509
510 * patch.c: Include <quotearg.h>, <xalloc.h>.
511 (create_output_file, init_output): New open_flags arg.
512 All callers changed.
513 (init_reject): No longer takes filename arg. All callers changed.
514 (remove_if_needed): New function.
515 (cleanup): Use it to remove temporary files only if needed.
516 (TMPREJNAME_needs_removal): New var.
517 (main): Set xalloc_fail_func to memory_fatal; needed for xalloc.
518 Initialize quoting style from QUOTING_STYLE.
519 (longopts, get_some_switches): Offset longarg options by CHAR_MAX,
520 not 128; this is needed for EBCDIC ports.
521
522 * patch.c (main, locate_hunk, abort_hunk, spew_output),
523 pch.c (there_is_another_patch, intuit_diff_type, malformed,
524 another_hunk):
525 The LINENUM type now might be longer than long,
526 so print and read line numbers more carefully.
527
528 * patch.c (main),
529 pch.c (there_is_another_patch):
530 util.c (fetchname):
531 strippath now defaults to -1, so that we can distinguish unset
532 value from largest possible.
533
534 * patch.man: Clarify how file name is chosen from candidates.
535
536 * pch.c: Include <quotearg.h>.
537 (p_strip_trailing_cr): New variable.
538 (scan_linenum): New function.
539 (pget_line, re_patch, there_is_another_patch, intuit_diff_type,
540 get_line): Strip trailing CRs from context diffs that need this.
541 (best_name): Use SIZE_MAX instead of (size_t) -1 for max size_t.
542
543 * quotesys.c, quotearg.h: Renamed from quotearg.c and quotearg.h.
544 All uses changed.
545 * quotesys.h (__QUOTESYS_P): Renamed from __QUOTEARG_P.
546
547 * util.c: Include <quotearg.h>, <xalloc.h>.
548 (raise): Don't define if already defined.
549 (move_file): New arg from_needs_removal. All callers changed.
550 (copy_file): New arg to_flags. All callers changed.
551 (CLEARTOOL_CO): New constant.
552 (version_controller): Add ClearCase support.
553 (format_linenum): New function.
554 (fetchname): Allow any POSIX.1 time zone spec, which means
555 any local time offset in the range -25:00 < offset < +26:00.
556 Ignore the name if it doesn't have enough slashes to strip off.
557 (xmalloc): Remove; now in xmalloc.c.
558
559 * util.h (LINENUM_LENGTH_BOUND): New macro.
560 (format_linenum): New decl.
561
562 * version.c (copyright_string): Update years of copyrights.
563
5641997-09-03 Paul Eggert <eggert@twinsun.com>
565
566 * configure.in (VERSION): Bump to 2.5.1.
567 * inp.c (re_input): Don't free buffers twice when input is garbled.
568 * patch.c (main): If skipping patch and Plan A fails, don't
569 bother trying Plan B.
570
5711997-08-31 Paul Eggert <eggert@twinsun.com>
572
573 * configure.in (VERSION): Version 2.5 released.
574
5751997-07-21 Paul Eggert <eggert@twinsun.com>
576
577 * configure.in (VERSION): Bump to 2.4.4.
578 * pch.c (there_is_another_patch), NEWS: Report an error if the patch
579 input contains garbage but no patches.
580
581 * pch.c (open_patch_file):
582 Check for patch file too long (i.e., its size
583 doesn't fit in a `long', and LFS isn't available).
584
585 * inp.c (plan_a):
586 Cast malloc return value, in case malloc returns char *.
587
5881997-07-16 Paul Eggert <eggert@twinsun.com>
589
590 * configure.in (VERSION): Bump to 2.4.3.
591
592 * NEWS, patch.man, pch.c (intuit_diff_type, get_line, pget_line):
593 Now demangles RFC 934 encapsulation.
594 * pch.c (p_rfc934_nesting): New var.
595
596 * pch.c (intuit_diff_type): Don't bother to check file names carefully
597 if we're going to return NO_DIFF.
598
599 * inp.c (plan_a): Count the number of lines before allocating
600 pointer-to-line buffer; this reduces memory requirements
601 considerably (roughly by a factor of 5 on 32-bit hosts).
602 Decrease `size' only when read unexpectedly reports EOF.
603 (i_buffer): New var.
604 (too_many_lines): New fn.
605 (re_input): Free i_buffer if using plan A.
606 Free buffers unconditionally; they can't be zero.
607
608 * inp.c (plan_a, plan_b): Check for overflow of line counter.
609
610 * pch.c (malformed), util.h (memory_fatal, read_fatal, write_fatal):
611 Declare as noreturn.
612
6131997-07-10 Paul Eggert <eggert@twinsun.com>
614
615 * configure.in (VERSION): Bump to 2.4.2.
616
617 * util.c (ok_to_reverse), NEWS: The default answer is now `n';
618 this is better for Emacs.
619
620 * Makefile.in (dist): Use cp -p, not ln;
621 some hosts do the wrong thing with ln if the source is a symbolic link.
622
623 * patch.man: Fix typo: -y -> -Y.
624
6251997-07-05 Paul Eggert <eggert@twinsun.com>
626
627 * configure.in (VERSION): Bump to 2.4.1.
628
629 * patch.c: (main, get_some_switches), NEWS, patch.man:
630 Version control is now independent of whether backups are made.
631 * patch.c (option_help): Put version control options together.
632 (get_some_switches): With CVS 1.9 hack, treat -b foo like -b -z foo,
633 not just -z foo. This change is needed due to recent change in -z.
634 * backupfile.c (find_backup_file_name):
635 backup_type == none causes undefined behavior;
636 this undoes the previous change to this file.
637
638 * patch.c (locate_hunk): Fix bug when locating context diff hunks
639 near end of file with nonzero fuzz.
640
641 * util.c (move_file): Don't assume that ENOENT is reported when both
642 ENOENT and EXDEV apply; this isn't true with DJGPP, and
643 Posix doesn't require it.
644
645 * pch.c (there_is_another_patch):
646 Suggest -p when we can't intuit a file.
647
6481997-06-19 Paul Eggert <eggert@twinsun.com>
649
650 * configure.in (VERSION): Version 2.4 released.
651 * NEWS: Patch is now verbose when patches do not match exactly.
652
6531997-06-17 Paul Eggert <eggert@twinsun.com>
654
655 * pc/djgpp/configure.sed (config.h): Remove redundant $(srcdir).
656
657 * configure.in (VERSION): Bump to 2.3.9.
658 * patch.c (main): By default, warn about hunks that succeed
659 with nonzero offset.
660 * patch.man: Add LC_ALL=C advice for making patches.
661 * pc/djgpp/configure.sed (config.h): Fix paths to dependent files.
662
6631997-06-17 Paul Eggert <eggert@twinsun.com>
664
665 * configure.in (VERSION): Bump to 2.3.8.
666
667 * pch.c (open_patch_file): Test stdin for fseekability.
668 (intuit_diff_type): Missing context diff headers are now warnings,
669 not errors; some people use patches with them (e.g. when retrying
670 rejects).
671
672 * patch.c (struct outstate):
673 New type, collecting together some output state vars.
674 (apply_hunk, copy_till, spew_output, init_output): Use it.
675 Keep track of whether some output has been generated.
676 (backup_if_mismatch): New var.
677 (ofp): Remove, in favor of local struct outstate vars.
678 (main): Use struct outstate. Initialize backup_if_mismatch to
679 be the inverse of posixly_correct. Keep track of whether mismatches
680 occur, and use this to implement backup_if_mismatch.
681 Report files that are not empty after patching, but should be.
682 (longopts, option_help, get_some_switches): New options
683 --backup-if-mismatch, --no-backup-if-mismatch.
684 (get_some_switches): -B, -Y, -z no longer set backup_type.
685 * backupfile.c (find_backup_file_name):
686 Treat backup_type == none like simple.
687
688 * Makefile.in (CONFIG_HDRS):
689 Remove var; no longer needed by djgpp port.
690 (DISTFILES_PC_DJGPP): Rename pc/djgpp/config.sed to
691 pc/djgpp/configure.sed; remove pc/djgpp/config.h in favor of
692 new file that edits it, called pc/djgpp/config.sed.
693 * pc/djgpp/configure.bat: Rename config.sed to configure.sed.
694 * pc/djgpp/configure.sed (CONFIG_HDRS): Remove.
695 (config.h): Add rule to build this from config.hin and
696 pc/djgpp/config.sed.
697 * pc/djgpp/config.sed:
698 Convert from .h file to .sed script that generates .h file.
699
700 * NEWS: Describe --backup-if-mismatch, --no-backup-if-mismatch.
701 * patch.man:
702 Describe new options --backup-if-mismatch, --no-backup-if-mismatch
703 and their ramifications. Use unreadable backup to represent
704 nonexistent file.
705
7061997-06-12 Paul Eggert <eggert@twinsun.com>
707
708 * configure.in (VERSION): Bump to 2.3.7.
709 (AC_CHECK_FUNCS): Add `raise'.
710
711 * Makefile.in (inp.o): No longer depends on quotearg.h.
712
713 * common.h (outfile): New decl (was private var named `output').
714 (invc): New decl.
715 (GENERIC_OBJECT): Renamed from VOID.
716 (NULL_DEVICE, TTY_DEVICE): New macros.
717
718 * patch.c (output): Remove; renamed to `outfile' and moved to common.h.
719 (main): `failed' is count, not boolean.
720 Say "Skipping patch." when deciding to skip patch.
721 (get_some_switches): Set invc when setting inname.
722
723 * inp.c: Do not include <quotearg.h>.
724 (SCCSPREFIX, GET, GET_LOCKED, SCCSDIFF1, SCCSDIFF2, SCCSDIFF3,
725 RCSSUFFIX, CHECKOUT, CHECKOUT_LOCKED, RCSDIFF1, RCSDIFF2):
726 Move to util.c.
727 (get_input_file): Invoke new functions version_controller and
728 version_get to simplify this code.
729 (plan_b): "/dev/tty" -> NULL_DEVICE
730
731 * pch.h (pch_timestamp): New decl.
732 * pch.c (p_timestamp): New var; takes over from global timestamp array.
733 (pch_timestamp): New function to export p_timestamp.
734 (there_is_another_patch): Use blander wording when you can't intuit
735 the file name.
736 Say "Skipping patch." when deciding to skip patch.
737 (intuit_diff_type): Look for version-controlled but nonexistent files
738 when intuiting file names; set invc accordingly.
739 Ignore Index: line if either old or new line is present, and if
740 POSIXLY_CORRECT is not set.
741 (do_ed_script): Flush stdout before invoking popen, since it may
742 send output to stdout.
743
744 * util.h (version_controller, version_get): New decls.
745 * util.c: Include <quotearg.h> earlier.
746 (raise): New macro, if ! HAVE_RAISE.
747 (move_file): Create empty unreadable file when backing up a nonexistent
748 file.
749 (DEV_NULL): New constant.
750 (SCCSPREFIX, GET. GET_LOCKED, SCCSDIFF1, SCCSDIFF2,
751 RCSSUFFIX, CHECKOUT, CHECKOUT_LOCKED, RCSDIFF1): Moved here from inp.c.
752 (version_controller, version_get): New functions.
753 (ask): Look only at /dev/tty for answers; and when standard output is
754 not a terminal and ! posixly_correct, don't even look there.
755 Remove unnecessary fflushes of stdout.
756 (ok_to_reverse): Say "Skipping patch." when deciding to skip patch..
757 (sigs): SIGPIPE might not be defined.
758 (exit_with_signal): Use `raise' instead of `kill'.
759 (systemic): fflush stdout before invoking subsidiary command.
760
761 * patch.man: Document recent changes.
762 Add "COMPATIBILITY ISSUES" section.
763
764 * NEWS: New COMPATIBILITY ISSUES for man page.
765 Changed verbosity when fuzz is found.
766 File name intuition is changed, again.
767 Backups are made unreadable when the file did not exist.
768
769 * pc/djgpp/config.h (HAVE_STRUCT_UTIMBUF): Define.
770 (HAVE_RAISE): New macro.
771 (HAVE_UTIME_H): Define.
772 (TZ_is_unset): Do not define; it's not a serious problem with `patch'
773 to have TZ be unset in DOS.
774
7751997-06-08 Paul Eggert <eggert@twinsun.com>
776
777 * configure.in (VERSION): Bump to 2.3.6.
778 (AC_CHECK_HEADERS): Add utime.h.
779 * acconfig.h, configure.in, pc/djgpp/config.h (HAVE_STRUCT_UTIMBUF):
780 New macro.
781 * pc/djgpp/config.h (HAVE_UTIME_H, TZ_is_unset): New macros.
782
783 * NEWS, patch.man: Describe new -Z, -T options, new numeric
784 option for -G, retired -G, and more verbose default behavior
785 with fuzz.
786
787 * pch.c (intuit_diff_type): Record times reported for files in headers.
788 Remove head_says_nonexistent[x], since it's now equivalent to
789 !timestamp[x].
790 * util.h (fetchname): Change argument head_says_nonexistent to
791 timestamp.
792 * util.c: #include <partime.h> for TM_LOCAL_ZONE.
793 Don't include <time.h> since common.h now includes it.
794 (ok_to_reverse): noreverse and batch cases now output regardless of
795 verbosity.
796 (fetchname): Change argument head_says_nonexistent to pstamp, and
797 store header timestamp into *pstamp.
798 If -T or -Z option is given, match time stamps more precisely.
799 (ask): Remove unnecessary close of ttyfd.
800 When there is no terminal at all, output a newline to make the
801 output look nicer. After reporting EOF, flush stdout;
802 when an input error, report the error type.
803
804 * inp.c (get_input_file):
805 Ask user whether to get file if patch_get is negative.
806
807 * Makefile.in (clean): Don't clean */*.o; clean core* and *core.
808
8091997-06-04 Paul Eggert <eggert@twinsun.com>
810
811 * configure.in (VERSION): Bump to 2.3.5.
812
813 * util.c (ok_to_reverse):
814 Be less chatty if verbosity is SILENT and we don't
815 have to ask the user. If force is nonzero, apply the patch anyway.
816
817 * pch.c (there_is_another_patch):
818 Before skipping rest of patch, skip to
819 the patch start, so that another_hunk can skip it properly.
820 (intuit_diff_type): Slight wording change for missing headers, to
821 regularize with other diagnostics. Fix off-by-one error when setting
822 p_input_line when scanning the first hunk to check for deleted files.
823
8241997-06-03 Paul Eggert <eggert@twinsun.com>
825
826 * configure.in (VERSION): Bump to 2.3.4.
827
828 * NEWS: Now matches more generously against nonexistent or empty files.
829
830 * pch.c (there_is_another_patch): Move warning about not being
831 able to intuit file names here from skip_to.
832 (intuit_diff_type): Fatal error if we find a headless unified
833 or context diff.
834
835 * util.c (ask): Null-terminate buffer properly even if it grew.
836 (fetchname): No need to test for null first argument.
837
8381997-06-02 Paul Eggert <eggert@twinsun.com>
839
840 * configure.in (VERSION): Bump to 2.3.3.
841 * pch.c (p_says_nonexistent, pch_says_nonexistent): Is now 1 for empty,
842 2 for nonexistent.
843 (intuit_diff_type): Set p_says_nonexistent according to new meaning.
844 Treat empty files like nonexistent files when reversing.
845 (skip_to): Output better diagnostic when we can't intuit a file name.
846 * patch.c (main):
847 Count bytes, not lines, when testing whether a file is empty,
848 since it may contain only non-newline chars.
849 pch_says_nonexistent now returns 2 for nonexistent files.
850
8511997-06-01 Paul Eggert <eggert@twinsun.com>
852
853 * configure.in (VERSION): Bump to 2.3.2.
854 * pch.c (open_patch_file):
855 Fix bug when computing size of patch read from a pipe.
856
8571997-05-30 Paul Eggert <eggert@twinsun.com>
858
859 * configure.in (VERSION): Bump to 2.3.1.
860
861 * Makefile.in (transform, patch_name): New vars,
862 for proper implementation of AC_ARG_PROGRAM.
863 (install, uninstall): Use them.
864 (install-strip): New rule.
865 * pc/djgpp/config.sed (program_transform_name): Set to empty.
866
8671997-05-30 Paul Eggert <eggert@twinsun.com>
868
869 * configure.in (VERSION), NEWS: Version 2.3 released.
870 * patch.man: Fix two font typos.
871 * util.c (doprogram): Fix misspelled decl.
872
8731997-05-26 Paul Eggert <eggert@twinsun.com>
874
875 * configure.in (VERSION): Bump to 2.2.93.
876
877 * pch.c (open_patch_file):
878 Fatal error if binary_transput and stdin is a tty.
879
880 * pc/djgpp/config.sed (chdirsaf.c):
881 Use sed instead of cp, since cp might not be installed.
882 * pc/djgpp/configure.bat:
883 Prepend %srcdir% to pathname of config.sed, for crosscompiles.
884
8851997-05-25 Paul Eggert <eggert@twinsun.com>
886
887 * configure.in (VERSION): Bump to 2.2.92.
888 (D_INO_IN_DIRENT): New macro.
889 * pc/djgpp/config.h, acconfig.h (D_INO_IN_DIRENT): New macro.
890 * backupfile.c (REAL_DIR_ENTRY):
891 Depend on D_INO_IN_DIRENT, not _POSIX_VERSION.
892
893 * addext.c (addext): Adjust slen when adjusting s for DOS 8.3 limit.
894 Do not use xxx.h -> xxxh~ hack.
895
896 * util.c: (move_file): Avoid makedirs test when possible even
897 if FILESYSTEM_PREFIX_LEN (p) is nonzero. Don't play
898 case-changing tricks to come up with backup file name; it's
899 not portable to case-insensitive file systems.
900 * common.h (ISLOWER): Remove.
901
902 * inp.c (scan_input): Don't use Plan A if (debug & 16).
903
904 * patch.c (shortopts): Add -g, -G.
905 (longopts): --help now maps to 132, not 'h', to avoid confusion.
906 (get_some_switches): Likewise.
907 Don't invoke setmode on input if --binary; wait until needed.
908 Don't ever invoke setmode on stdout.
909 * pch.c (open_patch_file): Setmode stdin to binary if binary_transput.
910
911 * patch.man: Fix documentation of backup file name to match behavior.
912 Add advice for ordering of patches of derived files.
913 Add /dev/tty to list of files used.
914 * README: Adjust instructions for building on DOS.
915 * pc/djgpp/README: Remove tentative wording.
916 * NEWS: The DOS port is now tested.
917 Backup file names are no longer computed by switching case.
918
919 * pc/chdirsaf.c (ERANGE): Include <errno.h> to define it.
920 (restore_wd): chdir unconditionally.
921 (chdir_safer): Invoke atexit successfully at most once.
922 * pc/djgpp/config.sed: Use chdirsaf.o, not pc/chdirsaf.o.
923 Replace CONFIG_HDRS, don't append.
924 Use $(srcdir) in CONFIG_STATUS.
925 Don't apply $(SHELL) to $(CONFIG_STATUS).
926 Append rules for chdirsaf.o, chdirsaf.c; clean chdirsaf.c at the end.
927 * pc/djgpp/configure.bat: Append CR to each line; DOS needs this.
928 Don't use | as sed s delimiter; DOS can't handle it.
929
9301997-05-21 Paul Eggert <eggert@twinsun.com>
931
932 * configure.in (VERSION): Bump to 2.2.91.
933
934 * pch.c (another_hunk):
935 Fix bug with computing size of prefix and suffix context
936 with ordinary context diffs. Report malformed patch if a unified diff
937 has nothing but context.
938
939 * inp.c (get_input_file):
940 Use patch_get, not backup_type, to decide whether to
941 get from RCS or SCCS. Use the word `get' in diagnostics.
942 * patch.c (main): Initialize patch_get from PATCH_GET.
943 Omit DEFAULT_VERSION_CONTROL hook; it just leads to nonstandarization.
944 (longopts, option_help, get_some_switches): Add support for -g, -G.
945 (option_help): Add bug report address.
946 * common.h (patch_get): New decl.
947 * patch.man: Add -g and -G options; use `get' instead of `check out'.
948 Add PATCH_GET. Recommend -Naur instead of -raNU2 for diff.
949 * NEWS: Describe -g, -G, PATCH_GET.
950
951 * version.c (copyright_string): Use only most recent copyright year,
952 as per GNU standards.
953
954 * Makefile.in (DISTFILES_PC): Remove pc/quotearg.c.
955 * pc/djgpp/config.sed: Remove unnecessary hooks for quotearg and SHELL.
956
9571997-05-18 Paul Eggert <eggert@twinsun.com>
958
959 * configure.in (VERSION): Increase to 2.2.9.
960 (AC_TYPE_MODE_T): Add.
961
962 * pch.h (another_hunk): New parameter REV.
963 * pch.c (hunkmax): Now of type LINENUM.
964 (malformed): Add decl.
965 (there_is_another_patch): Skip inname-detection if skip_rest_of_patch.
966 (intuit_diff_type): To determine whether file appears to have been
967 deleted, look at replacement, not pattern.
968 If there is a mismatch between existence of file and whether the
969 patch claims to change whether the file exists, ask whether to
970 reverse the patch.
971 (another_hunk): New parameter REV specifying whether to reverse the
972 hunk. All callers changed.
973 (do_ed_script): Add assertion to ensure input file exists.
974
975 * util.h (create_file): New function.
976 (copy_file): Now takes mode, not struct stat.
977 (makedirs): No longer exported.
978 (move_file): Now takes mode, not struct stat.
979 * util.c (makedirs): No longer exported.
980 (move_file): Accept mode of destination, not struct stat.
981 All callers changed.
982 Quote file names in diagnostics.
983 Create parent dir of destination if necessary.
984 Don't use ENOTDIR.
985 Don't unlink source; it will be unlinked later.
986 Unlink destination if FROM is zero.
987 (create_file): New function.
988 (copy_file): Accept mode of destination, not struct stat.
989 All callers changed.
990 Use create_file to create file.
991 (ok_to_reverse): Moved here from patch.c. Now accepts format and args;
992 all callers changed.
993 (mkdir): 2nd arg is now mode_t, for better compatibility.
994 (replace_slashes): Ignore slashes at the end of the filename.
995
996 * common.h (noreverse): New decl.
997 (ok_to_reverse): Remove decl.
998
999 * patch.c (noreverse): Now extern.
1000 (main): New environment var PATCH_VERSION_CONTROL overrides VERSION_CONTROL.
1001 Don't assert(hunk) if we're skipping the patch; we may not have any hunks.
1002 When removing a file, back it up if backups are desired.
1003 Don't chmod output file if input file did not exist.
1004 chmod rej file to input file's mode minus executable bits.
1005 (locate_hunk): Go back to old way of a single fuzz parameter, but
1006 handle it more precisely: context diffs with partial contexts
1007 can only match file ends, since the partial context can occur
1008 only at the start or end of file.
1009 All callers changed.
1010 (create_output_file): Use create_file to create files.
1011 (ok_to_reverse): Move to util.c.
1012
1013 * inp.c (scan_input, get_input_file): Quote file names in diagnostics.
1014 (get_input_file): Set inerrno if it's not already set.
1015 Don't create file; it's now the caller's responsibility.
1016 (plan_b): Use /dev/null if input size is zero, since it might not exist.
1017 Use create_file to create temporary file.
1018
1019 * NEWS: Add PATCH_VERSION_CONTROL; DOS port is untested.
1020
1021 * pc/djgpp/config.h: Add comment for mode_t.
1022
1023 * pc/djgpp/README: Note that it's not tested.
1024
1025 * patch.man: PATCH_VERSION_CONTROL overrides VERSION_CONTROL.
1026
10271997-05-15 Paul Eggert <eggert@twinsun.com>
1028
1029 * configure.in: Add AC_PREREQ(2.12).
1030 (VERSION): Bump to 2.2.8.
1031 (ed_PROGRAM): Rename from ED_PROGRAM.
1032
1033 * pch.c (prefix_components): Support DOS file names better.
1034 Fix typo that caused fn to almost always yield 0.
1035
1036 * util.c (<time.h>, <maketime.h>): Include.
1037 (move_file, copy_file): Add support for DOS filenames.
1038 Preserve mode of input files when creating temp files.
1039 Add binary file support.
1040 (doprogram, rmdir): New functions.
1041 (mkdir): Use doprogram.
1042 (replace_slashes): Add support for DOS filenames.
1043 (removedirs): New function.
1044 (init_time)): New function.
1045 (initial_time): New var.
1046 (fetchname): Add support for deleted files, DOS filenames.
1047
1048 * basename.c (FILESYSTEM_PREFIX_LEN, ISSLASH):
1049 New macros, for DOS port.
1050 (base_name): Use them.
1051
1052 * addext.c (HAVE_DOS_FILE_NAMES): New macro.
1053 <limits.h>: Include if HAVE_LIMITS_H.
1054 (addext): Handle hosts with DOS file name limits.
1055
1056 * common.h (LONG_MIN): New macro.
1057 (FILESYSTEM_PREFIX_LEN, ISSLASH): New macros, for DOS port.
1058 (ok_to_create_file): Remove.
1059 (reverse): Now int.
1060 (ok_to_reverse): New function decl.
1061 (O_WRONLY, _O_BINARY, O_BINARY, O_CREAT, O_TRUNC): New macros.
1062 (binary_transput): New var decl.
1063
1064 * Makefile.in (ed_PROGRAM): Renamed from ED_PROGRAM.
1065 (CONFIG_HDRS, CONFIG_STATUS): New vars.
1066 (SRCS): Add maketime.c, partime.c.
1067 (OBJS): Likewise.
1068 (HDRS): Add maketime.h, partime.h.
1069 (DISTFILES_PC, DISTFILES_PC_DJGPP): New vars.
1070 (Makefile, config.status): Use CONFIG_STATUS, not config.status.
1071 (clean): Remove */*.o.
1072 (dist): Add pc and pc/djgpp subdirectories.
1073 ($(OBJS)): Depend on $(CONFIG_HDRS) instead of config.h.
1074 (maketime.o, partime.o): New rules.
1075 (util.o): Depend on maketime.h.
1076
1077 * patch.c (main):
1078 Call init_time. Add DEFAULT_VERSION_CONTROL hook for people who
1079 prefer the old ways. Build temp file names before we might invoke cleanup.
1080 Add support for deleted files and clean up the patch-swapping code a bit.
1081 Delete empty ancestors of deleted files.
1082 When creating temporaries, use file modes of original files.
1083 (longopts, get_some_switches): New option --binary.
1084 (get_some_switches): Report non-errno errors with `fatal', not `pfatal'.
1085 (create_output_file): New function, which preserves modes of original files
1086 and supports binary transput.
1087 (init_output, init_reject): Use it.
1088 (ok_to_reverse): New function.
1089 (TMPDIR): New macro.
1090 (make_temp): Use $TMPDIR, $TMP, $TEMP, or TMPDIR, whichever comes first.
1091
1092 * pch.c (p_says_nonexistent): New var.
1093 (open_patch_file): Add binary transput support.
1094 Apply stat to file names retrieved from user.
1095 Reject them if they don't exist.
1096 (intuit_diff_type): Add support for deleting files.
1097 Don't treat trivial directories any differently.
1098 Avoid stating the same file twice in common case of context diffs.
1099 (prefix_components): Don't treat trivial directories any differently.
1100 Add support for DOS filenames.
1101 (pch_says_nonexistent): New function.
1102 (do_ed_script): Preserve mode of input files when creating temp files.
1103 Add support for binary transput.
1104
1105 * pch.h (pch_says_nonexistent): New decl.
1106
1107 * util.h (replace_slashes): No longer exported.
1108 (fetchname): Add support for deleted files.
1109 (copy_file, move_file): Add support for preserving file modes.
1110 (init_time, removedirs): New functions.
1111
1112 * argmatch.c: Converge with fileutils.
1113
1114 * backupfile.c: Converge with fileutils.
1115 (find_backup_file_name): Treat .~N~ suffix just like any other suffix
1116 when handling file names that are too long.
1117
1118 * inp.c:
1119 In messages, put quotes around file names and spaces around "--".
1120 (get_input_file): Allow files to be deleted. Do the expense of
1121 makedirs only if we can't create the file.
1122 (plan_a, plan_b): Add support for binary transput.
1123
1124 * pc/chdirsaf.c, pc/djgpp/README, pc/djgpp/config.h, pc/djgpp/config.sed, pc/djgpp/configure.bat, pc/quotearg.c:
1125 New file.
1126
1127 * NEWS:
1128 New methods for removing files; adjust file name intuition again.
1129 Add description of MS-DOS and MS-Windows ports.
1130
1131 * patch.man:
1132 Simplify file name intuition slightly (no distinction for trivial dirs).
1133 Add --binary. Describe how files and directories are deleted.
1134 Suggest diff -a. Include caveats about what context diffs cannot represent.
1135
11361997-05-06 Paul Eggert <eggert@twinsun.com>
1137
1138 * configure.in (VERSION): Now 2.2.7.
1139 (CPPFLAGS, LDFLAGS, LIBS): If the user has not set any of these vars,
1140 prefer support for large files if available.
1141
1142 * common.h (_LARGEFILE_SOURCE): Define.
1143 (file_offset): New typedef.
1144 (file_seek, file_tell): New macros.
1145
1146 * patch.c (main):
1147 Remove empty files by default unless POSIXLY_CORRECT is set.
1148
1149 * util.c, util.h (Fseek):
1150 Use file_offset instead of long, for portability to large-file hosts.
1151
1152 * pch.c: (p_base, p_start, next_intuit_at, skip_to, open_patch_file,
1153 intuit_diff_type, another_hunk, incomplete_line, do_ed_script):
1154 Use file_offset instead of long, for portability to large-file hosts.
1155 (prefix_components): Renamed from path_name_components; count only
1156 nontrivial prefix components, and take a 2nd EXISTING arg.
1157 (existing_prefix_components): Remove; subsumed by prefix_components.
1158 (intuit_diff_type): When creating files, try for the creation of the
1159 fewest directories.
1160
1161 * configure.in (VERSION): Now 2.2.6.
1162
1163 * pch.c (existing_prefix_components): New function.
1164 (intuit_diff_type): When creating a file, use a name whose existing
1165 directory prefix contains the most nontrivial path name components.
1166 (best_name): Don't check for null 2nd arg.
1167
1168 * util.h (replace_slashes): New decl.
1169
1170 * util.c (replace_slashes): Now external.
1171 (fetchname): Don't assume chars are nonnegative.
1172
1173 * patch.man:
1174 When creating a file, use a name whose existing directory prefix
1175 contains the most nontrivial path name components.
1176 Add advice for creating patches and applying them.
1177
11781997-05-06 Paul Eggert <eggert@twinsun.com>
1179
1180 * configure.in (VERSION): Now 2.2.6.
1181
1182 * pch.c (existing_prefix_components): New function.
1183 (intuit_diff_type): When creating a file, use a name whose existing
1184 directory prefix contains the most nontrivial path name components.
1185 (best_name): Don't check for null 2nd arg.
1186
1187 * util.h (replace_slashes): New decl.
1188 * util.c (replace_slashes): Now external.
1189 (fetchname): Don't assume chars are nonnegative.
1190
1191 * patch.man: Describe above change to pch.c.
1192 Add advice for creating patches and applying them.
1193
11941997-05-05 Paul Eggert <eggert@twinsun.com>
1195
1196 * configure.in (VERSION): Update to 2.2.5.
1197
1198 * quotearg.h, quotearg.c: New files.
1199 * Makefile.in (SRCS, OBJS, HDRS): Mention new files.
1200 (inp.o, util.o): Now depends on quotearg.h.
1201 (quotearg.o): New makefile rule.
1202
1203 * common.h (posixly_correct): New var.
1204 * patch.c (main): Initialize it.
1205 If ! posixly_correct, default backup type is now `existing'.
1206 SIMPLE_BACKUP_SUFFIX no longer affects backup type.
1207 (backup): Remove var.
1208
1209 * util.h: (countdirs): Remove.
1210 (systemic): New decl.
1211 * util.c (move_file): Try making the parent directory of TO
1212 if backup prefix or suffix contain a slash.
1213 (ask): Remove arbitrary limit on size of result.
1214 (systemic): New function.
1215 (mkdir): Work even if arg contains shell metacharacters.
1216 (replace_slashes): Return 0 if none were replaced.
1217 Don't replace slash after . or .. since it's redundant.
1218 (countdirs): Remove.
1219 (makedirs): Ignore mkdir failures.
1220
1221 * NEWS, patch.man: More POSIXLY_CORRECT adjustments.
1222 Describe new rules for how file names are intuited.
1223
12241997-04-17 Paul Eggert <eggert@twinsun.com>
1225
1226 * configure.in (VERSION): Version 2.2 released.
1227
1228 * Makefile.in (config.hin):
1229 Remove before building; we always want the timestamp updated.
1230
1231 * inp.c (get_input_file):
1232 Look for RCS files only if backup_type == numbered_existing.
1233
1234 * NEWS, patch.man:
1235 Remove mention of never-implemented -V rcs and -V sccs options.
1236 * patch.man: `pathname' -> `file name'
1237 Correct the description of how file names are found in diff headers.
1238 Clarify the distinction between ordinary and unified context diffs.
1239
12401997-04-13 Paul Eggert <eggert@twinsun.com>
1241
1242 * configure.in (VERSION): Update to 2.1.7.
1243
1244 * patch.c (numeric_optarg): New function.
1245 (get_some_switches): Use it.
1246
1247 * pch.c (intuit_diff_type): When creating a file, prefer a name whose
1248 existing dir prefix is the longest.
1249
1250 * util.h (countdirs): New function.
1251 * util.c (replace_slashes, countdirs): New functions.
1252 (makedirs): Use replace_slashes, to be more like countdirs.
1253
1254 * patch.man: Explain -pN vs -p N. Recommend --new-file.
1255 Explain possible incompatibility with strip count.
1256
12571997-04-10 Paul Eggert <eggert@twinsun.com>
1258
1259 * configure.in (VERSION): Bump to 2.1.6.
1260 (AC_CHECK_HEADERS): Remove stdlib.h (i.e. remove HAVE_STDLIB_H).
1261
1262 * Makefile.in: (HDRS, patchlevel.h, TAGS, distclean, maintainer-clean):
1263 Don't distribute patchlevel.h; let the user do it.
1264 This works around some obscure (possibly nonexistent?) `make' bugs.
1265
1266 * common.h (program_name): extern, not XTERN.
1267 (<stdlib.h>): Include if STDC_HEADERS, not if HAVE_STDLIB_H.
1268 (atol, getenv, malloc, realloc): Don't worry whether they're #defined.
1269
1270 * patch.c (get_some_switches):
1271 Add special hack for backwards compatibility with CVS 1.9.
1272 (-B, -Y, -z): Now set backup_type = simple.
1273
1274 * NEWS: Fix misspellings; minor reformatting.
1275 * README: Report POSIX.2 compliance.
1276
12771997-04-06 Paul Eggert <eggert@twinsun.com>
1278
1279 Move all old RCS $Log entries into ChangeLog.
1280 #include all files with < >, not " ".
1281
1282 * addext.c, argmatch.c, argmatch.h, memchr.c, install-sh:
1283 New files.
1284 * EXTERN.h, INTERN.h: Removed.
1285 * config.hin: Renamed from config.h.in.
1286
1287 * acconfig.h (NODIR): Remove.
1288 (HAVE_MEMCHR): Add.
1289
1290 * configure.in (AC_ARG_PROGRAM, AC_PROG_MAKE_SET, HAVE_MEMCHR): Add.
1291 (AC_CHECK_HEADERS): Replaces obsolescent AC_HAVE_HEADERS.
1292 Add stdlib.h, string.h, unistd.h, varargs.h.
1293 Delete obsolete call to AC_UNISTD_H.
1294 (AC_CONFIG_HEADER): Rename config.h.in to config.hin.
1295 (AC_C_CONST): Replaces obsolescent AC_CONST.
1296 (AC_CHECK_FUNC): Check for getopt_long; define LIBOBJS and substitute
1297 for it accordingly.
1298 (AC_CHECK_FUNCS): Replaces obsolescent AC_HAVE_FUNCS.
1299 Add _doprintf, isascii, mktemp, sigaction, sigprocmask, sigsetmask.
1300 Remove strerror.
1301 (AC_FUNC_CLOSEDIR_VOID, AC_FUNC_VPRINTF): Add.
1302 (AC_HEADER_DIRENT): Replaces obsolescent AC_DIR_HEADER.
1303 (AC_HEADER_STDC): Replaces obsolescent AC_STDC_HEADERS.
1304 (AC_SYS_LONG_FILE_NAMES): Replaces obsolescent AC_LONG_FILE_NAMES.
1305 (AC_TYPE_OFF_T): Replaces obsolescent AC_OFF_T.
1306 (AC_TYPE_SIGNAL): Replaces obsolescent AC_RETSIGTYPE.
1307 (AC_TYPE_SIZE_T): Replaces obsolescent AC_SIZE_T.
1308 (AC_XENIX_DIR): Remove.
1309 (ED_PROGRAM): New var.
1310 (NODIR): Remove.
1311 (PACKAGE, VERSION): New vars; substitute them with AC_SUBST.
1312
1313 * Makefile.in: Conform to current GNU build standards.
1314 Redo dependencies. Use library getopt_long if available.
1315 Use `&&' instead of `;' inside shell commands where applicable;
1316 GNU make requires this.
1317 Use double-colon rules for actions that do not build files.
1318 (@SET_MAKE@): Added.
1319 (CFLAGS, LDFLAGS, prefix, exec_prefix): Base on @ versions of symbols.
1320 (COMPILE, CPPFLAGS, DEFS, ED_PROGRAM, LIBOBJS, LIBSRCS, PACKAGE,
1321 VERSION): New symbols.
1322 (SRCS, OBJS, HDRS, MISC): Add new files.
1323 (man1dir): Renamed from mandir.
1324 (man1ext): Renamed from manext.
1325 (patch): Put -o first.
1326 (install): Use $(transform) to allow program to be renamed by configure.
1327 (patchlevel.h): Build from $(VERSION).
1328 (dist): Get version number from $(VERSION) and package name from
1329 $(PACKAGE).
1330 (TAGS): Scan $(HDRS).
1331 (maintainer-clean): Renamed from realclean. Remove patchlevel.h.
1332
1333 * backupfile.h (simple_backup_suffix): Now const *.
1334 (find_backup_file_name, base_name, get_version): Args are now const *.
1335 (base_name): New decl.
1336 * backupfile.c (<config.h>): Include only if HAVE_CONFIG_H.
1337 (<argmatch.h>): Include.
1338 (<string.h>): Include if HAVE_STRING_H, not if STDC_HEADERS.
1339 (<strings.h>): Include if !HAVE_STRING_H.
1340 (<unistd.h>): Do not include.
1341 (<dirent.h>): Redo include as per current autoconf standards.
1342 (<limits.h>): Include if HAVE_LIMITS_H. Define CHAR_BIT if not defined.
1343 (NLENGTH): Now returns size_t.
1344 (CLOSEDIR, INT_STRLEN_BOUND): New macros.
1345 (ISDIGIT): Use faster method.
1346 (find_backup_file_name): No longer depends on NODIR.
1347 Remove redundant code.
1348 (make_version_name): Remove; do it more portably.
1349 (max_backup_version): Args are now const *.
1350 (version_number): Simplify digit checking.
1351 (basename, concat, dirname): Remove.
1352 (argmatch, invalid_arg): Move to argmatch.c. Simplify test for
1353 ambiguous args. When reporting an error, use program_name not "patch".
1354 (addext): Move to addext.c. Treat all negative values from pathconf
1355 like -1. Always use long extension if it fits, even if the filesystem
1356 does not support long file names.
1357 (backup_types): Now const.
1358
1359 * common.h, inp.h (XTERN): Renamed from EXT to avoid collision
1360 with errno.h reserved name space.
1361
1362 * common.h (DEBUGGING): Now an integer; default is 1.
1363 (enum diff): New type.
1364 (diff_type): Use it instead of small integers.
1365 (CONTEXT_DIFF, NORMAL_DIFF, ED_DIFF, NEW_CONTEXT_DIFF, UNI_DIFF):
1366 Now enumerated values instead of macros.
1367 (NO_DIFF): New enumerated value (used instead of 0).
1368 (volatile): Default to the empty string if __STDC__ is not defined.
1369 (<signal.h>): Do not include.
1370 (Chmod, Close, Fclose, Fflush, Fputc, Signal, Sprintf, Strcat,
1371 Strcpy, Unlink, Write): Remove these macros; casts to void are
1372 not needed for GNU coding standards.
1373 (INITHUNKMAX): Move to pch.c.
1374 (malloc, realloc, INT_MIN, MAXLINELEN, strNE, strnNE,
1375 Reg1, Reg2, Reg3, Reg4, Reg5, Reg6, Reg7, Reg8, Reg9, Reg10, Reg11,
1376 Reg12, Reg13, Reg14, Reg15, Reg16): Remove these macros.
1377 (S_IXOTH, S_IWOTH, S_IROTH, S_IXGRP, S_IWGRP,
1378 S_IRGRP, S_IXUSR, S_IWUSR, S_IRUSR, O_RDONLY, O_RDWR):
1379 Define these macros, if not defined.
1380 (CTYPE_DOMAIN, ISLOWER, ISSPACE, ISDIGIT, PARAMS): New macros.
1381 (instat): Renamed from filestat; used for input file now.
1382 (bufsize, using_plan_a, debug, strippath): Not statically initialized.
1383 (debug): #define to 0 if not DEBUGGING, so that users of `debug'
1384 no longer need to be surrounded by `#if DEBUGGING'.
1385 (out_of_mem, filec, filearg, outname, toutkeep, trejkeep): Remove.
1386 (inname, inerrno, dry_run, origbase): New variables.
1387 (origprae): Now const*.
1388 (TMPOUTNAME, TMPINNAME, TMPPATNAME): Now const*volatile.
1389 (verbosity): New variable; subsumes `verbose'.
1390 (DEFAULT_VERBOSITY, SILENT, VERBOSE): Values in a new enum.
1391 (verbose): Removed.
1392 (VOID): Use `#ifdef __STDC__' instead of`#if __STDC__',
1393 for consistency elsewhere.
1394 (__attribute__): New macro (empty if not a recent GCC).
1395 (fatal_exit): Renamed from my_exit.
1396 (errno): Don't define if STDC_HEADERS.
1397 (<string.h>): Include if either STDC_HEADERS or HAVE_STRING_H.
1398 (memcmp, memcpy): Define if !STDC_HEADERS && !HAVE_STRING_H
1399 && !HAVE_MEMCHR.
1400 (<stdlib.h>): Include if HAVE_STDLIB_H, not if STDC_HEADERS.
1401 (atol, getenv, malloc, realloc, lseek): Declare only if not defined
1402 as a macro.
1403 (popen, strcpy, strcat, mktemp): Do not declare.
1404 (lseek): Declare to yield off_t, not long.
1405 (<fcntl.h>): Include only if HAVE_FCNTL_H.
1406
1407 * inp.h (get_input_file): New decl.
1408 * inp.c (SCCSPREFIX, GET, GET_LOCKED, SCCSDIFF, RCSSUFFIX, CHECKOUT,
1409 CHECKOUT_LOCKED, RCSDIFF): Moved here from common.h.
1410 (i_ptr): Now char const **.
1411 (i_size): Remove.
1412 (TIBUFSIZE_MINIMUM): Define only if not already defined.
1413 (plan_a, plan_b): Arg is now const *.
1414 (report_revision): Declare before use. It's now the caller's
1415 responsibility to test whether revision is 0.
1416 (scan_input, report_revision, get_input_file):
1417 Be less chatty unless --verbose.
1418 (get_input_file): New function, split off from plan_a.
1419 Reuse file status gotten by pch if possible. Allow for dry run.
1420 Use POSIX bits for creat, not number. Check for creation and
1421 close failure, and use fstat not stat. Use memcpy not strncpy.
1422 (plan_a): Rewrite for speed.
1423 Caller now assigns result to using_plan_a.
1424 Don't bother reading empty files; during dry runs they might not exist.
1425 Use ISSPACE, not isspace.
1426 (plan_b): Allow for dry runs. Use ISSPACE, and handle sign extension
1427 correctly on arg. Use POSIX symbol for open arg.
1428
1429 * patch.c (backup, output, patchname, program_name): New vars.
1430 (last_frozen_line): Moved here from inp.h.
1431 (TMPREJNAME): Moved here from common.h.
1432 (optind_last): Removed.
1433 (do_defines, if_defined, not_defined, else_defined, end_defined):
1434 Now char const. Prepend with \n (except for not_defined) to
1435 allow for files ending in non-newline.
1436 (Argv): Now char*const*.
1437 (main, get_some_switches): Exit status 0 means success,
1438 1 means hunks were rejected, 2 means trouble.
1439 (main, locate_hunk, patch_match): Keep track of patch prefix context
1440 separately from suffix context; this fixes several bugs.
1441 (main): Initialize bufsize, strippath.
1442 Be less chatty unless --verbose.
1443 No more NODIR; always have version control available.
1444 Require environment variables to be nonempty to have effect.
1445 Add support for --dry-run, --output, --verbose.
1446 Invoke get_input_file first, before deciding among do_ed_script,
1447 plan_a, or plan_b.
1448 Clear ofp after closing it, to keep discipline that ofp is either
1449 0 or open, to avoid file descriptor leaks. Conversely, rejfp doesn't
1450 need this trick since static analysis is enough to show when it
1451 needs to be closed.
1452 Don't allow file-creation patches to be applied to existing files.
1453 Misordered hunks are now not fatal errors; just go on to the next file.
1454 It's a fatal error to fall back on plan B when --output is given,
1455 since the moving hand has writ.
1456 Add support for binary files.
1457 Check for I/O errors.
1458 chmod output file ourselves, rather than letting move_file do it;
1459 this saves global state.
1460 Use better grammar when outputting hunks messages, e.g. avoid
1461 `1 hunks'.
1462 (main, reinitialize_almost_everything):
1463 Remove support for multiple file arguments.
1464 Move get_some_switches call from reinitialize_almost_everything
1465 to main.
1466 (reinitialize_almost_everything): No need to reinitialize things
1467 that are no longer global variables, e.g. outname.
1468 (shortopts): Remove leading "-"; it's no longer important to
1469 return options and arguments in order. '-b' no longer takes operand.
1470 -p's operand is no longer optional. Add -i, -Y, -z. Remove -S.
1471 (longopts): --suffix is now pared with -z, not -b. --backup now
1472 means -b. Add --input, --basename-prefix, --dry-run, --verbose.
1473 Remove --skip. --strip's operand is now required.
1474 (option_help): New variable. Use style of current coding standards.
1475 Change to match current option set.
1476 (usage): Use it.
1477 (get_some_switches): Get all switches, since `+' is defunct.
1478 New options -i, -Y, -z, --verbose, --dry-run.
1479 Option -S removed.
1480 -b now means backup (backup_type == simple), not simple_backup_suffix.
1481 -B now implies backup, and requires nonempty operand.
1482 -D no longer requires first char of argument to be an identifier.
1483 `-o -' is now disallowed (formerly output to regular file named "-").
1484 -p operand is now required.
1485 -v no longer needs to cleanup (no temp files can exist at that point).
1486 -V now implies backup.
1487 Set inname, patchname from file name arguments, if any;
1488 do not set filearg. It's now an error if extra operands are given.
1489 (abort_junk): Check for write errors in reject file.
1490 (apply_hunk, copy_till): Return error flag, so that failure to apply
1491 out-of-order hunk is no longer fatal.
1492 (apply_hunk): New arg after_newline,
1493 for patching files not ending in newline.
1494 Cache ofp for speed. Check for write errors.
1495 (OUTSIDE, IN_IFNDEF, IN_IFDEF, IN_ELSE): Now part of an enumerated type
1496 instead of being #defined to small integers.
1497 Change while-do to do-while when copying !-part for R_do_defines,
1498 since condition is always true the first time through the loop.
1499 (init_output, init_reject): Arg is now const *.
1500 (copy_till, spew_output): Do not insert ``missing'' newlines;
1501 propagate them via new after_newline argument.
1502 (spew_output): Nothing to copy if last_frozen_line == input lines.
1503 Do not close (ofp) if it's null.
1504 (dump_line): Remove.
1505 (similar): Ignore presence or absence of trailing newlines.
1506 Check for only ' ' or '\t', not isspace (as per POSIX.2).
1507 (make_temp): Use tmpnam if mktemp is not available.
1508 (cleanup): New function.
1509 (fatal_exit): Use it. Renamed from my_exit.
1510 Take signal to exit with, not exit status (which is now always 2).
1511
1512 * pch.h, pch.c (pch_prefix_context, pch_suffix_context):
1513 New fns replacing pch_context.
1514 (another_hunk): Now yields int, not bool; -1 means out of memory.
1515 Now takes difftype as argument.
1516 (pch_write_line): Now returns boolean indicating whether we're after
1517 a newline just after the write, for supporting non-text files.
1518 * pch.c (isdigit): Remove; use ISDIGIT instead.
1519 (INITHUNKMAX): Moved here from common.h.
1520 (p_context): Removed. We need to keep track of the pre- and post-
1521 context separately, in:
1522 (p_prefix_context, p_suffix_context): New variables.
1523 (bestguess): Remove.
1524 (open_patch_file): Arg is now char const *.
1525 Copy file a buffer at a time, not a char at a time, for speed.
1526 (grow_hunkmax): Now returns success indicator.
1527 (there_is_another_patch, skip_to, another_hunk, do_ed_script):
1528 Be less chatty unless --verbose.
1529 (there_is_another_patch):
1530 Avoid infinite loop if user input keeps yielding EOF.
1531 (intuit_diff_type): New returns enum diff, not int.
1532 Strip paths as they're being fetched.
1533 Set ok_to_create_file correctly even if patch is reversed.
1534 Set up file names correctly with unidiff output.
1535 Use algorithm specified by POSIX 1003.2b/D11 to deduce
1536 name of file to patch, with the exception of patches
1537 that can create files.
1538 (skip_to): Be verbose if !inname, since we're about to ask the
1539 user for a file name and the context will help the user choose.
1540 (another_hunk): Keep context as LINENUM, not int.
1541 If the replacement is missing, calculate its context correctly.
1542 Don't assume input ends in newline.
1543 Keep track of patch prefix context separately from suffix context;
1544 this fixes several bugs.
1545 Don't assume blank lines got chopped if the replacement is missing.
1546 Report poorly-formed hunks instead of aborting.
1547 Do not use strcpy on overlapping strings; it's not portable.
1548 Work even if lines are incomplete.
1549 Fix bugs associated with context-less context hunks,
1550 particularly when patching in reverse.
1551 (pget_line): Now takes just 1 arg; instead of second arg,
1552 just examine using_plan_a global. Return -1 if we ran out
1553 of memory.
1554 (do_ed_script): Now takes output FILE * argument.
1555 Take name of editor from ED_PROGRAM instead of hardwiring /bin/ed.
1556 Don't bother unlinking TMPOUTNAME.
1557 Check for popen failure.
1558 Flush pipe to check for output errors.
1559 If ofp is nonzero, copy result to it, instead of trying to
1560 move the result.
1561
1562 * util.h, util.c (say1, say2, say3, say4, fatal1, fatal2, fatal3,
1563 fatal4, pfatal1, pfatal2, pfatal3, pfatal4, ask1, ask2, ask3, ask4):
1564 Remove; replaced with following.
1565 (ask, say, fatal, pfatal): New stdarg functions.
1566 (fetchname): Remove last, `assume_exists' parameter.
1567 (savebuf, savestr, move_file, copy_file): Args are now const *.
1568 (exit_with_signal): New function, for proper process status if
1569 a signal is received as per POSIX.2.
1570 (basename): Rename to `base_name' and move to backupfile.
1571 * util.c (<signal.h>): Include here, not in common.h.
1572 (vararg_start): New macro.
1573 (va_dcl, va_start, va_arg, va_end): Define if neither <stdarg.h>
1574 nor <varargs.h> are available.
1575 (SIGCHLD): Define to SIGCLD if SIGCLD is defined and
1576 SIGCHLD isn't.
1577 (private_strerror): Remove.
1578 (move_file): Remove option of moving to stdout.
1579 Add support for -Y, -z.
1580 Don't assume chars in file name are nonnegative.
1581 Use copy_file if rename fails due to EXDEV;
1582 report failure if rename fails for any other reason.
1583 (copy_file, makedirs): Use POSIX symbols for permissions.
1584 (copy_file): Open source before destination.
1585 (remove_prefix): New function.
1586 (vfprintf): New function, if !HAVE_VPRINTF.
1587 (afatal, apfatal, zfatal, zpfatal, errnum): Remove.
1588 (fatal, pfatal, say): New functions that use stdarg.
1589 All callers changed.
1590 (zask): Renamed from `ask'. Now uses stdarg. Output to stdout,
1591 and read from /dev/tty, or if that cannot be opened, from
1592 stderr, stdout, stdin, whichever is first a tty.
1593 Print "EOF" when an EOF is read. Do not echo input.
1594 (sigs): New array.
1595 (sigset_t, sigemptyset, sigmask, sigaddset, sigismember, SIG_BLOCK,
1596 SIG_UNBLOCK, SIG_SETMASK, sigprocmask, sigblock, sigsetmask):
1597 Define substitutes if not available.
1598 (initial_signal_mask, signals_to_block): New vars.
1599 (fatal_exit_handler): New function, if !HAVE_SIGACTION.
1600 (set_signals, ignore_signals): Use sigaction and sigprocmask style
1601 signal-handling if possible; it doesn't lose signals.
1602 (set_signals): Default SIGCHLD to work around SysV fork+wait bug.
1603 (mkdir): First arg is now const *.
1604 (makedirs): Handle multiple adjacent slashes correctly.
1605 (fetchname): Do not worry about whether the file exists
1606 (that is now the caller's responsibility).
1607 Treat a sequence of one or more slashes like one slash.
1608 Do not unstrip leading directories if they all exist and if
1609 no -p option was given; POSIX doesn't allow this.
1610 (memcmp): Remove (now a macro in common.h).
1611
1612 * version.c (copyright_string, free_software_msgid, authorship_msgid):
1613 New constants.
1614 (version): Use them. Use program_name instead of hardwiring it.
1615
1616 * patch.man: Generate date from RCS Id.
1617 Rewrite to match the above changes.
1618
1619Fri Jul 30 02:02:51 1993 Paul Eggert (eggert@twinsun.com)
1620
1621 * configure.in (AC_HAVE_FUNCS): Add mkdir.
1622
1623 * common.h (Chmod, Fputc, Write, VOID): New macros.
1624 (malloc, realloc): Yield `VOID *', not `char *'.
1625
1626 * util.h (makedirs): Omit `striplast' argument. Remove `aask'.
1627
1628 * inp.c (plan_a): Remove fixed internal buffer. Remove lint.
1629
1630 * util.c (set_signals, ignore_signals): Trap SIGTERM, too.
1631 (makedirs): Removed fixed internal buffer. Omit `striplast' argument.
1632 (mkdir): New function, if !HAVE_MKDIR.
1633 (fetchname): Remove fixed internal buffer.
1634 Remove lint from various functions.
1635
1636 * patch.c, pch.c: Remove lint.
1637
1638Thu Jul 29 20:52:07 1993 David J. MacKenzie (djm@wookumz.gnu.ai.mit.edu)
1639
1640 * Makefile.in (config.status): Run config.status --recheck, not
1641 configure, to get the right args passed.
1642
1643Thu Jul 29 07:46:16 1993 Paul Eggert (eggert@twinsun.com)
1644
1645 * The following changes remove all remaining fixed limits on memory,
1646 and fix bugs in patch's handling of null bytes and files that do not
1647 end in newline. `Patch' now works on binary files.
1648
1649 * backupfile.c (find_backup_file_name): Don't dump core if malloc fails.
1650
1651 * EXTERN.h, INTERN.h (EXITING): New macro.
1652 * backupfile.[ch], patch.c, pch.c: Add PARAMS to function declarations.
1653
1654 * common.h (bool): Change to int, so ANSI C prototype promotion works.
1655 (CANVARARG): Remove varargs hack; it wasn't portable.
1656 (filearg): Now a pointer, not an array, so that it can be reallocated.
1657 (GET*, SCCSDIFF, CHECKOUT*, RCSDIFF): Quote operands to commands.
1658 (my_exit): Declare here.
1659 (BUFFERSIZE, Ctl, filemode, Fseek, Fstat, Lseek, MAXFILEC, MAXHUNKSIZE,
1660 Mktemp, myuid, Null, Nullch, Nullfp, Nulline, Pclose, VOIDUSED): Remove.
1661 All invokers changed.
1662 (Argc, Argv, *define[sd], last_offset, maxfuzz, noreverse, ofp,
1663 optind_last, rejfp, rejname): No longer externally visible; all
1664 definers changed.
1665 (INT_MAX, INT_MIN, STD*_FILENO, SEEK_SET): Define if the underlying
1666 system doesn't. Include <limits.h> for this.
1667
1668 * configure.in: Add limits.h, memcmp. Delete getline.
1669
1670 * inp.c (tibufsize): New variable; buffers grow as needed.
1671 (TIBUFSIZE_MINIMUM): New macro.
1672 (report_revision): New function.
1673 (plan_a): Do not search patch as a big string, since that fails
1674 if it contains null bytes.
1675 Prepend `./' to filenames starting with `-', for RCS and SCCS.
1676 If file does not match default RCS/SCCS version, go ahead and patch
1677 it anyway; warn about the problem but do not report a fatal error.
1678 (plan_b): Do not use a fixed buffer to read lines; read byte by byte
1679 instead, so that the lines can be arbitrarily long. Do not search
1680 lines as strings, since they may contain null bytes.
1681 (plan_a, plan_b): Report I/O errors.
1682
1683 * inp.c, inp.h (rev_in_string): Remove.
1684 (ifetch): Yield size of line too, since strlen no longer applies.
1685 (plan_a, plan_b): No longer exported.
1686
1687 * patch.c (abort_hunk, apply_hunk, patch_match, similar):
1688 Lines may contain NUL and need not end in newline.
1689 (copy_till, dump_line): Insert newline if appending after partial line.
1690 All invokers changed.
1691 (main, get_some_switches, apply_hunk): Allocate *_define[ds], filearg,
1692 rejname dynamically.
1693 (make_temp): New function.
1694 (main): Use it.
1695 (main, spew_output, dump_line) Check for I/O errors.
1696
1697 * pch.c (open_patch_file): Don't copy stdin to a temporary file if
1698 it's a regular file, since we can seek on it directly.
1699 (open_patch_file, skip_to, another_hunk): The patch file may contain
1700 NULs.
1701 (another_hunk): The patch file may contain lines starting with '\',
1702 which means the preceding line lacked a trailing newline.
1703 (pgetline): Rename to pget_line.
1704 (get_line, incomplete_line, pch_write_line): New functions.
1705 (pch_line_len): Return size_t, not short; lines may be very long.
1706 (do_ed_script): Check for I/O errors. Allow scripts to contain
1707 'i' and 's' commands, too.
1708
1709 * pch.h (pfp, grow_hunkmax, intuit_diff_type, next_intuit_at, skip_to,
1710 pfetch, pgetline): No longer exported.
1711 (pch_write_line): New declaration.
1712 (getline): Removed.
1713
1714 * util.c (move_file, fetchname): Use private stat buffer, so that
1715 filestat isn't lost. Check for I/O errors.
1716 (savestr): Use savebuf.
1717 (zask): Use STD*_FILENO instead of 0, 1, 2.
1718 (fetchname): strip_leading defaults to INT_MAX instead of 957 (!).
1719 (memcmp): Define if !HAVE_MEMCMP.
1720
1721 * util.c, util.h (say*, fatal*, pfatal*, ask*): Delete; these
1722 pseudo-varargs functions weren't ANSI C. Replace by macros
1723 that invoke [fs]printf directly, and invoke new functions
1724 [az]{say,fatal,pfatal,ask} before and after.
1725 (savebuf, read_fatal, write_fatal, memory_fatal, Fseek): New functions.
1726 (fatal*): Output trailing newline after message. All invokers changed.
1727
1728 * version.c (version): Don't exit.
1729
1730 * Makefile.in (SRCS): Remove getline.c.
1731
1732Thu Jul 22 15:24:24 1993 David J. MacKenzie (djm@goldman.gnu.ai.mit.edu)
1733
1734 * EXTERN.h, INTERN.h (PARAMS): Define.
1735 * backupfile.h, common.h, inp.h, pch.h, util.h: Use.
1736 * backupfile.c: Include EXTERN.h.
1737
1738Wed Jul 21 13:14:05 1993 David J. MacKenzie (djm@goldman.gnu.ai.mit.edu)
1739
1740 * getline.c: New file.
1741 * configure.in: Check for getline (GNU libc has it).
1742 * pch.c: Use it instead of fgets.
1743 (pgetline): Renamed from pgets. Change callers.
1744 * pch.h: Change decl.
1745
1746 * pch.c (pgets): Tab adjusts by 8 - (indent % 8), not % 7.
1747 Be consistent with similar code in pch.c::intuit_diff_type.
1748
1749 * common.h (MEM): Typedef removed.
1750 inp.c, pch.c, util.c: Use size_t instead of MEM.
1751 inp.c, pch.c: Use off_t.
1752 configure.in: Add AC_SIZE_T and AC_OFF_T.
1753
1754 * common.h: Make buf a pointer and add a bufsize variable.
1755 * util.c, pch.c, inp.c: Replace sizeof buf with bufsize.
1756 * patch.c: malloc buf to bufsize bytes.
1757
1758Tue Jul 20 20:40:03 1993 Paul Eggert (eggert@twinsun.com)
1759
1760 * common.h (BUFFERSIZE): Grow it to 8k too, just in case.
1761 (buf): Turn `buf' back into an array; making it a pointer broke
1762 things seriously.
1763 * patch.c (main): Likewise.
1764
1765Tue Jul 20 20:02:40 1993 David J. MacKenzie (djm@goldman.gnu.ai.mit.edu)
1766
1767 * Move Reg[1-16] and CANVARARG decls from config.h.in to common.h.
1768 * acconfig.h: New file.
1769 * Makefile (HDRS): Add it.
1770
1771Tue Jul 20 16:35:27 1993 Paul Eggert (eggert@twinsun.com)
1772
1773 * Makefile.in: Remove alloca.[co]; getopt no longer needs it.
1774 * configure.in (AC_ALLOCA): Remove.
1775
1776 * util.c (set_signals, ignore_signals): Do nothing if SIGHUP
1777 and SIGINT aren't defined.
1778
1779Tue Jul 20 17:59:56 1993 David J. MacKenzie (djm@goldman.gnu.ai.mit.edu)
1780
1781 * patch.c (main): Call xmalloc, not malloc. xmalloc buf.
1782 * common.h: Declare xmalloc. Make buf a pointer, not an array.
1783
1784 * util.c (xmalloc): Call fatal1, not fatal.
1785
1786 * common.h [MAXLINELEN]: Bump from 1k to 8k.
1787
1788Thu Jul 8 19:56:16 1993 David J. MacKenzie (djm@goldman.gnu.ai.mit.edu)
1789
1790 * Makefile.in (installdirs): New target.
1791 (install): Use it.
1792 (Makefile, config.status, configure): New targets.
1793
1794Wed Jul 7 13:25:40 1993 David J. MacKenzie (djm@goldman.gnu.ai.mit.edu)
1795
1796 * patch.c (get_some_switches, longopts): Recognize --help
1797 option, and call usage.
1798 (usage): New function.
1799
1800Fri Jun 25 07:49:45 1993 Paul Eggert (eggert@twinsun.com)
1801
1802 * backupfile.c (find_backup_file_name): Don't use .orig if
1803 numbered_existing with no existing numbered backup.
1804 (addext): Don't use ext if !HAVE_LONG_FILE_NAMES,
1805 even if it would fit. This matches patch's historical behavior.
1806 (simple_backup_suffix): Default to ".orig".
1807 * patch.c (main): Just use that default.
1808
1809Tue Jun 15 22:32:14 1993 Paul Eggert (eggert@twinsun.com)
1810
1811 * config.h.in (HAVE_ALLOCA_H): This #undef was missing.
1812 * Makefile.in (info, check, installcheck): New rules.
1813
1814Sun Jun 13 14:31:29 1993 Paul Eggert (eggert@twinsun.com)
1815
1816 * config.h.in (index, rindex): Remove unused macro
1817 definitions; they get in the way when porting to AIX.
1818 * config.h.in, configure.in (HAVE_STRING_H): Remove unused defn.
1819
1820Thu Jun 10 21:13:47 1993 Paul Eggert (eggert@twinsun.com)
1821
1822 * patchlevel.h: PATCH_VERSION 2.1.
1823 (The name `patch-2.0.12g12' is too long for traditional Unix.)
1824
1825 * patchlevel.h (PATCH_VERSION): Renamed from PATCHLEVEL.
1826 Now contains the entire patch version number.
1827 * version.c (version): Use it.
1828
1829Wed Jun 9 21:43:23 1993 Paul Eggert (eggert@twinsun.com)
1830
1831 * common.h: Remove declarations of index and rindex.
1832 * backupfile.c: Likewise.
1833 (addext, basename, dirname): Avoid rindex.
1834
1835Tue Jun 8 15:24:14 1993 Paul Eggert (eggert@twinsun.com)
1836
1837 * inp.c (plan_a): Check that RCS and working files are not the
1838 same. This check is needed on hosts that do not report file
1839 name length limits and have short limits.
1840
1841Sat Jun 5 22:56:07 1993 Paul Eggert (eggert@twinsun.com)
1842
1843 * Makefile.in (.c.o): Put $(CFLAGS) after other options.
1844 (dist): Switch from .z to .gz.
1845
1846Wed Jun 2 10:37:15 1993 Paul Eggert (eggert@twinsun.com)
1847
1848 * backupfile.c (find_backup_file_name): Initialize copy of
1849 file name properly.
1850
1851Mon May 31 21:55:21 1993 Paul Eggert (eggert@twinsun.com)
1852
1853 * patchlevel.h: Patch level 12g11.
1854
1855 * pch.c (p_Char): Renamed from p_char, which is a system type
1856 in Tex XD88's <sys/types.h>.
1857
1858 * backupfile.c: Include "config.h" first, so that `const' is
1859 treated consistently in system headers.
1860
1861Mon May 31 16:06:23 1993 Paul Eggert (eggert@twinsun.com)
1862
1863 * patchlevel.h: Patch level 12g10.
1864
1865 * configure.in: Add AC_CONST.
1866 * config.h.in: Add `const'.
1867 * Makefile.in (.c.o): Add -DHAVE_CONFIG_H.
1868 (getopt.o getopt1.o): Depend on config.h.
1869
1870 * util.c (xmalloc): New function; alloca.c needs this.
1871
1872Mon May 31 00:49:40 1993 Paul Eggert (eggert@twinsun.com)
1873
1874 * patchlevel.h: PATCHLEVEL 12g9.
1875
1876 * backupfile.c, backupfile.h (addext): New function.
1877 It uses pathconf(), if available, to determine maximum file
1878 name length.
1879 * patch.c (main): Use it for reject file name.
1880 * common.h (ORIGEXT): Moved to patch.c.
1881 * config.h.in (HAVE_PATHCONF): New macro.
1882 * configure.in: Define it.
1883
1884 * Makefile.in (dist): Use gzip, not compress.
1885
1886Sat May 29 09:42:18 1993 Paul Eggert (eggert@twinsun.com)
1887
1888 * patch.c (main): Use pathconf to decide reject file name.
1889 * common.h (REJEXT): Remove.
1890
1891 * inp.c (plan_a): Don't lock the checked-out file if `patch -o'
1892 redirected the output elsewhere.
1893 * common.h (CHECKOUT_LOCKED, GET_LOCKED): New macros. GET and
1894 CHECKOUT now just checkout unlocked copies.
1895
1896Fri May 28 08:44:50 1993 Paul Eggert (eggert@twinsun.com)
1897
1898 * backupfile.c (basename): Define even if NODIR isn't defined.
1899 * patch.c (main): Ask just once to apply a reversed patch.
1900
1901Tue Nov 24 08:09:04 1992 David J. MacKenzie (djm@goldman.gnu.ai.mit.edu)
1902
1903 * config.h.in, common.h: Use HAVE_FCNTL_H and HAVE_STRING_H
1904 instead of USG.
1905
1906 * backupfile.c: Use SYSDIR and NDIR instead of USG.
1907 Define direct as dirent, not vice-versa.
1908
1909Wed Sep 16 17:11:48 1992 David J. MacKenzie (djm@nutrimat.gnu.ai.mit.edu)
1910
1911 * patch.c (get_some_switches): optc should be int, not char.
1912
1913Tue Sep 15 00:36:46 1992 David J. MacKenzie (djm@nutrimat.gnu.ai.mit.edu)
1914
1915 * patchlevel.h: PATCHLEVEL 12g8.
1916
1917Mon Sep 14 22:01:23 1992 David J. MacKenzie (djm@nutrimat.gnu.ai.mit.edu)
1918
1919 * Makefile.in: Add uninstall target.
1920
1921 * util.c (fatal, pfatal): Add some asterisks to make fatal
1922 messages stand out more.
1923
1924Tue Aug 25 22:13:36 1992 David J. MacKenzie (djm@nutrimat.gnu.ai.mit.edu)
1925
1926 * patch.c (main, get_some_switches), common.h, inp.c (plan_a,
1927 plan_b), pch.c (there_is_another_patch): Add -t --batch
1928 option, similar to -f --force.
1929
1930Mon Jul 27 11:27:07 1992 David J. MacKenzie (djm@nutrimat.gnu.ai.mit.edu)
1931
1932 * common.h: Define SCCSDIFF and RCSDIFF.
1933 * inp.c (plan_a): Use them to make sure it's safe to check out
1934 the default RCS or SCCS version.
1935 From Paul Eggert.
1936
1937Mon Jul 20 14:10:32 1992 David J. MacKenzie (djm@nutrimat.gnu.ai.mit.edu)
1938
1939 * util.h: Declare basename.
1940 * inp.c (plan_a), util.c (fetchname): Use it to isolate the
1941 leading path when testing for RCS and SCCS files.
1942
1943Fri Jul 10 16:03:23 1992 David J. MacKenzie (djm@nutrimat.gnu.ai.mit.edu)
1944
1945 * util.c (makedirs): Only make the directories that don't exist.
1946 From chip@tct.com (Chip Salzenberg).
1947
1948Wed Jul 8 01:20:56 1992 David J. MacKenzie (djm@nutrimat.gnu.ai.mit.edu)
1949
1950 * patch.c (main): Open ofp after checking for ed script.
1951 Close ofp and rejfp before trying plan B.
1952 From epang@sfu.ca (Eugene Pang).
1953
1954 * util.c (fatal, pfatal): Print "patch: " before message.
1955 * pch.c, inp.c, patch.c, util.c: Remove "patch: " from the
1956 callers that had it.
1957
1958 * common.h (myuid): New variable.
1959 * patch.c (main): Initialize it.
1960 * inp.c (myuid): Function removed.
1961 (plan_a): Use the variable, not the function.
1962
1963 * patch.c: Add back -E --remove-empty-files option.
1964
1965Tue Jul 7 23:19:28 1992 David J. MacKenzie (djm@nutrimat.gnu.ai.mit.edu)
1966
1967 * inp.c (myuid): New function.
1968 (plan_a): Call it. Optimize stat calls. Be smarter about
1969 detecting checked out RCS and SCCS files.
1970 From Paul Eggert (eggert@twinsun.com).
1971
1972 * inp.c, util.c, patch.c: Don't bother checking for stat() > 0.
1973
1974Mon Jul 6 13:01:52 1992 David J. MacKenzie (djm@nutrimat.gnu.ai.mit.edu)
1975
1976 * util.c (move_file): Use rename instead of link and copying.
1977
1978 * util.c (pfatal): New function.
1979 * util.h: Declare it and pfatal[1-4] macros.
1980 * various files: Use it instead of fatal where appropriate.
1981
1982 * common.h, patch.c: Replace Arg[cv]_last with optind_last.
1983
1984 * patch.c (main, get_some_switches): Use getopt_long. Update
1985 usage message.
1986 (nextarg): Function removed.
1987
1988 * Rename FLEXFILENAMES to HAVE_LONG_FILE_NAMES,
1989 VOIDSIG to RETSIGTYPE.
1990
1991 * backupfile.c, common.h: Use STDC header files if available.
1992 backupfile.h: Declare get_version.
1993
1994 * COPYING, COPYING.LIB, INSTALL, Makefile.in, alloca.c,
1995 config.h.in, configure, configure.in, getopt.[ch], getopt1.c,
1996 rename.c: New files.
1997 * Configure, MANIFEST, Makefile.SH, config.H, config.h.SH,
1998 malloc.c: Files removed.
1999
2000 * version.c (version): Don't print the RCS stuff, since we're
2001 not updating it regularly.
2002
2003 * patchlevel.h: PATCHLEVEL 12u7.
2004
2005 * Makefile.SH (dist): New target.
2006 Makedist: File removed.
2007
2008 * inp.c (plan_a): Check whether the user can write to the
2009 file, not whether anyone can write to the file.
2010
2011Sat Jul 4 00:06:58 1992 David J. MacKenzie (djm@nutrimat.gnu.ai.mit.edu)
2012
2013 * inp.c (plan_a): Try to check out read-only files from RCS or SCCS.
2014
2015 * util.c (move_file): If backing up by linking fails, try copying.
2016 From cek@sdc.boeing.com (Conrad Kimball).
2017
2018 * patch.c (get_some_switches): Eliminate -E option; always
2019 remove empty output files.
2020
2021 * util.c (fetchname): Only undo slash removal for relative
2022 paths if -p was not given.
2023
2024 * Makefile.sh: Add mostlyclean target.
2025
2026Fri Jul 3 23:48:14 1992 David J. MacKenzie (djm@nutrimat.gnu.ai.mit.edu)
2027
2028 * util.c (fetchname): Accept whitespace between `Index:' and filename.
2029 Also plug a small memory leak for diffs against /dev/null.
2030 From eggert@twinsun.com (Paul Eggert).
2031
2032 * common.h: Don't define TRUE and FALSE if already defined.
2033 From phk@data.fls.dk (Poul-Henning Kamp).
2034
2035Wed Apr 29 10:19:33 1992 David J. MacKenzie (djm@churchy.gnu.ai.mit.edu)
2036
2037 * backupfile.c (get_version): Exit if given a bad backup type.
2038
2039Fri Mar 27 09:57:14 1992 Karl Berry (karl at hayley)
2040
2041 * common.h (S_ISDIR, S_ISREG): define these.
2042 * inp.c (plan_a): use S_ISREG, not S_IFREG.
2043 * util.c (fetchname): use S_ISDIR, not S_IFDIR.
2044
2045Mon Mar 16 14:10:42 1992 David J. MacKenzie (djm@wookumz.gnu.ai.mit.edu)
2046
2047 * patchlevel.h: PATCHLEVEL 12u6.
2048
2049Sat Mar 14 13:13:29 1992 David J. MacKenzie (djm at frob.eng.umd.edu)
2050
2051 * Configure, config.h.SH: Check for directory header and unistd.h.
2052
2053 * patch.c (main): If -E was given and output file is empty after
2054 patching, remove it.
2055 (get_some_switches): Recognize -E option.
2056
2057 * patch.c (copy_till): Make garbled output an error, not a warning
2058 that doesn't change the exit status.
2059
2060 * common.h: Protect against system declarations of malloc and realloc.
2061
2062 * Makedist: Add backupfile.[ch].
2063
2064 * Configure: Look for C library where NeXT and SVR4 put it.
2065 Look in /usr/ucb after /bin and /usr/bin for utilities,
2066 and look in /usr/ccs/bin, to make SVR4 happier.
2067 Recognize m68k predefine.
2068
2069 * util.c (fetchname): Test of stat return value was backward.
2070 From csss@scheme.cs.ubc.ca.
2071
2072 * version.c (version): Exit with status 0, not 1.
2073
2074 * Makefile.SH: Add backupfile.[cho].
2075 * patch.c (main): Initialize backup file generation.
2076 (get_some_switches): Add -V option.
2077 * common.h, util,c, patch.c: Replace origext with simple_backup_suffix.
2078 * util.c (move_file): Use find_backup_file_name.
2079
2080Tue Dec 3 11:27:16 1991 David J. MacKenzie (djm at wookumz.gnu.ai.mit.edu)
2081
2082 * patchlevel.h: PATCHLEVEL 12u5.
2083
2084 * Makefile.SH: Change clean, distclean, and realclean targets a
2085 little so they agree with the GNU coding standards.
2086 Add Makefile to addedbyconf, so distclean removes it.
2087
2088 * Configure: Recognize Domain/OS C library in /lib/libc.
2089 From mmuegel@mot.com (Michael S. Muegel).
2090
2091 * pch.c: Fixes from Wayne Davison:
2092 Patch now accepts no-context context diffs that are
2093 specified with an assumed one line hunk (e.g. "*** 10 ****").
2094 Fixed a bug in both context and unified diff processing that would
2095 put a zero-context hunk in the wrong place (one line too soon).
2096 Fixed a minor problem with p_max in unified diffs where it would
2097 set p_max to hunkmax unnecessarily (the only adverse effect was to
2098 not supply empty lines at eof by assuming they were truncated).
2099
2100Tue Jul 2 03:25:51 1991 David J. MacKenzie (djm at geech.gnu.ai.mit.edu)
2101
2102 * Configure: Check for signal declaration in
2103 /usr/include/sys/signal.h as well as /usr/include/signal.h.
2104
2105 * Configure, common.h, config.h.SH: Comment out the sprintf
2106 declaration and tests to determine its return value type. It
2107 conflicts with ANSI C systems' prototypes in stdio.h and the
2108 return value of sprintf is never used anyway -- it's always cast
2109 to void.
2110
2111Thu Jun 27 13:05:32 1991 David J. MacKenzie (djm at churchy.gnu.ai.mit.edu)
2112
2113 * patchlevel.h: PATCHLEVEL 12u4.
2114
2115Thu Feb 21 15:18:14 1991 David J. MacKenzie (djm at geech.ai.mit.edu)
2116
2117 * pch.c (another_hunk): Fix off by 1 error. From
2118 iverson@xstor.com (Tim Iverson).
2119
2120Sun Jan 20 20:18:58 1991 David J. MacKenzie (djm at geech.ai.mit.edu)
2121
2122 * Makefile.SH (all): Don't make a dummy `all' file.
2123
2124 * patchlevel.h: PATCHLEVEL 12u3.
2125
2126 * patch.c (nextarg): New function.
2127 (get_some_switches): Use it, to prevent dereferencing a null
2128 pointer if an option that takes an arg is not given one (is last
2129 on the command line). From Paul Eggert.
2130
2131 * pch.c (another_hunk): Fix from Wayne Davison to recognize
2132 single-line hunks in unified diffs (with a single line number
2133 instead of a range).
2134
2135 * inp.c (rev_in_string): Don't use `s' before defining it. From
2136 Wayne Davison.
2137
2138Mon Jan 7 06:25:11 1991 David J. MacKenzie (djm at geech.ai.mit.edu)
2139
2140 * patchlevel.h: PATCHLEVEL 12u2.
2141
2142 * pch.c (intuit_diff_type): Recognize `+++' in diff headers, for
2143 unified diff format. From unidiff patch 1.
2144
2145Mon Dec 3 00:14:25 1990 David J. MacKenzie (djm at albert.ai.mit.edu)
2146
2147 * patch.c (get_some_switches): Make the usage message more
2148 informative.
2149
2150Sun Dec 2 23:20:18 1990 David J. MacKenzie (djm at albert.ai.mit.edu)
2151
2152 * Configure: When checking for C preprocessor, look for 'abc.*xyz'
2153 instead of 'abc.xyz', so ANSI C preprocessors work.
2154
2155 * Apply fix for -D from ksb@mentor.cc.purdue.edu (Kevin Braunsdorf).
2156
21571990-05-01 Wayne Davison <davison@dri.com>
2158 * patch.c, pch.c: unidiff support added
2159
2160Wed Mar 7 23:47:25 1990 Jim Kingdon (kingdon at pogo.ai.mit.edu)
2161
2162 * pch.c: Call malformed instead of goto malformed
2163 (just allows easier debugging).
2164
2165Tue Jan 23 21:27:00 1990 Jim Kingdon (kingdon at pogo.ai.mit.edu)
2166
2167 * common.h (TMP*NAME): Make these char *, not char [].
2168 patch.c (main): Use TMPDIR (if present) to set TMP*NAME.
2169 common.h: Declare getenv.
2170
2171Sun Dec 17 17:29:48 1989 Jim Kingdon (kingdon at hobbes.ai.mit.edu)
2172
2173 * patch.c (reverse_flag_specified): New variable.
2174 (get_some_switches, reinitialize_almost_everything): Use it.
2175
21761988-06-22 Larry Wall <sdcrdcf!lwall>
2177 patch12:
2178 * common.h: sprintf was declared wrong
2179 * patch.c: rindex() wasn't declared
2180 * patch.man: now avoids Bell System Logo
2181
21821988-06-03 Larry Wall <sdcrdcf!lwall>
2183 patch10:
2184 * common.h: support for shorter extensions.
2185 * inp.c: made a little smarter about sccs files
2186 * patch.c: exit code improved.
2187 better support for non-flexfilenames.
2188 * patch.man: -B switch was contributed.
2189 * pch.c: Can now find patches in shar scripts.
2190 Hunks that swapped and then swapped back could core dump.
2191
21921987-06-04 Larry Wall <sdcrdcf!lwall>
2193 * pch.c: pch_swap didn't swap p_bfake and p_efake.
2194
21951987-02-16 Larry Wall <sdcrdcf!lwall>
2196 * patch.c: Short replacement caused spurious "Out of sync" message.
2197
21981987-01-30 Larry Wall <sdcrdcf!lwall>
2199 * patch.c: Improved diagnostic on sync error.
2200 Moved do_ed_script() to pch.c.
2201 * pch.c: Improved responses to mangled patches.
2202 * pch.h: Added do_ed_script().
2203
22041987-01-05 Larry Wall <sdcrdcf!lwall>
2205 * pch.c: New-style context diffs caused double call to free().
2206
22071986-11-21 Larry Wall <sdcrdcf!lwall>
2208 * patch.c: Fuzz factor caused offset of installed lines.
2209
22101986-11-14 Larry Wall <sdcrdcf!lwall>
2211 * pch.c: Fixed problem where a long pattern wouldn't grow the hunk.
2212 Also restored p_input_line when backtracking so error messages are
2213 right.
2214
22151986-11-03 Larry Wall <sdcrdcf!lwall>
2216 * pch.c: New-style delete triggers spurious assertion error.
2217
22181986-10-29 Larry Wall <sdcrdcf!lwall>
2219 * patch.c: Backwards search could terminate prematurely.
2220 * pch.c: Could falsely report new-style context diff.
2221
22221986-09-17 Larry Wall <sdcrdcf!lwall>
2223 * common.h, inp.c, inp.h, patch.c, patch.man, pch.c, pch.h,
2224 util.h, version.c, version.h: Baseline for netwide release.
2225
22261986-08-01 Larry Wall <sdcrdcf!lwall>
2227 * patch.c: Fixes for machines that can't vararg.
2228 Added fuzz factor. Generalized -p. General cleanup.
2229 Changed some %d's to %ld's. Linted.
2230 * patch.man: Documented -v, -p, -F.
2231 Added notes to patch senders.
2232
22331985-08-15 van%ucbmonet@berkeley
2234 Changes for 4.3bsd diff -c.
2235
22361985-03-26 Larry Wall <sdcrdcf!lwall>
2237 * patch.c: Frozen.
2238 * patch.man: Frozen.
2239
22401985-03-12 Larry Wall <sdcrdcf!lwall>
2241 * patch.c: Now checks for normalness of file to patch.
2242 Check i_ptr and i_womp to make sure they aren't null before freeing.
2243 Also allow ed output to be suppressed.
2244 Changed pfp->_file to fileno(pfp).
2245 Added -p option from jromine@uci-750a.
2246 Added -D (#ifdef) option from joe@fluke.
2247 * patch.man: Documented -p, -D.
2248
22491984-12-06 Larry Wall <sdcrdcf!lwall>
2250 * patch.c: Made smarter about SCCS subdirectories.
2251
22521984-12-05 Larry Wall <sdcrdcf!lwall>
2253 * patch.c: Added -l switch to do loose string comparison.
2254 * patch.man: Added -l switch, and noted bistability bug.
2255
22561984-12-04 Larry Wall <sdcrdcf!lwall>
2257 Branch for sdcrdcf changes.
2258 * patch.c: Failed hunk count not reset on multiple patch file.
2259 * patch.man: Baseline version.
2260
22611984-11-29 Larry Wall <sdcrdcf!lwall>
2262 * patch.c: Linted. Identifiers uniquified. Fixed i_ptr malloc() bug.
2263 Fixed multiple calls to mktemp(). Will now work on machines that can
2264 only read 32767 chars. Added -R option for diffs with new and old
2265 swapped. Various cosmetic changes.
2266
22671984-11-09 Larry Wall <sdcrdcf!lwall>
2268 * patch.c: Initial revision
2269
2270
2271Copyright (C) 1984, 1985, 1986, 1987, 1988 Larry Wall.
2272
2273Copyright (C) 1989, 1990, 1991, 1992, 1993, 1997, 1998, 1999, 2000, 2001,
22742002 Free Software Foundation, Inc.
2275
2276This file is part of GNU Patch.
2277
2278This program is free software; you can redistribute it and/or modify
2279it under the terms of the GNU General Public License as published by
2280the Free Software Foundation; either version 2, or (at your option)
2281any later version.
2282
2283This program is distributed in the hope that they will be useful,
2284but WITHOUT ANY WARRANTY; without even the implied warranty of
2285MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2286GNU General Public License for more details.
2287
2288You should have received a copy of the GNU General Public License
2289along with this program; see the file COPYING. If not, write to
2290the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
2291Boston, MA 02111-1307, USA.
Note: See TracBrowser for help on using the repository browser.