program rmblklines c c======================================================================= c === c This program removes blank lines from fortran codes. The input === c fortran code is taken from standard input and the cleanned code === c is output to standard output. === c === c======================================================================= c integer iend,ios,len,stdinp,stdout character*80 line c parameter (len=80, stdinp=5, stdout=6) c c----------------------------------------------------------------------- c Begin executable code. c----------------------------------------------------------------------- c read (stdinp,30,iostat=ios) line c do 20 while (ios.eq.0) c c----------------------------------------------------------------------- c Remove comment lines generated during C-preprocessing. These lines #ifndef rmcomments c start with a hash (#) character. # else c start with a hash (#) character. Also remove commented lines. #endif c----------------------------------------------------------------------- c #ifndef rmcomments if (line(1:1).ne.'#') then # else if ((line(1:1).ne.'#').and.(line(1:1).ne.'c').and. & (line(1:1).ne.'C')) then #endif c c---------------------------------------------------------------------- c Remove blank lines or blank spaces to right of the last line c character. c---------------------------------------------------------------------- c iend = len c do 10 while ( (line(iend:iend).eq.' ') .and. (iend.gt.1) ) iend = iend - 1 10 continue if (line(iend:iend).eq.' ') iend = iend - 1 c if (iend.ge.1) write (stdout,30) line(1:iend) c end if c read (stdinp,30,iostat=ios) line c 20 continue c stop c 30 format (a) c end