From mboxrd@z Thu Jan 1 00:00:00 1970 Message-Id: <200510112212.j9BMCXg16278@zamenhof.cs.utwente.nl> To: Fans of the OS Plan 9 from Bell Labs <9fans@cse.psu.edu> Subject: Re: [9fans] find acme 'window' name from which program B2-ed? In-reply-to: Your message of "Tue, 11 Oct 2005 17:47:38 -0300." <2ab7f24ab352cbde207196e9c6e2fa96@yourdomain.dom> References: <2ab7f24ab352cbde207196e9c6e2fa96@yourdomain.dom> From: Axel Belinfante MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <16276.1129068753.1@zamenhof.cs.utwente.nl.cs.utwente.nl> Date: Wed, 12 Oct 2005 00:12:33 +0200 Topicbox-Message-UUID: 99e05caa-ead0-11e9-9d60-3106f5b1d025 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