From f5e48e94a2f4d4bbd6e5628c7f2afafc6dbcc459 Mon Sep 17 00:00:00 2001 From: Ian Moffett Date: Thu, 7 Mar 2024 17:28:52 -0500 Subject: build: Build mlibc + add distclean target Signed-off-by: Ian Moffett --- lib/mlibc/tests/ansi/freopen.c | 49 ------------------------------------------ 1 file changed, 49 deletions(-) delete mode 100644 lib/mlibc/tests/ansi/freopen.c (limited to 'lib/mlibc/tests/ansi/freopen.c') diff --git a/lib/mlibc/tests/ansi/freopen.c b/lib/mlibc/tests/ansi/freopen.c deleted file mode 100644 index c91577f..0000000 --- a/lib/mlibc/tests/ansi/freopen.c +++ /dev/null @@ -1,49 +0,0 @@ -#include -#include -#include - -#ifdef USE_HOST_LIBC -#define TEST_FILE "freopen-host-libc.tmp" -#else -#define TEST_FILE "freopen.tmp" -#endif - -int main() { - FILE *file = fopen(TEST_FILE, "w"); - assert(file); - - assert(freopen("/dev/null", "w", file)); - - char str[] = "mlibc freopen test"; - fwrite(str, 1, sizeof(str) - 1, file); - fflush(file); - fclose(file); - - file = fopen(TEST_FILE, "r"); - assert(file); - - char buf[sizeof(str)]; - memset(buf, 0, sizeof(buf)); - int ret = fread(buf, 1, sizeof(buf) - 1, file); - fprintf(stderr, "ret %d\n", ret); - assert(ret == 0); - fclose(file); - - file = fopen("/dev/null", "w"); - assert(file); - - assert(freopen(TEST_FILE, "w", file)); - fwrite(str, 1, sizeof(str) - 1, file); - fflush(file); - fclose(file); - - memset(buf, 0, sizeof(buf)); - file = fopen(TEST_FILE, "r"); - assert(fread(buf, 1, sizeof(buf) - 1, file)); - - fprintf(stderr, "buffer content '%s'\n", buf); - assert(!strcmp(buf, "mlibc freopen test")); - fclose(file); - - return 0; -} -- cgit v1.2.3