Browse Source

Plan 9 from Bell Labs 2004-03-16

David du Colombier 16 years ago
parent
commit
d3ec37d1f8

+ 15 - 15
dist/replica/plan9.db

@@ -702,7 +702,7 @@ acme/mail/src/win.c - 664 sys sys 1033936955 5428
 acme/mkfile - 775 sys sys 1035390142 242
 acme/news - 20000000775 sys sys 1015011247 0
 acme/news/guide - 444 sys sys 1015011247 32
-acme/news/src - 20000000777 sys sys 1015011247 0
+acme/news/src - 20000000775 sys sys 1039727911 0
 acme/news/src/mkfile - 664 sys sys 1032639303 198
 acme/news/src/news.c - 664 sys sys 1032639277 17987
 acme/news/src/util.c - 664 sys sys 1015097408 1385
@@ -860,7 +860,7 @@ dist/replica - 20000000775 sys sys 1019277119 0
 dist/replica/cd - 664 sys sys 1019527959 390
 dist/replica/kfs - 664 sys sys 1019527929 237
 dist/replica/network - 775 sys sys 1071079179 996
-dist/replica/plan9.proto - 664 sys sys 1022112985 1209
+dist/replica/plan9.proto - 664 sys sys 1079376335 2533
 env - 20000000775 sys sys 1015094872 0
 fd - 20000000775 sys sys 947958544 0
 lib - 20000000775 sys sys 958504315 0
@@ -2780,7 +2780,7 @@ lib/ndb/local - 664 sys sys 1077723747 292
 lib/ndb/local.complicated - 664 sys sys 1032354376 2740
 lib/ndb/nfs - 664 sys sys 954036707 113
 lib/news - 20000000775 sys sys 944943954 0
-lib/sky - 20000000777 sys sys 954015749 0
+lib/sky - 20000000775 sys sys 1079376081 0
 lib/sky/abell.scat - 444 sys sys 954015738 86784
 lib/sky/bayer.scat - 444 sys sys 954015738 12136
 lib/sky/con.scat - 444 sys sys 954015746 213476
@@ -2790,7 +2790,7 @@ lib/sky/estartab - 444 sys sys 954015747 159692
 lib/sky/here - 444 sys sys 954015747 32
 lib/sky/mindex.scat - 444 sys sys 954015747 488
 lib/sky/name.scat - 444 sys sys 954023446 17580
-lib/sky/ngc2000.scat - 666 sys sys 954015747 0
+lib/sky/ngc2000.scat - 664 sys sys 954015747 0
 lib/sky/ngc2000type.scat - 444 sys sys 954015747 13226
 lib/sky/patch.scat - 444 sys sys 954015749 1298280
 lib/sky/patchindex.scat - 444 sys sys 954015749 92054
@@ -3418,7 +3418,7 @@ sys/include/flate.h - 664 sys sys 1014929063 1245
 sys/include/frame.h - 664 sys sys 1014929063 2666
 sys/include/geometry.h - 664 sys sys 1014929063 2632
 sys/include/html.h - 664 sys sys 1017679304 15157
-sys/include/httpd.h - 664 sys sys 1014929064 5726
+sys/include/httpd.h - 664 sys sys 1079372798 5747
 sys/include/ip.h - 664 sys sys 1050702405 2908
 sys/include/keyboard.h - 664 sys sys 1071725439 790
 sys/include/libc.h - 664 sys sys 1072792615 19430
@@ -4624,7 +4624,7 @@ sys/man/1/calendar - 664 sys sys 1032058542 1144
 sys/man/1/cat - 664 sys sys 1022048090 1335
 sys/man/1/cb - 664 sys sys 1063855627 896
 sys/man/1/chgrp - 664 sys sys 944959673 710
-sys/man/1/chmod - 664 sys sys 944959673 1276
+sys/man/1/chmod - 664 sys sys 1079372922 1299
 sys/man/1/cleanname - 664 sys sys 944959674 580
 sys/man/1/cmp - 664 sys sys 944959673 1092
 sys/man/1/colors - 664 sys sys 954523212 1443
@@ -4675,7 +4675,7 @@ sys/man/1/lens - 664 sys sys 1029431866 1230
 sys/man/1/lex - 664 sys sys 1032058565 1520
 sys/man/1/look - 664 sys sys 944959673 1348
 sys/man/1/lp - 664 sys sys 1015024739 3304
