9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: Alexander Kapshuk <alexander.kapshuk@gmail.com>
To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net>
Subject: Re: [9fans] writing to /dev/$winid/addr
Date: Wed, 23 Apr 2014 10:29:03 +0300	[thread overview]
Message-ID: <CAJ1xhMUXp74-aY9dgUdpHyOkiYee8qBGYhHjwb3cvBABYghe1g@mail.gmail.com> (raw)
In-Reply-To: <53567454.2050509@gmail.com>

Turns out, the reason why writing '/[A-Z]+\![a-z0-9]+\![0-9a-z]+' to
/dev/$winid/addr would fail for me is because sending a string
represented by the regular expression in question to /dev/$winid/body
was immediately followed by writing the regexp to addr. Putting a
while loop on the 'echo regexp >addr' followed by sleep, seems to have
been the answer. The script sets the prompt and the name of the window
running win when logged onto a UNIX machine.
Here's the script for those interested.

#!/bin/rc
{
 echo 'echo $SYSNAME!`uname -n`!$USER'
 echo 'PS1='':; '' PS2='' '''
} >/dev/$winid/body
while(! echo -n '/[A-Z]+\![a-z0-9]+\![0-9a-z]+' >/dev/$winid/addr >[2]/dev/null)
 sleep 0.2
sel=`{cat /dev/$winid/xdata}
echo name $sel >/dev/$winid/ctl

On Tue, Apr 22, 2014 at 4:53 PM, Alexander Kapshuk
<alexander.kapshuk@gmail.com> wrote:
> Howdy,
>
> I'm working on a script where I want to get hold of a particular string
> and use it as a new name of a particular window.
>
> What I've tried so far, although not successfully, is writing to
> /dev/$winid/addr with the intention of then being able to read the
> string found from the /dev/$winid/data or /dev/$winid/xdata.
>
> acme(4) says,
> addr        may be written with any textual address (line number,
>                regular expression, etc.), in the format understood by
>                button 3 but without the initial colon, including com-
>                pound addresses, to set the address for text accessed
>                through the data file.
>
> Here's an example of what I tried.
> echo '/[A-Z]+\![a-z0-9]+\![0-9a-z]+' >/dev/$winid/addr
>
> Which results in an 'address out of bounds' message being generated.
>
> How does one write to 'addr'? Clearly, the shortcoming is on my part.
> I'm just not sure what it is that's missing.
>
> Thanks.
>



  reply	other threads:[~2014-04-23  7:29 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-22 13:53 Alexander Kapshuk
2014-04-23  7:29 ` Alexander Kapshuk [this message]
2014-04-23 17:03   ` Bence Fábián
2014-04-23 18:07     ` erik quanstrom
2014-04-23 19:13       ` Alexander Kapshuk
2014-04-23 19:34         ` erik quanstrom
2014-04-24  4:15           ` Alexander Kapshuk
2014-04-24  4:18             ` Jacob Todd
2014-04-24  4:25               ` Alexander Kapshuk
2014-04-25  6:35                 ` Bence Fábián

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=CAJ1xhMUXp74-aY9dgUdpHyOkiYee8qBGYhHjwb3cvBABYghe1g@mail.gmail.com \
    --to=alexander.kapshuk@gmail.com \
    --cc=9fans@9fans.net \
    /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).