fix linecount bug with comments spanning multiple lines
authorhenning <henning@openbsd.org>
Tue, 3 Aug 2010 18:42:40 +0000 (18:42 +0000)
committerhenning <henning@openbsd.org>
Tue, 3 Aug 2010 18:42:40 +0000 (18:42 +0000)
problem reported with the obvious fix for bgpd by Sebastian Benoit
<benoit-lists at fb12.de>, also PR 6432
applied to all the others by yours truly. ok theo
isn't it amazing how far this parser (and more) spread?

19 files changed:
sbin/iked/parse.y
sbin/ipsecctl/parse.y
sbin/pfctl/parse.y
usr.sbin/bgpd/parse.y
usr.sbin/btctl/parse.y
usr.sbin/btd/parse.y
usr.sbin/dvmrpd/parse.y
usr.sbin/hostapd/parse.y
usr.sbin/ifstated/parse.y
usr.sbin/ldapd/parse.y
usr.sbin/ldpd/parse.y
usr.sbin/ntpd/parse.y
usr.sbin/ospf6d/parse.y
usr.sbin/ospfd/parse.y
usr.sbin/relayd/parse.y
usr.sbin/ripd/parse.y
usr.sbin/smtpd/parse.y
usr.sbin/snmpd/parse.y
usr.sbin/ypldap/parse.y

