summaryrefslogtreecommitdiffstats
path: root/usr.bin/diff/diff.c
AgeCommit message (Collapse)AuthorFilesLines
2019-06-28When system calls indicate an error they return -1, not some arbitraryderaadt1-3/+3
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.
2019-01-25I am retiring my old email address; replace it with my OpenBSD one.millert1-2/+2
2015-12-29fix exit status on pledge(2) failure.gsoares1-2/+2
OK tb@ jsg@
2015-10-26remove TMPDIR support. ok millerttedu1-8/+3
2015-10-09Change all tame callers to namechange to pledge(2).deraadt1-5/+5
2015-10-05Remove the non-standard -l flag that pipes the output through pr(1).millert1-28/+14
Based on a diff from and OK deraadt@
2015-10-05use different tame requests if TMPDIR is in env:semarie1-3/+8
- tmppath for when mktemp() operates in /tmp proper - cpath+wpath for use of $TMPDIR based on log-message from previous commit ok deraadt@
2015-10-05If the -l flag is set, diff will fork/execve pr on a pipe. But otherderaadt1-1/+5
uses can tame "stdio wpath rpath cpath tmppath". tmppath for when mktemp() operates in /tmp proper, but cpath+wpath for use of $TMPDIR. ok sthen millert
2015-04-29Change internal xrealloc() to a idiom-following xreallocarray().deraadt1-2/+2
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
2015-01-16Replace <sys/param.h> with <limits.h> and other less dirty headers wherederaadt1-2/+2
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)
2010-07-16Simplify print_status by removing NULL handling.ray1-12/+10
OK nicm
2010-02-21`-q' is an output option, hence it is mutually exclusive.sobrado1-8/+8
ok jmc@
2009-11-09move mutually exclusive options (-c, -e, -f, -n and -u) to the right place.sobrado1-5/+5
ok jmc@
2009-10-27rcsid[] and sccsid[] and copyright[] are essentially unmaintained (andderaadt1-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
2009-06-07More cvs/diff/rcs convergence:ray1-19/+19
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
2009-06-06Oops, forgot to pass dflags to diffreg. Now the flags work again.ray1-4/+4
OK millert
2009-06-06Pull changes from rcsdiff, similar to what was pulled into cvsdiff.ray1-13/+12
OK millert
2007-05-29Bring in some changes from rcsdiff:ray1-47/+10
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@
2007-03-01sort options/synopsis/usage();jmc1-8/+7
from Igor Sobrado
2004-12-09If the -L option is specified twice, use it for the second filenamemillert1-4/+9
like GNU diff does. Adapted from a diff by YAMAMOTO Takashi
2004-12-07advancing argv twice doesn't make it better.espie1-3/+3
okay otto@.
2004-06-20Implement -I option: ignore changes matching a set of regexes. Fromotto1-10/+50
Jared Yanovich, with twists from millert@ and me. Testing by brad@, sturm@ and pval@. ok millert@
2004-03-16POSIX specifies that in directory mode device special files andmillert1-2/+10
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-07Implement -p option.otto1-8/+12
"works here" millert@ ok miod@ deraadt@
2003-10-07Fix printing of "Only in foo" when foo is "/" (trailing slash removalmillert1-5/+11
was overzealous in this case). Fix tested by Hugo Villeneuve and myself.
2003-09-07Make -number be an error (similar to my change in grep.c); OK tedu@millert1-9/+15
2003-09-07 - add -P to SYNOPSISjmc1-8/+8
- 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@tedu1-4/+15
2003-09-06restore undocumented -u# support for the old schoolers. :)tedu1-3/+3
noticed by itojun@, ok deraadt@
2003-08-18fix spelling of --initial-tabdavid1-3/+3
ok otto@
2003-07-29cleanderaadt1-4/+4
2003-07-27Correct computation of argsize when setting diffargs.millert1-4/+4
2003-07-27- Use a heuristic to bound memory and cpu usage, at the cost ofotto1-10/+14
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-22Add missing terminator to long options list.millert1-2/+3
2003-07-22Implement the -L and -T options from GNU diff.millert1-11/+20
2003-07-21Don't print a trailing '/' in foo when printing "Only in foo: bar"millert1-3/+5
2003-07-21Fix printing of status when not in -l mode which was broken when themillert1-4/+4
-l support was added.
2003-07-21a little KNFhenning1-3/+3
2003-07-21POSIX-compliant output when there are two paths w/ the same name butmillert1-4/+8
one is a file and the other is a directory in -r mode (cosmetic).
2003-07-09Unlink temp file as soon as it is opened and return a FILE * formillert1-50/+26
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-directorymillert1-7/+58
mode (like GNU diff).
2003-07-08o Avoid a temp file if using stdin and stdin is redirected from a regular filemillert1-4/+4
o Fix a double free in the temmp file case
2003-07-06Add -q option from GNU diffmillert1-8/+12
2003-07-06Implement -P from GNU diff (like -N but only for files that are missingmillert1-5/+9
from dir1).
2003-07-06Some fairly major changes:millert1-132/+183
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@
2003-07-04Accept but ignore -h for backwards compat like GNU diff does.millert1-4/+7
Pointed out by espie@. Also remove other references to -h mode.
2003-07-04Kill non-standard -l option as discussed with tedu@millert1-9/+5
2003-07-04Kill diff -h, we don't use or want diffh. Discussed w/ tedu@millert1-8/+2
2003-07-04Some cosmetic fixes:millert1-10/+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
2003-06-27kill a warning: include <string.h>david1-1/+2
ok tedu@