# @(#) makebook 3.0 22jan94 Morgan_Davis @(#)
#
#   makebook bookfile [ -d ] [ options ]
#
#   Use this script to build a single file that contains all the manuals.
#   By default, the bookfile created is formatted for a PostScript printer.
#   Use the -d option to create a dot-matrix formatted book, and include
#   dotopts (options to man) for additional dot-matrix control.
#

if $gid > 0 then
    echo "$argv[0]: can't execute"
    exit -1
endif

if $argc < 2 then
    echo "Usage: $argv[0] bookfile [ -d ] [ options ]"
    exit -1
endif

if "$argv[2]" == "-d" then
    set ps= opts="-p $argv[3] $argv[4] $argv[5] -t"
else
    set ps="ps" opts="-pc $argv[2] $argv[3] $argv[4] -t"
endif

stty lines 0
man$ps $opts "System Administration"      ADM *    >$argv[1]
man$ps $opts "General Commands"           C *     >>$argv[1]
man$ps $opts "Typesetting Commands"       CT *    >>$argv[1]
man$ps $opts "File Formats"               F *     >>$argv[1]
man$ps $opts "Games"                      G *     >>$argv[1]
#man$ps $opts "Hardware Reference"         HW *    >>$argv[1]
man$ps $opts "Local Reference"            L *     >>$argv[1]
man$ps $opts "Miscellaneous"              M *     >>$argv[1]
man$ps $opts "Networking"                 NET *   >>$argv[1]
man$ps $opts "Software Development"       S *     >>$argv[1]

echo "$argv[0]: $argv[1] completed!"
unset ps opts
