[hackers] [scc] [libc] Add definition of stdin, stderr and stdout to stdio.h || Roberto E. Vargas Caballero
commit 3cc5a49bf9108eb49ed5032e587221286ea11357
Author: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
AuthorDate: Sat Feb 18 21:15:46 2017 +0100
Commit: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
CommitDate: Sat Feb 18 21:18:11 2017 +0100
[libc] Add definition of stdin, stderr and stdout to stdio.h
diff --git a/libc/include/bits/amd64-sysv/arch/stdio.h b/libc/include/bits/amd64-sysv/arch/stdio.h
index 78ea716..e67bf3c 100644
--- a/libc/include/bits/amd64-sysv/arch/stdio.h
+++ b/libc/include/bits/amd64-sysv/arch/stdio.h
_AT_@ -15,5 +15,4 @@ typedef unsigned long size_t;
#define TMP_MAX 25
#define L_tmpnam 256
-typedef struct _FILE FILE;
typedef int fpos_t;
diff --git a/libc/include/bits/i386-sysv/arch/stdio.h b/libc/include/bits/i386-sysv/arch/stdio.h
index 3cb4b93..f411dc7 100644
--- a/libc/include/bits/i386-sysv/arch/stdio.h
+++ b/libc/include/bits/i386-sysv/arch/stdio.h
_AT_@ -15,5 +15,4 @@ typedef unsigned long size_t;
#define TMP_MAX 25
#define L_tmpnam 256
-typedef struct _FILE FILE;
typedef long fpos_t;
diff --git a/libc/include/bits/z80/arch/stdio.h b/libc/include/bits/z80/arch/stdio.h
index fa5cc26..5e8f477 100644
--- a/libc/include/bits/z80/arch/stdio.h
+++ b/libc/include/bits/z80/arch/stdio.h
_AT_@ -15,5 +15,4 @@ typedef unsigned size_t;
#define TMP_MAX 25
#define L_tmpnam 256
-typedef struct _FILE FILE;
typedef long fpos_t;
diff --git a/libc/include/stdio.h b/libc/include/stdio.h
index 8e59d0d..8eedf8b 100644
--- a/libc/include/stdio.h
+++ b/libc/include/stdio.h
_AT_@ -12,6 +12,24 @@
#define SEEK_END 1
#define SEEK_SET 2
+typedef struct {
+ int fd; /* file descriptor */
+ char flags; /* bits for must free buffer on close, line-buffered */
+ char state; /* last operation was read, write, position, error, eof */
+ char *buf; /* pointer to i/o buffer */
+ char *rp; /* read pointer (or write end-of-buffer) */
+ char *wp; /* write pointer (or read end-of-buffer) */
+ char *lp; /* actual write pointer used when line-buffering */
+ size_t len; /* actual length of buffer */
+ char unbuf[1]; /* tiny buffer for unbuffered io */
+} FILE;
+
+extern FILE _IO_stream[FOPEN_MAX];
+
+#define stderr (&_IO_stream[2])
+#define stdin (&_IO_stream[0])
+#define stdout (&_IO_stream[1])
+
extern int remove(const char *filename);
extern int rename(const char *old, const char *new);
extern FILE *tmpfile(void);
Received on Sat Feb 18 2017 - 21:18:19 CET
This archive was generated by hypermail 2.3.0
: Sat Feb 18 2017 - 21:24:19 CET