MAJOR=4
MINOR=31
DEVNAME=tty31
  5   _ˆl–äY>”TÊ:”Ê�nã ¸ )‹Fÿ�þB6J³r†RŒŽ:á@ççƒqÐ½æÄã >    _#!/bin/sh
#
# pcdovtoppm - generate a single PPM file from a PCD overview file
#
# Based on pnmindex (PBMPLUS), which was written by Jef Poskanzer,
# this script makes also use of hpcdtoppm, written by Hadmut Danisch.
#
# Formerly called Pcdindex.
#
# A similar result can be achieved by using "hpcdtoppm -Overview"
# followed by "pnmindex -black" on the generated PPM images.
# This shell just makes it more convenient and transparent to
# convert from one PCD to one PPM overview file.
#
# Additional options (compared to pnmindex) are -maxwidth and
# -font <font>. See "man pbmtext" on how to create your own font.
#
# Pieter S. van der Meulen, 1992.
# Rewritten in sh by Steve McIntyre <93sam@debian.org>, 2001

# You may want to change the default values in the next 6 lines:
maxwidth=1152     # maximum width of the index image
size=192          # make the images about this big
across=6          # show this many images per row
colors="noquant"  # maximum amount of colors or noquant (no quantization)
back="-black"     # default background color
font=" "          # default font or none (pbmtext's internal font)

plainopt=""       # output plain ppm
quietopt=""       # quiet operation (currently no effect)
versionopt=0

usage ()
{
    echo "Usage: $0 [-m W] [-s S] [-a A] [-c N|n] [-f F] [-b|-w] <overview.pcd>"
    echo " with"
    echo "      W = maximum width of the result image   (default: $maxwidth)"
    echo "      S = maximum size of each of the images  (default: $size)"
    echo "      A = maximum number of images across     (default: $across)"
    echo "      N = maximum number of colors or noquant (default: $colors)"
    echo -n "   F = font to be used for annotation      (default: "
    if [ "$font" = " " ] ; then
                echo "internal font)"
    else
                echo "$font)"
    fi
    echo "      -b/-w = black/white background color    (default: $back)"
    echo " "
    echo " e.g.: $0 -m 768 -s 96 -f smallfont.pbm overview.pcd > overview.ppm"
    echo " or  : $0 /cdrom/photo_cd/overview.pcd | ppmtojpeg > overview.jpg"
    exit 1
}

version ()
{
    # report version using pnmscale
    pnmscale -version $quietopt
    exit 0
}

# Parse the options
while :; do
    case "$1" in 
        -m|-ma|-max|-maxw|-maxwi|-maxwid|-maxwidt|-maxwidth )
             if [ $# -lt 2 ] ; then usage; fi
             maxwidth="$2"
             shift
             shift
             ;;

        -s|-si|-siz|-size )
             if [ $# -lt 2 ] ; then usage; fi
             size="$2"
             shift
             shift
             ;;

         -a|-ac|-acr|-acro|-acros|-across )
             if [ $# -lt 2 ] ; then usage; fi
             across="$2"
             shift
             shift
             ;;

         -c|-co|-col|-colo|-color|-colors )
             if [ $# -lt 2 ] ; then usage; fi
             colors="$2"
             shift
             shift
             ;;

         -f|-fo|-fon|-font )
             if [ $# -lt 2 ] ; then usage; fi
             font="-font $2"
             shift
             shift
             ;;

         -b|-bl|-bla|-blac|-black )
             back="-black"
             shift
             ;;

         -w|-wh|-whi|-whit|-white )
             back="-white"
             shift
             ;;
             
         -p|-pl|-pla|-plai|-plain )
             plainopt="-plain"
             shift
             ;;
            
         -q|-qu|-qui|-quie|-quiet )
             quietopt="-quiet"
             shift
             ;;
             
         -v|-ve|-ver|-vers|-versi|-versio|-version )
             versionopt="1"
             shift
             ;;
                    
         -*)
             echo "$0 : Unknown option $1" 1>&2
             echo " " 1>&2
             usage
             ;;

         *)
             break
             ;;

    esac
done

if [ $versionopt -eq 1 ] ; then
    version
elif [ $# -eq 0 ] ; then
    usage
fi

tempdir=$(mktemp -d "${TMPDIR:-/tmp}/pcdovtoppm.XXXXXXXX") ||
    { echo "