code: purgatorio

Download patch

ref: dd16eef8365cb0b9e4805c23291aadcaa596dd87
parent: e59ffed426f628794d4669f152eff9a6239b99db
author: henesy <devnull@localhost>
date: Wed Oct 2 18:01:40 EDT 2019

stop tracking .dis files in /dis ;; fix makestubs(1) ;; remove powerman's /opt as it requires too much modification to integrate nicely, this was broken completely previously ;; add games/bf from pete elmore ;; update /lib/emptydirs

diff: cannot open b/appl/cmd/games//null: file does not exist: 'b/appl/cmd/games//null' diff: cannot open a/dis/alphabet/abc//null: file does not exist: 'a/dis/alphabet/abc//null' diff: cannot open a/dis/alphabet/fs//null: file does not exist: 'a/dis/alphabet/fs//null' diff: cannot open a/dis/alphabet/grid//null: file does not exist: 'a/dis/alphabet/grid//null' diff: cannot open a/dis/alphabet/main//null: file does not exist: 'a/dis/alphabet/main//null' diff: cannot open a/dis/alphabet//null: file does not exist: 'a/dis/alphabet//null' diff: cannot open a/dis/dbm//null: file does not exist: 'a/dis/dbm//null' diff: cannot open a/dis/ip/nppp//null: file does not exist: 'a/dis/ip/nppp//null' diff: cannot open a/dis/palm//null: file does not exist: 'a/dis/palm//null' diff: cannot open a/opt/misc/appl//null: file does not exist: 'a/opt/misc/appl//null' diff: cannot open a/opt/misc/dis//null: file does not exist: 'a/opt/misc/dis//null' diff: cannot open a/opt/misc//null: file does not exist: 'a/opt/misc//null' diff: cannot open a/opt/mkfiles//null: file does not exist: 'a/opt/mkfiles//null' diff: cannot open a/opt/setup//null: file does not exist: 'a/opt/setup//null' diff: cannot open a/opt/skel/appl/cmd/t//null: file does not exist: 'a/opt/skel/appl/cmd/t//null' diff: cannot open a/opt/skel/appl/cmd//null: file does not exist: 'a/opt/skel/appl/cmd//null' diff: cannot open a/opt/skel/appl/lib/t//null: file does not exist: 'a/opt/skel/appl/lib/t//null' diff: cannot open a/opt/skel/appl/lib//null: file does not exist: 'a/opt/skel/appl/lib//null' diff: cannot open a/opt/skel/appl//null: file does not exist: 'a/opt/skel/appl//null' diff: cannot open a/opt/skel/dis/cmd//null: file does not exist: 'a/opt/skel/dis/cmd//null' diff: cannot open a/opt/skel/dis/lib//null: file does not exist: 'a/opt/skel/dis/lib//null' diff: cannot open a/opt/skel/dis//null: file does not exist: 'a/opt/skel/dis//null' diff: cannot open a/opt/skel/doc/1//null: file does not exist: 'a/opt/skel/doc/1//null' diff: cannot open a/opt/skel/doc/2//null: file does not exist: 'a/opt/skel/doc/2//null' diff: cannot open a/opt/skel/doc//null: file does not exist: 'a/opt/skel/doc//null' diff: cannot open a/opt/skel/man/1//null: file does not exist: 'a/opt/skel/man/1//null' diff: cannot open a/opt/skel/man/2//null: file does not exist: 'a/opt/skel/man/2//null' diff: cannot open a/opt/skel/man//null: file does not exist: 'a/opt/skel/man//null' diff: cannot open a/opt/skel/module//null: file does not exist: 'a/opt/skel/module//null' diff: cannot open a/opt/skel//null: file does not exist: 'a/opt/skel//null' diff: cannot open a/opt//null: file does not exist: 'a/opt//null'
--- a/.hgignore
+++ b/.hgignore
@@ -55,6 +55,8 @@
 tmp/*
 
 syntax: regexp
+^dis/.*.dis
+^dis/*/.*.dis
 ^appl/.*.dis
 ^appl/.*.sbl
 ^tmp/.*
--- /dev/null
+++ b/appl/cmd/games/bf.b
@@ -1,0 +1,265 @@
+# Interpreter for the canonical esoteric language.
+# Compiles to bytecode, minimal optimizations, done for fun.
+# Pete Elmore (pete at debu dot gs), New Year's Day 2014
+# Released into the public domain.
+
+implement Bf;
+
+include "sys.m"; sys: Sys;
+include "draw.m";
+include "arg.m";
+
+Bf: module {
+	init: fn(nil: ref Draw->Context, args: list of string);
+	ARENASZ: con 1024 * 1024;
+	EXIT, ADD, JZ, JNZ, ADDP, READ, WRITE: con iota;
+};
+
+init(nil: ref Draw->Context, args: list of string)
+{
+	sys = load Sys Sys->PATH;
+	arg := load Arg Arg->PATH;
+
+	arg->init(args);
+	arg->setusage("games/bf [-d|-c] [program.bf|-e inline-program]");
+
+	eflag := 0;
+	outputmode := 0;
+	source := "";
+	while ((opt := arg->opt()) != 0) {
+		case opt {
+		'e' =>
+			eflag = 1;
+			source = arg->arg();
+		'd' =>
+			outputmode = 1;
+		'c' =>
+			outputmode = 2;
+		* =>
+			arg->usage();
+		}
+	}
+	args = arg->argv();
+	if(!eflag) {
+		if(len args != 1)
+			arg->usage();
+		else
+			source = readfile(hd args);
+	}
+
+	code := compile(source);
+	case outputmode {
+	0 => execute(code, array[ARENASZ] of { * => byte 0 });
+	1 => sys->print("%s", disassemble(code));
+	2 => sys->print("%s", bf2limbo(code));
+	}
+}
+
+compile(p: string): array of int
+{
+	marks: list of int = nil;
+	code := array[len p * 2 + 1] of { * => EXIT };
+	pc := 0;
+	n: int;
+	for(i := 0; i < len p; i++) {
+		case p[i] {
+		'-' or '+' =>
+			n = 0;
+			while(i < len p) {
+				if(p[i] == '-')
+					n--;
+				else if(p[i] == '+')
+					n++;
+				else {
+					i--;
+					break;
+				}
+				i++;
+			}
+			if(n) {
+				code[pc++] = ADD;
+				code[pc++] = n;
+			}
+		'<' or '>' =>
+			n = 0;
+			while(i < len p) {
+				if(p[i] == '<')
+					n--;
+				else if(p[i] == '>')
+					n++;
+				else {
+					i--;
+					break;
+				}
+				i++;
+			}
+			if(n) {
+				code[pc++] = ADDP;
+				code[pc++] = n;
+			}
+		',' => code[pc++] = READ;
+		'.' => code[pc++] = WRITE;
+		'[' =>
+			code[pc++] = JZ;
+			marks = pc++ :: marks;
+		']' =>
+			if(marks == nil) {
+				sys->fprint(sys->fildes(2), "bf: unmatched ']' at character %d.", pc);
+				raise "fail:errors";
+			}
+			c := hd marks;
+			marks = tl marks;
+			code[pc++] = JNZ;
+			code[c] = pc;
+			code[pc++] = c;
+		}
+	}
+	if(marks != nil) {
+		sys->fprint(sys->fildes(2), "bf: unmatched '['.");
+		raise "fail:errors";
+	}
+	return code[:pc + 1];
+}
+
+execute(code: array of int, arena: array of byte)
+{
+	pc := 0;
+	p := 0;
+	buf := array[1] of byte;
+	stopreading := 0;
+	for(;;) {
+		case code[pc] {
+		ADD =>
+			arena[p] += byte code[++pc];
+		ADDP =>
+			p += code[++pc];
+			while(p < 0)
+				p += len arena;
+			p = p % len arena;
+		READ =>
+			arena[p] = byte -1;
+			if(!stopreading) {
+				n := sys->read(sys->fildes(0), buf, 1);
+				if(n < 1)
+					stopreading = 1;
+				else
+					arena[p] = buf[0];
+			}
+		WRITE =>
+			buf[0] = arena[p];
+			sys->write(sys->fildes(1), buf, 1);
+		JNZ =>
+			if(arena[p] != byte 0)
+				pc = code[pc + 1];
+			else
+				pc++;
+		JZ =>
+			if(arena[p] == byte 0)
+				pc = code[pc + 1];
+			else
+				pc++;
+		EXIT => return;
+		}
+		pc++;
+	}
+}
+
+disassemble(code: array of int): string
+{
+	s := "";
+	for(i := 0; i < len code && code[i] != EXIT; i++) {
+		s += sys->sprint("[0x%08x]  0x%02x  ", i, code[i]);
+		case code[i] {
+		ADD => s += sys->sprint("add   %d", code[++i]);
+		ADDP => s += sys->sprint("addp  %d", code[++i]);
+		READ => s += "read ";
+		WRITE => s += "write";
+		JNZ => s += sys->sprint("jnz   0x%08x", code[++i]);
+		JZ => s += sys->sprint("jz    0x%08x", code[++i]);
+		* => s += sys->sprint(">>>>>>BUG %d / 0x%08x", code[i], code[i]);
+		}
+		s += "\n";
+	}
+	return s;
+}
+
+bf2limbo(code: array of int): string
+{
+	indent := 1;
+	s := "implement BfProg;\n" +
+		"include \"sys.m\"; sys: Sys;\n" +
+		"include \"draw.m\";\n" +
+		"BfProg: module {\n" +
+		"\tinit: fn(nil: ref Draw->Context, nil: list of string);\n" +
+		"};\n" +
+		"init(nil: ref Draw->Context, nil: list of string)\n{\n" +
+		"\tsys = load Sys Sys->PATH;\n" +
+		"\tp := 0;\n" +
+		"\tstopreading := 0;\n" +
+		"\tn := 0;\n" +
+		"\tbuf := array[1] of byte;\n" +
+		"\tarena := array[" + string ARENASZ + "] of { * => byte 0 };\n" +
+		"\n";
+	for(i := 0; i < len code && code[i] != EXIT; i++) {
+		case code[i] {
+		ADD => s += indents(indent) + "arena[p] += byte " + string code[++i] + ";\n";
+		ADDP =>
+			s += indents(indent) + "p += " + string code[++i] + ";\n" +
+				indents(indent) + "while(p < 0)\n" +
+				indents(indent + 1) + "p += len arena;\n" +
+				indents(indent) + "p = p % len arena;\n";
+		READ =>
+			s += indents(indent) + "arena[p] = byte -1;\n" +
+				indents(indent) + "if(!stopreading) {\n" +
+				indents(indent + 1) + "n = sys->read(sys->fildes(0), buf, 1);\n" +
+				indents(indent + 1) + "if(n < 1)\n" +
+				indents(indent + 2) + "stopreading = 1;\n" +
+				indents(indent + 1) + "else\n" +
+				indents(indent + 2) + "arena[p] = buf[0];\n" +
+				indents(indent) + "}\n";
+		WRITE =>
+			s += indents(indent) + "buf[0] = arena[p];\n" +
+				indents(indent) + "sys->write(sys->fildes(1), buf, 1);\n";
+		JNZ =>
+			indent--;
+			s += indents(indent) + "}\n";
+			i++;
+		JZ =>
+			s += indents(indent) + "while(arena[p] != byte 0) {\n";
+			indent++;
+			i++;
+		}
+		
+	}
+	return s + "}\n";
+}
+
+indents(i: int): string
+{
+	r := "";
+	while(i > 0) {
+		r += "\t";
+		i--;
+	}
+	return r;
+}
+
+readfile(fname: string): string
+{
+	fd := sys->open(fname, Sys->OREAD);
+	if(fd == nil)
+		die(fname);
+
+	src := "";
+	buf := array[Sys->ATOMICIO] of byte;
+	while((n := sys->read(fd, buf, len buf)) > 0) {
+		src += string buf[:n];
+	}
+	return src;
+}
+
+die(s: string)
+{
+	sys->fprint(sys->fildes(2), "bf: %s: %r\n", s);
+	raise "fail:errors";
+}
\ No newline at end of file
--- /dev/null
+++ b/appl/cmd/games/mkfile
@@ -1,0 +1,13 @@
+<../../../mkconfig
+
+TARG=\
+	bf.dis\
+
+SYSMODULES=\
+	arg.m\
+	sys.m\
+	draw.m\
+
+DISBIN=$ROOT/dis/games
+
+<$ROOT/mkfiles/mkdis
--- a/appl/cmd/mkfile
+++ b/appl/cmd/mkfile
@@ -6,6 +6,7 @@
 	avr\
 	disk\
 	fs\
