From mboxrd@z Thu Jan 1 00:00:00 1970 MIME-Version: 1.0 In-Reply-To: References: <53567454.2050509@gmail.com> Date: Wed, 23 Apr 2014 19:03:41 +0200 Message-ID: From: =?UTF-8?B?QmVuY2UgRsOhYmnDoW4=?= To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net> Content-Type: multipart/alternative; boundary=bcaec51968e3e6c25504f7b8b6e5 Subject: Re: [9fans] writing to /dev/$winid/addr Topicbox-Message-UUID: db1ae53e-ead8-11e9-9d60-3106f5b1d025 --bcaec51968e3e6c25504f7b8b6e5 Content-Type: text/plain; charset=UTF-8 is '!' a metacharacter in regexes? regex(6) doesn't say anything about it. 2014-04-23 9:29 GMT+02:00 Alexander Kapshuk : > 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 > 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. > > > > --bcaec51968e3e6c25504f7b8b6e5 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
is '!' a metacharacter in regexes? regex(6) doesn&= #39;t say anything about it.


2014-04-23 9:29 GMT+02:00 Alexander Kapshuk <alexander.kapshuk@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 t= o 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
{
=C2=A0echo 'echo $SYSNAME!`uname -n`!$USER'
=C2=A0echo 'PS1=3D'':; '' PS2=3D'' ''&#= 39;
} >/dev/$winid/body
while(! echo -n '/[A-Z]+\![a-z0-9]+\![0-9a-z]+' >/dev/$winid/add= r >[2]/dev/null)
=C2=A0sleep 0.2
sel=3D`{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 s= tring
> 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 =C2=A0 =C2=A0 =C2=A0 =C2=A0may be written with any textual addres= s (line number,
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0regular express= ion, etc.), in the format understood by
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0button 3 but wi= thout the initial colon, including com-
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0pound addresses= , to set the address for text accessed
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0through the dat= a 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 gene= rated.
>
> How does one write to 'addr'? Clearly, the shortcoming is on m= y part.
> I'm just not sure what it is that's missing.
>
> Thanks.
>


--bcaec51968e3e6c25504f7b8b6e5--