summaryrefslogtreecommitdiff
path: root/usr.bin/diff
AgeCommit message (Collapse)Author
2004-06-20Implement -I option: ignore changes matching a set of regexes. FromOtto Moerbeek
Jared Yanovich, with twists from millert@ and me. Testing by brad@, sturm@ and pval@. ok millert@
2004-06-18If a new hunk immediately follows the previous one, merge themOtto Moerbeek
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@
2004-03-16POSIX specifies that in directory mode device special files andTodd C. Miller
FIFOs shall be skipped. Other types of files may be skipped too (this is implementation-dependent). In directory mode, just skip anything that is not a regular file or directory. OK tedu@
2004-01-25use new .St macro;Jason McIntyre
2004-01-07Document -p option. ok jmc@Otto Moerbeek
2004-01-07Implement -p option.Otto Moerbeek
"works here" millert@ ok miod@ deraadt@
2003-11-22Fix diff -q exit value which was broken in last commit.Todd C. Miller
2003-11-21Fix broken assumption that a file must contain differences if files_differ()Todd C. Miller
fails. Fixes "diff -i" exit value. Problem found by Claudio Jeker.
2003-11-10Din't print the "No newline at end of file" to inline (ie: to stdout)Todd C. Miller
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
2003-11-09Typos in comments from Jared Yanovich <jjy2+ at pitt dot edu>Otto Moerbeek
2003-10-28prototype declared static, but function was not. add static to function.Anil Madhavapeddy
millert@ otto@ ok
2003-10-07Fix printing of "Only in foo" when foo is "/" (trailing slash removalTodd C. Miller
was overzealous in this case). Fix tested by Hugo Villeneuve and myself.
2003-09-18 - move `-d' to comparison options, rather then output optionsJason McIntyre
- note (again) that output options are mutually exclusive from Andy Isaacson (PR 3479)
2003-09-07Make -number be an error (similar to my change in grep.c); OK tedu@Todd C. Miller
2003-09-07 - add -P to SYNOPSISJason McIntyre
- remove "mutually exclusive" clause - -c produces 15 *'s, not a dozen - add -a to uage() - sync usage() with SYNOPSIS ok tedu@
2003-09-07try again at -u#. ok deraadt@Ted Unangst
2003-09-07correct ascii file test. ok deraadt@ pb@Ted Unangst
2003-09-06restore undocumented -u# support for the old schoolers. :)Ted Unangst
noticed by itojun@, ok deraadt@
2003-08-18fix spelling of --initial-tabDavid Krause
ok otto@
2003-08-13Based on what otto@ said on icb. The expensive thing in diff isTodd C. Miller
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
2003-08-08Guess the number of lines in a file and use that number for initialOtto Moerbeek
memory allocation. Initial version by me, cleanup by millert@. ok millert@
2003-08-01anychange is no longer extern; millert okTheo de Raadt
2003-07-31- Change the hash function to a simple multiplicative one. The oldOtto Moerbeek
hash function was apparently optimized for 16 bit processors and generates quite some collisions. - Fix another case of excessive reallocing. ok millert@
2003-07-31o correct exit code when comparing stdin and stdin (a noop)Todd C. Miller
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.
2003-07-29cleanTheo de Raadt
2003-07-27We need to initialize clen to 0 each time through diffreg() forTodd C. Miller
when diffreg() is called multiple times (i.e. in directory mode). Fixes a hang I saw doing "diff -r" of two large directory trees.
2003-07-27Correct computation of argsize when setting diffargs.Todd C. Miller
2003-07-27Start new sentence on a new line.Otto Moerbeek
ok jmc@
2003-07-27- Use a heuristic to bound memory and cpu usage, at the cost ofOtto Moerbeek
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@
2003-07-23better ascii test for fewer false negatives. ok millert@Ted Unangst
2003-07-22Add missing terminator to long options list.Todd C. Miller
2003-07-22Fixed the "dot alone on a line" bug.Todd C. Miller
2003-07-22Bring FILES section up to date.Todd C. Miller
2003-07-22Implement the -L and -T options from GNU diff.Todd C. Miller
2003-07-22Historically, when comparing two directories in -e mode, BSD diffTodd C. Miller
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.
2003-07-22Don't print lines consisting solely of a dot ('.') in -e mode sinceTodd C. Miller
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.
2003-07-21Historically, the "Only in" messages produced in dir modeTodd C. Miller
were not printed when the output format was -e (ed) since this prevented the output from being used as an ed script. However, POSIX specifies that this message shall always be printed regardless of the output format (this is also what GNU diff does). Also do the same with the "Common subdirectory" message which POSIX lists as optional.
2003-07-21Add STANDARDS sectionTodd C. Miller
2003-07-21Don't print a trailing '/' in foo when printing "Only in foo: bar"Todd C. Miller
2003-07-21Fix printing of status when not in -l mode which was broken when theTodd C. Miller
-l support was added.
2003-07-21a little KNFHenning Brauer
2003-07-21POSIX-compliant output when there are two paths w/ the same name butTodd C. Miller
one is a file and the other is a directory in -r mode (cosmetic).
2003-07-21Expand change records array as needed; passes Otto's new regression test.Todd C. Miller
2003-07-17cc -O2 -pipe -DSTDC_HEADERS=1 -DHAVE_UNISTD_H=1 -DDIRENT=1 -DDYN_ALLOC -c ↵Todd C. Miller
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.
2003-07-16Deal with files that lack a final newline before EOF (you naughtyTodd C. Miller
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@
2003-07-15Fix line ranges for unidiffs. Problem noted by otto@Todd C. Miller
2003-07-09Unlink temp file as soon as it is opened and return a FILE * forTodd C. Miller
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
2003-07-09Re-implement -l flag; diff -l now works correctly in non-directoryTodd C. Miller
mode (like GNU diff).
2003-07-08fix pasto in last commitTodd C. Miller
2003-07-08o Avoid a temp file if using stdin and stdin is redirected from a regular fileTodd C. Miller
o Fix a double free in the temmp file case