summaryrefslogtreecommitdiff
path: root/usr.bin/patch/inp.c
diff options
context:
space:
mode:
authorMarc Espie <espie@cvs.openbsd.org>1998-11-25 00:30:27 +0000
committerMarc Espie <espie@cvs.openbsd.org>1998-11-25 00:30:27 +0000
commitbb47551a102c5fe2b9a2f03e559fdaf09ffc655e (patch)
tree3b03e51b6d8b549ec45bca61e56368d4ac1a4e1d /usr.bin/patch/inp.c
parentaa25fbfecc7fb0b07bcae5390099b70d837006c1 (diff)
add -C
Diffstat (limited to 'usr.bin/patch/inp.c')
-rw-r--r--usr.bin/patch/inp.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/usr.bin/patch/inp.c b/usr.bin/patch/inp.c
index f5f43659dd3..bab3562943a 100644
--- a/usr.bin/patch/inp.c
+++ b/usr.bin/patch/inp.c
@@ -1,7 +1,7 @@
-/* $OpenBSD: inp.c,v 1.6 1997/09/22 05:45:26 millert Exp $ */
+/* $OpenBSD: inp.c,v 1.7 1998/11/25 00:30:25 espie Exp $ */
#ifndef lint
-static char rcsid[] = "$OpenBSD: inp.c,v 1.6 1997/09/22 05:45:26 millert Exp $";
+static char rcsid[] = "$OpenBSD: inp.c,v 1.7 1998/11/25 00:30:25 espie Exp $";
#endif /* not lint */
#include "EXTERN.h"
@@ -11,6 +11,8 @@ static char rcsid[] = "$OpenBSD: inp.c,v 1.6 1997/09/22 05:45:26 millert Exp $";
#include "INTERN.h"
#include "inp.h"
+extern bool check_only;
+
/* Input-file-with-indexable-lines abstract type */
static off_t i_size; /* size of the input file */
@@ -80,10 +82,18 @@ char *filename;
if (statfailed && ok_to_create_file) {
if (verbose)
say2("(Creating file %s...)\n",filename);
+ /* in check_patch case, we still display `Creating file' even
+ though we're not. The rule is that -C should be as similar
+ to normal patch behavior as possible
+ */
+ if (check_only)
+ return TRUE;
makedirs(filename, TRUE);
close(creat(filename, 0666));
statfailed = stat(filename, &filestat);
}
+ if (statfailed && check_only)
+ fatal2("%s not found, -C mode, can't probe further\n", filename);
/* For nonexistent or read-only files, look for RCS or SCCS versions. */
if (statfailed
/* No one can write to it. */