|
|
1.1 root 1: #define FIOBSIZE 4096
2:
3: typedef struct Fbuffer
4: {
5: unsigned char *next; /* next char to be used */
6: unsigned char *end; /* first invalid char */
7: unsigned char *lnext; /* previous value of next */
8: unsigned short flags; /* see FIO_.* below */
9: short oflush; /* if >= 0 fd to flush on read */
10: long offset; /* seek of end */
11: unsigned char buf[FIOBSIZE];
12: } Fbuffer;
13: extern Fbuffer *Ffb[];
14:
15: #define FIORESET(f) ((f)->next=(f)->lnext=(f)->end=(f)->buf, (f)->flags&= ~FIO_MALLOCED, (f)->oflush= -1)
16: #define FIOSET(f, fd) if((f=Ffb[fd&=0x7f]) == 0){Finit(fd,(char *)0);f=Ffb[fd];}
17: /* FIOLINELEN is length of last input */
18: #define FIOLINELEN(fd) (((int)(Ffb[fd]->next - Ffb[fd]->lnext))-1)
19: /* FIOSEEK is lseek of next char to be processed */
20: #define FIOSEEK(fd) (Ffb[fd]->offset - (Ffb[fd]->end - Ffb[fd]->next))
21: #define FIOFLUSH(fd) if((fd >= 0) && Ffb[fd]) Fflush(fd)
22:
23: #define FIO_RDLAST 0x0001 /* true if last input was rdline */
24: #define FIO_WRITING 0x0002 /* true if last action was write */
25: #define FIO_MALLOCED 0x0004 /* set if Finit did the malloc */
26:
27: extern void Finit();
28: extern char *Frdline();
29: extern void Fundo();
30: extern int Fgetc();
31: extern long Fread();
32: extern long Fwrite();
33: extern long Fseek();
34: extern int Fflush();
35:
36: #ifdef FIO_IMP
37: /* COUNT is the type of counts to things like read, write, memcpy etc */
38: #ifdef GNOT
39: #define COUNT long
40: #define FIOMALLOC(n) malloc(n)
41: #define SEEK(a,b,c) seek(a,b,c)
42: #else
43: #define COUNT int
44: #define FIOMALLOC(n) malloc(n)
45: #define SEEK(a,b,c) lseek(a,b,c)
46: #endif
47: extern COUNT read(), write();
48: #endif
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.