summaryrefslogtreecommitdiffstats
path: root/usr.bin/patch/util.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Use getline(3) to handle lines longer than 8192 bytes in patch filesjca2019-12-021-4/+4
| | | | | Spotted by jsg@ when working on mesa. Diff tested by sthen@ in a partial i386 bulk. Input from and ok jsg@ millert@
* signal handlers should not call exit() due to possibility of reenteringderaadt2019-08-171-7/+23
| | | | | libc (stdio etc), instead do the unlink tasks then call _exit() instead ok millert
* When system calls indicate an error they return -1, not some arbitraryderaadt2019-06-281-7/+7
| | | | | | 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.
* Delete unnecessary <libgen.h> #includesguenther2018-12-301-2/+1
| | | | ok deraadt@
* Remove unused pathnames.h header since patch was refactoring into not invokinganton2018-04-071-2/+1
| | | | ed back in 2015; ok millert@ tb@ tobias@
* Remove support for automatically checking files out of RCS. Themillert2015-07-261-25/+1
| | | | | behavior is confusing to users and even GNU patch no longer does it by default. OK krw@ guenther@
* Replace <sys/param.h> with <limits.h> and other less dirty headers wherederaadt2015-01-161-4/+3
| | | | | | | | | 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)
* The function savestr allows NULL return values during Plan A patching so intobias2014-12-131-1/+17
| | | | | | 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).
* Remove SCCS support. For this to work, we would need "get", which we don'ttobias2014-11-221-5/+3
| | | | | | even have in ports. XSI functionality of POSIX, therefore optional. ok deraadt, schwarze, tedu
* unsigned char casts for ctypederaadt2013-11-261-5/+5
| | | | ok krw
* Send normal output to stdout instead of everything to stderr. Thisray2010-07-241-3/+3
| | | | | | | | | | is currently done in the latest versions of GNU patch. Please watch out for output appearing out-of-order. Discussed with millert and deraadt. OK deraadt
* Don't leak memory after strdup() in makedirs().oga2010-01-081-2/+4
| | | | | | From Igor Zinovik; thanks! ok stsp@, millert@
* 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
* type police and assorted cleanup. From Lionel Fourquaux; ok ray@otto2006-03-111-2/+3
|
* umask juggling not needed; with Lionel Fourquaux.otto2005-06-201-6/+3
| | | | ok millert@ espie@
* Do not call out mkdir -p, but reuse the code from mkdir(1).espie2005-05-161-9/+8
| | | | | | | | | | | Removes the possibility of nasty stuff happening thanks to unquoted arguments in system(1). Also plug a small memory leak. Problems noticed by Lionel Fourquaud. okay millert@, deraadt@
* Allow for path names containing spaces and other funny chars (exceptotto2004-11-191-4/+6
| | | | | | | | tab) by scanning for the tab that separates the date from the pathname. If no tab is found, revert back to the old behaviour. Posix says there should be a space between the pathname and the date, but all known implementations of diff(1) use a tab. ok kurt@ deraadt@
* spacingderaadt2004-08-051-2/+2
|
* o fairly major man page reorganizationmillert2003-10-311-20/+31
| | | | | | 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@
* Add license from patch.c to original source files missing a license.otto2003-08-151-2/+28
| | | | ok deraadt@
* - use stdbool.h instead of roll-your-own booleansotto2003-08-011-4/+4
| | | | | | | | | - 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@
* Unbreak relative directory handling. Tweak from millert@otto2003-07-311-4/+5
| | | | ok millert@
* Make prompting POSIX-compliant. POSIX states "The patch utilitymillert2003-07-301-34/+18
| | | | | | shall write a prompt to standard output and request a filename interactively from the controlling terminal (for example, /dev/tty)." OK deraadt@ and otto@
* o add pathnames.hmillert2003-07-291-6/+8
| | | | | | o ignore empty TMPDIR environment variable o strip any trailing slashes from TMPDIR otto@ OK
* Don't treat consecutive slashes as path components; matches POSIXmillert2003-07-281-7/+7
| | | | OK otto@ and deraadt@
* More cleanup: sprinkled some const, removed ugly EXTERN/INTERN.h,otto2003-07-281-32/+29
| | | | | | some rewriting of code to make it more readable and more KNF. ok millert@ tedu@ deraadt@
* Make patch(1) exit value match POSIX and be consistent with diff.millert2003-07-281-5/+5
| | | | Comments and OK from otto@
* Add POSIX -b option but don't change the default beahvior wrt backupsmillert2003-07-251-86/+67
| | | | yet. The old -b option is now -z (matches GNU patch).
* just about nothingderaadt2003-07-221-3/+3
|
* More cleanup.otto2003-07-221-12/+35
| | | | ok millert@ tedu@
* fix headerderaadt2003-07-211-2/+2
|
* remove a bit more junkderaadt2003-07-211-3/+3
|
* knf and other cleanup; ok ottoderaadt2003-07-211-317/+311
|
* remove junk; ok otto teduderaadt2003-07-181-107/+98
|
* strcpy trashing, help from tedu; ok teduderaadt2003-04-081-3/+3
|
* string fixes; ok miod henningderaadt2003-04-051-3/+3
|
* a few more overflows goneprovos1999-12-041-40/+19
|
* revert strlcpy to strcpy for one case.provos1999-12-041-3/+3
|
* avoid overflowsprovos1999-12-041-9/+12
|
* fix seg fault on sparcmarc1999-01-111-3/+3
|
* Use libc basename(3) and dirname(3) instead of defining our own. Also clean up some nasty assumptions that basename() returns a pointer that lies within its argumentmillert1999-01-031-14/+11
|
* Start of -Wall and cleaning up icky bits.millert1997-09-221-25/+18
|
* sprintf -> snprintf except where guaranteed safe.millert1996-09-241-4/+4
|
* Support the long options that FSF's patch version has. $OpenBSD$ addedniklas1996-06-101-1/+3
|
* initial import of NetBSD treederaadt1995-10-181-0/+441