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)'
39 arg isfile $0
40 plumb to image
41 plumb client page -wi
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 page -w $file
52 # existing files, possibly tagged by line number, go to editor
53 type is text
54 data matches '([.a-zA-Z¡-￿0-9_/\-]*[a-zA-Z¡-￿0-9_/\-])('$addr')?'
55 arg isfile $1
56 data set $file
57 attr add addr=$3
58 plumb to edit
59 plumb start /usr/local/plan9/bin/B $file:$3
60 # plumb client window $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 start /usr/local/plan9/bin/B $file:$3
70 # plumb client window $editor
72 # .h files are looked up in /usr/local/include and passed to edit
73 type is text
74 data matches '([a-zA-Z¡-￿0-9]+\.h)('$addr')?'
75 arg isfile /usr/local/include/$1
76 data set $file
77 attr add addr=$3
78 plumb to edit
79 plumb start /usr/local/plan9/bin/B $file:$3
80 # plumb client window $editor
82 # .h files are looked up in /usr/local/plan9/include and passed to edit
83 type is text
84 data matches '([a-zA-Z¡-￿0-9]+\.h)('$addr')?'
85 arg isfile /usr/local/plan9/include/$1
86 data set $file
87 attr add addr=$3
88 plumb to edit
89 plumb start /usr/local/plan9/bin/B $file:$3
90 # plumb client window $editor
92 # .m files are looked up in /sys/module and passed to edit
93 type is text
94 data matches '([a-zA-Z¡-￿0-9]+\.m)('$addr')?'
95 arg isfile /sys/module/$1
96 data set $file
97 attr add addr=$3
98 plumb to edit
99 plumb start /usr/local/plan9/bin/B $file:$3
100 # plumb client window $editor
102 # faces -> new mail window for message
103 type is text
104 data matches '[a-zA-Z¡-￿0-9_\-./]+'
105 data matches '/mail/fs/[a-zA-Z¡-￿0-9/]+/[0-9]+'
106 plumb to showmail
107 plumb start window -r 4 120 750 600 upas/nedmail -s $0
109 # man index entries are synthesized
110 type is text
111 data matches '([a-zA-Z¡-￿0-9_\-./]+)\(([1-8])\)'
112 plumb start rc -c 'man '$2' '$1' >[2=1] | plumb -i -d edit -a ''action=showdata filename=/man/'$1'('$2')'''
114 # start rule for images without known suffixes
115 dst is image
116 plumb to image
117 plumb client page -wi
119 # start rule for postscript without known suffixes
120 dst is postscript
121 arg isfile $data
122 plumb start page -w $data
124 type is text
125 data matches 'Local (.*)'
126 plumb to none
127 plumb start rc -c $1