diff dmd/root/gnuc.c @ 1194:1853dcd9b944

Moved some DMDFE files into a seperate dmd/root subdir to closer match the DMD file structure since 1.041.
author Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
date Fri, 03 Apr 2009 17:02:52 +0200
parents dmd/gnuc.c@c53b6e3fe49a
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dmd/root/gnuc.c	Fri Apr 03 17:02:52 2009 +0200
@@ -0,0 +1,55 @@
+
+// Put functions in here missing from gnu C
+
+#include "gnuc.h"
+
+int memicmp(const char *s1, const char *s2, int n)
+{
+    int result = 0;
+
+    for (int i = 0; i < n; i++)
+    {	char c1 = s1[i];
+	char c2 = s2[i];
+
+	result = c1 - c2;
+	if (result)
+	{
+	    if ('A' <= c1 && c1 <= 'Z')
+		c1 += 'a' - 'A';
+	    if ('A' <= c2 && c2 <= 'Z')
+		c2 += 'a' - 'A';
+	    result = c1 - c2;
+	    if (result)
+		break;
+	}
+    }
+    return result;
+}
+
+int stricmp(const char *s1, const char *s2)
+{
+    int result = 0;
+
+    for (;;)
+    {	char c1 = *s1;
+	char c2 = *s2;
+
+	result = c1 - c2;
+	if (result)
+	{
+	    if ('A' <= c1 && c1 <= 'Z')
+		c1 += 'a' - 'A';
+	    if ('A' <= c2 && c2 <= 'Z')
+		c2 += 'a' - 'A';
+	    result = c1 - c2;
+	    if (result)
+		break;
+	}
+	if (!c1)
+	    break;
+	s1++;
+	s2++;
+    }
+    return result;
+}
+