1
0

basic 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  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. # cheap http/gif,jpeg,ps,pdf renderer
  8. type is text
  9. 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)'
  10. plumb start rc -c 'hget '$0' | page -w'
  11. # rtf files go to wdoc2txt
  12. type is text
  13. data matches '[a-zA-Z¡-￿0-9_\-./]+'
  14. data matches '([a-zA-Z¡-￿0-9_\-./]+)\.rtf'
  15. arg isfile $0
  16. plumb to msword
  17. plumb start wdoc2txt $file
  18. # start rule for microsoft word documents without .doc suffix
  19. type is text
  20. dst is msword
  21. plumb to msword
  22. plumb start wdoc2txt $file
  23. # email addresses get a new mail window
  24. type is text
  25. data matches '[a-zA-Z0-9_+.\-]+@[a-zA-Z0-9_+.\-]*'
  26. plumb to sendmail
  27. plumb start window rc -c '''echo % mail '''$0'; mail '$0
  28. # image files go to page
  29. type is text
  30. data matches '[a-zA-Z¡-￿0-9_\-./]+'
  31. data matches '([a-zA-Z¡-￿0-9_\-./]+)\.(jpe?g|JPE?G|gif|GIF|tiff?|TIFF?|ppm|PPM|bit|BIT|png|PNG)'
  32. arg isfile $0
  33. plumb to image
  34. plumb client page -wi
  35. # postscript/pdf/dvi/doc go to page but not over the a plumb port
  36. # the port is here for reference but is unused
  37. type is text
  38. data matches '[a-zA-Z¡-￿0-9_\-./]+'
  39. data matches '([a-zA-Z¡-￿0-9_\-./]+)\.(ps|PS|eps|EPS|pdf|PDF|dvi|DVI|doc|DOC)'
  40. arg isfile $0
  41. plumb to postscript
  42. plumb start page -w $file
  43. # existing files, possibly tagged by line number, go to editor
  44. type is text
  45. data matches '([.a-zA-Z¡-￿0-9_/\-]*[a-zA-Z¡-￿0-9_/\-])('$addr')?'
  46. arg isfile $1
  47. data set $file
  48. attr add addr=$3
  49. plumb to edit
  50. plumb client window $editor
  51. # .h files are looked up in /sys/include and passed to edit
  52. type is text
  53. data matches '([a-zA-Z¡-￿0-9]+\.h)('$addr')?'
  54. arg isfile /sys/include/$1
  55. data set $file
  56. attr add addr=$3
  57. plumb to edit
  58. plumb client window $editor
  59. # .m files are looked up in /sys/module and passed to edit
  60. type is text
  61. data matches '([a-zA-Z¡-￿0-9]+\.m)('$addr')?'
  62. arg isfile /sys/module/$1
  63. data set $file
  64. attr add addr=$3
  65. plumb to edit
  66. plumb client window $editor
  67. # faces -> new mail window for message
  68. type is text
  69. data matches '[a-zA-Z¡-￿0-9_\-./]+'
  70. data matches '/mail/fs/[a-zA-Z¡-￿0-9/]+/[0-9]+'
  71. plumb to showmail
  72. plumb start window -r 4 120 750 600 upas/nedmail -s $0
  73. # man index entries are synthesized
  74. type is text
  75. data matches '([a-zA-Z¡-￿0-9_\-./]+)\(([1-8])\)'
  76. plumb start rc -c 'man '$2' '$1' >[2=1] | plumb -i -d edit -a ''action=showdata filename=/man/'$1'('$2')'''
  77. # start rule for images without known suffixes
  78. dst is image
  79. plumb to image
  80. plumb client page -wi
  81. # start rule for postscript without known suffixes
  82. dst is postscript
  83. arg isfile $data
  84. plumb start page -w $data
  85. type is text
  86. data matches 'Local (.*)'
  87. plumb to none
  88. plumb start rc -c $1