summaryrefslogtreecommitdiffstats
path: root/usr.bin/patch/patch.c
diff options
context:
space:
mode:
authormillert <millert@openbsd.org>2003-07-31 21:07:35 +0000
committermillert <millert@openbsd.org>2003-07-31 21:07:35 +0000
commit3bf9a76cbfe328803abfcf4f2117de50e22d54cf (patch)
tree913d345613e4e6d88bde935bd98b4c4d39248194 /usr.bin/patch/patch.c
parentUnbreak relative directory handling. Tweak from millert@ (diff)
downloadwireguard-openbsd-3bf9a76cbfe328803abfcf4f2117de50e22d54cf.tar.xz
wireguard-openbsd-3bf9a76cbfe328803abfcf4f2117de50e22d54cf.zip
Historically, patch would treat a bare -p as -p0. This contradicts
POSIX and GNU patch has also removed this, so we will too. No objections on icb (no one even seemed to know about this "feature").
Diffstat (limited to 'usr.bin/patch/patch.c')
-rw-r--r--usr.bin/patch/patch.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/usr.bin/patch/patch.c b/usr.bin/patch/patch.c
index 5415ad2acf1..002c6328b8a 100644
--- a/usr.bin/patch/patch.c
+++ b/usr.bin/patch/patch.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: patch.c,v 1.33 2003/07/31 14:10:21 otto Exp $ */
+/* $OpenBSD: patch.c,v 1.34 2003/07/31 21:07:35 millert Exp $ */
/*
* patch - a program to apply diffs to original files
@@ -27,7 +27,7 @@
*/
#ifndef lint
-static const char rcsid[] = "$OpenBSD: patch.c,v 1.33 2003/07/31 14:10:21 otto Exp $";
+static const char rcsid[] = "$OpenBSD: patch.c,v 1.34 2003/07/31 21:07:35 millert Exp $";
#endif /* not lint */
#include <sys/types.h>
@@ -438,7 +438,7 @@ reinitialize_almost_everything(void)
static void
get_some_switches(void)
{
- const char *options = "b::B:cCd:D:eEfF:i:lnNo:p::r:RstuvV:x:z:";
+ const char *options = "b::B:cCd:D:eEfF:i:lnNo:p:r:RstuvV:x:z:";
static struct option longopts[] = {
{"backup", no_argument, 0, 'b'},
{"batch", no_argument, 0, 't'},
@@ -461,7 +461,7 @@ get_some_switches(void)
{"remove-empty-files", no_argument, 0, 'E'},
{"reverse", no_argument, 0, 'R'},
{"silent", no_argument, 0, 's'},
- {"strip", optional_argument, 0, 'p'},
+ {"strip", required_argument, 0, 'p'},
{"suffix", required_argument, 0, 'z'},
{"unified", no_argument, 0, 'u'},
{"version", no_argument, 0, 'v'},
@@ -547,7 +547,7 @@ get_some_switches(void)
outname = savestr(optarg);
break;
case 'p':
- strippath = optarg ? atoi(optarg) : 0;
+ strippath = atoi(optarg);
break;
case 'r':
if (strlcpy(rejname, optarg,
@@ -603,7 +603,7 @@ usage(void)
{
fprintf(stderr,
"usage: patch [-bcCeEflnNRstuv] [-B backup-prefix] [-d directory] [-D symbol]\n"
-" [-Fmax-fuzz] [-i patchfile] [-o out-file] [-p[strip-count]]\n"
+" [-F max-fuzz] [-i patchfile] [-o out-file] [-p strip-count]\n"
" [-r rej-name] [-V {numbered,existing,simple}] [-z backup-ext]\n"
" [origfile [patchfile]]\n");
my_exit(EXIT_SUCCESS);