I asked:
> >can I get at the name of the file from/in which I B2 nextpage?
>
> cat /mnt/acme/$winid/tag| awk '{print $1}'
thanks for the quick reply!
found later in acme(1) that it is even easier: echo $%
> >can I easily simulate B3 in box? (I can look this one up in the man)
> this one I don't know
seems not.
it turned out to be easier (and just as good, so far)
to just load the new page in the current window
(i.e. replace name in tag, and replace data in body)
I append my current 'nextpage' (in case someone is interested);
'prevpage' is the same apart for a s/+ 1/- 1/.
they assume a file named menu that contains the page names
in 'show' order.
what's missing is a test that t > 0, to avoid trying sed 0p .
the -n seems necessary when writing to addr
(without, I get: echo: write error: bad address syntax)
Some years ago I tried something similar
(managing a coffee/beer list) and I recall
that then I had to keep a ctl file open to
make sure that my echo to addr wasn't forgotten
by the time I would write to data; this seems to
be easier now (unless I misremember and the 'problem'
was not in writing data but in reading from it).
Axel.
#!/bin/rc
m=menu
id=$winid
f=$%
b=`{basename $f}
i=`{grep -n -h '^'^$b^'$' $m | sed 's/:.*//'}
t=`{echo $i + 1 | bc}
page=`{sed -n $t^p < $m}
if(~ $#page 0)
echo no such page
if not {
echo -n ',' > /mnt/acme/$id/addr
echo 'dot=addr' > /mnt/acme/$id/ctl
echo 'name '^`{pwd}^/^$page > /mnt/acme/$id/ctl
cat $page > /mnt/acme/$id/data
echo clean > /mnt/acme/$id/ctl
}
# that's all folks