summaryrefslogtreecommitdiffstats
path: root/gnu
diff options
context:
space:
mode:
authormike <mike@FreeBSD.org>2002-02-08 02:05:32 +0000
committermike <mike@FreeBSD.org>2002-02-08 02:05:32 +0000
commitd3aa0af1fe66d07ce4bc93adaa9f46fc34eaf0bd (patch)
treeb1e50f692cc451f2199bda5131fc6c6c34af8590 /gnu
parent614541205860c09d40f76b2e7d9e9b892337a318 (diff)
downloadFreeBSD-src-d3aa0af1fe66d07ce4bc93adaa9f46fc34eaf0bd.zip
FreeBSD-src-d3aa0af1fe66d07ce4bc93adaa9f46fc34eaf0bd.tar.gz
Add -i option (SUSv3) to patch(1). This allows one to specify a
patch file on command line instead of stdin. Submitted by: Joseph Mallett <jmallett@xMach.org> MFC after: 1 month
Diffstat (limited to 'gnu')
-rw-r--r--gnu/usr.bin/patch/patch.113
-rw-r--r--gnu/usr.bin/patch/patch.c7
2 files changed, 17 insertions, 3 deletions
diff --git a/gnu/usr.bin/patch/patch.1 b/gnu/usr.bin/patch/patch.1
index bf21ccf..4781369 100644
--- a/gnu/usr.bin/patch/patch.1
+++ b/gnu/usr.bin/patch/patch.1
@@ -116,6 +116,12 @@ option; if that file already exists, it is backed up first.
If
.I patchfile
is omitted, or is a hyphen, the patch will be read from standard input.
+If a
+\fB\-i\fP
+argument is specified, the filename following it will be used, instead of
+standard input. You may specify only one
+\fB\-i\fP
+directive.
.PP
Upon startup, patch will attempt to determine the type of the diff listing,
unless over-ruled by a
@@ -320,6 +326,11 @@ Note that a larger fuzz factor increases the odds of a faulty patch.
The default fuzz factor is 2, and it may not be set to more than
the number of lines of context in the context diff, ordinarily 3.
.TP 5
+.B "\-i patchfile"
+tells
+.I patch
+to apply \fBpatchfile\fP instead of stdin.
+.TP 5
.B "\-I, \-\-index-first"
forces
.I patch
@@ -453,7 +464,7 @@ causes
.I patch
to print out its revision header and patch level.
.TP 5
-.B "\-V method, \-\-version\-\-control=method"
+.B "\-V method, \-\-version\-control=method"
causes
.B method
to be interpreted as a method for creating
diff --git a/gnu/usr.bin/patch/patch.c b/gnu/usr.bin/patch/patch.c
index 0b49410..76ddd8a 100644
--- a/gnu/usr.bin/patch/patch.c
+++ b/gnu/usr.bin/patch/patch.c
@@ -450,7 +450,7 @@ reinitialize_almost_everything()
fatal1("you may not change to a different patch file\n");
}
-static char *shortopts = "-b:B:cCd:D:eEfF:IlnNo:p::r:RsStuvV:x:";
+static char *shortopts = "-b:B:cCd:D:eEfF:i:IlnNo:p::r:RsStuvV:x:";
static struct option longopts[] =
{
{"suffix", 1, NULL, 'b'},
@@ -540,6 +540,9 @@ get_some_switches()
case 'F':
maxfuzz = atoi(optarg);
break;
+ case 'i':
+ filearg[1] = savestr(optarg);
+ break;
case 'I':
index_first = TRUE;
break;
@@ -601,7 +604,7 @@ Usage: %s [options] [origfile [patchfile]] [+ [options] [origfile]]...\n",
fprintf(stderr, "\
Options:\n\
[-cCeEflnNRsStuv] [-b backup-ext] [-B backup-prefix] [-d directory]\n\
- [-D symbol] [-F max-fuzz] [-o out-file] [-p[strip-count]]\n\
+ [-D symbol] [-F max-fuzz] [-i patchfile] [-o out-file] [-p[strip-count]]\n\
[-r rej-name] [-V {numbered,existing,simple}] [--check] [--context]\n\
[--prefix=backup-prefix] [--suffix=backup-ext] [--ifdef=symbol]\n\
[--directory=directory] [--ed] [--fuzz=max-fuzz] [--force] [--batch]\n\
OpenPOWER on IntegriCloud