OpenBSD CVS

CVS log for src/usr.bin/diff/diffreg.c


[BACK] Up to [local] / src / usr.bin / diff

Request diff between arbitrary revisions


Default branch: MAIN


Revision 1.95 / (download) - annotate - [select for diffs], Sun Oct 24 21:24:16 2021 UTC (2 years, 6 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_7_5_BASE, OPENBSD_7_5, OPENBSD_7_4_BASE, OPENBSD_7_4, OPENBSD_7_3_BASE, OPENBSD_7_3, OPENBSD_7_2_BASE, OPENBSD_7_2, OPENBSD_7_1_BASE, OPENBSD_7_1, HEAD
Changes since 1.94: +2 -2 lines
Diff to previous 1.94 (colored)

For open/openat, if the flags parameter does not contain O_CREAT, the
3rd (variadic) mode_t parameter is irrelevant.  Many developers in the past
have passed mode_t (0, 044, 0644, or such), which might lead future people
to copy this broken idiom, and perhaps even believe this parameter has some
meaning or implication or application. Delete them all.
This comes out of a conversation where tb@ noticed that a strange (but
intentional) pledge behaviour is to always knock-out high-bits from
mode_t on a number of system calls as a safety factor, and his bewilderment
that this appeared to be happening against valid modes (at least visually),
but no sorry, they are all irrelevant junk.  They could all be 0xdeafbeef.
ok millert

Revision 1.94 / (download) - annotate - [select for diffs], Wed Sep 1 18:16:52 2021 UTC (2 years, 8 months ago) by halex
Branch: MAIN
CVS Tags: OPENBSD_7_0_BASE, OPENBSD_7_0
Changes since 1.93: +5 -1 lines
Diff to previous 1.93 (colored)

consider two files sharing the same inode identical

This gives a substantial speedup when comparing directory
structures with many hardlinked files, e.g. when using
rsnapshot for incremental backup.

ok stsp@ millert@

Revision 1.93 / (download) - annotate - [select for diffs], Fri Jun 28 13:35:00 2019 UTC (4 years, 10 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_6_9_BASE, OPENBSD_6_9, OPENBSD_6_8_BASE, OPENBSD_6_8, OPENBSD_6_7_BASE, OPENBSD_6_7, OPENBSD_6_6_BASE, OPENBSD_6_6
Changes since 1.92: +5 -5 lines
Diff to previous 1.92 (colored)

When system calls indicate an error they return -1, not some arbitrary
value < 0.  errno is only updated in this case.  Change all (most?)
callers of syscalls to follow this better, and let's see if this strictness
helps us in the future.

Revision 1.92 / (download) - annotate - [select for diffs], Fri Jun 28 05:35:34 2019 UTC (4 years, 10 months ago) by deraadt
Branch: MAIN
Changes since 1.91: +2 -2 lines
Diff to previous 1.91 (colored)

mkstemp() returns -1 on failure

Revision 1.91 / (download) - annotate - [select for diffs], Tue Mar 1 20:57:35 2016 UTC (8 years, 2 months ago) by natano
Branch: MAIN
CVS Tags: OPENBSD_6_5_BASE, OPENBSD_6_5, OPENBSD_6_4_BASE, OPENBSD_6_4, OPENBSD_6_3_BASE, OPENBSD_6_3, OPENBSD_6_2_BASE, OPENBSD_6_2, OPENBSD_6_1_BASE, OPENBSD_6_1, OPENBSD_6_0_BASE, OPENBSD_6_0
Changes since 1.90: +4 -3 lines
Diff to previous 1.90 (colored)

Rectify line numbers for s/.// commands in ed-style diffs.

When diff encounters a line that consists of a single dot, it emits two
dots instead, stops the current command and emits a substitute command
to replace the double dot with a single one. Then it restarts the
(original) command if necessary and inserts further lines. This is done
because a single dot on a line does have special meaning in ed. (It
stops text insertion.)

Following issues are fixed by this commit.

- The line number for the substitute command should be the number of the
most recently inserted line. diff instead uses the number of the first
inserted line of the current hunk. The first character of that line is
removed when applying the diff, while the superfluous dot is not.

- The line number of the restarted command is not adjusted for the
number of lines already inserted, resulting in the reordering of lines..

- When there is a bare dot in the replacement text of a change command,
too many lines are deleted, because a second change command is emitted.
An append command should be emitted instead, because the target lines
have already been removed by the first change command.

tweaks and ok stefan@

Revision 1.90 / (download) - annotate - [select for diffs], Mon Oct 26 12:52:27 2015 UTC (8 years, 6 months ago) by tedu
Branch: MAIN
CVS Tags: OPENBSD_5_9_BASE, OPENBSD_5_9
Changes since 1.89: +3 -12 lines
Diff to previous 1.89 (colored)

remove TMPDIR support. ok millert

Revision 1.89 / (download) - annotate - [select for diffs], Tue Oct 13 16:37:17 2015 UTC (8 years, 7 months ago) by tobias
Branch: MAIN
Changes since 1.88: +2 -2 lines
Diff to previous 1.88 (colored)

Replace our /^\.\././ expression with /.//. The term is simpler and has
the same meaning in our diff ed-context.

As a bonus, our ed-diff output can be processed by GNU patch now, too.

okay millert@

Revision 1.88 / (download) - annotate - [select for diffs], Mon Oct 5 20:15:00 2015 UTC (8 years, 7 months ago) by millert
Branch: MAIN
Changes since 1.87: +3 -56 lines
Diff to previous 1.87 (colored)

Remove the non-standard -l flag that pipes the output through pr(1).
Based on a diff from and OK deraadt@

Revision 1.87 / (download) - annotate - [select for diffs], Fri Sep 25 16:16:26 2015 UTC (8 years, 7 months ago) by tedu
Branch: MAIN
Changes since 1.86: +9 -9 lines
Diff to previous 1.86 (colored)

xmalloc/free wrappers don't need to support 20 year old non comformance

Revision 1.86 / (download) - annotate - [select for diffs], Wed Apr 29 04:00:25 2015 UTC (9 years ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_5_8_BASE, OPENBSD_5_8
Changes since 1.85: +9 -9 lines
Diff to previous 1.85 (colored)

Change internal xrealloc() to a idiom-following xreallocarray().
This loses a "new size is 0" failure case.  Probably not relevant;
and since we develop this in OpenBSD, we'll catch that before someone
else imports this...
ok millert

Revision 1.85 / (download) - annotate - [select for diffs], Thu Feb 5 12:59:57 2015 UTC (9 years, 3 months ago) by millert
Branch: MAIN
CVS Tags: OPENBSD_5_7_BASE, OPENBSD_5_7
Changes since 1.84: +2 -1 lines
Diff to previous 1.84 (colored)

Include stdint.h, not limits.h to get SIZE_MAX.  OK guenther@

Revision 1.84 / (download) - annotate - [select for diffs], Fri Jan 16 06:40:07 2015 UTC (9 years, 4 months ago) by deraadt
Branch: MAIN
Changes since 1.83: +15 -12 lines
Diff to previous 1.83 (colored)

Replace <sys/param.h> with <limits.h> and other less dirty headers where
possible.  Annotate <sys/param.h> lines with their current reasons.  Switch
to PATH_MAX, NGROUPS_MAX, HOST_NAME_MAX+1, LOGIN_NAME_MAX, etc.  Change
MIN() and MAX() to local definitions of MINIMUM() and MAXIMUM() where
sensible to avoid pulling in the pollution.  These are the files confirmed
through binary verification.
ok guenther, millert, doug (helped with the verification protocol)

Revision 1.83 / (download) - annotate - [select for diffs], Wed Aug 27 15:22:40 2014 UTC (9 years, 8 months ago) by kspillner
Branch: MAIN
Changes since 1.82: +9 -5 lines
Diff to previous 1.82 (colored)

Ensure diff -uw always produces valid output when one file doesn't end
with a newline.  Issue reported by guenther@.

ok guenther@

Revision 1.82 / (download) - annotate - [select for diffs], Sun Jul 8 15:48:56 2012 UTC (11 years, 10 months ago) by stsp
Branch: MAIN
CVS Tags: OPENBSD_5_6_BASE, OPENBSD_5_6, OPENBSD_5_5_BASE, OPENBSD_5_5, OPENBSD_5_4_BASE, OPENBSD_5_4, OPENBSD_5_3_BASE, OPENBSD_5_3, OPENBSD_5_2_BASE, OPENBSD_5_2
Changes since 1.81: +3 -6 lines
Diff to previous 1.81 (colored)

Switch diff(1) binary file detection from !(isprint() || isspace()) to
checking for embedded NULs, as was done for grep(1) some time ago.
Avoids problems with e.g. latin1-encoded files being treated as binary, since
isprint() uses only ASCII by default and diff(1) doesn't call setlocale().
prodded by and ok bluhm

Revision 1.81 / (download) - annotate - [select for diffs], Tue May 22 12:30:24 2012 UTC (11 years, 11 months ago) by millert
Branch: MAIN
Changes since 1.80: +6 -2 lines
Diff to previous 1.80 (colored)

Strip trailing slashes from directory in splice() before
appending the file portion.  OK krw@ matthew@

Revision 1.80 / (download) - annotate - [select for diffs], Fri Apr 1 17:25:26 2011 UTC (13 years, 1 month ago) by nicm
Branch: MAIN
CVS Tags: OPENBSD_5_1_BASE, OPENBSD_5_1, OPENBSD_5_0_BASE, OPENBSD_5_0
Changes since 1.79: +9 -6 lines
Diff to previous 1.79 (colored)

Move an isqrt() call outside a macro, from Michael W Bombardieri.

ok ray

Revision 1.79 / (download) - annotate - [select for diffs], Fri Jul 16 21:47:02 2010 UTC (13 years, 10 months ago) by ray
Branch: MAIN
CVS Tags: OPENBSD_4_9_BASE, OPENBSD_4_9, OPENBSD_4_8_BASE, OPENBSD_4_8
Changes since 1.78: +3 -2 lines
Diff to previous 1.78 (colored)

Close FILEs when fork fails.

OK nicm

Revision 1.78 / (download) - annotate - [select for diffs], Fri Jul 16 08:06:00 2010 UTC (13 years, 10 months ago) by ray
Branch: MAIN
Changes since 1.77: +2 -2 lines
Diff to previous 1.77 (colored)

diff exits 2 on error, not 1.

OK millert

Revision 1.77 / (download) - annotate - [select for diffs], Thu Jul 15 21:32:37 2010 UTC (13 years, 10 months ago) by ray
Branch: MAIN
Changes since 1.76: +50 -52 lines
Diff to previous 1.76 (colored)

cvs and rcs use diff_output() to print everything since it is not
always to stdout. A large number of differences are due to this.
This diff reduces many more differences between diff and cvs/rcs.
Personally I think it's kinda ugly. =(

"Looks fine" millert

Revision 1.76 / (download) - annotate - [select for diffs], Thu Jul 15 18:31:33 2010 UTC (13 years, 10 months ago) by ray
Branch: MAIN
Changes since 1.75: +4 -4 lines
Diff to previous 1.75 (colored)

Remove unused arguments from check(). From cvs/rcs.

OK millert

Revision 1.75 / (download) - annotate - [select for diffs], Wed Jul 14 22:15:57 2010 UTC (13 years, 10 months ago) by ray
Branch: MAIN
Changes since 1.74: +4 -5 lines
Diff to previous 1.74 (colored)

Return -1 on error as advertised.
Handle case when only one stream failed.

OK otto, millert

Revision 1.74 / (download) - annotate - [select for diffs], Mon Mar 22 19:33:19 2010 UTC (14 years, 2 months ago) by schwarze
Branch: MAIN
Changes since 1.73: +4 -2 lines
Diff to previous 1.73 (colored)

Even though this cannot happen in the diff -r case,
even though diff(1) will exit(3) soon after this mkstemp(3) failure,
even though this cannot really leak anything,
close the file descriptor as soon as it is not used any more
to make correctness of the code more obvious.

patch from Igor Zinovik <zinovik dot igor at gmail dot com> on tech@
"looks nice" deraadt@

Revision 1.73 / (download) - annotate - [select for diffs], Tue Oct 27 23:59:37 2009 UTC (14 years, 6 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_4_7_BASE, OPENBSD_4_7
Changes since 1.72: +1 -5 lines
Diff to previous 1.72 (colored)

rcsid[] and sccsid[] and copyright[] are essentially unmaintained (and
unmaintainable).  these days, people use source.  these id's do not provide
any benefit, and do hurt the small install media
(the 33,000 line diff is essentially mechanical)
ok with the idea millert, ok dms

Revision 1.72 / (download) - annotate - [select for diffs], Sun Jun 7 08:39:13 2009 UTC (14 years, 11 months ago) by ray
Branch: MAIN
CVS Tags: OPENBSD_4_6_BASE, OPENBSD_4_6
Changes since 1.71: +48 -55 lines
Diff to previous 1.71 (colored)

More cvs/diff/rcs convergence:
1. Mostly variable/function renaming, SIZE_T_MAX->SIZE_MAX, and
spacing.
2. One strchr -> strncspn.
3. diff had a weird thing where it set file[12] = ofile[12] but
never updated file or ofile, then if file and ofile were different
it freed it. I removed it.

OK millert

Revision 1.71 / (download) - annotate - [select for diffs], Sat Jun 6 15:00:27 2009 UTC (14 years, 11 months ago) by ray
Branch: MAIN
Changes since 1.70: +81 -73 lines
Diff to previous 1.70 (colored)

Pull changes from rcsdiff, similar to what was pulled into cvsdiff.

OK millert

Revision 1.70 / (download) - annotate - [select for diffs], Tue Sep 11 15:47:17 2007 UTC (16 years, 8 months ago) by gilles
Branch: MAIN
CVS Tags: OPENBSD_4_5_BASE, OPENBSD_4_5, OPENBSD_4_4_BASE, OPENBSD_4_4, OPENBSD_4_3_BASE, OPENBSD_4_3
Changes since 1.69: +4 -6 lines
Diff to previous 1.69 (colored)

use strcspn to properly overwrite '\n' in fgets returned buffer

ok pyr@, ray@, millert@, moritz@, chl@

Revision 1.69 / (download) - annotate - [select for diffs], Sat Jun 9 05:16:21 2007 UTC (16 years, 11 months ago) by ray
Branch: MAIN
CVS Tags: OPENBSD_4_2_BASE, OPENBSD_4_2
Changes since 1.68: +42 -42 lines
Diff to previous 1.68 (colored)

- Change sizeof(type) to sizeof(*ptr).
- Move function prototypes before variables.

No binary change.

OK otto and millert.

Revision 1.68 / (download) - annotate - [select for diffs], Tue May 29 18:24:56 2007 UTC (16 years, 11 months ago) by ray
Branch: MAIN
Changes since 1.67: +50 -61 lines
Diff to previous 1.67 (colored)

Bring in some changes from rcsdiff:
1. Replace all the e*alloc functions with the x*alloc versions.
2. Whitespace syncs according to style.
3. Remove the __inline stuff.
4. Remove the min/max functions, using the MAX/MIN macros instead.

OK millert@

Revision 1.67 / (download) - annotate - [select for diffs], Sun Mar 18 21:12:27 2007 UTC (17 years, 2 months ago) by espie
Branch: MAIN
Changes since 1.66: +23 -6 lines
Diff to previous 1.66 (colored)

improve -p for C++ code: classes definition often have
public:/protected:/private: at the start of line.
This lets the -p scanner just take note of the section and keep
looking for the actual class definition.

Also increase function name bufsize so it shows most of these pesky C++
decls...

okay otto@

Revision 1.66 / (download) - annotate - [select for diffs], Fri Feb 23 08:03:19 2007 UTC (17 years, 2 months ago) by espie
Branch: MAIN
CVS Tags: OPENBSD_4_1_BASE, OPENBSD_4_1
Changes since 1.65: +10 -8 lines
Diff to previous 1.65 (colored)

print the header only once.
okay millert@

Revision 1.65 / (download) - annotate - [select for diffs], Thu Feb 22 01:44:36 2007 UTC (17 years, 3 months ago) by millert
Branch: MAIN
Changes since 1.64: +14 -12 lines
Diff to previous 1.64 (colored)

Defer printing of the per-file diff header until after the regexp
"ignore" processing has finished.  This way we only print the header
for files that have diffs.  The new behavior matches GNU diff (which
is where the -I flag comes from).  OK otto@ espie@

Revision 1.64 / (download) - annotate - [select for diffs], Wed Feb 22 07:26:08 2006 UTC (18 years, 2 months ago) by otto
Branch: MAIN
CVS Tags: OPENBSD_4_0_BASE, OPENBSD_4_0, OPENBSD_3_9_BASE, OPENBSD_3_9
Changes since 1.63: +6 -4 lines
Diff to previous 1.63 (colored)

Append two string using strlcpy()/strlcat() instead of snprintf() to
avoid having to check for encoding errors returned by snprintf().
From Ray Lai; ok millert@ jaredy@

Revision 1.63 / (download) - annotate - [select for diffs], Thu Feb 16 08:15:05 2006 UTC (18 years, 3 months ago) by otto
Branch: MAIN
Changes since 1.62: +4 -2 lines
Diff to previous 1.62 (colored)

Strip newline from lines used with -I, otherwise ^$ will match all
lines and ignore them all. With and ok jaredy@

Revision 1.62 / (download) - annotate - [select for diffs], Thu Jan 13 08:27:45 2005 UTC (19 years, 4 months ago) by otto
Branch: MAIN
CVS Tags: OPENBSD_3_8_BASE, OPENBSD_3_8, OPENBSD_3_7_BASE, OPENBSD_3_7
Changes since 1.61: +5 -2 lines
Diff to previous 1.61 (colored)

Handle all isspace() chars the same for -w and -b. ok millert@ markus@

Revision 1.61 / (download) - annotate - [select for diffs], Thu Dec 9 18:56:10 2004 UTC (19 years, 5 months ago) by millert
Branch: MAIN
Changes since 1.60: +21 -12 lines
Diff to previous 1.60 (colored)

If the -L option is specified twice, use it for the second filename
like GNU diff does.  Adapted from a diff by YAMAMOTO Takashi

Revision 1.60 / (download) - annotate - [select for diffs], Sat Nov 27 19:16:25 2004 UTC (19 years, 5 months ago) by otto
Branch: MAIN
Changes since 1.59: +4 -4 lines
Diff to previous 1.59 (colored)

Use unsigned char for bytes that are fed to isxxx() functions, to improve
portability. Spotted by YAMAMOTO Takashi.
ok millert@

Revision 1.59 / (download) - annotate - [select for diffs], Wed Oct 20 08:52:19 2004 UTC (19 years, 7 months ago) by otto
Branch: MAIN
Changes since 1.58: +4 -4 lines
Diff to previous 1.58 (colored)

Change tabs in string constants to \t. "of course" deraadt@

Revision 1.58 / (download) - annotate - [select for diffs], Tue Sep 14 23:04:27 2004 UTC (19 years, 8 months ago) by deraadt
Branch: MAIN
Changes since 1.57: +5 -5 lines
Diff to previous 1.57 (colored)

use sizeof(struct cand) instead of defining an unused cand object, and
then doing sizeof(cand).  silly kids

Revision 1.57 / (download) - annotate - [select for diffs], Sun Jun 20 18:47:45 2004 UTC (19 years, 11 months ago) by otto
Branch: MAIN
CVS Tags: OPENBSD_3_6_BASE, OPENBSD_3_6
Changes since 1.56: +53 -2 lines
Diff to previous 1.56 (colored)

Implement -I option: ignore changes matching a set of regexes.  From
Jared Yanovich, with twists from millert@ and me. Testing by brad@,
sturm@ and pval@. ok millert@

Revision 1.56 / (download) - annotate - [select for diffs], Fri Jun 18 07:23:50 2004 UTC (19 years, 11 months ago) by otto
Branch: MAIN
Changes since 1.55: +4 -4 lines
Diff to previous 1.55 (colored)

If a new hunk immediately follows the previous one, merge them
into a single hunk. This makes diff produce the same diff as gdiff
in more cases. Found by brad@ and sturm@ using the ports tree.

ok millert@

Revision 1.55 / (download) - annotate - [select for diffs], Wed Jan 7 17:18:32 2004 UTC (20 years, 4 months ago) by otto
Branch: MAIN
CVS Tags: OPENBSD_3_5_BASE, OPENBSD_3_5
Changes since 1.54: +61 -6 lines
Diff to previous 1.54 (colored)

Implement -p option.

"works here" millert@ ok miod@ deraadt@

Revision 1.54 / (download) - annotate - [select for diffs], Sat Nov 22 18:02:44 2003 UTC (20 years, 6 months ago) by millert
Branch: MAIN
Changes since 1.53: +5 -4 lines
Diff to previous 1.53 (colored)

Fix diff -q exit value which was broken in last commit.

Revision 1.53 / (download) - annotate - [select for diffs], Fri Nov 21 01:28:01 2003 UTC (20 years, 6 months ago) by millert
Branch: MAIN
Changes since 1.52: +7 -7 lines
Diff to previous 1.52 (colored)

Fix broken assumption that a file must contain differences if files_differ()
fails.  Fixes "diff -i" exit value.  Problem found by Claudio Jeker.

Revision 1.52 / (download) - annotate - [select for diffs], Mon Nov 10 18:51:35 2003 UTC (20 years, 6 months ago) by millert
Branch: MAIN
Changes since 1.51: +8 -4 lines
Diff to previous 1.51 (colored)

Din't print the "No newline at end of file" to inline (ie: to stdout)
for edit scripts.  Instead, print it to stderr.  This matches the
GNU diff behavior and fixes a problem with RCS and files with no
trailing newline.  tedu@ OK

Revision 1.51 / (download) - annotate - [select for diffs], Tue Oct 28 13:23:59 2003 UTC (20 years, 6 months ago) by avsm
Branch: MAIN
Changes since 1.50: +3 -3 lines
Diff to previous 1.50 (colored)

prototype declared static, but function was not. add static to function.
millert@ otto@ ok

Revision 1.50 / (download) - annotate - [select for diffs], Sun Sep 7 07:53:01 2003 UTC (20 years, 8 months ago) by tedu
Branch: MAIN
CVS Tags: OPENBSD_3_4_BASE, OPENBSD_3_4
Changes since 1.49: +4 -5 lines
Diff to previous 1.49 (colored)

correct ascii file test.  ok deraadt@ pb@

Revision 1.49 / (download) - annotate - [select for diffs], Wed Aug 13 20:44:15 2003 UTC (20 years, 9 months ago) by millert
Branch: MAIN
Changes since 1.48: +6 -6 lines
Diff to previous 1.48 (colored)

Based on what otto@ said on icb.  The expensive thing in diff is
newcand() (this is what blows up the memory usage so badly).  Instead
of counting how many times we go through the loop, count how many
times we called newcand().  I renamed loopcount -> numtries since
it is no longer the number of loop runs.  This fixes espie@'s regression.
tedu@ OK

Revision 1.48 / (download) - annotate - [select for diffs], Fri Aug 8 16:09:26 2003 UTC (20 years, 9 months ago) by otto
Branch: MAIN
Changes since 1.47: +12 -8 lines
Diff to previous 1.47 (colored)

Guess the number of lines in a file and use that number for initial
memory allocation. Initial version by me, cleanup by millert@.

ok millert@

Revision 1.47 / (download) - annotate - [select for diffs], Thu Jul 31 20:00:03 2003 UTC (20 years, 9 months ago) by otto
Branch: MAIN
Changes since 1.46: +29 -25 lines
Diff to previous 1.46 (colored)

- Change the hash function to a simple multiplicative one. The old
hash function was apparently optimized for 16 bit processors and
generates quite some collisions.
- Fix another case of excessive reallocing.

ok millert@

Revision 1.46 / (download) - annotate - [select for diffs], Thu Jul 31 02:53:57 2003 UTC (20 years, 9 months ago) by millert
Branch: MAIN
Changes since 1.45: +4 -4 lines
Diff to previous 1.45 (colored)

o correct exit code when comparing stdin and stdin (a noop)
o after copying to a temp file, lseek() to the beginning so the
  inline cmp routine works.
Fixes an exit code issue when comparing against stdin.

Revision 1.45 / (download) - annotate - [select for diffs], Tue Jul 29 18:38:47 2003 UTC (20 years, 9 months ago) by deraadt
Branch: MAIN
Changes since 1.44: +3 -3 lines
Diff to previous 1.44 (colored)

clean

Revision 1.44 / (download) - annotate - [select for diffs], Sun Jul 27 18:58:26 2003 UTC (20 years, 9 months ago) by millert
Branch: MAIN
Changes since 1.43: +3 -2 lines
Diff to previous 1.43 (colored)

We need to initialize clen to 0 each time through diffreg() for
when diffreg() is called multiple times (i.e. in directory mode).
Fixes a hang I saw doing "diff -r" of two large directory trees.

Revision 1.43 / (download) - annotate - [select for diffs], Sun Jul 27 07:39:52 2003 UTC (20 years, 9 months ago) by otto
Branch: MAIN
Changes since 1.42: +40 -7 lines
Diff to previous 1.42 (colored)

- Use a heuristic to bound  memory and cpu usage, at the cost of
producing suboptimal diffs for large file containing lots of changes.
Switch heuristic off with -d/--minimal (GNU compatible). Some hints
from millert@.
- Improve performance by reducing the number of realloc(3) calls.

ok millert@ tedu@

Revision 1.42 / (download) - annotate - [select for diffs], Wed Jul 23 22:01:36 2003 UTC (20 years, 10 months ago) by tedu
Branch: MAIN
Changes since 1.41: +5 -5 lines
Diff to previous 1.41 (colored)

better ascii test for fewer false negatives.  ok millert@

Revision 1.41 / (download) - annotate - [select for diffs], Tue Jul 22 01:16:01 2003 UTC (20 years, 10 months ago) by millert
Branch: MAIN
Changes since 1.40: +40 -28 lines
Diff to previous 1.40 (colored)

Implement the -L and -T options from GNU diff.

Revision 1.40 / (download) - annotate - [select for diffs], Tue Jul 22 00:20:40 2003 UTC (20 years, 10 months ago) by millert
Branch: MAIN
Changes since 1.39: +5 -14 lines
Diff to previous 1.39 (colored)

Historically, when comparing two directories in -e mode, BSD diff
printed a header that turned the output into an actual script that
called ed(1) to make the changes.  This conflicts with POSIX so the
header has been removed and the standard diff header is used instead.

Revision 1.39 / (download) - annotate - [select for diffs], Tue Jul 22 00:15:55 2003 UTC (20 years, 10 months ago) by millert
Branch: MAIN
Changes since 1.38: +38 -9 lines
Diff to previous 1.38 (colored)

Don't print lines consisting solely of a dot ('.') in -e mode since
that will confuse ed(1).
POSIX says "one way to fix this bug is to output two periods whenever a lone
period is needed, then terminate the append command with a period, and then
use the substitute command to convert the two periods into one period."
This is exactly what I have done.

Revision 1.38 / (download) - annotate - [select for diffs], Mon Jul 21 21:59:58 2003 UTC (20 years, 10 months ago) by henning
Branch: MAIN
Changes since 1.37: +3 -3 lines
Diff to previous 1.37 (colored)

a little KNF

Revision 1.37 / (download) - annotate - [select for diffs], Mon Jul 21 21:57:22 2003 UTC (20 years, 10 months ago) by millert
Branch: MAIN
Changes since 1.36: +3 -3 lines
Diff to previous 1.36 (colored)

POSIX-compliant output when there are two paths w/ the same name but
one is a file and the other is a directory in -r mode (cosmetic).

Revision 1.36 / (download) - annotate - [select for diffs], Mon Jul 21 15:56:48 2003 UTC (20 years, 10 months ago) by millert
Branch: MAIN
Changes since 1.35: +46 -40 lines
Diff to previous 1.35 (colored)

Expand change records array as needed; passes Otto's new regression test.

Revision 1.35 / (download) - annotate - [select for diffs], Thu Jul 17 21:54:28 2003 UTC (20 years, 10 months ago) by millert
Branch: MAIN
Changes since 1.34: +7 -26 lines
Diff to previous 1.34 (colored)

cc -O2 -pipe  -DSTDC_HEADERS=1 -DHAVE_UNISTD_H=1 -DDIRENT=1 -DDYN_ALLOC   -c unpGet rid of ugly hack in readhash() that appears to be there for
machines with a 16 bit word size.  Also replace (HALFLONG - 1) with
a new define, HASHMASK since it really is a mask.
None of this results in any actual change in behavior.

Revision 1.34 / (download) - annotate - [select for diffs], Wed Jul 16 21:39:06 2003 UTC (20 years, 10 months ago) by millert
Branch: MAIN
Changes since 1.33: +42 -24 lines
Diff to previous 1.33 (colored)

Deal with files that lack a final newline before EOF (you naughty
emacs users!).  In most cases this just means checking for EOF in
addition to '\n'.  However, we need to tread carefully in readhash().
There we return 0 on EOF iff it is the first char in a "line".

Additionally, if the -b or -w flags were specified and the last
character in one file was '\n' but the other file is missing '\n',
pretend that we didn't see the newline in the one file.  This is
consistent with GNU diff.  For the non-{b,w} case, print
"\ No newline at end of file" when we see EOF before a newline in
one file where the other file has one.  Again, this is for consistency
with GNU diff and patch(1) in -current knows how to interpret this
message.

OK tedu@ and otto@

Revision 1.33 / (download) - annotate - [select for diffs], Tue Jul 15 23:17:56 2003 UTC (20 years, 10 months ago) by millert
Branch: MAIN
Changes since 1.32: +27 -12 lines
Diff to previous 1.32 (colored)

Fix line ranges for unidiffs.  Problem noted by otto@

Revision 1.32 / (download) - annotate - [select for diffs], Wed Jul 9 00:39:26 2003 UTC (20 years, 10 months ago) by millert
Branch: MAIN
Changes since 1.31: +36 -64 lines
Diff to previous 1.31 (colored)

Unlink temp file as soon as it is opened and return a FILE * for
it so we don't have to worry about cleanup.  This means the quit()
signal handler and error/errorx can go away too.

Move splice() out of diffreg() and into diff.c where it belongs
since we don't want to be calling splice() for a directory diff.
Add a check for mismatched paths (one file, one dir) in diffreg.c.

deraadt@ OK

Revision 1.31 / (download) - annotate - [select for diffs], Wed Jul 9 00:07:44 2003 UTC (20 years, 10 months ago) by millert
Branch: MAIN
Changes since 1.30: +78 -29 lines
Diff to previous 1.30 (colored)

Re-implement -l flag; diff -l now works correctly in non-directory
mode (like GNU diff).

Revision 1.30 / (download) - annotate - [select for diffs], Tue Jul 8 04:51:30 2003 UTC (20 years, 10 months ago) by millert
Branch: MAIN
Changes since 1.29: +3 -3 lines
Diff to previous 1.29 (colored)

fix pasto in last commit

Revision 1.29 / (download) - annotate - [select for diffs], Tue Jul 8 04:45:32 2003 UTC (20 years, 10 months ago) by millert
Branch: MAIN
Changes since 1.28: +15 -11 lines
Diff to previous 1.28 (colored)

o Avoid a temp file if using stdin and stdin is redirected from a regular file
o Fix a double free in the temmp file case

Revision 1.28 / (download) - annotate - [select for diffs], Sun Jul 6 22:17:21 2003 UTC (20 years, 10 months ago) by millert
Branch: MAIN
Changes since 1.27: +6 -2 lines
Diff to previous 1.27 (colored)

Add -q option from GNU diff

Revision 1.27 / (download) - annotate - [select for diffs], Sun Jul 6 20:48:59 2003 UTC (20 years, 10 months ago) by millert
Branch: MAIN
Changes since 1.26: +317 -202 lines
Diff to previous 1.26 (colored)

Some fairly major changes:
 o -N is implemented
 o -X is implemented
 o -x is implemented
 o diff.c has been rewritten and GNU long options are now supported
 o diffdir.c has been rewritten
    + no longer does fork + exec of /usr/bin/diff
    + can be called recursively (and will be for -r)
 o diff.h
    + don't include any .h files here any more, do it in the .c files
    + no Bell Labs code in this, gets a UCB copyright (the 32v sources
      only have a diff.c and there is nothing in common).
 o diffreg.c
    + most all remaining globals are now private to diffreg.c
    + files are only opened once
    + dynamically allocated objects are either freed or realloced
    + added missing UCB copyright (there were lots of UCB changes)
    + print correct thing when -s is specified
OK deraadt@

Revision 1.26 / (download) - annotate - [select for diffs], Fri Jul 4 17:37:07 2003 UTC (20 years, 10 months ago) by millert
Branch: MAIN
Changes since 1.25: +1 -6 lines
Diff to previous 1.25 (colored)

Kill diff -h, we don't use or want diffh.  Discussed w/ tedu@

Revision 1.25 / (download) - annotate - [select for diffs], Fri Jul 4 02:54:36 2003 UTC (20 years, 10 months ago) by millert
Branch: MAIN
Changes since 1.24: +4 -3 lines
Diff to previous 1.24 (colored)

Some cosmetic fixes:
o get rid of now-unused tempfile variable
o move inifdef into diffreg.c (only used there)
o correct a comment
o use _PATH_DIFF, _PATH_DIFFH and _PATH_PR instead of variables set to them
o get rid of hack to look for pr and diff in /bin

Revision 1.24 / (download) - annotate - [select for diffs], Wed Jul 2 18:54:13 2003 UTC (20 years, 10 months ago) by millert
Branch: MAIN
Changes since 1.23: +6 -4 lines
Diff to previous 1.23 (colored)

Treat /dev/null specially; there is no need to make a temp file for it.

Revision 1.23 / (download) - annotate - [select for diffs], Fri Jun 27 20:28:13 2003 UTC (20 years, 10 months ago) by tedu
Branch: MAIN
Changes since 1.22: +4 -1 lines
Diff to previous 1.22 (colored)

-a to force ascii compare.  ok millert

Revision 1.22 / (download) - annotate - [select for diffs], Thu Jun 26 22:04:45 2003 UTC (20 years, 10 months ago) by millert
Branch: MAIN
Changes since 1.21: +12 -25 lines
Diff to previous 1.21 (colored)

Remove cruft; We don't have the -I, -1 or -2 options anymore so we don't
need the associated scaffolding.  tedu@ OK

Revision 1.21 / (download) - annotate - [select for diffs], Thu Jun 26 18:19:29 2003 UTC (20 years, 10 months ago) by millert
Branch: MAIN
Changes since 1.20: +33 -65 lines
Diff to previous 1.20 (colored)

Fix temp file handling.
o honor TMPDIR environment variable as per man page
o need 2 temp files if both file1 and file2 are devices
o add error() and errorx() which cleanup temp file and then
call err() and errx() respectively.

OK tedu@

Revision 1.20 / (download) - annotate - [select for diffs], Thu Jun 26 04:52:26 2003 UTC (20 years, 10 months ago) by millert
Branch: MAIN
Changes since 1.19: +46 -25 lines
Diff to previous 1.19 (colored)

Fix temp file handling and deal with the case where we might need 2 temp files.

Revision 1.19 / (download) - annotate - [select for diffs], Thu Jun 26 04:47:30 2003 UTC (20 years, 10 months ago) by vincent
Branch: MAIN
Changes since 1.18: +2 -2 lines
Diff to previous 1.18 (colored)

off by one in size calculation

ok tedu

Revision 1.18 / (download) - annotate - [select for diffs], Wed Jun 25 22:38:11 2003 UTC (20 years, 10 months ago) by tedu
Branch: MAIN
Changes since 1.17: +9 -9 lines
Diff to previous 1.17 (colored)

fix unified diff output.  ok millert@

Revision 1.17 / (download) - annotate - [select for diffs], Wed Jun 25 22:14:43 2003 UTC (20 years, 10 months ago) by millert
Branch: MAIN
Changes since 1.16: +86 -15 lines
Diff to previous 1.16 (colored)

Add unidiff support and try to pretty up usage() a bit

Revision 1.16 / (download) - annotate - [select for diffs], Wed Jun 25 21:43:49 2003 UTC (20 years, 10 months ago) by millert
Branch: MAIN
Changes since 1.15: +24 -22 lines
Diff to previous 1.15 (colored)

o use S_ISDIR instead of doing it by hand
o rename talloc -> emalloc and ralloc -> erealloc
o struct direct -> struct dirent (POSIX)
o kill remaining strcpy()
o fix unterminated string in setfile()
deraadt@ OK

Revision 1.15 / (download) - annotate - [select for diffs], Wed Jun 25 17:49:22 2003 UTC (20 years, 10 months ago) by millert
Branch: MAIN
Changes since 1.14: +12 -21 lines
Diff to previous 1.14 (colored)

o use getopt()
o use err/warn
o only call done() when needed (after mkstemp)
o add "-C lines" like GNU grep
OK deraadt@

Revision 1.14 / (download) - annotate - [select for diffs], Wed Jun 25 07:26:59 2003 UTC (20 years, 10 months ago) by tedu
Branch: MAIN
Changes since 1.13: +6 -7 lines
Diff to previous 1.13 (colored)

remove silly signal catcher, and just use done.  ok deraadt@

Revision 1.13 / (download) - annotate - [select for diffs], Wed Jun 25 03:55:45 2003 UTC (20 years, 10 months ago) by deraadt
Branch: MAIN
Changes since 1.12: +3 -3 lines
Diff to previous 1.12 (colored)

oops

Revision 1.12 / (download) - annotate - [select for diffs], Wed Jun 25 03:53:59 2003 UTC (20 years, 10 months ago) by deraadt
Branch: MAIN
Changes since 1.11: +4 -4 lines
Diff to previous 1.11 (colored)

use SEEK_SET with fseek()

Revision 1.11 / (download) - annotate - [select for diffs], Wed Jun 25 03:50:27 2003 UTC (20 years, 10 months ago) by deraadt
Branch: MAIN
Changes since 1.10: +9 -7 lines
Diff to previous 1.10 (colored)

more knf

Revision 1.10 / (download) - annotate - [select for diffs], Wed Jun 25 03:46:45 2003 UTC (20 years, 10 months ago) by deraadt
Branch: MAIN
Changes since 1.9: +2 -2 lines
Diff to previous 1.9 (colored)

index -> strrchr

Revision 1.9 / (download) - annotate - [select for diffs], Wed Jun 25 03:42:16 2003 UTC (20 years, 10 months ago) by deraadt
Branch: MAIN
Changes since 1.8: +37 -46 lines
Diff to previous 1.8 (colored)

knf

Revision 1.8 / (download) - annotate - [select for diffs], Wed Jun 25 03:42:00 2003 UTC (20 years, 10 months ago) by tedu
Branch: MAIN
Changes since 1.7: +4 -4 lines
Diff to previous 1.7 (colored)

remove unused variable

Revision 1.7 / (download) - annotate - [select for diffs], Wed Jun 25 03:39:23 2003 UTC (20 years, 10 months ago) by tedu
Branch: MAIN
Changes since 1.6: +1 -2 lines
Diff to previous 1.6 (colored)

-Wstrict-prototypes

Revision 1.6 / (download) - annotate - [select for diffs], Wed Jun 25 03:38:34 2003 UTC (20 years, 10 months ago) by deraadt
Branch: MAIN
Changes since 1.5: +4 -4 lines
Diff to previous 1.5 (colored)

avoid signed issues; tedu ok

Revision 1.5 / (download) - annotate - [select for diffs], Wed Jun 25 03:37:32 2003 UTC (20 years, 10 months ago) by deraadt
Branch: MAIN
Changes since 1.4: +16 -16 lines
Diff to previous 1.4 (colored)

exit path signal race safe

Revision 1.4 / (download) - annotate - [select for diffs], Wed Jun 25 03:25:29 2003 UTC (20 years, 10 months ago) by tedu
Branch: MAIN
Changes since 1.3: +14 -15 lines
Diff to previous 1.3 (colored)

more cast removal, and fix some indent(1) oddities

Revision 1.3 / (download) - annotate - [select for diffs], Wed Jun 25 03:02:33 2003 UTC (20 years, 10 months ago) by tedu
Branch: MAIN
Changes since 1.2: +445 -396 lines
Diff to previous 1.2 (colored)

cleanup.  ansi, headers, correct prototypes, some safer string and
tempfile functions, whitespace, ...
no functional improvements yet

Revision 1.2 / (download) - annotate - [select for diffs], Wed Jun 25 01:23:38 2003 UTC (20 years, 10 months ago) by deraadt
Branch: MAIN
Changes since 1.1: +36 -0 lines
Diff to previous 1.1 (colored)

caldera licenses

Revision 1.1 / (download) - annotate - [select for diffs], Wed Jun 25 01:20:52 2003 UTC (20 years, 10 months ago) by deraadt
Branch: MAIN

4.3reno diff.  This is free because of the Caldera license.  Nasty, but a
place to start.

This form allows you to request diff's between any two revisions of a file. You may select a symbolic revision name using the selection box or you may type in a numeric name using the type-in text box.