diff options
author | 2003-07-31 21:07:35 +0000 | |
---|---|---|
committer | 2003-07-31 21:07:35 +0000 | |
commit | 3bf9a76cbfe328803abfcf4f2117de50e22d54cf (patch) | |
tree | 913d345613e4e6d88bde935bd98b4c4d39248194 /usr.bin/patch | |
parent | Unbreak relative directory handling. Tweak from millert@ (diff) | |
download | wireguard-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')
-rw-r--r-- | usr.bin/patch/patch.1 | 4 | ||||
-rw-r--r-- | usr.bin/patch/patch.c | 12 |
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); |