C----------------------------------------------------------------------- C; Copyright (C) 1995 C; Associated Universities, Inc. Washington DC, USA. C; C; This program is free software; you can redistribute it and/or C; modify it under the terms of the GNU General Public License as C; published by the Free Software Foundation; either version 2 of C; the License, or (at your option) any later version. C; C; This program is distributed in the hope that it will be useful, C; but WITHOUT ANY WARRANTY; without even the implied warranty of C; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the C; GNU General Public License for more details. C; C; You should have received a copy of the GNU General Public C; License along with this program; if not, write to the Free C; Software Foundation, Inc., 675 Massachusetts Ave, Cambridge, C; MA 02139, USA. C C For further information about this software contact: C Internet email: bcotton@nrao.edu. C Postal address: Bill Cotton C National Radio Astronomy Observatory C 520 Edgemont Road C Charlottesville, VA 22903-2475 USA C----------------------------------------------------------------------- SUBROUTINE TXOPN (UNIT, FILNAM, IERR) C----------------------------------------------------------------------- C Open a text file for read C Translated from the AIPSish C Inputs: C UNIT I Logical unit number C FILNAM C*(*) File name C Outputs: C IERR I Error return code: 0 => no error C 1 = File does not exist C 2 = Error opening C----------------------------------------------------------------------- CHARACTER FILNAM*(*) INTEGER UNIT, IERR C LOGICAL EXISTS C----------------------------------------------------------------------- IERR = 0 C See if file exists INQUIRE (FILE=FILNAM, EXIST=EXISTS) IF (.NOT.EXISTS) THEN IERR = 1 GO TO 999 END IF C Open C OPEN (UNIT=UNIT, FILE=FILNAM, READONLY, ERR=900) C solaris f77 ver SC4.0 C OPEN (UNIT=UNIT, FILE=FILNAM, ACTION='read', ERR=900) C For systems without READONLY OPEN (UNIT=UNIT, FILE=FILNAM, ERR=900) GO TO 999 C Open error 900 IERR = 2 C 999 RETURN END SUBROUTINE TXCLS (UNIT, IERR) C----------------------------------------------------------------------- C Close the text file associated with UNIT. C Inputs: C UNIT I Logical unit number C Output: C IERR I Error return code: 0 => no error C 1 => close error C----------------------------------------------------------------------- INTEGER UNIT, IERR C----------------------------------------------------------------------- IERR = 0 C Close the text file. CLOSE (UNIT=UNIT, ERR=900) GO TO 999 C Error 900 IERR = 1 C 999 RETURN END SUBROUTINE TXREAD (UNIT, LINE, IERR) C----------------------------------------------------------------------- C Read/write the next sequential line from/to a text file. C Inputs: C UNIT I Logical unit number C LINE C*(*) Line of text. C Output: C LINE C*(*) Line of text. C IERR I Error return code: 0 => no error C -1 = EOF, 1 = read error C----------------------------------------------------------------------- CHARACTER LINE*(*) INTEGER UNIT, IERR C C----------------------------------------------------------------------- IERR = 0 C Read READ (UNIT, 1000, END=800, ERR=900) LINE GO TO 999 C End of file. 800 IERR = -1 LINE = ' ' GO TO 999 C Other error. 900 IERR = 1 LINE = ' ' GO TO 999 C 999 RETURN C----------------------------------------------------------------------- 1000 FORMAT (A) END