summaryrefslogtreecommitdiffstats
path: root/usr.bin/cvs/diff3.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Fix merging of files that lack newlines for diff(3), OpenRCS, and OpenCVS.stsp2020-06-261-2/+9
| | | | | | | | | | | | | | | | | | | | | Merges with a file that lacks newlines (\n) were triggering a fatal error. This could be easily reproduced with merge(1) and diff3(1): $ echo foo > foo $ echo bar > bar $ echo -n baz > baz $ merge -p foo bar baz merge: failed to merge $ diff3 -E foo bar baz 1a ======= diff3prog: logic error $ Fix this by properly handling short reads from the third file argument. Only the third file argument triggered the problem. The other input files were already handled correctly. ok millert@
* When system calls indicate an error they return -1, not some arbitraryderaadt2019-06-281-4/+4
| | | | | | 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.
* Using bitwise OR along with two assignments in the conditional ofmillert2016-10-181-2/+7
| | | | | | a while() loop is a trap for the unwary programmer (albeit a clever trap). Break this up into two separate assignments and using boolean OR for clarity. OK otto@
* Remove useless n=n assignment in the first parse of a for().millert2016-10-161-2/+2
| | | | It was already removed from the rcs version by nicm@.
* Quiet compiler warnings. OK tomc@ tb@millert2016-10-151-3/+4
|
* Remove xfree(), like already done for RCS. From Michael W Bombardieri,nicm2015-11-051-20/+14
| | | | ok mmcc
* Add brackets to clarify assignments that are the result of a test operator.jsg2015-09-051-2/+2
| | | | ok deraadt@ looks correct millert@ jung@
* Replace <sys/param.h> with <limits.h> and other less dirty headers wherederaadt2015-01-161-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)
* An internal function called xrealloc() is actually a fail-hardderaadt2014-12-011-6/+6
| | | | reallocarray()... so rename it.
* In preparation for getline and getdelim additions to libc, rename getline()fgsch2012-03-041-5/+5
| | | | | occurrences to get_line(). Based on a diff from Jan Klemkow <j-dot-klemkow-at-wemelug-dot-de> to tech.
* Nuke some unused variables and remove an unnecessary call to dirname().nicm2010-10-291-3/+3
| | | | From Michael W Bombardieri via ray@.
* Reduce variable/function name and whitespace differences betweenray2010-07-231-24/+23
| | | | | | cvs/rcs. OK xsa zinovik
* Rename a bunch of variables and functions, removing the cvs_/rcs_ray2010-07-231-4/+4
| | | | | | prefixes to reduce differences between cvs and rcs files. "yes!" nicm
* rcsid[] and sccsid[] and copyright[] are essentially unmaintained (andderaadt2009-10-271-12/+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-4/+4
| | | | | | | | | | | 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
* Sync some rcsdiff changes to cvsdiff. As a side effect,ray2009-06-061-4/+4
| | | | | | | cvs diff -t now works. There should be no functional change otherwise. OK millert
* unused varjoris2008-03-091-3/+3
|
* add checkout/update -j support.joris2008-03-081-23/+44
| | | | still has some rough edges.
* correct usage of lseek(2);joris2008-03-081-5/+5
|
* when reopening the file pass the proper mode and reopen it usingjoris2008-03-011-3/+3
| | | | | O_RDWR instead of O_WRONLY so that when we are in server mode we do not screw up in cvs_remote_send_file().
* handle file permissions and owners properly.joris2008-02-291-3/+3
| | | | | | | | matches what gnu cvs does. fixes the fact that we couldnt update group writable files. problem report & diff testing by David Crawshaw.
* nobody needs weird debug messagesjoris2008-02-281-5/+2
|
* prevent file racesjoris2008-02-271-23/+45
| | | | ok tobias@
* reset overlapcnt at each cvs_merge_file() call so that files thatjoris2008-02-231-2/+3
| | | | | are being merged that have no conflicts will not report the previous conflicts that might have been found.
* Cleanup buf implementation:tobias2008-02-111-6/+6
| | | | | | | | | | | | * Don't check for NULL on buffer creation, because it calls fatal() when something's wrong. * All buffers are supposed to expand if there is no space left in them, so zap flags as well. * Remove code that is now dead. OK joris@ > Inspired by a diff from Igor Zinovik about unchecked return value.
* Imported atomicio interface.tobias2007-09-171-3/+5
| | | | Requested by ray@, OK joris@
* Proper use of fseek/fseeko macros.tobias2007-09-101-4/+5
| | | | OK joris@, otto@
* Sync revisions and time buffers size to be consistent with each others.xsa2007-06-281-3/+3
| | | | | Simplifies further size tweaks if needed. OK niallo@ ray@.
* Since xrealloc dies on failure it is safe to directly assign to theray2007-05-291-19/+11
| | | | | | | | | original pointer. Theo agrees, and so does the rest of the tree (ssh, etc. all do this already). Saves a bunch of variables and assignments. OK niallo@
* general includes cleanup sweep. ok joris@ niallo@otto2007-02-221-4/+8
|
* snprintf() -> xsnprintf()xsa2007-01-311-9/+4
|
* add merging support in both local and remote sides.joris2007-01-281-48/+46
| | | | tested by many, thanks.
* major re-work of the RCS api. this results in 100x performance improvements in some places and muchniallo2007-01-121-21/+8
| | | | | | | | | reduced memory usage. note that only checkout has been fully converted to use the new high-performance functions. other codepaths (e.g. update) still use the old method which is provided for backwards compatibility. we can convert the remaining slow bits over to the new api piece-by-piece. "commit this, now" joris@ brad@ tested, too.
* complete binary support for opencvs,joris2007-01-121-5/+2
| | | | | | adding/importing binary files now works too partially taken from openrcs
* rework opencvs so that we can deal with binary files. previously we assumed all files were ascii,niallo2007-01-111-6/+17
| | | | | | | | which broke things in real-world usage. now a checkout of src should work, albeit using lots of memory and cpu. fixing this is the next step. testing by many. ok & some input joris@
* sync with usr.bin/rcs/diff3.cxsa2006-11-101-8/+11
|
* respect TMPDIR here too, changes pulled in from usr.bin/rcs.xsa2006-11-091-11/+20
|
* Check that string length != 0 before setting buf[strlen(buf) - 1].ray2006-10-241-2/+4
| | | | OK xsa@.
* Remove file mode argument from {cvs|rcs}_buf_write_stmp(). Weray2006-07-081-7/+7
| | | | | | | always set the temporary file to mode 600, which is already done by mkstemp(). OK joris@ and xsa@ over a month ago.
* add cvs_buf_load_fd() which does the same as cvs_buf_load()joris2006-06-141-4/+5
| | | | | | | | | | except it takes a decriptor as argument instead of a path. modified cvs_buf_load() to open the descriptor then pass it to cvs_buf_load_fd(). change all the calls to cvs_buf_load() that have a descriptor open for the path to cvs_buf_load_fd() to prevent races.
* commit the new opencvs code, i have been hacking onjoris2006-05-271-9/+9
| | | | | | | | | | | | this for the past 2 weeks now and it should go in at the start of the hackathon so others can help out. this code is a lot safer, smarter, faster and best of all it is actually doing what it is suppose to do! basic checkout, update, status, diff and commit are working in local mode only. there is no support for any remote setups now.
* more nasty spaces go bye byederaadt2006-04-141-8/+8
|
* Use variable names for sizeof, remove casts in front of xmalloc,ray2006-04-051-11/+13
| | | | | | use xcalloc and xstrdup where appropriate, and other stuff. OK joris@
* Today is Integer Overflow Prevention Day:ray2006-03-281-7/+7
| | | | | | | - Sync xmalloc.? with ssh versions. - Change all xrealloc() calls to new API. ``I really like this.'' niallo@
* Correct integer types, remove unused arguments, non-portable bitshiftsray2006-03-251-11/+12
| | | | | | | | | changed to division, KNF, replace unreachable code with goto fail, et cetera. Found by lint. The free() -> xfree() as well. OK niallo@
* kill two unused variables.xsa2006-03-161-6/+5
|
* add an argument to cvs_diff3() to be able to handle verbosity ofxsa2006-03-141-6/+8
| | | | commands; fixes rcsmerge -q behaviour. OK niallo@ ray@.
* adapt informative message if we are sending output to stdout.xsa2006-03-061-5/+2
|
* if the submitted rev(s) is/are the same as the head rev, skip the processxsa2006-03-061-4/+4
| | | | for the specified file. Fix some error messages while there. OK joris@
* oops, forgot the diff3.c portion of this diff:niallo2006-03-051-7/+7
| | | | | | | | | | fatal() instead of returning -1 on failure in patch functions ed_patch_lines() and rcs_patch_lines(). this can avoid segfault in certain circumstances. From: Ray Lai <ray@cyth.net> discussed with xsa@ and joris@