]> arthur.barton.de Git - netatalk.git/commitdiff
Add missing strnlen implemantation
authorFrank Lahm <franklahm@googlemail.com>
Fri, 25 May 2012 10:17:13 +0000 (12:17 +0200)
committerFrank Lahm <franklahm@googlemail.com>
Fri, 25 May 2012 10:17:13 +0000 (12:17 +0200)
libatalk/compat/misc.c

index 0bd45a7318c871ab34c442ebc8fdaf4cad6c9cc7..5811531520ddcf860da59a6d76dae346d0e8a191 100644 (file)
@@ -11,3 +11,17 @@ int dirfd(DIR *dir)
     return dir->d_fd;
 }
 #endif
+
+#ifndef HAVE_STRNLEN
+size_t strnlen(const char *s, size_t max)
+{
+    size_t len;
+  
+    for (len = 0; len < max; len++) {
+        if (s[len] == '\0') {
+            break;
+        }
+    }
+    return len;  
+}
+#endif