summaryrefslogtreecommitdiff
path: root/APLDemo
blob: 3480bacc1a05aa7150b450f464dd0c4fdac119f8 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/bin/rc

winid=`{grep -e '-apl' /mnt/acme/index | awk '{print $1}' }
if(~ $#winid 0){
	kill apl | rc
	echo 0 `{cat $1 | wc -l} >> /mnt/apldemo/data
	win apl &
	sleep 1
	winid=`{grep -e '-apl' /mnt/acme/index | awk '{print $1}' }
	rm -f /tmp/apldemo.$winid.state
	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
echo $current `{cat $1 | wc -l} >> /mnt/apldemo/data