1 /*--------------------------------------------------*
2  | io.h                                             |
3  | Header file for io.c, part of the Awka           |
4  | Library, Copyright 1999, Andrew Sumner.          |
5  | This file is covered by the GNU General Public   |
6  | License (GPL).                                   |
7  *--------------------------------------------------*/
8 
9 #ifndef _IO_H
10 #define _IO_H
11 
12 #define A_BUFSIZ 16384
13 
14 #define _a_IO_CLOSED 0
15 #define _a_IO_READ   1
16 #define _a_IO_WRITE  2
17 #define _a_IO_APPEND 4
18 #define _a_IO_EOF    8
19 
20 typedef struct {
21   char *name;       /* name of output file or device */
22   FILE *fp;         /* file pointer */
23   char *buf;        /* input buffer */
24   char *current;    /* where up to in buffer */
25   char *end;        /* end of data in buffer */
26   int alloc;        /* size of input buffer */
27   char io;          /* input or output stream flag */
28   char pipe;        /* true/false */
29   char lastmode;    /* for |& this records whether stream was last read from
30                        or written to */
31   char interactive; /* whether from a /dev/xxx stream or not */
32 } _a_IOSTREAM;
33 
34 #ifndef _IO_C
35 extern _a_IOSTREAM *_a_iostream;
36 extern int _a_ioallc, _a_ioused;
37 #endif
38 
39 int _awka_io_addstream( char *name, char flag, int pipe );
40 int awka_io_readline( a_VAR *var, int, int );
41 void awka_exit(double);
42 void awka_cleanup();
43 int _awka_wait_pid(int);
44 
45 #endif
46