Commit Graph

34 Commits

Author SHA1 Message Date
wiz 66c213d6e4 patch: add --backup-if-mismatch and --no-backup-if-mismatch for GNU patch compatibility
These options only make sense in POSIX mode, since NetBSD's patch
has --backup enabled by default and GNU patch doesn't.

In POSIX mode, GNU patch and NetBSD patch now behave the same for these
two options.
2023-06-16 11:27:00 +00:00
dholland 71e9f39a89 Fix the message that appears if you patch -R an unapplied patch. 2021-09-20 23:22:36 +00:00
cjep 9265e94bb9 As per OpenBSD, use malloc for the line buffer. Fixes the known issue
with long lines and makes our ATF test suite pass fully.
Closes PR bin/54620 from coypu who suggested the approach.
Reviewed by christos.
2021-05-25 11:25:59 +00:00
nia 894dfd713b patch(1): use PATH_MAX for the size of rejname
via freebsd, openbsd
2021-02-20 09:17:13 +00:00
nia 8b022a822c patch: make '-V none' work in the expected way
Internally the code confuses the concept of "the user doesn't want
a backup file" and "the user hasn't defined a type of backup file".

Introduce a new "undefined" backup type to serve the purpose "none"
previously did, and make "none" not generate backup files, as expected.

http://mail-index.netbsd.org/tech-userlevel/2021/02/19/msg012901.html

XXX pullup?
2021-02-19 17:46:53 +00:00
joerg d5bd94639a Consistently use __dead and __printflike. 2011-09-06 18:25:14 +00:00
dholland 51ab93526e Exit with EXIT_FAILURE for invalid arguments. PR 43517. 2011-03-26 21:45:48 +00:00
joerg d5b2c9a825 Update patch to the version used by DragonFly and derived from OpenBSD.
Major changes are:
- better detection of double applied patches
- rejects remain unified diffs for unified patches
- far less limitations, e.g. patch lines may be arbitrary long

This addresses PR standards/11220 by changing patch -b behavior to be
POSIX compliant. Old behavior can be obtained using --suffix, which
works since NetBSD 1.4. pkgsrc has been adjusted accordingly.
2008-09-19 18:33:34 +00:00
gdt 69bdd817cc Add error checking to use of fputs in creating output file in
temprorary directory.  Previously, fputs was used without checking the
return value, leading to silent truncation when the temporary
filesystem was full (such as can easily happen when migrating to
tmpfs).
2008-08-10 22:36:23 +00:00
lukem bd560fde31 Convert to using raise_default_signal(3). 2007-10-14 04:54:34 +00:00
wiz de60b309dc Sort options. Add -C to usage. 2005-03-25 23:55:02 +00:00
skd 4f9669ed8d add --dry-run like gnu patch. 2005-03-25 23:00:55 +00:00
mycroft 33131ab95f Fix an array overrun in option parsing.
Fixes PR 26732, PR 26775, PR 28416 and PR 28589.
2004-12-09 18:06:10 +00:00
cube 224d89c7db Remove debug printf (hi mycroft!). 2004-08-14 12:53:35 +00:00
mycroft ee776b9f85 Parse multiple options that are specified together; e.g. "-fs".
XXX It is not clear to me why patch(1) doesn't get getopt_long(3).
2004-08-06 14:54:26 +00:00
itojun 75c32b46eb use bounded string op 2003-07-30 08:51:04 +00:00
kristerw 3e51d2b759 Const poisoning. 2003-07-08 01:55:35 +00:00
kristerw f4b0e187e9 Fix some lint warnings. 2003-05-30 23:08:12 +00:00
kristerw 7e5434fe39 Remove stuff that are not needed any longer. 2003-05-30 22:33:58 +00:00
kristerw b86c323d39 Simplify handling of memory allocation, and make sure all return values
from malloc etc. are handled.

This removes the old behavior to retry the operation with a less memory-
consuming method in case malloc failed (this mechanism has never really
worked, and is hard to test.  Besides, it is less useful now than it was
20 years ago when the code was written...)
2003-05-30 18:14:13 +00:00
kristerw 2a9882e7e9 Be consistent with use of types (e.g. do not use LINENUM for quantities
that are not line numbers).
2003-05-29 00:59:23 +00:00
kristerw 6d0ebdd74a Do not try to write a rejects file for those cases where the user has
told us to skip a patch due to missing file to patch.

Solves PR 19827 from Toru TAKAMIZU.
2003-01-19 00:50:28 +00:00
kristerw 93318b47b3 Check result of malloc and strdup
Made some functions static
Removed unneccessary buffer
Increased size of some buffers that could overflow
2002-03-16 22:36:42 +00:00
kristerw 175b5054de Ansify
Remove unused defines
Remove #ifndef lint
Remove redundant and incorrect casts.
2002-03-11 18:47:51 +00:00
kristerw 8bcbaa7bc8 Ansify
Remove 'register'
Make local functions static.
Remove most '#ifndef lint'
2002-03-08 21:57:33 +00:00
ragge 744110b40b License change; patch.c now has a BSD license.
From Larry Wall via Niklas Hallqvist, <niklas@appli.se>.
2002-03-06 12:01:03 +00:00
kleink 961cdd38dd Support the 1003.2-92 -i option to specify a patchfile;
fixes PR standards/11221.
2000-10-16 07:05:04 +00:00
christos b239b35fe2 char -> unsigned char
rindex -> strrchr
1998-11-06 22:40:13 +00:00
christos 795e0608f6 WARNSify 1998-02-22 12:55:44 +00:00
lukem 0c81e58868 use mkstemp() instead of mktemp() to create the tempfile 1997-03-22 03:38:03 +00:00
thorpej 29cf09f47a RCS id police. 1996-09-19 06:27:04 +00:00
thorpej 0b02f897d7 Decode long (GNU-style) options. Changes originally from Niklas Hallqvist,
but modified some by me.
1996-09-19 06:10:02 +00:00
mycroft aee4b07b8a Add RCS identifiers, remove some completely useless RCS logs and patchkit
headers, and a few other insignificant changes.
1993-08-02 17:48:44 +00:00
cgd 3b63e56cdf patch 2.0.12u8, from prep.ai.mit.edu. this is not under the GPL. 1993-04-09 11:33:50 +00:00