diff options
author | cinap_lenrek <cinap_lenrek@gmx.de> | 2013-09-07 18:42:40 +0200 |
---|---|---|
committer | cinap_lenrek <cinap_lenrek@gmx.de> | 2013-09-07 18:42:40 +0200 |
commit | ebf2c5cd6997eb7a200ff7d79734ff0dfd43a748 (patch) | |
tree | 671da0a706639c6fbc967d1b91f85a06df54c4f9 /sys/src/cmd/mk | |
parent | 12596736e98355fb64702270554e7911dd0d520d (diff) |
mk: handle rc blocks in shell quote
this is so we cna handle:
foo = `{echo `{echo bar}}
thanks to erik and friedrich psiorz on 9fans for
bringing the issue up.
Diffstat (limited to 'sys/src/cmd/mk')
-rw-r--r-- | sys/src/cmd/mk/lex.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/sys/src/cmd/mk/lex.c b/sys/src/cmd/mk/lex.c index d942918f3..5c4bc99be 100644 --- a/sys/src/cmd/mk/lex.c +++ b/sys/src/cmd/mk/lex.c @@ -67,7 +67,7 @@ eof: static int bquote(Biobuf *bp, Bufblock *buf) { - int c, line, term; + int c, line, term, depth; int start; line = mkinline; @@ -80,9 +80,12 @@ bquote(Biobuf *bp, Bufblock *buf) } else term = '`'; /* sh style */ + depth = 1; start = buf->current-buf->start; for(;c > 0; c = nextrune(bp, 0)){ - if(c == term){ + if(c == '{' && term == '}') + depth++; + if(c == term && --depth == 0){ insert(buf, '\n'); insert(buf,0); buf->current = buf->start+start; |