9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* Re: [9fans] slight glossing over 8) ?
@ 2002-11-12 19:21 Russ Cox
  2002-11-14 23:04 ` matt
  0 siblings, 1 reply; 11+ messages in thread
From: Russ Cox @ 2002-11-12 19:21 UTC (permalink / raw)
  To: 9fans

if you _really_ want the right regexp, you should
use the ones from webfs, due to jeff brown.

/* RE character-class components -- these go in brackets */
#define PUNCT			"\\-_.!~*'()"
#define RES			";/?:@&=+$,"
#define ALNUM		"a-zA-Z0-9"
#define HEX			"0-9a-fA-F"
#define UNRES			ALNUM PUNCT

/* RE components; _N => has N parenthesized subexpressions when expanded */
#define ESCAPED_1			"(%[" HEX "][" HEX "])"
#define URIC_2			"([" RES UNRES "]|" ESCAPED_1 ")"
#define URICNOSLASH_2		"([" UNRES ";?:@&=+$,]|" ESCAPED_1 ")"
#define USERINFO_2		"([" UNRES ";:&=+$,]|" ESCAPED_1 ")"
#define PCHAR_2			"([" UNRES ":@&=+$,]|" ESCAPED_1 ")"
#define PSEGCHAR_3		"([/;]|" PCHAR_2 ")"

Retab retab[] =	/* view in constant width Font */
{
[REsplit]
	"^(([^:/?#]+):)?(//([^/?#]*))?([^?#]+)?(\\?([^#]*))?(#(.*))?$", nil, 0,
	/* |-scheme-|      |-auth.-|  |path--|    |query|     |--|frag */
	{  2,              4,         5,          7,          9},

[REscheme]
	"^[a-z][a-z0-9+-.]*$", nil, 0,
	{ 0, },

[REunknowndata]
	"^" URICNOSLASH_2 URIC_2 "*$", nil, 0,
	{ 0, },

[REauthority]
	"^(((" USERINFO_2 "*)@)?(((\\[[^\\]@]+\\])|([^:\\[@]+))(:([0-9]*))?)?)?$", nil, 0,
	/* |----user info-----|  |--------host----------------|  |-port-| */
	{  2,                    7,                              12, },

[REhost]
	"^(([a-zA-Z0-9\\-.]+)|(\\[([a-fA-F0-9.:]+)\\]))$", nil, 0,
	/* |--regular host--|     |-IPv6 literal-| */
	{  2,                     4, },

[REuserinfo]
	"^(([^:]*)(:([^:]*))?)$", nil, 0,
	/* |user-|  |pass-| */
	{  2,       4, },

[REabspath]
	"^/" PSEGCHAR_3 "*$", nil, 0,
	{ 0, },

[REquery]
	"^" URIC_2 "*$", nil, 0,
	{ 0, },

[REfragment]
	"^" URIC_2 "*$", nil, 0,
	{ 0, },

[REhttppath]
	"^.*$", nil, 0,
	{ 0, },

[REftppath]
	"^(.+)(;[tT][yY][pP][eE]=([aAiIdD]))?$", nil, 0,
	/*|--|-path              |ftptype-| */
	{ 1,                     3, },

[REfilepath]
	"^.*$", nil, 0,
	{ 0, },
};



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [9fans] slight glossing over 8) ?
  2002-11-12 19:21 [9fans] slight glossing over 8) ? Russ Cox
@ 2002-11-14 23:04 ` matt
  2002-11-14 23:07   ` andrey mirtchovski
  0 siblings, 1 reply; 11+ messages in thread
From: matt @ 2002-11-14 23:04 UTC (permalink / raw)
  To: 9fans


> if you _really_ want the right regexp, you should
> use the ones from webfs, due to jeff brown.

I think I'll stick to the na�ve one for now 8)

Just to let people know that web_waiter.py does it's job just as well on
FreeBSD / Enlightenment / Mozilla 1.0
presumably that's an indication that it will work with other X11 desktops
too

It's not just for drawterm based browsing btw. it's certainly quicker than
cutting and pasting into vnc and to be honest it's better than using the
browser in the 'normal' way. Being a web developer I'm often testing a
different URL for an hour or so and then on to the next one. Not having to
mess about with favourites is a boon. my acme dump contains the current set
of URLs. So acme has reduced my edit / refresh cycle for which I'm grateful.


I don't think I could give up my multi screen setup now, highlighted when I
go in for my one day a week in the office.

Can I ask those who know, how plan9 is fixed for dual screen output?

m



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [9fans] slight glossing over 8) ?
  2002-11-14 23:04 ` matt
