summaryrefslogtreecommitdiff
path: root/usr.bin/diff
AgeCommit message (Collapse)Author
2017-08-28Fix exit value when diffing directories with missing files and the -NTodd C. Miller
or -P options are not used. From Ibrahim Khalifa
2016-03-01Rectify line numbers for s/.// commands in ed-style diffs.natano
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@
2015-12-29fix exit status on pledge(2) failure.Gleydson Soares
OK tb@ jsg@
2015-11-24fix an error in the text; from donald allenJason McIntyre
ok millert
2015-11-17Merge xmalloc.[ch] files across base, skipping OpenSSH for now.Tobias Stoeckmann
ok nicm
2015-11-12Remove xfree()'s prototype. tedu@ removed its definition a few weeksmmcc
ago. Pointed out by Ricardo Mestre.
2015-10-26no more TMPDIR;Jason McIntyre
2015-10-26remove TMPDIR support. ok millertTed Unangst
2015-10-13Replace our /^\.\././ expression with /.//. The term is simpler and hasTobias Stoeckmann
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@
2015-10-09Change all tame callers to namechange to pledge(2).Theo de Raadt
2015-10-05Remove the non-standard -l flag that pipes the output through pr(1).Todd C. Miller
Based on a diff from and OK deraadt@
2015-10-05use different tame requests if TMPDIR is in env:Sebastien Marie
- 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 otherTheo de Raadt
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-09-25xmalloc/free wrappers don't need to support 20 year old non comformanceTed Unangst
2015-06-17Use strdup in xstrdup; from Fritjof Bornebusch.Nicholas Marriott
2015-04-29Change internal xrealloc() to a idiom-following xreallocarray().Theo de Raadt
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-02-05Include stdint.h, not limits.h to get SIZE_MAX. OK guenther@Todd C. Miller
2015-01-16Replace <sys/param.h> with <limits.h> and other less dirty headers whereTheo de Raadt
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)
2014-08-27Ensure diff -uw always produces valid output when one file doesn't endKent R. Spillner
with a newline. Issue reported by guenther@. ok guenther@
2014-05-20Use errc/warnc to simplify code.Philip Guenther
Also, in 'ftp', always put the error message last, after the hostname/ipaddr. ok jsing@ krw@ millert@
2014-02-13TMPDIR is an extension;Jason McIntyre
while here, converting \*(Gt to >, in accordance with some advice from ingo
2013-08-19Fix bogus errx(2, NULL) usage; malloc() failure should use err(2, NULL).Todd C. Miller
For size and overflow errors, use the same error messages as ecalloc(). OK otto@
2013-07-16where "-" represents stdin, just use Sq, not Fl, since it's not a flag;Jason McIntyre
from Jan Stary
2013-01-20remove obsolete BUGS (cmp is not run internally); ok ottoJason McIntyre
2012-11-29Change scandir()'s 'select' argument fromPhilip Guenthe
int (*)(struct dirent *) to int (*)(const struct dirent *) to match POSIX. ok millert@, ports check by naddy@
2012-07-08Switch diff(1) binary file detection from !(isprint() || isspace()) toStefan Sperling
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
2012-05-22Strip trailing slashes from directory in splice() beforeTodd C. Miller
appending the file portion. OK krw@ matthew@
2011-04-01Move an isqrt() call outside a macro, from Michael W Bombardieri.Nicholas Marriott
ok ray
2011-02-03add a reference to the "An Algorithm for Differential File Comparison" paper;Jason McIntyre
diff originally from Daniel Dickman, but otto suggested this paper ok otto millert
2010-11-14scandir() does not NULL-terminate the list of dirent structs so useTodd C. Miller
the returned count and set and end pointer instead. we no longer need to allocate a dummy array when diffing against a non-existent directory so eliminate slurpdir() and call scandir() directly. OK krw@
2010-11-08getdirentries(2) should be avoided outside of libc so use scandir(3)Todd C. Miller
instead. This makes slurpdir() just a thin wrapper around scandir(3). OK schwarze@
2010-10-28Change basep parameter of getdirentries() to be off_t *, not long *Todd C. Miller
so it works correctly with large offsets (and matches other systems). This requires adding a new getdirentries syscall, with the old one renamed to ogetdirentries. All in-tree consumers of getdirentries() have been updated. Bump libc and libpthread major numbers. OK and with deraadt@
2010-09-03add an EXIT STATUS section for /usr/bin;Jason McIntyre
2010-08-18Add a cross reference to patch(1)Ingo Schwarze
as suggested by Thomas de Grivel <billitch at gmail dot com> on tech@. While here, remove the SEE ALSO entries (but not the cross references at the appropriate places!) to fnmatch(3), re_format(7), and pr(1). Their relevance is restricted to one single option each, the latter is mostly obsolete nowadays anyway, and the number of SEE ALSO entries is so large that SEE ALSO is starting to look confusing. "yes" jmc@
2010-08-04exit(2) on xcalloc failure. From Daniel Dickman <didickman () gmailRay Lai
! com>, thanks! OK deraadt
2010-07-17Plug memory leak.Ray Lai
OK nicm
2010-07-16Simplify print_status by removing NULL handling.Ray Lai
OK nicm
2010-07-16Close FILEs when fork fails.Ray Lai
OK nicm
2010-07-16diff exits 2 on error, not 1.Ray Lai
OK millert
2010-07-15cvs and rcs use diff_output() to print everything since it is notRay Lai
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
2010-07-15Remove unused arguments from check(). From cvs/rcs.Ray Lai
OK millert
2010-07-14Return -1 on error as advertised.Ray Lai
Handle case when only one stream failed. OK otto, millert
2010-03-22Even though this cannot happen in the diff -r case,Ingo Schwarze
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@
2010-02-21`-q' is an output option, hence it is mutually exclusive.Igor Sobrado
ok jmc@
2009-11-09move mutually exclusive options (-c, -e, -f, -n and -u) to the right place.Igor Sobrado
ok jmc@
2009-10-28rcsid[] and sccsid[] and copyright[] are essentially unmaintained (andTheo de Raadt
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:Ray Lai
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.Ray Lai
OK millert
2009-06-06Pull changes from rcsdiff, similar to what was pulled into cvsdiff.Ray Lai
OK millert
2009-02-08updates to IEEE Std 1003.1-2008;Jason McIntyre