repo.or.cz
/
vde.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
readchar fix
[vde.git]
/
vde-2
/
utils
/
strndup.c
blob
e810ec2748f878f6c603780d4864194294424b4f
1
2
#include <stdlib.h>
3
#include <string.h>
4
5
char
*
strndup
(
const char
*
s
,
size_t
n
)
6
{
7
char
*
r
=
malloc
(
n
+
1
);
8
if
(
r
){
9
strncpy
(
r
,
s
,
n
);
10
r
[
n
] =
0
;
11
}
12
return
r
;
13
}
14