Browse Source

Plan 9 from Bell Labs 2003-12-18

David du Colombier 17 years ago
parent
commit
f42a0a3106

+ 5 - 5
dist/replica/plan9.db

@@ -5158,7 +5158,7 @@ sys/src/9/bitsy/l.s - 664 sys sys 1055700934 18211
 sys/src/9/bitsy/main.c - 664 sys sys 1067722593 9083
 sys/src/9/bitsy/map - 664 sys sys 1017695515 236
 sys/src/9/bitsy/mem.h - 664 sys sys 1055700932 8049
-sys/src/9/bitsy/mkfile - 664 sys sys 1071245512 2450
+sys/src/9/bitsy/mkfile - 664 sys sys 1071671673 2466
 sys/src/9/bitsy/mmu.c - 664 sys sys 1055700931 11228
 sys/src/9/bitsy/mouse.c - 664 sys sys 1017695516 962
 sys/src/9/bitsy/paqfiles - 20000000775 sys sys 1020011250 0
@@ -5440,7 +5440,7 @@ sys/src/9/port/mkroot - 775 sys sys 1039753334 235
 sys/src/9/port/mkrootall - 775 sys sys 1055954696 386
 sys/src/9/port/mkrootc - 775 sys sys 1055954695 717
 sys/src/9/port/mksystab - 664 sys sys 1014931176 783
-sys/src/9/port/mul64fract.c - 664 sys sys 1071320142 618
+sys/src/9/port/mul64fract.c - 664 sys sys 1071671674 867
 sys/src/9/port/netif.c - 664 sys sys 1066514951 13421
 sys/src/9/port/netif.h - 664 sys sys 1066514947 2975
 sys/src/9/port/nulledf.c - 664 sys sys 1037669300 821
@@ -7510,7 +7510,7 @@ sys/src/cmd/fax/receive.c - 664 sys sys 944960990 1097
 sys/src/cmd/fax/receiverc - 775 sys sys 944960990 581
 sys/src/cmd/fax/send.c - 664 sys sys 944960990 923
 sys/src/cmd/fax/subr.c - 664 sys sys 1015090401 1245
-sys/src/cmd/file.c - 664 sys sys 1065017417 20590
+sys/src/cmd/file.c - 664 sys sys 1071719684 20614
 sys/src/cmd/fmt.c - 664 sys sys 1070032009 4088
 sys/src/cmd/fortune.c - 664 sys sys 1035832953 1674
 sys/src/cmd/fossil - 20000000775 sys sys 1042005512 0
@@ -10780,7 +10780,7 @@ sys/src/cmd/upas/filterkit/token.c - 664 sys sys 1018549521 1312
 sys/src/cmd/upas/fs - 20000000775 sys sys 988250018 0
 sys/src/cmd/upas/fs/dat.h - 664 sys sys 1047490337 4267
 sys/src/cmd/upas/fs/fs.c - 664 sys sys 1068350246 27381
-sys/src/cmd/upas/fs/imap4.c - 664 sys sys 1061779754 18103
+sys/src/cmd/upas/fs/imap4.c - 664 sys sys 1071689378 16021
 sys/src/cmd/upas/fs/mbox.c - 664 sys sys 1071334860 28493
 sys/src/cmd/upas/fs/mkfile - 664 sys sys 1047490336 321
 sys/src/cmd/upas/fs/plan9.c - 664 sys sys 1071334861 7465
@@ -11781,7 +11781,7 @@ sys/src/libdraw/getrect.c - 664 sys sys 1014927875 3046
 sys/src/libdraw/getsubfont.c - 664 sys sys 1014927875 757
 sys/src/libdraw/icossin.c - 664 sys sys 944961724 2117
 sys/src/libdraw/icossin2.c - 664 sys sys 944961724 4587
-sys/src/libdraw/init.c - 664 sys sys 1070660683 9077
+sys/src/libdraw/init.c - 664 sys sys 1071692552 9082
 sys/src/libdraw/keyboard.c - 664 sys sys 1030970091 1703
 sys/src/libdraw/line.c - 664 sys sys 1040442973 731
 sys/src/libdraw/loadimage.c - 664 sys sys 1014927876 983

+ 5 - 0
dist/replica/plan9.log

@@ -13148,3 +13148,8 @@
 1071615680 0 c sys/src/9/pc/sdata.c - 664 sys sys 1071615236 50538
 1071615680 1 c sys/src/boot/pc/sdata.c - 664 sys sys 1071615664 35424
 1071621080 0 a sys/lib/lp/log - 20000000775 sys sys 1071620128 0
+1071673287 0 c sys/src/9/bitsy/mkfile - 664 sys sys 1071671673 2466
+1071673287 1 c sys/src/9/port/mul64fract.c - 664 sys sys 1071671674 867
+1071689381 0 c sys/src/cmd/upas/fs/imap4.c - 664 sys sys 1071689378 16021
+1071692561 0 c sys/src/libdraw/init.c - 664 sys sys 1071692552 9082
+1071720094 0 c sys/src/cmd/file.c - 664 sys sys 1071719684 20614

+ 1 - 0
sys/src/9/bitsy/mkfile

@@ -18,6 +18,7 @@ PORT=\
 	edf.$O\
 	fault.$O\
 	latin1.$O\
+	mul64fract.$O\
 	rebootcmd.$O\
 	page.$O\
 	parse.$O\

+ 17 - 6
sys/src/9/port/mul64fract.c

@@ -1,11 +1,22 @@
 #include <u.h>
 