@ 2002-11-14 23:07   ` andrey mirtchovski
  0 siblings, 0 replies; 11+ messages in thread
From: andrey mirtchovski @ 2002-11-14 23:07 UTC (permalink / raw)
  To: 9fans

On Thu, 14 Nov 2002, matt wrote:

>
> Can I ask those who know, how plan9 is fixed for dual screen output?

it's not. there was some talk about it in april, but nothing was done...

andrey




^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [9fans] slight glossing over 8) ?
  2002-11-12 18:30 Russ Cox
@ 2002-11-12 18:50 ` matt
  0 siblings, 0 replies; 11+ messages in thread
From: matt @ 2002-11-12 18:50 UTC (permalink / raw)
  To: 9fans

> oh, right.  you know, you don't really need any quotes.
> two quotes is the same as none.

yes that works just as well

it was the regex all along

with

file='([:.]?[a-zA-Z0-9_?,%#~=&/\-]+)*'

it all works fine

with the regex supplied on the man page
file='([:.][a-zA-Z0-9_?,%#~=&/\-]+)*'

http://tiger/a=5

fails

and

http://tiger/:a=5

succeeds





^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [9fans] slight glossing over 8) ?
@ 2002-11-12 18:30 Russ Cox
  2002-11-12 18:50 ` matt
  0 siblings, 1 reply; 11+ messages in thread
From: Russ Cox @ 2002-11-12 18:30 UTC (permalink / raw)
  To: 9fans

oh, right.  you know, you don't really need any quotes.
two quotes is the same as none.

that is,

/usr/matt/bin/web_plumber -w tcp!192.168.1.101!8005 ''$0''

is like

x=''
/usr/matt/bin/web_plumber -w tcp!192.168.1.101!8005 $x$0$x

while this

window webbrowser ''''$0''''

is like

x=''''
window webbrowser $x$0$x



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [9fans] slight glossing over 8) ?
  2002-11-12 17:02 Russ Cox
@ 2002-11-12 18:21 ` matt
  0 siblings, 0 replies; 11+ messages in thread
From: matt @ 2002-11-12 18:21 UTC (permalink / raw)
  To: 9fans

> > plumb start /usr/matt/bin/web_plumber -w tcp!192.168.1.101!8005 ''$0''

> plumb start window webbrowser ''''$0''''
> and i need four quotes.

If I use four quotes the string 'http://tiger' gets passed including the
quotes

It's because I don't use the extra window command
If I add window I do need four quotes as you rightly discovered

> ps |grep Broken

 it's in my naive C skills in web_plumber.c :

fprint(wfd, argv[0]);

too much php where fprint is fprint(int, string)
I've updated my http://proweb.net/~matt/p9-4/web_plumber.c accordingly

thanks for your help

m





^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [9fans] slight glossing over 8) ?
@ 2002-11-12 17:02 Russ Cox
  2002-11-12 18:21 ` matt
  0 siblings, 1 reply; 11+ messages in thread
From: Russ Cox @ 2002-11-12 17:02 UTC (permalink / raw)
  To: 9fans

> plumb start /usr/matt/bin/web_plumber -w tcp!192.168.1.101!8005 ''$0''

i don't understand why this works.
i've been testing with

type	is	text
data	matches	'=.*'
plumb	to	echo
plumb	start	window webbrowser ''''$0''''

and i need four quotes.

i also can't reproduce your print format
problem, but here's how to debug it:
plumb

	http://whatever/%s%s%s%s%s%s%s%s%s%s/

and then do

	ps |grep Broken



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [9fans] slight glossing over 8) ?
@ 2002-11-12 16:03 rob pike, esq.
  0 siblings, 0 replies; 11+ messages in thread
From: rob pike, esq. @ 2002-11-12 16:03 UTC (permalink / raw)
  To: 9fans

> http://tiger/%7ematt/home.html

It's obvious the %7e is somehow getting into a print format string.
But where?  A quick test in my environment finds such strings
going through the plumber to their destination unaffected.

-rob



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [9fans] slight glossing over 8) ?
  2002-11-12  2:40 Russ Cox
@ 2002-11-12 12:15 ` matt
  0 siblings, 0 replies; 11+ messages in thread
