git://scm.lunaixsky.com
/
lunaix-os.git
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
04c85c9784db0f4ccbab8e8d6c27c19a8c4bd1b7
[lunaix-os.git]
/
lunaix-os
/
libs
/
klibc
/
string
/
strcpy.c
1
#include <klibc/string.h>
2
#include <lunaix/compiler.h>
3
4
char* weak
5
strcpy(char* dest, const char* src)
6
{
7
char c;
8
unsigned int i = 0;
9
while ((c = src[i])) {
10
dest[i] = c;
11
i++;
12
}
13
dest[i++] = '\0';
14
return &dest[i];
15
}
16
17
char* weak
18
strncpy(char* dest, const char* src, unsigned long n)
19
{
20
char c;
21
unsigned int i = 0;
22
while ((c = src[i]) && i <= n)
23
dest[i++] = c;
24
while (i <= n)
25
dest[i++] = 0;
26
return dest;
27
}