Highley Recommended, Inc.
[ Home |
News |
Services |
Links ]
FrameMaker Build File
#! /bin/ksh
SRC_ID='@(#) $Header: build_file,v 1.0 93/11/10 14:56:15 uid=135(dhighley)
gid=10(staff) groups=10(staff) Exp $'
# Author: David Highley
# Copyright (c) 1993 Highley Recommended, Inc.
# All Rights Reserved. This copyright and the "SRC_ID" string(s)
# included in the source must not be removed. Permission is granted for
# licensed systems.
#
# $Log$
# Initial Edit: 93/11/10 14:56:15
#
Rev='$Revision: 1.0 $'
OrigFile=$1
Index=0
FileNo=1
cat catalog > tmp.mif
#############################
# List paragraph body files #
#############################
ls *AFrame | sort -t"." -n +0 |
awk '{
No = substr($1,1,index($1,"."))
print No
}' |
while read No
do
file[${Index}]=${No}
Index=`expr ${Index} + 1`
if [ -s ${No}"ID" ] # Diagram may have been to
then # large to print
cat ${No}"ID" >>tmp.mif # Put in diagram for paragraph
fi
if [ ${Index} -gt 199 ]
then {
if [ ${FileNo} -eq 1 ]
then
cat ChapTitlePar >>tmp.mif
else
echo "<TextFlow" >>tmp.mif
fi
Ind=0
while [ ${Ind} -lt ${Index} ]
do
cat ${file[$Ind]}"AFrame" >>tmp.mif # Add body paragraph
Ind=`expr ${Ind} + 1`
done
cat trailer >>tmp.mif # Add end of file info
mv tmp.mif ${OrigFile}${FileNo}
cat catalog >tmp.mif
FileNo=`expr ${FileNo} + 1`
Index=0
}
fi
done
if [ ${Index} -gt 0 ]
then
if [ ${FileNo} -eq 1 ] # Paranoid check
then
cat ChapTitlePar >>tmp.mif
else
echo "<TextFlow" >>tmp.mif
fi
Ind=0
while [ ${Ind} -lt ${Index} ]
do
cat ${file[$Ind]}"AFrame" >>tmp.mif # Add body paragraph
Ind=`expr ${Ind} + 1`
done
cat trailer >>tmp.mif
mv tmp.mif ${OrigFile}${FileNo}
fi
echo "${FileNo}" # Output number of files constructed
rm -f *.ID *.AFrame catalog ChapTitlePar trailer