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 # cheap http/gif,jpeg,ps,pdf renderer
11 type is text
12 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)'
13 plumb start rc -c 'hget '$0' | page -w'
15 # doc and rtf files go to wdoc2txt
16 type is text
17 data matches '[a-zA-Z¡-￿0-9_\-./]+'
18 data matches '([a-zA-Z¡-￿0-9_\-./]+)\.(doc|rtf)'
19 arg isfile $0
20 plumb to msword
21 plumb start wdoc2txt $file
23 # start rule for microsoft word documents without .doc suffix
24 type is text
25 dst is msword
26 plumb to msword
27 plumb start wdoc2txt $file
29 # email addresses get a new mail window
30 type is text
31 data matches '[a-zA-Z0-9_+.\-]+@[a-zA-Z0-9_+.\-]*'
32 plumb to sendmail
33 plumb start window rc -c '''echo % mail '''$0'; mail '$0
35 # image files go to page
36 type is text
37 data matches '[a-zA-Z¡-￿0-9_\-./]+'
38 data matches '([a-zA-Z¡-￿0-9_\-./]+)\.(jpe?g|JPE?G|gif|GIF|tiff?|TIFF?|ppm|bit|png|PNG)'
39 arg isfile $0
40 plumb to image
41 plumb start qiv -t $0
43 # postscript/pdf/dvi go to page but not over the a plumb port
44 # the port is here for reference but is unused
45 type is text
46 data matches '[a-zA-Z¡-￿0-9_\-./]+'
47 data matches '([a-zA-Z¡-￿0-9_\-./]+)\.(ps|PS|eps|EPS|pdf|PDF|dvi|DVI)'
48 arg isfile $0
49 plumb to postscript
50 plumb start gv $file
51 # plumb start page -w $file
53 # existing files, possibly tagged by line number, go to editor
54 type is text
55 data matches '([.a-zA-Z¡-￿0-9_/\-]*[a-zA-Z¡-￿0-9_/\-])('$addr')?'
56 arg isfile $1
57 data set $file
58 attr add addr=$3
59 plumb to edit
60 plumb client $editor
62 # .h files are looked up in /usr/include and passed to edit
63 type is text
64 data matches '([a-zA-Z¡-￿0-9]+\.h)('$addr')?'
65 arg isfile /usr/include/$1
66 data set $file
67 attr add addr=$3
68 plumb to edit
69 plumb client $editor
71 # .h files are looked up in /usr/local/include and passed to edit
72 type is text
73 data matches '([a-zA-Z¡-￿0-9]+\.h)('$addr')?'
74 arg isfile /usr/local/include/$1
75 data set $file
76 attr add addr=$3
77 plumb to edit
78 plumb client $editor
80 # .h files are looked up in /usr/local/plan9/include and passed to edit
81 type is text
82 data matches '([a-zA-Z¡-￿0-9]+\.h)('$addr')?'
83 arg isfile /usr/local/plan9/include/$1
84 data set $file
85 attr add addr=$3
86 plumb to edit
87 plumb client $editor
89 # .m files are looked up in /sys/module and passed to edit
90 type is text
91 data matches '([a-zA-Z¡-￿0-9]+\.m)('$addr')?'
92 arg isfile /sys/module/$1
93 data set $file
94 attr add addr=$3
95 plumb to edit
96 plumb client window $editor
98 # faces -> new mail window for message
99 type is text
100 data matches '[a-zA-Z¡-￿0-9_\-./]+'
101 data matches '/mail/fs/[a-zA-Z¡-￿0-9/]+/[0-9]+'
102 plumb to showmail
103 plumb start window -r 4 120 750 600 upas/nedmail -s $0
105 # man index entries are synthesized
106 type is text
107 data matches '([a-zA-Z¡-￿0-9_\-./]+)\(([1-8])\)'
108 plumb start rc -c 'man '$2' '$1' >[2=1] | nobs | plumb -i -d edit -a ''action=showdata filename=/man/'$1'('$2')'''
110 # start rule for images without known suffixes
111 dst is image
112 arg isfile $data
113 plumb to image
114 plumb start qiv -t $data
116 # start rule for postscript without known suffixes
117 dst is postscript
118 arg isfile $data
119 plumb start gv $data
121 # urls to internet explorer on another machine
122 type is text
123 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_?,%#~&/\-+=]+)*'
124 plumb to web
125 plumb start web $0
126 # plumb start winstart iexplore -new $0