summaryrefslogtreecommitdiffstats
path: root/usr.bin/patch/pch.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Remove unused pathnames.h header since patch was refactoring into not invokinganton2018-04-071-2/+1
| | | | ed back in 2015; ok millert@ tb@ tobias@
* Fix adding and removing files with git-style a/ b/ diffs: only skiptb2017-12-201-3/+5
| | | | | | | six letters if they actually match "--- a/" and "+++ b/" instead of laxer checks. ok tom, tedu, millert
* Unbreak previous for git diffs that do not have the a/ prefix.florian2017-05-301-2/+2
| | | | Found the hard way be me, OK tedu
* sometimes patches coming from other places have extra a/ and b/ directoriestedu2017-05-261-7/+15
| | | | | prepended to filenames. detect this condition and attempt to correct it. ok openbsd
* One string buffer can use recallocarray() to ensure that the address spacederaadt2017-03-261-2/+2
| | | | | doesn't get dribbled with known contents. ok otto millert tobias
* If reading fails, do not go into infinite loop asking for a filenameotto2016-09-021-3/+5
| | | | | Happens in bulf build where no tty is available. ok sthen@ naddy@ $(jot -b yes 1000) landry@
* Add native support for ed-style diffs. No need to pledge "proc exec" anymore.tobias2015-10-161-85/+7
| | | | ok deraadt
* Account for newlines in substitution (s///) commands. Substitutionmillert2015-07-311-2/+14
| | | | | | | | commands might contain a newline in the replacement pattern (escaped with a backslash before it), causing patch's understanding of the state the ed child process is in to diverge from reality. This can lead to patch unwillingly feeding '!' (execute shell command) lines to ed. From Martin Natano. OK deraadt@
* Remove support for automatically checking files out of RCS. Themillert2015-07-261-27/+11
| | | | | behavior is confusing to users and even GNU patch no longer does it by default. OK krw@ guenther@
* Include stdint.h, not limits.h to get SIZE_MAX. OK guenther@millert2015-02-051-1/+2
|
* Handle ed command "s" as a one line command, which it is.tobias2014-12-141-3/+3
| | | | | | Prevents arbitrary ed command executions in following lines. ok millert
* The function savestr allows NULL return values during Plan A patching so intobias2014-12-131-7/+7
| | | | | | case of out of memory conditions, Plan B can step in. In many cases, NULL value is not properly handled, so use xstrdup here (it's outside Plan A/B patching, which means that even Plan B relies on successful operations).
* spacesderaadt2014-12-081-2/+2
|
* three trivial reallocarray() usesderaadt2014-12-011-4/+4
|
* Properly validate line ranges supplied in diff file to prevent overflows.tobias2014-11-261-4/+27
| | | | | | | Also fixes an out of boundary memory access because the resulting values are used as array indices. ok millert
* Introduce strtolinenum to properly check line numbers while parsing:tobias2014-11-251-32/+48
| | | | | | no signs, no spaces, just digits, 0 <= x <= LONG_MAX ok millert, otto
* Remove SCCS support. For this to work, we would need "get", which we don'ttobias2014-11-221-2/+2
| | | | | | even have in ports. XSI functionality of POSIX, therefore optional. ok deraadt, schwarze, tedu
* Avoid iterating over end of string.tobias2014-11-181-3/+3
| | | | ok millert, otto
* Check fstat return value. Also, use off_t for file size and offsets astobias2014-11-171-37/+39
| | | | | | suggested by bluhm@. ok schwarze@
* unsigned char casts for ctypederaadt2013-11-261-25/+28
| | | | ok krw
* Bring file selection in accordance with the man page; from Stefan Esserotto2013-07-111-35/+33
| | | | ok millert@
* Silence gcc warnings.ajacoutot2012-04-111-1/+3
| | | | ok 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
* use calloc() to avoid malloc(n * m) overflows; checked by djm canacar jsgderaadt2007-09-021-5/+5
|
* type police and assorted cleanup. From Lionel Fourquaux; ok ray@otto2006-03-111-4/+3
|
* spacingderaadt2004-08-051-3/+3
|
* Properly detect if a patch already has been applied, even if thereotto2004-07-091-2/+8
| | | | | | are no eols at eofs involved. Tested by quite some people. ok deraadt@
* Fix a segv when patch cannot find a file and the user indicatesotto2004-01-281-3/+3
| | | | | | to use the file anyway. Problem found by david@ ok david@ millert@
* o fairly major man page reorganizationmillert2003-10-311-63/+183
| | | | | | o add --posix option for strict POSIX conformance o change filename determination to match GNU patch Tested by various people, including a full ports build by naddy@
* realloc(3) cleanup.otto2003-09-281-7/+27
| | | | ok cloder@ tedu@
* Add license from patch.c to original source files missing a license.otto2003-08-151-2/+28
| | | | ok deraadt@
* spacingderaadt2003-08-051-8/+8
|
* - use stdbool.h instead of roll-your-own booleansotto2003-08-011-91/+97
| | | | | | | | | - fix some -Wall warnings - fix asserts: in some cases remove them, in other cases they have become Internal errors or detection of malformed patch files. - fix some free() related code ok millert@ tedu@
* o add pathnames.hmillert2003-07-291-6/+5
| | | | | | o ignore empty TMPDIR environment variable o strip any trailing slashes from TMPDIR otto@ OK
* minor knf and cleanups; otto okderaadt2003-07-281-13/+11
|
* More cleanup: sprinkled some const, removed ugly EXTERN/INTERN.h,otto2003-07-281-26/+29
| | | | | | some rewriting of code to make it more readable and more KNF. ok millert@ tedu@ deraadt@
* Add POSIX -b option but don't change the default beahvior wrt backupsmillert2003-07-251-4/+6
| | | | yet. The old -b option is now -z (matches GNU patch).
* just about nothingderaadt2003-07-221-4/+4
|
* POSIX defines allowed commands as {a,c,d,i,s} but patch was onlymillert2003-07-221-6/+5
| | | | | recognizing {a,c,d}. We need to recognize 's' (substitute) for the "dot alone on a line" bug fix in diff(1).
* More cleanup.otto2003-07-221-103/+107
| | | | ok millert@ tedu@
* fix headerderaadt2003-07-211-2/+2
|
* remove a bit more junkderaadt2003-07-211-8/+8
|
* knfderaadt2003-07-211-8/+14
|
* knf and other cleanup; ok ottoderaadt2003-07-211-1152/+1165
|
* remove junk; ok otto teduderaadt2003-07-181-95/+95
|
* Fix merge error.otto2003-07-171-4/+4
| | | | ok millert@ tedu@
* Teach patch how to deal with \ No newline at end of file.otto2003-07-161-2/+63
| | | | | From NetBSD. ok deraadt@
* strcpy trashing, help from tedu; ok teduderaadt2003-04-081-3/+3
|
* string fixes; ok miod henningderaadt2003-04-051-9/+11
|
* make patch -f and -b actually skip patches for which the file can't bebeck2000-12-141-2/+3
| | | | found, instead of claiming it will and erroring out anyway.