BSD 4_2 development
[unix-history] / usr / man / man3 / topen.3f
CommitLineData
e300f457
C
1.TH TOPEN 3F "18 July 1983"
2.UC 4
3.SH NAME
4topen, tclose, tread, twrite, trewin, tskipf, tstate \- f77 tape I/O
5.SH SYNOPSIS
6.B integer function topen
7(tlu, devnam, label)
8.br
9.B integer
10tlu
11.br
12.B character*(*)
13devnam
14.br
15.B logical
16label
17.sp 1
18.B integer function tclose
19(tlu)
20.br
21.B integer
22tlu
23.sp 1
24.B integer function tread
25(tlu, buffer)
26.br
27.B integer
28tlu
29.br
30.B character*(*)
31buffer
32.sp 1
33.B integer function twrite
34(tlu, buffer)
35.br
36.B integer
37tlu
38.br
39.B character*(*)
40buffer
41.sp 1
42.B integer function trewin
43(tlu)
44.br
45.B integer
46tlu
47.sp 1
48.B integer function tskipf
49(tlu, nfiles, nrecs)
50.br
51.B integer
52tlu, nfiles, nrecs
53.sp 1
54.B integer function tstate
55(tlu, fileno, recno, errf, eoff, eotf, tcsr)
56.br
57.B integer
58tlu, fileno, recno, tcsr
59.br
60.B logical
61errf, eoff, eotf
62.SH DESCRIPTION
63These functions provide a simple interface between f77 and magnetic
64tape devices.
65A ``tape logical unit'',
66.IR tlu ,
67is ``topen''ed in much the same way as a normal f77 logical unit
68is ``open''ed.
69All other operations are performed via the
70.IR tlu .
71The
72.I tlu
73has no relationship at all to any normal f77 logical unit.
74.PP
75.I Topen
76associates a device name with a
77.IR tlu .
78.I Tlu
79must be in the range 0 to 3.
80The logical argument
81.I label
82should indicate whether the tape includes a tape label.
83This is used by
84.I trewin
85below.
86.I Topen
87does not move the tape.
88The normal returned value is 0.
89If the value of the function is negative, an error has occured.
90See
91.IR perror (3F)
92for details.
93.PP
94.I Tclose
95closes the tape device channel and removes its association with
96.IR tlu .
97The normal returned value is 0.
98A negative value indicates an error.
99.PP
100.I Tread
101reads the next physical record from tape to
102.IR buffer .
103.I Buffer
104.B must
105be of type
106.BR character .
107The size of
108.I buffer
109should be large enough to hold the largest physical record to be read.
110The actual number of bytes read will be returned as the value of the
111function.
112If the value is 0, the end-of-file has been detected.
113A negative value indicates an error.
114.PP
115.I Twrite
116writes a physical record to tape from
117.IR buffer .
118The physical record length will be the size of
119.IR buffer .
120.I Buffer
121.B must
122be of type
123.BR character .
124The number of bytes written will be returned.
125A value of 0 or negative indicates an error.
126.PP
127.I Trewin
128rewinds the tape associated with
129.I tlu
130to the beginning of the first data file.
131If the tape is a labelled tape
132(see
133.I topen
134above)
135then the label is skipped over after rewinding.
136The normal returned value is 0.
137A negative value indicates an error.
138.PP
139.I Tskipf
140allows the user to skip over files and/or records.
141First,
142.I nfiles
143end-of-file marks are skipped. If the current file is at
144EOF, this counts as 1 file to skip.
145(Note: This is the way to reset the EOF status for a
146.IR tlu .)
147Next,
148.I nrecs
149physical records are skipped over.
150The normal returned value is 0.
151A negative value indicates an error.
152.PP
153Finally,
154.I tstate
155allows the user to determine the logical state of the tape I/O channel
156and to see the tape drive control status register.
157The values of
158.I fileno
159and
160.I recno
161will be returned and indicate the current file and record number.
162The logical values
163.IR errf ,
164.IR eoff ,
165and
166.I eotf
167indicate an error has occurred, the current file is at EOF,
168or the tape has reached logical end-of-tape.
169End-of-tape (EOT) is indicated by an empty file, often
170referred to as a double EOF mark.
171It is not allowed to read past EOT although it is allowed to write.
172The value of
173.I tcsr
174will reflect the tape drive control status register.
175See
176.IR ht (4)
177for details.
178.SH FILES
179.ie \nM /usr/ucb/lib/libU77.a
180.el /usr/lib/libU77.a
181.SH "SEE ALSO"
182ht(4), perror(3F), rewind(1)