blob: 365381b9552cf7c63d84e5204f07455bfd4ff622 (
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
37
38
39
40
41
42
43
44
45
46
47
48
49
|
#include <stddef.h>
#include <stdbool.h>
bool isdigit(char c)
{
return c >= 48 && c <= 57;
}
size_t strlen(const char *s)
{
size_t c = 0;
while (s[c])
c++;
return c;
}
size_t strnlen(const char *s, size_t maxlen)
{
size_t c = 0;
while (c <= maxlen && s[c])
c++;
return c;
}
char *strcpy(char *restrict dst, const char *restrict src)
{
size_t pos = 0;
size_t len = strlen(src) + 1;
for(pos = 0; pos <= len; pos++)
dst[pos] = src[pos];
return dst;
}
void *memset(void *s, int c, size_t n) {
char *cur = (char*) s;
int i;
for (i = 0; i < n; i++)
cur[i] = (unsigned char)c;
return s;
}
|