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.
This commit is contained in:
parent
12596736e9
commit
ebf2c5cd69
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue