ref: bc762e9c9294990c0d2480295637c792363dcc8c
dir: /bin/rc/wman/
#!/bin/rc
sections=()
if(~ $#* 2) {
sections=($"1)
manpage=$"2
}
if(~ $#* 1) {
manpage=$"1
}
if(~ $#manpage 0) {
echo 'usage: wman [section] manpage'
exit 'usage'
}
if(~ $#sections 0) {
manfiles=`{man -w $manpage}
for(mp in $manfiles) {
sectionno=`{basename `{basename -d $mp}}
sections=($sectionno $sections)
}
}
for (section in $sections) {
wplabel=$"manpage^'('^$"section^')'
window 'man '^$section^' '^$"manpage^' ;& label '''^$"wplabel^'''; cat /dev/cons >/dev/null'
}