summaryrefslogtreecommitdiffstats
path: root/usr.bin/diff/diffreg.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Replace our /^\.\././ expression with /.//. The term is simpler and hastobias2015-10-131-2/+2
| | | | | | | | 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@
* Remove the non-standard -l flag that pipes the output through pr(1).millert2015-10-051-56/+3
| | | | Based on a diff from and OK deraadt@
* xmalloc/free wrappers don't need to support 20 year old non comformancetedu2015-09-251-9/+9
|
* Change internal xrealloc() to a idiom-following xreallocarray().deraadt2015-04-291-9/+9
| | | | | | | 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
* Include stdint.h, not limits.h to get SIZE_MAX. OK guenther@millert2015-02-051-1/+2
|
* Replace <sys/param.h> with <limits.h> and other less dirty headers wherederaadt2015-01-161-12/+15
| | | | | | | | | 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)
* Ensure diff -uw always produces valid output when one file doesn't endkspillner2014-08-271-5/+9
| | | | | | with a newline. Issue reported by guenther@. ok guenther@
* Switch diff(1) binary file detection from !(isprint() || isspace()) tostsp2012-07-081-6/+3
| | | | | | | 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
* Strip trailing slashes from directory in splice() beforemillert2012-05-221-2/+6
| | | | appending the file portion. OK krw@ matthew@
* Move an isqrt() call outside a macro, from Michael W Bombardieri.nicm2011-04-011-6/+9
| | | | ok ray
* Close FILEs when fork fails.ray2010-07-161-2/+3
| | | | OK nicm
* diff exits 2 on error, not 1.ray2010-07-161-2/+2
| | | | OK millert
* cvs and rcs use diff_output() to print everything since it is notray2010-07-151-52/+50
| | | | | | | | 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
* Remove unused arguments from check(). From cvs/rcs.ray2010-07-151-4/+4
| | | | OK millert
* Return -1 on error as advertised.ray2010-07-141-5/+4
| | | | | | Handle case when only one stream failed. OK otto, millert
* Even though this cannot happen in the diff -r case,schwarze2010-03-221-2/+4
| | | | | | | | | | 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@
* rcsid[] and sccsid[] and copyright[] are essentially unmaintained (andderaadt2009-10-271-5/+1
| | | | | | | 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
* More cvs/diff/rcs convergence:ray2009-06-071-55/+48
| | | | | | | | | | | 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
* Pull changes from rcsdiff, similar to what was pulled into cvsdiff.ray2009-06-061-73/+81
| | | | OK millert
* use strcspn to properly overwrite '\n' in fgets returned buffergilles2007-09-111-6/+4
| | | | ok pyr@, ray@, millert@, moritz@, chl@
* - Change sizeof(type) to sizeof(*ptr).ray2007-06-091-42/+42
| | | | | | | | - Move function prototypes before variables. No binary change. OK otto and millert.
* Bring in some changes from rcsdiff:ray2007-05-291-61/+50
| | | | | | | | | 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@
* improve -p for C++ code: classes definition often haveespie2007-03-181-6/+23
| | | | | | | | | | | 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@
* print the header only once.espie2007-02-231-8/+10
| | | | okay millert@
* Defer printing of the per-file diff header until after the regexpmillert2007-02-221-12/+14
| | | | | | "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@
* Append two string using strlcpy()/strlcat() instead of snprintf() tootto2006-02-221-4/+6
| | | | | avoid having to check for encoding errors returned by snprintf(). From Ray Lai; ok millert@ jaredy@
* Strip newline from lines used with -I, otherwise ^$ will match allotto2006-02-161-2/+4
| | | | lines and ignore them all. With and ok jaredy@
* Handle all isspace() chars the same for -w and -b. ok millert@ markus@otto2005-01-131-2/+5
|
* If the -L option is specified twice, use it for the second filenamemillert2004-12-091-12/+21
| | | | like GNU diff does. Adapted from a diff by YAMAMOTO Takashi
* Use unsigned char for bytes that are fed to isxxx() functions, to improveotto2004-11-271-4/+4
| | | | | portability. Spotted by YAMAMOTO Takashi. ok millert@
* Change tabs in string constants to \t. "of course" deraadt@otto2004-10-201-4/+4
|
* 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.