1. cleaner error messages (no more fmtstr in acme). 2. install Mail in /acme/bin/$objtype so acme can find it Notes: Thu Apr 28 10:08:23 EDT 2005 rsc > 1. cleaner error messages (no more fmtstr in acme). Now there is a limit on the size of the error message that can be printed. This is not progress. I agree that printing Mail: twice should be fixed. I'll apply that bit. > 2. install Mail in /acme/bin/$objtype so acme can find it I'm willing to try this. In the past people have started mail via /acme/mail/Mail, which does some name space setup before invoking the binary. Russ Reference: /n/sources/patch/applied/acmemail-errormsgs Date: Wed Apr 27 21:57:14 CES 2005 Reviewed-by: rsc --- /acme/mail/src/mkfile Wed Apr 27 21:55:10 2005 +++ /acme/mail/src/mkfile Wed Apr 27 21:55:05 2005 @@ -12,7 +12,7 @@ HFILES=dat.h LIB= -BIN=../$objtype +BIN=/acme/bin/$objtype UPDATE=\ mkfile\ --- /acme/mail/src/mail.c Wed Apr 27 21:55:33 2005 +++ /acme/mail/src/mail.c Wed Apr 27 21:55:27 2005 @@ -151,7 +151,7 @@ s = estrstrdup(maildir, "ctl"); mbox.ctlfd = open(s, ORDWR|OCEXEC); if(mbox.ctlfd < 0) - error("Mail: can't open %s: %r\n", s); + error("can't open %s: %r", s); fsname = estrdup(name); if(newdir && argc > 0){ @@ -163,13 +163,13 @@ err[0] = '\0'; errstr(err, sizeof err); if(strstr(err, "mbox name in use") == nil) - error("Mail: can't create directory %s for mail: %s\n", name, err); + error("can't create directory %s for mail: %s", name, err); free(fsname); fsname = emalloc(strlen(name)+10); sprint(fsname, "%s-%d", name, i); } if(i == 10) - error("Mail: can't open %s/%s: %r", mailboxdir, mboxname); + error("can't open %s/%s: %r", mailboxdir, mboxname); free(s); } --- /acme/mail/src/util.c Wed Apr 27 21:56:01 2005 +++ /acme/mail/src/util.c Wed Apr 27 21:55:57 2005 @@ -77,18 +77,14 @@ void error(char *fmt, ...) { - Fmt f; - char buf[64]; + char buf[128]; va_list arg; - fmtfdinit(&f, 2, buf, sizeof buf); - fmtprint(&f, "Mail: "); va_start(arg, fmt); - fmtvprint(&f, fmt, arg); + vsnprint(buf, sizeof buf, fmt, arg); va_end(arg); - fmtprint(&f, "\n"); - fmtfdflush(&f); - threadexitsall(fmt); + fprint(2, "Mail: %s\n", buf); + threadexitsall(buf); } void --- /acme/mail/src/mesg.c Wed Apr 27 21:56:40 2005 +++ /acme/mail/src/mesg.c Wed Apr 27 21:56:31 2005 @@ -533,7 +533,7 @@ Message *n, *next; if(m->opened) - error("Mail: internal error: deleted message still open in mesgdel\n"); + error("internal error: deleted message still open in mesgdel"); /* delete subparts */ for(n=m->head; n!=nil; n=next){ next = n->next;