-// multiply two 64 numbers and return the middle 64 bits of the 128 bit result.
-// the assummption is that one of the numbers is a fixed point number with the
-// decimal to the left of the low order 32 bits.
-//
-// there should be an assembler version of this routine for each architecture.
-// this one is provided to make ports easier.
+/* mul64fract(uvlong*r, uvlong a, uvlong b)
+ *
+ * Multiply two 64 numbers and return the middle 64 bits of the 128 bit result.
+ *
+ * The assumption is that one of the numbers is a 
+ * fixed point number with the integer portion in the
+ * high word and the fraction in the low word.
+ *
+ * There should be an assembler version of this routine
+ * for each architecture.  This one is intended to
+ * make ports easier.
+ *
+ *	ignored		r0 = lo(a0*b0)
+ *	lsw of result	r1 = hi(a0*b0) +lo(a0*b1) +lo(a1*b0)
+ *	msw of result	r2 = 		hi(a0*b1) +hi(a1*b0) +lo(a1*b1)
+ *	ignored		r3 = hi(a1*b1)
+ */
 
 void
 mul64fract(uvlong *r, uvlong a, uvlong b)

+ 1 - 1
sys/src/cmd/file.c

@@ -1094,7 +1094,7 @@ isp9font(void)
 		}
 	}
 	if (i) {
-		print("font file\n");
+		print(mime ? "text/plain\n" : "font file\n");
 		return 1;
 	}
 	return 0;

+ 3 - 89
sys/src/cmd/upas/fs/imap4.c

@@ -485,61 +485,6 @@ imap4hangup(Imap *imap)
 	close(imap->fd);
 }
 
-//
-// download just the header of a message
-// because we do this, the sha1 digests are only of
-// the headers.  hopefully this won't cause problems.
-//
-// this doesn't work (and isn't used).  the downloading
-// itself works, but we need to have the full mime headers
-// to get the right recursive structures into the file system,
-// which means having the body.  i've also had other weird
-// problems with bodies being paged in incorrectly.
-//
-// this is here as a start in case someone else wants a crack
-// at it.  note that if you start using this you'll have to 
-// change the digest in imap4fetch() to digest just the header.
-//
-static char*
-imap4fetchheader(Imap *imap, Mailbox *mb, Message *m)
-{
-	int i;
-	char *p, *s, sdigest[2*SHA1dlen+1];
-
-	imap->size = 0;
-	free(imap->base);
-	imap->base = nil;
-	imap->data = nil;
-
-	imap4cmd(imap, "UID FETCH %lud RFC822.HEADER", (ulong)m->imapuid);
-	if(!isokay(s = imap4resp(imap)))
-		return s;
-	if(imap->base == nil)
-		return "didn't get header";
-
-	p = imap->base;
-	removecr(p);
-	free(m->start);
-	m->start = p;
-	m->end = p+strlen(p);
-	m->bend = m->rbend = m->end;
-	m->header = m->start;
-	//m->fetched = 0;
-
-	imap->base = nil;
-	imap->data = nil;
-
-	parseheaders(m, 0, mb, 1);
-
-	// digest headers
-	sha1((uchar*)m->start, m->hend - m->start, m->digest, nil);
-	for(i = 0; i < SHA1dlen; i++)
-		sprint(sdigest+2*i, "%2.2ux", m->digest[i]);
-	m->sdigest = s_copy(sdigest);
-
-	return nil;
-}
-
 //
 // download a single message
 //
@@ -549,55 +494,24 @@ imap4fetch(Mailbox *mb, Message *m)
 	int i;
 	char *p, *s, sdigest[2*SHA1dlen+1];
 	Imap *imap;
-//	int sz;
 
 	imap = mb->aux;
 
-//	if(s = imap4dial(imap))
-//		return s;
-//
-//	imap4cmd(imap, "STATUS %s (MESSAGES UIDVALIDITY)", imap->mbox);
-//	if(!isokay(s = imap4resp(imap)))
-//		return s;
-//	if((ulong)(m->imapuid>>32) != imap->validity)
-//		return "uids changed underfoot";
-
 	imap->size = 0;
 
-	/* SIZE */
-//	if(!isokay(s = imap4resp(imap)))
-//		return s;
-//	if(imap->size == 0)
-//		return "didn't get size from size command";
-
-//	sz = imap->size;
-//	p = emalloc(sz+1);
-//	free(imap->base);
-//	imap->base = p;
-//	imap->data = p;
-//	imap->size = sz;
-
-	/* HEADER */
-//	if(!isokay(s = imap4resp(imap)))
-//		return s;
-//	if(imap->size == sz){
-//		free(p);
-//		imap->data = nil;
-//		return "didn't get header";
-//	}
-
-	/* TEXT */
 	if(!isokay(s = imap4resp(imap)))
 		return s;
 
 	p = imap->base;
+	if(p == nil)
+		return "did not get message body";
+
 	removecr(p);
 	free(m->start);
 	m->start = p;
 	m->end = p+strlen(p);
 	m->bend = m->rbend = m->end;
 	m->header = m->start;
-	//m->fetched = 1;
 
 	imap->base = nil;
 	imap->data = nil;

+ 1 - 1
sys/src/libdraw/init.c

@@ -387,7 +387,7 @@ drawerror(Display *d, char *s)
 {
 	char err[ERRMAX];
 
-	if(d->error)
+	if(d && d->error)
 		d->error(d, s);
 	else{
 		errstr(err, sizeof err);