ref: 75395e221fbf9d1049554b20ec48a6a147471eae
dir: /sam-fullfrontalnudity/
diff -Naur a/sys/src/cmd/sam/cmd.c b/sys/src/cmd/sam/cmd.c --- a/sys/src/cmd/sam/cmd.c Sun Mar 15 22:31:10 2020 +++ b/sys/src/cmd/sam/cmd.c Tue Feb 4 05:48:08 2020 @@ -35,7 +35,7 @@ '>', 0, 0, 0, 0, aDot, 0, linex, plan9_cmd, '<', 0, 0, 0, 0, aDot, 0, linex, plan9_cmd, '|', 0, 0, 0, 0, aDot, 0, linex, plan9_cmd, - '^', 0, 0, 0, 0, aNo, 0, linex, plan9_cmd, + '^', 0, 0, 0, 0, aDot, 0, linex, plan9_cmd, '_', 0, 0, 0, 0, aDot, 0, linex, plan9_cmd, '=', 0, 0, 0, 0, aDot, 0, linex, eq_cmd, 'c'|0x100,0, 0, 0, 0, aNo, 0, wordx, cd_cmd, diff -Naur a/sys/src/cmd/sam/mesg.c b/sys/src/cmd/sam/mesg.c --- a/sys/src/cmd/sam/mesg.c Mon Apr 30 05:09:33 2012 +++ b/sys/src/cmd/sam/mesg.c Tue Feb 4 05:48:08 2020 @@ -349,6 +349,12 @@ f = whichfile(inshort()); p0 = inlong(); journaln(0, p0); + int fd = open("/dev/snarf", OREAD); + if(fd < 0) + panic("paste: open"); + bufreset(&snarfbuf); + bufload(&snarfbuf, 0, fd, &i); + close(fd); for(l=0; l<snarfbuf.nc; l+=m){ m = snarfbuf.nc-l; if(m>BLOCKSIZE) @@ -576,7 +582,9 @@ snarf(File *f, Posn p1, Posn p2, Buffer *buf, int emptyok) { Posn l; - int i; + int i, fd, n; + String *s; + char *cs; if(!emptyok && p1==p2) return; @@ -586,11 +594,23 @@ fprint(2, "bad snarf addr p1=%ld p2=%ld f->nc=%d\n", p1, p2, f->nc); /*ZZZ should never happen, can remove */ p2 = f->nc; } + fd = open("/dev/snarf", OWRITE); + if(fd < 0){ + fprint(2, "snarf: %r\n"); + return; + } for(l=p1; l<p2; l+=i){ i = p2-l>BLOCKSIZE? BLOCKSIZE : p2-l; bufread(f, l, genbuf, i); - bufinsert(buf, buf->nc, tmprstr(genbuf, i)->s, i); + s = tmprstr(genbuf, i); + cs = Strtoc(s); + n = strlen(cs); + if(write(fd, cs, n) != n) + fprint(2, "snarf: %r\n"); + free(cs); + bufinsert(buf, buf->nc, s->s, i); } + close(fd); } int diff -Naur a/sys/src/cmd/sam/shell.c b/sys/src/cmd/sam/shell.c --- a/sys/src/cmd/sam/shell.c Sun Mar 15 22:31:10 2020 +++ b/sys/src/cmd/sam/shell.c Tue Feb 4 05:48:08 2020 @@ -13,8 +13,7 @@ static void updateenv(File *f) { - static int fd = -1; - int n; + int n, fd; char buf[64], *p, *e; if(f == nil){ @@ -33,7 +32,6 @@ p = seprint(p+1, e, "%lud", f->dot.r.p1); p = seprint(p+1, e, "%lud", f->dot.r.p2); n = p - buf; - if(fd == -1) if((fd = create("/env/%dot", OWRITE, 0666)) < 0) fprint(2, "updateenv create: %r\n"); if(write(fd, buf, n) != n) diff -Naur a/sys/src/cmd/sam/xec.c b/sys/src/cmd/sam/xec.c --- a/sys/src/cmd/sam/xec.c Sun Mar 15 22:31:10 2020 +++ b/sys/src/cmd/sam/xec.c Tue Feb 4 05:48:08 2020 @@ -26,7 +26,7 @@ if(f && f->unread) load(f); if(f==0 && (cp->addr==0 || cp->addr->type!='"') && - !utfrune("bBnqUXY!^", cp->cmdc) && + !utfrune("bBnqUXY!", cp->cmdc) && cp->cmdc!=('c'|0x100) && !(cp->cmdc=='D' && cp->ctext)) error(Enofile); i = lookup(cp->cmdc);