-sys/man/1/ls - 664 sys sys 1049813576 2791
+sys/man/1/ls - 664 sys sys 1079372922 2897
 sys/man/1/mail - 664 sys sys 1050078464 2158
 sys/man/1/man - 664 sys sys 1059484724 1740
 sys/man/1/marshal - 664 sys sys 1050078464 3307
@@ -4735,7 +4735,7 @@ sys/man/1/tbl - 664 sys sys 944959674 4308
 sys/man/1/tcs - 664 sys sys 952627441 2575
 sys/man/1/tee - 664 sys sys 969499886 351
 sys/man/1/tel - 664 sys sys 1045501423 941
-sys/man/1/test - 664 sys sys 1070459150 3475
+sys/man/1/test - 664 sys sys 1079372544 3535
 sys/man/1/thesaurus - 664 sys sys 1068121775 222
 sys/man/1/time - 664 sys sys 944959673 380
 sys/man/1/touch - 664 sys sys 1018369246 461
@@ -5594,7 +5594,7 @@ sys/src/ape/cmd/expr/mkfile - 664 sys sys 1014921975 144
 sys/src/ape/cmd/expr/regexp.h - 664 sys sys 1014921975 5958
 sys/src/ape/cmd/kill.c - 664 sys sys 1014921975 1605
 sys/src/ape/cmd/make - 20000000775 sys sys 1014921974 0
-sys/src/ape/cmd/make-3.79 - 20000000777 sys sys 1014921978 0
+sys/src/ape/cmd/make-3.79 - 20000000775 sys sys 1039727530 0
 sys/src/ape/cmd/make-3.79/tests - 20000000775 sys sys 1014921978 0
 sys/src/ape/cmd/make-3.79/tests/scripts - 20000000755 sys sys 1014921981 0
 sys/src/ape/cmd/make-3.79/tests/scripts/features - 20000000755 sys sys 1014921979 0
@@ -7277,7 +7277,7 @@ sys/src/cmd/cfs/mkfile - 664 sys sys 1032457443 663
 sys/src/cmd/cfs/notes - 664 sys sys 944960876 570
 sys/src/cmd/cfs/stats.h - 664 sys sys 1014925220 918
 sys/src/cmd/chgrp.c - 664 sys sys 1014926580 624
-sys/src/cmd/chmod.c - 664 sys sys 1072793234 1903
+sys/src/cmd/chmod.c - 664 sys sys 1079372923 1904
 sys/src/cmd/cleanname.c - 664 sys sys 944960760 715
 sys/src/cmd/clock.c - 664 sys sys 1014925410 1881
 sys/src/cmd/cmp.c - 664 sys sys 1072145760 2379
@@ -7541,7 +7541,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 1071719684 20614
+sys/src/cmd/file.c - 664 sys sys 1079372472 21344
 sys/src/cmd/fmt.c - 664 sys sys 1070032009 4088
 sys/src/cmd/fortune.c - 664 sys sys 1072729222 1779
 sys/src/cmd/fossil - 20000000775 sys sys 1042005512 0
@@ -9749,7 +9749,7 @@ sys/src/cmd/mv.c - 664 sys sys 1014926695 4276
 sys/src/cmd/ndb - 20000000775 sys sys 988249988 0
 sys/src/cmd/ndb/convDNS2M.c - 664 sys sys 1060612175 6862
 sys/src/cmd/ndb/convM2DNS.c - 664 sys sys 1060612175 7248
-sys/src/cmd/ndb/cs.c - 664 sys sys 1078840015 33033
+sys/src/cmd/ndb/cs.c - 664 sys sys 1079357413 33069
 sys/src/cmd/ndb/csgetval.c - 664 sys sys 957402051 1051
 sys/src/cmd/ndb/csquery.c - 664 sys sys 1014926159 1062
 sys/src/cmd/ndb/dblookup.c - 664 sys sys 1078927860 18090
@@ -10511,7 +10511,7 @@ sys/src/cmd/telco/mkfile - 664 sys sys 944961290 201
 sys/src/cmd/telco/telco.c - 664 sys sys 1021579996 26253
 sys/src/cmd/telco/telcodata - 775 sys sys 944961290 95
 sys/src/cmd/telco/telcofax - 664 sys sys 944961289 30
