[ale] messed up man
    Jacob Langseth 
    jlangseth at esisys.com
       
    Wed Oct 21 01:43:04 EDT 1998
    
    
  
> groff: couldn't exec troff: Not a directory
> 
> I have suse 5.3 which installs groff and troff in /usr/bin.  I've checked
> out
> my man path which is:
Does `file /usr/bin/[gt]roff` indicate anything strange?
> /usr/local/man:/usr/man:/usr/X11R6/man:/usr/openwin/man
> 
> and all the man directories are still there.  Any suggestions?  Thanks.
This will probably be of only limited use.  I had a system which
had a broken man, so I wound up implementing a small shell
equivalent which can be loaded as an alias to replace man.
Perhaps this can provide a workaround while you locate a
more permanent fix.
-- 
Jacob Langseth <jlangseth at esisys.com>
Enhanced Systems, Inc.
###
# system man replacement
# tested with bash
#
# USAGE:  source ./set_man.sh
#
# Alternate usage for non-bash shells:
#    echo '#!/bin/bash' > ~/man
#    sed '/^man ()$/d' ~musashi/man.sh | sed '/^[{}]$/d' >> ~/man
#    chmod 0755 ~/man
#    PATH=~/:$PATH	# setenv or whatever
#
# <jlangseth at esisys.com> 1997-10-25
####
# 98.01.15 JwL	added code to handle .so references
man () 
{ 
    if [ $# -lt 1 ] || [ $# -gt 2 ]; then
	echo USAGE:  man [section] topic 1>&2
	return 1
    fi
    unset section files
    let found=1
    if [ $# -eq 2 ]; then
	section=$1
	shift
    fi
    ifs_save=$IFS
    IFS=:
    for dir in $MANPATH; do
	IFS=$ifs_save
	if [ ! -d "$dir" ]; then
	    IFS=:
	    continue
	fi
	list=`find ${dir}/man${section:-?} -name $1.\* -print 2>/dev/null`
	# check for a .so reference
	if [ ! -z "$list" ]; then
	    for ManFile in $list; do
		ManRef=`if [ "${ManFile}" != "${ManFile%%.gz}" ]; then
			    gzip -dc $ManFile | head -1
			else
			    head -1 $ManFile
			fi`
		if [ "${ManRef%% *}" = ".so" ]; then
		    ManFile=${dir}/${ManRef##* }
		    if [ ! -s "$ManFile" ]; then
			ManFile=${ManFile}.gz
			if [ ! -s "$ManFile" ]; then
			    # complain about bogus .so ref?
			    ManFile=""
			fi
		    fi
		fi
		if [ ! -z "$ManFile" ]; then
		    if [ -z "$files" ]; then
			files=$ManFile
		    else
			files="$files $ManFile"
		    fi
		fi
	    done
	fi
	IFS=:
    done
    unset list dir ManFile ManRef
    IFS=$ifs_save
    unset ifs_save
    if [ -z "$files" ]; then
	if [ -z "$section" ]; then
	    echo $1 not found in \$MANPATH
	else
	    echo $1 not found in section $section of \$MANPATH
	    unset section
	fi
	return 1
    fi
    unset section
    (
    found=`echo $files | wc -w`
    if [ $found -gt 1 ]; then
	echo Found $found entries:
	echo
	echo $files | tr -s '[:space:]' | tr ' ' '\n'
#	echo ----------------------------
    fi
    unset found
    for file in $files; do
	echo
	echo -----------
	echo ${file}
	echo -----------
	if [ "${file}" != "${file%%.gz}" ]; then
	    gzip -dc $file
	else
	    cat $file
	fi
    done | nroff -mandoc -Tascii
    ) | ${PAGER:-less}
    unset file files
    return 0
}
#EOF#
    
    
More information about the Ale
mailing list