]> git.lizzy.rs Git - plan9front.git/blob - sys/src/libstdio/iolib.h
Import sources from 2011-03-30 iso image
[plan9front.git] / sys / src / libstdio / iolib.h
1 /*
2  * pANS stdio -- definitions
3  * The following names are defined in the pANS:
4  *      FILE            fpos_t          _IOFBF          _IOLBF          _IONBF
5  *      BUFSIZ          EOF             FOPEN_MAX       FILENAME_MAX    L_tmpnam
6  *      SEEK_CUR        SEEK_END        SEEK_SET        TMP_MAX         stderr
7  *      stdin           stdout          remove          rename          tmpfile
8  *      tmpnam          fclose          fflush          fopen           freopen
9  *      setbuf          setvbuf         fprintf         fscanf          printf
10  *      scanf           sprintf         sscanf          vfprintf        vprintf
11  *      vsprintf        fgetc           fgets           fputc           fputs
12  *      getc            getchar         gets            putc            putchar
13  *      puts            ungetc          fread           fwrite          fgetpos
14  *      fseek           fsetpos         ftell           rewind          clearerr
15  *      feof            ferror          perror  
16  *
17  * (But plan9 version omits remove and rename, because they are in libc)
18  */
19 #include <u.h>
20 #include <libc.h>
21 #undef END
22 #include "Stdio.h"
23 /*
24  * Flag bits
25  */
26 #define BALLOC  1       /* did stdio malloc fd->buf? */
27 #define LINEBUF 2       /* is stream line buffered? */
28 #define STRING  4       /* output to string, instead of file */
29 #define APPEND  8       /* append mode output */
30 /*
31  * States
32  */
33 #define CLOSED  0       /* file not open */
34 #define OPEN    1       /* file open, but no I/O buffer allocated yet */
35 #define RDWR    2       /* open, buffer allocated, ok to read or write */
36 #define RD      3       /* open, buffer allocated, ok to read but not write */
37 #define WR      4       /* open, buffer allocated, ok to write but not read */
38 #define ERR     5       /* open, but an uncleared error occurred */
39 #define END     6       /* open, but at eof */
40
41 int _IO_setvbuf(FILE *);
42
43 /* half hearted attempt to make multi threaded */
44 extern QLock _stdiolk;