#! /bin/sh
 
#    JAN 26/93 - F.Majaess
 
#id  src2dk  - Adds "%DECK..." to Fortran source code 
 
#    AUTHOR  - F.Majaess
 
#hd  PURPOSE - "src2dk" script is used to add "%DECK..." line to 
#hd            the top of "pathfil" source code data and write 
#hd            the resulting code to "outfil".
#hd            NOTE: mainly used by "updcpgm" script.
 
#pr  PARAMETERS:
#pr
#pr    POSITIONAL     
#pr
#pr      pathfil = path/filename containing source code. 
#pr
#pr    PRIMARY
#pr
#pr      outfil  = name of the file to which generated data get appended 
#pr                (=updtsrc).
#pr
#ex  EXAMPLE: 
#ex
#ex    src2dk ~acrnsrc/source_linux/lspgm/.f/add.f 
 
#   * code used to set switches and deal with parameter=value arguments 
#   * as well as setting parameters to their primary/secondary defaults.
#   * The list of other arguments (if any) is returned in "prmtrl" var...
 
. $SUBPROC/check_set_swtches_prmtrs
 
#   * The following code deals with checking/setting positional 
#   * parameters ...
#   * Note: script will abort if too many arguments are specified.
 
if [ -n "$prmtrl" ] ; then
    i=1
    for prmtr in $prmtrl
    do
      case $i in
        1) pathfil=$prmtr;;
        *) eval "echo '$0 : too many parameters !' "; exit 1 ;;
      esac
      i=`expr $i + 1`
    done
fi
 
#     * Prompt for a positional parameter value(s) if none was/were
#     * specified...
 
  while [ -z "$pathfil" ] ; do
    echo "please enter filename ? > \\c"
    read pathfil
  done
 

eval "outfil=${outfil='updtsrc'}"
 
#   ****   Task of the script...   ****
 
 Flname=`expr //$pathfil : '.*/\(.*\)' | tr '[a-z]' '[A-Z]' | sed -e 's/\..*\$//' ` 
#(echo "%DECK $Flname" ; cat $pathfil ) >> $outfil 
 (echo "%DECK $Flname" ; cat $pathfil | sed -e 's/REVISED FOR F90 AND LINUX PLATFORMS) /REVISED FOR F90 AND LINUX PLATFORMS )/') >> $outfil 
