about summary refs log tree commit diff stats
path: root/dirent/tests/t-compile.c
diff options
context:
space:
mode:
authorRory Bradford <roryrjb@gmail.com>2022-11-19 11:11:26 +0000
committerRory Bradford <roryrjb@gmail.com>2022-11-19 11:18:40 +0000
commit0f92f7352d1964a9859868439e8ded2c4de2111e (patch)
tree14c690402fa28c3b465ec00d2fe767054a1a3331 /dirent/tests/t-compile.c
parentfbb7c479de91b197c6c501c2023bf564a6a7610f (diff)
downloadrf-0f92f7352d1964a9859868439e8ded2c4de2111e.tar.gz
Full native win32 support
This will now compile with MSVC using the make.bat batch file. It does
however bring in some additional third party dependencies: ports of
dirent and getopt (something I'd ideally like to work on in the future).

Signed-off-by: Rory Bradford <roryrjb@gmail.com>
Diffstat (limited to 'dirent/tests/t-compile.c')
-rw-r--r--dirent/tests/t-compile.c46
1 files changed, 46 insertions, 0 deletions
diff --git a/dirent/tests/t-compile.c b/dirent/tests/t-compile.c
new file mode 100644
index 0000000..90d8e50
--- /dev/null
+++ b/dirent/tests/t-compile.c
@@ -0,0 +1,46 @@
+/*
+ * Test program to make sure that dirent compiles cleanly with winsock.
+ *
+ * Copyright (C) 1998-2019 Toni Ronkko
+ * This file is part of dirent.  Dirent may be freely distributed
+ * under the MIT license.  For all details and documentation, see
+ * https://github.com/tronkko/dirent
+ */
+#include <dirent.h>
+#ifdef WIN32
+#	include <winsock2.h>
+#	include <ws2tcpip.h>
+#endif
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+int
+main(int argc, char *argv[])
+{
+	struct dirent *dirp = NULL;
+
+	(void) argc;
+	(void) argv;
+
+#ifdef _DIRENT_HAVE_D_TYPE
+	printf("Has d_type\n");
+#endif
+#ifdef _DIRENT_HAVE_D_NAMLEN
+	printf("Has d_namlen\n");
+#endif
+#ifdef _D_EXACT_NAMLEN
+	printf("Has _D_EXACT_NAMLEN\n");
+#endif
+#ifdef _D_ALLOC_NAMLEN
+	printf("Has _D_ALLOC_NAMLEN\n");
+#endif
+#ifdef _D_ALLOC_NAMLEN
+	printf("Has _D_ALLOC_NAMLEN\n");
+#endif
+	printf("Length of d_name with terminator: %d\n",
+		(int) sizeof(dirp->d_name));
+
+	printf("OK\n");
+	return EXIT_SUCCESS;
+}