diff options
| author | Jakob Kaivo <jkk@ung.org> | 2019-02-23 15:22:33 -0500 |
|---|---|---|
| committer | Jakob Kaivo <jkk@ung.org> | 2019-02-23 15:22:33 -0500 |
| commit | 1221e834f49adb91eb0b7443a57274f2611459c2 (patch) | |
| tree | 7afb7ed5a203ddefd5559005af7ec61d801b972e /src/stdio | |
| parent | f546f27d1fdb8d2663b2fbb130f53ee32cac90b0 (diff) | |
compile in current environment
Diffstat (limited to 'src/stdio')
| -rw-r--r-- | src/stdio/fclose.c | 3 | ||||
| -rw-r--r-- | src/stdio/fileno.c | 2 | ||||
| -rw-r--r-- | src/stdio/fputc.c | 3 | ||||
| -rw-r--r-- | src/stdio/freopen.c | 3 | ||||
| -rw-r--r-- | src/stdio/pclose.c | 4 | ||||
| -rw-r--r-- | src/stdio/popen.c | 13 |
6 files changed, 18 insertions, 10 deletions
diff --git a/src/stdio/fclose.c b/src/stdio/fclose.c index e8cd037e..f07cf55e 100644 --- a/src/stdio/fclose.c +++ b/src/stdio/fclose.c @@ -2,7 +2,8 @@ #include "stdlib.h" #include "nonstd/io.h" -#ifdef _POSIX_SOURCE +#if defined _POSIX_SOURCE || defined _POSIX_C_SOURCE || defined _XOPEN_SOURCE +#include "sys/types.h" #include "unistd.h" #else #define close(fd) -1 diff --git a/src/stdio/fileno.c b/src/stdio/fileno.c index a3af0ec2..56ba86aa 100644 --- a/src/stdio/fileno.c +++ b/src/stdio/fileno.c @@ -1,5 +1,5 @@ #include <stdio.h> -#include "nonstd/FILE.h" +#include "nonstd/io.h" #include "nonstd/assert.h" int fileno(FILE * stream) diff --git a/src/stdio/fputc.c b/src/stdio/fputc.c index eb249b77..7b80f0ef 100644 --- a/src/stdio/fputc.c +++ b/src/stdio/fputc.c @@ -1,7 +1,8 @@ #include <stdio.h> #include "nonstd/io.h" -#ifdef _POSIX_SOURCE +#if defined _POSIX_SOURCE || defined _POSIX_C_SOURCE || defined _XOPEN_SOURCE +#include "sys/types.h" #include "unistd.h" #else #define write(fd, buf, size) -1 diff --git a/src/stdio/freopen.c b/src/stdio/freopen.c index cddf296a..69732a48 100644 --- a/src/stdio/freopen.c +++ b/src/stdio/freopen.c @@ -2,7 +2,8 @@ #include "errno.h" #include "nonstd/io.h" -#ifdef _POSIX_SOURCE +#if defined _POSIX_SOURCE || defined _POSIX_C_SOURCE || defined _XOPEN_SOURCE +#include "sys/types.h" #include "fcntl.h" #else #define open(fname, flags, mode) (filename ? -1 : -1) diff --git a/src/stdio/pclose.c b/src/stdio/pclose.c index 7a70bf9f..aff03b73 100644 --- a/src/stdio/pclose.c +++ b/src/stdio/pclose.c @@ -1,5 +1,7 @@ #include <stdio.h> +#include "sys/types.h" #include "sys/wait.h" +#include "nonstd/io.h" int pclose(FILE * stream) { @@ -11,7 +13,7 @@ int pclose(FILE * stream) fclose(stream); - waitpid(pid, &status, 0); + waitpid(child, &status, 0); return status; } diff --git a/src/stdio/popen.c b/src/stdio/popen.c index cd1a6572..56fce132 100644 --- a/src/stdio/popen.c +++ b/src/stdio/popen.c @@ -1,14 +1,17 @@ #include <stdio.h> #include "string.h" #include "errno.h" + +#include "sys/types.h" #include "unistd.h" -#include "wchar.h" -#include "__nonstd.h" + +#include "nonstd/assert.h" +#include "nonstd/io.h" FILE * popen(const char * command, const char * mode) { - __ASSERT_NONNULL(command); - __ASSERT_NONNULL(mode); + ASSERT_NONNULL(command); + ASSERT_NONNULL(mode); int direction = 0; if (!strcmp(mode, "w")) { @@ -52,7 +55,7 @@ FILE * popen(const char * command, const char * mode) } fwide(p, -1); - p->pipe_pid = pid; + p->pipe_pid = child; return p; } |
