diff options
| author | kleink <kleink@NetBSD.org> | 2000-10-16 07:05:04 +0000 |
|---|---|---|
| committer | kleink <kleink@NetBSD.org> | 2000-10-16 07:05:04 +0000 |
| commit | 961cdd38dd45873eb2efce8dcba9bf2672d3bbd3 (patch) | |
| tree | 4e34bb5ad62b91353d57e68ce1e40b00ed6e2146 /usr.bin/patch | |
| parent | c64069308bd9b857694266b6414ecb893dca6988 (diff) | |
Support the 1003.2-92 -i option to specify a patchfile;
fixes PR standards/11221.
Diffstat (limited to 'usr.bin/patch')
| -rw-r--r-- | usr.bin/patch/patch.1 | 12 | ||||
| -rw-r--r-- | usr.bin/patch/patch.c | 13 |
2 files changed, 21 insertions, 4 deletions
diff --git a/usr.bin/patch/patch.1 b/usr.bin/patch/patch.1 index c3b8d4c3f2b..d1aef308bc3 100644 --- a/usr.bin/patch/patch.1 +++ b/usr.bin/patch/patch.1 @@ -1,4 +1,4 @@ -.\" $NetBSD: patch.1,v 1.4 1996/09/19 06:27:12 thorpej Exp $ -*- nroff -*- +.\" $NetBSD: patch.1,v 1.5 2000/10/16 07:05:04 kleink Exp $ -*- nroff -*- .rn '' }` .de Sh .br @@ -80,8 +80,13 @@ You may also specify where you want the output to go with a switch; if that file already exists, it is backed up first. .PP If +no .I patchfile -is omitted, or is a hyphen, the patch will be read from standard input. +argument is specified using the +.BR -i +option, and the +.I patchfile +argument is omitted, or is a hyphen, the patch will be read from standard input. .PP Upon startup, patch will attempt to determine the type of the diff listing, unless over-ruled by a @@ -255,6 +260,9 @@ This option does not suppress commentary; use .B \-s for that. .TP 5 +.B \-i <patchfile> or \-\-patchfile <patchfile> +Read the patch to be applied from the specified file. +.TP 5 .B \-t or \-\-batch similar to .BR \-f , diff --git a/usr.bin/patch/patch.c b/usr.bin/patch/patch.c index 5b828478a5e..f54ad2af169 100644 --- a/usr.bin/patch/patch.c +++ b/usr.bin/patch/patch.c @@ -1,4 +1,4 @@ -/* $NetBSD: patch.c,v 1.7 1998/11/06 22:40:13 christos Exp $ */ +/* $NetBSD: patch.c,v 1.8 2000/10/16 07:05:04 kleink Exp $ */ /* patch - a program to apply diffs to original files * @@ -10,7 +10,7 @@ #include <sys/cdefs.h> #ifndef lint -__RCSID("$NetBSD: patch.c,v 1.7 1998/11/06 22:40:13 christos Exp $"); +__RCSID("$NetBSD: patch.c,v 1.8 2000/10/16 07:05:04 kleink Exp $"); #endif /* not lint */ #include "INTERN.h" @@ -424,6 +424,7 @@ decode_long_option(opt) { "ignore-whitespace", 'l' }, { "normal", 'n' }, { "output", 'o' }, + { "patchfile", 'i' }, { "prefix", 'B' }, { "quiet", 's' }, { "reject-file", 'r' }, @@ -466,6 +467,9 @@ get_some_switches() if (*s != '-' || !s[1]) { if (filec == MAXFILEC) fatal1("too many file arguments\n"); + if (filec == 1 && filearg[filec] != Nullch) + fatal1("-i option and patchfile argument are mutually\ +exclusive\n"); filearg[filec++] = savestr(s); } else { @@ -518,6 +522,11 @@ get_some_switches() s++; maxfuzz = atoi(s); break; + case 'i': + if (filearg[1] != Nullch) + free(filearg[1]); + filearg[1] = savestr(nextarg()); + break; case 'l': canonicalize = TRUE; break; |
