summaryrefslogtreecommitdiff
path: root/usr.bin/patch/patch.c
diff options
context:
space:
mode:
authorkleink <kleink@NetBSD.org>2000-10-16 07:05:04 +0000
committerkleink <kleink@NetBSD.org>2000-10-16 07:05:04 +0000
commit961cdd38dd45873eb2efce8dcba9bf2672d3bbd3 (patch)
tree4e34bb5ad62b91353d57e68ce1e40b00ed6e2146 /usr.bin/patch/patch.c
parentc64069308bd9b857694266b6414ecb893dca6988 (diff)
Support the 1003.2-92 -i option to specify a patchfile;
fixes PR standards/11221.
Diffstat (limited to 'usr.bin/patch/patch.c')
-rw-r--r--usr.bin/patch/patch.c13
1 files changed, 11 insertions, 2 deletions
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;