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/fopen.c | 59 -------------------------------------------- 1 file changed, 59 deletions(-) delete mode 100644 lib/mlibc/tests/ansi/fopen.c (limited to 'lib/mlibc/tests/ansi/fopen.c') diff --git a/lib/mlibc/tests/ansi/fopen.c b/lib/mlibc/tests/ansi/fopen.c deleted file mode 100644 index f4818b2..0000000 --- a/lib/mlibc/tests/ansi/fopen.c +++ /dev/null @@ -1,59 +0,0 @@ -#include -#include -#include - -#ifdef USE_HOST_LIBC -#define TEST_FILE "fopen-host-libc.tmp" -#else -#define TEST_FILE "fopen.tmp" -#endif - -int main() { - FILE *file; - char str[] = "mlibc fopen test"; - char str2[] = " mlibc appending"; - char completestr[] = "mlibc fopen test mlibc appending"; - char buffer[100]; - char buffer2[100]; - - // Clear all the buffers to zero. - memset(buffer, 0, sizeof(buffer)); - memset(buffer2, 0, sizeof(buffer2)); - - // Open the file for writing. - file = fopen(TEST_FILE, "w"); - assert(file); - - // Write string minus null terminator, flush and close. - fwrite(str, 1, sizeof(str) - 1, file); - fflush(file); - fclose(file); - - // Open the file for reading. - file = fopen(TEST_FILE, "r"); - assert(file); - - // Verify that we read back the written string and close the file. - assert(fread(buffer, 1, sizeof(str) - 1, file)); - assert(!strcmp(buffer, str)); - fclose(file); - - // Open the file in appending mode, append string 2 (minus the null terminator) to the file, flush and close. - file = fopen(TEST_FILE, "a"); - fwrite(str2, 1, sizeof(str2) - 1, file); - fflush(file); - fclose(file); - - // Open the file for reading again, verify the contents, close the file and return. - file = fopen(TEST_FILE, "r"); - assert(fread(buffer2, 1, sizeof(completestr) - 1, file)); - assert(!strcmp(buffer2, completestr)); - fclose(file); - - // Check that stdout, stdin and stderr can be closed by the application (issue #12). - fclose(stdout); - fclose(stdin); - fclose(stderr); - - return 0; -} -- cgit v1.2.3