diff options
| author | Jakob Kaivo <jkk@ung.org> | 2020-08-11 19:24:53 -0400 |
|---|---|---|
| committer | Jakob Kaivo <jkk@ung.org> | 2020-08-11 19:24:53 -0400 |
| commit | 5d9519b799ac6fb1e2d5bdb3daaf123c1326c0f1 (patch) | |
| tree | cb350f07817282ca6b2b34893451feb56f6a1c2e /src | |
| parent | 63857e44e4f34187109ade06dcfa2bdce63a5dee (diff) | |
rename __FILES to __stdio to catch all <stdio.h> internals
Diffstat (limited to 'src')
| -rw-r--r-- | src/nonstd/__libc_start.c | 8 | ||||
| -rw-r--r-- | src/stdio/__FILES.c | 2 | ||||
| -rw-r--r-- | src/stdio/__stdio.c | 2 | ||||
| -rw-r--r-- | src/stdio/_stdio.h | 9 |
4 files changed, 13 insertions, 8 deletions
diff --git a/src/nonstd/__libc_start.c b/src/nonstd/__libc_start.c index 924029d7..cd115068 100644 --- a/src/nonstd/__libc_start.c +++ b/src/nonstd/__libc_start.c @@ -21,17 +21,17 @@ void __libc_start(int argc, char **argv) { extern int main(int, char*[]); - stdin = __FILES + 0; + stdin = __stdio.FILES + 0; stdin->fd = 0; /* freopen(", "r", stdin); */ setvbuf(stdin, NULL, isatty(0) ? _IOLBF : _IOFBF, BUFSIZ); - stdout = __FILES + 1; + stdout = __stdio.FILES + 1; stdout->fd = 1; /* freopen(NULL, "w", stdout); */ setvbuf(stdin, NULL, isatty(1) ? _IOLBF : _IOFBF, BUFSIZ); - stderr = __FILES + 2; + stderr = __stdio.FILES + 2; stderr->fd = 2; /* freopen(NULL, "w", stderr); */ setvbuf(stderr, NULL, _IONBF, 0); @@ -42,7 +42,7 @@ void __libc_start(int argc, char **argv) stdout->prev = stdin; stderr->prev = stdout; - setlocale(LC_ALL, DEFAULT_LOCALE); + /* setlocale(LC_ALL, DEFAULT_LOCALE); */ exit(main(argc, argv)); } diff --git a/src/stdio/__FILES.c b/src/stdio/__FILES.c deleted file mode 100644 index f9bcdbba..00000000 --- a/src/stdio/__FILES.c +++ /dev/null @@ -1,2 +0,0 @@ -#include "_stdio.h" -struct __FILE __FILES[FOPEN_MAX]; diff --git a/src/stdio/__stdio.c b/src/stdio/__stdio.c new file mode 100644 index 00000000..d607bde6 --- /dev/null +++ b/src/stdio/__stdio.c @@ -0,0 +1,2 @@ +#include "_stdio.h" +struct __stdio __stdio; diff --git a/src/stdio/_stdio.h b/src/stdio/_stdio.h index 6cb0ab0c..79e7a28c 100644 --- a/src/stdio/_stdio.h +++ b/src/stdio/_stdio.h @@ -14,7 +14,8 @@ struct __FILE { fpos_t pos; char *buf; - enum { SUPPLIED, ALLOCED, UNSET } buftype; + char ibuf[BUFSIZ]; + enum { INTERNAL, SUPPLIED, ALLOCED, UNSET } buftype; int buffering; int bsize; int isopen; @@ -54,7 +55,11 @@ struct io_options { int __printf(struct io_options * restrict, const char * restrict, va_list); int __scanf(struct io_options * restrict, const char * restrict, va_list); -extern struct __FILE __FILES[FOPEN_MAX]; +struct __stdio { + struct __FILE FILES[FOPEN_MAX]; +}; + +extern struct __stdio __stdio; #if !defined _POSIX_C_SOURCE || _POSIX_C_SOURCE < 199506L #define flockfile(_file) (void)(_file) |
