9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* 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
* 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 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, 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
* [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  2:40 [9fans] slight glossing over 8) ? Russ Cox
2002-11-12 12:15 ` matt
  -- strict thread matches above, loose matches on Subject: below --
2002-11-12 19:21 Russ Cox
2002-11-14 23:04 ` matt
2002-11-14 23:07   ` andrey mirtchovski
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  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).