66 lines
1.3 KiB
C
66 lines
1.3 KiB
C
#include "stdio.h"
|
|
#ifndef NULL
|
|
/* ANSI C */
|
|
#include "stddef.h"
|
|
#endif
|
|
|
|
#ifndef SEEK_SET
|
|
#define SEEK_SET 0
|
|
#define SEEK_CUR 1
|
|
#define SEEK_END 2
|
|
#endif
|
|
|
|
#ifdef MSDOS
|
|
#ifndef NON_UNIX_STDIO
|
|
#define NON_UNIX_STDIO
|
|
#endif
|
|
#endif
|
|
|
|
/*units*/
|
|
typedef struct
|
|
{ FILE *ufd; /*0=unconnected*/
|
|
char *ufnm;
|
|
#ifndef MSDOS
|
|
long uinode;
|
|
int udev;
|
|
#endif
|
|
int url; /*0=sequential*/
|
|
flag useek; /*true=can backspace, use dir, ...*/
|
|
flag ufmt;
|
|
flag uprnt;
|
|
flag ublnk;
|
|
flag uend;
|
|
flag uwrt; /*last io was write*/
|
|
flag uscrtch;
|
|
} unit;
|
|
|
|
extern int errno;
|
|
extern flag init;
|
|
extern cilist *elist; /*active external io list*/
|
|
extern flag reading,external,sequential,formatted;
|
|
extern int (*getn)(),(*putn)(); /*for formatted io*/
|
|
extern long inode();
|
|
extern FILE *cf; /*current file*/
|
|
extern unit *curunit; /*current unit*/
|
|
extern unit units[];
|
|
extern VOID sig_die();
|
|
#define err(f,m,s) {if(f) errno= m; else fatal(m,s); return(m);}
|
|
|
|
/*Table sizes*/
|
|
#define MXUNIT 100
|
|
|
|
extern int recpos; /*position in current record*/
|
|
extern int cursor; /* offset to move to */
|
|
extern int hiwater; /* so TL doesn't confuse us */
|
|
|
|
#define WRITE 1
|
|
#define READ 2
|
|
#define SEQ 3
|
|
#define DIR 4
|
|
#define FMT 5
|
|
#define UNF 6
|
|
#define EXT 7
|
|
#define INT 8
|
|
|
|
#define buf_end(x) (x->_flag & _IONBF ? x->_ptr : x->_base + BUFSIZ)
|