#!/bin/csh
#                        ---diagram9.sh---
#Unix csh procedure to diagram a (free format) FORTRAN language program.

#On some unix systems $1 should be replaced by %1.

# by Mitchell R Grunes, for his own use, in his own time.

#I assume that the executable and this procedure are in the search path,
#  and that this procedure has execute permission.

#Syntax:
#    diagram9.sh
#to be prompted for input parameters.

#Alternate Syntax:
#    diagram9.sh filename(s)
#to append diagram of file(s) into diagram.out

  if  (${?noclobber}) then
    unset noclobber
    set   noclobbersave
  endif

  if $1a == a  then
    diagramf
    goto quit
  endif

loop:
  echo ========================-- $1 --========================
  #Prompt answers: input from $1, output to diagram2.sc (for now),
  # place numbers in column 73, embed include files, use free
  # format, don't use IBM PC graphics.

  echo $1          >  diagram.sc
  echo diagram2.sc >> diagram.sc
  echo 73          >> diagram.sc
  echo 1           >> diagram.sc
  echo 1           >> diagram.sc
  echo 0           >> diagram.sc
  diagramf < diagram.sc
  cat diagram2.sc >> diagram.out
  rm -f diagram.sc
  rm -f diagram2.sc
  shift
  if ! ($1a == a) then
    goto loop
  endif
quit:
  echo Note--This does not delete diagram.out before appending to it.
  if  (${?noclobbersave}) then
    set   noclobber
    unset noclobbersave
  endif