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 start qiv -t $1
42 # plumb client page -wi
44 # postscript/pdf/dvi go to page but not over the a plumb port
45 # the port is here for reference but is unused
46 type is text
47 data matches '[a-zA-Z¡-￿0-9_\-./]+'
48 data matches '([a-zA-Z¡-￿0-9_\-./]+)\.(ps|PS|eps|EPS|pdf|PDF|dvi|DVI)'
49 arg isfile $0
50 plumb to postscript
51 plumb start gv $file
52 # plumb start page -w $file
54 # existing files, possibly tagged by line number, go to editor
55 type is text
56 data matches '([.a-zA-Z¡-￿0-9_/\-]*[a-zA-Z¡-￿0-9_/\-])('$addr')?'
57 arg isfile $1
58 data set $file
59 attr add addr=$3
60 plumb to edit
61 plumb client $editor
63 # .h files are looked up in /usr/include and passed to edit
64 type is text
65 data matches '([a-zA-Z¡-￿0-9]+\.h)('$addr')?'
66 arg isfile /usr/include/$1
67 data set $file
68 attr add addr=$3
69 plumb to edit
70 plumb client $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 client $editor
81 # .h files are looked up in /usr/local/plan9/include and passed to edit
82 type is text
83 data matches '([a-zA-Z¡-￿0-9]+\.h)('$addr')?'
84 arg isfile /usr/local/plan9/include/$1
85 data set $file
86 attr add addr=$3
87 plumb to edit
88 plumb client $editor
90 # .m files are looked up in /sys/module and passed to edit
91 type is text
92 data matches '([a-zA-Z¡-￿0-9]+\.m)('$addr')?'
93 arg isfile /sys/module/$1
94 data set $file
95 attr add addr=$3
96 plumb to edit
97 plumb client window $editor
99 # faces -> new mail window for message
100 type is text
101 data matches '[a-zA-Z¡-￿0-9_\-./]+'
102 data matches '/mail/fs/[a-zA-Z¡-￿0-9/]+/[0-9]+'
103 plumb to showmail
104 plumb start window -r 4 120 750 600 upas/nedmail -s $0
106 # man index entries are synthesized
107 type is text
108 data matches '([a-zA-Z¡-￿0-9_\-./]+)\(([1-8])\)'
109 plumb start rc -c 'man '$2' '$1' >[2=1] | plumb -i -d edit -a ''action=showdata filename=/man/'$1'('$2')'''
111 # start rule for images without known suffixes
112 dst is image
113 arg isfile $data
114 plumb to image
115 plumb start qiv -t $data
117 # start rule for postscript without known suffixes
118 dst is postscript
119 arg isfile $data
120 plumb start gv $data
122 # urls to internet explorer on another machine
123 type is text
124 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_?,%#~&/\-+=]+)*'
125 plumb to web
126 plumb start web $0
127 # plumb start winstart iexplore -new $0