Browse Source

Plan 9 from Bell Labs 2006-12-13

David du Colombier 14 years ago
parent
commit
334e494c87

+ 5 - 5
dist/replica/_plan9.db

@@ -5759,7 +5759,7 @@ sys/games - 20000000775 sys sys 952648872 0
 sys/games/lib - 20000000775 sys sys 952648879 0
 sys/games/lib/4scores - 10000000666 sys sys 1118680448 0
 sys/games/lib/5scores - 10000000666 sys sys 1118680453 0
-sys/games/lib/fortunes - 664 sys sys 1164833354 262072
+sys/games/lib/fortunes - 664 sys sys 1165968371 262152
 sys/games/lib/mahjongg - 20000000775 sys sys 1095792278 0
 sys/games/lib/mahjongg/backgrounds - 20000000775 sys sys 1095792293 0
 sys/games/lib/mahjongg/backgrounds/default.bit - 664 sys sys 1095792293 346803
@@ -14007,11 +14007,11 @@ sys/src/cmd/upas/filterkit/readaddrs.c - 664 sys sys 1143759341 1331
 sys/src/cmd/upas/filterkit/token.c - 664 sys sys 1162952184 1319
 sys/src/cmd/upas/fs - 20000000775 sys sys 988250018 0
 sys/src/cmd/upas/fs/dat.h - 664 sys sys 1143929916 4189
-sys/src/cmd/upas/fs/fs.c - 664 sys sys 1143946869 26924
-sys/src/cmd/upas/fs/imap4.c - 664 sys sys 1133147970 16258
-sys/src/cmd/upas/fs/mbox.c - 664 sys sys 1143929917 26636
+sys/src/cmd/upas/fs/fs.c - 664 sys sys 1165967907 26929
+sys/src/cmd/upas/fs/imap4.c - 664 sys sys 1165967944 16484
+sys/src/cmd/upas/fs/mbox.c - 664 sys sys 1165967884 27070
 sys/src/cmd/upas/fs/mkfile - 664 sys sys 1047490336 321
-sys/src/cmd/upas/fs/plan9.c - 664 sys sys 1071334861 7465
+sys/src/cmd/upas/fs/plan9.c - 664 sys sys 1165967878 7480
 sys/src/cmd/upas/fs/pop3.c - 664 sys sys 1133988332 13024
 sys/src/cmd/upas/fs/readdir.c - 664 sys sys 944961331 203
 sys/src/cmd/upas/fs/rfc2047-test - 664 sys sys 1143946985 1146

+ 5 - 5
dist/replica/plan9.db

@@ -5759,7 +5759,7 @@ sys/games - 20000000775 sys sys 952648872 0
 sys/games/lib - 20000000775 sys sys 952648879 0
 sys/games/lib/4scores - 10000000666 sys sys 1118680448 0
 sys/games/lib/5scores - 10000000666 sys sys 1118680453 0
-sys/games/lib/fortunes - 664 sys sys 1164833354 262072
+sys/games/lib/fortunes - 664 sys sys 1165968371 262152
 sys/games/lib/mahjongg - 20000000775 sys sys 1095792278 0
 sys/games/lib/mahjongg/backgrounds - 20000000775 sys sys 1095792293 0
 sys/games/lib/mahjongg/backgrounds/default.bit - 664 sys sys 1095792293 346803
@@ -14007,11 +14007,11 @@ sys/src/cmd/upas/filterkit/readaddrs.c - 664 sys sys 1143759341 1331
 sys/src/cmd/upas/filterkit/token.c - 664 sys sys 1162952184 1319
 sys/src/cmd/upas/fs - 20000000775 sys sys 988250018 0
 sys/src/cmd/upas/fs/dat.h - 664 sys sys 1143929916 4189
-sys/src/cmd/upas/fs/fs.c - 664 sys sys 1143946869 26924
-sys/src/cmd/upas/fs/imap4.c - 664 sys sys 1133147970 16258
-sys/src/cmd/upas/fs/mbox.c - 664 sys sys 1143929917 26636
+sys/src/cmd/upas/fs/fs.c - 664 sys sys 1165967907 26929
+sys/src/cmd/upas/fs/imap4.c - 664 sys sys 1165967944 16484
+sys/src/cmd/upas/fs/mbox.c - 664 sys sys 1165967884 27070
 sys/src/cmd/upas/fs/mkfile - 664 sys sys 1047490336 321
-sys/src/cmd/upas/fs/plan9.c - 664 sys sys 1071334861 7465
+sys/src/cmd/upas/fs/plan9.c - 664 sys sys 1165967878 7480
 sys/src/cmd/upas/fs/pop3.c - 664 sys sys 1133988332 13024
 sys/src/cmd/upas/fs/readdir.c - 664 sys sys 944961331 203
 sys/src/cmd/upas/fs/rfc2047-test - 664 sys sys 1143946985 1146

+ 5 - 0
dist/replica/plan9.log

