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