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 #include <stdio.h> 18 #include <stdlib.h> 19 #include <sys/types.h> 20 #include <unistd.h> 21 #include <fcntl.h> 22 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 char *strerror(int errno); 41 int _IO_setvbuf(FILE *); 42 FILE *_IO_sopenr(const char*); 43 FILE *_IO_sopenw(void); 44 char *_IO_sclose(FILE *); 45