summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJakob Kaivo <jkk@ung.org>2020-08-16 12:12:29 -0400
committerJakob Kaivo <jkk@ung.org>2020-08-16 12:12:29 -0400
commit8d4af013972f64dbabb7176706c18a94a63792f2 (patch)
treecc7017fd6c6576367a0d6ead91a013545d3d48ef /src
parent6b422ab2b2a6a31cb633116be8cf262e60d04885 (diff)
improve fallback if not building for POSIX (still requires POSIX headers)
Diffstat (limited to 'src')
-rw-r--r--src/stdio/freopen.c39
1 files changed, 13 insertions, 26 deletions
diff --git a/src/stdio/freopen.c b/src/stdio/freopen.c
index ad9e254e..516684b4 100644
--- a/src/stdio/freopen.c
+++ b/src/stdio/freopen.c
@@ -1,33 +1,20 @@
+#ifndef _POSIX_SOURCE
+#define _POSIX_SOURCE
+#define POSIX_FORCED
+#endif
+
#include <stdio.h>
-#include "string.h"
-#include "errno.h"
+#include <string.h>
+#include <errno.h>
+#include <sys/types.h>
+#include <fcntl.h>
+#include <unistd.h>
#include "_stdio.h"
-#if defined _POSIX_SOURCE
-#include "sys/types.h"
-#include "fcntl.h"
-#else
-#include "fcntl/O_RDONLY.c"
-#include "fcntl/O_WRONLY.c"
-#include "fcntl/O_CREAT.c"
-#include "fcntl/O_TRUNC.c"
-#include "fcntl/O_APPEND.c"
-#include "fcntl/O_RDWR.c"
-#define open(fname, flags, mode) __syscall(__syscall_lookup(open), fname, flags, mode)
-#endif
-
-#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"
+#ifdef POSIX_FORCED
#include "termios/_termios.h"
+#include "_syscall.h"
+#define open(fname, flags, mode) __scall3(open, fname, flags, mode)
#define isatty(fd) ioctl(fd, TCFLSH, 0)
#endif