#!/bin/bsh
# IBM_PROLOG_BEGIN_TAG 
# This is an automatically generated prolog. 
#  
# cmdtext720 src/cmdtext/usr/bin/mmt/mmt.sh 1.21 
#  
# Licensed Materials - Property of IBM 
#  
# COPYRIGHT International Business Machines Corp. 1989,2008 
# All Rights Reserved 
#  
# US Government Users Restricted Rights - Use, duplication or 
# disclosure restricted by GSA ADP Schedule Contract with IBM Corp. 
#  
# IBM_PROLOG_END_TAG 
# @(#)80	1.21  src/cmdtext/usr/bin/mmt/mmt.sh, cmdtext, cmdtext720 8/25/08 07:13:53
#
# COMPONENT_NAME: (CMDTEXT) Text Formatting Services
#
# FUNCTIONS:
#
# ORIGINS: 54,27,28
#
# (C) COPYRIGHT International Business Machines Corp. 1989
# All Rights Reserved
# Licensed Materials - Property of IBM
#
# US Government Users Restricted Rights - Use, duplication or
# disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
#
#
PATH=/usr/bin:/usr/sbin
export PATH
case "basename $0" in
	*mmt)	u="-mm";;
	*mant)	u="-man";;
	*mvt)	u="-mv";;
esac
if test $# = 0;
then 
#cat >&2 <<!
dspmsg mm.cat 3 "Usage: %s [options] files (or mvt [options] files) where options are:\n\
 -a	=> output to terminal\n\
 -c     => cw \n\
 -e	=> eqn\n\
 -p	=> pic\n\
 -g	=> grap\n\
 -t	=> tbl\n\
 -Taps	=> APS-5\n\
 -Tptty	=> format for troff device ptty\n\
 -D4014	=> Tektronix 4014\n\
 -z	=> use no postprocessor for troff output\n\
 -	=> instead of "files" inside a pipeline.\n\
Other options as required by TROFF and the macros.\n" $0
#!
exit 1
fi
case $TYPESETTER in
	ibm3816|"") ptty=ibm3816;  x=;  Teqn=-Tibm3816;
		O=;  o="|ibm3816";  y=; ec=/usr/pub/eqnchar;
	;;
	X100) ptty=X100;  x=;  Teqn=-TX100;
		O=;  o=;  y=; ec=/usr/pub/eqnchar;
	;;
	X100K) ptty=X100K;  x=;  Teqn=-TX100K;
		O=;  o=;  y=; ec=/usr/pub/eqnchar;
	;;
	aps)	ptty=aps  Teqn=-Taps x=;
		O=;  o="|aps";  y=;  ec=/usr/pub/apseqnchar;
	;;
	4014|tek) ptty=$TYPESETTER;  Teqn=-T$TYPESETTER;
		O=; o="|tc"  x=  y="-rX1" ec=/usr/pub/eqnchar;
	;;
	*)	ptty=$TYPESETTER;  x=;  Teqn=-T$TYPESETTER;
		O=;  o="|$TYPESETTER";  y=; ec=/usr/pub/eqnchar;
	;;
esac
PATH=$PATH:/bin:/usr/bin
#	'If phototypesetter connected to unix, use o="|daps"'
#	'If sending to MHCC use o="|apsend"'
a= e= f= p= z= g=
while test -n "$1" -a ! -f "$1"
do case $1 in
	-a)	O="-a"  o=  x=  ;;
	-Taps)	ptty=aps  Teqn=-Taps  ec=/usr/pub/apseqnchar  ;;
	-D4014|-Dtek|-T4014)	o="|tc"  x=  y="-rX1" ;;
	###Set -T flag; Teqn sets flag for eqn
	-T*)	ptty=`echo $1 | sed "s/-T//"`
		x=  
		case $ptty in
			ibm3816) o="|ibm3816"; Teqn=-Tibm3816;;
			ibm3812) o="|ibm3812"; Teqn=-Tibm3812;;
			hplj) o="|hplj"; Teqn=-Thplj;;
			psc) o="|psc"; Teqn=-Tpsc;;
			#support Xpreview
			X100) o=; Teqn=-TX100;;
			X100K) o=; Teqn=-TX100K;;
			#support for Kanji printer.
			ibm5587G) o="|ibm5587G"; Teqn=-Tibm5587G;;
			*) o="|$ptty";;
		esac
		;;
	-e)	e=eqn ;;
	-t)	f=tbl ;;
        -c)     C=cw ;;
	-p)	p=pic ;;
	-g)	g=grap  p=pic ;;
	-y)	;;
	-)	break ;;
	-z)	z=z  ;;
	*)	a="$a $1" ;;
   esac
   shift
done
if test -z "$1";  then dspmsg mm.cat 2 "%s: no input file\n" $0 >&2;  exit 1;  fi
if test -n "$ptty" || "$ptty" != $TYPESETTER
then troff="troff -T$ptty"
else troff=troff
fi
if test -n "$z";  then o=  x=;  fi
if test "|apsend" = "$o";  then x="$x c=$1";  fi
d="$*"
if test -n "$g";  then g="grap $d|";  d="-";  fi
if test -n "$p";  then p="pic $Teqn $d|";  d="-";  fi
if test -n "$C";  then C="cw $d|"; d="-"; fi
if test -n "$f";  then f="tbl $d|";  d="-";  fi
if test -n "$e";  then e="eqn $Teqn $ec $d|";  d="-";  fi
if test "$u" = "-mm";  then y=;  fi
eval "$g $p $C $f $e $troff $y $O $u $a $d $o $x"; exit 0