delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1997/11/27/13:49:44

From: ms AT ley DOT de (Michael M. Schmitz)
Subject: MAN script for troff2html
27 Nov 1997 13:49:44 -0800 :
Message-ID: <01BCFB3C.18D40950.cygnus.gnu-win32@PENTIUMMS.sleydom.col.sw-ley.de>
Mime-Version: 1.0
To: "'gnu-win32 AT cygnus DOT com'" <gnu-win32 AT cygnus DOT com>

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 AT ley DOT de			with Windows 3.x)

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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019