Source-Changes-HG archive

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

[src/trunk]: src/bin/sh Don't use quoteflag when deciding if the word after a...



details:   https://anonhg.NetBSD.org/src/rev/02628dfcde35
branches:  trunk
changeset: 838406:02628dfcde35
user:      kre <kre%NetBSD.org@localhost>
date:      Tue Jan 15 14:23:56 2019 +0000

description:
Don't use quoteflag when deciding if the word after an alias
should be looked up as a potential following alias - if the first
expands to a string that ends with a space (any space, quoted or
not) then the next word is to be treated as an alias candidate.
(POSIX was to specify only unquoted spaces, but is now going to
leave that unspecified, and the "any space" version turns out to
be more useful.

And besides, the quoteflag test didn't work properly, and would
have been very messy to fix ... if in a word (as if we have a
quoted space) it means that the word has been quoted, which meant
that quoted spaces were correctly detected, but it outside a word,
it just means that the previous word was quoted, so it would sometimes
reject alias lookup on the next word in cases where it is unquestioned
it should be done.

diffstat:

 bin/sh/input.c |  7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)

diffs (28 lines):

diff -r 52b9ff95732c -r 02628dfcde35 bin/sh/input.c
--- a/bin/sh/input.c    Tue Jan 15 14:17:49 2019 +0000
+++ b/bin/sh/input.c    Tue Jan 15 14:23:56 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: input.c,v 1.67 2019/01/09 11:09:16 kre Exp $   */
+/*     $NetBSD: input.c,v 1.68 2019/01/15 14:23:56 kre Exp $   */
 
 /*-
  * Copyright (c) 1991, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)input.c    8.3 (Berkeley) 6/9/95";
 #else
-__RCSID("$NetBSD: input.c,v 1.67 2019/01/09 11:09:16 kre Exp $");
+__RCSID("$NetBSD: input.c,v 1.68 2019/01/15 14:23:56 kre Exp $");
 #endif
 #endif /* not lint */
 
@@ -435,8 +435,7 @@
        if (sp->ap) {
                int alen;
 
-               if (!quoteflag &&
-                   (alen = strlen(sp->ap->val)) > 0 &&
+               if ((alen = strlen(sp->ap->val)) > 0 &&
                    (sp->ap->val[alen - 1] == ' ' ||
                     sp->ap->val[alen - 1] == '\t'))
                        checkkwd |= CHKALIAS;



Home | Main Index | Thread Index | Old Index