summaryrefslogtreecommitdiff
path: root/src/stdio
diff options
context:
space:
mode:
authorJakob Kaivo <jkk@ung.org>2024-01-31 17:07:29 -0500
committerJakob Kaivo <jkk@ung.org>2024-01-31 17:07:29 -0500
commit40e2986d3d196855bba3836a60a482fd3a0f73a8 (patch)
tree6ce03ea7ddffb7f0001bff12706b21f9bce3c67e /src/stdio
parent421cc9cd7295e5b92cf167a41bd8f55a3b842728 (diff)
remove posix and xopen specific functions
Diffstat (limited to 'src/stdio')
-rw-r--r--src/stdio/fdopen.c13
-rw-r--r--src/stdio/fileno.c13
-rw-r--r--src/stdio/getw.c14
-rw-r--r--src/stdio/pclose.c24
-rw-r--r--src/stdio/popen.c71
-rw-r--r--src/stdio/putw.c14
-rw-r--r--src/stdio/tempnam.c12
7 files changed, 0 insertions, 161 deletions
diff --git a/src/stdio/fdopen.c b/src/stdio/fdopen.c
deleted file mode 100644
index 875d5b9a..00000000
--- a/src/stdio/fdopen.c
+++ /dev/null
@@ -1,13 +0,0 @@
-#include <stdio.h>
-#include "_stdio.h"
-
-FILE * fdopen(int fildes, const char * mode)
-{
- SIGNAL_SAFE(0);
- (void)fildes; (void)mode;
- return NULL;
-}
-
-/*
-POSIX(1)
-*/
diff --git a/src/stdio/fileno.c b/src/stdio/fileno.c
deleted file mode 100644
index 5432ecb0..00000000
--- a/src/stdio/fileno.c
+++ /dev/null
@@ -1,13 +0,0 @@
-#include <stdio.h>
-#include "_stdio.h"
-
-int fileno(FILE * stream)
-{
- SIGNAL_SAFE(0);
- ASSERT_NONNULL(stream);
- return stream->fd;
-}
-
-/*
-POSIX(1)
-*/
diff --git a/src/stdio/getw.c b/src/stdio/getw.c
deleted file mode 100644
index ad1b0bad..00000000
--- a/src/stdio/getw.c
+++ /dev/null
@@ -1,14 +0,0 @@
-#include <stdio.h>
-#include "_stdio.h"
-
-# define _XOPEN_LEGACY 500
-
-int getw(FILE *stream)
-{
- SIGNAL_SAFE(0);
- return 0;
-}
-
-/*
-XOPEN(4,600)
-*/
diff --git a/src/stdio/pclose.c b/src/stdio/pclose.c
deleted file mode 100644
index b39cfa15..00000000
--- a/src/stdio/pclose.c
+++ /dev/null
@@ -1,24 +0,0 @@
-#include <stdio.h>
-#include <sys/types.h>
-#include <sys/wait.h>
-#include "_stdio.h"
-
-int pclose(FILE * stream)
-{
- int status;
- pid_t child = stream->pipe_pid;
- SIGNAL_SAFE(0);
-
- if (child == 0) {
- /* undefined behavior */
- }
-
- fclose(stream);
-
- waitpid(child, &status, 0);
- return status;
-}
-
-/*
-POSIX(2)
-*/
diff --git a/src/stdio/popen.c b/src/stdio/popen.c
deleted file mode 100644
index 67b70f4d..00000000
--- a/src/stdio/popen.c
+++ /dev/null
@@ -1,71 +0,0 @@
-#include <stdio.h>
-#include <string.h>
-#include <errno.h>
-
-#include <sys/types.h>
-#include <unistd.h"
-
-#include "_stdio.h"
-
-#ifdef __STDC_VERSION__
-#include <wchar.h>
-#endif
-
-FILE * popen(const char * command, const char * mode)
-{
- SIGNAL_SAFE(0);
- ASSERT_NONNULL(command);
- ASSERT_NONNULL(mode);
-
- int direction = 0;
- if (!strcmp(mode, "w")) {
- direction = 1;
- } else if (strcmp(mode, "r")) {
- errno = EINVAL;
- return NULL;
- }
-
- int pd[2];
- if (pipe(pd) == -1) {
- return NULL;
- }
-
- pid_t child = fork();
- if (child == -1) {
- close(pd[0]);
- close(pd[1]);
- return NULL;
- } else if (child == 0) {
- if (direction == 1) {
- dup2(pd[0], STDIN_FILENO);
- } else {
- dup2(pd[1], STDOUT_FILENO);
- }
- close(pd[0]);
- close(pd[1]);
- execl("/bin/sh", "sh", "-c", command, (char *)0);
- return NULL;
- }
-
- FILE *p = NULL;
- if (direction == 1) {
- p = fdopen(pd[1], "w");
- } else {
- p = fdopen(pd[0], "r");
- }
-
- if (p == NULL) {
- return NULL;
- }
-
- #if defined __STDC_VERSION__
- fwide(p, -1);
- #endif
-
- p->pipe_pid = child;
- return p;
-}
-
-/*
-POSIX(2)
-*/
diff --git a/src/stdio/putw.c b/src/stdio/putw.c
deleted file mode 100644
index fb18c445..00000000
--- a/src/stdio/putw.c
+++ /dev/null
@@ -1,14 +0,0 @@
-#include <stdio.h>
-#include "_stdio.h"
-
-# define _XOPEN_LEGACY 500
-
-int putw(int w, FILE *stream)
-{
- SIGNAL_SAFE(0);
- (void)w; (void)stream;
-}
-
-/*
-XOPEN(4,600)
-*/
diff --git a/src/stdio/tempnam.c b/src/stdio/tempnam.c
deleted file mode 100644
index e40ec537..00000000
--- a/src/stdio/tempnam.c
+++ /dev/null
@@ -1,12 +0,0 @@
-#include <stdio.h>
-
-char * tempnam(const char * dir, const char * pfx)
-{
- SIGNAL_SAFE(0);
- (void)dir; (void)pfx;
- return NULL;
-}
-
-/*
-XOPEN(4)
-*/