summaryrefslogtreecommitdiff
path: root/riscv/riscv-probe/libfemto/std/strncpy.c
blob: ccb8fc37a062c37068c2e6e47b58f7387004e2af (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
// See LICENSE for license details.

#include <stddef.h>

char *strncpy(char *dst, const char *src, size_t n)
{
    size_t i;
    for (i = 0; i < n && src[i]; i++) {
        dst[i] = src[i];
    }
    for (; i < n; i++) {
        dst[i] = 0;
    }
    return dst;
}