#  this script file may be used to break monster fortran programs into
#  individual files.  To use, simply type
#
#  breakup fortfile [>main]
#
#  breakup will place each function and subroutine on a file with the
#  same name and the extension .qq.  If a main program appears
#  at the beginning of the file, it will be placed on standard output.
#
tr <$1 A-Z a-z |@
ch "%[!#c][!#]*subroutine" "%[!#c][!#]*function" "%?*$"  "#-h- &@n&" |@
ch "%#-h-" "@- ?*subroutine" "@- " |@
ch "%#-h-" "@- ?*function" "@- " | asplit -v -t.qq
