|
|
1.1 root 1: /***************************************************************************
2: * This program is Copyright (C) 1986, 1987, 1988 by Jonathan Payne. JOVE *
3: * is provided to you without charge, and with no warranty. You may give *
4: * away copies of JOVE, including sources, provided that this notice is *
5: * included in all the files. *
6: ***************************************************************************/
7:
8: extern void jputchar proto((int c)); /* hidden by macro */
9:
10: #define jputchar(c) jputc((c), stdout)
11: #define jputc(c, fp) (--(fp)->f_cnt >= 0 ? (*(fp)->f_ptr++ = (c)) : _flush((c), fp))
12: #define jgetc(fp) (((--(fp)->f_cnt < 0) ? filbuf(fp) : *(fp)->f_ptr++))
13: #define f_eof(fp) ((fp)->f_flags & F_EOF)
14:
15: typedef struct _file {
16: int f_cnt, /* number of characters left in buffer */
17: f_bufsize, /* size of what f_base points to */
18: f_fd, /* fildes */
19: f_flags; /* various flags */
20: char *f_ptr, /* current offset */
21: *f_base; /* pointer to base */
22: char *f_name; /* name of open file */
23: } File;
24:
25: #define F_READ 01
26: #define F_WRITE 02
27: #define F_APPEND 04
28: #define F_MODE(x) ((x)&07)
29: #define F_EOF 010
30: #define F_STRING 020
31: #define F_ERR 040
32: #define F_LOCKED 0100 /* don't close this file upon error */
33: #define F_MYBUF 0200 /* f_alloc allocated the buffer, so
34: f_close knows to free it up */
35: #define F_TELLALL 0400 /* whether to display info upon close */
36: #define F_READONLY 01000 /* file is read only */
37:
38: extern long io_chars;
39: extern int io_lines;
40:
41: extern File
42: *stdout;
43:
44: #ifdef VMUNIX
45: # define MAXTTYBUF 2048
46: #else
47: # define MAXTTYBUF 512
48: #endif
49:
50: extern int BufSize;
51:
52: extern File
53: *f_open proto((char *name,int flags,char *buffer,int buf_size)),
54: *fd_open proto((char *name,int flags,int fd,char *buffer,int bsize));
55:
56: extern int
57: f_getint proto((File *fp)),
58: f_gets proto((File *fp,char *buf,size_t max)),
59: filbuf proto((File *fp)),
60: _flush proto((int c,File *fp)),
61: f_readn proto((File *fp,char *addr,int n));
62:
63: extern void
64: f_close proto((File *fp)),
65: f_seek proto((File *fp, off_t offset)),
66: f_toNL proto((File *fp)),
67: flush proto((File *fp)),
68: flusho proto((void)),
69: fputnchar proto((char *s,int n,File *fp)),
70: gc_openfiles proto((void)),
71: putstr proto((char *s));
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.