Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/bin/sh explain the previous fix.



details:   https://anonhg.NetBSD.org/src/rev/bc86acbebe76
branches:  trunk
changeset: 792369:bc86acbebe76
user:      christos <christos%NetBSD.org@localhost>
date:      Wed Jan 01 16:55:28 2014 +0000

description:
explain the previous fix.

diffstat:

 bin/sh/parser.c |  13 ++++++++++---
 1 files changed, 10 insertions(+), 3 deletions(-)

diffs (34 lines):

diff -r 6dca72fcc8d8 -r bc86acbebe76 bin/sh/parser.c
--- a/bin/sh/parser.c   Wed Jan 01 16:27:10 2014 +0000
+++ b/bin/sh/parser.c   Wed Jan 01 16:55:28 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: parser.c,v 1.86 2013/12/31 22:53:57 christos Exp $     */
+/*     $NetBSD: parser.c,v 1.87 2014/01/01 16:55:28 christos Exp $     */
 
 /*-
  * Copyright (c) 1991, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)parser.c   8.7 (Berkeley) 5/16/95";
 #else
-__RCSID("$NetBSD: parser.c,v 1.86 2013/12/31 22:53:57 christos Exp $");
+__RCSID("$NetBSD: parser.c,v 1.87 2014/01/01 16:55:28 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -432,7 +432,14 @@
                cpp = &n1->ncase.cases;
                noalias = 1;
                checkkwd = 2, readtoken();
-               while(lasttoken != TESAC) {
+               /*
+                * This should be a do {} while loop as it was originally
+                * since POSIX mandates at least one case statement, but
+                * unfortunately both ksh and bash accept 'case x in esac'
+                * so configure scripts started taking advantage of this.
+                * so do we.
+                */
+               while (lasttoken != TESAC) {
                        *cpp = cp = (union node *)stalloc(sizeof (struct nclist));
                        if (lasttoken == TLP)
                                readtoken();



Home | Main Index | Thread Index | Old Index