[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: How to view a troff formatted file?



On Mon, Feb 22, 2021 at 06:04:15AM -0600, Richard Owlett wrote:
> I have downloaded a program with a man-page in troff format.
> How do I view it?
> I installed troffcvt but its man-page is non-informative.
> TIA

Feel free to use my script to do that, below.

ps_print is another script that send to my printer.

****************
#!/bin/ksh
# Format up a man page, the file name is the argument
# ADDW, July 1999

progname=$0

Usage() {
	cat <<-!
	Process a file with the man macros.
	Usage: $0 [opts] [file]
	-p	generate (Postscript) output to current printer
	-x	eXplain
	!
	exit $1
}

Postscript=0

while getopts px arg
do	case "$arg" in
	p)	Postscript=1;;
	x)	Usage 0;;
	esac
done

shift $((OPTIND - 1))


if [ $# -eq 0 ]
then	echo "Usage: $0 filename" >&2
	exit 2
fi

if [ $Postscript = 1 ]
then	groff -man -etpsR -rO0.75i -rW6.5i -rL11i $o $1 | ps_print
else	tbl $1 | nroff -man | col | less
fi
****************

-- 
Alain Williams
Linux/GNU Consultant - Mail systems, Web sites, Networking, Programmer, IT Lecturer.
+44 (0) 787 668 0256  https://www.phcomp.co.uk/
Parliament Hill Computers Ltd. Registration Information: https://www.phcomp.co.uk/Contact.html
#include <std_disclaimer.h>


Reply to: