      subroutine readin (ios, record, lenrec)

      character*(*) record

      include 'basics.inc'

      character*6 chival

c read a record from the FFB files (UNIX version)

      read (nin, '(a)', iostat=ios) record
      if (ios .eq. 0) then
        lenrec = len_trim(record)
        if (lenrec .gt. 0) then
          if (record(lenrec:lenrec) .eq. char(13)) then
            record(lenrec:lenrec) = ' '
            lenrec = len_trim(record(:lenrec))
          end if
        end if
      else if (ios .ne. -1) then
        call abort ('Unusual i/o status code found'//chival(ios))
      end if
      return
      end
