summaryrefslogtreecommitdiffstats
path: root/gnu
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>1994-02-25 21:46:07 +0000
committerphk <phk@FreeBSD.org>1994-02-25 21:46:07 +0000
commit17a5179b1d900d0ba0652135681713e8875596dd (patch)
treed004a80c02ffbe532db8d9ab87ba6ffcf99d8b43 /gnu
parentd9de9c1745c15f1661b06c747d6bb1dfb353e4b0 (diff)
downloadFreeBSD-src-17a5179b1d900d0ba0652135681713e8875596dd.zip
FreeBSD-src-17a5179b1d900d0ba0652135681713e8875596dd.tar.gz
added the -C/-check again.
Diffstat (limited to 'gnu')
-rw-r--r--gnu/usr.bin/patch/patch.19
-rw-r--r--gnu/usr.bin/patch/patch.c27
-rw-r--r--gnu/usr.bin/patch/pch.c7
3 files changed, 35 insertions, 8 deletions
diff --git a/gnu/usr.bin/patch/patch.1 b/gnu/usr.bin/patch/patch.1
index b5a9dba..6af062a 100644
--- a/gnu/usr.bin/patch/patch.1
+++ b/gnu/usr.bin/patch/patch.1
@@ -1,8 +1,12 @@
.\" -*- nroff -*-
.rn '' }`
-'\" $Header: /home/cvs/386BSD/src/gnu/usr.bin/patch/patch.1,v 1.2 1994/02/17 22:16:02 jkh Exp $
+'\" $Header: /home/cvs/386BSD/src/gnu/usr.bin/patch/patch.1,v 1.3 1994/02/17 22:20:33 jkh Exp $
'\"
'\" $Log: patch.1,v $
+.\" Revision 1.3 1994/02/17 22:20:33 jkh
+.\" Put this back - I was somehow under the erroneous impression that patch was in
+.\" ports, until I saw the the commit messages, that is! :-) All changed backed out.
+.\"
.\" Revision 1.2 1994/02/17 22:16:02 jkh
.\" From Poul-Henning Kamp - Implement a -C option to verify the integrity of
.\" a patch before actually applying it.
@@ -265,6 +269,9 @@ forces
.I patch
to interpret the patch file as a context diff.
.TP 5
+.B "\-C, \-\-check"
+see what would happen, but don't do it.
+.TP 5
.B "\-d dir, \-\-directory=dir"
causes
.I patch
diff --git a/gnu/usr.bin/patch/patch.c b/gnu/usr.bin/patch/patch.c
index 0335d66..626c453 100644
--- a/gnu/usr.bin/patch/patch.c
+++ b/gnu/usr.bin/patch/patch.c
@@ -1,5 +1,5 @@
char rcsid[] =
- "$Header: /home/cvs/386BSD/src/gnu/usr.bin/patch/patch.c,v 1.2 1994/02/17 22:16:03 jkh Exp $";
+ "$Header: /home/cvs/386BSD/src/gnu/usr.bin/patch/patch.c,v 1.3 1994/02/17 22:20:34 jkh Exp $";
/* patch - a program to apply diffs to original files
*
@@ -9,6 +9,10 @@ char rcsid[] =
* money off of it, or pretend that you wrote it.
*
* $Log: patch.c,v $
+ * Revision 1.3 1994/02/17 22:20:34 jkh
+ * Put this back - I was somehow under the erroneous impression that patch was in
+ * ports, until I saw the the commit messages, that is! :-) All changed backed out.
+ *
* Revision 1.2 1994/02/17 22:16:03 jkh
* From Poul-Henning Kamp - Implement a -C option to verify the integrity of
* a patch before actually applying it.
@@ -130,6 +134,9 @@ static int remove_empty_files = FALSE;
/* TRUE if -R was specified on command line. */
static int reverse_flag_specified = FALSE;
+/* TRUE if -C was specified on command line. */
+static int check_patch = FALSE;
+
/* Apply a set of diffs as appropriate. */
int
@@ -359,7 +366,9 @@ char **argv;
struct stat statbuf;
char *realout = outname;
- if (move_file(TMPOUTNAME, outname) < 0) {
+ if (check_patch) {
+ ;
+ } else if (move_file(TMPOUTNAME, outname) < 0) {
toutkeep = TRUE;
realout = TMPOUTNAME;
chmod(TMPOUTNAME, filemode);
@@ -390,7 +399,9 @@ char **argv;
say4("%d out of %d hunks failed--saving rejects to %s\n",
failed, hunk, rejname);
}
- if (move_file(TMPREJNAME, rejname) < 0)
+ if (check_patch) {
+ ;
+ } else if (move_file(TMPREJNAME, rejname) < 0)
trejkeep = TRUE;
}
set_signals(1);
@@ -438,11 +449,12 @@ reinitialize_almost_everything()
fatal1("you may not change to a different patch file\n");
}
-static char *shortopts = "-b:B:cd:D:eEfF:lnNo:p::r:RsStuvV:x:";
+static char *shortopts = "-b:B:cCd:D:eEfF:lnNo:p::r:RsStuvV:x:";
static struct option longopts[] =
{
{"suffix", 1, NULL, 'b'},
{"prefix", 1, NULL, 'B'},
+ {"check", 0, NULL, 'C'},
{"context", 0, NULL, 'c'},
{"directory", 1, NULL, 'd'},
{"ifdef", 1, NULL, 'D'},
@@ -499,6 +511,9 @@ get_some_switches()
case 'c':
diff_type = CONTEXT_DIFF;
break;
+ case 'C':
+ check_patch = TRUE;
+ break;
case 'd':
if (chdir(optarg) < 0)
pfatal2("can't cd to %s", optarg);
@@ -579,9 +594,9 @@ Usage: %s [options] [origfile [patchfile]] [+ [options] [origfile]]...\n",
Argv[0]);
fprintf(stderr, "\
Options:\n\
- [-ceEflnNRsStuv] [-b backup-ext] [-B backup-prefix] [-d directory]\n\
+ [-cCeEflnNRsStuv] [-b backup-ext] [-B backup-prefix] [-d directory]\n\
[-D symbol] [-F max-fuzz] [-o out-file] [-p[strip-count]]\n\
- [-r rej-name] [-V {numbered,existing,simple}] [--context]\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\
[--ignore-whitespace] [--forward] [--reverse] [--output=out-file]\n");
diff --git a/gnu/usr.bin/patch/pch.c b/gnu/usr.bin/patch/pch.c
index 9b34496..0a844f2 100644
--- a/gnu/usr.bin/patch/pch.c
+++ b/gnu/usr.bin/patch/pch.c
@@ -1,6 +1,10 @@
-/* $Header: /home/cvs/386BSD/src/gnu/usr.bin/patch/pch.c,v 1.2 1994/02/17 22:16:05 jkh Exp $
+/* $Header: /home/cvs/386BSD/src/gnu/usr.bin/patch/pch.c,v 1.3 1994/02/17 22:20:36 jkh Exp $
*
* $Log: pch.c,v $
+ * Revision 1.3 1994/02/17 22:20:36 jkh
+ * Put this back - I was somehow under the erroneous impression that patch was in
+ * ports, until I saw the the commit messages, that is! :-) All changed backed out.
+ *
* Revision 1.2 1994/02/17 22:16:05 jkh
* From Poul-Henning Kamp - Implement a -C option to verify the integrity of
* a patch before actually applying it.
@@ -184,6 +188,7 @@ there_is_another_patch()
if (force || batch) {
say1("No file to patch. Skipping...\n");
filearg[0] = savestr(bestguess);
+ skip_rest_of_patch = TRUE;
return TRUE;
}
ask1("File to patch: ");
OpenPOWER on IntegriCloud