shithub: purgatorio

Download patch

ref: b5bc6572b0a82c52ab04bcf25e1ed76700deb246
parent: d0ab3a0dd8f6355b3603d0fb04043a9ae867639b
author: henesy <devnull@localhost>
date: Mon Nov 5 08: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/