basic 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. # these are generally in order from most specific to least,
  2. # since first rule that fires wins.
  3. include fileaddr
  4. # declarations of ports without rules
  5. plumb to seemail
  6. plumb to showmail
  7. # open urls with web browser
  8. type is text
  9. data matches 'https?://[^ ]+'
  10. plumb to web
  11. plumb client window $browser
  12. # rtf files go to wdoc2txt
  13. type is text
  14. data matches '[a-zA-Z¡-￿0-9_\-.,/]+'
  15. data matches '([a-zA-Z¡-￿0-9_\-.,/]+)\.rtf'
  16. arg isfile $0
  17. plumb to msword
  18. plumb start wdoc2txt $file
  19. # start rule for microsoft word documents without .doc suffix
  20. type is text
  21. dst is msword
  22. plumb to msword
  23. plumb start wdoc2txt $file
  24. # email addresses get a new mail window
  25. type is text
  26. data matches '[a-zA-Z0-9_+.\-]+@[a-zA-Z0-9_+.\-]*'
  27. plumb to sendmail
  28. plumb start window rc -c '''echo % mail '''$0'; mail '$0
  29. # audio
  30. type is text
  31. data matches '[a-zA-Z¡-￿0-9_\-.,/]+'
  32. data matches '([a-zA-Z¡-￿0-9_\-.,/]+)\.(mp3|ogg|flac|m3u|pls)'
  33. arg isfile $0
  34. plumb to audio
  35. plumb start window play $0
  36. # image files go to page
  37. type is text
  38. data matches '[a-zA-Z¡-￿0-9_\-.,/]+'
  39. 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)'
  40. arg isfile $0
  41. plumb to image
  42. plumb client page -wi
  43. # page bookmarks
  44. type is text
  45. data matches '(([a-zA-Z¡-￿0-9_\-.,/]+)\.(ps|PS|eps|EPS|pdf|PDF|dvi|DVI|doc|DOC|epub|EPUB|cb[tz]|CB[TZ]))!(.+)'
  46. arg isfile $1
  47. data set $file
  48. attr add addr=$4
  49. plumb to image
  50. plumb start page -wij $0 $file
  51. # postscript/pdf/dvi/doc go to page but not over the a plumb port
  52. # the port is here for reference but is unused
  53. type is text
  54. data matches '[a-zA-Z¡-￿0-9_\-.,/]+'
  55. data matches '([a-zA-Z¡-￿0-9_\-.,/]+)\.(ps|PS|eps|EPS|pdf|PDF|dvi|DVI|doc|DOC|epub|EPUB|cb[tz]|CB[TZ])'
  56. arg isfile $0
  57. plumb to postscript
  58. plumb start page -w $file
  59. # existing files, possibly tagged by line number, go to editor
  60. type is text
  61. data matches '([.a-zA-Z¡-￿0-9_/+\-]*[a-zA-Z¡-￿0-9_/+\-])('$addr')?'
  62. arg isfile $1
  63. data set $file
  64. attr add addr=$3
  65. plumb to edit
  66. plumb client window $editor
  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. # .m files are looked up in /usr/inferno/module and passed to edit
  76. type is text
  77. data matches '([a-zA-Z¡-￿0-9]+\.m)('$addr')?'
  78. arg isfile /usr/inferno/module/$1
  79. data set $file
  80. attr add addr=$3
  81. plumb to edit
  82. plumb client window $editor
  83. # faces -> new mail window for message
  84. type is text
  85. data matches '[a-zA-Z¡-￿0-9_\-./]+'
  86. data matches '/mail/fs/[a-zA-Z¡-￿0-9/]+/[0-9]+'
  87. plumb to showmail
  88. plumb start window -r 4 120 750 600 upas/nedmail -s $0
  89. # man index entries are synthesized
  90. type is text
  91. data matches '([a-zA-Z¡-￿0-9_\-./]+)\(([1-8])\)'
  92. plumb start rc -c 'man -b '$2' '$1'
  93. # RFC references are looked up in /lib/rfc and passed to editor
  94. type is text
  95. data matches 'RFC ?([0-9]+)'
  96. arg isfile /lib/rfc/rfc$1
  97. data set $file
  98. plumb to edit
  99. plumb client window $editor
  100. # start rule for images without known suffixes
  101. dst is image
  102. plumb to image
  103. plumb client page -wi
  104. # start rule for postscript without known suffixes
  105. dst is postscript
  106. arg isfile $data
  107. plumb start page -w $data
  108. type is text
  109. data matches 'Local (.*)'
  110. plumb to none
  111. plumb start rc -c $1