diff --git a/gnu/usr.bin/patch/patch.1 b/gnu/usr.bin/patch/patch.1 index bf21ccf1d834..4781369d7608 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 0b49410fa356..76ddd8a28f74 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\