summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2003-07-31 21:07:36 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2003-07-31 21:07:36 +0000
commita11d33cb66c2a63ab4cc10df9bee32b699bab2aa (patch)
tree667ab01792ca7786575266877d584de8fd1e6cb4
parent526fe45812ae125bcc899def9b7ec5c7ff1b3118 (diff)
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").
-rw-r--r--usr.bin/patch/patch.14
-rw-r--r--usr.bin/patch/patch.c12
2 files changed, 7 insertions, 9 deletions
diff --git a/usr.bin/patch/patch.1 b/usr.bin/patch/patch.1
index ccbe89c79a9..082443d87a9 100644
--- a/usr.bin/patch/patch.1
+++ b/usr.bin/patch/patch.1
@@ -1,4 +1,4 @@
-.\" $OpenBSD: patch.1,v 1.15 2003/07/30 16:45:44 millert Exp $
+.\" $OpenBSD: patch.1,v 1.16 2003/07/31 21:07:35 millert Exp $
.\" Copyright 1986, Larry Wall
.\"
.\" Redistribution and use in source and binary forms, with or without
@@ -312,8 +312,6 @@ For example, supposing the filename in the patch file was
.Pa /u/howard/src/blurfl/blurfl.c :
.Pp
Setting
-.Fl p
-or
.Fl p Ns Ar 0
gives the entire pathname unmodified.
.Pp
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);