blob: 0f01d1f43355b4b2c6d7fe9439a89d5052bdfe22 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
#include "PR/ultratypes.h"
#include "string.h"
// TODO: this comes from a header
#ident "$Revision: 1.23 $"
char* strchr(const char* s, int c) {
const char ch = c;
while (*s != ch) {
if (*s == 0) {
return NULL;
}
s++;
}
return (char*)s;
}
size_t strlen(const char* s) {
const char* sc = s;
while (*sc != 0) {
sc++;
}
return sc - s;
}
void* memcpy(void* s1, const void* s2, size_t n) {
char* su1 = (char*)s1;
const char* su2 = (const char*)s2;
while (n > 0) {
*su1 = *su2;
su1++;
su2++;
n--;
}
return (void*)s1;
}
|