chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
history
|
raw
|
HEAD
[PATCH] Writing udev rules docs update
[elogind.git]
/
klibc
/
klibc
/
strncpy.c
1
/*
2
* strncpy.c
3
*/
4
5
#include <string.h>
6
7
char *strncpy(char *dst, const char *src, size_t n)
8
{
9
char *q = dst;
10
const char *p = src;
11
char ch;
12
13
while (n) {
14
n--;
15
*q++ = ch = *p++;
16
if ( !ch )
17
break;
18
}
19
20
/* The specs say strncpy() fills the entire buffer with NUL. Sigh. */
21
memset(q, 0, n);
22
23
return dst;
24
}