# General script to make modset from modified source code using nmodex

VN=4.5                              # Version from which mods are made
MODID=ask1f406                      # Name of modset
AUTHOR="Stepher Cusack"             # Name of Author
DECKSLIST=" CALRHC2B  "             # List of library decks
MEMBERLIST="CALRHC2B.m"             # List of modified decks
DIR=/home/hc1400/hadba/SRCE/ask1f406 # HP directory with editted deck vn
TARGET=$DIR                         # Target directory for modset on HP

cd $TMPDIR
#-----------------------------------------------------------------------
#  Add header and footer text
#
cat >header <<eof                   # Add descriptive comment line(s)
eof
cat >footer <<eof           # Add *C and *MOVEDK directives if needed
*/ ---------------------------------------------------------------------
eof
#
#-----------------------------------------------------------------------

# Now construct the mods themselves, cutting out anything beyond col 72

PL=$UMDIR/vn$VN/source/umpl         # Name of update library
SERIAL=0                            # Initialise counter
>allmods
>alldecks.e
>alldecks.s

for DECK in $DECKSLIST
do

  SERIAL=`expr $SERIAL + 1`
  MEMBER=`echo $MEMBERLIST|cut -f$SERIAL -d" "`

  rcp hadba@hc1400:$DIR/$MEMBER $DECK.t
  cat $DECK.t|cut -c1-72 >$DECK.e
  nupdate -p $PL -s $DECK.s -o sq -q $DECK
  cat $DECK.e >>alldecks.e
  cat $DECK.s >>alldecks.s

done

nmodex -i $MODID -e alldecks.e -s alldecks.s -m allmods -v

cat header allmods footer >$TMPDIR/$MODID       # Copy to temp space ...
rcp $TMPDIR/$MODID hadba@hc1400:$TARGET/$MODID  # .. and to target dir
