summaryrefslogtreecommitdiff
path: root/kernel/libc/string/strncpy.c
blob: a8868951d91ea8d0d2a1bcee9b6c6a0d601101ce (plain)
1
2
3
4
5
6
7
8
9
10
11
#include <stddef.h>
#include <string.h>

// FIXME: Something is weird with this function
char *strncpy(char *dest, const char *src, size_t n) {
  char *r = dest;
  for (; n && (*dest = *src); n--, src++, dest++)
    ;
  *dest = '\0';
  return r;
}