Blame view

Modif/epsilon-master/liba/src/strlcpy.c 266 Bytes
6663b6c9   adorian   projet complet av...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
  #include <string.h>
  
  size_t strlcpy(char * dst, const char * src, size_t len) {
    if (len == 0) {
      return 0;
    }
    const char * cur = src;
    const char * end = src+len-1;
    while (*cur != 0 && cur < end) {
      *dst++ = *cur++;
    }
    *dst = 0;
    return cur-src;
  }