summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--usr.bin/patch/common.h3
-rw-r--r--usr.bin/patch/inp.c9
-rw-r--r--usr.bin/patch/patch.c6
3 files changed, 12 insertions, 6 deletions
diff --git a/usr.bin/patch/common.h b/usr.bin/patch/common.h
index 00863b57b6e..0de1fc67a08 100644
--- a/usr.bin/patch/common.h
+++ b/usr.bin/patch/common.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: common.h,v 1.20 2003/07/28 19:15:34 deraadt Exp $ */
+/* $OpenBSD: common.h,v 1.21 2003/07/31 14:10:21 otto Exp $ */
#define DEBUGGING
@@ -72,6 +72,7 @@ extern int strippath;
extern bool canonicalize;
/* TRUE if -C was specified on command line. */
extern bool check_only;
+extern bool warn_on_invalid_line;
#define CONTEXT_DIFF 1
diff --git a/usr.bin/patch/inp.c b/usr.bin/patch/inp.c
index 9e81fd9b2be..77ad4b66cb3 100644
--- a/usr.bin/patch/inp.c
+++ b/usr.bin/patch/inp.c
@@ -1,7 +1,7 @@
-/* $OpenBSD: inp.c,v 1.20 2003/07/28 19:15:34 deraadt Exp $ */
+/* $OpenBSD: inp.c,v 1.21 2003/07/31 14:10:21 otto Exp $ */
#ifndef lint
-static const char rcsid[] = "$OpenBSD: inp.c,v 1.20 2003/07/28 19:15:34 deraadt Exp $";
+static const char rcsid[] = "$OpenBSD: inp.c,v 1.21 2003/07/31 14:10:21 otto Exp $";
#endif /* not lint */
#include <sys/types.h>
@@ -329,7 +329,10 @@ char *
ifetch(LINENUM line, int whichbuf)
{
if (line < 1 || line > input_lines) {
- say("No such line %ld in input file, ignoring\n", line);
+ if (warn_on_invalid_line) {
+ say("No such line %ld in input file, ignoring\n", line);
+ warn_on_invalid_line = FALSE;
+ }
return NULL;
}
if (using_plan_a)
diff --git a/usr.bin/patch/patch.c b/usr.bin/patch/patch.c
index b88036cb324..5415ad2acf1 100644
--- a/usr.bin/patch/patch.c
+++ b/usr.bin/patch/patch.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: patch.c,v 1.32 2003/07/30 16:45:44 millert Exp $ */
+/* $OpenBSD: patch.c,v 1.33 2003/07/31 14:10:21 otto Exp $ */
/*
* patch - a program to apply diffs to original files
@@ -27,7 +27,7 @@
*/
#ifndef lint
-static const char rcsid[] = "$OpenBSD: patch.c,v 1.32 2003/07/30 16:45:44 millert Exp $";
+static const char rcsid[] = "$OpenBSD: patch.c,v 1.33 2003/07/31 14:10:21 otto Exp $";
#endif /* not lint */
#include <sys/types.h>
@@ -68,6 +68,7 @@ char *TMPREJNAME;
char *TMPPATNAME;
bool toutkeep = FALSE;
bool trejkeep = FALSE;
+bool warn_on_invalid_line;
#ifdef DEBUGGING
int debug = 0;
@@ -210,6 +211,7 @@ main(int argc, char *argv[])
/* for each patch in patch file */
patch_seen = TRUE;
+ warn_on_invalid_line = TRUE;
if (outname == NULL)
outname = savestr(filearg[0]);