Annotation of researchv8dc/cmd/man/man.sh, revision 1.1.1.1

1.1       root        1: #!/bin/sh
                      2: MAN=/usr/man
                      3: CACHE=/usr/spool/man
                      4: cmd= sec= fil= opt= i= all= quick=
                      5: cmd=q sec=\?
                      6: 
                      7: if [ -d $MAN ]
                      8: then   cd $MAN
                      9:        cacheonly=
                     10: else   cd $CACHE
                     11:        cacheonly=y
                     12: fi
                     13: 
                     14: for i
                     15: do     case $i in
                     16:        [1-9])          sec=$i ;;
                     17:        -q)             cmd=q ;;
                     18:        -n)             cmd=n ;;
                     19:        -t)             cmd=t ;;
                     20:        -k)             cmd=k ;;
                     21:        -e | -et | -te) cmd=e ;;
                     22:        -ek | -ke)      cmd=ek ;;
                     23:        -ne | -en)      cmd=ne ;;
                     24:        -w)             cmd=where ;;
                     25:        -*)             opt="$opt $i" ;;
                     26:        *)              fil=`echo man$sec/$i.*`
                     27:                        case $fil in
                     28:                        man7/eqnchar.7) all="$all /usr/pub/eqnchar $fil" ;;
                     29:                        *\*)            echo $i not found 1>&2 ;;
                     30:                        *)              if [ "$cacheonly" = y ]
                     31:                                        then    quick="$quick $fil"
                     32:                                        elif [ "$cmd" = q ]
                     33:                                        then    qf=$CACHE/$fil
                     34:                                                if newer $qf $fil
                     35:                                                then    quick="$quick $qf"
                     36:                                                else    all="$all $fil"
                     37:                                                fi
                     38:                                        else    all="$all $fil"
                     39:                                        fi ;;
                     40:                        esac
                     41:        esac
                     42: done
                     43: 
                     44: case "$all$quick" in
                     45:        "") exit ;;
                     46: esac
                     47: 
                     48: if [ "$cacheonly" = y -a "$cmd" != q ]
                     49: then   echo unformatted manual pages are not available on this system 1>&2
                     50:        exit
                     51: fi
                     52: 
                     53: case $cmd in
                     54: 
                     55: q)             if [ -t ]
                     56:                then (  if [ "$quick" != "" ]
                     57:                        then    cat $quick
                     58:                        fi
                     59:                        if [ "$all" != "" ]
                     60:                        then    nroff -man $all
                     61:                        fi) | ul | sed ':x
                     62:                                /^$/{
                     63:                                        N
                     64:                                        s/^\n$//
                     65:                                        bx
                     66:                                }'
                     67:                else    if [ "$quick" != "" ]
                     68:                        then    cat $quick
                     69:                        fi
                     70:                        if [ "$all" != "" ]
                     71:                        then    nroff -man $all
                     72:                        fi
                     73:                fi ;;
                     74: n)             nroff $opt -man $all ;;
                     75: ne)            neqn $all | nroff $opt -man ;;
                     76: t)             troff $opt -man $all ;;
                     77: k)             troff -t $opt -man $all | tc ;;
                     78: e)             eqn $all | troff $opt -man ;;
                     79: ek)            eqn $all | troff -t $opt -man | tc ;;
                     80: where)         echo $all ;;
                     81: 
                     82: esac

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.