fixed more binutils issues (newer gcc/libc)
[zpugcc/jano.git] / toolchain / gcc / libf2c / libI77 / fio.h
blob7734f0c2f2f3a2aa4eb0c9873957715c5c7d9ae4
1 #include <sys/types.h>
2 #include <stdio.h>
3 #include <errno.h>
4 #ifndef NULL
5 /* ANSI C */
6 #include <stddef.h>
7 #endif
8 #ifdef STDC_HEADERS
9 #include <string.h>
10 #endif
12 #ifndef SEEK_SET
13 #define SEEK_SET 0
14 #define SEEK_CUR 1
15 #define SEEK_END 2
16 #endif
18 /* Only use fseeko/ftello if they are both there. */
20 #if defined (HAVE_FSEEKO) && defined (HAVE_FTELLO)
21 #define FSEEK fseeko
22 #define FTELL ftello
23 #else
24 #define FSEEK fseek
25 #define FTELL ftell
26 #endif
28 #if defined (MSDOS) && !defined (GO32)
29 #ifndef NON_UNIX_STDIO
30 #define NON_UNIX_STDIO
31 #endif
32 #endif
34 #ifdef UIOLEN_int
35 typedef int uiolen;
36 #else
37 typedef long uiolen;
38 #endif
40 /*units*/
41 typedef struct
43 FILE *ufd; /*0=unconnected */
44 char *ufnm;
45 #if !(defined (MSDOS) && !defined (GO32))
46 long uinode;
47 int udev;
48 #endif
49 int url; /*0=sequential */
50 flag useek; /*true=can backspace, use dir, ... */
51 flag ufmt;
52 flag urw; /* (1 for can read) | (2 for can write) */
53 flag ublnk;
54 flag uend;
55 flag uwrt; /*last io was write */
56 flag uscrtch;
58 unit;
60 extern int f__init;
61 extern cilist *f__elist; /*active external io list */
62 extern flag f__reading, f__external, f__sequential, f__formatted;
63 extern int (*f__getn) (void); /* for formatted input */
64 extern void (*f__putn) (int); /* for formatted output */
65 extern void x_putc (int);
66 extern long f__inode (char *, int *);
67 extern void sig_die (char *, int);
68 extern void f__fatal (int, char *);
69 extern int t_runc (alist *);
70 extern int f__nowreading (unit *), f__nowwriting (unit *);
71 extern int fk_open (int, int, ftnint);
72 extern int en_fio (void);
73 extern void f_init (void);
74 extern int (*f__donewrec) (void), t_putc (int), x_wSL (void);
75 extern void b_char (char *, char *, ftnlen), g_char (char *, ftnlen, char *);
76 extern int c_sfe (cilist *), z_rnew (void);
77 extern int isatty (int);
78 extern int err__fl (int, int, char *);
79 extern int xrd_SL (void);
80 extern int f__putbuf (int);
81 extern int (*f__doend) (void);
82 extern FILE *f__cf; /*current file */
83 extern unit *f__curunit; /*current unit */
84 extern unit f__units[];
85 #define err(f,m,s) do {if(f) {f__init &= ~2; errno= m;} else f__fatal(m,s); return(m);} while(0)
86 #define errfl(f,m,s) do {return err__fl((int)f,m,s);} while(0)
88 /*Table sizes*/
89 #define MXUNIT 100
91 extern int f__recpos; /*position in current record */
92 extern int f__cursor; /* offset to move to */
93 extern int f__hiwater; /* so TL doesn't confuse us */
95 #define WRITE 1
96 #define READ 2
97 #define SEQ 3
98 #define DIR 4
99 #define FMT 5
100 #define UNF 6
101 #define EXT 7
102 #define INT 8
104 #define buf_end(x) (x->_flag & _IONBF ? x->_ptr : x->_base + BUFSIZ)