1998-08-06  David Masterson of kla-tencor.com

	* util.c (flush_output): Don't prototype.

Thu Jul  2 16:34:38 1998  Ian Lance Taylor  <ian@cygnus.com>

	Simplify the callback interface:
	* diffrun.h: Don't include <stdarg.h> or <varargs.h>.
	(struct diff_callbacks): Remove printf_output field.
	* util.c: Include <stdarg.h> or <varargs.h>.
	(printf_output): Use vasprintf and write_output callback rather
	than printf_output callback.
	* diff3.c (read_diff): Don't set my_callbacks.printf_output.

Thu Jun 18 12:43:53 1998  Ian Lance Taylor  <ian@cygnus.com>

	* diffrun.h: New file.
	* diff.h: Include diffrun.h.
	(callbacks): New EXTERN variable.
	(write_output, printf_output, flush_output): Declare.
	* diff.c (diff_run): Add parameter callbacks_arg.  Use callback
	functions rather than writing to stdout.  Don't open a file if
	there is a write_output callback.  Call perror_with_name rather
	than perror.
	(usage): Use callbacks if defined rather than writing to stdout.
	(compare_files): Call flush_output rather than fflush (outfile).
	* diff3.c: Include diffrun.h.  Change several functions to use
	output functions from util.c rather than direct printing.  Use
	diff_error and friends rather than printing to stderr.  Set global
	variable outfile.
	(outfile, callbacks): Declare.
	(write_output, printf_output, flush_output): Declare.
	(diff3_run): Add parameter callbacks_arg.  Use callback functions
	rather than writing to stdout.
	(usage): Use callbacks if defined rather than writing to stdout.
	(read_diff): Preserve callbacks and outfile around call to
	diff_run.
	* util.c (perror_with_name): Use error callback if defined.
	(pfatal_with_name, diff_error): Likewise.
	(message5): Use printf_output and write_output.
	(print_message_queue, print_1_line, output_1_line): Likewise.
	(begin_output): Reject paginate_flag if there are output
	callbacks.
	(write_output, printf_output, flush_output): New functions.
	* context.c: Change all output to outfile to use printf_output and
	write_output.
	* ed.c: Likewise.
	* ifdef.c: Likewise.
	* normal.c: Likewise.
	* side.c: Likewise.
	* Makefile.in (SOURCES): Add diffrun.h.
	($(OBJECTS)): Depend upon diffrun.h.

Fri Jan 16 14:58:19 1998  Larry Jones  <larry.jones@sdrc.com>

	* diff.c, diff3.c: Plug memory leaks.

Thu Jan 15 13:36:46 1998  Jim Kingdon  <kingdon@harvey.cyclic.com>

	* Makefile.in (installdirs): New rule, for when ../Makefile
	recurses into this directory (bug reported by W. L. Estes).

Tue Nov 11 10:48:19 1997  Jim Kingdon  <kingdon@harvey.cyclic.com>

	* diff.c (diff_run): Change #ifdef on HAVE_SETMODE to #if to match
	the other uses (fixes compilation error on unix).

	* diff.c (diff_run): Don't set stdout to binary mode.

Mon, 10 Nov 1997  Jim Kingdon

	* diff.c (run_diff): Open outfile in binary mode if --binary.

