summaryrefslogtreecommitdiff
path: root/src/stdio
diff options
context:
space:
mode:
authorJakob Kaivo <jkk@ung.org>2024-01-30 18:35:35 -0500
committerJakob Kaivo <jkk@ung.org>2024-01-30 18:35:35 -0500
commitd5e1fa835e46dac2e1729e73c5e6743ef78714c7 (patch)
tree656a1c893b9930f444761c2811b1fc57fccd6802 /src/stdio
parent7cdd27f8dce39bed37a266fa578cfaedce0a015d (diff)
fix to compile under c89
Diffstat (limited to 'src/stdio')
-rw-r--r--src/stdio/__printf.c7
-rw-r--r--src/stdio/fflush.c2
-rw-r--r--src/stdio/freopen.c7
-rw-r--r--src/stdio/remove.c14
4 files changed, 17 insertions, 13 deletions
diff --git a/src/stdio/__printf.c b/src/stdio/__printf.c
index 0d950583..391f7cbc 100644
--- a/src/stdio/__printf.c
+++ b/src/stdio/__printf.c
@@ -1,15 +1,18 @@
+#if 0
//#include <sys/types.h>
+//#include <unistd.h>
+#endif
+
#include <stdio.h>
#include <stddef.h>
#include "wctype/wint_t.h"
#include "wctype/wctrans_t.h"
#include <wchar.h>
#include <inttypes.h>
-//#include <unistd.h>
#include <stdlib.h>
#include "_stdio.h"
-#if !defined __STDC_VERSION__ || __STDC_VERSION__ < 199909L
+#if (!defined __STDC_VERSION__) || (__STDC_VERSION__ < 199909L)
#include "stdint/intmax_t.h"
#include "stdint/uintmax_t.h"
#include "stdint/intptr_t.h"
diff --git a/src/stdio/fflush.c b/src/stdio/fflush.c
index 23899e82..e13f8979 100644
--- a/src/stdio/fflush.c
+++ b/src/stdio/fflush.c
@@ -4,8 +4,6 @@
#endif
#include <stdio.h>
-//#include <sys/types.h>
-//#include <unistd.h>
#include "_stdio.h"
#ifdef POSIX_FORCED
diff --git a/src/stdio/freopen.c b/src/stdio/freopen.c
index b39fda4c..b40eb439 100644
--- a/src/stdio/freopen.c
+++ b/src/stdio/freopen.c
@@ -3,19 +3,16 @@
#define POSIX_FORCED
#endif
-//#include <sys/types.h>
#include <errno.h>
-//#include <fcntl.h>
#include <stdio.h>
#include <string.h>
-//#include <unistd.h>
#include "_stdio.h"
#ifdef POSIX_FORCED
-#include "termios/_termios.h"
#include "_syscall.h"
#define open(_p, _f, _m) __scall3(open, _p, _f, _m)
-#define isatty(_fd) ioctl(_fd, TCFLSH, 0)
+#define isatty(_fd) (-1) /*ioctl(_fd, TCFLSH, 0) */
+#define TCFLSH 0x540B
#define O_RDONLY 00
#define O_WRONLY 01
#define O_CREAT 0100
diff --git a/src/stdio/remove.c b/src/stdio/remove.c
index 2ac91743..8b6c5925 100644
--- a/src/stdio/remove.c
+++ b/src/stdio/remove.c
@@ -1,13 +1,16 @@
-#if 0
#ifndef _POSIX_SOURCE
#define _POSIX_SOURCE
#define POSIX_FORCED
#endif
#include <stdio.h>
+#include "_stdio.h"
+
+#if 0
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
+#endif
#ifdef POSIX_FORCED
#include "_syscall.h"
@@ -20,15 +23,20 @@
int remove(const char *filename)
{
- struct stat st;
+ /* struct stat st; */
SIGNAL_SAFE(0);
+ /*
stat(filename, &st);
if (S_ISDIR(st.st_mode)) {
return rmdir(filename);
}
return unlink(filename);
+ */
+
+ (void)filename;
+ return -1;
}
/***
@@ -40,5 +48,3 @@ open that file will fail unless creating a new file.
IMPLEMENTATION(Whether the file is removed if it is open)
STDC(1)
*/
-
-#endif