unix: move man pages in unix ports
diff --git a/unix/make/Makefile.MID b/unix/make/Makefile.MID
index 9c142d4..71a9d01 100644
--- a/unix/make/Makefile.MID
+++ b/unix/make/Makefile.MID
@@ -31,11 +31,11 @@
 all: $(LIB)
 
 install: $(LIB)
-	test -d $(PREFIX)/man/man3 || mkdir $(PREFIX)/man/man3
-	install -c -m 0644 isalpharune.3 $(PREFIX)/man/man3/isalpharune.3
+	test -d $(PREFIX)/share/man/man3 || mkdir $(PREFIX)/share/man/man3
+	install -c -m 0644 isalpharune.3 $(PREFIX)/share/man/man3/isalpharune.3
 	install -c -m 0644 utf.7 $(PREFIX)/man/man7/utf.7
-	install -c -m 0644 rune.3 $(PREFIX)/man/man3/rune.3
-	install -c -m 0644 runestrcat.3 $(PREFIX)/man/man3/runestrcat.3
+	install -c -m 0644 rune.3 $(PREFIX)/share/man/man3/rune.3
+	install -c -m 0644 runestrcat.3 $(PREFIX)/share/man/man3/runestrcat.3
 	install -c -m 0644 utf.h $(PREFIX)/include/utf.h
 	install -c -m 0644 $(LIB) $(PREFIX)/lib/$(LIB)
 
diff --git a/unix/make/Makefile.bio b/unix/make/Makefile.bio
index 00a0b69..f862aac 100644
--- a/unix/make/Makefile.bio
+++ b/unix/make/Makefile.bio
@@ -28,8 +28,8 @@
 all: $(LIB)
 
 install: $(LIB)
-	mkdir -p $(PREFIX)/man/man3
-	install -m 0644 bio.3 $(PREFIX)/man/man3/bio.3
+	mkdir -p $(PREFIX)/share/man/man3
+	install -m 0644 bio.3 $(PREFIX)/share/man/man3/bio.3
 	mkdir -p $(PREFIX)/include
 	install -m 0644 bio.h $(PREFIX)/include
 	mkdir -p $(PREFIX)/lib
diff --git a/unix/make/Makefile.fmt b/unix/make/Makefile.fmt
index 3a07840..2cf5f62 100644
--- a/unix/make/Makefile.fmt
+++ b/unix/make/Makefile.fmt
@@ -17,6 +17,7 @@
 	fmtfdflush.$O\
 	fmtlocale.$O\
 	fmtlock.$O\
+	fmtnull.$O\
 	fmtprint.$O\
 	fmtquote.$O\
 	fmtrune.$O\
@@ -51,9 +52,9 @@
 all: $(LIB)
 
 install: $(LIB)
-	test -d $(PREFIX)/man/man3 || mkdir -p $(PREFIX)/man/man3
-	install -m 0644 print.3 $(PREFIX)/man/man3/print.3
-	install -m 0644 fmtinstall.3 $(PREFIX)/man/man3/fmtinstall.3
+	test -d $(PREFIX)/share/man/man3 || mkdir -p $(PREFIX)/share/man/man3
+	install -m 0644 print.3 $(PREFIX)/share/man/man3/print.3
+	install -m 0644 fmtinstall.3 $(PREFIX)/share/man/man3/fmtinstall.3
 	mkdir -p $(PREFIX)/include
 	install -m 0644 fmt.h $(PREFIX)/include/fmt.h
 	mkdir -p $(PREFIX)/lib
diff --git a/unix/make/Makefile.regexp b/unix/make/Makefile.regexp
index fae24c5..f4c862d 100644
--- a/unix/make/Makefile.regexp
+++ b/unix/make/Makefile.regexp
@@ -19,8 +19,8 @@
 all: $(LIB)
 
 install: $(LIB)
-	mkdir -p $(PREFIX)/man/man3 $(PREFIX)/man/man7
-	install -m 0644 regexp9.3 $(PREFIX)/man/man3/regexp9.3
+	mkdir -p $(PREFIX)/share/man/man3 $(PREFIX)/man/man7
+	install -m 0644 regexp9.3 $(PREFIX)/share/man/man3/regexp9.3
 	install -m 0644 regexp9.7 $(PREFIX)/man/man7/regexp9.7
 	mkdir -p $(PREFIX)/lib
 	install -m 0644 $(LIB) $(PREFIX)/lib/$(LIB)
diff --git a/unix/make/Makefile.utf b/unix/make/Makefile.utf
index 10e7230..78601bb 100644
--- a/unix/make/Makefile.utf
+++ b/unix/make/Makefile.utf
@@ -31,11 +31,11 @@
 all: $(LIB)
 
 install: $(LIB)
