From 7e2f8eec5cd6e34690e39a53119e0effb724b98c Mon Sep 17 00:00:00 2001 From: Jakob Kaivo Date: Sat, 15 Aug 2020 20:53:04 -0400 Subject: update __FILE to reflect actually implemented buffering --- src/stdio/_stdio.h | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) (limited to 'src/stdio') diff --git a/src/stdio/_stdio.h b/src/stdio/_stdio.h index 5ec8b884..ba7dc82f 100644 --- a/src/stdio/_stdio.h +++ b/src/stdio/_stdio.h @@ -15,13 +15,21 @@ #include "L_ctermid.c" #endif +#define f_is_open(s) (s && (s->bmode != 0)) + +struct __fpos_t { + size_t off; +}; + struct __FILE { fpos_t pos; - char *buf; - char ibuf[BUFSIZ]; - enum { INTERNAL, SUPPLIED, ALLOCED, UNSET } buftype; - int buffering; - int bsize; + + char *buf; /* pointer to in-use buffer */ + char ibuf[BUFSIZ]; /* statically allocated buffer */ + size_t bsize; /* how big is the buffer */ + size_t bpos; /* current position of next character */ + int bmode; /* _IONBF, _IOLBF, _IOFBF */ + int isopen; int flags; int lastop; @@ -37,12 +45,6 @@ struct __FILE { pid_t pipe_pid; - struct { - char *buf; - size_t size; - int allocated; - } mem; - struct __FILE *prev; struct __FILE *next; }; -- cgit v1.2.1