Correct stat size. [rsc] --rw-rw-r-- M 73506 glenda sys 1723 Jan 7 11:37 sys/src/ape/lib/ap/plan9/dirstat.c /n/sourcesdump/2006/0107/plan9/sys/src/ape/lib/ap/plan9/dirstat.c:18,28 - /n/sourcesdump/2006/0108/plan9/sys/src/ape/lib/ap/plan9/dirstat.c:18,28 nd = DIRSIZE; for(i=0; i<2; i++){ /* should work by the second try */ - d = malloc(sizeof(Dir) + nd); + d = malloc(sizeof(Dir) + BIT16SZ +nd); if(d == nil) return nil; buf = (uchar*)&d[1]; - n = _STAT(name, buf, nd); + n = _STAT(name, buf, BIT16SZ+nd); if(n < BIT16SZ){ free(d); return nil; /n/sourcesdump/2006/0107/plan9/sys/src/ape/lib/ap/plan9/dirstat.c:32,38 - /n/sourcesdump/2006/0108/plan9/sys/src/ape/lib/ap/plan9/dirstat.c:32,38 _convM2D(buf, n, d, (char*)&d[1]); return d; } - /* else sizeof(Dir)+nd is plenty */ + /* else sizeof(Dir)+BIT16SZ+nd is plenty */ free(d); } return nil; Fix usage. [rsc] --rw-rw-r-- M 73506 rsc sys 7027 Jan 7 11:39 sys/src/cmd/aquarela/aquarela.c /n/sourcesdump/2006/0107/plan9/sys/src/cmd/aquarela/aquarela.c:176,183 - /n/sourcesdump/2006/0108/plan9/sys/src/cmd/aquarela/aquarela.c:176,183 void usage(void) { - print("usage: aquarela [-u unicodevalue]\n"); - threadexitsall(""); + fprint(2, "usage: %s [-d debug-opt] [-n] [-p] [-u 1|0] [-w workgroup]\n", argv0); + threadexitsall("usage"); } static void [rsc] --rw-rw-r-- M 73506 rsc sys 1141 Jan 7 11:39 sys/src/cmd/aquarela/smbglobals.c /n/sourcesdump/2006/0107/plan9/sys/src/cmd/aquarela/smbglobals.c:36,43 - /n/sourcesdump/2006/0108/plan9/sys/src/cmd/aquarela/smbglobals.c:36,46 if (smbglobals.serverinfo.remark == nil) smbglobals.serverinfo.remark = "This is a default server comment"; if (smbglobals.log.fd < 0) - if (client) + if (client){ smbglobals.log.fd = create("client.log", OWRITE|OTRUNC, 0666); - else - smbglobals.log.fd = create("aquarela.log", OWRITE|OTRUNC, 0666); + } + else{ + if (access("/sys/log/aquarela", 2) == 0) + smbglobals.log.fd = open("/sys/log/aquarela", OWRITE); + } } Fix error messages. [rsc] --rw-rw-r-- M 73506 rsc sys 3799 Jan 7 11:37 sys/src/cmd/fcp.c /n/sourcesdump/2006/0107/plan9/sys/src/cmd/fcp.c:44,50 - /n/sourcesdump/2006/0108/plan9/sys/src/cmd/fcp.c:44,50 if(dirb!=nil && (dirb->mode&DMDIR)) todir=1; if(argc>2 && !todir){ - fprint(2, "cp: %s not a directory\n", argv[argc-1]); + fprint(2, "fcp: %s not a directory\n", argv[argc-1]); exits("bad usage"); } for(i=0; iqid.vers==a->qid.vers) if(b->dev==a->dev) if(b->type==a->type){ - fprint(2, "cp: %s and %s are the same file\n", an, bn); + fprint(2, "fcp: %s and %s are the same file\n", an, bn); ret = 1; } free(b); /n/sourcesdump/2006/0107/plan9/sys/src/cmd/fcp.c:98,110 - /n/sourcesdump/2006/0108/plan9/sys/src/cmd/fcp.c:98,110 } if((dirb=dirstat(from))==nil){ - fprint(2,"cp: can't stat %s: %r\n", from); + fprint(2,"fcp: can't stat %s: %r\n", from); failed = 1; return; } mode = dirb->mode; if(mode&DMDIR){ - fprint(2, "cp: %s is a directory\n", from); + fprint(2, "fcp: %s is a directory\n", from); free(dirb); failed = 1; return; /n/sourcesdump/2006/0107/plan9/sys/src/cmd/fcp.c:117,123 - /n/sourcesdump/2006/0108/plan9/sys/src/cmd/fcp.c:117,123 mode &= 0777; fdf=open(from, OREAD); if(fdf<0){ - fprint(2, "cp: can't open %s: %r\n", from); + fprint(2, "fcp: can't open %s: %r\n", from); free(dirb); failed = 1; return; /n/sourcesdump/2006/0107/plan9/sys/src/cmd/fcp.c:124,130 - /n/sourcesdump/2006/0108/plan9/sys/src/cmd/fcp.c:124,130 } fdt=create(to, OWRITE, mode); if(fdt<0){ - fprint(2, "cp: can't create %s: %r\n", to); + fprint(2, "fcp: can't create %s: %r\n", to); close(fdf); free(dirb); failed = 1; /n/sourcesdump/2006/0107/plan9/sys/src/cmd/fcp.c:141,147 - /n/sourcesdump/2006/0108/plan9/sys/src/cmd/fcp.c:141,147 if(gflag) dirt.gid = dirb->gid; if(dirfwstat(fdt, &dirt) < 0) - fprint(2, "cp: warning: can't wstat %s: %r\n", to); + fprint(2, "fcp: warning: can't wstat %s: %r\n", to); } free(dirb); close(fdf); /n/sourcesdump/2006/0107/plan9/sys/src/cmd/fcp.c:169,175 - /n/sourcesdump/2006/0108/plan9/sys/src/cmd/fcp.c:169,175 } } if(n == 0){ - fprint(2, "cp: rfork: %r\n"); + fprint(2, "fcp: rfork: %r\n"); failed = 1; return -1; } Return non-negative numbers. [rsc] --rw-rw-r-- M 73506 glenda sys 11556 Jan 7 11:35 sys/src/cmd/pic/input.c /n/sourcesdump/2006/0107/plan9/sys/src/cmd/pic/input.c:245,251 - /n/sourcesdump/2006/0108/plan9/sys/src/cmd/pic/input.c:245,251 printf(" <%c>", c); if (ep >= ebuf + sizeof ebuf) ep = ebuf; - return *ep++ = c; + return *(unsigned char *)ep++ = c; } nextchar(void)