SpiderScript! (with a sample script)
[tpg/acess2.git] / Usermode / Libraries / libc.so_src / string.c
index e85356d..4e8dfe2 100644 (file)
@@ -19,6 +19,19 @@ EXPORT int strcmp(const char *s1, const char *s2)
        return (int)*s1 - (int)*s2;
 }
 
+/**
+ * \fn EXPORT int strncmp(const char *s1, const char *s2)
+ * \brief Compare two strings
+ */
+EXPORT int strncmp(const char *s1, const char *s2, size_t n)
+{
+       if( n == 0 )    return 0;
+       while(n -- && *s1 == *s2 && *s1 != '\0' && *s2 != '\0') {
+               s1++; s2++;
+       }
+       return (int)*s1 - (int)*s2;
+}
+
 /**
  * \fn EXPORT char *strcpy(char *dst, const char *src)
  * \brief Copy a string to another

UCC git Repository :: git.ucc.asn.au