patch(1): Sync with FreeBSD
authorJohn Marino <draco@marino.st>
Thu, 6 Feb 2014 11:22:53 +0000 (12:22 +0100)
committerJohn Marino <draco@marino.st>
Thu, 6 Feb 2014 11:28:37 +0000 (12:28 +0100)
commit5027f2b859b3278b388cbe51b3500242a1661f2c
tree313a24cfb4ce8a9f9dff1f7b5cc657598572ed31
parent2cb4dff2ba25c53de7b4952a1352cd70506cbd59
patch(1): Sync with FreeBSD

FreeBSD has taken our patch(1) completely (29 JAN 2013), forked it, and
has improved on it.  It's a relatively simple sync.  Selected change log:

More user friendly:
 - Ask only once for "apply anyway"
 - Tell user which patch failed rather than only # of hunk failures

Handle lines with null character:
 - read buffer for pgets properly populated
 - callers of pgets still misprocess buffer contents, but at least
   pgets is more accurate

Make "patch < fubar" and "patch -i fubar" equivalent:
 - previous behavior was source of "unexpected end of file in patch"
   errors when null characters came from stdin

Fixed error handling where final fclose got skipped
Fixed target selection logic to match was was documented on man page
Synced with OpenBSD base
usr.bin/patch/common.h
usr.bin/patch/inp.c
usr.bin/patch/patch.1
usr.bin/patch/patch.c
usr.bin/patch/pch.c
usr.bin/patch/util.c