-sys/src/cmd/test.c - 664 sys sys 1070459150 5319
+sys/src/cmd/test.c - 664 sys sys 1079372543 5409
 sys/src/cmd/time.c - 664 sys sys 1014926662 1546
 sys/src/cmd/tlsclient.c - 664 sys sys 1024375149 1631
 sys/src/cmd/tlssrv.c - 664 sys sys 1018720167 3254
@@ -10929,7 +10929,7 @@ sys/src/cmd/upas/unesc/mkfile - 664 sys sys 1075080255 164
 sys/src/cmd/upas/unesc/unesc.c - 664 sys sys 1075080255 789
 sys/src/cmd/upas/vf - 20000000775 sys sys 1015096796 0
 sys/src/cmd/upas/vf/mkfile - 664 sys sys 1064393881 241
-sys/src/cmd/upas/vf/vf.c - 664 sys sys 1079323044 17391
+sys/src/cmd/upas/vf/vf.c - 664 sys sys 1079357412 17391
 sys/src/cmd/usb - 20000000775 sys sys 1017802022 0
 sys/src/cmd/usb/audio - 20000000775 sys sys 1017802021 0
 sys/src/cmd/usb/audio/audioclass.h - 664 sys sys 1017802021 5463
@@ -11931,7 +11931,7 @@ sys/src/libhttpd/date.c - 664 sys sys 1045502928 3507
 sys/src/libhttpd/escape.h - 664 sys sys 1014930784 2728
 sys/src/libhttpd/fail.c - 664 sys sys 1014930784 2794
 sys/src/libhttpd/gethead.c - 664 sys sys 1014930784 733
-sys/src/libhttpd/hio.c - 664 sys sys 1032633473 7300
+sys/src/libhttpd/hio.c - 664 sys sys 1079372798 7482
 sys/src/libhttpd/httpfmt.c - 664 sys sys 1014930784 472
 sys/src/libhttpd/httpunesc.c - 664 sys sys 1014930784 888
 sys/src/libhttpd/lower.c - 664 sys sys 1014930784 226

+ 15 - 0
dist/replica/plan9.log

@@ -14648,3 +14648,18 @@
 1079116211 0 c sys/src/cmd/acme/text.c - 664 sys sys 1079115968 27284
 1079323248 0 c sys/src/cmd/upas/smtp/smtpd.c - 664 sys sys 1079323038 27764
 1079323248 1 c sys/src/cmd/upas/vf/vf.c - 664 sys sys 1079323044 17391
+1079376349 0 m acme/news/src - 20000000775 sys sys 1039727911 0
+1079376349 1 m lib/sky - 20000000775 sys sys 1079376081 0
+1079376349 2 m lib/sky/ngc2000.scat - 664 sys sys 954015747 0
+1079376349 3 c sys/include/httpd.h - 664 sys sys 1079372798 5747
+1079376349 4 c sys/man/1/chmod - 664 sys sys 1079372922 1299
+1079376349 5 c sys/man/1/ls - 664 sys sys 1079372922 2897
+1079376349 6 c sys/man/1/test - 664 sys sys 1079372544 3535
+1079376349 7 m sys/src/ape/cmd/make-3.79 - 20000000775 sys sys 1039727530 0
+1079376349 8 c sys/src/cmd/ndb/cs.c - 664 sys sys 1079357413 33069
+1079376349 9 c sys/src/cmd/chmod.c - 664 sys sys 1079372923 1904
+1079376349 10 c sys/src/cmd/upas/vf/vf.c - 664 sys sys 1079357412 17391
+1079376349 11 c sys/src/cmd/file.c - 664 sys sys 1079372472 21344
+1079376349 12 c sys/src/cmd/test.c - 664 sys sys 1079372543 5409
+1079376349 13 c sys/src/libhttpd/hio.c - 664 sys sys 1079372798 7482
+1079376349 14 c dist/replica/plan9.proto - 664 sys sys 1079376335 2533

+ 85 - 9
dist/replica/plan9.proto

@@ -9,15 +9,16 @@ adm	- adm adm
 mail	- upas upas
 	box	- upas upas
 		glenda	- glenda glenda
