shithub: binrc

Download patch

ref: b82b52776f6c6cb34a2bca222e3c92ac918ae517
parent: 5cb4b786139c7e3ad5df18d5d7edc56634d111a0
author: glenda <glenda@narshaddaa>
date: Mon May 1 07:20:38 EDT 2023

add some flags

--- a/olenda
+++ b/olenda
@@ -1,6 +1,40 @@
 #!/bin/rc
 
+face = '/lib/face/48x48x4/g/glenda.1'
+bunny = /lib/bunny.bit
+img = $bunny
+refpath = /mnt/reform/kbdoled
 
+argv0 = $0
+fn usage {
+	echo >[1=2] 'usage:' $argv0 '[-bf] [-r reform/] [-i img.bit]'
+	exit 'usage'
+}
+
+while(~ $1 -*)
+	switch($1){
+	case -f
+		$img = $face
+		shift
+	case -b
+		$img = $bunny
+		shift
+	case -r
+		shift
+		$refpath = $1
+		shift
+
+	case -i
+		shift
+		$img = $1
+		shift
+
+	case -*
+		# Unknown flags trigger usage text
+		usage
+
+}
+
 # x0 = inc x0 i 
 fn inc {
 	echo $1^'+'^$2 | bc 
@@ -15,7 +49,7 @@
 	y1 = 32
 
 	for(nothing in `{seq 14}){
-		crop -r $x0 $y0 $x1 $y1 < /lib/bunny.bit | iconv -u > /mnt/reform/kbdoled
+		crop -r $x0 $y0 $x1 $y1 < $img | iconv -u > $refpath
 		#x0 = `{inc $x0 $i}
 		y0 = `{inc $y0 $i}
 		#x1 = `{inc $x1 $i}