From: Axel Belinfante <Axel.Belinfante@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?
Date: Wed, 12 Oct 2005 00:12:33 +0200 [thread overview]
Message-ID: <200510112212.j9BMCXg16278@zamenhof.cs.utwente.nl> (raw)
In-Reply-To: Your message of "Tue, 11 Oct 2005 17:47:38 -0300." <2ab7f24ab352cbde207196e9c6e2fa96@yourdomain.dom>
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
next prev parent reply other threads:[~2005-10-11 22:12 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-10-11 20:47 Federico G. Benavento
2005-10-11 22:12 ` Axel Belinfante [this message]
-- strict thread matches above, loose matches on Subject: below --
2005-10-11 20:12 Axel Belinfante
2005-10-11 21:19 ` Russ Cox
2005-10-12 22:48 ` Axel Belinfante
2005-11-28 20:49 ` Russ Cox
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200510112212.j9BMCXg16278@zamenhof.cs.utwente.nl \
--to=axel.belinfante@cs.utwente.nl \
--cc=9fans@cse.psu.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).