-	mkdir -p $(PREFIX)/man/man3 $(PREFIX)/man/man7
-	install -c -m 0644 isalpharune.3 $(PREFIX)/man/man3/isalpharune.3
+	mkdir -p $(PREFIX)/share/man/man3 $(PREFIX)/man/man7
+	install -c -m 0644 isalpharune.3 $(PREFIX)/share/man/man3/isalpharune.3
 	install -c -m 0644 utf.7 $(PREFIX)/man/man7/utf.7
-	install -c -m 0644 rune.3 $(PREFIX)/man/man3/rune.3
-	install -c -m 0644 runestrcat.3 $(PREFIX)/man/man3/runestrcat.3
+	install -c -m 0644 rune.3 $(PREFIX)/share/man/man3/rune.3
+	install -c -m 0644 runestrcat.3 $(PREFIX)/share/man/man3/runestrcat.3
 	mkdir -p $(PREFIX)/include
 	install -c -m 0644 utf.h $(PREFIX)/include/utf.h
 	mkdir -p $(PREFIX)/lib
diff --git a/unix/mkfile b/unix/mkfile
index 3d9d35a..42560bb 100644
--- a/unix/mkfile
+++ b/unix/mkfile
@@ -17,14 +17,14 @@
 	t=$stem
 	path=($PLAN9/bin $path)
 	mk new-$t
-	cd $t
 	switch($t){
-	case bio;	d=libbio
-	case regexp;	d=libregexp
-	case fmt;	d=lib9/fmt
-	case utf:	d=lib9/utf
-	case mk;	d=cmd/mk
+	case bio;	d=libbio; td=libbio
+	case regexp;	d=libregexp; td=libregexp
+	case fmt;	d=lib9/fmt; td=libfmt
+	case utf;	d=lib9/utf; td=libutf
+	case mk;	d=cmd/mk; td=mk
 	}
+	cd $td
 	d=$PLAN9/src/$d
 	for(i in `{ls -p $d/*.c})
 		if(! test -f $i)
@@ -34,7 +34,7 @@
 		if(! test -f `{echo $i | sed 's/.c$/.o/'})
 			echo XXX not building $i
 	cd ..
-	rm -r $t
+	rm -r $td
 
 lib%.tgz:V:
 	mk new-$stem
diff --git a/unix/mkfile.fmt b/unix/mkfile.fmt
index c85852c..d88525e 100644
--- a/unix/mkfile.fmt
+++ b/unix/mkfile.fmt
@@ -1,10 +1,12 @@
 MAKEALL=`{cd ../make; ls Make.*}
+CFILES=`{9 ls -p $PLAN9/src/lib9/fmt/*.c}
+CFILES1=`{9 ls -p $PLAN9/src/lib9/fmt/*.c |grep -v test}
 TARG=\
 	$MAKEALL\
+	$CFILES\
 	NOTICE\
 	README\
 	Makefile\
-	`{9 ls -p $PLAN9/src/lib9/fmt/*.c}\
 	fmt.h\
 	fmtdef.h\
 	nan.h\
@@ -19,3 +21,17 @@
 %: $PLAN9/src/lib9/fmt/%
 	cp $prereq $target
 
+fmt1.c: plan9.h $CFILES1
+	(echo '#include <stdarg.h>'; \
+	 echo '#include <string.h>'; \
+	 echo '#include <stdlib.h>'; \
+	 echo '#include <errno.h>'; \
+	 echo '#include <limits.h>'; \
+	 echo '#include <math.h>'; \
+	 echo '#include <float.h>'; \
+	 cat plan9.h; \
+	 echo '#include "utf.h"'; \
+	 echo '#include "fmt.h"'; \
+	 cat fmtdef.h; \
+	 grep -hv '^#include' $CFILES1) >$target
+
diff --git a/unix/mkfile.utf b/unix/mkfile.utf
index 581c4e0..a001da4 100644
--- a/unix/mkfile.utf
+++ b/unix/mkfile.utf
@@ -1,10 +1,11 @@
 MAKEALL=`{cd ../make; ls Make.*}
+CFILES=`{9 ls -p $PLAN9/src/lib9/utf/*.c}
 TARG=\
 	$MAKEALL\
 	NOTICE\
 	README\
 	Makefile\
-	`{9 ls -p $PLAN9/src/lib9/utf/*.c}\
+	$CFILES\
 	plan9.h\
 	utf.h\
 	utfdef.h\
@@ -23,3 +24,12 @@
 %: $PLAN9/src/lib9/utf/%
 	cp $prereq $target
 
+utf1.c:D: plan9.h $CFILES
+	(cat plan9.h; \
+	 echo '#include <stdlib.h>'; \
+	 echo '#include <string.h>'; \
+	 echo '#include <unistd.h>'; \
+	 echo '#define bsearch utf_bsearch'; \
+	 echo '#include "utf.h"'; \
+	 grep -hv '^#include' $CFILES) >$target
+