blob: 4edd4327c731bbf8476ca0956dc16492d0dfe54c [file] [log] [blame]
rsce70f3052003-11-23 18:30:04 +00001# these are generally in order from most specific to least,
2# since first rule that fires wins.
3
4include fileaddr
5
6# declarations of ports without rules
7plumb to seemail
8plumb to showmail
9
rscdee84542004-08-11 02:16:07 +000010# relative files as file: urls get made into absolute paths
11type is text
12data matches 'file:([.a-zA-Z¡-￿0-9_\-]([.a-zA-Z¡-￿0-9_/\-]*[a-zA-Z¡-￿0-9_/\-]))?'
13arg isfile $1
14data set file://$file
15plumb to web
16plumb start web $data
17
rsc3040f282004-06-09 14:07:16 +000018# urls go to web browser
rsce70f3052003-11-23 18:30:04 +000019type is text
20data 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_?,%#~&/\-+=]+)*\.(jpe?g|JPE?G|gif|GIF|ps|PS|pdf|PDF)'
rscdee84542004-08-11 02:16:07 +000021plumb to web
rsc3040f282004-06-09 14:07:16 +000022plumb start web $0
23
24# html goes to web browser
rscdee84542004-08-11 02:16:07 +000025# uncomment if you want this behavior
26# commented out is more like plan 9
27#
28# type is text
29# data matches '[a-zA-Z¡-￿0-9_\-./]+'
30# data matches '([a-zA-Z¡-￿0-9_\-./]+)\.(html|htm|HTM|HTML)'
31# arg isfile $0
32# plumb start web $file
rsce70f3052003-11-23 18:30:04 +000033
34# doc and rtf files go to wdoc2txt
35type is text
36data matches '[a-zA-Z¡-￿0-9_\-./]+'
37data matches '([a-zA-Z¡-￿0-9_\-./]+)\.(doc|rtf)'
38arg isfile $0
39plumb to msword
40plumb start wdoc2txt $file
41
42# start rule for microsoft word documents without .doc suffix
43type is text
44dst is msword
45plumb to msword
46plumb start wdoc2txt $file
47
48# email addresses get a new mail window
49type is text
50data matches '[a-zA-Z0-9_+.\-]+@[a-zA-Z0-9_+.\-]*'
51plumb to sendmail
rscf69a6ff2004-08-22 15:38:10 +000052plumb start wmail $0
53# plumb start window rc -c '''echo % mail '''$0'; mail '$0
rsce70f3052003-11-23 18:30:04 +000054
55# image files go to page
56type is text
57data matches '[a-zA-Z¡-￿0-9_\-./]+'
rsc661756d2004-04-21 23:34:32 +000058data matches '([a-zA-Z¡-￿0-9_\-./]+)\.(jpe?g|JPE?G|gif|GIF|tiff?|TIFF?|ppm|bit|png|PNG)'
rsce70f3052003-11-23 18:30:04 +000059arg isfile $0
60plumb to image
rsc4de03b52005-01-11 19:46:06 +000061plumb start page $file
rsce70f3052003-11-23 18:30:04 +000062
63# postscript/pdf/dvi go to page but not over the a plumb port
64# the port is here for reference but is unused
65type is text
66data matches '[a-zA-Z¡-￿0-9_\-./]+'
67data matches '([a-zA-Z¡-￿0-9_\-./]+)\.(ps|PS|eps|EPS|pdf|PDF|dvi|DVI)'
68arg isfile $0
69plumb to postscript
rsc4de03b52005-01-11 19:46:06 +000070plumb start page $file
rsce70f3052003-11-23 18:30:04 +000071
rscdee84542004-08-11 02:16:07 +000072# open office - s[xt][cdigmw], doc, xls, ppt
73data matches '[a-zA-Z¡-￿0-9_\-./]+'
74data matches '([a-zA-Z¡-￿0-9_\-./]+)\.([Ss][XxTt][CcDdIiGgMmWw]|[Dd][Oo][Cc]|[Xx][Ll][Ss]|[Pp][Pp][Tt])'
75arg isfile $0
76plumb to openoffice
77plumb start openoffice $file
78
rsce70f3052003-11-23 18:30:04 +000079# existing files, possibly tagged by line number, go to editor
80type is text
81data matches '([.a-zA-Z¡-￿0-9_/\-]*[a-zA-Z¡-￿0-9_/\-])('$addr')?'
82arg isfile $1
83data set $file
84attr add addr=$3
85plumb to edit
rsc32f69c32003-12-11 17:48:38 +000086plumb client $editor
rsce70f3052003-11-23 18:30:04 +000087
rscccee5482003-12-04 19:18:06 +000088# .h files are looked up in /usr/include and passed to edit
rsce70f3052003-11-23 18:30:04 +000089type is text
90data matches '([a-zA-Z¡-￿0-9]+\.h)('$addr')?'
rscccee5482003-12-04 19:18:06 +000091arg isfile /usr/include/$1
92data set $file
93attr add addr=$3
94plumb to edit
rsc32f69c32003-12-11 17:48:38 +000095plumb client $editor
rscccee5482003-12-04 19:18:06 +000096
97# .h files are looked up in /usr/local/include and passed to edit
98type is text
99data matches '([a-zA-Z¡-￿0-9]+\.h)('$addr')?'
100arg isfile /usr/local/include/$1
101data set $file
102attr add addr=$3
103plumb to edit
rsc32f69c32003-12-11 17:48:38 +0000104plumb client $editor
rscccee5482003-12-04 19:18:06 +0000105
rsc4de03b52005-01-11 19:46:06 +0000106# .h files are looked up in $plan9/include and passed to edit
rscccee5482003-12-04 19:18:06 +0000107type is text
108data matches '([a-zA-Z¡-￿0-9]+\.h)('$addr')?'
rsc4de03b52005-01-11 19:46:06 +0000109arg isfile $plan9/include/$1
rsce70f3052003-11-23 18:30:04 +0000110data set $file
111attr add addr=$3
112plumb to edit
rsc32f69c32003-12-11 17:48:38 +0000113plumb client $editor
rsce70f3052003-11-23 18:30:04 +0000114
115# .m files are looked up in /sys/module and passed to edit
116type is text
117data matches '([a-zA-Z¡-￿0-9]+\.m)('$addr')?'
118arg isfile /sys/module/$1
119data set $file
120attr add addr=$3
121plumb to edit
rsc32f69c32003-12-11 17:48:38 +0000122plumb client window $editor
rsce70f3052003-11-23 18:30:04 +0000123
124# faces -> new mail window for message
125type is text
126data matches '[a-zA-Z¡-￿0-9_\-./]+'
127data matches '/mail/fs/[a-zA-Z¡-￿0-9/]+/[0-9]+'
128plumb to showmail
129plumb start window -r 4 120 750 600 upas/nedmail -s $0
130
131# man index entries are synthesized
132type is text
133data matches '([a-zA-Z¡-￿0-9_\-./]+)\(([1-8])\)'
rsc6b53e2a2004-04-19 05:53:47 +0000134plumb start rc -c 'man '$2' '$1' >[2=1] | nobs | plumb -i -d edit -a ''action=showdata filename=/man/'$1'('$2')'''
rsce70f3052003-11-23 18:30:04 +0000135
136# start rule for images without known suffixes
137dst is image
rsc32f69c32003-12-11 17:48:38 +0000138arg isfile $data
rsce70f3052003-11-23 18:30:04 +0000139plumb to image
rsc4de03b52005-01-11 19:46:06 +0000140plumb start page $data
rsce70f3052003-11-23 18:30:04 +0000141
142# start rule for postscript without known suffixes
143dst is postscript
144arg isfile $data
rsc4de03b52005-01-11 19:46:06 +0000145plumb start page $data