#!/usr/bin/sh
##########################################################################
# COPYRIGHT:
#    5765-273 (C) COPYRIGHT IBM CORPORATION 1995.
#    All Rights Reserved.
#    Licenced Materials - Property of IBM
#
#    US Government Users Restricted Rights - Use, duplication, or
#    disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
#
##########################################################################

if [[ "$PDBASE" = "" && -r /etc/rc.config.d/pd ]]
then
   . /etc/rc.config.d/pd
   export PATH=$PATH:/opt/pd/bin:/opt/pd/lbin
   export NLSPATH=/opt/pd/lib/nls/msg/%L/%N
   export PDBASE=/var/opt/pd

   # Default the DPS locale to C.

   if [[ -z "$LC_MESSAGES" && -z "$LC_ALL" && -z "$LANG" ]]
   then
      export LANG="C"
   fi
fi

typeset bn=$(basename $0)
#######################################################################
#
#  Create the Palladium supervisor default objects.
#
#######################################################################
if [ $# -ne 1 ]; then
   printf "%-16s[%3d]: " $bn $LINENO
   pddmsg 430 "pdcrdflt"
   exit 1
fi

#-------------------------------------------------------------------
# Ensure client code installed and client daemon running before
# trying to issue any commands
#-------------------------------------------------------------------
# Check if the client code is installed

if test ! -f $pdlsLoc; then # pdlsLoc defined in RunIUT, JJB.
   printf "%-16s[%3d]: " $bn $LINENO
   pddmsg 409
   exit 0
fi

# Check if the client daemon is running
pdls -c server $1 >/dev/null 2>&1
CLI_RC=$?
if [ $CLI_RC -eq 2 ]; then
   printf "%-16s[%3d]: " $bn $LINENO
   pddmsg 410
   exit $CLI_RC
fi

#-------------------------------------------------------------------
# Create default Auxiliary Sheets
#-------------------------------------------------------------------

# "none"
pdcreate -c auxiliary-sheet -x"\
     -descriptor = 'This represents the absense of an auxiliary sheet' \
     " $1:none

# "brief"
pdcreate -c auxiliary-sheet -x"\
     -descriptor = 'This represents a brief auxiliary sheet' \
     -psf-exit-program-name = '' \
     -psf-exit-page-mark = false \
     -psf-exit-form-definition = F1A10110 \
     " $1:brief

# "full"
pdcreate -c auxiliary-sheet -x"\
     -descriptor = 'This represents a full auxiliary sheet' \
     -psf-exit-program-name = '' \
     -psf-exit-page-mark = false \
     -psf-exit-form-definition = F1A10110 \
     " $1:full

# "blank"
pdcreate -c auxiliary-sheet -x"\
     -descriptor = 'This represents a blank auxiliary sheet' \
     " $1:blank

# "blank-start"
pdcreate -c auxiliary-sheet -x"\
     -descriptor = 'This represents a blank start sheet' \
     -psf-exit-program-name = pduxblkh \
     -psf-exit-page-mark = false \
     -psf-exit-form-definition = F1A10110 \
     " $1:blank-start

# "blank-separator"
pdcreate -c auxiliary-sheet -x"\
     -descriptor = 'This represents a blank separator sheet' \
     -psf-exit-program-name = "pduxblks" \
     -psf-exit-page-mark = false \
     -psf-exit-form-definition = F1A10110 \
     " $1:blank-separator

# "blank-end"
pdcreate -c auxiliary-sheet -x"\
     -descriptor = 'This represents a blank end sheet' \
     -psf-exit-program-name = "pduxblkt" \
     -psf-exit-page-mark = false \
     -psf-exit-form-definition = F1A10110 \
     " $1:blank-end

#-------------------------------------------------------------------
# Create default Media Objects
#-------------------------------------------------------------------

###################################################
###############   NA_LETTER_WHITE   ###############
###################################################
#NOTE: dimensions are converted to mm,  25.4mm = 1 inch

pdcreate -c medium -x"                                                        \
   -descriptor = 'North American letter white medium with size 8.5in by 11in' \
   -medium-type = stationery                                                  \
   -medium-size = na-letter                                                   \
   -medium-dimensions = 215.9:279.4                                           \
   -medium-color = white                                                      \
   -medium-sides = 2                                                          \
   " $1:na-letter-white

##################################################
###############   NA_LEGAL_WHITE   ###############
##################################################
#NOTE: dimensions are converted to mm,  25.4mm = 1 inch

pdcreate -c medium -x"                                                        \
   -descriptor = 'North American legal white medium with size 8.5in by 14in'  \
   -medium-type = stationery                                                  \
   -medium-size = na-legal                                                    \
   -medium-dimensions = 215.9:355.6                                           \
   -medium-color = white                                                      \
   -medium-sides = 2                                                          \
   " $1:na-legal-white

exit 0
