readchar fix
[vde.git] / vde-2 / utils / strndup.c
blobe810ec2748f878f6c603780d4864194294424b4f
2 #include <stdlib.h>
3 #include <string.h>
5 char *strndup(const char *s, size_t n)
7 char *r = malloc(n+1);
8 if(r){
9 strncpy(r, s, n);
10 r[n] = 0;
12 return r;