summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bin/chio/parse.y29
-rw-r--r--usr.sbin/bgpd/parse.y29
-rw-r--r--usr.sbin/dvmrpd/parse.y29
-rw-r--r--usr.sbin/hostapd/parse.y29
-rw-r--r--usr.sbin/ifstated/parse.y29
-rw-r--r--usr.sbin/ntpd/parse.y29
-rw-r--r--usr.sbin/ospf6d/parse.y29
-rw-r--r--usr.sbin/ospfd/parse.y29
-rw-r--r--usr.sbin/relayd/parse.y26
-rw-r--r--usr.sbin/ripd/parse.y29
10 files changed, 148 insertions, 139 deletions
diff --git a/bin/chio/parse.y b/bin/chio/parse.y
index b78e9f26906..7b14abb5ad1 100644
--- a/bin/chio/parse.y
+++ b/bin/chio/parse.y
@@ -1,4 +1,4 @@
-/* $OpenBSD: parse.y,v 1.11 2007/11/12 23:59:40 mpf Exp $ */
+/* $OpenBSD: parse.y,v 1.12 2008/02/26 10:09:58 mpf Exp $ */
/*
* Copyright (c) 2006 Bob Beck <beck@openbsd.org>
@@ -40,7 +40,7 @@ static struct file {
char *name;
int lineno;
int errors;
-} *file;
+} *file, *topfile;
struct file *pushfile(const char *);
int popfile(void);
int yyparse(void);
@@ -200,8 +200,9 @@ lgetc(int quotec)
if (quotec) {
if ((c = getc(file->stream)) == EOF) {
- yyerror("reached end of file while parsing quoted string");
- if (popfile() == EOF)
+ yyerror("reached end of file while parsing "
+ "quoted string");
+ if (file == topfile || popfile() == EOF)
return (EOF);
return (quotec);
}
@@ -219,7 +220,7 @@ lgetc(int quotec)
}
while (c == EOF) {
- if (popfile() == EOF)
+ if (file == topfile || popfile() == EOF)
return (EOF);
c = getc(file->stream);
}
@@ -404,16 +405,15 @@ popfile(void)
{
struct file *prev;
- if ((prev = TAILQ_PREV(file, files, entry)) != NULL) {
+ if ((prev = TAILQ_PREV(file, files, entry)) != NULL)
prev->errors += file->errors;
- TAILQ_REMOVE(&files, file, entry);
- fclose(file->stream);
- free(file->name);
- free(file);
- file = prev;
- return (0);
- }
- return (EOF);
+
+ TAILQ_REMOVE(&files, file, entry);
+ fclose(file->stream);
+ free(file->name);
+ free(file);
+ file = prev;
+ return (file ? 0 : EOF);
}
char *
@@ -444,6 +444,7 @@ parse_tapedev(const char *filename, const char *changer, int drive)
tapedev = NULL;
}
}
+ topfile = file;
guess:
/* if no device found, do the default of /dev/rstX */
diff --git a/usr.sbin/bgpd/parse.y b/usr.sbin/bgpd/parse.y
index a7f912e07f4..2c8c60e1604 100644
--- a/usr.sbin/bgpd/parse.y
+++ b/usr.sbin/bgpd/parse.y
@@ -1,4 +1,4 @@
-/* $OpenBSD: parse.y,v 1.214 2007/11/12 23:59:41 mpf Exp $ */
+/* $OpenBSD: parse.y,v 1.215 2008/02/26 10:09:58 mpf Exp $ */
/*
* Copyright (c) 2002, 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -47,7 +47,7 @@ static struct file {
char *name;
int lineno;
int errors;
-} *file;
+} *file, *topfile;
struct file *pushfile(const char *, int);
int popfile(void);
int check_file_secrecy(int, const char *);
@@ -1884,8 +1884,9 @@ lgetc(int quotec)
if (quotec) {
if ((c = getc(file->stream)) == EOF) {
- yyerror("reached end of file while parsing quoted string");
- if (popfile() == EOF)
+ yyerror("reached end of file while parsing "
+ "quoted string");
+ if (file == topfile || popfile() == EOF)
return (EOF);
return (quotec);
}
@@ -1903,7 +1904,7 @@ lgetc(int quotec)
}
while (c == EOF) {
- if (popfile() == EOF)
+ if (file == topfile || popfile() == EOF)
return (EOF);
c = getc(file->stream);
}
@@ -2145,16 +2146,15 @@ popfile(void)
{
struct file *prev;
- if ((prev = TAILQ_PREV(file, files, entry)) != NULL) {
+ if ((prev = TAILQ_PREV(file, files, entry)) != NULL)
prev->errors += file->errors;
- TAILQ_REMOVE(&files, file, entry);
- fclose(file->stream);
- free(file->name);
- free(file);
- file = prev;
- return (0);
- }
- return (EOF);
+
+ TAILQ_REMOVE(&files, file, entry);
+ fclose(file->stream);
+ free(file->name);
+ free(file);
+ file = prev;
+ return (file ? 0 : EOF);
}
int
@@ -2177,6 +2177,7 @@ parse_config(char *filename, struct bgpd_config *xconf,
free(conf);
return (-1);
}
+ topfile = file;
if ((mrtconf = calloc(1, sizeof(struct mrt_head))) == NULL)
fatal(NULL);
diff --git a/usr.sbin/dvmrpd/parse.y b/usr.sbin/dvmrpd/parse.y
index 9e8941ddf35..226e96f7170 100644
--- a/usr.sbin/dvmrpd/parse.y
+++ b/usr.sbin/dvmrpd/parse.y
@@ -1,4 +1,4 @@
-/* $OpenBSD: parse.y,v 1.13 2007/11/12 23:59:41 mpf Exp $ */
+/* $OpenBSD: parse.y,v 1.14 2008/02/26 10:09:58 mpf Exp $ */
/*
* Copyright (c) 2004, 2005, 2006 Esben Norby <norby@openbsd.org>
@@ -51,7 +51,7 @@ static struct file {
char *name;
int lineno;
int errors;
-} *file;
+} *file, *topfile;
struct file *pushfile(const char *, int);
int popfile(void);
int check_file_secrecy(int, const char *);
@@ -430,8 +430,9 @@ lgetc(int quotec)
if (quotec) {
if ((c = getc(file->stream)) == EOF) {
- yyerror("reached end of file while parsing quoted string");
- if (popfile() == EOF)
+ yyerror("reached end of file while parsing "
+ "quoted string");
+ if (file == topfile || popfile() == EOF)
return (EOF);
return (quotec);
}
@@ -449,7 +450,7 @@ lgetc(int quotec)
}
while (c == EOF) {
- if (popfile() == EOF)
+ if (file == topfile || popfile() == EOF)
return (EOF);
c = getc(file->stream);
}
@@ -690,16 +691,15 @@ popfile(void)
{
struct file *prev;
- if ((prev = TAILQ_PREV(file, files, entry)) != NULL) {
+ if ((prev = TAILQ_PREV(file, files, entry)) != NULL)
prev->errors += file->errors;
- TAILQ_REMOVE(&files, file, entry);
- fclose(file->stream);
- free(file->name);
- free(file);
- file = prev;
- return (0);
- }
- return (EOF);
+
+ TAILQ_REMOVE(&files, file, entry);
+ fclose(file->stream);
+ free(file->name);
+ free(file);
+ file = prev;
+ return (file ? 0 : EOF);
}
struct dvmrpd_conf *
@@ -713,6 +713,7 @@ parse_config(char *filename, int opts)
errx(1, "parse_config calloc");
return (NULL);
}
+ topfile = file;
defs = &globaldefs;
defs->probe_interval = DEFAULT_PROBE_INTERVAL;
diff --git a/usr.sbin/hostapd/parse.y b/usr.sbin/hostapd/parse.y
index 4f4103cd656..820917e4b3b 100644
--- a/usr.sbin/hostapd/parse.y
+++ b/usr.sbin/hostapd/parse.y
@@ -1,4 +1,4 @@
-/* $OpenBSD: parse.y,v 1.36 2007/11/12 23:59:41 mpf Exp $ */
+/* $OpenBSD: parse.y,v 1.37 2008/02/26 10:09:58 mpf Exp $ */
/*
* Copyright (c) 2004, 2005, 2006 Reyk Floeter <reyk@openbsd.org>
@@ -64,7 +64,7 @@ static struct file {
char *name;
int lineno;
int errors;
-} *file;
+} *file, *topfile;
struct file *pushfile(const char *, int);
int popfile(void);
int check_file_secrecy(int, const char *);
@@ -1351,8 +1351,9 @@ lgetc(int quotec)
if (quotec) {
if ((c = getc(file->stream)) == EOF) {
- yyerror("reached end of file while parsing quoted string");
- if (popfile() == EOF)
+ yyerror("reached end of file while parsing "
+ "quoted string");
+ if (file == topfile || popfile() == EOF)
return (EOF);
return (quotec);
}
@@ -1370,7 +1371,7 @@ lgetc(int quotec)
}
while (c == EOF) {
- if (popfile() == EOF)
+ if (file == topfile || popfile() == EOF)
return (EOF);
c = getc(file->stream);
}
@@ -1689,16 +1690,15 @@ popfile(void)
{
struct file *prev;
- if ((prev = TAILQ_PREV(file, files, entry)) != NULL) {
+ if ((prev = TAILQ_PREV(file, files, entry)) != NULL)
prev->errors += file->errors;
- TAILQ_REMOVE(&files, file, entry);
- fclose(file->stream);
- free(file->name);
- free(file);
- file = prev;
- return (0);
- }
- return (EOF);
+
+ TAILQ_REMOVE(&files, file, entry);
+ fclose(file->stream);
+ free(file->name);
+ free(file);
+ file = prev;
+ return (file ? 0 : EOF);
}
int
@@ -1739,6 +1739,7 @@ hostapd_parse_file(struct hostapd_config *cfg)
free(sym);
}
}
+ topfile = file;
return (errors ? EINVAL : ret);
}
diff --git a/usr.sbin/ifstated/parse.y b/usr.sbin/ifstated/parse.y
index e13e642d9c1..d3a882882e9 100644
--- a/usr.sbin/ifstated/parse.y
+++ b/usr.sbin/ifstated/parse.y
@@ -1,4 +1,4 @@
-/* $OpenBSD: parse.y,v 1.25 2007/11/12 23:59:41 mpf Exp $ */
+/* $OpenBSD: parse.y,v 1.26 2008/02/26 10:09:58 mpf Exp $ */
/*
* Copyright (c) 2004 Ryan McBride <mcbride@openbsd.org>
@@ -49,7 +49,7 @@ static struct file {
char *name;
int lineno;
int errors;
-} *file;
+} *file, *topfile;
struct file *pushfile(const char *, int);
int popfile(void);
int check_file_secrecy(int, const char *);
@@ -431,8 +431,9 @@ lgetc(int quotec)
if (quotec) {
if ((c = getc(file->stream)) == EOF) {
- yyerror("reached end of file while parsing quoted string");
- if (popfile() == EOF)
+ yyerror("reached end of file while parsing "
+ "quoted string");
+ if (file == topfile || popfile() == EOF)
return (EOF);
return (quotec);
}
@@ -450,7 +451,7 @@ lgetc(int quotec)
}
while (c == EOF) {
- if (popfile() == EOF)
+ if (file == topfile || popfile() == EOF)
return (EOF);
c = getc(file->stream);
}
@@ -691,16 +692,15 @@ popfile(void)
{
struct file *prev;
- if ((prev = TAILQ_PREV(file, files, entry)) != NULL) {
+ if ((prev = TAILQ_PREV(file, files, entry)) != NULL)
prev->errors += file->errors;
- TAILQ_REMOVE(&files, file, entry);
- fclose(file->stream);
- free(file->name);
- free(file);
- file = prev;
- return (0);
- }
- return (EOF);
+
+ TAILQ_REMOVE(&files, file, entry);
+ fclose(file->stream);
+ free(file->name);
+ free(file);
+ file = prev;
+ return (file ? 0 : EOF);
}
struct ifsd_config *
@@ -719,6 +719,7 @@ parse_config(char *filename, int opts)
free(conf);
return (NULL);
}
+ topfile = file;
TAILQ_INIT(&conf->states);
diff --git a/usr.sbin/ntpd/parse.y b/usr.sbin/ntpd/parse.y
index 082e0c3f7e4..ea9357a8b19 100644
--- a/usr.sbin/ntpd/parse.y
+++ b/usr.sbin/ntpd/parse.y
@@ -1,4 +1,4 @@
-/* $OpenBSD: parse.y,v 1.41 2007/11/12 23:59:41 mpf Exp $ */
+/* $OpenBSD: parse.y,v 1.42 2008/02/26 10:09:58 mpf Exp $ */
/*
* Copyright (c) 2002, 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -43,7 +43,7 @@ static struct file {
char *name;
int lineno;
int errors;
-} *file;
+} *file, *topfile;
struct file *pushfile(const char *);
int popfile(void);
int yyparse(void);
@@ -353,8 +353,9 @@ lgetc(int quotec)
if (quotec) {
if ((c = getc(file->stream)) == EOF) {
- yyerror("reached end of file while parsing quoted string");
- if (popfile() == EOF)
+ yyerror("reached end of file while parsing "
+ "quoted string");
+ if (file == topfile || popfile() == EOF)
return (EOF);
return (quotec);
}
@@ -372,7 +373,7 @@ lgetc(int quotec)
}
while (c == EOF) {
- if (popfile() == EOF)
+ if (file == topfile || popfile() == EOF)
return (EOF);
c = getc(file->stream);
}
@@ -560,16 +561,15 @@ popfile(void)
{
struct file *prev;
- if ((prev = TAILQ_PREV(file, files, entry)) != NULL) {
+ if ((prev = TAILQ_PREV(file, files, entry)) != NULL)
prev->errors += file->errors;
- TAILQ_REMOVE(&files, file, entry);
- fclose(file->stream);
- free(file->name);
- free(file);
- file = prev;
- return (0);
- }
- return (EOF);
+
+ TAILQ_REMOVE(&files, file, entry);
+ fclose(file->stream);
+ free(file->name);
+ free(file);
+ file = prev;
+ return (file ? 0 : EOF);
}
int
@@ -585,6 +585,7 @@ parse_config(const char *filename, struct ntpd_conf *xconf)
if ((file = pushfile(filename)) == NULL) {
return (-1);
}
+ topfile = file;
yyparse();
errors = file->errors;
diff --git a/usr.sbin/ospf6d/parse.y b/usr.sbin/ospf6d/parse.y
index 0bc09123b30..69163d8750a 100644
--- a/usr.sbin/ospf6d/parse.y
+++ b/usr.sbin/ospf6d/parse.y
@@ -1,4 +1,4 @@
-/* $OpenBSD: parse.y,v 1.12 2007/12/13 08:54:05 claudio Exp $ */
+/* $OpenBSD: parse.y,v 1.13 2008/02/26 10:09:58 mpf Exp $ */
/*
* Copyright (c) 2004, 2005 Esben Norby <norby@openbsd.org>
@@ -51,7 +51,7 @@ static struct file {
char *name;
int lineno;
int errors;
-} *file;
+} *file, *topfile;
struct file *pushfile(const char *, int);
int popfile(void);
int check_file_secrecy(int, const char *);
@@ -589,8 +589,9 @@ lgetc(int quotec)
if (quotec) {
if ((c = getc(file->stream)) == EOF) {
- yyerror("reached end of file while parsing quoted string");
- if (popfile() == EOF)
+ yyerror("reached end of file while parsing "
+ "quoted string");
+ if (file == topfile || popfile() == EOF)
return (EOF);
return (quotec);
}
@@ -608,7 +609,7 @@ lgetc(int quotec)
}
while (c == EOF) {
- if (popfile() == EOF)
+ if (file == topfile || popfile() == EOF)
return (EOF);
c = getc(file->stream);
}
@@ -849,16 +850,15 @@ popfile(void)
{
struct file *prev;
- if ((prev = TAILQ_PREV(file, files, entry)) != NULL) {
+ if ((prev = TAILQ_PREV(file, files, entry)) != NULL)
prev->errors += file->errors;
- TAILQ_REMOVE(&files, file, entry);
- fclose(file->stream);
- free(file->name);
- free(file);
- file = prev;
- return (0);
- }
- return (EOF);
+
+ TAILQ_REMOVE(&files, file, entry);
+ fclose(file->stream);
+ free(file->name);
+ free(file);
+ file = prev;
+ return (file ? 0 : EOF);
}
struct ospfd_conf *
@@ -889,6 +889,7 @@ parse_config(char *filename, int opts)
free(conf);
return (NULL);
}
+ topfile = file;
LIST_INIT(&conf->area_list);
LIST_INIT(&conf->cand_list);
diff --git a/usr.sbin/ospfd/parse.y b/usr.sbin/ospfd/parse.y
index bc2a9b463b9..d4e8f0fe247 100644
--- a/usr.sbin/ospfd/parse.y
+++ b/usr.sbin/ospfd/parse.y
@@ -1,4 +1,4 @@
-/* $OpenBSD: parse.y,v 1.60 2008/02/22 10:56:50 simon Exp $ */
+/* $OpenBSD: parse.y,v 1.61 2008/02/26 10:09:58 mpf Exp $ */
/*
* Copyright (c) 2004, 2005 Esben Norby <norby@openbsd.org>
@@ -49,7 +49,7 @@ static struct file {
char *name;
int lineno;
int errors;
-} *file;
+} *file, *topfile;
struct file *pushfile(const char *, int);
int popfile(void);
int check_file_secrecy(int, const char *);
@@ -717,8 +717,9 @@ lgetc(int quotec)
if (quotec) {
if ((c = getc(file->stream)) == EOF) {
- yyerror("reached end of file while parsing quoted string");
- if (popfile() == EOF)
+ yyerror("reached end of file while parsing "
+ "quoted string");
+ if (file == topfile || popfile() == EOF)
return (EOF);
return (quotec);
}
@@ -736,7 +737,7 @@ lgetc(int quotec)
}
while (c == EOF) {
- if (popfile() == EOF)
+ if (file == topfile || popfile() == EOF)
return (EOF);
c = getc(file->stream);
}
@@ -977,16 +978,15 @@ popfile(void)
{
struct file *prev;
- if ((prev = TAILQ_PREV(file, files, entry)) != NULL) {
+ if ((prev = TAILQ_PREV(file, files, entry)) != NULL)
prev->errors += file->errors;
- TAILQ_REMOVE(&files, file, entry);
- fclose(file->stream);
- free(file->name);
- free(file);
- file = prev;
- return (0);
- }
- return (EOF);
+
+ TAILQ_REMOVE(&files, file, entry);
+ fclose(file->stream);
+ free(file->name);
+ free(file);
+ file = prev;
+ return (file ? 0 : EOF);
}
struct ospfd_conf *
@@ -1018,6 +1018,7 @@ parse_config(char *filename, int opts)
free(conf);
return (NULL);
}
+ topfile = file;
LIST_INIT(&conf->area_list);
LIST_INIT(&conf->cand_list);
diff --git a/usr.sbin/relayd/parse.y b/usr.sbin/relayd/parse.y
index 63954efeb51..6e7f2020ec4 100644
--- a/usr.sbin/relayd/parse.y
+++ b/usr.sbin/relayd/parse.y
@@ -1,4 +1,4 @@
-/* $OpenBSD: parse.y,v 1.107 2008/02/13 11:32:59 reyk Exp $ */
+/* $OpenBSD: parse.y,v 1.108 2008/02/26 10:09:58 mpf Exp $ */
/*
* Copyright (c) 2007, 2008 Reyk Floeter <reyk@openbsd.org>
@@ -57,7 +57,7 @@ static struct file {
char *name;
int lineno;
int errors;
-} *file;
+} *file, *topfile;
struct file *pushfile(const char *, int);
int popfile(void);
int check_file_secrecy(int, const char *);
@@ -1400,7 +1400,7 @@ lgetc(int quotec)
if ((c = getc(file->stream)) == EOF) {
yyerror("reached end of file while parsing "
"quoted string");
- if (popfile() == EOF)
+ if (file == topfile || popfile() == EOF)
return (EOF);
return (quotec);
}
@@ -1418,7 +1418,7 @@ lgetc(int quotec)
}
while (c == EOF) {
- if (popfile() == EOF)
+ if (file == topfile || popfile() == EOF)
return (EOF);
c = getc(file->stream);
}
@@ -1659,16 +1659,15 @@ popfile(void)
{
struct file *prev;
- if ((prev = TAILQ_PREV(file, files, entry)) != NULL) {
+ if ((prev = TAILQ_PREV(file, files, entry)) != NULL)
prev->errors += file->errors;
- TAILQ_REMOVE(&files, file, entry);
- fclose(file->stream);
- free(file->name);
- free(file);
- file = prev;
- return (0);
- }
- return (EOF);
+
+ TAILQ_REMOVE(&files, file, entry);
+ fclose(file->stream);
+ free(file->name);
+ free(file);
+ file = prev;
+ return (file ? 0 : EOF);
}
struct relayd *
@@ -2069,6 +2068,7 @@ table_inherit(struct table *tb)
h->tablename = tb->conf.name;
TAILQ_INSERT_HEAD(&tb->hosts, h, entry);
}
+ topfile = file;
conf->sc_tablecount++;
TAILQ_INSERT_HEAD(conf->sc_tables, tb, entry);
diff --git a/usr.sbin/ripd/parse.y b/usr.sbin/ripd/parse.y
index 58416c55810..18ee46b1770 100644
--- a/usr.sbin/ripd/parse.y
+++ b/usr.sbin/ripd/parse.y
@@ -1,4 +1,4 @@
-/* $OpenBSD: parse.y,v 1.17 2007/11/12 23:59:41 mpf Exp $ */
+/* $OpenBSD: parse.y,v 1.18 2008/02/26 10:09:58 mpf Exp $ */
/*
* Copyright (c) 2006 Michele Marchetto <mydecay@openbeer.it>
@@ -50,7 +50,7 @@ static struct file {
char *name;
int lineno;
int errors;
-} *file;
+} *file, *topfile;
struct file *pushfile(const char *, int);
int popfile(void);
int yyparse(void);
@@ -436,8 +436,9 @@ lgetc(int quotec)
if (quotec) {
if ((c = getc(file->stream)) == EOF) {
- yyerror("reached end of file while parsing quoted string");
- if (popfile() == EOF)
+ yyerror("reached end of file while parsing "
+ "quoted string");
+ if (file == topfile || popfile() == EOF)
return (EOF);
return (quotec);
}
@@ -455,7 +456,7 @@ lgetc(int quotec)
}
while (c == EOF) {
- if (popfile() == EOF)
+ if (file == topfile || popfile() == EOF)
return (EOF);
c = getc(file->stream);
}
@@ -696,16 +697,15 @@ popfile(void)
{
struct file *prev;
- if ((prev = TAILQ_PREV(file, files, entry)) != NULL) {
+ if ((prev = TAILQ_PREV(file, files, entry)) != NULL)
prev->errors += file->errors;
- TAILQ_REMOVE(&files, file, entry);
- fclose(file->stream);
- free(file->name);
- free(file);
- file = prev;
- return (0);
- }
- return (EOF);
+
+ TAILQ_REMOVE(&files, file, entry);
+ fclose(file->stream);
+ free(file->name);
+ free(file);
+ file = prev;
+ return (file ? 0 : EOF);
}
struct ripd_conf *
@@ -754,6 +754,7 @@ parse_config(char *filename, int opts)
clear_config(conf);
return (NULL);
}
+ topfile = file;
return (conf);
}