#!/bin/rc # man page browser for use with following plumbing rules: # data matches ([a-zA-Z¡-￿0-9_\-.]+)\(([1-9])\) # arg isfile /sys/man/$2/$1 # plumb to man # plumb client window manbrowse # wdir is /mnt/manbrowse # plumb to man rfork en m = () fn x{echo $1 | sed -n 's/^([a-zA-Z¡-￿0-9_\-.]+)\(([1-9])\)$/\2 \1/p'} cd /mnt/manbrowse echo -n /mnt/manbrowse >/dev/wdir echo -n man >/dev/label bind /dev/null /dev/label bind /mnt/plumb/none /mnt/plumb/image /dev/null{ read; read; read; read; read data = `{read} data = `''{read -c $data} }){ n = `{x $data} if(~ $#n 2 && test -f /sys/man/^$n(1)^/^$n(2)){ o = $m(1-12) m = $data for(i in `{seq $#o}) if(! ~ $o($i) $data) m = ($m $o($i)) o = () >/dev/wctl >[2]/dev/null for(i in unhide current scroll) echo -n $i >/dev/text{ echo '[page]' man $n if(! ~ $#m 1) echo recently viewed: $m(2-) | fmt } echo -n  >/dev/kbdin } if not if(~ $data '[page]' && ! ~ $#m 0) man -t `{x $m(1)} | page -p180 if not lookman $data }