#!/bin/sh
# Portable System Interface Copyright (c) 1997-1998 Tycho Softworks.
# $Id: instman 1.1 Tue, 23 Jun 1998 11:38:33 -0400 dyfet $

prefix=$1
set=$2
shift
shift

for page in $* ; do
	source=$page'.'$set
	target=""
	if test -d $prefix/man$set ; then
		mandir=$prefix/man$set
		target=$mandir/$page'.'$set
	fi
	if test -z $target ; then
		roff=nroff
		if test -f /usr/lib/groff ; then
			roff="groff -Tascii"
		fi
		if test -f /usr/local/lib/groff ; then
			roff="groff -Tascii"
		fi
		if test -d $prefix/cat$set ; then
			mandir=$prefix/cat$set
			target=$mandir/$page.set
			$roff -man <$source >$page'.man'
			source=$page'.man'
		fi
	fi	
	echo 'Adding '$page' to '$mandir
	install -g man -m 0664 -d $mandir
	install -g man -m 0664 $source $target
done

