This is the mail archive of the cygwin@sourceware.cygnus.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

MAN script for troff2html


Hi...

Here a ksh-script for a cool man functionality. It's only neccessary to
convert it for bash. I also have the file troff2html.exe (75KB)....
I will be happy to get a converted version of this script - It's very cool....

------------------------------------------------------------------------------
# this is the first pass at the man command for uwin
manpath=${MANPATH:-/usr/man}
section=?
macro=an

function getfile # varname fname
{
	nameref file=$1
	typeset name=$2
	IFS=:
	for i in $manpath
	do	if	[[ $i == '' ]]
		then	i=.
		fi
		set -- "$i"/man$section/"$name".$section
		if	[[ -e $1 ]]
		then	file=$1
			return
		fi
	done
	return 1
}

while getopts "lrM:[path}T:[macro]s#[section]k:[keyword] file " n
do	case $n in
	M)	mpath=$OPTARG;;
	T)	macro=$OPTARG;;
	k)	keyword=$OPTARG;;
	k)	section=$OPTARG;;
	l)	lflag=1;;	
	r)	rflag=1;;	
	esac
done

shift $((OPTIND-1))

if	[[ $1 == [123456789] ]]
then	section=$1
	shift
fi

if	! getfile fname $1
then	print -u2 man page for "$1" not found
	exit 2
fi
cname=${fname/man'/'man/man'/'cat}
cname=${cname%.?}.html
if	[[ ! -e $cname ]]
then	troff2html -man "$fname" > $cname
fi
/usr/lib/webbrowser "$cname"
------------------------------------------------------------------------------

Thanks in advance,

-------------------------------------------------------------------------------------------------------------
Michael Schmitz	Software-Ley GmbH
Lindenstr. 15	Phone:	+49 2238 96600	(Windows '95
D-50259 Pulheim	Fax:	+49 2238 50842		crash compatible
Germany		Email:	ms@ley.de			with Windows 3.x)

-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]