      subroutine putchr(iunit,chr,*)

c     Copyright 2012 Leon van Dommelen.  This software is made available
c     under the GNU Public License version 3.

c     Write a character to the output file open on unit iunit.

c     Takes exit 1 on error.

c     This version for g77.  Unit iunit must have been opened using
c     "form='unformatted'".

c     avoid typos
      implicit none

c input:

c     I/O unit to write to
      integer iunit

c     character to write
      character*1 chr

c local:

c     error status
      integer stat

c executable:

c     write the character to the file
      call fputc(iunit,chr,stat)

c     check for problems
      if(stat.ne.0)return 1

c     all OK
      return
      end
