4.3BSD-UWisc/man/cat3/topen.3f




TOPEN(3F)           UNIX Programmer's Manual            TOPEN(3F)



NAME
     topen, tclose, tread, twrite, trewin, tskipf, tstate - f77
     tape I/O

SYNOPSIS
     integer function topen (tlu, devnam, label)
     integer tlu
     character*(*) devnam
     logical label

     integer function tclose (tlu)
     integer tlu

     integer function tread (tlu, buffer)
     integer tlu
     character*(*) buffer

     integer function twrite (tlu, buffer)
     integer tlu
     character*(*) buffer

     integer function trewin (tlu)
     integer tlu

     integer function tskipf (tlu, nfiles, nrecs)
     integer tlu, nfiles, nrecs

     integer function tstate (tlu, fileno, recno, errf, eoff,
     eotf, tcsr)
     integer tlu, fileno, recno, tcsr
     logical errf, eoff, eotf

DESCRIPTION
     These functions provide a simple interface between f77 and
     magnetic tape devices.  A ``tape logical unit'', _t_l_u, is
     ``topen''ed in much the same way as a normal f77 logical
     unit is ``open''ed.  All other operations are performed via
     the _t_l_u.  The _t_l_u has no relationship at all to any normal
     f77 logical unit.

     _T_o_p_e_n associates a device name with a _t_l_u.  _T_l_u must be in
     the range 0 to 3.  The logical argument _l_a_b_e_l should indi-
     cate whether the tape includes a tape label.  This is used
     by _t_r_e_w_i_n below.  _T_o_p_e_n does not move the tape.  The normal
     returned value is 0.  If the value of the function is nega-
     tive, an error has occured.  See _p_e_r_r_o_r(3F) for details.

     _T_c_l_o_s_e closes the tape device channel and removes its asso-
     ciation with _t_l_u.  The normal returned value is 0.  A nega-
     tive value indicates an error.





Printed 12/27/86          May 15, 1985                          1






TOPEN(3F)           UNIX Programmer's Manual            TOPEN(3F)



     _T_r_e_a_d reads the next physical record from tape to _b_u_f_f_e_r.
     _B_u_f_f_e_r must be of type character.  The size of _b_u_f_f_e_r should
     be large enough to hold the largest physical record to be
     read.  The actual number of bytes read will be returned as
     the value of the function.  If the value is 0, the end-of-
     file has been detected.  A negative value indicates an
     error.

     _T_w_r_i_t_e writes a physical record to tape from _b_u_f_f_e_r.  The
     physical record length will be the size of _b_u_f_f_e_r.  _B_u_f_f_e_r
     must be of type character.  The number of bytes written will
     be returned.  A value of 0 or negative indicates an error.

     _T_r_e_w_i_n rewinds the tape associated with _t_l_u to the beginning
     of the first data file.  If the tape is a labelled tape (see
     _t_o_p_e_n above) then the label is skipped over after rewinding.
     The normal returned value is 0.  A negative value indicates
     an error.

     _T_s_k_i_p_f allows the user to skip over files and/or records.
     First, _n_f_i_l_e_s end-of-file marks are skipped. If the current
     file is at EOF, this counts as 1 file to skip.  (Note: This
     is the way to reset the EOF status for a _t_l_u.) Next, _n_r_e_c_s
     physical records are skipped over.  The normal returned
     value is 0.  A negative value indicates an error.

     Finally, _t_s_t_a_t_e allows the user to determine the logical
     state of the tape I/O channel and to see the tape drive con-
     trol status register.  The values of _f_i_l_e_n_o and _r_e_c_n_o will
     be returned and indicate the current file and record number.
     The logical values _e_r_r_f, _e_o_f_f, and _e_o_t_f indicate an error
     has occurred, the current file is at EOF, or the tape has
     reached logical end-of-tape.  End-of-tape (EOT) is indicated
     by an empty file, often referred to as a double EOF mark.
     It is not allowed to read past EOT although it is allowed to
     write.  The value of _t_c_s_r will reflect the tape drive con-
     trol status register.  See _h_t(4) for details.

FILES
     /usr/lib/libU77.a

SEE ALSO
     ht(4), perror(3F), rewind(1)












Printed 12/27/86          May 15, 1985                          2