@@ -31789,3 +31789,8 @@
 1165624206 11 c sys/man/8/httpd - 664 sys sys 1165623004 6865
 1165624206 12 c sys/man/8/tlssrv - 664 sys sys 1165623041 2589
 1165811406 0 c sys/src/9/port/devsrv.c - 664 sys sys 1165810571 5711
+1165968006 0 c sys/src/cmd/upas/fs/fs.c - 664 sys sys 1165967907 26929
+1165968006 1 c sys/src/cmd/upas/fs/imap4.c - 664 sys sys 1165967944 16484
+1165968006 2 c sys/src/cmd/upas/fs/mbox.c - 664 sys sys 1165967884 27070
+1165968006 3 c sys/src/cmd/upas/fs/plan9.c - 664 sys sys 1165967878 7480
+1165969806 0 c sys/games/lib/fortunes - 664 sys sys 1165968371 262152

+ 1 - 0
sys/games/lib/fortunes

@@ -4157,3 +4157,4 @@ Subclass code (assigned by the USB-IF).  Indicates which industry standard comma
 Globus is an unstoppable monster - rminnich; No, Globus is an unstartable monster - ericvh.
 Multithreading is just one damn thing after, before, or simultaneous with another.  - Andrei Alexandrescu
 ArrayList of int / my list of int, equals new / ArrayList of int  - Steve Yegge
+In the land of the clueless, the man with half an idea is king.  - Todd Robbins

+ 1 - 1
sys/src/cmd/upas/fs/fs.c

@@ -226,7 +226,7 @@ main(int argc, char *argv[])
 	if(mboxfile != nil){
 		err = newmbox(mboxfile, "mbox", std);
 		if(err != nil)
-			sysfatal("opening mailbox: %s", err);
+			sysfatal("opening %s: %s", mboxfile, err);
 	}
 
 	switch(rfork(RFFDG|RFPROC|RFNAMEG|RFNOTEG|RFREND)){

+ 13 - 1
sys/src/cmd/upas/fs/imap4.c

@@ -409,6 +409,18 @@ mypushtls(int fd)
 	return p[1];
 }
 
+static char*
+imaperrstr(char *host, char *port)
+{
+	static char mess[256];
+	char err[64];
+
+	err[0] = '\0';
+	errstr(err, sizeof(err));
+	snprint(mess, sizeof(mess), "%s/%s:%s", host, port, err);
+	return mess;
+}
+
 //
 // dial and handshake with the imap server
 //
@@ -434,7 +446,7 @@ imap4dial(Imap *imap)
 		port = "imap";
 
 	if((imap->fd = dial(netmkaddr(imap->host, "net", port), 0, 0, 0)) < 0)
-		return geterrstr();
+		return imaperrstr(imap->host, port);
 
 	if(imap->mustssl){
 		memset(&conn, 0, sizeof conn);

+ 35 - 6
sys/src/cmd/upas/fs/mbox.c

@@ -578,28 +578,57 @@ addr822(char *p)
 	return list;
 }
 
+/*
+ * per rfc2822 §4.5.3, permit multiple to, cc and bcc headers by
+ * concatenating their values.
+ */
+
 static void
 to822(Message *m, Header *h, char *p)
 {
+	String *s;
+
 	p += strlen(h->type);
-	s_free(m->to822);
-	m->to822 = addr822(p);
+	s = addr822(p);
+	if (m->to822 == nil)
+		m->to822 = s;
+	else {
+		s_append(m->to822, " ");
+		s_append(m->to822, s_to_c(s));
+		s_free(s);
+	}
 }
 
 static void
 cc822(Message *m, Header *h, char *p)
 {
+	String *s;
+
 	p += strlen(h->type);
-	s_free(m->cc822);
-	m->cc822 = addr822(p);
+	s = addr822(p);
+	if (m->cc822 == nil)
+		m->cc822 = s;
+	else {
+		s_append(m->cc822, " ");
+		s_append(m->cc822, s_to_c(s));
+		s_free(s);
+	}
 }
 
 static void
 bcc822(Message *m, Header *h, char *p)
 {
+	String *s;
+
 	p += strlen(h->type);
-	s_free(m->bcc822);
-	m->bcc822 = addr822(p);
+	s = addr822(p);
+	if (m->bcc822 == nil)
+		m->bcc822 = s;
+	else {
+		s_append(m->bcc822, " ");
+		s_append(m->bcc822, s_to_c(s));
+		s_free(s);
+	}
 }
 
 static void

+ 2 - 1
sys/src/cmd/upas/fs/plan9.c

@@ -23,7 +23,7 @@ addtomessage(Message *m, uchar *p, int n, int done)
 {
 	int i, len;
 
-	// add to message (+ 1 in malloc is for a trailing null)
+	// add to message (+1 in malloc is for a trailing NUL)
 	if(m->lim - m->end < n){
 		if(m->start != nil){
 			i = m->end-m->start;
@@ -46,6 +46,7 @@ addtomessage(Message *m, uchar *p, int n, int done)
 
 	memmove(m->end, p, n);
 	m->end += n;
+	*m->lim = '\0';
 }
 
 //