code: 9ferno

Download patch

ref: 73df3774832b33b2e7a449898d064ab8b46aafe4
parent: 55eddf2f2cd9d53ef6f576ddb47cee7b5c1b436b
author: henesy <unknown>
date: Mon Nov 5 14:49:24 EST 2018

add naive find to ease searching

--- /dev/null
+++ b/dis/find
@@ -1,0 +1,41 @@
+#!/dis/sh
+# find a given filename in a series of paths
+# find mc -i /dis /appl
+
+load expr
+load std
+
+fn usage {
+	echo >[1=2] usage: find filename paths...
+	exit usage
+}
+
+if {! ntest ${expr $#* 2 ge} } {
+	usage
+}
+
+# Get grep options
+ind=1
+dirs=()
+opts=()
+for i in $* { 
+	if {~ $i -*} {
+		opts=($opts $1)
+		ind = ${expr $ind 1 +}
+	}
+}
+
+# Get grep pattern
+pattern=${index $ind $*}
+ind = ${expr $ind 1 +}
+
+# Get directory list
+n = 1
+for i in $* {
+	if { ntest ${expr $n $ind ge} } {
+		dirs = ($dirs $i)
+	}
+	n = ${expr $n 1 +}
+}
+
+du -an $dirs | grep $opts $pattern
--- a/dis/makestubs
+++ b/dis/makestubs
@@ -3,7 +3,7 @@
 # Opt material courtesy of powerman
 user=`{cat /dev/user}
 home=/usr/$user
-dirs=($home/keyring /tmp /mnt/keys /mnt/registry /n/remote /chan /keydb)
+dirs=($home/keyring /tmp /mnt/keys /mnt/registry /mnt/acme /n/remote /chan /keydb)
 
 mkdir -p $home
 cp -r /usr/inferno/* $home/