Un outil pour savoir si une commande est posix - retour accueil
git clone git://bebou.netlib.re/isposix
Log | Files | Refs | README |
patch.html (28326B)
1 <!-- Copyright 2001-2024 IEEE and The Open Group, All Rights Reserved --> 2 <!DOCTYPE HTML> 3 <html lang="en"> 4 <head> 5 <meta name="generator" content="HTML Tidy for HTML5 for Linux version 5.8.0"> 6 <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> 7 <link type="text/css" rel="stylesheet" href="style.css"><!-- Generated by The Open Group rhtm tool v1.2.4 --> 8 <!-- Copyright (c) 2001-2024 The Open Group, All Rights Reserved --> 9 <title>patch</title> 10 </head> 11 <body bgcolor="white"> 12 <div class="NAVHEADER"> 13 <table summary="Header navigation table" class="nav" width="100%" border="0" cellpadding="0" cellspacing="0"> 14 <tr class="nav"> 15 <td class="nav" width="15%" align="left" valign="bottom"><a href="../utilities/paste.html" accesskey="P"><<< 16 Previous</a></td> 17 <td class="nav" width="70%" align="center" valign="bottom"><a href="contents.html">Home</a></td> 18 <td class="nav" width="15%" align="right" valign="bottom"><a href="../utilities/pathchk.html" accesskey="N">Next 19 >>></a></td> 20 </tr> 21 </table> 22 <hr align="left" width="100%"></div> 23 <script language="JavaScript" src="../jscript/codes.js"></script><basefont size="3"> 24 <center><font size="2">The Open Group Base Specifications Issue 8<br> 25 IEEE Std 1003.1-2024<br> 26 Copyright © 2001-2024 The IEEE and The Open Group</font></center> 27 <hr size="2" noshade> 28 <a name="top" id="top"></a> <a name="patch" id="patch"></a> <a name="tag_20_92" id="tag_20_92"></a><!-- patch --> 29 <h4 class="mansect"><a name="tag_20_92_01" id="tag_20_92_01"></a>NAME</h4> 30 <blockquote>patch — apply changes to files</blockquote> 31 <h4 class="mansect"><a name="tag_20_92_02" id="tag_20_92_02"></a>SYNOPSIS</h4> 32 <blockquote class="synopsis"> 33 <p><code><tt>patch</tt> <b>[</b><tt>-blNR</tt><b>] [</b><tt>-c|-e|-n|-u</tt><b>] [</b><tt>-d</tt> <i>dir</i><b>] [</b><tt>-D</tt> 34 <i>define</i><b>] [</b><tt>-i</tt> <i>patchfile</i><b>]<br></b> <tt> </tt> <b>[</b><tt>-o</tt> 35 <i>outfile</i><b>] [</b><tt>-p</tt> <i>num</i><b>] [</b><tt>-r</tt> <i>rejectfile</i><b>] [</b><i>file</i><b>]</b></code></p> 36 </blockquote> 37 <h4 class="mansect"><a name="tag_20_92_03" id="tag_20_92_03"></a>DESCRIPTION</h4> 38 <blockquote> 39 <p>The <i>patch</i> utility shall read a source (patch) file containing any of four forms of difference (diff) listings produced by 40 the <a href="../utilities/diff.html"><i>diff</i></a> utility (normal, copied context, unified context, or in the style of <a href= 41 "../utilities/ed.html"><i>ed</i></a>) and apply those differences to a file. By default, <i>patch</i> shall read from the standard 42 input.</p> 43 <p>The <i>patch</i> utility shall attempt to determine the type of the <a href="../utilities/diff.html"><i>diff</i></a> listing, 44 unless overruled by a <b>-c</b>, <b>-e</b>, <b>-n</b>, or <b>-u</b> option.</p> 45 <p>If the patch file contains more than one patch, <i>patch</i> shall attempt to apply each of them as if they came from separate 46 patch files. (In this case, the application shall ensure that the name of the patch file is determinable for each <a href= 47 "../utilities/diff.html"><i>diff</i></a> listing.)</p> 48 </blockquote> 49 <h4 class="mansect"><a name="tag_20_92_04" id="tag_20_92_04"></a>OPTIONS</h4> 50 <blockquote> 51 <p>The <i>patch</i> utility shall conform to XBD <a href="../basedefs/V1_chap12.html#tag_12_02"><i>12.2 Utility Syntax 52 Guidelines</i></a> .</p> 53 <p>The following options shall be supported:</p> 54 <dl compact> 55 <dd></dd> 56 <dt><b>-b</b></dt> 57 <dd>Save a copy of the original contents of each modified file, before the differences are applied, in a file of the same name with 58 the suffix <b>.orig</b> appended to it. If the file already exists, it shall be overwritten; if multiple patches are applied to the 59 same file, the <b>.orig</b> file shall be written only for the first patch. When the <b>-o</b> <i>outfile</i> option is also 60 specified, <i>file</i><b>.orig</b> shall not be created but, if <i>outfile</i> already exists, <i>outfile</i><b>.orig</b> shall be 61 created.</dd> 62 <dt><b>-c</b></dt> 63 <dd>Interpret the patch file as a copied context difference (the output of the utility <a href= 64 "../utilities/diff.html"><i>diff</i></a> when the <b>-c</b> or <b>-C</b> options are specified).</dd> 65 <dt><b>-d </b><i>dir</i></dt> 66 <dd>Change the current directory to <i>dir</i> before processing as described in the EXTENDED DESCRIPTION section.</dd> 67 <dt><b>-D </b><i>define</i></dt> 68 <dd>Mark changes with one of the following C preprocessor constructs: 69 <pre> 70 <tt>#ifdef define 71 ... 72 #endif 73 <br> 74 #ifndef define 75 ... 76 #endif 77 </tt></pre> 78 <p>optionally combined with the C preprocessor construct <b>#else</b>. If the patched file is processed with the C preprocessor, 79 where the macro <i>define</i> is defined, the output shall contain the changes from the patch file; otherwise, the output shall not 80 contain the patches specified in the patch file.</p> 81 </dd> 82 <dt><b>-e</b></dt> 83 <dd>Interpret the patch file as an <a href="../utilities/ed.html"><i>ed</i></a> script, rather than a <a href= 84 "../utilities/diff.html"><i>diff</i></a> script.</dd> 85 <dt><b>-i </b><i>patchfile</i></dt> 86 <dd>Read the patch information from the file named by the pathname <i>patchfile</i>, rather than the standard input.</dd> 87 <dt><b>-l</b></dt> 88 <dd>(The letter ell.) Cause any sequence of <blank> characters in the difference script to match any sequence of 89 <blank> characters in the input file. Other characters shall be matched exactly.</dd> 90 <dt><b>-n</b></dt> 91 <dd>Interpret the script as a normal difference.</dd> 92 <dt><b>-N</b></dt> 93 <dd>Ignore patches where the differences have already been applied to the file; by default, already-applied patches shall be 94 rejected.</dd> 95 <dt><b>-o </b><i>outfile</i></dt> 96 <dd>Instead of modifying the files (specified by the <i>file</i> operand or the difference listings) directly, write a copy of the 97 file referenced by each patch, with the appropriate differences applied, to <i>outfile</i>. Multiple patches for a single file 98 shall be applied to the intermediate versions of the file created by any previous patches, and shall result in multiple, 99 concatenated versions of the file being written to <i>outfile</i>.</dd> 100 <dt><b>-p </b><i>num</i></dt> 101 <dd>For all pathnames in the patch file that indicate the names of files to be patched, delete <i>num</i> pathname components from 102 the beginning of each pathname. If the pathname in the patch file is absolute, any leading <slash> characters shall be 103 considered the first component (that is, <b>-p 1</b> shall remove the leading <slash> characters). Specifying 104 <b>-p 0</b> shall cause the full pathname to be used. If <b>-p</b> is not specified, only the basename (the final pathname 105 component) shall be used.</dd> 106 <dt><b>-R</b></dt> 107 <dd>Reverse the sense of the patch script; that is, assume that the difference script was created from the new version to the old 108 version. The <b>-R</b> option cannot be used with <a href="../utilities/ed.html"><i>ed</i></a> scripts. The <i>patch</i> utility 109 shall attempt to reverse each portion of the script before applying it. Rejected differences shall be saved in swapped format. If 110 this option is not specified, and until a portion of the patch file is successfully applied, <i>patch</i> attempts to apply each 111 portion in its reversed sense as well as in its normal sense. If the attempt is successful, the user shall be prompted to determine 112 whether the <b>-R</b> option should be set.</dd> 113 <dt><b>-r </b><i>rejectfile</i></dt> 114 <dd>Override the default reject filename. In the default case, the reject file shall have the same name as the output file, with 115 the suffix <b>.rej</b> appended to it; see <a href="#tag_20_92_13_03">Patch Application</a> .</dd> 116 <dt><b>-u</b></dt> 117 <dd>Interpret the patch file as a unified context difference (the output of the <a href="../utilities/diff.html"><i>diff</i></a> 118 utility when the <b>-u</b> or <b>-U</b> options are specified).</dd> 119 </dl> 120 </blockquote> 121 <h4 class="mansect"><a name="tag_20_92_05" id="tag_20_92_05"></a>OPERANDS</h4> 122 <blockquote> 123 <p>The following operand shall be supported:</p> 124 <dl compact> 125 <dd></dd> 126 <dt><i>file</i></dt> 127 <dd>A pathname of a file to patch.</dd> 128 </dl> 129 </blockquote> 130 <h4 class="mansect"><a name="tag_20_92_06" id="tag_20_92_06"></a>STDIN</h4> 131 <blockquote> 132 <p>See the INPUT FILES section.</p> 133 </blockquote> 134 <h4 class="mansect"><a name="tag_20_92_07" id="tag_20_92_07"></a>INPUT FILES</h4> 135 <blockquote> 136 <p>Input files shall be text files.</p> 137 </blockquote> 138 <h4 class="mansect"><a name="tag_20_92_08" id="tag_20_92_08"></a>ENVIRONMENT VARIABLES</h4> 139 <blockquote> 140 <p>The following environment variables shall affect the execution of <i>patch</i>:</p> 141 <dl compact> 142 <dd></dd> 143 <dt><i>LANG</i></dt> 144 <dd>Provide a default value for the internationalization variables that are unset or null. (See XBD <a href= 145 "../basedefs/V1_chap08.html#tag_08_02"><i>8.2 Internationalization Variables</i></a> the precedence of internationalization 146 variables used to determine the values of locale categories.)</dd> 147 <dt><i>LC_ALL</i></dt> 148 <dd>If set to a non-empty string value, override the values of all the other internationalization variables.</dd> 149 <dt><i>LC_COLLATE</i></dt> 150 <dd><br> 151 Determine the locale for the behavior of ranges, equivalence classes, and multi-character collating elements used in the extended 152 regular expression defined for the <b>yesexpr</b> locale keyword in the <i>LC_MESSAGES</i> category.</dd> 153 <dt><i>LC_CTYPE</i></dt> 154 <dd>Determine the locale for the interpretation of sequences of bytes of text data as characters (for example, single-byte as 155 opposed to multi-byte characters in arguments and input files), and the behavior of character classes used in the extended regular 156 expression defined for the <b>yesexpr</b> locale keyword in the <i>LC_MESSAGES</i> category.</dd> 157 <dt><i>LC_MESSAGES</i></dt> 158 <dd><br> 159 Determine the locale used to process affirmative responses, and the locale used to affect the format and contents of diagnostic 160 messages and prompts written to standard error.</dd> 161 <dt><i>NLSPATH</i></dt> 162 <dd><sup>[<a href="javascript:open_code('XSI')">XSI</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0"> 163 Determine the location of messages objects and message catalogs. <img src="../images/opt-end.gif" alt="[Option End]" border= 164 "0"></dd> 165 <dt><i>LC_TIME</i></dt> 166 <dd>Determine the locale for recognizing the format of file timestamps written by the <a href= 167 "../utilities/diff.html"><i>diff</i></a> utility in a context-difference input file.</dd> 168 </dl> 169 </blockquote> 170 <h4 class="mansect"><a name="tag_20_92_09" id="tag_20_92_09"></a>ASYNCHRONOUS EVENTS</h4> 171 <blockquote> 172 <p>Default.</p> 173 </blockquote> 174 <h4 class="mansect"><a name="tag_20_92_10" id="tag_20_92_10"></a>STDOUT</h4> 175 <blockquote> 176 <p>Not used.</p> 177 </blockquote> 178 <h4 class="mansect"><a name="tag_20_92_11" id="tag_20_92_11"></a>STDERR</h4> 179 <blockquote> 180 <p>The standard error shall be used for diagnostic and informational messages.</p> 181 </blockquote> 182 <h4 class="mansect"><a name="tag_20_92_12" id="tag_20_92_12"></a>OUTPUT FILES</h4> 183 <blockquote> 184 <p>The output of the <i>patch</i> utility, the save files (<b>.orig</b> suffixes), and the reject files (<b>.rej</b> suffixes) 185 shall be text files.</p> 186 </blockquote> 187 <h4 class="mansect"><a name="tag_20_92_13" id="tag_20_92_13"></a>EXTENDED DESCRIPTION</h4> 188 <blockquote> 189 <p>A patch file may contain patching instructions for more than one file; filenames shall be determined as specified in <a href= 190 "#tag_20_92_13_02">Filename Determination</a> . When the <b>-b</b> option is specified, for each patched file, the original shall 191 be saved in a file of the same name with the suffix <b>.orig</b> appended to it.</p> 192 <p>For each patched file, a reject file may also be created as noted in <a href="#tag_20_92_13_03">Patch Application</a> . In the 193 absence of a <b>-r</b> option, the name of this file shall be formed by appending the suffix <b>.rej</b> to the original 194 filename.</p> 195 <h5><a name="tag_20_92_13_01" id="tag_20_92_13_01"></a>Patch File Format</h5> 196 <p>The patch file shall contain zero or more lines of header information followed by one or more patches. Each patch shall contain 197 zero or more lines of filename identification in the format produced by the <b>-c</b>, <b>-C</b>, <b>-u</b>, or <b>-U</b> options 198 of the <a href="../utilities/diff.html"><i>diff</i></a> utility, and one or more sets of <a href= 199 "../utilities/diff.html"><i>diff</i></a> output, which are customarily called <i>hunks</i>.</p> 200 <p>The <i>patch</i> utility shall recognize the following expression in the header information:</p> 201 <dl compact> 202 <dd></dd> 203 <dt><b>Index: </b><i>pathname</i></dt> 204 <dd><br> 205 The file to be patched is named <i>pathname</i>.</dd> 206 </dl> 207 <p>If all lines (including headers) within a patch begin with the same leading sequence of <blank> characters, the 208 <i>patch</i> utility shall remove this sequence before proceeding. Within each patch, if the type of difference is common context, 209 the <i>patch</i> utility shall recognize the following expressions:</p> 210 <dl compact> 211 <dd></dd> 212 <dt>*** <i>filename timestamp</i></dt> 213 <dd><br> 214 The patches arose from <i>filename</i>.</dd> 215 <dt>--- <i>filename timestamp</i></dt> 216 <dd><br> 217 The patches should be applied to <i>filename</i>.</dd> 218 </dl> 219 <p>If the type of difference is unified context, the <i>patch</i> utility shall recognize the following expressions:</p> 220 <dl compact> 221 <dd></dd> 222 <dt>--- <i>filename timestamp</i></dt> 223 <dd><br> 224 The patches arose from <i>filename</i>.</dd> 225 <dt>+++ <i>filename timestamp</i></dt> 226 <dd><br> 227 The patches should be applied to <i>filename</i>.</dd> 228 </dl> 229 <p>Each hunk within a patch shall be the <a href="../utilities/diff.html"><i>diff</i></a> output to change a line range within the 230 original file. The line numbers for successive hunks within a patch shall occur in ascending order.</p> 231 <h5><a name="tag_20_92_13_02" id="tag_20_92_13_02"></a>Filename Determination</h5> 232 <p>If no <i>file</i> operand is specified, <i>patch</i> shall perform the following steps to determine the filename to use:</p> 233 <ol> 234 <li> 235 <p>If the type of <a href="../utilities/diff.html"><i>diff</i></a> is context, the <i>patch</i> utility shall delete pathname 236 components (as specified by the <b>-p</b> option) from the filename on the line beginning with <tt>"***"</tt> (if copied context) 237 or <tt>"---"</tt> (if unified context), then test for the existence of this file relative to the current directory (or the 238 directory specified with the <b>-d</b> option). If the file exists, the <i>patch</i> utility shall use this filename.</p> 239 </li> 240 <li> 241 <p>If the type of <a href="../utilities/diff.html"><i>diff</i></a> is context, the <i>patch</i> utility shall delete the pathname 242 components (as specified by the <b>-p</b> option) from the filename on the line beginning with <tt>"---"</tt> (if copied context) 243 or <tt>"+++"</tt> (if unified context), then test for the existence of this file relative to the current directory (or the 244 directory specified with the <b>-d</b> option). If the file exists, the <i>patch</i> utility shall use this filename.</p> 245 </li> 246 <li> 247 <p>If the header information contains a line beginning with the string <b>Index:</b>, the <i>patch</i> utility shall delete 248 pathname components (as specified by the <b>-p</b> option) from this line, then test for the existence of this file relative to the 249 current directory (or the directory specified with the <b>-d</b> option). If the file exists, the <i>patch</i> utility shall use 250 this filename.</p> 251 </li> 252 <li> 253 <p><sup>[<a href="javascript:open_code('XSI')">XSI</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0"> 254 If an <b>SCCS</b> directory exists in the current directory, <i>patch</i> shall attempt to perform a <a href= 255 "../utilities/get.html"><i>get</i></a> <b>-e</b> <b>SCCS/s.</b><i>filename</i> command to retrieve an editable version of the file. 256 If the file exists, the <i>patch</i> utility shall use this filename. <img src="../images/opt-end.gif" alt="[Option End]" border= 257 "0"></p> 258 </li> 259 <li> 260 <p>The <i>patch</i> utility shall write a prompt to standard output and request a filename interactively from the controlling 261 terminal (for example, <b>/dev/tty</b>).</p> 262 </li> 263 </ol> 264 <h5><a name="tag_20_92_13_03" id="tag_20_92_13_03"></a>Patch Application</h5> 265 <p>If the <b>-c</b>, <b>-e</b>, <b>-n</b>, or <b>-u</b> option is present, the <i>patch</i> utility shall interpret information 266 within each hunk as a copied context difference, an <a href="../utilities/ed.html"><i>ed</i></a> difference, a normal difference, 267 or a unified context difference, respectively. In the absence of any of these options, the <i>patch</i> utility shall determine the 268 type of difference based on the format of information within the hunk.</p> 269 <p>For each hunk, the <i>patch</i> utility shall begin to search for the place to apply the patch at the line number at the 270 beginning of the hunk, plus or minus any offset used in applying the previous hunk. If lines matching the hunk context are not 271 found, <i>patch</i> shall scan both forwards and backwards at least 1000 bytes for a set of lines that match the hunk context.</p> 272 <p>If no such place is found and it is a context difference, then another scan shall take place, ignoring the first and last line 273 of context. If that fails, the first two and last two lines of context shall be ignored and another scan shall be made. 274 Implementations may search more extensively for installation locations.</p> 275 <p>If no location can be found, the <i>patch</i> utility shall append the hunk to the reject file. A rejected hunk that is a copied 276 context difference, an <a href="../utilities/ed.html"><i>ed</i></a> difference, or a normal difference shall be written in 277 copied-context-difference format regardless of the format of the patch file. It is implementation-defined whether a rejected hunk 278 that is a unified context difference is written in copied-context-difference format or in unified-context-difference format. If the 279 input was a normal or <a href="../utilities/ed.html"><i>ed</i></a>-style difference, the reject file may contain differences with 280 zero lines of context. The line numbers on the hunks in the reject file may be different from the line numbers in the patch file 281 since they shall reflect the approximate locations for the failed hunks in the new file rather than the old one.</p> 282 <p>If the type of patch is an <a href="../utilities/ed.html"><i>ed</i></a> diff, the implementation may accomplish the patching by 283 invoking the <a href="../utilities/ed.html"><i>ed</i></a> utility.</p> 284 </blockquote> 285 <h4 class="mansect"><a name="tag_20_92_14" id="tag_20_92_14"></a>EXIT STATUS</h4> 286 <blockquote> 287 <p>The following exit values shall be returned:</p> 288 <dl compact> 289 <dd></dd> 290 <dt> 0</dt> 291 <dd>Successful completion.</dd> 292 <dt> 1</dt> 293 <dd>One or more lines were written to a reject file.</dd> 294 <dt>>1</dt> 295 <dd>An error occurred.</dd> 296 </dl> 297 </blockquote> 298 <h4 class="mansect"><a name="tag_20_92_15" id="tag_20_92_15"></a>CONSEQUENCES OF ERRORS</h4> 299 <blockquote> 300 <p>Patches that cannot be correctly placed in the file shall be written to a reject file.</p> 301 </blockquote> 302 <hr> 303 <div class="box"><em>The following sections are informative.</em></div> 304 <h4 class="mansect"><a name="tag_20_92_16" id="tag_20_92_16"></a>APPLICATION USAGE</h4> 305 <blockquote> 306 <p>The <b>-R</b> option does not work with <a href="../utilities/ed.html"><i>ed</i></a> scripts because there is too little 307 information to reconstruct the reverse operation.</p> 308 <p>The <b>-p</b> option makes it possible to customize a patch file to local user directory structures without manually editing the 309 patch file. For example, if the filename in the patch file was:</p> 310 <pre> 311 <tt>/curds/whey/src/blurfl/blurfl.c 312 </tt></pre> 313 <p>Setting <b>-p 0</b> gives the entire pathname unmodified; <b>-p 1</b> gives:</p> 314 <pre> 315 <tt>curds/whey/src/blurfl/blurfl.c 316 </tt></pre> 317 <p>without the leading <slash>, <b>-p 4</b> gives:</p> 318 <pre> 319 <tt>blurfl/blurfl.c 320 </tt></pre> 321 <p>and not specifying <b>-p</b> at all gives:</p> 322 <pre> 323 <tt>blurfl.c . 324 </tt></pre></blockquote> 325 <h4 class="mansect"><a name="tag_20_92_17" id="tag_20_92_17"></a>EXAMPLES</h4> 326 <blockquote> 327 <p>None.</p> 328 </blockquote> 329 <h4 class="mansect"><a name="tag_20_92_18" id="tag_20_92_18"></a>RATIONALE</h4> 330 <blockquote> 331 <p>Some of the functionality in historical <i>patch</i> implementations was not specified. The following documents those features 332 present in historical implementations that have not been specified.</p> 333 <p>A deleted piece of functionality was the <tt>'+'</tt> pseudo-option allowing an additional set of options and a patch file 334 operand to be given. This was seen as being insufficiently useful to standardize.</p> 335 <p>In historical implementations, if the string <tt>"Prereq:"</tt> appeared in the header, the <i>patch</i> utility would search 336 for the corresponding version information (the string specified in the header, delimited by <blank> characters or the 337 beginning or end of a line or the file) anywhere in the original file. This was deleted as too simplistic and insufficiently 338 trustworthy a mechanism to standardize. For example, if:</p> 339 <pre> 340 <tt>Prereq: 1.2 341 </tt></pre> 342 <p>were in the header, the presence of a delimited 1.2 anywhere in the file would satisfy the prerequisite.</p> 343 <p>The following options were dropped from historical implementations of <i>patch</i> as insufficiently useful to standardize:</p> 344 <dl compact> 345 <dd></dd> 346 <dt><b>-b</b></dt> 347 <dd>The <b>-b</b> option historically provided a method for changing the name extension of the backup file from the default 348 <b>.orig</b>. This option has been modified and retained in this volume of POSIX.1-2024.</dd> 349 <dt><b>-F</b></dt> 350 <dd>The <b>-F</b> option specified the number of lines of a context diff to ignore when searching for a place to install a 351 patch.</dd> 352 <dt><b>-f</b></dt> 353 <dd>The <b>-f</b> option historically caused <i>patch</i> not to request additional information from the user.</dd> 354 <dt><b>-r</b></dt> 355 <dd>The <b>-r</b> option historically provided a method of overriding the extension of the reject file from the default 356 <b>.rej</b>.</dd> 357 <dt><b>-s</b></dt> 358 <dd>The <b>-s</b> option historically caused <i>patch</i> to work silently unless an error occurred.</dd> 359 <dt><b>-x</b></dt> 360 <dd>The <b>-x</b> option historically set internal debugging flags.</dd> 361 </dl> 362 <p>In some file system implementations, the saving of a <b>.orig</b> file may produce unwanted results. In the case of 12, 13, or 363 14-character filenames (on file systems supporting 14-character maximum filenames), the <b>.orig</b> file overwrites the new file. 364 The reject file may also exceed this filename limit. It was suggested, due to some historical practice, that a <tilde> 365 (<tt>'~'</tt>) suffix be used instead of <b>.orig</b> and some other character instead of the <b>.rej</b> suffix. This was rejected 366 because it is not obvious to the user which file is which. The suffixes <b>.orig</b> and <b>.rej</b> are clearer and more 367 understandable.</p> 368 <p>The <b>-b</b> option has the opposite sense in some historical implementations—do not save the <b>.orig</b> file. The default 369 case here is not to save the files, making <i>patch</i> behave more consistently with the other standard utilities.</p> 370 <p>The <b>-w</b> option in early proposals was changed to <b>-l</b> to match historical practice.</p> 371 <p>The <b>-N</b> option was included because without it, a non-interactive application cannot reject previously applied patches. 372 For example, if a user is piping the output of <a href="../utilities/diff.html"><i>diff</i></a> into the <i>patch</i> utility, and 373 the user only wants to patch a file to a newer version non-interactively, the <b>-N</b> option is required.</p> 374 <p>Changes to the <b>-l</b> option description were proposed to allow matching across <newline> characters in addition to 375 just <blank> characters. Since this is not historical practice, and since some ambiguities could result, it is suggested that 376 future developments in this area utilize another option letter, such as <b>-L</b>.</p> 377 <p>The <b>-u</b> option of GNU <i>patch</i> has been added, along with support for unified context formats.</p> 378 </blockquote> 379 <h4 class="mansect"><a name="tag_20_92_19" id="tag_20_92_19"></a>FUTURE DIRECTIONS</h4> 380 <blockquote> 381 <p>If this utility is directed to create a new directory entry that contains any bytes that have the encoded value of a 382 <newline> character, implementations are encouraged to treat this as an error. A future version of this standard may require 383 implementations to treat this as an error.</p> 384 </blockquote> 385 <h4 class="mansect"><a name="tag_20_92_20" id="tag_20_92_20"></a>SEE ALSO</h4> 386 <blockquote> 387 <p><a href="../utilities/diff.html#"><i>diff</i></a> , <a href="../utilities/ed.html#"><i>ed</i></a></p> 388 <p>XBD <a href="../basedefs/V1_chap08.html#tag_08"><i>8. Environment Variables</i></a> , <a href= 389 "../basedefs/V1_chap12.html#tag_12_02"><i>12.2 Utility Syntax Guidelines</i></a></p> 390 </blockquote> 391 <h4 class="mansect"><a name="tag_20_92_21" id="tag_20_92_21"></a>CHANGE HISTORY</h4> 392 <blockquote> 393 <p>First released in Issue 4.</p> 394 </blockquote> 395 <h4 class="mansect"><a name="tag_20_92_22" id="tag_20_92_22"></a>Issue 5</h4> 396 <blockquote> 397 <p>The FUTURE DIRECTIONS section is added.</p> 398 </blockquote> 399 <h4 class="mansect"><a name="tag_20_92_23" id="tag_20_92_23"></a>Issue 6</h4> 400 <blockquote> 401 <p>This utility is marked as part of the User Portability Utilities option.</p> 402 <p>The description of the <b>-D</b> option and the steps in <a href="#tag_20_92_13_02">Filename Determination</a> are changed to 403 match historical practice as defined in the IEEE P1003.2b draft standard.</p> 404 <p>The normative text is reworded to avoid use of the term "must" for application requirements.</p> 405 <p>IEEE Std 1003.1-2001/Cor 1-2002, item XCU/TC1/D6/34 is applied, clarifying the way that the <i>patch</i> utility 406 performs <b>ifdef</b> selection for the <b>-D</b> option.</p> 407 </blockquote> 408 <h4 class="mansect"><a name="tag_20_92_24" id="tag_20_92_24"></a>Issue 7</h4> 409 <blockquote> 410 <p>The <i>patch</i> utility is moved from the User Portability Utilities option to the Base. User Portability Utilities is now an 411 option for interactive utilities.</p> 412 <p>SD5-XCU-ERN-97 is applied, updating the SYNOPSIS.</p> 413 <p>SD5-XCU-ERN-103 and SD5-XCU-ERN-120 are applied, adding the <b>-u</b> option.</p> 414 <p>Austin Group Interpretation 1003.1-2001 #126 is applied, changing the description of the <i>LC_MESSAGES</i> and <i>LC_CTYPE</i> 415 environment variables and adding the <i>LC_COLLATE</i> environment variable.</p> 416 </blockquote> 417 <h4 class="mansect"><a name="tag_20_92_25" id="tag_20_92_25"></a>Issue 8</h4> 418 <blockquote> 419 <p>Austin Group Defect 251 is applied, encouraging implementations to disallow the creation of filenames containing any bytes that 420 have the encoded value of a <newline> character.</p> 421 <p>Austin Group Defect 1122 is applied, changing the description of <i>NLSPATH .</i></p> 422 </blockquote> 423 <div class="box"><em>End of informative text.</em></div> 424 <hr> 425 <p> </p> 426 <a href="#top"><span class="topOfPage">return to top of page</span></a><br> 427 <hr size="2" noshade> 428 <center><font size="2">UNIX® is a registered Trademark of The Open Group.<br> 429 POSIX™ is a Trademark of The IEEE.<br> 430 Copyright © 2001-2024 The IEEE and The Open Group, All Rights Reserved<br> 431 [ <a href="../mindex.html">Main Index</a> | <a href="../basedefs/contents.html">XBD</a> | <a href= 432 "../functions/contents.html">XSH</a> | <a href="../utilities/contents.html">XCU</a> | <a href="../xrat/contents.html">XRAT</a> 433 ]</font></center> 434 <hr size="2" noshade> 435 <div class="NAVHEADER"> 436 <table summary="Header navigation table" class="nav" width="100%" border="0" cellpadding="0" cellspacing="0"> 437 <tr class="nav"> 438 <td class="nav" width="15%" align="left" valign="bottom"><a href="../utilities/paste.html" accesskey="P"><<< 439 Previous</a></td> 440 <td class="nav" width="70%" align="center" valign="bottom"><a href="contents.html">Home</a></td> 441 <td class="nav" width="15%" align="right" valign="bottom"><a href="../utilities/pathchk.html" accesskey="N">Next 442 >>></a></td> 443 </tr> 444 </table> 445 <hr align="left" width="100%"></div> 446 </body> 447 </html>