-			+	- glenda glenda
-	faxoutqueue	- upas upas
-	faxqueue	- upas upas
-		+	- upas upas
+			L.mbox	l666 glenda glenda
+			mbox	a662 glenda glenda
+	faxoutqueue	d777 upas upas
+	faxqueue	d777 upas upas
+		*	- upas upas
 	fs	- upas upas
 	lib	- upas upas
 		+	- upas upas
-	queue	- upas upas
-	tmp	- upas upas
+	queue	d777 upas upas
+	tmp	d777 upas upas
 
 # glenda owns her home directory
 usr	- sys sys
@@ -49,7 +50,7 @@ sparc	- sys sys
 # everything else is owned by sys
 acme	- sys sys
 	+	- sys sys
-cron	- sys sys
+cron	d777 sys sys
 	upas	- upas sys
 		+	- upas sys
 fd	- sys sys
@@ -59,7 +60,10 @@ env	- sys sys
 lib	- sys sys
 	+	- sys sys
 lp	- sys sys
-	+	- sys sys
+	log	d777 sys sys
+	prob	d777 sys sys
+	queue	d777 sys sys
+	tmp	d777 sys sys
 mnt	- sys sys
 	+	- sys sys
 n	- sys sys
@@ -67,7 +71,79 @@ n	- sys sys
 rc	- sys sys
 	+	- sys sys
 sys	- sys sys
-	+	- sys sys
+	doc	- sys sys
+		+	- sys sys
+	games	- sys sys
+		+	- sys sys
+	include	- sys sys
+		+	- sys sys
+	lib	- sys sys
+		*	- sys sys
+		acid	- sys sys
+			+	- sys sys
+		antiword	- sys sys
+			+	- sys sys
+		astar	- sys sys
+			+	- sys sys
+		dist	- sys sys
+			+	- sys sys
+		fax	- sys sys
+			+	- sys sys
+		ghostscript	- sys sys
+			+	- sys sys
+		lex	- sys sys
+			+	- sys sys
+		lp	- sys sys
+			*	- sys sys
+			bin	- sys sys
+				+	- sys sys
+			daemon	- sys sys
+				+	- sys sys
+			kill	- sys sys
+				+	- sys sys
+			log	d777 sys sys
+			perm	- sys sys
+				+	- sys sys
+			process	- sys sys
+				+	- sys sys
+			sched	- sys sys
+				+	- sys sys
+			spooler	- sys sys
+				+	- sys sys
+			stat	- sys sys
+				+	- sys sys
+			tmp	d777 sys sys
+		man	- sys sys
+			+	- sys sys
+		plumb	- sys sys
+			+	- sys sys
+		postscript	- sys sys
+			+	- sys sys
+		scribble	- sys sys
+			+	- sys sys
+		ssh	- sys sys
+			+	- sys sys
+		sysconfig	- sys sys
+			+	- sys sys
+		texmf	- sys sys
+			+	- sys sys
+		tls	- sys sys
+			+	- sys sys
+		tmac	- sys sys
+			+	- sys sys
+		troff	- sys sys
+			+	- sys sys
+		wiki	- sys sys
+			+	- sys sys
+	log	- sys sys
+		*	a666 sys sys 
+		timesync.d	d775 sys sys
+		httpd	- sys sys
+			*	666 sys sys
+	man	- sys sys
+		+	- sys sys
+	src	- sys sys
+		+	- sys sys
 tmp	- sys sys
 	+	- sys sys
 

+ 156 - 0
dist/replica/plan9x.proto

