From mboxrd@z Thu Jan 1 00:00:00 1970 From: erik quanstrom Date: Fri, 29 Apr 2011 21:09:58 -0400 To: 9fans@9fans.net Message-ID: <0293e3961df7c047ffef96c2fc6939ae@brasstown.quanstro.net> In-Reply-To: <1304104623.9113.1446566425@webmail.messagingengine.com> References: <20110427131041.GA21774@skaro.cthulhu.dircon.co.uk> <0bc37e9990e3c3ebde8276275a170a88@quintile.net> <20110428121127.GD1020@skaro.cthulhu.dircon.co.uk> <3B3CAD91-6623-4E25-AB8A-FE1613ACFD83@fastmail.fm> <2345D520-5F13-4A07-A96B-48B0A725A4C9@fastmail.fm> <25321b4258988e7615bcacfd9f1878d1@coraid.com> <1304104623.9113.1446566425@webmail.messagingengine.com> MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Subject: Re: [9fans] spaces in filenames (and filesystems...) Topicbox-Message-UUID: d948c372-ead6-11e9-9d60-3106f5b1d025 > > this is one thing that byron understood in his version of rc. > > he had > > x=``ifs {cmd} > > the `` was required since `singleton was allowed in his version. > > i think that one could just extend the grammar to allow > > x=`ifs {cmd} > > and i think it would be even better if it were > > x=`splitchars {cmd} > > so ifs is never set. > > I don't quite understand the first two examples. Do they set ifs only > within the {} ? I guess that risks breaking any scripts you might want > to run as cmd, so yeah, the 3rd looks good. i implemented the 3d this evening in a compatable way with Traditional Rc. there's an argument that it's not completely necessary, but it's so easy to make a mistake and type this ifs=$something x=`{something} leaving ifs set rather than the intended ifs=$something {x=`{something}} i also don't see a argument against making the splitting string local to the backq. i don't believe i've ever written a script that uses the fact that ifs can be set once and reused with it's nonstandard value. - erik ---- ; 8.out broken! x=`{echo a b c d} broken! whatis x x=(a b c d) broken! x=`/$nl {pwd} broken! whatis x x=(usr quanstro src rc) broken! ifs=/$nl {x=`{pwd}} broken! whatis x x=(usr quanstro src rc) broken! diffy -c *.[chy] diff -c /n/dump/2011/0429/usr/quanstro/src/rc/code.c code.c /n/dump/2011/0429/usr/quanstro/src/rc/code.c:145,158 - code.c:145,167 emitf(Xconc); break; case '`': + emitf(Xmark); + if(c0==0){ + emitf(Xword); + emits(strdup("ifs")); + emitf(Xdol); + }else{ + outcode(c0, 0, brkaddr); + emitf(Xglob); + } emitf(Xbackq); if(havefork){ p = emiti(0); - outcode(c0, 0, brkaddr); + outcode(c1, 0, brkaddr); emitf(Xexit); stuffdot(p); } else - emits(fnstr(c0)); + emits(fnstr(c1)); break; case ANDAND: outcode(c0, 0, brkaddr); diff -c /n/dump/2011/0429/usr/quanstro/src/rc/havefork.c havefork.c /n/dump/2011/0429/usr/quanstro/src/rc/havefork.c:83,93 - havefork.c:83,92 int pfd[2]; char *s, *wd, *ewd, *stop; struct io *f; - var *ifs = vlook("ifs"); word *v, *nextv; Rune r; - stop = ifs->val? ifs->val->word: ""; + stop = runq->argv->words->word; if(pipe(pfd)<0){ Xerror("can't make pipe"); return; /n/dump/2011/0429/usr/quanstro/src/rc/havefork.c:140,145 - havefork.c:139,145 efree(wd); closeio(f); Waitfor(pid, 0); + popword(); /* ditch split in "stop" */ /* v points to reversed arglist -- reverse it onto argv */ while(v){ nextv = v->next; /n/dump/2011/0429/usr/quanstro/src/rc/pcmd.c:32,38 - pcmd.c:32,38 break; case '^': pfmt(f, "%t^%t", c0, c1); break; - case '`': pfmt(f, "`%t", c0); + case '`': pfmt(f, "`%t%t", c0, c1); break; case ANDAND: pfmt(f, "%t && %t", c0, c1); break; diff -c /n/dump/2011/0429/usr/quanstro/src/rc/syn.y syn.y /n/dump/2011/0429/usr/quanstro/src/rc/syn.y:96,102 - syn.y:96,103 | '"' word {$$=tree1('"', $2);} | COUNT word {$$=tree1(COUNT, $2);} | WORD - | '`' brace {$$=tree1('`', $2);} + | '`' brace {$$=tree2('`', nil, $2);} + | '`' word brace {$$=tree2('`', $2, $3);} | '(' wordsnl nl ')' {$$=tree1(PAREN, $2);} | REDIR brace {$$=mung1($1, $2); $$->type=PIPEFD;} keyword: FOR|IN|WHILE|IF|NOT|TWIDDLE|BANG|SUBSHELL|SWITCH|FN|BREAK