9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] web plumbing on OS X drawterm
@ 2008-07-16  6:11 a
  2008-07-16 12:57 ` Russ Cox
  2008-07-16 14:08 ` Skip Tavakkolian
  0 siblings, 2 replies; 6+ messages in thread
From: a @ 2008-07-16  6:11 UTC (permalink / raw)
  To: 9fans

OS X has this command 'open', which I'm told exists or is
available on other unixes. It's about as close as you get to
'plumb' when in foreign lands. You call it like 'open
http://9fans.net' or 'open /etc/passwd' and it does more
or less what you'd expect, finding (usually) the right app.

I mostly get to my Plan 9 cpu servers via drawterm from
my OS X laptop these days (9vx soon, once I get a
comfortable environment there). I have a script that
calls drawterm with the right arguments. I just added
this to the script:
	mkfifo /tmp/open.fifo
	while () {open `{cat open.fifo}}
I also have a srcipt on the Plan 9 side, 'web':
	#!/bin/rc

	fifoname=/mnt/term/tmp/open.fifo

	if (test -e $fifoname)
		echo $* > $fifoname
	if not
		lynx2txt $*
(for those unfamiliar, lynx2txt is like wurl2txt, but using
fgb's lynx port instead of hget to get things like tables).
So now 'web http://9fans.net' on my Plan 9 box opens up
a Safari window. Stick that in a plumbing rule and I can
now click on urls in my drawterm'd acme and have a
Safari window come up.

It's pretty nice, and took all of about two minutes. Maybe
useful for others.
Anthony




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

* Re: [9fans] web plumbing on OS X drawterm
  2008-07-16  6:11 [9fans] web plumbing on OS X drawterm a
@ 2008-07-16 12:57 ` Russ Cox
  2008-07-16 13:06   ` a
  2008-07-16 14:08 ` Skip Tavakkolian
  1 sibling, 1 reply; 6+ messages in thread
From: Russ Cox @ 2008-07-16 12:57 UTC (permalink / raw)
  To: 9fans

> I mostly get to my Plan 9 cpu servers via drawterm from
> my OS X laptop these days (9vx soon, once I get a
> comfortable environment there). I have a script that
> calls drawterm with the right arguments. I just added
> this to the script:
> 	mkfifo /tmp/open.fifo
> 	while () {open `{cat open.fifo}}

There is a web command in plan9port, so this doesn't
need to be OS X specific:

	mkfifo /tmp/web.fifo
	while() { web `{cat /tmp/web.fifo} }

Russ



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

* Re: [9fans] web plumbing on OS X drawterm
  2008-07-16 12:57 ` Russ Cox
@ 2008-07-16 13:06   ` a
  0 siblings, 0 replies; 6+ messages in thread
From: a @ 2008-07-16 13:06 UTC (permalink / raw)
  To: 9fans

Ah, right. I'd started out using p9p's 'web', but
decided having access to 'open' might be useful
in other contexts, even if i'm not plumbing
anything to it right now.

Project for today is sort of the inverse: how to
make OS X use Acme-sac or B for text files.
Anyone looked at it?
Anthony




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

* Re: [9fans] web plumbing on OS X drawterm
  2008-07-16  6:11 [9fans] web plumbing on OS X drawterm a
  2008-07-16 12:57 ` Russ Cox
@ 2008-07-16 14:08 ` Skip Tavakkolian
  2008-07-16 18:19   ` Antonin Vecera
  1 sibling, 1 reply; 6+ messages in thread
From: Skip Tavakkolian @ 2008-07-16 14:08 UTC (permalink / raw)
  To: 9fans

i added /dev/showfile for windows a while back.  in that case, dt
hands anything it is given on /dev/showfile to explorer (closest thing
to plumber on windows).  plumb rule for urls hands them to a script
that looks like this:

	echo -n $* > /mnt/term/dev/showfile

> 	mkfifo /tmp/open.fifo
> 	while () {open `{cat open.fifo}}
> I also have a srcipt on the Plan 9 side, 'web':
> 	#!/bin/rc
>
> 	fifoname=/mnt/term/tmp/open.fifo
>
> 	if (test -e $fifoname)
> 		echo $* > $fifoname
> 	if not
> 		lynx2txt $*




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

* Re: [9fans] web plumbing on OS X drawterm
  2008-07-16 14:08 ` Skip Tavakkolian
@ 2008-07-16 18:19   ` Antonin Vecera
  2008-07-16 19:00     ` Skip Tavakkolian
  0 siblings, 1 reply; 6+ messages in thread
From: Antonin Vecera @ 2008-07-16 18:19 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

On Wed, Jul 16, 2008 at 4:08 PM, Skip Tavakkolian <9nut@9netics.com> wrote:
> i added /dev/showfile for windows a while back.  in that case, dt
> hands anything it is given on /dev/showfile to explorer (closest thing
> to plumber on windows).  plumb rule for urls hands them to a script
> that looks like this:
>
>        echo -n $* > /mnt/term/dev/showfile

Could you please tell me in more details where should I write it?
I am not familiar with plumb rules.

Antonin



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

* Re: [9fans] web plumbing on OS X drawterm
  2008-07-16 18:19   ` Antonin Vecera
@ 2008-07-16 19:00     ` Skip Tavakkolian
  0 siblings, 0 replies; 6+ messages in thread
From: Skip Tavakkolian @ 2008-07-16 19:00 UTC (permalink / raw)
  To: 9fans

>>        echo -n $* > /mnt/term/dev/showfile
>
> Could you please tell me in more details where should I write it?
> I am not familiar with plumb rules.

in $home/lib/plumbing add a line to plumb to winstart for the
following rule:

	type	is text
	data	matches '(https?|ftp|file|gopher|mailto|news|nntp|telnet|wais|prospero)://[a-zA-Z0-9_@\-]+([.:][a-zA-Z0-9_@\-]+)*/?[a-zA-Z0-9_?,%#~&/\-+=]+([:.][a-zA-Z0-9_?,%#~&/\-+=]+)*'
	plumb	to web
	plumb	start winstart $0

the script /rc/bin/winstart looks like this:

	#!/bin/rc
	echo -n $* > /mnt/term/dev/showfile

a better script would test existance of /dev/showfile first.




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

end of thread, other threads:[~2008-07-16 19:00 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-07-16  6:11 [9fans] web plumbing on OS X drawterm a
2008-07-16 12:57 ` Russ Cox
2008-07-16 13:06   ` a
2008-07-16 14:08 ` Skip Tavakkolian
2008-07-16 18:19   ` Antonin Vecera
2008-07-16 19:00     ` Skip Tavakkolian

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