From: matt @ 2002-11-12 12:15 UTC (permalink / raw)
  To: 9fans

> plumb start window webbrowser ''''$0''''

the problem lies elsewhere

I stumbled on to it when right clicking in acme

my url is http://tiger/a=7

in my plumb rules :

file='([:.][a-zA-Z0-9_?,%#~&/\-=]+)*'

with the = included doesn't match the url

if I change it to file ='.*' it worked fine

from there I changed it to

file='([:.]?[a-zA-Z0-9_?,%#~&/\-=]+)*'

and it worked

and now I can use

plumb start /usr/matt/bin/web_plumber -w tcp!192.168.1.101!8005 ''$0''

I found the : in the file regex puzzling ("surely it's an illegal filename
char") and
I seem to have opened a can of worms on myself.
I started investigating URL syntax : ftp://ftp.isi.edu/in-notes/rfc2616.txt


http://tiger/~matt/home.html
goes through fine

but
http://tiger/%7ematt/home.html

ends up as
http://tiger/0.000000e+00matt/home.html

If it ends up affecting me I'll look into it more.

m











^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [9fans] slight glossing over 8) ?
@ 2002-11-12  2:40 Russ Cox
  2002-11-12 12:15 ` matt
  0 siblings, 1 reply; 11+ messages in thread
From: Russ Cox @ 2002-11-12  2:40 UTC (permalink / raw)
  To: 9fans

plumb start window webbrowser ''''$0''''

should work.  the problem is that it gets
tokenized twice -- once by plumber and
once again by rio (window can only pass a single
string to rio).

note that you have the same problem on the
command line.

	g% cat /bin/webbrowser
	#!/bin/rc

	# simplest webbrowser ever
	whatis '*'
	sleep 100
	g%
	g% x='=hello'
	g% window webbrowser $x	# fails
	g% window webbrowser ''''$x''''	# works

there should probably be quoting and unquoting
operators in the shell to make things like
this less troublesome.  (if window could
add the necessary quotes before handing
off to rio, we'd be better off.)  but it's not
clear what the syntax should be.  i kind of
which td had used $^ to concat like byron
did, and then we could use $" to produce
a quoted version of a list.  we'd still need a
way to unquote a string into a list though.
note that $' is out because

	g% '#a'=123
	g% echo $'#a'
	123
	g%




^ permalink raw reply	[flat|nested] 11+ messages in thread

* [9fans] slight glossing over 8) ?
@ 2002-11-12  0:58 matt
  0 siblings, 0 replies; 11+ messages in thread
From: matt @ 2002-11-12  0:58 UTC (permalink / raw)
  To: 9fans

The plumb man page kindly supplies a rule for web pages

this includes the definition  :
 file='([:.][a-zA-Z0-9_?,%#~&/\-]+)*'

and then the rule culminating in

plumb start window webbrowser $0

what it didn't mention was that this rule didn't work for all URLs, in
particular one's containing a =

adding = to the file regex is no good because although the pattern matches
the plumb start barfs on the = in $data
with
rc: line 2: token '=': syntax error

I've tried various quoting to no avail

any ideas?

m



^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2002-11-14 23:07 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-11-12 19:21 [9fans] slight glossing over 8) ? Russ Cox
2002-11-14 23:04 ` matt
2002-11-14 23:07   ` andrey mirtchovski
  -- strict thread matches above, loose matches on Subject: below --
2002-11-12 18:30 Russ Cox
2002-11-12 18:50 ` matt
2002-11-12 17:02 Russ Cox
2002-11-12 18:21 ` matt
2002-11-12 16:03 rob pike, esq.
2002-11-12  2:40 Russ Cox
2002-11-12 12:15 ` matt
2002-11-12  0:58 matt

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).