@@ -0,0 +1,156 @@
+# files like NOTICE
+*	- sys sys
+
+# adm owns adm
+adm	- adm adm
+	+	- adm adm
+
+# upas owns mail
+mail	- upas upas
+	box	- upas upas
+		glenda	- glenda glenda
+			L.mbox	l666 glenda glenda
+			mbox	a662 glenda glenda
+	faxoutqueue	d777 upas upas
+	faxqueue	d777 upas upas
+		*	- upas upas
+	fs	- upas upas
+	lib	- upas upas
+		+	- upas upas
+	queue	d777 upas upas
+	tmp	d777 upas upas
+
+# glenda owns her home directory
+usr	- sys sys
+	glenda	- glenda glenda
+		+	- glenda glenda
+
+# architectures owned by sys
+29000	- sys sys
+	+	- sys sys
+386	- sys sys
+	+	- sys sys
+68000	- sys sys
+	+	- sys sys
+68020	- sys sys
+	+	- sys sys
+960	- sys sys
+	+	- sys sys
+alpha	- sys sys
+	+	- sys sys
+arm	- sys sys
+	+	- sys sys
+mips	- sys sys
+	+	- sys sys
+power	- sys sys
+	+	- sys sys
+sparc	- sys sys
+	+	- sys sys
+
+# everything else is owned by sys
+acme	- sys sys
+	+	- sys sys
+cron	d777 sys sys
+	upas	- upas sys
+		+	- upas sys
+fd	- sys sys
+	+	- sys sys
+env	- sys sys
+	+	- sys sys
+lib	- sys sys
+	+	- sys sys
+lp	- sys sys
+	log	d777 sys sys
+	prob	d777 sys sys
+	queue	d777 sys sys
+	tmp	d777 sys sys
+mnt	- sys sys
+	+	- sys sys
+n	- sys sys
+	+	- sys sys
+rc	- sys sys
+	+	- sys sys
+sys	- sys sys
+	doc	- sys sys
+		+	- sys sys
+	games	- sys sys
+		+	- sys sys
+	include	- sys sys
+		+	- sys sys
+	lib	- sys sys
+		*	- sys sys
+		acid	- sys sys
+			+	- sys sys
+		antiword	- sys sys
+			+	- sys sys
+		astar	- sys sys
+			+	- sys sys
+		dist	- sys sys
+			+	- sys sys
+		fax	- sys sys
+			+	- sys sys
+		ghostscript	- sys sys
+			+	- sys sys
+		lex	- sys sys
+			+	- sys sys
+		lp	- sys sys
+			bin	- sys sys
+				+	- sys sys
+			daemon	- sys sys
+				+	- sys sys
+			kill	- sys sys
+				+	- sys sys
+			log	d777 sys sys
+			perm	- sys sys
+				+	- sys sys
+			process	- sys sys
+				+	- sys sys
+			sched	- sys sys
+				+	- sys sys
+			spooler	- sys sys
+				+	- sys sys
+			stat	- sys sys
+				+	- sys sys
+			tmp	d777 sys sys
+			*	- sys sys
+		man	- sys sys
+			+	- sys sys
+		plumb	- sys sys
+			+	- sys sys
+		postscript	- sys sys
+			+	- sys sys
+		scribble	- sys sys
+			+	- sys sys
+		ssh	- sys sys
+			+	- sys sys
+		sysconfig	- sys sys
+			+	- sys sys
+		texmf	- sys sys
+			+	- sys sys
+		tls	- sys sys
+			+	- sys sys
+		tmac	- sys sys
+			+	- sys sys
+		troff	- sys sys
+			+	- sys sys
+		wiki	- sys sys
+			+	- sys sys
+	log	- sys sys
+		*	a666 sys sys 
+		httpd	- sys sys
+			*	666 sys sys
+	man	- sys sys
+		+	- sys sys
+	src	- sys sys
+		+	- sys sys
+tmp	- sys sys
+	+	- sys sys
+
+# distribution metadata
+dist	- sys sys
+	replica	- sys sys
+		kfs	- sys sys
+		cd	- sys sys
+		network	- sys sys
+		plan9.proto	- sys sys
+

+ 32 - 3
rc/bin/ipso

@@ -11,6 +11,9 @@ editor = (acme -c1)
 name = secstore
 get = secstoreget
 put = secstoreput
+edit = no
+load = no
+flush = no
 
 fn secstoreget{
 	auth/secstore -i -g $1 <_password
@@ -50,13 +53,31 @@ while(~ $1 -*){
 		name = aescbc
 		get = aesget
 		put = aesput
+	case -f
+		flush = yes
+	case -e
+		edit = yes
+	case -l
+		load = yes
 	case *
-		echo >[2=1] 'usage: ipso [-s] [file ...]'
+		echo >[2=1] 'usage: ipso [-a -f -e -l] [-s] [file ...]'
 		exit usage
 	}
 	shift
 }
 
