.\" patch man page.de Id.ds Dt \\$4...Id $Id: patch.man,v 1.23 1997/07/16 12:26:36 eggert Exp $.ds = \-\^\-.de Sp.if t .sp .3.if n .sp...TH PATCH 1 \*(Dt GNU.ta 3n.SH NAMEpatch \- apply a diff file to an original.SH SYNOPSIS.B patch.RI [ options ].RI [ originalfile.RI [ patchfile ]].Spbut usually just.Sp.BI "patch \-p" "num".BI < patchfile.SH DESCRIPTION.B patchtakes a patch file.I patchfilecontaining a difference listing produced by the.B diffprogram and applies those differences to one or more original files,producing patched versions.Normally the patched versions are put in place of the originals.Backups can be made; see the.B \-bor.B \*=backupoption.The names of the files to be patched are usually taken from the patch file,but if there's just one file to be patched it can specified on thecommand line as.IR originalfile ..PPUpon startup, patch attempts to determine the type of the diff listing,unless overruled by a\fB\-c\fP (\fB\*=context\fP),\fB\-e\fP (\fB\*=ed\fP),\fB\-n\fP (\fB\*=normal\fP),or\fB\-u\fP (\fB\*=unified\fP)option.Context diffs (old-style, new-style, and unified) andnormal diffs are applied by the.B patchprogram itself, while.B eddiffs are simply fed to the.BR ed (1)editor via a pipe..PP.B patchtries to skip any leading garbage, apply the diff,and then skip any trailing garbage.Thus you could feed an article or message containing adiff listing to.BR patch ,and it should work.If the entire diff is indented by a consistent amount,or if a context diff is encapsulated one or more times by prepending"\fB\- \fP" to lines starting with "\fB\-\fP" as specified by Internet RFC 934,this is taken into account..PPWith context diffs, and to a lesser extent with normal diffs,.B patchcan detect when the line numbers mentioned in the patch are incorrect,and attempts to find the correct place to apply each hunk of the patch.As a first guess, it takes the line number mentioned for the hunk, plus orminus any offset used in applying the previous hunk.If that is not the correct place,.B patchscans both forwards and backwards for a set of lines matching the contextgiven in the hunk.First.B patchlooks for a place where all lines of the context match.If no such place is found, and it's a context diff, and the maximum fuzz factoris set to 1 or more, then another scan takes place ignoring the first and lastline of context.If that fails, and the maximum fuzz factor is set to 2 or more,the first two and last two lines of context are ignored,and another scan is made.(The default maximum fuzz factor is 2.)If.B patchcannot find a place to install that hunk of the patch, it puts thehunk out to a reject file, which normally is the name of the output fileplus a.B \&.rejsuffix, or.B #if.B \&.rejwould generate a file name that is too long(if even appending the single character.B #makes the file name too long, then.B #replaces the file name's last character).(The rejected hunk comes out in ordinary context diff form regardless ofthe input patch's form.If the input was a normal diff, many of the contexts are simply null.)The line numbers on the hunks in the reject file may be different thanin the patch file: they reflect the approximate location patch thinks thefailed hunks belong in the new file rather than the old one..PPAs each hunk is completed, you are told if the hunkfailed, and if so which line (in the new file).B patchthought the hunk should go on.If the hunk is installed at a different linefrom the line number specified in the diff youare told the offset.A single large offset.I mayindicate that a hunk was installed in thewrong place.You are also told if a fuzz factor was used to make the match, in whichcase you should also be slightly suspicious.If the.B \*=verboseoption is given, you are also told about hunks that match exactly..PPIf no original file.I origfileis specified on the command line,.B patchtries to figure out from the leading garbage what the name of the fileto edit is, using the following rules..TP 3.B " \(bu"If the header is that of a context diff,.B patchtakes the old and new file names in the header.Any.B /dev/nullnames are ignored..TP.B " \(bu"If there is an.B Index:\&line in the leading garbageand if either the old and new names are both absent or the.B POSIXLY_CORRECTenvironment variable is set,.B patchtakes the name in the.B Index:\&line..TP.B " \(bu"For the purpose of the following rules,the names are considered to be in the order (old, new, index),regardless of the order that they appear in the header..TP.B " \(bu"If some of the named files exist,.B patchuses the first name if the.B POSIXLY_CORRECTenvironment variable is set, and the best name otherwise..TP.B " \(bu"If.B patchis not ignoring \s-1RCS\s0 and \s-1SCCS\s0 (see the.BI "\-g\ " numor.BI \*=get= numoption), and no named files existbut an \s-1RCS\s0 or \s-1SCCS\s0 master is found,.B patchuses the first named file with an \s-1RCS\s0 or \s-1SCCS\s0 master..TP.B " \(bu"If no named files exist, no \s-1RCS\s0 or \s-1SCCS\s0 master was found,some names are given,.B POSIXLY_CORRECTis not set, and the patch appears to create a file,.B patchuses the best name requiring the creation of the fewest directories..TP.B " \(bu"If no file name results from the above heuristics, you are askedfor the name of the file to patch..LPTo determine the.I bestof a nonempty list of file names,.B patchfirst takes all the names with the fewest path name components;of those, it then takes all the names with the shortest basename;of those, it then takes all the shortest names;finally, it takes the first remaining name..PPAdditionally, if the leading garbage contains a.B Prereq:\&line,.B patchtakes the first word from the prerequisites line (normally a versionnumber) and checks the original file to see if that word can be found.If not,.B patchasks for confirmation before proceeding..PPThe upshot of all this is that you should be able to say, while in a newsinterface, something like the following:.Sp \fB| patch \-d /usr/src/local/blurfl\fP.Spand patch a file in the.B blurfldirectory directly from the article containingthe patch..PPIf the patch file contains more than one patch,.B patchtries to apply each of them as if they came from separate patch files.This means, among other things, that it is assumed that the name of the fileto patch must be determined for each diff listing,and that the garbage before each diff listingcontains interesting things such as file names and revision level, asmentioned previously..SH OPTIONS.TP 3\fB\-b\fP or \fB\*=backup\fPMake backup files.That is, when patching a file,rename or copy the original instead of removing it.When backing up a file that does not exist,an empty, unreadable backup file is createdas a placeholder to represent the nonexistent file.See the.B \-Vor.B \*=version\-controloption for details about how backup file names are determined..TP.B \*=backup\-if\-mismatchBack up a file if the patch does not match the file exactlyand if backups are not otherwise requested.This is the default unless the.B POSIXLY_CORRECTenvironment variable is set..TP.B \*=no\-backup\-if\-mismatchDo not back up a file if the patch does not match the file exactlyand if backups are not otherwise requested.This is the default if the.B POSIXLY_CORRECTenvironment variable is set..TP\fB\-B\fP \fIpref\fP or \fB\*=prefix=\fP\fIpref\fPPrefix.I prefto a file name when generating its simple backup file name.For example, with.B "\-B\ /junk/"the simple backup file name for.B src/patch/util.cis.BR /junk/src/patch/util.c ..TP\fB\*=binary\fPRead and write all files in binary mode,except for standard output and.BR /dev/tty .This option has no effect on \s-1POSIX\s0-compliant systems.On systems like \s-1DOS\s0 where this option makes a difference,the patch should be generated by.BR "diff\ \-a\ \*=binary" ..TP\fB\-c\fP or \fB\*=context\fPInterpret the patch file as a ordinary context diff..TP\fB\-d\fP \fIdir\fP or \fB\*=directory=\fP\fIdir\fPChange to the directory.I dirimmediately, before doinganything else..TP\fB\-D\fP \fIdefine\fP or \fB\*=ifdef=\fP\fIdefine\fPUse the.BR #ifdef " .\|.\|. " #endifconstruct to mark changes, with.I defineas the differentiating symbol..TP.B "\*=dry\-run"Print the results of applying the patches without actually changing any files..TP\fB\-e\fP or \fB\*=ed\fPInterpret the patch file as an.B edscript..TP\fB\-E\fP or \fB\*=remove\-empty\-files\fPRemove output files that are empty after the patches have been applied.Normally this option is unnecessary, since.B patchcan examine the time stamps on the header to determine whether a fileshould exist after patching.However, if the input is not a context diff or if the.B POSIXLY_CORRECTenvironment variable is set,.B patchdoes not remove empty patched files unless this option is given.When.B patchremoves a file, it also attempts to remove any empty ancestor directories..TP\fB\-f\fP or \fB\*=force\fPAssume that the user knows exactly what he or she is doing, and do notask any questions. Skip patches whose headersdo not say which file is to be patched; patch files even though they have thewrong version for the.B Prereq:\&line in the patch; and assume thatpatches are not reversed even if they look like they are.This option does not suppress commentary; use.B \-sfor that..TP\fB\-F\fP \fInum\fP or \fB\*=fuzz=\fP\fInum\fPSet the maximum fuzz factor.This option only applies to diffs that have context, and causes.B patchto ignore up to that many lines in looking for places to install a hunk.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 thanthe number of lines of context in the context diff, ordinarily 3..TP\fB\-g\fP \fInum\fP or \fB\*=get=\fP\fInum\fPThis option controls.BR patch 'sactions when a file is under \s-1RCS\s0 or \s-1SCCS\s0 control,and does not exist or is read-only and matches the default version.If.I numis positive,.B patchgets (or checks out) the file from the revision control system; if zero,.B patchignores \s-1RCS\s0 and \s-1SCCS\s0 and does not get the file; and if negative,.B patchasks the user whether to get the file.The default value of this option is given by the value of the.B PATCH_GETenvironment variable if it is set; if not, the default value is zero if .B POSIXLY_CORRECTis set, negative otherwise..TP.B "\*=help"Print a summary of options and exit..TP\fB\-i\fP \fIpatchfile\fP or \fB\*=input=\fP\fIpatchfile\fPRead the patch from.IR patchfile .If.I patchfileis.BR \- ,read from standard input, the default..TP\fB\-l\fP or \fB\*=ignore\-whitespace\fPMatch patterns loosely, in case tabs or spaceshave been munged in your files.Any sequence of one or more blanks in the patch file matches any sequencein the original file, and sequences of blanks at the ends of lines are ignored.Normal characters must still match exactly.Each line of the context must still match a line in the original file..TP\fB\-n\fP or \fB\*=normal\fPInterpret the patch file as a normal diff..TP\fB\-N\fP or \fB\*=forward\fPIgnore patches that seem to be reversed or already applied.See also.BR \-R ..TP\fB\-o\fP \fIoutfile\fP or \fB\*=output=\fP\fIoutfile\fPSend output to.I outfileinstead of patching files in place..TP\fB\-p\fP\fInum\fP or \fB\*=strip\fP\fB=\fP\fInum\fPStrip the smallest prefix containing.I numleading slashes from each file name found in the patch file.A sequence of one or more adjacent slashes is counted as a single slash.This controls how file names found in the patch file are treated, in caseyou keep your files in a different directory than the person who sentout the patch.For example, supposing the file name in the patch file was.Sp \fB/u/howard/src/blurfl/blurfl.c\fP.Spsetting.B \-p0gives the entire file name unmodified,.B \-p1gives.Sp \fBu/howard/src/blurfl/blurfl.c\fP.Spwithout the leading slash,.B \-p4gives.Sp \fBblurfl/blurfl.c\fP.Spand not specifying.B \-pat all just gives you \fBblurfl.c\fP.Whatever you end up with is looked for either in the current directory,or the directory specified by the.B \-doption..TP\fB\-r\fP \fIrejectfile\fP or \fB\*=reject\-file=\fP\fIrejectfile\fPPut rejects into.I rejectfileinstead of the default.B \&.rejfile..TP\fB\-R\fP or \fB\*=reverse\fPAssume that this patch was created with the old and new files swapped.(Yes, I'm afraid that does happen occasionally, human nature being what itis.).B patchattempts to swap each hunk around before applying it.Rejects come out in the swapped format.The.B \-Roption does not work with.B eddiff scripts because there is too littleinformation to reconstruct the reverse operation..SpIf the first hunk of a patch fails,.B patchreverses the hunk to see if it can be applied that way.If it can, you are asked if you want to have the.B \-Roption set.If it can't, the patch continues to be applied normally.(Note: this method cannot detect a reversed patch if it is a normal diffand if the first command is an append (i.e. it should have been a delete)since appends always succeed, due to the fact that a null context matchesanywhere.Luckily, most patches add or change lines rather than delete them, so mostreversed normal diffs begin with a delete, which fails, triggeringthe heuristic.).TP\fB\-s\fP or \fB\*=silent\fP or \fB\*=quiet\fPWork silently, unless an error occurs..TP\fB\-t\fP or \fB\*=batch\fPSuppress questions like.BR \-f ,but make some different assumptions:skip patches whose headers do not contain file names (the same as \fB\-f\fP);skip patches for which the file has the wrong version for the.B Prereq:\&linein the patch; and assume that patches are reversed if they look likethey are..TP\fB\-T\fP or \fB\*=set\-time\fPSet the modification and access times of patched files from time stampsgiven in context diff headers, assuming that the context diff headersuse local time. This option is not recommended, because patches usinglocal time cannot easily be used by people in other time zones, andbecause local time stamps are ambiguous when local clocks move backwardsduring daylight-saving time adjustments. Instead of using this option,generate patches with \s-1UTC\s0 and use the.B \-Zor.B \*=set\-utcoption instead..TP\fB\-u\fP or \fB\*=unified\fPInterpret the patch file as a unified context diff..TP\fB\-v\fP or \fB\*=version\fPPrint out.BR patch 'srevision header and patch level, and exit..TP\fB\-V\fP \fImethod\fP or \fB\*=version\-control=\fP\fImethod\fPLines 1–500 of 1064. Load more
.\" patch man page .de Id .ds Dt \\$4 .. .Id $Id: patch.man,v 1.23 1997/07/16 12:26:36 eggert Exp $ .ds = \-\^\- .de Sp .if t .sp .3 .if n .sp .. .TH PATCH 1 \*(Dt GNU .ta 3n .SH NAME patch \- apply a diff file to an original .SH SYNOPSIS .B patch .RI [ options ] .RI [ originalfile .RI [ patchfile ]] .Sp but usually just .Sp .BI "patch \-p" "num" .BI < patchfile .SH DESCRIPTION .B patch takes a patch file .I patchfile containing a difference listing produced by the .B diff program and applies those differences to one or more original files, producing patched versions. Normally the patched versions are put in place of the originals. Backups can be made; see the .B \-b or .B \*=backup option. The names of the files to be patched are usually taken from the patch file, but if there's just one file to be patched it can specified on the command line as .IR originalfile . .PP Upon startup, patch attempts to determine the type of the diff listing, unless overruled by a \fB\-c\fP (\fB\*=context\fP), \fB\-e\fP (\fB\*=ed\fP), \fB\-n\fP (\fB\*=normal\fP), or \fB\-u\fP (\fB\*=unified\fP) option. Context diffs (old-style, new-style, and unified) and normal diffs are applied by the .B patch program itself, while .B ed diffs are simply fed to the .BR ed (1) editor via a pipe. .PP .B patch tries to skip any leading garbage, apply the diff, and then skip any trailing garbage. Thus you could feed an article or message containing a diff listing to .BR patch , and it should work. If the entire diff is indented by a consistent amount, or if a context diff is encapsulated one or more times by prepending "\fB\- \fP" to lines starting with "\fB\-\fP" as specified by Internet RFC 934, this is taken into account. .PP With context diffs, and to a lesser extent with normal diffs, .B patch can detect when the line numbers mentioned in the patch are incorrect, and attempts to find the correct place to apply each hunk of the patch. As a first guess, it takes the line number mentioned for the hunk, plus or minus any offset used in applying the previous hunk. If that is not the correct place, .B patch scans both forwards and backwards for a set of lines matching the context given in the hunk. First .B patch looks for a place where all lines of the context match. If no such place is found, and it's a context diff, and the maximum fuzz factor is set to 1 or more, then another scan takes place ignoring the first and last line of context. If that fails, and the maximum fuzz factor is set to 2 or more, the first two and last two lines of context are ignored, and another scan is made. (The default maximum fuzz factor is 2.) If .B patch cannot find a place to install that hunk of the patch, it puts the hunk out to a reject file, which normally is the name of the output file plus a .B \&.rej suffix, or .B # if .B \&.rej would generate a file name that is too long (if even appending the single character .B # makes the file name too long, then .B # replaces the file name's last character). (The rejected hunk comes out in ordinary context diff form regardless of the input patch's form. If the input was a normal diff, many of the contexts are simply null.) The line numbers on the hunks in the reject file may be different than in the patch file: they reflect the approximate location patch thinks the failed hunks belong in the new file rather than the old one. .PP As each hunk is completed, you are told if the hunk failed, and if so which line (in the new file) .B patch thought the hunk should go on. If the hunk is installed at a different line from the line number specified in the diff you are told the offset. A single large offset .I may indicate that a hunk was installed in the wrong place. You are also told if a fuzz factor was used to make the match, in which case you should also be slightly suspicious. If the .B \*=verbose option is given, you are also told about hunks that match exactly. .PP If no original file .I origfile is specified on the command line, .B patch tries to figure out from the leading garbage what the name of the file to edit is, using the following rules. .TP 3 .B " \(bu" If the header is that of a context diff, .B patch takes the old and new file names in the header. Any .B /dev/null names are ignored. .TP .B " \(bu" If there is an .B Index:\& line in the leading garbage and if either the old and new names are both absent or the .B POSIXLY_CORRECT environment variable is set, .B patch takes the name in the .B Index:\& line. .TP .B " \(bu" For the purpose of the following rules, the names are considered to be in the order (old, new, index), regardless of the order that they appear in the header. .TP .B " \(bu" If some of the named files exist, .B patch uses the first name if the .B POSIXLY_CORRECT environment variable is set, and the best name otherwise. .TP .B " \(bu" If .B patch is not ignoring \s-1RCS\s0 and \s-1SCCS\s0 (see the .BI "\-g\ " num or .BI \*=get= num option), and no named files exist but an \s-1RCS\s0 or \s-1SCCS\s0 master is found, .B patch uses the first named file with an \s-1RCS\s0 or \s-1SCCS\s0 master. .TP .B " \(bu" If no named files exist, no \s-1RCS\s0 or \s-1SCCS\s0 master was found, some names are given, .B POSIXLY_CORRECT is not set, and the patch appears to create a file, .B patch uses the best name requiring the creation of the fewest directories. .TP .B " \(bu" If no file name results from the above heuristics, you are asked for the name of the file to patch. .LP To determine the .I best of a nonempty list of file names, .B patch first takes all the names with the fewest path name components; of those, it then takes all the names with the shortest basename; of those, it then takes all the shortest names; finally, it takes the first remaining name. .PP Additionally, if the leading garbage contains a .B Prereq:\& line, .B patch takes the first word from the prerequisites line (normally a version number) and checks the original file to see if that word can be found. If not, .B patch asks for confirmation before proceeding. .PP The upshot of all this is that you should be able to say, while in a news interface, something like the following: .Sp \fB| patch \-d /usr/src/local/blurfl\fP .Sp and patch a file in the .B blurfl directory directly from the article containing the patch. .PP If the patch file contains more than one patch, .B patch tries to apply each of them as if they came from separate patch files. This means, among other things, that it is assumed that the name of the file to patch must be determined for each diff listing, and that the garbage before each diff listing contains interesting things such as file names and revision level, as mentioned previously. .SH OPTIONS .TP 3 \fB\-b\fP or \fB\*=backup\fP Make backup files. That is, when patching a file, rename or copy the original instead of removing it. When backing up a file that does not exist, an empty, unreadable backup file is created as a placeholder to represent the nonexistent file. See the .B \-V or .B \*=version\-control option for details about how backup file names are determined. .TP .B \*=backup\-if\-mismatch Back up a file if the patch does not match the file exactly and if backups are not otherwise requested. This is the default unless the .B POSIXLY_CORRECT environment variable is set. .TP .B \*=no\-backup\-if\-mismatch Do not back up a file if the patch does not match the file exactly and if backups are not otherwise requested. This is the default if the .B POSIXLY_CORRECT environment variable is set. .TP \fB\-B\fP \fIpref\fP or \fB\*=prefix=\fP\fIpref\fP Prefix .I pref to a file name when generating its simple backup file name. For example, with .B "\-B\ /junk/" the simple backup file name for .B src/patch/util.c is .BR /junk/src/patch/util.c . .TP \fB\*=binary\fP Read and write all files in binary mode, except for standard output and .BR /dev/tty . This option has no effect on \s-1POSIX\s0-compliant systems. On systems like \s-1DOS\s0 where this option makes a difference, the patch should be generated by .BR "diff\ \-a\ \*=binary" . .TP \fB\-c\fP or \fB\*=context\fP Interpret the patch file as a ordinary context diff. .TP \fB\-d\fP \fIdir\fP or \fB\*=directory=\fP\fIdir\fP Change to the directory .I dir immediately, before doing anything else. .TP \fB\-D\fP \fIdefine\fP or \fB\*=ifdef=\fP\fIdefine\fP Use the .BR #ifdef " .\|.\|. " #endif construct to mark changes, with .I define as the differentiating symbol. .TP .B "\*=dry\-run" Print the results of applying the patches without actually changing any files. .TP \fB\-e\fP or \fB\*=ed\fP Interpret the patch file as an .B ed script. .TP \fB\-E\fP or \fB\*=remove\-empty\-files\fP Remove output files that are empty after the patches have been applied. Normally this option is unnecessary, since .B patch can examine the time stamps on the header to determine whether a file should exist after patching. However, if the input is not a context diff or if the .B POSIXLY_CORRECT environment variable is set, .B patch does not remove empty patched files unless this option is given. When .B patch removes a file, it also attempts to remove any empty ancestor directories. .TP \fB\-f\fP or \fB\*=force\fP Assume that the user knows exactly what he or she is doing, and do not ask any questions. Skip patches whose headers do not say which file is to be patched; patch files even though they have the wrong version for the .B Prereq:\& line in the patch; and assume that patches are not reversed even if they look like they are. This option does not suppress commentary; use .B \-s for that. .TP \fB\-F\fP \fInum\fP or \fB\*=fuzz=\fP\fInum\fP Set the maximum fuzz factor. This option only applies to diffs that have context, and causes .B patch to ignore up to that many lines in looking for places to install a hunk. 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 \fB\-g\fP \fInum\fP or \fB\*=get=\fP\fInum\fP This option controls .BR patch 's actions when a file is under \s-1RCS\s0 or \s-1SCCS\s0 control, and does not exist or is read-only and matches the default version. If .I num is positive, .B patch gets (or checks out) the file from the revision control system; if zero, .B patch ignores \s-1RCS\s0 and \s-1SCCS\s0 and does not get the file; and if negative, .B patch asks the user whether to get the file. The default value of this option is given by the value of the .B PATCH_GET environment variable if it is set; if not, the default value is zero if .B POSIXLY_CORRECT is set, negative otherwise. .TP .B "\*=help" Print a summary of options and exit. .TP \fB\-i\fP \fIpatchfile\fP or \fB\*=input=\fP\fIpatchfile\fP Read the patch from .IR patchfile . If .I patchfile is .BR \- , read from standard input, the default. .TP \fB\-l\fP or \fB\*=ignore\-whitespace\fP Match patterns loosely, in case tabs or spaces have been munged in your files. Any sequence of one or more blanks in the patch file matches any sequence in the original file, and sequences of blanks at the ends of lines are ignored. Normal characters must still match exactly. Each line of the context must still match a line in the original file. .TP \fB\-n\fP or \fB\*=normal\fP Interpret the patch file as a normal diff. .TP \fB\-N\fP or \fB\*=forward\fP Ignore patches that seem to be reversed or already applied. See also .BR \-R . .TP \fB\-o\fP \fIoutfile\fP or \fB\*=output=\fP\fIoutfile\fP Send output to .I outfile instead of patching files in place. .TP \fB\-p\fP\fInum\fP or \fB\*=strip\fP\fB=\fP\fInum\fP Strip the smallest prefix containing .I num leading slashes from each file name found in the patch file. A sequence of one or more adjacent slashes is counted as a single slash. This controls how file names found in the patch file are treated, in case you keep your files in a different directory than the person who sent out the patch. For example, supposing the file name in the patch file was .Sp \fB/u/howard/src/blurfl/blurfl.c\fP .Sp setting .B \-p0 gives the entire file name unmodified, .B \-p1 gives .Sp \fBu/howard/src/blurfl/blurfl.c\fP .Sp without the leading slash, .B \-p4 gives .Sp \fBblurfl/blurfl.c\fP .Sp and not specifying .B \-p at all just gives you \fBblurfl.c\fP. Whatever you end up with is looked for either in the current directory, or the directory specified by the .B \-d option. .TP \fB\-r\fP \fIrejectfile\fP or \fB\*=reject\-file=\fP\fIrejectfile\fP Put rejects into .I rejectfile instead of the default .B \&.rej file. .TP \fB\-R\fP or \fB\*=reverse\fP Assume that this patch was created with the old and new files swapped. (Yes, I'm afraid that does happen occasionally, human nature being what it is.) .B patch attempts to swap each hunk around before applying it. Rejects come out in the swapped format. The .B \-R option does not work with .B ed diff scripts because there is too little information to reconstruct the reverse operation. .Sp If the first hunk of a patch fails, .B patch reverses the hunk to see if it can be applied that way. If it can, you are asked if you want to have the .B \-R option set. If it can't, the patch continues to be applied normally. (Note: this method cannot detect a reversed patch if it is a normal diff and if the first command is an append (i.e. it should have been a delete) since appends always succeed, due to the fact that a null context matches anywhere. Luckily, most patches add or change lines rather than delete them, so most reversed normal diffs begin with a delete, which fails, triggering the heuristic.) .TP \fB\-s\fP or \fB\*=silent\fP or \fB\*=quiet\fP Work silently, unless an error occurs. .TP \fB\-t\fP or \fB\*=batch\fP Suppress questions like .BR \-f , but make some different assumptions: skip patches whose headers do not contain file names (the same as \fB\-f\fP); skip patches for which the file has the wrong version for the .B Prereq:\& line in the patch; and assume that patches are reversed if they look like they are. .TP \fB\-T\fP or \fB\*=set\-time\fP Set the modification and access times of patched files from time stamps given in context diff headers, assuming that the context diff headers use local time. This option is not recommended, because patches using local time cannot easily be used by people in other time zones, and because local time stamps are ambiguous when local clocks move backwards during daylight-saving time adjustments. Instead of using this option, generate patches with \s-1UTC\s0 and use the .B \-Z or .B \*=set\-utc option instead. .TP \fB\-u\fP or \fB\*=unified\fP Interpret the patch file as a unified context diff. .TP \fB\-v\fP or \fB\*=version\fP Print out .BR patch 's revision header and patch level, and exit. .TP \fB\-V\fP \fImethod\fP or \fB\*=version\-control=\fP\fImethod\fP