home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 10 Tools
/
10-Tools.zip
/
GENMAN.ZIP
/
GENMAN
next >
Wrap
Text File
|
1993-03-13
|
1KB
|
74 lines
#!/bin/sh
#
# This shell script converts a c++ header file to a man page
# using the genman.awk program.
#
# Options supported are:
# -t produces troff output, default is ascii
# -s uses the program gmtime instead of ls -l
# to get the modify time of the file
# -o file output file name, default is stdout
#
set -e
# Set the variable XX to be the path where you have placed the file
# genman.awk and program gmtime.
#XX=/usr/local/bin
XX=.
# Set the AWK variable to the name and/or path of the version of awk
# you use.
AWK=gawk
# Get the name of the shell script
prog=$0
#
# Process the command line switches
#
opt_t=""
opt_s=""
opt_o=""
file=""
gmtime=$XX/gmtime
while test -n "$1"
do
case $1 in
-t)
opt_t="device=troff";;
-s)
opt_s="mtime=$gmtime";;
-o)
opt_o=$2
shift;;
-*)
echo "$prog: bad option $1"
exit 1;;
*)
file=$1;;
esac
shift
done
# Print out the usage message if an input file was not specified
if test ! -n "$file"
then
echo "usage: $prog [-s -t -o file] filename"
exit 1;
fi
# See if they want to output to a particular file
if test -n "$opt_o"
then
# make sure the input and output file are not the same
if test $opt_o = $file
then
echo "$prog: input and output file are the same, $file"
exit 1
fi
$AWK -f $XX/genman.awk $opt_t $opt_s $file > $opt_o
else
$AWK -f $XX/genman.awk $opt_t $opt_s $file
fi