rsc | e70f305 | 2003-11-23 18:30:04 +0000 | [diff] [blame] | 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 | |
rsc | dee8454 | 2004-08-11 02:16:07 +0000 | [diff] [blame] | 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 |
| 17 | |
rsc | 3040f28 | 2004-06-09 14:07:16 +0000 | [diff] [blame] | 18 | # urls go to web browser |
rsc | e70f305 | 2003-11-23 18:30:04 +0000 | [diff] [blame] | 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_?,%#~&/\-+=]+)*\.(jpe?g|JPE?G|gif|GIF|ps|PS|pdf|PDF)' |
rsc | dee8454 | 2004-08-11 02:16:07 +0000 | [diff] [blame] | 21 | plumb to web |
rsc | 3040f28 | 2004-06-09 14:07:16 +0000 | [diff] [blame] | 22 | plumb start web $0 |
| 23 | |
| 24 | # html goes to web browser |
rsc | dee8454 | 2004-08-11 02:16:07 +0000 | [diff] [blame] | 25 | # uncomment if you want this behavior |
| 26 | # commented out is more like plan 9 |
| 27 | # |
| 28 | # type is text |
| 29 | # data matches '[a-zA-Z¡-0-9_\-./]+' |
| 30 | # data matches '([a-zA-Z¡-0-9_\-./]+)\.(html|htm|HTM|HTML)' |
| 31 | # arg isfile $0 |
| 32 | # plumb start web $file |
rsc | e70f305 | 2003-11-23 18:30:04 +0000 | [diff] [blame] | 33 | |
| 34 | # doc and rtf files go to wdoc2txt |
| 35 | type is text |
| 36 | data matches '[a-zA-Z¡-0-9_\-./]+' |
| 37 | data matches '([a-zA-Z¡-0-9_\-./]+)\.(doc|rtf)' |
| 38 | arg isfile $0 |
| 39 | plumb to msword |
| 40 | plumb start wdoc2txt $file |
| 41 | |
| 42 | # start rule for microsoft word documents without .doc suffix |
| 43 | type is text |
| 44 | dst is msword |
| 45 | plumb to msword |
| 46 | plumb start wdoc2txt $file |
| 47 | |
| 48 | # email addresses get a new mail window |
| 49 | type is text |
| 50 | data matches '[a-zA-Z0-9_+.\-]+@[a-zA-Z0-9_+.\-]*' |
| 51 | plumb to sendmail |
rsc | f69a6ff | 2004-08-22 15:38:10 +0000 | [diff] [blame] | 52 | plumb start wmail $0 |
| 53 | # plumb start window rc -c '''echo % mail '''$0'; mail '$0 |
rsc | e70f305 | 2003-11-23 18:30:04 +0000 | [diff] [blame] | 54 | |
| 55 | # image files go to page |
| 56 | type is text |
| 57 | data matches '[a-zA-Z¡-0-9_\-./]+' |
rsc | 661756d | 2004-04-21 23:34:32 +0000 | [diff] [blame] | 58 | data matches '([a-zA-Z¡-0-9_\-./]+)\.(jpe?g|JPE?G|gif|GIF|tiff?|TIFF?|ppm|bit|png|PNG)' |
rsc | e70f305 | 2003-11-23 18:30:04 +0000 | [diff] [blame] | 59 | arg isfile $0 |
| 60 | plumb to image |
rsc | 4de03b5 | 2005-01-11 19:46:06 +0000 | [diff] [blame] | 61 | plumb start page $file |
rsc | e70f305 | 2003-11-23 18:30:04 +0000 | [diff] [blame] | 62 | |
| 63 | # postscript/pdf/dvi go to page but not over the a plumb port |
| 64 | # the port is here for reference but is unused |
| 65 | type is text |
| 66 | data matches '[a-zA-Z¡-0-9_\-./]+' |
| 67 | data matches '([a-zA-Z¡-0-9_\-./]+)\.(ps|PS|eps|EPS|pdf|PDF|dvi|DVI)' |
| 68 | arg isfile $0 |
| 69 | plumb to postscript |
rsc | 4de03b5 | 2005-01-11 19:46:06 +0000 | [diff] [blame] | 70 | plumb start page $file |
rsc | e70f305 | 2003-11-23 18:30:04 +0000 | [diff] [blame] | 71 | |
rsc | dee8454 | 2004-08-11 02:16:07 +0000 | [diff] [blame] | 72 | # open office - s[xt][cdigmw], doc, xls, ppt |
| 73 | data matches '[a-zA-Z¡-0-9_\-./]+' |
| 74 | data matches '([a-zA-Z¡-0-9_\-./]+)\.([Ss][XxTt][CcDdIiGgMmWw]|[Dd][Oo][Cc]|[Xx][Ll][Ss]|[Pp][Pp][Tt])' |
| 75 | arg isfile $0 |
| 76 | plumb to openoffice |
| 77 | plumb start openoffice $file |
| 78 | |
rsc | e70f305 | 2003-11-23 18:30:04 +0000 | [diff] [blame] | 79 | # existing files, possibly tagged by line number, go to editor |
| 80 | type is text |
| 81 | data matches '([.a-zA-Z¡-0-9_/\-]*[a-zA-Z¡-0-9_/\-])('$addr')?' |
| 82 | arg isfile $1 |
| 83 | data set $file |
| 84 | attr add addr=$3 |
| 85 | plumb to edit |
rsc | 32f69c3 | 2003-12-11 17:48:38 +0000 | [diff] [blame] | 86 | plumb client $editor |
rsc | e70f305 | 2003-11-23 18:30:04 +0000 | [diff] [blame] | 87 | |
rsc | ccee548 | 2003-12-04 19:18:06 +0000 | [diff] [blame] | 88 | # .h files are looked up in /usr/include and passed to edit |
rsc | e70f305 | 2003-11-23 18:30:04 +0000 | [diff] [blame] | 89 | type is text |
| 90 | data matches '([a-zA-Z¡-0-9]+\.h)('$addr')?' |
rsc | ccee548 | 2003-12-04 19:18:06 +0000 | [diff] [blame] | 91 | arg isfile /usr/include/$1 |
| 92 | data set $file |
| 93 | attr add addr=$3 |
| 94 | plumb to edit |
rsc | 32f69c3 | 2003-12-11 17:48:38 +0000 | [diff] [blame] | 95 | plumb client $editor |
rsc | ccee548 | 2003-12-04 19:18:06 +0000 | [diff] [blame] | 96 | |
| 97 | # .h files are looked up in /usr/local/include and passed to edit |
| 98 | type is text |
| 99 | data matches '([a-zA-Z¡-0-9]+\.h)('$addr')?' |
| 100 | arg isfile /usr/local/include/$1 |
| 101 | data set $file |
| 102 | attr add addr=$3 |
| 103 | plumb to edit |
rsc | 32f69c3 | 2003-12-11 17:48:38 +0000 | [diff] [blame] | 104 | plumb client $editor |
rsc | ccee548 | 2003-12-04 19:18:06 +0000 | [diff] [blame] | 105 | |
rsc | 4de03b5 | 2005-01-11 19:46:06 +0000 | [diff] [blame] | 106 | # .h files are looked up in $plan9/include and passed to edit |
rsc | ccee548 | 2003-12-04 19:18:06 +0000 | [diff] [blame] | 107 | type is text |
| 108 | data matches '([a-zA-Z¡-0-9]+\.h)('$addr')?' |
rsc | 4de03b5 | 2005-01-11 19:46:06 +0000 | [diff] [blame] | 109 | arg isfile $plan9/include/$1 |
rsc | e70f305 | 2003-11-23 18:30:04 +0000 | [diff] [blame] | 110 | data set $file |
| 111 | attr add addr=$3 |
| 112 | plumb to edit |
rsc | 32f69c3 | 2003-12-11 17:48:38 +0000 | [diff] [blame] | 113 | plumb client $editor |
rsc | e70f305 | 2003-11-23 18:30:04 +0000 | [diff] [blame] | 114 | |
| 115 | # .m files are looked up in /sys/module and passed to edit |
| 116 | type is text |
| 117 | data matches '([a-zA-Z¡-0-9]+\.m)('$addr')?' |
| 118 | arg isfile /sys/module/$1 |
| 119 | data set $file |
| 120 | attr add addr=$3 |
| 121 | plumb to edit |
rsc | 32f69c3 | 2003-12-11 17:48:38 +0000 | [diff] [blame] | 122 | plumb client window $editor |
rsc | e70f305 | 2003-11-23 18:30:04 +0000 | [diff] [blame] | 123 | |
| 124 | # faces -> new mail window for message |
| 125 | type is text |
| 126 | data matches '[a-zA-Z¡-0-9_\-./]+' |
| 127 | data matches '/mail/fs/[a-zA-Z¡-0-9/]+/[0-9]+' |
| 128 | plumb to showmail |
| 129 | plumb start window -r 4 120 750 600 upas/nedmail -s $0 |
| 130 | |
| 131 | # man index entries are synthesized |
| 132 | type is text |
| 133 | data matches '([a-zA-Z¡-0-9_\-./]+)\(([1-8])\)' |
rsc | 6b53e2a | 2004-04-19 05:53:47 +0000 | [diff] [blame] | 134 | plumb start rc -c 'man '$2' '$1' >[2=1] | nobs | plumb -i -d edit -a ''action=showdata filename=/man/'$1'('$2')''' |
rsc | e70f305 | 2003-11-23 18:30:04 +0000 | [diff] [blame] | 135 | |
| 136 | # start rule for images without known suffixes |
| 137 | dst is image |
rsc | 32f69c3 | 2003-12-11 17:48:38 +0000 | [diff] [blame] | 138 | arg isfile $data |
rsc | e70f305 | 2003-11-23 18:30:04 +0000 | [diff] [blame] | 139 | plumb to image |
rsc | 4de03b5 | 2005-01-11 19:46:06 +0000 | [diff] [blame] | 140 | plumb start page $data |
rsc | e70f305 | 2003-11-23 18:30:04 +0000 | [diff] [blame] | 141 | |
| 142 | # start rule for postscript without known suffixes |
| 143 | dst is postscript |
| 144 | arg isfile $data |
rsc | 4de03b5 | 2005-01-11 19:46:06 +0000 | [diff] [blame] | 145 | plumb start page $data |