16.12.2012 Views

z/OS V1R9.0 UNIX System Services Command ... - Christian Grothoff

z/OS V1R9.0 UNIX System Services Command ... - Christian Grothoff

z/OS V1R9.0 UNIX System Services Command ... - Christian Grothoff

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

–r rejectfile<br />

Records rejects in the file rejectfile, instead of the default reject file name.<br />

Reject files are discussed later in this section.<br />

–s Tells patch to remain silent until an error occurs. Normally, patch writes<br />

information on the results of the patching process to standard error (stderr).<br />

–v Displays the version number of patch and then exits.<br />

If you do not specify either the –b or –B option, patch attempts to change the<br />

original file directly. If you do not specify –c, –e, or –n, patch looks at the format of<br />

the diff output and tries to determine which type of output the patch file contains.<br />

If you do not specify a file to be patched and the patchfile is not in context format,<br />

patch prompts you for the name of the file you want to patch.<br />

If the patchfile is in context format, patch tries to determine the filename on its own.<br />

The first two lines of a context patch file give the names of the old and new files<br />

that diff compared. If only one of the files exists, patch patches that file; if neither<br />

exists or both do, patch checks for a line starting with a string Index: before asking<br />

you for the name of the file to patch. If both files exist but one of them is empty, the<br />

empty file will automatically be patched.<br />

After patch has determined the file to patch, it checks for a source control system<br />

(SCCS) subdirectory in the current directory; if one exists, it tries to obtain an<br />

editable version of that file by performing the source code control system (SCCS)<br />

command get –e. If patch cannot determine the file to patch, it prompts you for the<br />

name of the file to use.<br />

With a context format patchfile, patch can recognize when line numbers given in<br />

the patchfile do not match line numbers in the file being patched. Thus, it can patch<br />

a file with line counts that do not match the old file that was used by diff. To do<br />

this, it takes these steps:<br />

1. For each section to be changed, patch starts with the line number found in the<br />

patch file, plus or minus any adjustment that must be made for the previous<br />

section.<br />

2. If the line at this location does not match the line in the patch file, patch scans<br />

forward and backward for a line that does match. If it finds a matching line,<br />

patch proceeds to make the required changes. patch also remembers the<br />

adjustment it had to make to find the matching line, and uses this adjustment in<br />

the next section to be changed.<br />

3. If patch cannot find a line matching the one in the patch file, it tries to find the<br />

line using the lines given as context. It ignores the first and last two lines of the<br />

context and goes searching again. If it finds a match this time, it makes the<br />

change and remembers the adjustment.<br />

4. If a search ignoring the first and last lines of the context fails, patch searches<br />

one more time, ignoring the first two and last two lines of the context. If it finds<br />

a match, it makes the changes and remembers the adjustment.<br />

5. If patch still cannot find a match, it writes the unmatching portion to the reject<br />

file. It then tries to process the next section of changes. Thus, the reject file<br />

contains the sections that patch is not able to change. Line numbers on<br />

sections in the reject file may be different than those in the patchfile, because<br />

patch adjusts them using the adjustment that patch calculated for preceding<br />

sections.<br />

patch<br />

Chapter 2. Shell command descriptions 471

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!