+if(~ $flush no && ~ $edit no && ~ $load no){
+	load = yes
+	edit = yes
+	flush = yes
+}
+
+if(~ $flush yes && ~ $edit no && ~ $load no){
+	echo flushing old keys
+	echo delkey > /mnt/factotum/ctl
+	exit 0
+}
+
 if(~ $get aesget && ~ $#* 0){
 	echo >[2=1] ipso: must specify a fully qualified file name for aescbc '(-a)'
 	exit usage
@@ -68,7 +89,7 @@ unmount /mnt/plumb
 bind -c /tmp /srv
 cd /tmp
 
-echo '
+if ( ~ $edit yes ) echo '
 	Warning: The editor will display the secret contents of
 	your '$name' files in the clear.
 '
@@ -103,7 +124,15 @@ for(i in $files){
 sleep 2; date > _timestamp	# so we can find which files have been edited.
 
 # edit the files
-$editor `{for(i in $files) basename $i}
+if(~ $edit yes) $editor `{for(i in $files) basename $i}
+if(~ $flush yes ){
+	echo flushing old keys
+	echo delkey > /mnt/factotum/ctl
+}
+if(~ $load yes){
+	echo loading factotum keys
+	if (~ factotum $files) read -m < factotum > /mnt/factotum/ctl
+}
 
 # copy the files back
 for(i in `{editedfiles}){

+ 1 - 0
sys/include/httpd.h

@@ -229,6 +229,7 @@ int			hgetc(Hio*);
 int			hgethead(HConnect *c, int many);
 int			hinit(Hio*, int, int);
 int			hiserror(Hio *h);
+int			hlflush(Hio*);
 int			hload(Hio*, char*);
 char			*hlower(char*);
 HContent		*hmkcontent(HConnect *c, char *generic, char *specific, HContent *next);

+ 1 - 1
sys/man/1/ar

@@ -119,7 +119,7 @@ showing
 .IP
 .B
 	mode uid/gid size date name
-.TP
+.\" .TP
 .\" .B c
 .\" Create.
 .\" Normally

+ 4 - 2
sys/man/1/chmod

@@ -90,9 +90,11 @@ is any combination of the letters
 (execute),
 .B a
 (append only),
-and
 .B l
-(exclusive access).
+(exclusive access),
+and
+.B t
+(temporary file).
 .PP
 Only the owner of a file or the group leader of its group
 may change the file's mode.

+ 8 - 1
sys/man/1/ls

@@ -89,7 +89,14 @@ after all directory names
 and the character
 .B *
 after all executable files.
-.PP
+.TP
+.B -L
+Print the character
+.B t
+before each file if it has the temporary flag set, and
+.B -
+otherwise.
+.TP
 .B -Q
 By default, printed file names are quoted if they contain characters special to
 .IR rc (1).

+ 17 - 1
sys/man/1/secstore

@@ -45,7 +45,7 @@ aescbc, secstore, ipso \- secstore commands
 .PP
 .B ipso
 [
-.B -as
+.B -a -e -l -f -s
 ] [
 .I file
 \&...
@@ -152,6 +152,22 @@ grabs all the user's files from
 .I secstore
 for editing.
 .PP
+By default, ipso will edit the
+.I secstore
+files and, if
+one of them is named
+.BR factotum ,
+flush your current keys from factotum and load
+the new ones from the file.
+If you supply any of the
+.BR -e ,
+.BR -f ,
+or
+.BR -l
+options,
+.I ipso
+will just perform the operations you requested, i.e.,
+edit, flush, and/or load.
 .PP
 The
 .B -s

+ 3 - 0
sys/man/1/test

@@ -50,6 +50,9 @@ True if the file exists and is append-only.
 .BI -L " file"
 True if the file exists and is exclusive-use.
 .TP
+.BI -T "file"
+True if the file exists and is temporary.
+.TP
 .IB s1 " = " s2
 True
 if the strings

+ 6 - 8
sys/src/9/pc/ether83815.c

@@ -659,21 +659,19 @@ eeidle(Ctlr *ctlr)
 static int
 eegetw(Ctlr *ctlr, int a)
 {
-	int d, i, w;
+	int d, i, w, v;
 
 	eeidle(ctlr);
 	eeclk(ctlr, 0);
 	eeclk(ctlr, Eeclk);
 	d = 0x180 | a;
 	for(i=0x400; i; i>>=1){
-		if(d & i)
-			csr32w(ctlr, Rmear, Eesel|Eedi);
-		else
-			csr32w(ctlr, Rmear, Eesel);
-		eeclk(ctlr, Eeclk);
-		eeclk(ctlr, 0);
-		microdelay(2);
+		v = (d & i) ? Eedi : 0;
+		eeclk(ctlr, v);
+		eeclk(ctlr, Eeclk|v);
 	}
+	eeclk(ctlr, 0);
+
 	w = 0;
 	for(i=0x8000; i; i >>= 1){
 		eeclk(ctlr, Eeclk);

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

@@ -19,7 +19,7 @@ main(int argc, char *argv[])
 	char *p;
 
 	if(argc < 3){
-		fprint(2, "usage: chmod 0777 file ... or chmod [who]op[rwxal] file ...\n");
+		fprint(2, "usage: chmod 0777 file ... or chmod [who]op[rwxalt] file ...\n");
 		exits("usage");
 	}
 	mode = strtol(argv[1], &p, 8);

+ 44 - 0
sys/src/cmd/file.c

@@ -157,6 +157,7 @@ int	isp9bit(void);
 int	isp9font(void);
 int	isrtf(void);
 int	ismsdos(void);
+int	iself(void);
 int	istring(void);
 int	long0(void);
 int	p9bitnum(uchar*);
@@ -183,6 +184,7 @@ int	(*call[])(void) =
 	isenglish,	/* char frequency English */
 	isrtf,		/* rich text format */
 	ismsdos,	/* msdos exe (virus file attachement) */
+	iself,		/* ELF (foreign) executable */
 	0
 };
 
@@ -1132,3 +1134,45 @@ ismsdos(void)
 	}
 	return 0;
 }
+
+int
+iself(void)
+{
+	char *cpu[] = {		/* NB: incomplete and arbitary list */
+	[1]	"WE32100",
+	[2]	"SPARC",
+	[3]	"i386",
+	[4]	"M68000",
+	[5]	"M88000",
+	[6]	"i486",
+	[7]	"i860",
+	[8]	"R3000",
+	[9]	"S370",
+	[10]	"R4000",
+	[15]	"HP-PA",
+	[18]	"sparc v8+",
+	[19]	"i960",
+	[20]	"PPC-32",
+	[21]	"PPC-64",
+	[40]	"ARM",
+	[41]	"Alpha",
+	[43]	"sparc v9",
+	[50]	"IA-46",
+	[62]	"AMD x86-64",
+	[75]	"VAX",
+	};
+
+
+	if (memcmp(buf, "\x7fELF", 4) == 0){
+		if (!mime){
+			int n = (buf[19] << 8) | buf[18];
+			char *p = (n > 0 && n < nelem(cpu) && cpu[n])? cpu[n]: "unknown";
+			print("%s ELF executable\n", p);
+		}
+		else
+			print("application/x-elf-executable");
+		return 1;
+	}
+
+	return 0;
+}

+ 6 - 3
sys/src/cmd/ndb/cs.c

@@ -1018,11 +1018,12 @@ ipid(void)
 					}
 				}
 			}
-			for(tt = t; tt != nil; tt = tt->entry)
-				if(strcmp(t->attr, "sys") == 0){
-					mysysname = strdup(t->val);
+			for(tt = t; tt != nil; tt = tt->entry){
+				if(strcmp(tt->attr, "sys") == 0){
+					mysysname = strdup(tt->val);
 					break;
 				}
+			}
 			ndbfree(t);
 		}
 
@@ -1274,6 +1275,8 @@ ipserv(Network *np, char *name, char *buf, int blen)
 	p = nil;
 	if(alpha){
 		p = ndbgetvalue(db, &s, np->net, name, "port", &t);
+		if(p == nil)
+			return 0;
 	} else {
 		/* look up only for tcp ports < 1024 to get the restricted
 		 * attribute

+ 4 - 0
sys/src/cmd/test.c

@@ -6,6 +6,7 @@
  * Plan 9 additions:
  *	-A file exists and is append-only
  *	-L file exists and is exclusive-use
+ *	-T file exists and is temporary
  */
 
 #include <u.h>
@@ -115,6 +116,9 @@ e3(void) {
 	if(EQ(a, "-L"))
 		return(hasmode(nxtarg(0), DMEXCL));
 
+	if(EQ(a, "-T"))
+		return(hasmode(nxtarg(0), DMTMP));
+
 	if(EQ(a, "-f"))
 		return(isreg(nxtarg(0)));
 

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

@@ -340,7 +340,7 @@ save(Part *p)
 	seek(fd, 0, 2);
 	Binit(&out, fd, OWRITE);
 	cp = ctime(time(0));
-	cp[20] = 0;
+	cp[28] = 0;
 	Bprint(&out, "From virusfilter %s\n", cp);
 	writeheader(p);
 	passbody(p, 1);

+ 22 - 0
sys/src/cmd/wikifs/fs.c

@@ -19,6 +19,7 @@ enum {
 	Qedithtml,
 	Qwerrorhtml,
 	Qwerrortxt,
+	Qhttplogin,
 	Nfile,
 };
 
@@ -32,6 +33,7 @@ static char *filelist[] = {
 	"edit.html",
 	"werror.html",
 	"werror.txt",
+	".httplogin",
 };
 
 static int needhist[Nfile] = {
@@ -112,6 +114,23 @@ fsattach(Req *r)
 	respond(r, nil);
 }
 
+static String *
+httplogin(void)
+{
+	String *s=s_new();
+	Biobuf *b;
+
+	if((b = wBopen(".httplogin", OREAD)) == nil)
+		goto Return;
+
+	while(s_read(b, s, Bsize) > 0)
+		;
+	Bterm(b);
+
+Return:
+	return s;
+}
+
 static char*
 fswalk1(Fid *fid, char *name, Qid *qid)
 {
@@ -252,6 +271,9 @@ Gotfile:
 	case Qwerrortxt:
 		s = totext(a->w, a->w->doc+a->n, Twerror);
 		break;
+	case Qhttplogin:
+		s = httplogin();
+		break;
 	default:
 		return "internal error";
 	}

+ 10 - 6
sys/src/cmd/wikifs/tohtml.c

@@ -96,9 +96,11 @@ gettemplate(int type)
 		goto Return;
 
 	ns = s_reset(nil);
-	n = s_read(b, ns, 10000);
+	do
+		n = s_read(b, ns, Bsize);
+	while(n > 0);
 	Bterm(b);
-	if(n <= 0)
+	if(n < 0)
 		goto Return;
 
 	s_free(cache[type].s);
@@ -540,6 +542,7 @@ s_appendbrk(String *s, char *p, char *prefix, int dosharp)
 {
 	char *e, *w, *x;
 	int first, l;
+	Rune r;
 
 	first = 1;
 	while(*p){
@@ -549,11 +552,12 @@ s_appendbrk(String *s, char *p, char *prefix, int dosharp)
 			e = s_to_c(s);
 		else
 			e++;
-		l = utflen(e);
-		if(l <= LINELEN)
+		if(utflen(e) <= LINELEN)
 			break;
-		/* BUG: should be LINELEN utf chars not LINELEN bytes */
-		x = strchr(e+LINELEN, ' ');
+		x = e; l=LINELEN;
+		while(l--)
+			x+=chartorune(&r,x);
+		x = strchr(x, ' ');
 		if(x){
 			*x = '\0';
 			w = strrchr(e, ' ');

+ 16 - 2
sys/src/libhttpd/hio.c

@@ -391,8 +391,8 @@ hprint(Hio *h, char *fmt, ...)
 	return n;
 }
 
-int
-hflush(Hio *h)
+static int
+_hflush(Hio* h, int dolength)
 {
 	uchar *s;
 	int w;
@@ -415,6 +415,8 @@ hflush(Hio *h)
 		h->pos[1] = '\n';
 		w = &h->pos[2] - s;
 	}
+	if (dolength)
+		fprint(h->fd, "Content-Length: %d\r\n\r\n", w);
 	if(write(h->fd, s, w) != w){
 		h->state = Herr;
 		h->stop = h->pos;
@@ -425,6 +427,18 @@ hflush(Hio *h)
 	return 0;
 }
 
+int
+hflush(Hio *h)
+{
+	return _hflush(h, 0);
+}
+
+int
+hlflush(Hio* h)
+{
+	return _hflush(h, 1);
+}
+
 int
 hwrite(Hio *h, void *vbuf, int len)
 {