various fixes

This commit is contained in:
rsc 2006-02-26 15:20:28 +00:00
parent eb0e8f26c4
commit d4baecd94d

View file

@ -237,7 +237,6 @@ threadmain(int argc, char **argv)
cflag = 1; cflag = 1;
break; break;
case 'f': case 'f':
sysfatal("-f not available");
file = EARGF(usage()); file = EARGF(usage());
break; break;
case 's': case 's':
@ -490,7 +489,6 @@ dir2message(Message *parent, int reverse)
highest = last->fileno; highest = last->fileno;
n = fsdirreadall(fd, &d); n = fsdirreadall(fd, &d);
fprint(2,"read %d messages\n", n);
for(i = 0; i < n; i++){ for(i = 0; i < n; i++){
if((d[i].qid.type & QTDIR) == 0) if((d[i].qid.type & QTDIR) == 0)
continue; continue;
@ -1515,16 +1513,22 @@ pcmd(Cmd *x, Message *m)
void void
printpartindented(String *s, char *part, char *indent) printpartindented(String *s, char *part, char *indent)
{ {
int fd;
char *p; char *p;
String *path; String *path;
Biobuf *b; Biobuf *b;
fprint(2,"printpartindented: fixme\n");
path = extendpath(s, part); path = extendpath(s, part);
b = Bopen(s_to_c(path), OREAD); fd = fsopenfd(mailfs, s_to_c(path), OREAD);
s_free(path); s_free(path);
if(b == nil){ if(fd < 0){
fprint(2, "!message dissappeared\n"); fprint(2, "!message disappeared\n");
return;
}
b = Bfdopen(fd, OREAD);
if(b == 0){
fprint(2, "out of memory\n");
close(fd);
return; return;
} }
while((p = Brdline(b, '\n')) != nil){ while((p = Brdline(b, '\n')) != nil){
@ -2358,6 +2362,7 @@ xpipecmd(Cmd *c, Message *m, char *part)
path = extendpath(m->path, part); path = extendpath(m->path, part);
fd = fsopenfd(mailfs, s_to_c(path), OREAD); fd = fsopenfd(mailfs, s_to_c(path), OREAD);
s_free(path); s_free(path);
if(fd < 0){ // compatibility with older upas/fs if(fd < 0){ // compatibility with older upas/fs
path = extendpath(m->path, "raw"); path = extendpath(m->path, "raw");
fd = fsopenfd(mailfs, s_to_c(path), OREAD); fd = fsopenfd(mailfs, s_to_c(path), OREAD);
@ -2421,7 +2426,7 @@ switchmb(char *file, char *singleton)
// if the user didn't say anything and there // if the user didn't say anything and there
// is an mbox mounted already, use that one // is an mbox mounted already, use that one
// so that the upas/fs -fdefault default is honored. // so that the upas/fs -fdefault default is honored.
if(file || (singleton && fsaccess(mailfs, singleton, 0) < 0)){ if(0 && (file || (singleton && fsaccess(mailfs, singleton, 0) < 0))){
/* XXX all wrong */ /* XXX all wrong */
fprint(2, "file=%s singleton=%s\n", file, singleton); fprint(2, "file=%s singleton=%s\n", file, singleton);
if(file == nil) if(file == nil)
@ -2491,9 +2496,12 @@ switchmb(char *file, char *singleton)
path = s_reset(nil); path = s_reset(nil);
mboxpath(mbname, user, path, 0); mboxpath(mbname, user, path, 0);
}else{ }else{
path = s_reset(nil); if(file)
mboxpath("mbox", user, path, 0); strecpy(mbname, mbname+sizeof mbname, file);
else
strcpy(mbname, "mbox"); strcpy(mbname, "mbox");
path = s_reset(nil);
mboxpath(mbname, user, path, 0);
} }
snprint(root, sizeof root, "%s", mbname); snprint(root, sizeof root, "%s", mbname);