Blob


1 # these are generally in order from most specific to least,
2 # since first rule that fires wins.
4 include fileaddr
6 # declarations of ports without rules
7 plumb to seemail
8 plumb to showmail
10 # relative files as file: urls get made into absolute paths
11 type is text
12 data matches 'file:([.a-zA-Z¡-￿0-9_\-]([.a-zA-Z¡-￿0-9_/\-]*[a-zA-Z¡-￿0-9_/\-]))?'
13 arg isfile $1
14 data set file://$file
15 plumb to web
16 plumb start web $data
18 # urls go to web browser
19 type is text
20 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_?,%#~&/\-+=]+)*\.(jpe?g|JPE?G|gif|GIF|ps|PS|pdf|PDF)'
21 plumb to web
22 plumb start web $0
24 # html goes to web browser
25 # 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
34 # doc and rtf files go to wdoc2txt
35 type is text
36 data matches '[a-zA-Z¡-￿0-9_\-./]+'
37 data matches '([a-zA-Z¡-￿0-9_\-./]+)\.(doc|rtf)'
38 arg isfile $0
39 plumb to msword
40 plumb start wdoc2txt $file
42 # start rule for microsoft word documents without .doc suffix
43 type is text
44 dst is msword
45 plumb to msword
46 plumb start wdoc2txt $file
48 # email addresses get a new mail window
49 type is text
50 data matches '[a-zA-Z0-9_+.\-]+@[a-zA-Z0-9_+.\-]*'
51 plumb to sendmail
52 plumb start wmail $0
53 # plumb start window rc -c '''echo % mail '''$0'; mail '$0
55 # image files go to page
56 type is text
57 data matches '[a-zA-Z¡-￿0-9_\-./]+'
58 data matches '([a-zA-Z¡-￿0-9_\-./]+)\.(jpe?g|JPE?G|gif|GIF|tiff?|TIFF?|ppm|bit|png|PNG)'
59 arg isfile $0
60 plumb to image
61 plumb start page $file
63 # postscript/pdf/dvi go to page but not over the a plumb port
64 # the port is here for reference but is unused
65 type is text
66 data matches '[a-zA-Z¡-￿0-9_\-./]+'
67 data matches '([a-zA-Z¡-￿0-9_\-./]+)\.(ps|PS|eps|EPS|pdf|PDF|dvi|DVI)'
68 arg isfile $0
69 plumb to postscript
70 plumb start page $file
72 # open office - s[xt][cdigmw], doc, xls, ppt
73 data matches '[a-zA-Z¡-￿0-9_\-./]+'
74 data matches '([a-zA-Z¡-￿0-9_\-./]+)\.([Ss][XxTt][CcDdIiGgMmWw]|[Dd][Oo][Cc]|[Xx][Ll][Ss]|[Pp][Pp][Tt])'
75 arg isfile $0
76 plumb to openoffice
77 plumb start openoffice $file
79 # existing files, possibly tagged by line number, go to editor
80 type is text
81 data matches '([.a-zA-Z¡-￿0-9_/\-]*[a-zA-Z¡-￿0-9_/\-])('$addr')?'
82 arg isfile $1
83 data set $file
84 attr add addr=$3
85 plumb to edit
86 plumb client $editor
88 # .h files are looked up in /usr/include and passed to edit
89 type is text
90 data matches '([a-zA-Z¡-￿0-9]+\.h)('$addr')?'
91 arg isfile /usr/include/$1
92 data set $file
93 attr add addr=$3
94 plumb to edit
95 plumb client $editor
97 # .h files are looked up in /usr/local/include and passed to edit
98 type is text
99 data matches '([a-zA-Z¡-￿0-9]+\.h)('$addr')?'
100 arg isfile /usr/local/include/$1
101 data set $file
102 attr add addr=$3
103 plumb to edit
104 plumb client $editor
106 # .h files are looked up in $plan9/include and passed to edit
107 type is text
108 data matches '([a-zA-Z¡-￿0-9]+\.h)('$addr')?'
109 arg isfile $plan9/include/$1
110 data set $file
111 attr add addr=$3
112 plumb to edit
113 plumb client $editor
115 # .m files are looked up in /sys/module and passed to edit
116 type is text
117 data matches '([a-zA-Z¡-￿0-9]+\.m)('$addr')?'
118 arg isfile /sys/module/$1
119 data set $file
120 attr add addr=$3
121 plumb to edit
122 plumb client window $editor
124 # faces -> new mail window for message
125 type is text
126 data matches '[a-zA-Z¡-￿0-9_\-./]+'
127 data matches '/mail/fs/[a-zA-Z¡-￿0-9/]+/[0-9]+'
128 plumb to showmail
129 plumb start window -r 4 120 750 600 upas/nedmail -s $0
131 # man index entries are synthesized
132 type is text
133 data matches '([a-zA-Z¡-￿0-9_\-./]+)\(([1-8])\)'
134 plumb start rc -c 'man '$2' '$1' >[2=1] | nobs | plumb -i -d edit -a ''action=showdata filename=/man/'$1'('$2')'''
136 # start rule for images without known suffixes
137 dst is image
138 arg isfile $data
139 plumb to image
140 plumb start page $data
142 # start rule for postscript without known suffixes
143 dst is postscript
144 arg isfile $data
145 plumb start page $data