summaryrefslogtreecommitdiff
path: root/userland/libc/string/strnlen.c
blob: 50f907e5c13e412661511a2f402caeabbb221615 (plain)
1
2
3
4
5
6
7
8
9
10
11
#include <string.h>

size_t strnlen(const char *s, size_t maxlen) {
  size_t i;
  for (i = 0; i < maxlen; i++) {
    if (s[i] == 0) {
      break;
    }
  }
  return i;
}