Source-Changes-HG archive

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

[src/trunk]: src/bin/sh Treat $((x)) as equivalent to $(($x)) - posix seems t...



details:   https://anonhg.NetBSD.org/src/rev/b050b83a366c
branches:  trunk
changeset: 579660:b050b83a366c
user:      dsl <dsl%NetBSD.org@localhost>
date:      Sun Mar 20 21:39:11 2005 +0000

description:
Treat $((x)) as equivalent to $(($x)) - posix seems to require this now.

diffstat:

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

diffs (43 lines):

diff -r da9bd4c6c6b9 -r b050b83a366c bin/sh/parser.c
--- a/bin/sh/parser.c   Sun Mar 20 21:38:17 2005 +0000
+++ b/bin/sh/parser.c   Sun Mar 20 21:39:11 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: parser.c,v 1.57 2004/06/27 10:27:57 dsl Exp $  */
+/*     $NetBSD: parser.c,v 1.58 2005/03/20 21:39:11 dsl 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.57 2004/06/27 10:27:57 dsl Exp $");
+__RCSID("$NetBSD: parser.c,v 1.58 2005/03/20 21:39:11 dsl Exp $");
 #endif
 #endif /* not lint */
 
@@ -974,9 +974,6 @@
                                        setprompt(0);
                                c = pgetc();
                                goto loop;              /* continue outer loop */
-                       case CWORD:
-                               USTPUTC(c, out);
-                               break;
                        case CCTL:
                                if (eofmark == NULL || ISDBLQUOTE())
                                        USTPUTC(CTLESC, out);
@@ -1067,6 +1064,14 @@
                                        USTPUTC(CTLQUOTEMARK, out);
                                }
                                break;
+                       case CWORD:
+                               if (!arinest || !is_name(c)) {
+                                       USTPUTC(c, out);
+                                       break;
+                               }
+                               /* Treat $((x)) as $(($x)) */
+                               pungetc();
+                               /* FALLTHROUGH */
                        case CVAR:      /* '$' */
                                PARSESUB();             /* parse substitution */
                                break;



Home | Main Index | Thread Index | Old Index