#!/bin/rc
builtin cd $1
echo '
'
echo 'Octopus User Manual ('$1')'
echo ''
echo ''
echo '[Index]'
echo -n 'Octopus '
switch($1){
case 1
echo -n Commands
case 2
echo -n Functions
case 4
echo -n File Servers
case O
echo -n Protocol
}
echo '
'
echo '
'
echo ''
for (i in [a-z0-9:]*) {
switch($1/$i){
case *
echo '- '$i''
awk '
BEGIN { syms = ""; indesc = 0; desc = ""; }
/.SH *NAME/,/.SH *(DES|SYN)/ {
if($1 != "\.SH"){
if($1 ~ /^\..*/)
i = 2;
else
i = 1;
for(; i <= NF; i++){
if(indesc){
desc = desc " " $i;
} else if($i ~ /^\\?-.*/) {
indesc = 1;
} else {
syms = syms " " $i;
}
}
}
}
END { print "- " desc; print "
- " syms ""}
' $i
echo ''
}
}
echo '
'