| tbasic - plan9port - [fork] Plan 9 from user space | |
| git clone git://src.adamsgaard.dk/plan9port | |
| Log | |
| Files | |
| Refs | |
| README | |
| LICENSE | |
| --- | |
| tbasic (4420B) | |
| --- | |
| 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 # 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… | |
| 13 arg isfile $1 | |
| 14 data set file://$file | |
| 15 plumb to web | |
| 16 plumb start web $data | |
| 17 | |
| 18 # urls go to web browser | |
| 19 type is text | |
| 20 data matches '(https?|ftp|file|gopher|mailto|news|nntp|telnet|wais|prosp… | |
| 21 plumb to web | |
| 22 plumb start web $0 | |
| 23 | |
| 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 | |
| 31 | |
| 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 | |
| 37 | |
| 38 # image files go to page | |
| 39 type is text | |
| 40 data matches '[a-zA-Z¡-0-9_\-./@]+' | |
| 41 data matches '([a-zA-Z¡-0-9_\-./@]+)\.(jpe?g|JPE?G|gif|GIF|tiff?|TIF… | |
| 42 arg isfile $0 | |
| 43 plumb to image | |
| 44 plumb start 9 page $file | |
| 45 | |
| 46 # postscript/pdf/dvi go to page but not over the a plumb port | |
| 47 # the port is here for reference but is unused | |
| 48 type is text | |
| 49 data matches '[a-zA-Z¡-0-9_\-./@]+' | |
| 50 data matches '([a-zA-Z¡-0-9_\-./@]+)\.(ps|PS|eps|EPS|pdf|PDF|dvi|DVI… | |
| 51 arg isfile $0 | |
| 52 plumb to postscript | |
| 53 plumb start 9 page $file | |
| 54 | |
| 55 # open office - s[xt][cdigmw], doc, xls, ppt | |
| 56 data matches '[a-zA-Z¡-0-9_\-./@]+' | |
| 57 data matches '([a-zA-Z¡-0-9_\-./@]+)\.([Ss][XxTt][CcDdIiGgMmWw]|[Dd]… | |
| 58 arg isfile $0 | |
| 59 plumb to openoffice | |
| 60 plumb start openoffice $file | |
| 61 | |
| 62 # existing files tagged by line number:columnumber or linenumber.columnu… | |
| 63 type is text | |
| 64 data matches '([.a-zA-Z¡-0-9_/\-@]*[a-zA-Z¡-0-9_/\-])':$twocolon… | |
| 65 arg isfile $1 | |
| 66 data set $file | |
| 67 attr add addr=$2-#0+#$3-#1,$4-#0+#$5-#1 | |
| 68 plumb to edit | |
| 69 plumb client $editor | |
| 70 | |
| 71 # existing files tagged by line number:columnumber or linenumber.columnu… | |
| 72 type is text | |
| 73 data matches '([.a-zA-Z¡-0-9_/\-@]*[a-zA-Z¡-0-9_/\-])':$twocolon… | |
| 74 arg isfile $1 | |
| 75 data set $file | |
| 76 attr add addr=$2-#0+#$3-#1 | |
| 77 plumb to edit | |
| 78 plumb client $editor | |
| 79 | |
| 80 # existing files, possibly tagged by line number, go to editor | |
| 81 type is text | |
| 82 data matches '([.a-zA-Z¡-0-9_/\-@]*[a-zA-Z¡-0-9_/\-])('$addr')?' | |
| 83 arg isfile $1 | |
| 84 data set $file | |
| 85 attr add addr=$3 | |
| 86 plumb to edit | |
| 87 plumb client $editor | |
| 88 | |
| 89 # .h files are looked up in /usr/include and passed to edit | |
| 90 type is text | |
| 91 data matches '([a-zA-Z¡-0-9/_\-]+\.h)('$addr')?' | |
| 92 arg isfile /usr/include/$1 | |
| 93 data set $file | |
| 94 attr add addr=$3 | |
| 95 plumb to edit | |
| 96 plumb client $editor | |
| 97 | |
| 98 # .h files are looked up in /usr/local/include and passed to edit | |
| 99 type is text | |
| 100 data matches '([a-zA-Z¡-0-9/_\-]+\.h)('$addr')?' | |
| 101 arg isfile /usr/local/include/$1 | |
| 102 data set $file | |
| 103 attr add addr=$3 | |
| 104 plumb to edit | |
| 105 plumb client $editor | |
| 106 | |
| 107 # .h files are looked up in $plan9/include and passed to edit | |
| 108 type is text | |
| 109 data matches '([a-zA-Z¡-0-9/_\-]+\.h)('$addr')?' | |
| 110 arg isfile $plan9/include/$1 | |
| 111 data set $file | |
| 112 attr add addr=$3 | |
| 113 plumb to edit | |
| 114 plumb client $editor | |
| 115 | |
| 116 # .m files are looked up in /usr/inferno/module and passed to edit | |
| 117 type is text | |
| 118 data matches '([a-zA-Z¡-0-9/_\-]+\.m)('$addr')?' | |
| 119 arg isfile /usr/inferno/module/$1 | |
| 120 data set $file | |
| 121 attr add addr=$3 | |
| 122 plumb to edit | |
| 123 plumb client window $editor | |
| 124 | |
| 125 # faces -> new mail window for message | |
| 126 type is text | |
| 127 data matches '[a-zA-Z¡-0-9_\-./]+' | |
| 128 data matches '/mail/fs/[a-zA-Z¡-0-9/]+/[0-9]+' | |
| 129 plumb to showmail | |
| 130 plumb start window -r 4 120 750 600 upas/nedmail -s $0 | |
| 131 | |
| 132 # email addresses get a new mail window | |
| 133 type is text | |
| 134 data matches '[a-zA-Z0-9_+.\-]+@[a-zA-Z0-9_+.\-]*' | |
| 135 plumb to sendmail | |
| 136 plumb start wmail $0 | |
| 137 # plumb start window rc -c '''echo % mail '''$0'; mail '$0 | |
| 138 | |
| 139 # man index entries are synthesized | |
| 140 type is text | |
| 141 data matches '([a-zA-Z¡-0-9_\-./]+)\(([1-8])\)' | |
| 142 plumb start rc -c 'man '$2' '$1' >[2=1] | nobs | plumb -i -d edit -a ''a… | |
| 143 | |
| 144 # start rule for images without known suffixes | |
| 145 dst is image | |
| 146 arg isfile $data | |
| 147 plumb to image | |
| 148 plumb start 9 page $data | |
| 149 | |
| 150 # start rule for postscript without known suffixes | |
| 151 dst is postscript | |
| 152 arg isfile $data | |
| 153 plumb start 9 page $data |