From f4ae6f75089de187aafb63d5cb9937a82803ddf9 Mon Sep 17 00:00:00 2001 From: tg Date: Fri, 20 Feb 2015 07:14:30 +0000 Subject: [PATCH] can't set word=IFS_QUOTE if already IFS_WORD (something there) or IFS_QUOTE (third dquote (second OQUOTE) in """something) --- check.t | 34 +++++++++++++++++++++++++++++++--- eval.c | 14 ++++++++++++-- sh.h | 4 ++-- 3 files changed, 45 insertions(+), 7 deletions(-) diff --git a/check.t b/check.t index 2cbdcc9..e8b3bae 100644 --- a/check.t +++ b/check.t @@ -1,4 +1,4 @@ -# $MirOS: src/bin/mksh/check.t,v 1.680 2015/02/19 22:26:47 tg Exp $ +# $MirOS: src/bin/mksh/check.t,v 1.681 2015/02/20 07:14:26 tg Exp $ # -*- mode: sh -*- #- # Copyright © 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, @@ -30,7 +30,7 @@ # (2013/12/02 20:39:44) http://openbsd.cs.toronto.edu/cgi-bin/cvsweb/src/regress/bin/ksh/?sortby=date expected-stdout: - @(#)MIRBSD KSH R50 2015/02/19 + @(#)MIRBSD KSH R50 2015/02/20 description: Check version of shell. stdin: @@ -39,7 +39,7 @@ name: KSH_VERSION category: shell:legacy-no --- expected-stdout: - @(#)LEGACY KSH R50 2015/02/19 + @(#)LEGACY KSH R50 2015/02/20 description: Check version of legacy shell. stdin: @@ -8444,9 +8444,37 @@ stdin: showargs() { for s_arg in "$@"; do echo -n "<$s_arg> "; done; echo .; } x=; showargs 1 "$x"$@ set A; showargs 2 "${@:+}" + n() { echo "$#"; } + unset e + set -- a b + n """$@" + n "$@" + n "$@""" + n "$e""$@" + n "$@" + n "$@""$e" + set -- + n """$@" + n "$@" + n "$@""" + n "$e""$@" + n "$@" + n "$@""$e" expected-stdout: <1> <> . <2> <> . + 2 + 2 + 2 + 2 + 2 + 2 + 1 + 0 + 1 + 1 + 0 + 1 --- name: print-funny-chars description: diff --git a/eval.c b/eval.c index 02beae8..44a267e 100644 --- a/eval.c +++ b/eval.c @@ -23,7 +23,7 @@ #include "sh.h" -__RCSID("$MirOS: src/bin/mksh/eval.c,v 1.165 2015/02/19 22:26:48 tg Exp $"); +__RCSID("$MirOS: src/bin/mksh/eval.c,v 1.166 2015/02/20 07:14:29 tg Exp $"); /* * string expansion @@ -291,7 +291,17 @@ expand( c = *sp++; break; case OQUOTE: - word = IFS_QUOTE; + switch (word) { + case IFS_QUOTE: + /* """something */ + word = IFS_WORD; + break; + case IFS_WORD: + break; + default: + word = IFS_QUOTE; + break; + } tilde_ok = 0; quote = 1; continue; diff --git a/sh.h b/sh.h index 5c38a69..bca0843 100644 --- a/sh.h +++ b/sh.h @@ -169,9 +169,9 @@ #endif #ifdef EXTERN -__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.712 2015/02/19 22:26:50 tg Exp $"); +__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.713 2015/02/20 07:14:30 tg Exp $"); #endif -#define MKSH_VERSION "R50 2015/02/19" +#define MKSH_VERSION "R50 2015/02/20" /* arithmetic types: C implementation */ #if !HAVE_CAN_INTTYPES