summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJakob Kaivo <jkk@ung.org>2020-08-15 20:53:04 -0400
committerJakob Kaivo <jkk@ung.org>2020-08-15 20:53:04 -0400
commit7e2f8eec5cd6e34690e39a53119e0effb724b98c (patch)
treef05ed21e5a02bea06ed8c7f9a1f3cddae305ae90 /src
parentc0b73d8cf2b022e479af74ac9c6068bd60a1a289 (diff)
update __FILE to reflect actually implemented buffering
Diffstat (limited to 'src')
-rw-r--r--src/stdio/_stdio.h24
1 files changed, 13 insertions, 11 deletions
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;
};