diff --git a/basic/oneliner b/basic/oneliner index e0b8581..f3439cb 100755 --- a/basic/oneliner +++ b/basic/oneliner @@ -39,3 +39,5 @@ HERE # an example of escaping double-quotes ../c99sh -e 'printf("\"Hello ");' -e 'printf("World\" ");' -e 'printf("from 1-liner\n");' + +../c99sh -e '#define w1 "Hello"' -e '#define w2 "World"' -e 'printf("%s %s\n", w1, w2);' diff --git a/c99sh b/c99sh index f755167..eb2281a 100755 --- a/c99sh +++ b/c99sh @@ -163,7 +163,9 @@ emit_main_close() { echo "#line 1 \"$f\"" >>"$c" if [ $oneline -eq 1 ] then - echo ${stmts[@]} >> "$c" + for ((i = 0; i < $stmtcnt; ++i)); do + echo ${stmts[$i]} >> "$c" + done fi if [[ ($oneline -eq 1 && $m -gt 0) || $oneline -eq 0 ]]