summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--usr.bin/yacc/defs.h3
-rw-r--r--usr.bin/yacc/error.c11
-rw-r--r--usr.bin/yacc/main.c8
3 files changed, 15 insertions, 7 deletions
diff --git a/usr.bin/yacc/defs.h b/usr.bin/yacc/defs.h
index 8a4a4de99a5..9708a43c065 100644
--- a/usr.bin/yacc/defs.h
+++ b/usr.bin/yacc/defs.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: defs.h,v 1.10 2003/06/03 02:56:24 millert Exp $ */
+/* $OpenBSD: defs.h,v 1.11 2005/06/08 03:18:59 pvalchev Exp $ */
/* $NetBSD: defs.h,v 1.6 1996/03/19 03:21:30 jtc Exp $ */
/*
@@ -323,6 +323,7 @@ extern void done(int);
extern void no_space(void);
extern void open_error(char *);
+extern void open_write_error(char *);
extern void unexpected_EOF(void);
extern void print_pos(char *, char *);
extern void syntax_error(int, char *, char *);
diff --git a/usr.bin/yacc/error.c b/usr.bin/yacc/error.c
index 1892fc583a0..333017334a3 100644
--- a/usr.bin/yacc/error.c
+++ b/usr.bin/yacc/error.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: error.c,v 1.9 2003/06/19 16:34:53 pvalchev Exp $ */
+/* $OpenBSD: error.c,v 1.10 2005/06/08 03:18:59 pvalchev Exp $ */
/* $NetBSD: error.c,v 1.4 1996/03/19 03:21:32 jtc Exp $ */
/*
@@ -37,7 +37,7 @@
#if 0
static char sccsid[] = "@(#)error.c 5.3 (Berkeley) 6/1/90";
#else
-static char rcsid[] = "$OpenBSD: error.c,v 1.9 2003/06/19 16:34:53 pvalchev Exp $";
+static char rcsid[] = "$OpenBSD: error.c,v 1.10 2005/06/08 03:18:59 pvalchev Exp $";
#endif
#endif /* not lint */
@@ -69,6 +69,13 @@ open_error(char *filename)
done(2);
}
+void
+open_write_error(char *filename)
+{
+ fprintf(stderr, "%s: cannot open target file %s for writing\n",
+ input_file_name, filename);
+ done(2);
+}
void
unexpected_EOF(void)
diff --git a/usr.bin/yacc/main.c b/usr.bin/yacc/main.c
index 5dc48f002a9..b8ca6120bbd 100644
--- a/usr.bin/yacc/main.c
+++ b/usr.bin/yacc/main.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: main.c,v 1.19 2005/04/04 13:46:06 robert Exp $ */
+/* $OpenBSD: main.c,v 1.20 2005/06/08 03:18:59 pvalchev Exp $ */
/* $NetBSD: main.c,v 1.5 1996/03/19 03:21:38 jtc Exp $ */
/*
@@ -43,7 +43,7 @@ char copyright[] =
#if 0
static char sccsid[] = "@(#)main.c 5.5 (Berkeley) 5/24/93";
#else
-static char rcsid[] = "$OpenBSD: main.c,v 1.19 2005/04/04 13:46:06 robert Exp $";
+static char rcsid[] = "$OpenBSD: main.c,v 1.20 2005/06/08 03:18:59 pvalchev Exp $";
#endif
#endif /* not lint */
@@ -371,8 +371,8 @@ open_files(void)
if (dflag)
{
defines_file = fopen(defines_file_name, "w");
- if (defines_file == 0)
- open_error(defines_file_name);
+ if (defines_file == NULL)
+ open_write_error(defines_file_name);
fd = mkstemp(union_file_name);
if (fd == -1 || (union_file = fdopen(fd, "w")) == NULL)
open_error(union_file_name);