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_?,%#~&/\-+=]+)*'
21 plumb to web
22 plumb start web $0
24 # doc and rtf files go to wdoc2txt
25 type is text
26 data matches '[a-zA-Z¡-￿0-9_\-./]+'
27 data matches '([a-zA-Z¡-￿0-9_\-./]+)\.(doc|rtf)'
28 arg isfile $0
29 plumb to msword
30 plumb start wdoc2txt $file
32 # start rule for microsoft word documents without .doc suffix
33 type is text
34 dst is msword
35 plumb to msword
36 plumb start wdoc2txt $file
38 # email addresses get a new mail window
39 type is text
40 data matches '[a-zA-Z0-9_+.\-]+@[a-zA-Z0-9_+.\-]*'
41 plumb to sendmail
42 plumb start wmail $0
43 # plumb start window rc -c '''echo % mail '''$0'; mail '$0
45 # image files go to page
46 type is text
47 data matches '[a-zA-Z¡-￿0-9_\-./]+'
48 data matches '([a-zA-Z¡-￿0-9_\-./]+)\.(jpe?g|JPE?G|gif|GIF|tiff?|TIFF?|ppm|bit|png|PNG)'
49 arg isfile $0
50 plumb to image
51 plumb start 9 page $file
53 # postscript/pdf/dvi go to page but not over the a plumb port
54 # the port is here for reference but is unused
55 type is text
56 data matches '[a-zA-Z¡-￿0-9_\-./]+'
57 data matches '([a-zA-Z¡-￿0-9_\-./]+)\.(ps|PS|eps|EPS|pdf|PDF|dvi|DVI)'
58 arg isfile $0
59 plumb to postscript
60 plumb start 9 page $file
62 # open office - s[xt][cdigmw], doc, xls, ppt
63 data matches '[a-zA-Z¡-￿0-9_\-./]+'
64 data matches '([a-zA-Z¡-￿0-9_\-./]+)\.([Ss][XxTt][CcDdIiGgMmWw]|[Dd][Oo][Cc]|[Xx][Ll][Ss]|[Pp][Pp][Tt])'
65 arg isfile $0
66 plumb to openoffice
67 plumb start openoffice $file
69 # existing files, possibly tagged by line number, go to editor
70 type is text
71 data matches '([.a-zA-Z¡-￿0-9_/\-]*[a-zA-Z¡-￿0-9_/\-])('$addr')?'
72 arg isfile $1
73 data set $file
74 attr add addr=$3
75 plumb to edit
76 plumb client $editor
78 # .h files are looked up in /usr/include and passed to edit
79 type is text
80 data matches '([a-zA-Z¡-￿0-9/_\-]+\.h)('$addr')?'
81 arg isfile /usr/include/$1
82 data set $file
83 attr add addr=$3
84 plumb to edit
85 plumb client $editor
87 # .h files are looked up in /usr/local/include and passed to edit
88 type is text
89 data matches '([a-zA-Z¡-￿0-9/_\-]+\.h)('$addr')?'
90 arg isfile /usr/local/include/$1
91 data set $file
92 attr add addr=$3
93 plumb to edit
94 plumb client $editor
96 # .h files are looked up in $plan9/include and passed to edit
97 type is text
98 data matches '([a-zA-Z¡-￿0-9/_\-]+\.h)('$addr')?'
99 arg isfile $plan9/include/$1
100 data set $file
101 attr add addr=$3
102 plumb to edit
103 plumb client $editor
105 # .m files are looked up in /sys/module and passed to edit
106 type is text
107 data matches '([a-zA-Z¡-￿0-9/_\-]+\.m)('$addr')?'
108 arg isfile /sys/module/$1
109 data set $file
110 attr add addr=$3
111 plumb to edit
112 plumb client window $editor
114 # faces -> new mail window for message
115 type is text
116 data matches '[a-zA-Z¡-￿0-9_\-./]+'
117 data matches '/mail/fs/[a-zA-Z¡-￿0-9/]+/[0-9]+'
118 plumb to showmail
119 plumb start window -r 4 120 750 600 upas/nedmail -s $0
121 # man index entries are synthesized
122 type is text
123 data matches '([a-zA-Z¡-￿0-9_\-./]+)\(([1-8])\)'
124 plumb start rc -c 'man '$2' '$1' >[2=1] | nobs | plumb -i -d edit -a ''action=showdata filename=/man/'$1'('$2')'''
126 # start rule for images without known suffixes
127 dst is image
128 arg isfile $data
129 plumb to image
130 plumb start 9 page $data
132 # start rule for postscript without known suffixes
133 dst is postscript
134 arg isfile $data
135 plumb start 9 page $data