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 #ifndef _SUSV2_SOURCE 18 #define _SUSV2_SOURCE /* for *intptr_t types */ 19 #endif 20 21 #include <stdio.h> 22 #include <inttypes.h> 23 #include <stdlib.h> 24 #include <sys/types.h> 25 #include <unistd.h> 26 #include <fcntl.h> 27 28 /* 29 * Flag bits 30 */ 31 #define BALLOC 1 /* did stdio malloc fd->buf? */ 32 #define LINEBUF 2 /* is stream line buffered? */ 33 #define STRING 4 /* output to string, instead of file */ 34 #define APPEND 8 /* append mode output */ 35 /* 36 * States 37 */ 38 #define CLOSED 0 /* file not open */ 39 #define OPEN 1 /* file open, but no I/O buffer allocated yet */ 40 #define RDWR 2 /* open, buffer allocated, ok to read or write */ 41 #define RD 3 /* open, buffer allocated, ok to read but not write */ 42 #define WR 4 /* open, buffer allocated, ok to write but not read */ 43 #define ERR 5 /* open, but an uncleared error occurred */ 44 #define END 6 /* open, but at eof */ 45 char *strerror(int errno); 46 int _IO_setvbuf(FILE *); 47 FILE *_IO_sopenr(const char*); 48 FILE *_IO_sopenw(void); 49 char *_IO_sclose(FILE *); 50