summaryrefslogtreecommitdiffstats
path: root/usr.bin/diff/diffreg.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* use sizeof(struct cand) instead of defining an unused cand object, andderaadt2004-09-141-5/+5
| | | | then doing sizeof(cand). silly kids
* Implement -I option: ignore changes matching a set of regexes. Fromotto2004-06-201-2/+53
| | | | | Jared Yanovich, with twists from millert@ and me. Testing by brad@, sturm@ and pval@. ok millert@
* If a new hunk immediately follows the previous one, merge themotto2004-06-181-4/+4
| | | | | | | 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@
* Implement -p option.otto2004-01-071-6/+61
| | | | "works here" millert@ ok miod@ deraadt@
* Fix diff -q exit value which was broken in last commit.millert2003-11-221-4/+5
|
* Fix broken assumption that a file must contain differences if files_differ()millert2003-11-211-7/+7
| | | | fails. Fixes "diff -i" exit value. Problem found by Claudio Jeker.
* Din't print the "No newline at end of file" to inline (ie: to stdout)millert2003-11-101-4/+8
| | | | | | 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
* prototype declared static, but function was not. add static to function.avsm2003-10-281-3/+3
| | | | millert@ otto@ ok
* correct ascii file test. ok deraadt@ pb@tedu2003-09-071-5/+4
|
* Based on what otto@ said on icb. The expensive thing in diff ismillert2003-08-131-6/+6
| | | | | | | | 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
* Guess the number of lines in a file and use that number for initialotto2003-08-081-8/+12
| | | | | | memory allocation. Initial version by me, cleanup by millert@. ok millert@
* - Change the hash function to a simple multiplicative one. The oldotto2003-07-311-25/+29
| | | | | | | | hash function was apparently optimized for 16 bit processors and generates quite some collisions. - Fix another case of excessive reallocing. ok millert@
* o correct exit code when comparing stdin and stdin (a noop)millert2003-07-311-4/+4
| | | | | | 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.
* cleanderaadt2003-07-291-3/+3
|
* We need to initialize clen to 0 each time through diffreg() formillert2003-07-271-2/+3
| | | | | when diffreg() is called multiple times (i.e. in directory mode). Fixes a hang I saw doing "diff -r" of two large directory trees.
* - Use a heuristic to bound memory and cpu usage, at the cost ofotto2003-07-271-7/+40
| | | | | | | | | 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@
* better ascii test for fewer false negatives. ok millert@tedu2003-07-231-5/+5
|
* Implement the -L and -T options from GNU diff.millert2003-07-221-28/+40
|
* Historically, when comparing two directories in -e mode, BSD diffmillert2003-07-221-14/+5
| | | | | | 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.
* Don't print lines consisting solely of a dot ('.') in -e mode sincemillert2003-07-221-9/+38
| | | | | | | | 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.
* a little KNFhenning2003-07-211-3/+3
|
* POSIX-compliant output when there are two paths w/ the same name butmillert2003-07-211-3/+3
| | | | one is a file and the other is a directory in -r mode (cosmetic).
* Expand change records array as needed; passes Otto's new regression test.millert2003-07-211-40/+46
|
* 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 formillert2003-07-171-26/+7
| | | | | | 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.
* Deal with files that lack a final newline before EOF (you naughtymillert2003-07-161-24/+42
| | | | | | | | | | | | | | | | | 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@
* Fix line ranges for unidiffs. Problem noted by otto@millert2003-07-151-12/+27
|
* Unlink temp file as soon as it is opened and return a FILE * formillert2003-07-091-65/+37
| | | | | | | | | | | 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
* Re-implement -l flag; diff -l now works correctly in non-directorymillert2003-07-091-29/+78
| | | | mode (like GNU diff).
* fix pasto in last commitmillert2003-07-081-3/+3
|
* o Avoid a temp file if using stdin and stdin is redirected from a regular filemillert2003-07-081-11/+15
| | | | o Fix a double free in the temmp file case
* Add -q option from GNU diffmillert2003-07-061-2/+6
|
* Some fairly major changes:millert2003-07-061-199/+314
| | | | | | | | | | | | | | | | | | | | | 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@
* Kill diff -h, we don't use or want diffh. Discussed w/ tedu@millert2003-07-041-6/+1
|
* Some cosmetic fixes:millert2003-07-041-3/+4
| | | | | | | | 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
* Treat /dev/null specially; there is no need to make a temp file for it.millert2003-07-021-4/+6
|
* -a to force ascii compare. ok millerttedu2003-06-271-1/+4
|
* Remove cruft; We don't have the -I, -1 or -2 options anymore so we don'tmillert2003-06-261-25/+12
| | | | need the associated scaffolding. tedu@ OK
* Fix temp file handling.millert2003-06-261-64/+32
| | | | | | | | | 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@
* Fix temp file handling and deal with the case where we might need 2 temp files.millert2003-06-261-25/+46
|
* off by one in size calculationvincent2003-06-261-2/+2
| | | | ok tedu
* fix unified diff output. ok millert@tedu2003-06-251-9/+9
|
* Add unidiff support and try to pretty up usage() a bitmillert2003-06-251-15/+86
|
* o use S_ISDIR instead of doing it by handmillert2003-06-251-22/+24
| | | | | | | | 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
* o use getopt()millert2003-06-251-21/+12
| | | | | | | o use err/warn o only call done() when needed (after mkstemp) o add "-C lines" like GNU grep OK deraadt@
* remove silly signal catcher, and just use done. ok deraadt@tedu2003-06-251-7/+6
|
* oopsderaadt2003-06-251-3/+3
|
* use SEEK_SET with fseek()deraadt2003-06-251-4/+4
|
* more knfderaadt2003-06-251-7/+9
|
* index -> strrchrderaadt2003-06-251-2/+2
|
* knfderaadt2003-06-251-46/+37
|