+	games\
 	install\
 	ip\
 	lego\
@@ -74,7 +75,7 @@
 	ftpfs.dis\
 	getauthinfo.dis\
 	gettar.dis\
-	# gif2bit.dis\
+	gif2bit.dis\
 	grep.dis\
 	gunzip.dis\
 	gzip.dis\
binary files a/dis/acme/guiwm.dis /dev/null differ
binary files a/dis/alphabet/abc.dis /dev/null differ
binary files a/dis/alphabet/abc/abc.dis /dev/null differ
binary files a/dis/alphabet/abc/autoconvert.dis /dev/null differ
binary files a/dis/alphabet/abc/autodeclare.dis /dev/null differ
binary files a/dis/alphabet/abc/declare.dis /dev/null differ
binary files a/dis/alphabet/abc/declares.dis /dev/null differ
binary files a/dis/alphabet/abc/define.dis /dev/null differ
binary files a/dis/alphabet/abc/eval.dis /dev/null differ
binary files a/dis/alphabet/abc/import.dis /dev/null differ
binary files a/dis/alphabet/abc/rewrite.dis /dev/null differ
binary files a/dis/alphabet/abc/type.dis /dev/null differ
binary files a/dis/alphabet/abc/typeset.dis /dev/null differ
binary files a/dis/alphabet/abc/undeclare.dis /dev/null differ
binary files a/dis/alphabet/abctypes.dis /dev/null differ
binary files a/dis/alphabet/alphabet.dis /dev/null differ
binary files a/dis/alphabet/alphabet.shmod.dis /dev/null differ
binary files a/dis/alphabet/endpoints.dis /dev/null differ
binary files a/dis/alphabet/endpointsrv.dis /dev/null differ
binary files a/dis/alphabet/eval.dis /dev/null differ
binary files a/dis/alphabet/extvalues.dis /dev/null differ
binary files a/dis/alphabet/fs.dis /dev/null differ
binary files a/dis/alphabet/fs/and.dis /dev/null differ
binary files a/dis/alphabet/fs/bundle.dis /dev/null differ
binary files a/dis/alphabet/fs/chstat.dis /dev/null differ
binary files a/dis/alphabet/fs/compose.dis /dev/null differ
binary files a/dis/alphabet/fs/depth.dis /dev/null differ
binary files a/dis/alphabet/fs/entries.dis /dev/null differ
binary files a/dis/alphabet/fs/exec.dis /dev/null differ
binary files a/dis/alphabet/fs/filter.dis /dev/null differ
binary files a/dis/alphabet/fs/ls.dis /dev/null differ
binary files a/dis/alphabet/fs/match.dis /dev/null differ
binary files a/dis/alphabet/fs/merge.dis /dev/null differ
binary files a/dis/alphabet/fs/mergewrite.dis /dev/null differ
binary files a/dis/alphabet/fs/mode.dis /dev/null differ
binary files a/dis/alphabet/fs/newer.dis /dev/null differ
binary files a/dis/alphabet/fs/not.dis /dev/null differ
binary files a/dis/alphabet/fs/or.dis /dev/null differ
binary files a/dis/alphabet/fs/path.dis /dev/null differ
binary files a/dis/alphabet/fs/pipe.dis /dev/null differ
binary files a/dis/alphabet/fs/print.dis /dev/null differ
binary files a/dis/alphabet/fs/proto.dis /dev/null differ
binary files a/dis/alphabet/fs/query.dis /dev/null differ
binary files a/dis/alphabet/fs/run.dis /dev/null differ
binary files a/dis/alphabet/fs/select.dis /dev/null differ
binary files a/dis/alphabet/fs/setroot.dis /dev/null differ
binary files a/dis/alphabet/fs/size.dis /dev/null differ
binary files a/dis/alphabet/fs/unbundle.dis /dev/null differ
binary files a/dis/alphabet/fs/walk.dis /dev/null differ
binary files a/dis/alphabet/fs/write.dis /dev/null differ
binary files a/dis/alphabet/fsfilter.dis /dev/null differ
binary files a/dis/alphabet/fstypes.dis /dev/null differ
binary files a/dis/alphabet/grid.dis /dev/null differ
binary files a/dis/alphabet/grid/farm.dis /dev/null differ
binary files a/dis/alphabet/grid/line2rec.dis /dev/null differ
binary files a/dis/alphabet/grid/local.dis /dev/null differ
binary files a/dis/alphabet/grid/remote.dis /dev/null differ
binary files a/dis/alphabet/grid/rexec.dis /dev/null differ
binary files a/dis/alphabet/gridtypes.dis /dev/null differ
binary files a/dis/alphabet/main/auth.dis /dev/null differ
binary files a/dis/alphabet/main/cat.dis /dev/null differ
binary files a/dis/alphabet/main/create.dis /dev/null differ
binary files a/dis/alphabet/main/dial.dis /dev/null differ
binary files a/dis/alphabet/main/echo.dis /dev/null differ
binary files a/dis/alphabet/main/env.dis /dev/null differ
binary files a/dis/alphabet/main/export.dis /dev/null differ
binary files a/dis/alphabet/main/fd.dis /dev/null differ
binary files a/dis/alphabet/main/filter.dis /dev/null differ
binary files a/dis/alphabet/main/mount.dis /dev/null differ
binary files a/dis/alphabet/main/par.dis /dev/null differ
binary files a/dis/alphabet/main/parse.dis /dev/null differ
binary files a/dis/alphabet/main/pretty.dis /dev/null differ
binary files a/dis/alphabet/main/print.dis /dev/null differ
binary files a/dis/alphabet/main/read.dis /dev/null differ
binary files a/dis/alphabet/main/readall.dis /dev/null differ
binary files a/dis/alphabet/main/rewrite.dis /dev/null differ
binary files a/dis/alphabet/main/seq.dis /dev/null differ
binary files a/dis/alphabet/main/unparse.dis /dev/null differ
binary files a/dis/alphabet/main/w2fd.dis /dev/null differ
binary files a/dis/alphabet/main/wait.dis /dev/null differ
binary files a/dis/alphabet/mktypeset.dis /dev/null differ
binary files a/dis/alphabet/proxy.dis /dev/null differ
binary files a/dis/alphabet/reports.dis /dev/null differ
binary files a/dis/alphabet/rexecsrv.dis /dev/null differ
binary files a/dis/asm.dis /dev/null differ
binary files a/dis/auth/infauth.dis /dev/null differ
binary files a/dis/auth/proto/infauth.dis /dev/null differ
binary files a/dis/auth/sign.dis /dev/null differ
binary files a/dis/auxi/camera.dis /dev/null differ
binary files a/dis/auxi/chatsrv.dis /dev/null differ
binary files a/dis/auxi/ns.dis /dev/null differ
binary files a/dis/auxi/odbcmnt.dis /dev/null differ
binary files a/dis/auxi/wbsrv.dis /dev/null differ
binary files a/dis/dbm/delete.dis /dev/null differ
binary files a/dis/dbm/fetch.dis /dev/null differ
binary files a/dis/dbm/keys.dis /dev/null differ
binary files a/dis/dbm/list.dis /dev/null differ
binary files a/dis/dbm/store.dis /dev/null differ
binary files a/dis/demo/camera/jpg2bit.dis /dev/null differ
binary files a/dis/demo/camera/readjpg.dis /dev/null differ
binary files a/dis/demo/readjpg.dis /dev/null differ
binary files a/dis/fs/join.dis /dev/null differ
binary files a/dis/fs/merge2.dis /dev/null differ
binary files a/dis/ip/nppp/modem.dis /dev/null differ
binary files a/dis/ip/nppp/ppplink.dis /dev/null differ
binary files a/dis/ip/nppp/script.dis /dev/null differ
binary files a/dis/lib/mash/tk.dis /dev/null differ
binary files a/dis/lib/regexutils.dis /dev/null differ
binary files a/dis/lib/spki/keyreps.dis /dev/null differ
binary files a/dis/lib/styxconv/styxconv.dis /dev/null differ
binary files a/dis/lib/tcl_tk.dis /dev/null differ
--- a/dis/makestubs
+++ b/dis/makestubs
@@ -5,7 +5,7 @@
 
 user=`{cat /dev/user}
 
-dirs=(/tmp /mnt/keys /mnt/registry /mnt/acme /n/remote /chan /keydb)
+dis=`{cat /lib/emptydirs}
 
 for i in $dirs {
 	mkdir -p $i
binary files a/dis/palm/connex.dis /dev/null differ
binary files a/dis/palm/desklink.dis /dev/null differ
binary files a/dis/palm/palmsrv.dis /dev/null differ
binary files a/dis/sh/alphabet.dis /dev/null differ
binary files a/dis/sh/mk.dis /dev/null differ
binary files a/dis/sh/shmk.dis /dev/null differ
binary files a/dis/spree/joinsession.dis /dev/null differ
binary files a/dis/wm/chat.dis /dev/null differ
binary files a/dis/wm/mpeg.dis /dev/null differ
binary files a/dis/wm/qt.dis /dev/null differ
--- a/lib/emptydirs
+++ b/lib/emptydirs
@@ -90,4 +90,70 @@
 usr/inferno/tmp
 services/collab/export/services
 services/collab/export/collab
-
+dis/acme
+dis/alphabet
+dis/alphabet/abc
+dis/alphabet/fs
+dis/alphabet/grid
+dis/alphabet/main
+dis/alphabet/auth
+dis/alphabet/auth/proto
+dis/auxi
+dis/avr
+dis/charon
+dis/collab
+dis/collab/clients
+dis/collab/lib
+dis/collab/servers
+dis/db
+dis/demo
+dis/demo/camera
+dis/demo/chat
+dis/demo/cpupool
+dis/demo/lego
+dis/demo/ns
+dis/demo/odbc
+dis/demo/spree
+dis/demo/whiteboard
+dis/disk
+dis/ebook
+dis/fs
+dis/games
+dis/grid
+dis/grid/demo
+dis/grid/lib
+dis/install
+dis/ip
+dis/ip/nppp
+dis/ip/ppp
+dis/lego
+dis/lib
+dis/lib/convcs
+dis/lib/crypt
+dis/lib/encoding
+dis/lib/ftree
+dis/lib/ida
+dis/lib/mash
+dis/lib/print
+dis/lib/spki
+dis/lib/strokes
+dis/lib/styxconv
+dis/lib/usb
+dis/lib/w3c
+dis/math
+dis/mpc
+dis/mpeg
+dis/ndb
+dis/palm
+dis/sh
+dis/spki
+dis/spree
+dis/spree/clients
+dis/spree/engines
+dis/spree/lib
+dis/svc/httpd
+dis/svc/webget
+dis/tiny
+dis/usb
+dis/wm
+dis/wm/brutus
--- a/lib/sh/profile
+++ b/lib/sh/profile
@@ -16,7 +16,7 @@
 # Networking
 ndb/dns -r
 ndb/cs
-# bind -b '#scs' /net
+# bind -a '#scs' /net
 mount {mntgen} /n
 mount {mntgen} /mnt
 
--- a/mkfile
+++ b/mkfile
@@ -38,7 +38,7 @@
 
 DIRS=\
 	$EMUDIRS\
-#	appl\
+	appl\
 
 foo:QV:
 	echo mk all, clean, install, installall or nuke
--- a/opt/README
+++ /dev/null
@@ -1,2 +1,0 @@
-optional components live in subdirectories of /opt.
-see opt(6) and opt(1)
--- a/opt/misc/appl/bf.b
+++ /dev/null
@@ -1,269 +1,0 @@
-# Interpreter for the canonical esoteric language.
-# Compiles to bytecode, minimal optimizations, done for fun.
-# Pete Elmore (pete at debu dot gs), New Year's Day 2014
-# Released into the public domain.
-
-implement Bf;
-
-include "sys.m"; sys: Sys;
-include "draw.m";
-include "arg.m";
-
-Bf: module {
-	init: fn(nil: ref Draw->Context, args: list of string);
-	ARENASZ: con 1024 * 1024;
-	EXIT, ADD, JZ, JNZ, ADDP, READ, WRITE: con iota;
-};
-
-init(nil: ref Draw->Context, args: list of string)
-{
-	sys = load Sys Sys->PATH;
-	arg := load Arg Arg->PATH;
-
-	arg->init(args);
-	eflag := 0;
-	outputmode := 0;
-	source := "";
-	while ((opt := arg->opt()) != 0) {
-		case opt {
-		'e' =>
-			eflag = 1;
-			source = arg->arg();
-		'd' =>
-			outputmode = 1;
-		'c' =>
-			outputmode = 2;
-		* =>
-			usage();
-		}
-	}
-	args = arg->argv();
-	if(!eflag) {
-		if(len args != 1)
-			usage();
-		else
-			source = readfile(hd args);
-	}
-
-	code := compile(source);
-	case outputmode {
-	0 => execute(code, array[ARENASZ] of { * => byte 0 });
-	1 => sys->print("%s", disassemble(code));
-	2 => sys->print("%s", bf2limbo(code));
-	}
-}
-
-usage()
-{
-	sys->fprint(sys->fildes(2), "usage: bf [-d|-c] [program.bf|-e inline-program]");
-	raise "fail:usage";
-}
-
-compile(p: string): array of int
-{
-	marks: list of int = nil;
-	code := array[len p * 2 + 1] of { * => EXIT };
-	pc := 0;
-	n: int;
-	for(i := 0; i < len p; i++) {
-		case p[i] {
-		'-' or '+' =>
-			n = 0;
-			while(i < len p) {
-				if(p[i] == '-')
-					n--;
-				else if(p[i] == '+')
-					n++;
-				else {
-					i--;
-					break;
-				}
-				i++;
-			}
-			if(n) {
-				code[pc++] = ADD;
-				code[pc++] = n;
-			}
-		'<' or '>' =>
-			n = 0;
-			while(i < len p) {
-				if(p[i] == '<')
-					n--;
-				else if(p[i] == '>')
-					n++;
-				else {
-					i--;
-					break;
-				}
-				i++;
-			}
-			if(n) {
-				code[pc++] = ADDP;
-				code[pc++] = n;
-			}
-		',' => code[pc++] = READ;
-		'.' => code[pc++] = WRITE;
-		'[' =>
-			code[pc++] = JZ;
-			marks = pc++ :: marks;
-		']' =>
-			if(marks == nil) {
-				sys->fprint(sys->fildes(2), "bf: unmatched ']' at character %d.", pc);
-				raise "fail:errors";
-			}
-			c := hd marks;
-			marks = tl marks;
-			code[pc++] = JNZ;
-			code[c] = pc;
-			code[pc++] = c;
-		}
-	}
-	if(marks != nil) {
-		sys->fprint(sys->fildes(2), "bf: unmatched '['.");
-		raise "fail:errors";
-	}
-	return code[:pc + 1];
-}
-
-execute(code: array of int, arena: array of byte)
-{
-	pc := 0;
-	p := 0;
-	buf := array[1] of byte;
-	stopreading := 0;
-	for(;;) {
-		case code[pc] {
-		ADD =>
-			arena[p] += byte code[++pc];
-		ADDP =>
-			p += code[++pc];
-			while(p < 0)
-				p += len arena;
-			p = p % len arena;
-		READ =>
-			arena[p] = byte -1;
-			if(!stopreading) {
-				n := sys->read(sys->fildes(0), buf, 1);
-				if(n < 1)
-					stopreading = 1;
-				else
-					arena[p] = buf[0];
-			}
-		WRITE =>
-			buf[0] = arena[p];
-			sys->write(sys->fildes(1), buf, 1);
-		JNZ =>
-			if(arena[p] != byte 0)
-				pc = code[pc + 1];
-			else
-				pc++;
-		JZ =>
-			if(arena[p] == byte 0)
-				pc = code[pc + 1];
-			else
-				pc++;
-		EXIT => return;
-		}
-		pc++;
-	}
-}
-
-disassemble(code: array of int): string
-{
-	s := "";
-	for(i := 0; i < len code && code[i] != EXIT; i++) {
-		s += sys->sprint("[0x%08x]  0x%02x  ", i, code[i]);
-		case code[i] {
-		ADD => s += sys->sprint("add   %d", code[++i]);
-		ADDP => s += sys->sprint("addp  %d", code[++i]);
-		READ => s += "read ";
-		WRITE => s += "write";
-		JNZ => s += sys->sprint("jnz   0x%08x", code[++i]);
-		JZ => s += sys->sprint("jz    0x%08x", code[++i]);
-		* => s += sys->sprint(">>>>>>BUG %d / 0x%08x", code[i], code[i]);
-		}
-		s += "\n";
-	}
-	return s;
-}
-
-bf2limbo(code: array of int): string
-{
-	indent := 1;
-	s := "implement BfProg;\n" +
-		"include \"sys.m\"; sys: Sys;\n" +
-		"include \"draw.m\";\n" +
-		"BfProg: module {\n" +
-		"\tinit: fn(nil: ref Draw->Context, nil: list of string);\n" +
-		"};\n" +
-		"init(nil: ref Draw->Context, nil: list of string)\n{\n" +
-		"\tsys = load Sys Sys->PATH;\n" +
-		"\tp := 0;\n" +
-		"\tstopreading := 0;\n" +
-		"\tn := 0;\n" +
-		"\tbuf := array[1] of byte;\n" +
-		"\tarena := array[" + string ARENASZ + "] of { * => byte 0 };\n" +
-		"\n";
-	for(i := 0; i < len code && code[i] != EXIT; i++) {
-		case code[i] {
-		ADD => s += indents(indent) + "arena[p] += byte " + string code[++i] + ";\n";
-		ADDP =>
-			s += indents(indent) + "p += " + string code[++i] + ";\n" +
-				indents(indent) + "while(p < 0)\n" +
-				indents(indent + 1) + "p += len arena;\n" +
-				indents(indent) + "p = p % len arena;\n";
-		READ =>
-			s += indents(indent) + "arena[p] = byte -1;\n" +
-				indents(indent) + "if(!stopreading) {\n" +
-				indents(indent + 1) + "n = sys->read(sys->fildes(0), buf, 1);\n" +
-				indents(indent + 1) + "if(n < 1)\n" +
-				indents(indent + 2) + "stopreading = 1;\n" +
-				indents(indent + 1) + "else\n" +
-				indents(indent + 2) + "arena[p] = buf[0];\n" +
-				indents(indent) + "}\n";
-		WRITE =>
-			s += indents(indent) + "buf[0] = arena[p];\n" +
-				indents(indent) + "sys->write(sys->fildes(1), buf, 1);\n";
-		JNZ =>
-			indent--;
-			s += indents(indent) + "}\n";
-			i++;
-		JZ =>
-			s += indents(indent) + "while(arena[p] != byte 0) {\n";
-			indent++;
-			i++;
-		}
-		
-	}
-	return s + "}\n";
-}
-
-indents(i: int): string
-{
-	r := "";
-	while(i > 0) {
-		r += "\t";
-		i--;
-	}
-	return r;
-}
-
-readfile(fname: string): string
-{
-	fd := sys->open(fname, Sys->OREAD);
-	if(fd == nil)
-		die(fname);
-
-	src := "";
-	buf := array[Sys->ATOMICIO] of byte;
-	while((n := sys->read(fd, buf, len buf)) > 0) {
-		src += string buf[:n];
-	}
-	return src;
-}
-
-die(s: string)
-{
-	sys->fprint(sys->fildes(2), "bf: %s: %r\n", s);
-	raise "fail:errors";
-}
\ No newline at end of file
--- a/opt/misc/appl/hello.b
+++ /dev/null
@@ -1,15 +1,0 @@
-implement Hello;
-
-include "sys.m";
-	sys: Sys;
-include "draw.m";
-
-Hello: module {
-	init:
-	fn(ctxt: ref Draw->Context, argv: list of string);
-};
-
-init(ctxt : ref Draw->Context, argv: list of string) {
-	sys = load Sys Sys->PATH;
-	sys->print("Hello World!\n");
-}
binary files a/opt/misc/dis/bf.dis /dev/null differ
binary files a/opt/misc/dis/hello.dis /dev/null differ
--- a/opt/mkfiles/README.md
+++ /dev/null
@@ -1,49 +1,0 @@
-# Description
-
-These mkfiles can be used as is or as basis for your own mkfiles. Unlike
-standard files in `/mkfiles` these know how to handle `/opt` packages;
-able to build/run tests (both in host os and inside emu) and have other
-features (generation of INDEX files for your man pages, generation of man
-pages from text in asciidoc markup, etc.).
-
-
-# Install
-
-Make directory with these files available in /opt/mkfiles.
-
-Install system-wide:
-
-```
-# git clone https://github.com/powerman/inferno-opt-mkfiles.git $INFERNO_ROOT/opt/mkfiles
-```
-
-or in your home directory:
-
-```
-$ git clone https://github.com/powerman/inferno-opt-mkfiles.git $INFERNO_USER_HOME/opt/mkfiles
-$ emu
-; bind opt /opt
-```
-
-or locally for your project:
-
-```
-$ git clone https://github.com/powerman/inferno-opt-mkfiles.git $YOUR_PROJECT_DIR/opt/mkfiles
-$ emu
-; cd $YOUR_PROJECT_DIR_INSIDE_EMU
-; bind opt /opt
-```
-
-
-# Usage
-
-Start your new project using these mkfiles:
-
-```
-$ emu
-; mkdir newproject
-; cd newproject
-; cp /opt/mkfiles/mkconfig-example mkconfig
-; cp /opt/mkfiles/mkfile-example mkfile
-```
-
--- a/opt/mkfiles/mkasciidoc
+++ /dev/null
@@ -1,43 +1,0 @@
-# MANDIR=$PKGDIR/man/2
-# 
-# MANTARG=\
-# 	somelib\
-# 
-
-KEEPMTIME=${OSTARG:Inferno=-x}
-KEEPMTIME=${KEEPMTIME:os=-p}
-
-all:V:			${MANTARG:%=%.man}
-
-install:V:		${MANTARG:%=$MANDIR/%}
-
-test:V:			install
-
-clean:V:
-	rm -f *.man
-
-nuke:V:			clean
-	cd $MANDIR; rm -f $MANTARG
-
-%.man:N:		%.man-$OSTARG
-
-%.man-Inferno:QV:	%.txt
-	echo 'Require asciidoc (run mk install in host os)'
-	raise 'not implemented'
-
-%.man-os:QV:		%.txt
-	if ! asciidoc 2>/dev/null; then
-	    echo 'Require asciidoc: http://www.methods.co.nz/asciidoc/'
-	    false
-	elif ! asciidoc --backend list 2>/dev/null | grep -q 9man; then
-	    echo 'Require 9man backend for asciidoc: http://powerman.name/asciidoc/'
-	    false
-	else
-	    echo asciidoc -d manpage -b 9man $stem.txt
-	    asciidoc -d manpage -b 9man $stem.txt 
-	    # avoid redundant INDEX regen on next mk all
-	    touch -c -r $stem.txt -d '+1 second' $stem.man
-	fi
-
-$MANDIR/%:		%.man
-	rm -f $MANDIR/$stem && cp $KEEPMTIME $stem.man $MANDIR/$stem
--- a/opt/mkfiles/mkconfig-example
+++ /dev/null
@@ -1,26 +1,0 @@
-<$ROOT/mkconfig
-
-
-# PKGDIR: [host,emu] path to project's root (from mkfile's dir).
-# Used to run tests. Also very useful to simplify paths in any mkfile.
-PKGDIR=$PKGDIR	# MUST BE SET IN EVERY mkfile BEFORE INCLUDING THIS mkconfig!
-
-# OPTDIR: [host,emu] path to dir with opt/ subdir (from mkfile's dir).
-# Used to find modules by relative path (e.g. opt/powerman/tap/module/t.m).
-OPTDIR=${OSTARG:Inferno=/}
-OPTDIR=${OPTDIR:os=$INFERNO_HOME}
-
-# MKFILES: [host,emu] path to mkfiles/ dir (from mkfile's dir).
-# Used to find helper files needed by some mkfiles and ease including them.
-MKFILES=$OPTDIR/opt/mkfiles
-
-# EMUCMD: command to run .dis file from host os.
-# EMUPKGDIR: [emu] path to project's root (from $EMUCMD's dir).
-# Used to run tests from host os (e.g. $EMUCMD $EMUPKGDIR/appl/lib/t/smoke.dis).
-EMUCMD='emu-g sh -c "run /lib/sh/profile; \$1; shutdown -h"'
-EMUPKGDIR=/opt/YOURNAME/YOURPACKAGE
-
-
-# Default target (first target in first loaded mkfile).
-usage:QV:
-    echo mk all, install, test, clean or nuke
--- a/opt/mkfiles/mkdis
+++ /dev/null
@@ -1,42 +1,0 @@
-# DISBIN=$PKGDIR/dis/lib
-# 
-# TARG=\
-# 	somelib.dis\
-# 
-# SYSMODULES=\
-# 	sys.m\
-# 
-# OPTMODULES=\
-#	opt/powerman/hashtable/module/hashtable.m\
-# 
-# MODULES=\
-# 	$PKGDIR/module/somelib.m\
-# 
-
-MODDIR=$ROOT/module
-SYS_MODULE=${SYSMODULES:%=$MODDIR/%}
-OPT_MODULE=${OPTMODULES:%=$OPTDIR/%}
-LIMBOFLAGS=-I$MODDIR -I$OPTDIR
-
-all:V:			$TARG
-
-install:V:		${TARG:%=$DISBIN/%}
-
-test:V:			install
-
-clean:V:
-	rm -f *.dis *.sbl *.s
-
-nuke:V:			clean
-	cd $DISBIN; rm -f $TARG
-
-%.dis:			$MODULES $SYS_MODULE $OPT_MODULE
-
-%.dis:			%.b
-	limbo $LIMBOFLAGS -gw $stem.b
-
-%.s:			%.b
-	limbo $LIMBOFLAGS -w -G -S $stem.b
-
-$DISBIN/%.dis:		%.dis
-	rm -f $DISBIN/$stem.dis && cp $stem.dis $DISBIN/$stem.dis
--- a/opt/mkfiles/mkfile-example
+++ /dev/null
@@ -1,10 +1,0 @@
-PKGDIR=.
-<$PKGDIR/mkconfig
-
-
-DIRS=\
-	appl\
-	doc\
-	man\
-
-<$MKFILES/mksubdirs
--- a/opt/mkfiles/mkindices
+++ /dev/null
@@ -1,73 +1,0 @@
-# MANDIRS=\
-# 	2\
-# 
-
-MKINDICES=$MKFILES/mkindices
-
-all:V:			indices-$OSTARG
-
-install:V:		all
-
-test:V:			install
-
-clean:V:		${MANDIRS:%=clean-%}
-
-clean-%:V:
-	rm -f $stem/INDEX
-
-nuke:V:			clean
-
-indices-Inferno:QV:
-	MKINDICESABS=`{ cleanname -d `{pwd} $"MKINDICES }
-	for j in $MANDIRS {
-		if { ftest -d $j } {
-			echo cd $j'; mk -f' $MKINDICES $MKFLAGS 'MANPAGES=… INDEX'
-			@{ pctl forkns; cd $j; mk -f $MKINDICESABS $MKFLAGS 'MANPAGES=`{ ls | grep -v ''^INDEX$'' }' INDEX }
-		} {
-			! ftest -e $j || raise $j^' not a directory'
-		}
-	}
-
-indices-os:QV:
-	MKINDICESABS=$(realpath $MKINDICES)
-	for j in $MANDIRS; do
-		if test -d $j; then
-			echo cd $j'; mk -f' $MKINDICES $MKFLAGS 'MANPAGES=… INDEX'
-			(cd $j; mk -f $MKINDICESABS $MKFLAGS "MANPAGES=$(echo $(ls | grep -v '^INDEX$'))" INDEX) || exit 1
-		else
-			test ! -e $j || { echo $j not a directory; exit 1; }
-		fi
-	done
-
-INDEX:N:		INDEX-$OSTARG
-
-INDEX-Inferno:QEV:	$MANPAGES
-	test -z $"prereq || {
-		echo 'generating INDEX'
-		# /man/*/INDEX generator by Pete Elmore
-		load regex
-		for f in $prereq {
-			ws := ${re sg '0intro' 'intro' $f}
-			h := ()
-			getlines {
-				(s n rest) := ${split ' ' $line}
-				if {~ $s .SH}	{h = $n; raise continue}
-				if {no $h}	{raise continue}
-				if {~ $h NAME}	{ws = $ws $line}	{raise break}
-			} < $f
-			ws = `{echo ${re sg '( |\\)-.*' '' $"ws} | tr A-Z a-z | tr -dc 'a-z0-9_/!~. -'}
-			for w in $ws {echo $w $f} | sort
-		} | uniq >INDEX
-	}
-
-INDEX-os:QV:		$MANPAGES
-	if test -n "$prereq"; then
-		echo 'generating INDEX'
-		perl -0777 -ne '
-			s/\A.*?^\.SH\s+NAME\s*\n(.*?)^\.SH\s.*/$1/ms;
-			s/(?:\s|\\)-.*//ms;
-			$f=$ARGV;
-			$f=~s/0intro/intro/ms;
-			print "$_ $ARGV\n" for sort map {lc} $f, /([\w\/!~.-]+)/msg;
-		' $prereq | uniq >INDEX
-	fi
--- a/opt/mkfiles/mksubdirs
+++ /dev/null
@@ -1,30 +1,0 @@
-# DIRS=\
-# 	subdir1\
-# 	subdir2\
-# 
-
-all:V:			all-$SHELLTYPE
-install:V:		install-$SHELLTYPE
-test:V:			test-$SHELLTYPE
-clean:V:		clean-$SHELLTYPE
-nuke:V:			nuke-$SHELLTYPE
-
-%-rc:QV:
-	for j in $DIRS {
-		if { ftest -d $j } {
-			echo cd $j'; mk' $MKFLAGS $stem
-			@{ pctl forkns; cd $j; mk $MKFLAGS $stem }
-		} {
-			! ftest -e $j || raise $j' not a directory'
-		}
-	}
-
-%-sh:QV:
-	for j in $DIRS; do
-		if test -d $j; then
-			echo cd $j'; mk' $MKFLAGS $stem
-			(cd $j; mk $MKFLAGS $stem) || exit 1
-		else
-			test ! -e $j || { echo $j not a directory; exit 1; }
-		fi
-	done
--- a/opt/mkfiles/mktest
+++ /dev/null
@@ -1,51 +1,0 @@
-# TESTS=\
-# 	smoke.dis\
-# 	sometest.dis\
-# 
-# TESTTARG=\
-# 	share.dis\
-# 
-# SYSMODULES=\
-# 	sys.m\
-# 	draw.m\
-# 
-# OPTMODULES=\
-#	opt/powerman/tap/module/t.m\
-#	opt/powerman/tap/module/tap.m\
-# 
-# MODULES=\
-# 	$PKGDIR/module/somelib.m\
-# 
-
-MODDIR=$ROOT/module
-SYS_MODULE=${SYSMODULES:%=$MODDIR/%}
-OPT_MODULE=${OPTMODULES:%=$OPTDIR/%}
-LIMBOFLAGS=-I$MODDIR -I$OPTDIR
-
-all:V:			$TESTTARG $TESTS ${TESTS:%.dis=%.t}
-
-install:V:		all
-
-test:V:			install ${TESTS:%.dis=%.test-$OSTARG}
-
-clean:V:
-	rm -f *.dis *.sbl *.s *.t
-
-nuke:V:			clean
-
-%.dis:			$MODULES $SYS_MODULE $OPT_MODULE
-
-%.dis:			%.b
-	limbo $LIMBOFLAGS -gw $stem.b
-
-%.s:			%.b
-	limbo $LIMBOFLAGS -w -G -S $stem.b
-
-%.t:			$MKFILES/runtest.sh
-	cp $MKFILES/runtest.sh $stem.t
-
-%.test-Inferno:V:
-	d=`{pwd}; cd $PKGDIR; $d/$stem.dis
-
-%.test-os:V:
-	./$stem.t
--- a/opt/mkfiles/runtest.sh
+++ /dev/null
@@ -1,20 +1,0 @@
-#!/bin/bash -i
-# This script designed to be executed from host os in any way:
-#	cd /…/project;	prove -r; mk test; appl/lib/t/smoke.t
-#	cd appl/lib;	prove -r; mk test; t/smoke.t
-#	cd t;		prove -r; mk test; ./smoke.t
-# It require PKGDIR, EMUPKGDIR and EMUCMD variables set in mkfile.
-
-# When this script executed not by mk (i.e. by prove or manually) it won't
-# have variables from mkfile in environment and will need to fetch them.
-function getvar() {
-	echo -e "<mkfile\ngetvar:VQ:\n\techo \$$1" |
-		mk -f /proc/self/fd/0 getvar
-}
-
-SUBDIR=$(pwd)
-cd $(getvar PKGDIR)
-PKGDIR=$(pwd)
-DIS=$(getvar EMUPKGDIR)${SUBDIR:${#PKGDIR}}/$(dirname $0)/$(basename $0 .t).dis
-
-eval "$(getvar EMUCMD) \$DIS"
--- a/opt/setup/README.md
+++ /dev/null
@@ -1,41 +1,0 @@
-# Description
-
-Scripts to setup projects installed in `/opt` (bind their commands, man
-pages, etc. to standard places).
-
-
-# Install
-
-Make directory with these scripts available in /opt/setup/.
-
-Install system-wide:
-
-```
-# git clone https://github.com/powerman/inferno-opt-setup.git $INFERNO_ROOT/opt/setup
-```
-
-or in your home directory:
-
-```
-$ git clone https://github.com/powerman/inferno-opt-setup.git $INFERNO_USER_HOME/opt/setup
-$ emu
-; bind opt /opt
-```
-
-
-# Usage
-
-Add this into `profile` file in your Inferno home dir:
-
-```
-/opt/setup/cmd
-/opt/setup/man
-```
-
-The `/opt/setup/cmd` will bind all commands provided by /opt packages into
-`/dis/`, to let you run these commands by their name, without long
-`/opt/provider/package/dis/cmd/` prefix.
-
-The `/opt/setup/man` will bind all man pages provided by /opt packages
-into `/man/*/` and union provided man indexes with `/man/*/INDEX`.
-
--- a/opt/setup/cmd
+++ /dev/null
@@ -1,10 +1,0 @@
-#!/dis/sh -n
-load std
-
-for d in /opt/*/dis/* /opt/*/*/dis/* {
-	or {ftest -d $d} {raise continue}
-	n := `{basename $d}
-	and {~ $n lib} {raise continue}
-	and {~ $n cmd} {n=''}
-	bind -b $d /dis/$n
-}
--- a/opt/setup/man
+++ /dev/null
@@ -1,20 +1,0 @@
-#!/dis/sh -n
-load std
-
-for d in /opt/*/man/* /opt/*/*/man/* {
-	or {ftest -d $d} {raise continue}
-	n := `{basename $d}
-	if {ftest -r $d/INDEX} {
-		f := '/chan/man-' ^ $n ^ '-INDEX'
-		or {ftest -w $f} {ramfile $f; cp /man/$n/INDEX $f}
-		echo -n "{cat $f $d/INDEX} > $f
-	}
-	bind -b $d /man/$n
-}
-
-for d in /man/[1-9]* {
-	n := `{basename $d}
-	f := '/chan/man-' ^ $n ^ '-INDEX'
-	or {ftest -r $f} {raise continue}
-	or {diff $f $d/INDEX >/dev/null} {bind $f $d/INDEX}
-}
--- a/opt/skel/README.md
+++ /dev/null
@@ -1,90 +1,0 @@
-# Description
-
-This project is example, which can be used as template to start new /opt
-project for OS Inferno.
-
-
-# Install
-
-Make directory with this app/module skeleton available in /opt/skel/.
-
-Install system-wide:
-
-```
-# git clone https://github.com/powerman/inferno-opt-skel.git $INFERNO_ROOT/opt/skel
-```
-
-or in your home directory:
-
-```
-$ git clone https://github.com/powerman/inferno-opt-skel.git $INFERNO_USER_HOME/opt/skel
-$ emu
-; bind opt /opt
-```
-
-## Dependencies
-
-* https://github.com/powerman/inferno-opt-mkfiles
-* https://github.com/powerman/inferno-contrib-tap (only for tests)
-* https://github.com/powerman/inferno-contrib-logger (example dependency for
-  example command :))
-* http://asciidoc.org/ (converter from asciidoc markup to other formats)
-* https://github.com/powerman/asciidoc-9man-backend (asciidoc 9man backend
-  for converting into Inferno man pages)
-
-Actually all these dependencies are optional:
-
-* mkfiles project can be just copied to ./mkfiles/ subdir in your project
-  to avoid dependency on external project
-* tap module needed only for testing; you can use another modules, but
-  this one is cool because it allow you to run tests using `prove` command
-  in host os (standard testing tool for Perl)
-* logger is just an example dependency, nothing more
-* asciidoc needed only if you like to generate Inferno man pages from
-  simple .txt source
-
-
-# Usage
-
-Just copy `/opt/skel/` into your project's directory when you start new
-project.
-
-You can build your project using these commands both from host os and
-inside emu (except `prove`, which works only in host os):
-
-```
-mk all
-mk install
-
-mk test
-prove -r
-
-mk clean
-mk nuke
-```
-
-## Example
-
-When this project installed in `/opt/skel` and your /opt is correctly set
-(https://github.com/powerman/inferno-opt-setup) you can also:
-
-```
-$ emu
-; examplecmd
-Hello from ExampleLib->init()
-user.warn: Dec  6 05:04:40 examplecmd[158]: Hello from ExampleCmd->init()
-user.err: Dec  6 05:04:40 examplecmd[158]: Hello from ExampleCmd->init()
-; man examplecmd
-EXAMPLECMD(1)                                       EXAMPLECMD(1)
-
-NAME
-     examplecmd - Example command in /opt skeleton project
-…
-; man examplelib
-EXAMPLELIB(2)                                       EXAMPLELIB(2)
-
-NAME
-     examplelib - Example library in /opt skeleton project
-…
-```
-
--- a/opt/skel/appl/cmd/examplecmd.b
+++ /dev/null
@@ -1,65 +1,0 @@
-implement ExampleCmd;
-
-include "sys.m";
-	sys: Sys;
-	sprint: import sys;
-include "draw.m";
-include "opt/powerman/logger/module/logger.m";
-	logger: Logger;
-	log, ERR, WARN, NOTICE, INFO, DEBUG: import logger;
-include "arg.m";
-include "opt/skel/module/examplelib.m";
-
-
-ExampleCmd: module
-{
-	init: fn(nil: ref Draw->Context, argv: list of string);
-};
-
-init(nil: ref Draw->Context, argv: list of string)
-{
-	sys		=  load Sys Sys->PATH;
-	logger		=  checkload(load Logger Logger->PATH, "Logger");
-	logger->init();
-	arg		:= checkload(load Arg Arg->PATH, "Arg");
-	arg->init(argv);
-	logger->progname(arg->progname());
-	examplelib	:= checkload(load ExampleLib ExampleLib->PATH, "ExampleLib");
-	examplelib->init();
-
-	arg->setusage(sprint("%s [-v]", arg->progname()));
-	while((p := arg->opt()) != 0)
-		case p {
-		'v' =>	logger->verbose++;
-		* =>	arg->usage();
-		}
-	argv = arg->argv();
-	if(len argv != 0)
-		arg->usage();
-
-	log(DEBUG,  "Hello from ExampleCmd->init()");
-	log(INFO,   "Hello from ExampleCmd->init()");
-	log(NOTICE, "Hello from ExampleCmd->init()");
-	log(WARN,   "Hello from ExampleCmd->init()");
-	log(ERR,    "Hello from ExampleCmd->init()");
-}
-
-
-###
-
-fail(s: string)
-{
-	if(logger != nil)
-		log(ERR, s);
-	else
-		sys->fprint(sys->fildes(2), "%s\n", s);
-	raise "fail:"+s;
-}
-
-checkload[T](x: T, s: string): T
-{
-	if(x == nil)
-		fail(sprint("load: %s: %r", s));
-	return x;
-}
-
--- a/opt/skel/appl/cmd/mkfile
+++ /dev/null
@@ -1,27 +1,0 @@
-PKGDIR=../..
-<$PKGDIR/mkconfig
-
-
-DIRS=\
-	t\
-
-<$MKFILES/mksubdirs
-
-
-DISBIN=$PKGDIR/dis/cmd
-
-TARG=\
-	examplecmd.dis\
-
-SYSMODULES=\
-	sys.m\
-	draw.m\
-	arg.m\
-
-OPTMODULES=\
-	opt/powerman/logger/module/logger.m\
-
-MODULES=\
-	$PKGDIR/module/examplelib.m\
-
-<$MKFILES/mkdis
--- a/opt/skel/appl/cmd/t/mkfile
+++ /dev/null
@@ -1,21 +1,0 @@
-PKGDIR=../../..
-<$PKGDIR/mkconfig
-
-
-TESTS=\
-	smoke.dis\
-
-TESTTARG=\
-
-SYSMODULES=\
-	sys.m\
-	draw.m\
-	sh.m\
-
-OPTMODULES=\
-	opt/powerman/tap/module/t.m\
-	opt/powerman/tap/module/tap.m\
-
-MODULES=\
-
-<$MKFILES/mktest
--- a/opt/skel/appl/cmd/t/smoke.b
+++ /dev/null
@@ -1,13 +1,0 @@
-implement T;
-
-include "opt/powerman/tap/module/t.m";
-include "sh.m";
-
-
-test()
-{
-	plan(1);
-
-	examplecmd := load Command "/opt/skel/dis/cmd/examplecmd.dis";
-	ok(examplecmd != nil, "examplecmd loaded as Command");
-}
--- a/opt/skel/appl/cmd/t/smoke.t
+++ /dev/null
@@ -1,20 +1,0 @@
-#!/bin/bash -i
-# This script designed to be executed from host os in any way:
-#	cd /…/project;	prove -r; mk test; appl/lib/t/smoke.t
-#	cd appl/lib;	prove -r; mk test; t/smoke.t
-#	cd t;		prove -r; mk test; ./smoke.t
-# It require PKGDIR, EMUPKGDIR and EMUCMD variables set in mkfile.
-
-# When this script executed not by mk (i.e. by prove or manually) it won't
-# have variables from mkfile in environment and will need to fetch them.
-function getvar() {
-	echo -e "<mkfile\ngetvar:VQ:\n\techo \$$1" |
-		mk -f /proc/self/fd/0 getvar
-}
-
-SUBDIR=$(pwd)
-cd $(getvar PKGDIR)
-PKGDIR=$(pwd)
-DIS=$(getvar EMUPKGDIR)${SUBDIR:${#PKGDIR}}/$(dirname $0)/$(basename $0 .t).dis
-
-eval "$(getvar EMUCMD) \$DIS"
--- a/opt/skel/appl/lib/examplelib.b
+++ /dev/null
@@ -1,12 +1,0 @@
-implement ExampleLib;
-
-include "sys.m";
-	sys: Sys;
-include "../../module/examplelib.m";
-
-
-init()
-{
-	sys = load Sys Sys->PATH;
-	sys->print("Hello from ExampleLib->init()\n");
-}
--- a/opt/skel/appl/lib/mkfile
+++ /dev/null
@@ -1,24 +1,0 @@
-PKGDIR=../..
-<$PKGDIR/mkconfig
-
-
-DIRS=\
-	t\
-
-<$MKFILES/mksubdirs
-
-
-DISBIN=$PKGDIR/dis/lib
-
-TARG=\
-	examplelib.dis\
-
-SYSMODULES=\
-	sys.m\
-
-OPTMODULES=\
-
-MODULES=\
-	$PKGDIR/module/examplelib.m\
-
-<$MKFILES/mkdis
--- a/opt/skel/appl/lib/t/mkfile
+++ /dev/null
@@ -1,21 +1,0 @@
-PKGDIR=../../..
-<$PKGDIR/mkconfig
-
-
-TESTS=\
-	smoke.dis\
-
-TESTTARG=\
-
-SYSMODULES=\
-	sys.m\
-	draw.m\
-
-OPTMODULES=\
-	opt/powerman/tap/module/t.m\
-	opt/powerman/tap/module/tap.m\
-
-MODULES=\
-	$PKGDIR/module/examplelib.m\
-
-<$MKFILES/mktest
--- a/opt/skel/appl/lib/t/smoke.b
+++ /dev/null
@@ -1,18 +1,0 @@
-implement T;
-
-include "opt/powerman/tap/module/t.m";
-include "../../../module/examplelib.m";
-	examplelib: ExampleLib;
-
-
-test()
-{
-	plan(1);
-
-	examplelib = load ExampleLib ExampleLib->PATH;
-	if(examplelib == nil)
-		bail_out(sprint("load %s: %r",ExampleLib->PATH));
-
-	{ examplelib->init(); } exception e { "*"=>catched(e); }
-	raised(nil, "init() doesn't raise");
-}
--- a/opt/skel/appl/lib/t/smoke.t
+++ /dev/null
@@ -1,20 +1,0 @@
-#!/bin/bash -i
-# This script designed to be executed from host os in any way:
-#	cd /…/project;	prove -r; mk test; appl/lib/t/smoke.t
-#	cd appl/lib;	prove -r; mk test; t/smoke.t
-#	cd t;		prove -r; mk test; ./smoke.t
-# It require PKGDIR, EMUPKGDIR and EMUCMD variables set in mkfile.
-
-# When this script executed not by mk (i.e. by prove or manually) it won't
-# have variables from mkfile in environment and will need to fetch them.
-function getvar() {
-	echo -e "<mkfile\ngetvar:VQ:\n\techo \$$1" |
-		mk -f /proc/self/fd/0 getvar
-}
-
-SUBDIR=$(pwd)
-cd $(getvar PKGDIR)
-PKGDIR=$(pwd)
-DIS=$(getvar EMUPKGDIR)${SUBDIR:${#PKGDIR}}/$(dirname $0)/$(basename $0 .t).dis
-
-eval "$(getvar EMUCMD) \$DIS"
--- a/opt/skel/appl/mkfile
+++ /dev/null
@@ -1,9 +1,0 @@
-PKGDIR=..
-<$PKGDIR/mkconfig
-
-
-DIRS=\
-	lib\
-	cmd\
-
-<$MKFILES/mksubdirs
binary files a/opt/skel/dis/cmd/examplecmd.dis /dev/null differ
binary files a/opt/skel/dis/lib/examplelib.dis /dev/null differ
--- a/opt/skel/doc/1/examplecmd.man
+++ /dev/null
@@ -1,22 +1,0 @@
-.TH EXAMPLECMD 1
-.SH NAME
-examplecmd \- Example command in /opt skeleton project
-.SH SYNOPSIS
-.EX
-examplecmd [-v]
-
-.EE
-.SH DESCRIPTION
-.PP
-This command is example how to implement commands in /opt project.
-.PP
-.B -v
-will increase log verbosity level.
-.SH SOURCE
-.PP
-.B /opt/skel/appl/cmd/examplecmd.b
-.br
-.SH SEE ALSO
-.PP
-.IR examplelib (2)
-.SH BUGS
--- a/opt/skel/doc/1/examplecmd.txt
+++ /dev/null
@@ -1,34 +1,0 @@
-EXAMPLECMD(1)
-=============
-
-== NAME
-
-examplecmd - Example command in /opt skeleton project
-
-
-== SYNOPSIS
-
-----
-examplecmd [-v]
-----
-
-
-== DESCRIPTION
-
-This command is example how to implement commands in /opt project.
-
-*-v* will increase log verbosity level.
-
-
-== SOURCE
-
-`/opt/skel/appl/cmd/examplecmd.b`
-
-
-== SEE ALSO
-
-examplelib(2)
-
-
-== BUGS
-
--- a/opt/skel/doc/1/mkfile
+++ /dev/null
@@ -1,10 +1,0 @@
-PKGDIR=../..
-<$PKGDIR/mkconfig
-
-
-MANDIR=$PKGDIR/man/1
-
-MANTARG=\
-	examplecmd\
-
-<$MKFILES/mkasciidoc
--- a/opt/skel/doc/2/examplelib.man
+++ /dev/null
@@ -1,26 +1,0 @@
-.TH EXAMPLELIB 2
-.SH NAME
-examplelib \- Example library in /opt skeleton project
-.SH SYNOPSIS
-.EX
-include "opt/skel/module/examplelib.m";
-        examplelib: ExampleLib;
-examplelib = load ExampleLib ExampleLib->PATH;
-
-init: fn();
-
-.EE
-.SH DESCRIPTION
-.PP
-This module provide example how to implement library in /opt project.
-.PP
-.B init
-will say "hi" to you.
-.SH SOURCE
-.PP
-.B /opt/skel/appl/lib/examplelib.b
-.br
-.SH SEE ALSO
-.PP
-.IR examplecmd (1)
-.SH BUGS
--- a/opt/skel/doc/2/examplelib.txt
+++ /dev/null
@@ -1,38 +1,0 @@
-EXAMPLELIB(2)
-=============
-
-== NAME
-
-examplelib - Example library in /opt skeleton project
-
-
-== SYNOPSIS
-
-----
-include "opt/skel/module/examplelib.m";
-	examplelib: ExampleLib;
-examplelib = load ExampleLib ExampleLib->PATH;
-
-init: fn();
-----
-
-
-== DESCRIPTION
-
-This module provide example how to implement library in /opt project.
-
-*init* will say "hi" to you.
-
-
-== SOURCE
-
-`/opt/skel/appl/lib/examplelib.b`
-
-
-== SEE ALSO
-
-examplecmd(1)
-
-
-== BUGS
-
--- a/opt/skel/doc/2/mkfile
+++ /dev/null
@@ -1,10 +1,0 @@
-PKGDIR=../..
-<$PKGDIR/mkconfig
-
-
-MANDIR=$PKGDIR/man/2
-
-MANTARG=\
-	examplelib\
-
-<$MKFILES/mkasciidoc
--- a/opt/skel/doc/mkfile
+++ /dev/null
@@ -1,9 +1,0 @@
-PKGDIR=..
-<$PKGDIR/mkconfig
-
-
-DIRS=\
-	1\
-	2\
-
-<$MKFILES/mksubdirs
--- a/opt/skel/man/1/INDEX
+++ /dev/null
@@ -1,1 +1,0 @@
-examplecmd examplecmd
--- a/opt/skel/man/1/examplecmd
+++ /dev/null
@@ -1,22 +1,0 @@
-.TH EXAMPLECMD 1
-.SH NAME
-examplecmd \- Example command in /opt skeleton project
-.SH SYNOPSIS
-.EX
-examplecmd [-v]
-
-.EE
-.SH DESCRIPTION
-.PP
-This command is example how to implement commands in /opt project.
-.PP
-.B -v
-will increase log verbosity level.
-.SH SOURCE
-.PP
-.B /opt/skel/appl/cmd/examplecmd.b
-.br
-.SH SEE ALSO
-.PP
-.IR examplelib (2)
-.SH BUGS
--- a/opt/skel/man/2/INDEX
+++ /dev/null
@@ -1,1 +1,0 @@
-examplelib examplelib
--- a/opt/skel/man/2/examplelib
+++ /dev/null
@@ -1,26 +1,0 @@
-.TH EXAMPLELIB 2
-.SH NAME
-examplelib \- Example library in /opt skeleton project
-.SH SYNOPSIS
-.EX
-include "opt/skel/module/examplelib.m";
-        examplelib: ExampleLib;
-examplelib = load ExampleLib ExampleLib->PATH;
-
-init: fn();
-
-.EE
-.SH DESCRIPTION
-.PP
-This module provide example how to implement library in /opt project.
-.PP
-.B init
-will say "hi" to you.
-.SH SOURCE
-.PP
-.B /opt/skel/appl/lib/examplelib.b
-.br
-.SH SEE ALSO
-.PP
-.IR examplecmd (1)
-.SH BUGS
--- a/opt/skel/man/mkfile
+++ /dev/null
@@ -1,9 +1,0 @@
-PKGDIR=..
-<$PKGDIR/mkconfig
-
-
-MANDIRS=\
-	1\
-	2\
-
-<$MKFILES/mkindices
--- a/opt/skel/mkconfig
+++ /dev/null
@@ -1,26 +1,0 @@
-<$ROOT/mkconfig
-
-
-# PKGDIR: [host,emu] path to project's root (from mkfile's dir).
-# Used to run tests. Also very useful to simplify paths in any mkfile.
-PKGDIR=$PKGDIR	# MUST BE SET IN EVERY mkfile BEFORE INCLUDING THIS mkconfig!
-
-# OPTDIR: [host,emu] path to dir with opt/ subdir (from mkfile's dir).
-# Used to find modules by relative path (e.g. opt/powerman/tap/module/t.m).
-OPTDIR=${OSTARG:Inferno=/}
-OPTDIR=${OPTDIR:os=$INFERNO_HOME}
-
-# MKFILES: [host,emu] path to mkfiles/ dir (from mkfile's dir).
-# Used to find helper files needed by some mkfiles and ease including them.
-MKFILES=$OPTDIR/opt/mkfiles
-
-# EMUCMD: command to run .dis file from host os.
-# EMUPKGDIR: [emu] path to project's root (from $EMUCMD's dir).
-# Used to run tests from host os (e.g. $EMUCMD $EMUPKGDIR/appl/lib/t/smoke.dis).
-EMUCMD='emu-g sh -c "run /lib/sh/profile; \$1; shutdown -h"'
-EMUPKGDIR=/opt/skel
-
-
-# Default target (first target in first loaded mkfile).
-usage:QV:
-    echo mk all, install, test, clean or nuke
--- a/opt/skel/mkfile
+++ /dev/null
@@ -1,10 +1,0 @@
-PKGDIR=.
-<$PKGDIR/mkconfig
-
-
-DIRS=\
-	appl\
-	doc\
-	man\
-
-<$MKFILES/mksubdirs
--- a/opt/skel/module/examplelib.m
+++ /dev/null
@@ -1,6 +1,0 @@
-ExampleLib: module
-{
-	PATH: con "/opt/skel/dis/lib/examplelib.dis";
-
-	init: fn();
-};
--- a/usr/inferno/lib/profile
+++ b/usr/inferno/lib/profile
@@ -10,6 +10,3 @@
 ndb/cs
 ndb/dns
 
-# /opt package setup
-run /opt/setup/cmd
-run /opt/setup/man