forked from starnakin/IronGOLEM
add: strcat, strcpy, strncpy
This commit is contained in:
parent
4e65a7f1c0
commit
281087ca5c
18
src/strcat.🗿
Normal file
18
src/strcat.🗿
Normal file
@ -0,0 +1,18 @@
|
||||
strcat(dst, src)
|
||||
{
|
||||
local i;
|
||||
local j;
|
||||
i = 0;
|
||||
loop {
|
||||
if ([dst + i] == 0)
|
||||
break;
|
||||
i = i + 1;
|
||||
}
|
||||
j = 0;
|
||||
loop {
|
||||
if ([src + j] == 0)
|
||||
return (dst);
|
||||
[dst + i + j] = [src + j];
|
||||
j = j + 1;
|
||||
}
|
||||
}
|
11
src/strcpy.🗿
Normal file
11
src/strcpy.🗿
Normal file
@ -0,0 +1,11 @@
|
||||
strcpy(dst, src)
|
||||
{
|
||||
local i;
|
||||
i = 0;
|
||||
loop {
|
||||
if ([src + i] == 0)
|
||||
return (dst);
|
||||
[dst + i] = [src + i];
|
||||
i = i + 1;
|
||||
}
|
||||
}
|
11
src/strncpy.🗿
Normal file
11
src/strncpy.🗿
Normal file
@ -0,0 +1,11 @@
|
||||
strncpy(dst, src, size)
|
||||
{
|
||||
local i;
|
||||
i = 0;
|
||||
loop {
|
||||
if ([src + i] == 0 | i == size)
|
||||
return (dst);
|
||||
[dst + i] = [src + i];
|
||||
i = i + 1;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user