Sync usage with man page.
[netbsd-mini2440.git] / external / bsd / pcc / dist / pcc-libs / libI77 / fio.h
blobff16dc3c2e2bd2716f91bfede7c34de4aafd03b1
1 /* $Id: fio.h,v 1.1.1.1 2008/08/24 05:34:47 gmcgarry Exp $ */
2 /*
3 * Copyright(C) Caldera International Inc. 2001-2002. All rights reserved.
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
9 * Redistributions of source code and documentation must retain the above
10 * copyright notice, this list of conditions and the following disclaimer.
11 * Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditionsand the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 * All advertising materials mentioning features or use of this software
15 * must display the following acknowledgement:
16 * This product includes software developed or owned by Caldera
17 * International, Inc.
18 * Neither the name of Caldera International, Inc. nor the names of other
19 * contributors may be used to endorse or promote products derived from
20 * this software without specific prior written permission.
22 * USE OF THE SOFTWARE PROVIDED FOR UNDER THIS LICENSE BY CALDERA
23 * INTERNATIONAL, INC. AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR
24 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
25 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
26 * DISCLAIMED. IN NO EVENT SHALL CALDERA INTERNATIONAL, INC. BE LIABLE
27 * FOR ANY DIRECT, INDIRECT INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30 * HOWEVER CAUSED AND ON ANY THEORY OFLIABILITY, WHETHER IN CONTRACT,
31 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
32 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33 * POSSIBILITY OF SUCH DAMAGE.
35 #include <stdio.h>
36 typedef long ftnint;
37 typedef ftnint flag;
38 typedef long ftnlen;
39 /*external read, write*/
40 typedef struct
41 { flag cierr;
42 ftnint ciunit;
43 flag ciend;
44 char *cifmt;
45 ftnint cirec;
46 } cilist;
47 /*internal read, write*/
48 typedef struct
49 { flag icierr;
50 char *iciunit;
51 flag iciend;
52 char *icifmt;
53 ftnint icirlen;
54 ftnint icirnum;
55 } icilist;
56 /*open*/
57 typedef struct
58 { flag oerr;
59 ftnint ounit;
60 char *ofnm;
61 ftnlen ofnmlen;
62 char *osta;
63 char *oacc;
64 char *ofm;
65 ftnint orl;
66 char *oblnk;
67 } olist;
68 /*close*/
69 typedef struct
70 { flag cerr;
71 ftnint cunit;
72 char *csta;
73 } cllist;
74 /*rewind, backspace, endfile*/
75 typedef struct
76 { flag aerr;
77 ftnint aunit;
78 } alist;
79 /*units*/
80 typedef struct
81 { FILE *ufd; /*0=unconnected*/
82 char *ufnm;
83 long uinode;
84 int url; /*0=sequential*/
85 flag useek; /*true=can backspace, use dir, ...*/
86 flag ufmt;
87 flag uprnt;
88 flag ublnk;
89 flag uend;
90 flag uwrt; /*last io was write*/
91 flag uscrtch;
92 } unit;
93 typedef struct
94 { flag inerr;
95 ftnint inunit;
96 char *infile;
97 ftnlen infilen;
98 ftnint *inex; /*parameters in standard's order*/
99 ftnint *inopen;
100 ftnint *innum;
101 ftnint *innamed;
102 char *inname;
103 ftnlen innamlen;
104 char *inacc;
105 ftnlen inacclen;
106 char *inseq;
107 ftnlen inseqlen;
108 char *indir;
109 ftnlen indirlen;
110 char *infmt;
111 ftnlen infmtlen;
112 char *inform;
113 ftnint informlen;
114 char *inunf;
115 ftnlen inunflen;
116 ftnint *inrecl;
117 ftnint *innrec;
118 char *inblank;
119 ftnlen inblanklen;
120 } inlist;
122 extern int errno;
123 extern flag init;
124 extern cilist *elist; /*active external io list*/
125 extern flag reading,external,sequential,formatted;
126 extern int (*getn)(void),(*putn)(int); /*for formatted io*/
127 extern FILE *cf; /*current file*/
128 extern unit *curunit; /*current unit*/
129 extern unit units[];
130 #define err(f,n,s) {if(f) errno= n; else fatal(n,s); return(n);}
132 /*Table sizes*/
133 #define MXUNIT 10
135 extern int recpos; /*position in current record*/
137 #define WRITE 1
138 #define READ 2
139 #define SEQ 3
140 #define DIR 4
141 #define FMT 5
142 #define UNF 6
143 #define EXT 7
144 #define INT 8
146 /* forward decl's */
147 struct syl;
149 /* function prototypes */
150 void fatal(int n, char *s);
151 int t_runc(unit *b);
152 int nowreading(unit *x);
153 int f_back(alist *a);
154 int rd_ed(struct syl *p, void *ptr, ftnlen len);
155 int rd_ned(struct syl *p, char *ptr);
156 int w_ed(struct syl *p, void *ptr, ftnlen len);
157 int w_ned(struct syl *p, char *ptr);
158 int s_rdfe(cilist *a);
159 void f_init(void);
160 int pars_f(char *);
161 void fmt_bg(void);
162 int s_wdfe(cilist *a);
163 int e_rdfe(void);
164 int e_wdfe(void);
165 int nowwriting(unit *);
166 int en_fio(void);
167 int do_fio(ftnint *number, char *ptr, ftnlen len);
168 int fk_open(int rd,int seq,int fmt, ftnint n);
169 int s_rdue(cilist *a);
170 int s_wdue(cilist *a);
171 int c_due(cilist *a, int flag);
172 int e_rdue(void);
173 int e_wdue(void);
174 int z_getc(void);
175 int z_putc(int);
176 int s_rsfi(icilist *a);
177 int s_wsfi(icilist *a);
178 int e_rsfi(void);
179 int e_wsfi(void);
180 int f_inqu(inlist *a);
181 void g_char(char *a, ftnlen alen, char *b);
182 void b_char(char *a, char *b, ftnlen blen);
183 int inode(char *a);
184 void setcilist(cilist *x, int u, char *fmt,int rec,int xerr,int end);
185 void setolist(olist *, int, char *, char *, char *, int, char *, int);
186 void stcllist(cllist *x, int xunit, char *stat, int cerr);
187 void setalist(alist *x, int xunit, int aerr);
188 int f_rew(alist *a);
189 int s_rsfe(cilist *a);
190 int c_sfe(cilist *a, int flag);
191 int s_rsue(cilist *a);
192 int s_wsue(cilist *a);
193 int e_rsue(void);
194 int e_wsue(void);
195 int do_uio(ftnint *number, char *ptr, ftnlen len);
196 int s_wsfe(cilist *a);
197 void pr_put(int);
198 int e_rsfe(void);
199 int e_wsfe(void);
200 int c_le(cilist *a, int flag);
201 int e_wsle(void);
202 int s_wsle(cilist *a);
203 int wrt_L(ftnint *n, int len);
204 int s_rsle(cilist *a);
205 int e_rsle(void);
206 int f_open(olist *a);
207 int f_clos(cllist *a);
208 void f_exit(void);
209 void flush_(void);
210 int fullpath(char *a,char *b, int errflag);
211 int f_end(alist *);
212 char *icvt(long value,int *ndigit,int *sign);