summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorglenda <glenda@cirno>2022-09-13 13:20:23 +0000
committerglenda <glenda@cirno>2022-09-13 13:20:23 +0000
commit9d2a64a26740982587baab2f5938210bdba9accc (patch)
treef4802768e4a06b30e60d70cbe6f870f65492823f
parent92597a2d660285cf32eb0b88ec3d00b4fd48156e (diff)
Add APLDemo acme script
-rwxr-xr-xAPLDemo19
-rw-r--r--mkfile6
2 files changed, 24 insertions, 1 deletions
diff --git a/APLDemo b/APLDemo
new file mode 100755
index 0000000..fbf85b5
--- /dev/null
+++ b/APLDemo
@@ -0,0 +1,19 @@
+#!/bin/rc
+
+winid=`{grep -e '-apl' /mnt/acme/index | awk '{print $1}' }
+if(~ $#winid 0){
+ win apl &
+ exit
+}
+
+state=/tmp/apldemo.$winid.state
+if (test -e $state)
+ current=`{cat $state}
+if not
+ current=1
+
+next=`{echo $current + 1 | hoc}
+echo $next > $state
+
+cat $1 | awk 'NR=='$current > /mnt/acme/$winid/body
+
diff --git a/mkfile b/mkfile
index 9df4d9f..1f262de 100644
--- a/mkfile
+++ b/mkfile
@@ -26,10 +26,14 @@ DISTFILES=\
runtime/stdlib.apl\
runtime/start.apl\
+ACMEFILES=\
+ APLDemo\
+
default:V: all
-install: $DISTFILES
+install: $DISTFILES $ACMEFILES
mkdir -p /sys/lib/apl/runtime
cp $DISTFILES /sys/lib/apl/runtime
+ cp $ACMEFILES /acme/bin
</sys/src/cmd/mkone