Thu Nov  6 12:42:12 1997  Karl Fogel  <kfogel@floss.red-bean.com>
	                  and Paul Eggert <eggert@twinsun.com>

	* analyze.c: applied Paul Eggert's patch to fix the diff3 merge
	bug described in ccvs/doc/DIFFUTILS-2.7-BUG:
	(shift_boundaries): new var `inhibit_hunk_merge'; use it to
	control something important that I don't quite understand, but
	Paul apparently does, so that's okay.

Sat Nov  1 14:17:57 1997  Michael L.H. Brouwer  <michael@thi.nl>

	* Makefile.in: Add call to ranlib to build a table of contents for
	the library since some systems seem to require this.

1997-10-28  Jim Kingdon

	* .cvsignore: Add files du jour for Visual C++, vc50.pdb and vc50.idb.

	* system.h: Define HAVE_TIME_H.
	* dir.c [_WIN32]: Define CLOSEDIR_VOID.

1997-10-18  Jim Kingdon

	* build_diff.com: Add diff3.c

Fri Sep 26 14:24:42 1997  Tim Pierce  <twp@twp.tezcat.com>

	* diff.c (diff_run): Save old value of optind before calling
	getopt_long, then restore before returning.  Eventually it would
	be nice if diff_run were fully reentrant.

	New diff3 library for CVS.
	* Makefile.in (SOURCES): Add diff3.c.
	(OBJECTS): Add diff3.o.
	* diff3.c: New file, copied from diffutils-2.7.  See diffutils for
	earlier ChangeLogs.  Undefine initialize_main macro. Remove <signal.h>.
	(diff3_run): Renamed from main().  Add `outfile' argument.  Remove
	SIGCLD handling; we do not fork.  Save optind and reset to 0
	before calling getopt_long; restore after option processing done.
	(read_diff): Use diff_run with a temporary output file,
	instead of forking a diff subprocess and reading from a pipe.
	Change DIFF_PROGRAM to "diff"; this argument is now used only for
	diagnostic reporting.
	(xmalloc, xrealloc): Removed.
	(diff_program): Removed.
	(diff_program_name): Made extern, so it may be used in other
	library calls like `error'.
	(initialize_main): New function.

	Namespace munging.  util.c defines both fatal() and
 	perror_with_exit(), but these cannot be used to abort diff3: both
 	attempt to longjmp() to a buffer set in diff.c, used only by
 	diff_run.  This is an awful solution, but necessary until the code
 	can be cleaned up.  (These functions do not *have* to be renamed,
 	since both are declared static to diff3.c and should not clash
 	with libdiff.a, but it reduces potential confusion.)
	* diff3.c (diff3_fatal): Renamed from fatal.
	(diff3_perror_with_exit): Renamed from perror_with_exit.

	Eliminate exit calls.
	(try_help): Change from `void' to `int'.  Return, do not exit.
	(diff3_fatal, diff3_perror_with_exit, process_diff): Change `exit'
	to DIFF3_ABORT.
	(diff3_run): Initialize jump buffer for nonlocal exits.  Change
 	exit calls to returns.  Change `perror_with_exit' to
 	`perror_with_name' and add a return.  Change `fatal' to
 	`diff_error' and add a return.  The reasoning is that we shouldn't
 	rely on setjmp/longjmp any more than necessary.

	Redirect stdout.
	(check_output): Renamed from check_stdout.  Take stream argument
	instead of blindly checking stdout.  Do not close stream, but
	merely fflush it.
	(diff3_run): Initialize outstream, and close when done.  Pass this
	stream (instead of stdout) to output_diff3_edscript,
	output_diff3_merge, and output_diff3.

Thu Sep 25 14:34:22 1997  Jim Kingdon  <kingdon@harvey.cyclic.com>

	* util.c (begin_output, finish_output): If PR_PROGRAM is not
	defined (VMS), just give a fatal error if --paginate specified.

	* Makefile.in (DISTFILES): Add ChangeLog build_diff.com
	Makefile.in.
	* build_diff.com: New file.

Wed Sep 24 10:27:00 1997  Jim Kingdon  <kingdon@harvey.cyclic.com>

	* Makefile.in: Also set top_srcdir.  Needed to make today's other
	Makefile.in change work.

	* .cvsignore: New file.

	* Makefile.in (COMPILE): Add -I options for srcdir (perhaps
	unneeded) and change -I option for lib to use top_srcdir (needed
	to avoid mixups with CVS's regex.h vs. the system one).

Sun Sep 21 19:44:42 1997  Jim Kingdon  <kingdon@harvey.cyclic.com>

	* Makefile.in (util.o): Change util.c to $<, needed for srcdir.

Sat Sep 20 12:06:41 1997  Tim Pierce  <twp@twp.tezcat.com>

	New diff library for CVS, based on diffutils-2.7.  See diffutils
	for earlier ChangeLogs.
	* Makefile.in, analyze.c, cmpbuf.c, cmpbuf.h, config.hin,
	context.c, diagmeet.note, diff.c, diff.h, dir.c, ed.c, ifdef.c,
	io.c, normal.c, side.c, stamp-h.in, system.h, util.c, version.c:
	New files.
	(COMPILE): Add -I../lib, so we can get getopt.h.

	* Makefile.in: Removed anything not related to libdiff.a.
	(dist-dir): New target, copied from ../lib/Makefile.in.
	(DISTFILES): New variable.
	(SOURCES): Renamed from `srcs'.
	(OBJECTS): Renamed from `libdiff_o'.
	(Makefile): Changed dependencies to reflect
	new, shallow config directory structure.
	(stamp-h.in, config.h.in, config.h, stamp-h): Removed.
	* stamp-h.in, config.h.in: Removed.

	* system.h: Remove dup2 macro (provided by ../lib/dup2.c).
	Include stdlib.h if STDC_HEADERS is defined (not just
	HAVE_STDLIB_H).

Sat Sep 20 05:32:18 1997  Tim Pierce  <twp@twp.tezcat.com>

	Diff librarification.
	
	* diff.c (diff_run): New function, renamed from `main'.
	Initialize `outfile' based on the value of the new `out' filename
	argument.
	(initialize_main): New function.
	* system.h: Removed initialize_main macro.
	* diffmain.c: New file.
	* Makefile.in (diff): Added diffmain.o.
 	(libdiff): New target.
	(AR, libdiff_o): New variables.  libdiff_o does not include
	xmalloc.o, fnmatch.o, getopt.o, getopt1.o, regex.o or error.o,
	because these functions are already present in CVS.  It will take
	some work to make this more general-purpose.

	Redirect standard output.
	* util.c: Redirect stdout to outfile: change all naked `printf'
 	and `putchar' statements to `fprintf (outfile)' and `putc (...,
 	outfile)' throughout.  This should permit redirecting diff output
 	by changing `outfile' just once in `diff_run'.
	(output_in_progress): New variable.
	(begin_output, finish_output): Use `output_in_progress', rather than
	`outfile', as a semaphore to avoid reentrancy problems.
	(finish_output): Close `outfile' only if paginate_flag is set.
	* diff.c (check_output): New function, was check_stdout.  Take a
	`file' argument, and flush it instead of closing it.
	(diff_run): Change check_stdout to check_output.
	(compare_files): Fflush outfile, not stdout.
	
	Eliminate exit statements.
	* diff.h: Include setjmp.h.
	(diff_abort_buf): New variable.
	(DIFF_ABORT): New macro.
	* diff.c (diff_run): Change all `exit' statements to `return'.
	Set up diff_abort_buf, so we can abort diff without
	terminating (for libdiff.a).
	(try_help): Return int instead of void; do not exit.
	* util.c (fatal): Use DIFF_ABORT instead of exit.
	(pfatal_with_name): Use DIFF_ABORT instead of exit.

	Namespace cleanup (rudimentary).  Strictly speaking, this is not
 	necessary to make diff into a library.  However, namespace
	clashes between diff and CVS must be resolved immediately, since
	CVS is the first application targeted for use with difflib.
	
	* analyze.c, diff.c, diff.h, util.c (diff_error): Renamed from `error'.
	
	* version.c, diff.c, diff.h, cmp.c, diff3.c, sdiff.c
	(diff_version_string): Renamed from version_string.
	* diff.c, util.c, diff.h, diff3.c, error.c (diff_program_name):
	Renamed from program_name.

	* util.c (xmalloc, xrealloc): Removed.
	* Makefile.in (diff_o): Added error.o and xmalloc.o.

