c FPRINT - print a file to stdout
      subroutine fprint(fname)
      character fname*(*)
      character buf*1024

      open(unit=1, status='OLD', file=fname, err=398)
  300 read(1, '(A)', END=310, ERR=399) buf
      write(*, '(A)') buf(:length(buf))
      goto 300
  310 close(unit=1)
      return
  398 write(*,*) 'Could not open ', fname
      return
  399 write(*,*) 'Could not read ', fname
      end

c LENGTH - return the actual length of a string in a character array
      integer function length(str)
      character str*(*)
      do 1100, I = len(str), 1, -1
          if (str(I:I) .NE. ' ') goto 1110
 1100 continue
 1110 length = I
      end
