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 qiv -t $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 psv $file
71 # plumb start page -w $file
73 # open office - s[xt][cdigmw], doc, xls, ppt
74 data matches '[a-zA-Z¡-￿0-9_\-./]+'
75 data matches '([a-zA-Z¡-￿0-9_\-./]+)\.([Ss][XxTt][CcDdIiGgMmWw]|[Dd][Oo][Cc]|[Xx][Ll][Ss]|[Pp][Pp][Tt])'
76 arg isfile $0
77 plumb to openoffice
78 plumb start openoffice $file
80 # existing files, possibly tagged by line number, go to editor
81 type is text
82 data matches '([.a-zA-Z¡-￿0-9_/\-]*[a-zA-Z¡-￿0-9_/\-])('$addr')?'
83 arg isfile $1
84 data set $file
85 attr add addr=$3
86 plumb to edit
87 plumb client $editor
89 # .h files are looked up in /usr/include and passed to edit
90 type is text
91 data matches '([a-zA-Z¡-￿0-9]+\.h)('$addr')?'
92 arg isfile /usr/include/$1
93 data set $file
94 attr add addr=$3
95 plumb to edit
96 plumb client $editor
98 # .h files are looked up in /usr/local/include and passed to edit
99 type is text
100 data matches '([a-zA-Z¡-￿0-9]+\.h)('$addr')?'
101 arg isfile /usr/local/include/$1
102 data set $file
103 attr add addr=$3
104 plumb to edit
105 plumb client $editor
107 # .h files are looked up in /usr/local/plan9/include and passed to edit
108 type is text
109 data matches '([a-zA-Z¡-￿0-9]+\.h)('$addr')?'
110 arg isfile /usr/local/plan9/include/$1
111 data set $file
112 attr add addr=$3
113 plumb to edit
114 plumb client $editor
116 # .m files are looked up in /sys/module and passed to edit
117 type is text
118 data matches '([a-zA-Z¡-￿0-9]+\.m)('$addr')?'
119 arg isfile /sys/module/$1
120 data set $file
121 attr add addr=$3
122 plumb to edit
123 plumb client window $editor
125 # faces -> new mail window for message
126 type is text
127 data matches '[a-zA-Z¡-￿0-9_\-./]+'
128 data matches '/mail/fs/[a-zA-Z¡-￿0-9/]+/[0-9]+'
129 plumb to showmail
130 plumb start window -r 4 120 750 600 upas/nedmail -s $0
132 # man index entries are synthesized
133 type is text
134 data matches '([a-zA-Z¡-￿0-9_\-./]+)\(([1-8])\)'
135 plumb start rc -c 'man '$2' '$1' >[2=1] | nobs | plumb -i -d edit -a ''action=showdata filename=/man/'$1'('$2')'''
137 # start rule for images without known suffixes
138 dst is image
139 arg isfile $data
140 plumb to image
141 plumb start qiv -t $data
143 # start rule for postscript without known suffixes
144 dst is postscript
145 arg isfile $data
146 plumb start gv $data