#!/bin/sh
#
# Convert a man page to an appropriate postscript file
#
# 2003 Copyright (c) Markus Drechsler, Bavaria, Germany
#
# Revision: 1.0
#
# Usage:
#   man2ps [<page>] <manpage>
#
# Example:
#   man2ps 5 procmailex 
#   converts page 5 of procmailex to file procmailex.ps 
#

PAGES_PER_SHEET=1

# have params
if [ $# -gt 0 ]; then
  nr=""
  # have optional page param
  if [ $# -gt 1 ]; then
    nr="$1";
    shift;
  fi
  # now convert it
  man $nr $1 | a2ps -$PAGES_PER_SHEET -m -t$1 -b$1 -o$1$nr.ps
  # echo "$0 $nr $1";
else
  echo "Usage: man2ps [<page>] <manpage>"
fi

exit 0