index a5d9b7d..6f64fa0 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: parse.y,v 1.10 2010/07/22 17:16:45 jsg Exp $  */
+/*     $OpenBSD: parse.y,v 1.11 2010/08/03 18:42:40 henning Exp $      */
 /*     $vantronix: parse.y,v 1.22 2010/06/03 11:08:34 reyk Exp $       */
 
 /*
@@ -1128,9 +1128,10 @@ top:
                                        return (0);
                                if (next == quotec || c == ' ' || c == '\t')
                                        c = next;
-                               else if (next == '\n')
+                               else if (next == '\n') {
+                                       file->lineno++;
                                        continue;
-                               else
+                               else
                                        lungetc(next);
                        } else if (c == quotec) {
                                *p = '\0';
index 405323c..13e33fc 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: parse.y,v 1.147 2010/05/10 02:00:50 krw Exp $ */
+/*     $OpenBSD: parse.y,v 1.148 2010/08/03 18:42:40 henning Exp $     */
 
 /*
  * Copyright (c) 2002, 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -1132,9 +1132,10 @@ top:
                                        return (0);
                                if (next == quotec || c == ' ' || c == '\t')
                                        c = next;
-                               else if (next == '\n')
+                               else if (next == '\n') {
+                                       file->lineno++;
                                        continue;
-                               else
+                               else
                                        lungetc(next);
                        } else if (c == quotec) {
                                *p = '\0';
index 8dbdfde..19d7aa2 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: parse.y,v 1.590 2010/07/03 02:28:57 mcbride Exp $     */
+/*     $OpenBSD: parse.y,v 1.591 2010/08/03 18:42:40 henning Exp $     */
 
 /*
  * Copyright (c) 2001 Markus Friedl.  All rights reserved.
@@ -5309,9 +5309,10 @@ top:
                                        return (0);
                                if (next == quotec || c == ' ' || c == '\t')
                                        c = next;
-                               else if (next == '\n')
+                               else if (next == '\n') {
+                                       file->lineno++;
                                        continue;
-                               else
+                               else
                                        lungetc(next);
                        } else if (c == quotec) {
                                *p = '\0';
index 6ec94d8..04ed72e 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: parse.y,v 1.256 2010/06/27 19:53:34 claudio Exp $ */
+/*     $OpenBSD: parse.y,v 1.257 2010/08/03 18:42:40 henning Exp $ */
 
 /*
  * Copyright (c) 2002, 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -2364,9 +2364,10 @@ top:
                                        return (0);
                                if (next == quotec || c == ' ' || c == '\t')
                                        c = next;
-                               else if (next == '\n')
+                               else if (next == '\n') {
+                                       file->lineno++;
                                        continue;
-                               else
+                               else
                                        lungetc(next);
                        } else if (c == quotec) {
                                *p = '\0';
index 3158896..b84121b 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: parse.y,v 1.6 2009/03/31 21:03:48 tobias Exp $ */
+/*     $OpenBSD: parse.y,v 1.7 2010/08/03 18:42:40 henning Exp $ */
 
 /*
  * Copyright (c) 2008 Uwe Stuehler <uwe@openbsd.org>
@@ -395,9 +395,10 @@ yylex(void)
                                        return (0);
                                if (next == quotec || c == ' ' || c == '\t')
                                        c = next;
-                               else if (next == '\n')
+                               else if (next == '\n') {
+                                       file->lineno++;
                                        continue;
-                               else
+                               else
                                        lungetc(next);
                        } else if (c == quotec) {
                                *p = '\0';
index a4f3a2d..1cfda6a 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: parse.y,v 1.2 2008/11/25 17:13:53 uwe Exp $ */
+/*     $OpenBSD: parse.y,v 1.3 2010/08/03 18:42:40 henning Exp $ */
 
 /*
  * Copyright (c) 2008 Uwe Stuehler <uwe@openbsd.org>
@@ -367,9 +367,10 @@ yylex(void)
                                        return (0);
                                if (next == quotec || c == ' ' || c == '\t')
                                        c = next;
-                               else if (next == '\n')
+                               else if (next == '\n') {
+                                       file->lineno++;
                                        continue;
-                               else
+                               else
                                        lungetc(next);
                        } else if (c == quotec) {
                                *p = '\0';
index 69fa220..baf05e6 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: parse.y,v 1.20 2009/09/04 13:11:45 claudio Exp $ */
+/*     $OpenBSD: parse.y,v 1.21 2010/08/03 18:42:40 henning Exp $ */
 
 /*
  * Copyright (c) 2004, 2005, 2006 Esben Norby <norby@openbsd.org>
@@ -557,9 +557,10 @@ top:
                                        return (0);
                                if (next == quotec || c == ' ' || c == '\t')
                                        c = next;
-                               else if (next == '\n')
+                               else if (next == '\n') {
+                                       file->lineno++;
                                        continue;
-                               else
+                               else
                                        lungetc(next);
                        } else if (c == quotec) {
                                *p = '\0';
index ed1fcb6..85222f1 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: parse.y,v 1.42 2010/01/11 03:55:21 deraadt Exp $      */
+/*     $OpenBSD: parse.y,v 1.43 2010/08/03 18:42:40 henning Exp $      */
 
 /*
  * Copyright (c) 2004, 2005, 2006 Reyk Floeter <reyk@openbsd.org>
@@ -1476,9 +1476,10 @@ top:
                                        return (0);
                                if (next == quotec || c == ' ' || c == '\t')
                                        c = next;
-                               else if (next == '\n')
+                               else if (next == '\n') {
+                                       file->lineno++;
                                        continue;
-                               else
+                               else
                                        lungetc(next);
                        } else if (c == quotec) {
                                *p = '\0';
index e2070a3..24875a7 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: parse.y,v 1.29 2009/03/31 21:03:48 tobias Exp $       */
+/*     $OpenBSD: parse.y,v 1.30 2010/08/03 18:42:40 henning Exp $      */
 
 /*
  * Copyright (c) 2004 Ryan McBride <mcbride@openbsd.org>
@@ -556,9 +556,10 @@ top:
                                        return (0);
                                if (next == quotec || c == ' ' || c == '\t')
                                        c = next;
-                               else if (next == '\n')
+                               else if (next == '\n') {
+                                       file->lineno++;
                                        continue;
-                               else
+                               else
                                        lungetc(next);
                        } else if (c == quotec) {
                                *p = '\0';
index e198c19..abc0746 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: parse.y,v 1.8 2010/06/30 22:16:53 martinh Exp $ */
+/*     $OpenBSD: parse.y,v 1.9 2010/08/03 18:42:40 henning Exp $ */
 
 /*
  * Copyright (c) 2009, 2010 Martin Hedenfalk <martinh@openbsd.org>
@@ -609,9 +609,10 @@ top:
                                        return (0);
                                if (next == quotec || c == ' ' || c == '\t')
                                        c = next;
-                               else if (next == '\n')
+                               else if (next == '\n') {
+                                       file->lineno++;
                                        continue;
-                               else
+                               else
                                        lungetc(next);
                        } else if (c == quotec) {
                                *p = '\0';
index ed37192..52a3c06 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: parse.y,v 1.5 2010/06/21 19:41:44 claudio Exp $ */
+/*     $OpenBSD: parse.y,v 1.6 2010/08/03 18:42:40 henning Exp $ */
 
 /*
  * Copyright (c) 2004, 2005, 2008 Esben Norby <norby@openbsd.org>
@@ -521,9 +521,10 @@ top:
                                        return (0);
                                if (next == quotec || c == ' ' || c == '\t')
                                        c = next;
-                               else if (next == '\n')
+                               else if (next == '\n') {
+                                       file->lineno++;
                                        continue;
-                               else
+                               else
                                        lungetc(next);
                        } else if (c == quotec) {
                                *p = '\0';
index 35432d6..5751682 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: parse.y,v 1.46 2009/03/31 21:03:48 tobias Exp $ */
+/*     $OpenBSD: parse.y,v 1.47 2010/08/03 18:42:40 henning Exp $ */
 
 /*
  * Copyright (c) 2002, 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -468,9 +468,10 @@ yylex(void)
                                        return (0);
                                if (next == quotec || c == ' ' || c == '\t')
                                        c = next;
-                               else if (next == '\n')
+                               else if (next == '\n') {
+                                       file->lineno++;
                                        continue;
-                               else
+                               else
                                        lungetc(next);
                        } else if (c == quotec) {
                                *p = '\0';
index 656727d..ec85caf 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: parse.y,v 1.17 2010/07/01 19:47:04 bluhm Exp $ */
+/*     $OpenBSD: parse.y,v 1.18 2010/08/03 18:42:41 henning Exp $ */
 
 /*
  * Copyright (c) 2004, 2005 Esben Norby <norby@openbsd.org>
@@ -714,9 +714,10 @@ top:
                                        return (0);
                                if (next == quotec || c == ' ' || c == '\t')
                                        c = next;
-                               else if (next == '\n')
+                               else if (next == '\n') {
+                                       file->lineno++;
                                        continue;
-                               else
+                               else
                                        lungetc(next);
                        } else if (c == quotec) {
                                *p = '\0';
index e9bc7cd..01f91be 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: parse.y,v 1.71 2010/03/24 07:18:39 gollo Exp $ */
+/*     $OpenBSD: parse.y,v 1.72 2010/08/03 18:42:41 henning Exp $ */
 
 /*
  * Copyright (c) 2004, 2005 Esben Norby <norby@openbsd.org>
@@ -912,9 +912,10 @@ top:
                                        return (0);
                                if (next == quotec || c == ' ' || c == '\t')
                                        c = next;
-                               else if (next == '\n')
+                               else if (next == '\n') {
+                                       file->lineno++;
                                        continue;
-                               else
+                               else
                                        lungetc(next);
                        } else if (c == quotec) {
                                *p = '\0';
index edd24e2..3f23508 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: parse.y,v 1.144 2010/08/01 22:18:35 sthen Exp $       */
+/*     $OpenBSD: parse.y,v 1.145 2010/08/03 18:42:41 henning Exp $     */
 
 /*
  * Copyright (c) 2007, 2008 Reyk Floeter <reyk@openbsd.org>
@@ -1945,9 +1945,10 @@ top:
                                        return (0);
                                if (next == quotec || c == ' ' || c == '\t')
                                        c = next;
-                               else if (next == '\n')
+                               else if (next == '\n') {
+                                       file->lineno++;
                                        continue;
-                               else
+                               else
                                        lungetc(next);
                        } else if (c == quotec) {
                                *p = '\0';
index f60569c..8cb73ee 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: parse.y,v 1.27 2009/09/26 18:24:58 michele Exp $ */
+/*     $OpenBSD: parse.y,v 1.28 2010/08/03 18:42:41 henning Exp $ */
 
 /*
  * Copyright (c) 2006 Michele Marchetto <mydecay@openbeer.it>
@@ -581,9 +581,10 @@ top:
                                        return (0);
                                if (next == quotec || c == ' ' || c == '\t')
                                        c = next;
-                               else if (next == '\n')
+                               else if (next == '\n') {
+                                       file->lineno++;
                                        continue;
-                               else
+                               else
                                        lungetc(next);
                        } else if (c == quotec) {
                                *p = '\0';
index 1bdce82..8605a94 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: parse.y,v 1.63 2010/06/10 19:34:51 chl Exp $  */
+/*     $OpenBSD: parse.y,v 1.64 2010/08/03 18:42:41 henning Exp $      */
 
 /*
  * Copyright (c) 2008 Gilles Chehade <gilles@openbsd.org>
@@ -1237,9 +1237,10 @@ top:
                                        return (0);
                                if (next == quotec || c == ' ' || c == '\t')
                                        c = next;
-                               else if (next == '\n')
+                               else if (next == '\n') {
+                                       file->lineno++;
                                        continue;
-                               else
+                               else
                                        lungetc(next);
                        } else if (c == quotec) {
                                *p = '\0';
index a5fe7e2..109fdfc 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: parse.y,v 1.17 2009/03/31 21:03:49 tobias Exp $       */
+/*     $OpenBSD: parse.y,v 1.18 2010/08/03 18:42:41 henning Exp $      */
 
 /*
  * Copyright (c) 2007, 2008 Reyk Floeter <reyk@vantronix.net>
@@ -563,9 +563,10 @@ top:
                                        return (0);
                                if (next == quotec || c == ' ' || c == '\t')
                                        c = next;
-                               else if (next == '\n')
+                               else if (next == '\n') {
+                                       file->lineno++;
                                        continue;
-                               else
+                               else
                                        lungetc(next);
                        } else if (c == quotec) {
                                *p = '\0';
index 5264bf4..d70e821 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: parse.y,v 1.8 2009/03/31 21:03:49 tobias Exp $        */
+/*     $OpenBSD: parse.y,v 1.9 2010/08/03 18:42:41 henning Exp $       */
 
 /*
  * Copyright (c) 2008 Pierre-Yves Ritschard <pyr@openbsd.org>
@@ -538,9 +538,10 @@ top:
                                        return (0);
                                if (next == quotec || c == ' ' || c == '\t')
                                        c = next;
-                               else if (next == '\n')
+                               else if (next == '\n') {
+                                       file->lineno++;
                                        continue;
-                               else
+                               else
                                        lungetc(next);
                        } else if (c == quotec) {
                                *p = '\0';