]> git.lizzy.rs Git - plan9front.git/blob - sys/lib/plumb/basic
merge
[plan9front.git] / sys / lib / plumb / basic
1 # these are generally in order from most specific to least,
2 # since first rule that fires wins.
3
4 include fileaddr
5
6 # declarations of ports without rules
7 plumb to seemail
8 plumb to showmail
9
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|png|PNG)'
13 plumb start rc -c 'hget '''$0''' | page -w'
14
15 ## open urls with abaco web browser
16 #type is text
17 #data matches 'https?://[a-zA-Z0-9_@\-]+([.:][a-zA-Z0-9_@\-]+)*/?[a-zA-Z0-9_?,%#~&/\-+=]+([:.][a-zA-Z0-9_?,''%#~&/\-+=;]+)*'
18 #plumb to web
19 #plumb client window abaco
20
21 # rtf files go to wdoc2txt
22 type is text
23 data matches '[a-zA-Z¡-￿0-9_\-./]+'
24 data matches '([a-zA-Z¡-￿0-9_\-./]+)\.rtf'
25 arg isfile      $0
26 plumb to msword
27 plumb start wdoc2txt $file
28
29 # start rule for microsoft word documents without .doc suffix
30 type is text
31 dst is msword
32 plumb to msword
33 plumb start wdoc2txt $file
34
35 # email addresses get a new mail window
36 type is text
37 data matches '[a-zA-Z0-9_+.\-]+@[a-zA-Z0-9_+.\-]*'
38 plumb to sendmail
39 plumb start window rc -c '''echo % mail '''$0'; mail '$0
40
41 # image files go to page
42 type is text
43 data matches '[a-zA-Z¡-￿0-9_\-./]+'
44 data matches '([a-zA-Z¡-￿0-9_\-./]+)\.(jpe?g|JPE?G|gif|GIF|tiff?|TIFF?|ppm|PPM|bit|BIT|png|PNG|pgm|PGM|bmp|BMP|yuv|YUV)'
45 arg isfile      $0
46 plumb to image
47 plumb client page -wi
48
49 # postscript/pdf/dvi/doc go to page but not over the a plumb port
50 # the port is here for reference but is unused
51 type is text
52 data matches '[a-zA-Z¡-￿0-9_\-./]+'
53 data matches '([a-zA-Z¡-￿0-9_\-./]+)\.(ps|PS|eps|EPS|pdf|PDF|dvi|DVI|doc|DOC)'
54 arg isfile      $0
55 plumb to postscript
56 plumb start page -w $file
57
58 # existing files, possibly tagged by line number, go to editor
59 type is text
60 data matches '([.a-zA-Z¡-￿0-9_/+\-]*[a-zA-Z¡-￿0-9_/+\-])('$addr')?'
61 arg isfile      $1
62 data set        $file
63 attr add        addr=$3
64 plumb to edit
65 plumb client window $editor
66
67 # .h files are looked up in /sys/include and passed to edit
68 type is text
69 data matches '([a-zA-Z¡-￿0-9]+\.h)('$addr')?'
70 arg isfile      /sys/include/$1
71 data set        $file
72 attr add        addr=$3
73 plumb to edit
74 plumb client window $editor
75
76 # .m files are looked up in /usr/inferno/module and passed to edit
77 type is text
78 data matches '([a-zA-Z¡-￿0-9]+\.m)('$addr')?'
79 arg isfile      /usr/inferno/module/$1
80 data set        $file
81 attr add        addr=$3
82 plumb to edit
83 plumb client window $editor
84
85 # faces -> new mail window for message
86 type    is      text
87 data    matches '[a-zA-Z¡-￿0-9_\-./]+'
88 data    matches '/mail/fs/[a-zA-Z¡-￿0-9/]+/[0-9]+'
89 plumb   to      showmail
90 plumb   start   window -r 4 120 750 600 upas/nedmail -s $0
91
92 # man index entries are synthesized
93 type is text
94 data matches '([a-zA-Z¡-￿0-9_\-./]+)\(([1-8])\)'
95 plumb start rc -c 'man -b '$2' '$1'
96
97 # RFC references are looked up in /lib/rfc and passed to editor
98 type is text
99 data    matches 'RFC ?([0-9]+)'
100 arg isfile /lib/rfc/rfc$1
101 data set        $file
102 plumb to edit
103 plumb client window $editor
104
105 # start rule for images without known suffixes
106 dst is image
107 plumb to image
108 plumb client page -wi
109
110 # start rule for postscript without known suffixes
111 dst is postscript
112 arg isfile $data
113 plumb start page -w $data
114
115 type    is      text
116 data    matches 'Local (.*)'
117 plumb   to      none
118 plumb   start   rc -c $1