On Sat Sep 7 04:23:05 EDT 2013, [email protected] wrote:
> I don't think that the behavior is really unexpected ... the `{...} part
> is interpreted by mk, but not the text between the braces. You probably
> need to quote it if it contains braces itself.
>
after looking at the code, it appears to me that this is an oversight,
that does not effect bourne-shell compatabiles. we simply need to
count the `{s and subtract the }s, and when the count reachs 0
we're done.
(it appears that ' quoting is incorrect for bourne shell compatables,
and the interpretation of \ is incorrect for rc.)
- erik
; diffy -c lex.c
/n/dump/2013/0907/sys/src/cmd/mk/lex.c:67,73 - lex.c:67,73
static int
bquote(Biobuf *bp, Bufblock *buf)
{
- int c, line, term;
+ int c, line, term, depth;
int start;
line = mkinline;
/n/dump/2013/0907/sys/src/cmd/mk/lex.c:79,88 - lex.c:79,91
;
} else
term = '`'; /* sh style */
+ depth = 1;
start = buf->current-buf->start;
for(;c > 0; c = nextrune(bp, 0)){
- if(c == term){
+ if(term == '}' && c == '`')
+ depth++;
+ if(c == term && --depth == 0){
insert(buf, '\n');
insert(buf,0);
buf->current = buf->start+start;