summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJakob Kaivo <jkk@ung.org>2020-08-15 21:21:51 -0400
committerJakob Kaivo <jkk@ung.org>2020-08-15 21:21:51 -0400
commitbdc07807f4debcd6155c628a8cdbf25f2e8402f7 (patch)
tree3c47dcf88446140216a92e0cd75dc79419da49f1 /src
parentf6467297867b5b5e3cc6bc20ffbe0a3367fd5994 (diff)
let freopen() handle buffering for stdin and stdout
Diffstat (limited to 'src')
-rw-r--r--src/__main.c21
1 files changed, 3 insertions, 18 deletions
diff --git a/src/__main.c b/src/__main.c
index 675a4b46..0e7483b9 100644
--- a/src/__main.c
+++ b/src/__main.c
@@ -6,17 +6,8 @@
#ifdef _POSIX_SOURCE
#define DEFAULT_LOCALE "POSIX"
-#include "unistd.h"
#else
#define DEFAULT_LOCALE "C"
-#include "_syscall.h"
-#include "termios/NCCS.c"
-#include "termios/speed_t.c"
-#include "termios/cc_t.c"
-#include "termios/tcflag_t.c"
-#include "termios/struct_termios.c"
-#include "termios/_termios.h"
-#define isatty(fd) ioctl(fd, TCFLSH, 0)
#endif
void __main(int argc, char **argv)
@@ -34,25 +25,19 @@ void __main(int argc, char **argv)
stdin = __stdio.FILES + 0;
stdin->fd = 0;
freopen(NULL, "r", stdin);
- setvbuf(stdin, NULL, isatty(0) ? _IOLBF : _IOFBF, BUFSIZ);
stdout = __stdio.FILES + 1;
stdout->fd = 1;
freopen(NULL, "w", stdout);
- setvbuf(stdin, NULL, isatty(1) ? _IOLBF : _IOFBF, BUFSIZ);
stderr = __stdio.FILES + 2;
stderr->fd = 2;
freopen(NULL, "w", stderr);
setvbuf(stderr, NULL, _IONBF, 0);
- stdin->next = stdout;
- stdout->next = stderr;
-
- stdout->prev = stdin;
- stderr->prev = stdout;
-
- setlocale(LC_ALL, DEFAULT_LOCALE);
+ /* setlocale(LC_ALL, DEFAULT_LOCALE); */
exit(main(argc, argv));
}
+
+void __stack_chk_fail(void) {}