History log of /freebsd-current/usr.bin/patch/util.c
Revision Date Author Comments
# 42b38843 16-Aug-2023 Warner Losh <imp@FreeBSD.org>

Remove $FreeBSD$: one-line .h pattern

Remove /^\s*\*+\s*\$FreeBSD\$.*$\n/


# 50dacbf6 03-Nov-2019 Kyle Evans <kevans@FreeBSD.org>

patch(1): give /dev/null patches special treatment

We have a bad habit of duplicating contents of files that are sourced from
/dev/null and applied more than once... take the more sane (in most ways)
GNU route and complain if the file exists and offer reversal options.

This still falls short a little bit as selecting "don't reverse, apply
anyway" will still give you duplicated file contents. There's probably other
issues as well, but awareness is the first step to happiness.

MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D21535


# e678759c 14-Aug-2015 Xin LI <delphij@FreeBSD.org>

Remove automatic checkout feature.

Obtained from: DragonFly via OpenBSD
Relnotes: yes
MFC: never


# df6e4074 20-Apr-2015 Pedro F. Giffuni <pfg@FreeBSD.org>

patch(1): small include changes.

Mostly to match OpenBSD, no functional change.

Obtained from: OpenBSD


# f718bedc 31-Dec-2014 Pedro F. Giffuni <pfg@FreeBSD.org>

Fixes to exit status.

Exit with EXIT_FAILURE for invalid arguments.
Fixes NetBSD-PR 43517.

Print version string to stdout instead of stderr;
it is user-requested and not an error.

Obtained from: NetBSD
MFC after: 5 days


# 547e0acb 25-Dec-2014 Pedro F. Giffuni <pfg@FreeBSD.org>

patch: Bring in xstrdup and use it when appropriate.

The function savestr allows NULL return values during Plan A patching so in
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).

Clean up some whitespaces while here

Obtained from: OpenBSD
MFC after: 2 weeks


# e11cd3bc 26-Sep-2013 Xin LI <delphij@FreeBSD.org>

Improve bsdpatch usability:

- Ask only once for "Apply anyway". [1]
- Tell user what file have failed patch rather than just how
many hunks failed.

Reported by: jmg via pfg [1]
Tested by: pfg [1]
Approved by: re (gjb)


# 79d8aaa9 04-Sep-2013 Stefan Eßer <se@FreeBSD.org>

Fix file selection logic for the RCS/SCCS case, as was done for the simple
file case before. Bump version because of the changed behavior, which now
matches the documentation.

Reviewed by: pfg


# ffca5883 25-May-2013 Glen Barber <gjb@FreeBSD.org>

Revert r250972 to fix build.


# 2360cb0e 24-May-2013 Stefan Eßer <se@FreeBSD.org>

The error handling for writes to the target file could lead to the final
fclose() being skipped. Fix this by using boolean "&" and "|" instead of
short-cut operators "&&" and "||".
While here, increment the last part of the version string. The reason is
the fixed output file selection logic in pch.c, which was committed as
r250943, yesterday.

Reviewed by: pfg


# 23a36825 08-Feb-2013 Pedro F. Giffuni <pfg@FreeBSD.org>

patch: Follow original versioning convention.

According to the README file [1] the 12u variant, unlike
the 12g variant, contains no copyleft code. It is therefore
convenient to keep using the original versioning scheme to
prevent confusions.

[1] http://www.openbsd.org/cgi-bin/cvsweb/src/usr.bin/patch/README


# e56ef7d3 29-Jan-2013 Xin LI <delphij@FreeBSD.org>

- Refresh code with latest OpenBSD revisions.
- Remove $DragonFly$ tags as they are using git nowadays and VCS tags will
not help merging.
- Other changes to Copyright headers to make them consistent with other
source code, we intend to fork from this point.

Reviewed by: pfg


# 2dd076b8 29-Jan-2013 Gabor Kovesdan <gabor@FreeBSD.org>

- Add a BSD-licensed patch, ported by Pedro F. Giffuni (pfg) from
DragonflyBSD and install it as bsdpatch. WITH_BSD_PATCH makes it
default and installs GNU patch as gnupatch.

Submitted by: pfg
Obtained from: The DragonflyBSD Project


# a9c7144e 01-Aug-2004 Garance A Drosehn <gad@FreeBSD.org>

Import of a BSD-licensed version of `patch', which will eventually
replace the version we currently have in src/gnu/usr.bin/patch/.
Among other things, this version includes a --posix option for strict
POSIX conformance.

This version is the current source from OpenBSD as of today. It is
their 3.5-release, plus a few updates to patch.c and pch.c that they
made about three weeks ago.


# 65b3003d 13-Jul-1997 Peter Wemm <peter@FreeBSD.org>

kill the undead


# c44252b6 06-Jul-1997 Bruce Evans <bde@FreeBSD.org>

Finish importing Lite2's src/usr.bin, except for ex, diff, grep, mail,
pascal and vmstat.sparc. All changed files on the vendor branch should
already have been imported.


# 6065a0be 30-Dec-1995 Peter Wemm <peter@FreeBSD.org>

This commit was generated by cvs2svn to compensate for changes in r13122,
which included commits to RCS files with non-trunk default branches.


# 9b50d902 26-May-1994 Rodney W. Grimes <rgrimes@FreeBSD.org>

BSD 4.4 Lite Usr.bin Sources