-I$(top_srcdir) \
-I$(top_srcdir)/lib/cdt
-pkginclude_HEADERS = cgraph.h
+pkginclude_HEADERS = cgraph.h strcasecmp.h
noinst_HEADERS = agxbuf.h cghdr.h
noinst_LTLIBRARIES = libcgraph_C.la
lib_LTLIBRARIES = libcgraph.la
<ClInclude Include="agxbuf.h" />
<ClInclude Include="cghdr.h" />
<ClInclude Include="cgraph.h" />
+ <ClInclude Include="strcasecmp.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="agerror.c" />
<ClInclude Include="cgraph.h">
<Filter>Header Files</Filter>
</ClInclude>
+ <ClInclude Include="strcasecmp.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="agerror.c">
--- /dev/null
+/* platform abstraction for case-insensitive string functions */
+
+#pragma once
+
+#include <stddef.h>
+
+/* Re-prototype the functions we are abstracting. The purpose of this is to
+ * cause a compiler warning if our implementations diverge. Windows compilation
+ * will see these and the inline functions below, and warn if they do not match.
+ * Compilation on other platforms will see these and the strings.h prototypes,
+ * and warn if they do not match. This way we have a safeguard that the
+ * alternatives provided for Windows match the libc functions on other
+ * platforms.
+ */
+int strcasecmp(const char *s1, const char *s2);
+int strncasecmp(const char *s1, const char *s2, size_t n);
+
+#ifdef _MSC_VER
+ /* redirect these to the Windows alternatives */
+
+ #include <string.h>
+
+ static inline int strcasecmp(const char *s1, const char *s2) {
+ return _stricmp(s1, s2);
+ }
+
+ static inline int strncasecmp(const char *s1, const char *s2, size_t n) {
+ return _strnicmp(s1, s2, n);
+ }
+
+#else
+ /* other platforms define these in strings.h */
+ #include <strings.h>
+
+#endif