can't set word=IFS_QUOTE if already IFS_WORD (something there)

or IFS_QUOTE (third dquote (second OQUOTE) in """something)
This commit is contained in:
tg
2015-02-20 07:14:30 +00:00
parent 73082b9292
commit f4ae6f7508
3 changed files with 45 additions and 7 deletions

34
check.t
View File

@ -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 -*- # -*- mode: sh -*-
#- #-
# Copyright © 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, # 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 # (2013/12/02 20:39:44) http://openbsd.cs.toronto.edu/cgi-bin/cvsweb/src/regress/bin/ksh/?sortby=date
expected-stdout: expected-stdout:
@(#)MIRBSD KSH R50 2015/02/19 @(#)MIRBSD KSH R50 2015/02/20
description: description:
Check version of shell. Check version of shell.
stdin: stdin:
@ -39,7 +39,7 @@ name: KSH_VERSION
category: shell:legacy-no category: shell:legacy-no
--- ---
expected-stdout: expected-stdout:
@(#)LEGACY KSH R50 2015/02/19 @(#)LEGACY KSH R50 2015/02/20
description: description:
Check version of legacy shell. Check version of legacy shell.
stdin: stdin:
@ -8444,9 +8444,37 @@ stdin:
showargs() { for s_arg in "$@"; do echo -n "<$s_arg> "; done; echo .; } showargs() { for s_arg in "$@"; do echo -n "<$s_arg> "; done; echo .; }
x=; showargs 1 "$x"$@ x=; showargs 1 "$x"$@
set A; showargs 2 "${@:+}" 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: expected-stdout:
<1> <> . <1> <> .
<2> <> . <2> <> .
2
2
2
2
2
2
1
0
1
1
0
1
--- ---
name: print-funny-chars name: print-funny-chars
description: description:

14
eval.c
View File

@ -23,7 +23,7 @@
#include "sh.h" #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 * string expansion
@ -291,7 +291,17 @@ expand(
c = *sp++; c = *sp++;
break; break;
case OQUOTE: 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; tilde_ok = 0;
quote = 1; quote = 1;
continue; continue;

4
sh.h
View File

@ -169,9 +169,9 @@
#endif #endif
#ifdef EXTERN #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 #endif
#define MKSH_VERSION "R50 2015/02/19" #define MKSH_VERSION "R50 2015/02/20"
/* arithmetic types: C implementation */ /* arithmetic types: C implementation */
#if !HAVE_CAN_INTTYPES #if !HAVE_CAN_INTTYPES