From de60b309dce4dd02d49e36af94c0dfc181601881 Mon Sep 17 00:00:00 2001 From: wiz Date: Fri, 25 Mar 2005 23:55:02 +0000 Subject: [PATCH] Sort options. Add -C to usage. --- usr.bin/patch/patch.1 | 102 +++++++++++++++++++++--------------------- usr.bin/patch/patch.c | 6 +-- 2 files changed, 54 insertions(+), 54 deletions(-) diff --git a/usr.bin/patch/patch.1 b/usr.bin/patch/patch.1 index 27c9cc1b5221..aa935b67bc73 100644 --- a/usr.bin/patch/patch.1 +++ b/usr.bin/patch/patch.1 @@ -1,4 +1,4 @@ -.\" $NetBSD: patch.1,v 1.11 2005/03/25 23:49:28 wiz Exp $ -*- nroff -*- +.\" $NetBSD: patch.1,v 1.12 2005/03/25 23:55:02 wiz Exp $ -*- nroff -*- .rn '' }` .de Sh .br @@ -212,19 +212,14 @@ patch file, however.) .I Patch recognizes the following switches: .TP 5 -.B \-b or \-\-suffix -causes the next argument to be interpreted as the backup extension, to be -used in place of \*(L".orig\*(R" or \*(L"~\*(R". -.TP 5 .B \-B or \-\-prefix causes the next argument to be interpreted as a prefix to the backup file name. If this argument is specified any argument from -b will be ignored. .TP 5 -.B \-c or \-\-context -forces -.I patch -to interpret the patch file as a context diff. +.B \-b or \-\-suffix +causes the next argument to be interpreted as the backup extension, to be +used in place of \*(L".orig\*(R" or \*(L"~\*(R". .TP 5 .B \-C or \-\-dry\-run causes @@ -232,11 +227,10 @@ causes to report what would be done, but not to actually modify any files or create any rejects. .TP 5 -.B \-d or \-\-directory -causes +.B \-c or \-\-context +forces .I patch -to interpret the next argument as a directory, and cd to it before doing -anything else. +to interpret the patch file as a context diff. .TP 5 .B \-D or \-\-ifdef causes @@ -247,16 +241,31 @@ Note that, unlike the C compiler, there must be a space between the .B \-D and the argument. .TP 5 -.B \-e or \-\-ed -forces +.B \-d or \-\-directory +causes .I patch -to interpret the patch file as an ed script. +to interpret the next argument as a directory, and cd to it before doing +anything else. .TP 5 .B \-E or \-\-remove-empty-files causes .I patch to remove output files that are empty after the patches have been applied. .TP 5 +.B \-e or \-\-ed +forces +.I patch +to interpret the patch file as an ed script. +.TP 5 +.B \-F\*[Lt]number\*[Gt] or \-\-fuzz \*[Lt]number\*[Gt] +sets the maximum fuzz factor. +This switch only applies to context diffs, and causes +.I 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 5 .B \-f or \-\-force forces .I patch @@ -273,24 +282,6 @@ for that. .B \-i \*[Lt]patchfile\*[Gt] or \-\-patchfile \*[Lt]patchfile\*[Gt] Read the patch to be applied from the specified file. .TP 5 -.B \-t or \-\-batch -similar to -.BR \-f , -in that it suppresses questions, but makes some different assumptions: -skip patches for which a file to patch can't be found (the same as \fB\-f\fP); -skip patches for which the file has the wrong version for the ``Prereq:'' line -in the patch; and assume that patches are reversed if they look like -they are. -.TP 5 -.B \-F\*[Lt]number\*[Gt] or \-\-fuzz \*[Lt]number\*[Gt] -sets the maximum fuzz factor. -This switch only applies to context diffs, and causes -.I 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 5 .B \-l or \-\-ignore-whitespace causes the pattern matching to be done loosely, in case the tabs and spaces have been munged in your input file. @@ -299,11 +290,6 @@ in the input file. Normal characters must still match exactly. Each line of the context must still match a line in the input file. .TP 5 -.B \-n or \-\-normal -forces -.I patch -to interpret the patch file as a normal diff. -.TP 5 .B \-N or \-\-forward causes .I patch @@ -311,6 +297,11 @@ to ignore patches that it thinks are reversed or already applied. See also .B \-R . .TP 5 +.B \-n or \-\-normal +forces +.I patch +to interpret the patch file as a normal diff. +.TP 5 .B \-o or \-\-output causes the next argument to be interpreted as the output file name. .TP 5 @@ -352,9 +343,6 @@ or the directory specified by the .B \-d switch. .TP 5 -.B \-r or \-\-reject-file -causes the next argument to be interpreted as the reject file name. -.TP 5 .B \-R or \-\-reverse tells .I patch @@ -384,10 +372,8 @@ Luckily, most patches add or change lines rather than delete them, so most reversed normal diffs will begin with a delete, which will fail, triggering the heuristic.) .TP 5 -.B \-s or \-\-quiet or \-\-silent -makes -.I patch -do its work silently, unless an error occurs. +.B \-r or \-\-reject-file +causes the next argument to be interpreted as the reject file name. .TP 5 .B \-S or \-\-skip causes @@ -400,16 +386,25 @@ Thus .sp will ignore the first and second of three patches. .TP 5 +.B \-s or \-\-quiet or \-\-silent +makes +.I patch +do its work silently, unless an error occurs. +.TP 5 +.B \-t or \-\-batch +similar to +.BR \-f , +in that it suppresses questions, but makes some different assumptions: +skip patches for which a file to patch can't be found (the same as \fB\-f\fP); +skip patches for which the file has the wrong version for the ``Prereq:'' line +in the patch; and assume that patches are reversed if they look like +they are. +.TP 5 .B \-u or \-\-unified forces .I patch to interpret the patch file as a unified context diff (a unidiff). .TP 5 -.B \-v or \-\-version -causes -.I patch -to print out its revision header and patch level. -.TP 5 .B \-V or \-\-version-control causes the next argument to be interpreted as a method for creating backup file names. @@ -443,6 +438,11 @@ This is the default. Always make simple backups. .RE .TP 5 +.B \-v or \-\-version +causes +.I patch +to print out its revision header and patch level. +.TP 5 .B \-x\*[Lt]number\*[Gt] or \-\-debug \*[Lt]number\*[Gt] sets internal debugging flags, and is of interest only to .I patch diff --git a/usr.bin/patch/patch.c b/usr.bin/patch/patch.c index e5be242443a4..283f3395e677 100644 --- a/usr.bin/patch/patch.c +++ b/usr.bin/patch/patch.c @@ -1,4 +1,4 @@ -/* $NetBSD: patch.c,v 1.23 2005/03/25 23:00:55 skd Exp $ */ +/* $NetBSD: patch.c,v 1.24 2005/03/25 23:55:02 wiz Exp $ */ /* patch - a program to apply diffs to original files * @@ -25,7 +25,7 @@ #include #ifndef lint -__RCSID("$NetBSD: patch.c,v 1.23 2005/03/25 23:00:55 skd Exp $"); +__RCSID("$NetBSD: patch.c,v 1.24 2005/03/25 23:55:02 wiz Exp $"); #endif /* not lint */ #include "INTERN.h" @@ -578,7 +578,7 @@ exclusive\n"); fprintf(stderr, "\ Usage: patch [options] [origfile [patchfile]] [+ [options] [origfile]]...\n\ Options:\n\ - [-ceEflnNRsStuv] [-b backup-ext] [-B backup-prefix] [-d directory]\n\ + [-CcEeflNnRSstuv] [-B backup-prefix] [-b backup-ext] [-d directory]\n\ [-D symbol] [-Fmax-fuzz] [-o out-file] [-p[strip-count]]\n\ [-r rej-name] [-V {numbered,existing,simple}]\n"); my_exit(1);