summaryrefslogtreecommitdiffstats
path: root/usr.bin/rcs/diff3.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Fix merging of files that lack newlines for diff(3), OpenRCS, and OpenCVS.stsp2020-06-261-3/+10
| | | | | | | | | | | | | | | | | | | | | 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@
* Amend previous fix; joris@ fixed the same bug in OpenCVS's diff3.c r1.47.stsp2019-08-101-2/+4
| | | | | Put the OpenCVS fix, which additionally checks for trailing \n, into OpenRCS. Sync requested by deraadt@ (thanks, I would otherwise have overlooked this)
* Fix merge(1) of files which contain lines with leading dots.stsp2019-08-101-2/+2
| | | | | | | | | | | | A check which tried to detect "dot on a line of its own" in the internal ed script was treating any line with a leading dot as such. Changes made to groups of such lines therefore ended up being truncated in the merged result. "For a random user, there's no shame in being unable to use ed." -- Michael W Lucas ok millert@ deraadt@
* 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@
* Quiet compiler warnings; as applied to usr.bin/cvs by millert@okan2016-10-161-2/+2
| | | | ok millert@
* Pull in <time.h> for struct tm, used in rcs.hguenther2016-08-261-1/+2
| | | | ok deraadt@
* Allow rcsnum_free and buf_free to accept NULL and remove various NULLnicm2015-11-021-17/+9
| | | | checks that are now unnecessary, from Michael W Bombardieri. ok millert
* Add brackets to clarify assignments that are the result of a test operator.jsg2015-09-051-2/+2
| | | | ok deraadt@ looks correct millert@ jung@
* Convert xfree to free. From Fritjof Bornebusch. ok deraadtnicm2015-06-131-29/+15
|
* 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.
* Remove some unneeded includes and dead code, from Michael W Bombardieri.nicm2011-04-201-2/+2
| | | | ok jasper xsa
* Make BUFs autoextend by default. This was already done in OpenCVSray2010-07-281-11/+11
| | | | | | a while ago. OK zinovik nicm
* Reduce variable/function name and whitespace differences betweenray2010-07-231-50/+54
| | | | | | cvs/rcs. OK xsa zinovik
* Rename a bunch of variables and functions, removing the cvs_/rcs_ray2010-07-231-3/+3
| | | | | | 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
* Checking if a file is ASCII should only be done when diffing, becauseray2009-02-251-6/+6
| | | | | | | | | | | the non-ASCII characters could be printed to the screen. For checking in files, checking out files, merging files, and removing revisions of files, we do so regardless of whether the files are ASCII or binary. Fixes PR6031. OK joris and deraadt.
* Make sure that temporary file has been successfully opened.tobias2008-03-021-7/+15
| | | | ok joris
* increase the marker buffers, they are not big enough for hg mergetedu2007-12-231-3/+3
|
* Proper use of fseek/fseeko macros.tobias2007-09-101-4/+4
| | | | OK joris@, otto@
* Rename rcs_diffreg() to diffreg().ray2007-07-031-6/+6
| | | | OK joris@
* Sync revisions and time buffers size to be consistent with each others.xsa2007-06-301-3/+3
| | | | | Simplifies further size tweaks if needed. OK 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@
* As done in OpenCVS, general includes cleanup sweep. OK otto@.xsa2007-02-271-3/+8
|
* Fix const inconsistencies, void pointer artithmetic;xsa2007-02-221-4/+4
| | | | Based on diff from otto@ in OpenCVS. OK otto@.
* remove some un-needed buffer NUL-termination. in openrcs, diff3 is already NUL-terminating itsniallo2007-01-111-9/+2
| | | | | | | buffers so we don't need to do it twice. this allows us to sync rcs_splitlines() with opencvs' cvs_splitlines(). ok joris@
* - fix support for checking out binary files.niallo2007-01-021-8/+41
| | | | | testing from xsa@ and Igor Sobrado <igor at string1.ciencias.uniovi.es> ok xsa@
* Check that string length != 0 before setting buf[strlen(buf) - 1].ray2006-10-241-2/+4
| | | | OK xsa@.
* Add support to rcsdiff for all the other diff flags thatmillert2006-09-211-6/+6
| | | | | are pertinent to files (not directories) and that do not conflict with rcsdiff-specific flags. OK xsa@
* correctly handle merge(1) and rcsmerge(1) -e and -E flags; tests and OK ray@.xsa2006-08-111-18/+22
|
* let ed_patch_lines work with a c command that encompasses the last lineespie2006-08-081-4/+5
| | | | | | | | | | | | of the file. The TAILQ structures specifically contain an extra `first line' to avoid this kind of issue, but no extra last line. Instead of walking beyond the end of the structure, and wondering at the null pointer, keep a pointer before the deleted block, as this one is guaranteed to exist. Fix Matthieu's testcase. okay joris@, xsa@
* More strlcpy/strlcat -> snprintf/xasprintf cleanup.ray2006-08-071-7/+7
| | | | OK joris@
* Remove file mode argument from {cvs|rcs}_buf_write_stmp(). Weray2006-07-081-12/+12
| | | | | | | always set the temporary file to mode 600, which is already done by mkstemp(). OK joris@ and xsa@ over a month ago.
* - correctly handle binary files; say bye bye to using c strings for deltatexts.niallo2006-06-031-23/+4
| | | | "slap it in" joris@
* missing bits for a working merge(1). Built and enabled.xsa2006-05-151-2/+119
| | | | OK joris@ ray@.
* Remove (size_t) casts on integer constants.ray2006-05-101-6/+6
| | | | | | | We should not cover up lint's shortcomings, especially if they no longer exist. ``This is definately good.'' niallo@.
* check for rcs_diffreg() return value; OK ray@.xsa2006-05-081-4/+9
|
* fix error/verbose messages to match gnu/usr.bin/rcs when using rcsmerge(1).xsa2006-05-081-9/+6
|
* finish work wrt TMPDIR; use xasprintf() to simplify code while in there;xsa2006-05-041-23/+19
| | | | "looks fine" ray@.
* respect TMPDIR; OK ray@.xsa2006-05-031-9/+19
|
* Check return values for all strlcpy, and strlcat calls.ray2006-04-291-15/+18
| | | | OK xsa@ and probably others.
* zap util.[ch] and move the content into rcsutil.[ch].xsa2006-04-271-3/+3
| | | | discussed with joris@.
* fork our code we shared between openrcs/cvs into the openrcs dir.joris2006-04-261-0/+806
this was starting to become inhuman to maintain without ugly ugly hacks in the shared code, and it will be easier to make specific changes for openrcs without touching the soon-to-be-replaced opencvs code.