#!/bin/csh -f

# manvi - view manual pages in vi(1)
#
# 1.00 ??/??/94 erco@netcom.com -- Initial implementation
# 1.10 01/13/02 erco@3dsite.com -- Check for exit codes from man
#

set tmp = "/var/tmp";
man $*:q < /dev/null > $tmp/manvi-man.$$

if ( $status == 0 ) then
    # BRING UP EDITOR IF NO ERROR OCCURRED
    col -b < $tmp/manvi-man.$$ > $tmp/manvi-col.$$

    if ( $?EDITOR ) then
        $EDITOR $tmp/manvi-col.$$
    else
        vi $tmp/manvi-col.$$
    endif
endif

rm -f $tmp/manvi-*.$$
