-
Notifications
You must be signed in to change notification settings - Fork 34
Expand file tree
/
Copy path_lib.c
More file actions
62 lines (53 loc) · 684 Bytes
/
_lib.c
File metadata and controls
62 lines (53 loc) · 684 Bytes
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
50
51
52
53
54
55
56
57
58
59
60
61
62
#ifdef NEED_MEMSET
void *memset(void *dest, int c, size_t count)
{
char *bytes = (char *)dest;
while (count--)
{
*bytes++ = (char)c;
}
return dest;
}
#endif
#ifdef NEED_STRCHR
char *
strchr (s, c)
const char *s;
int c;
{
for (;;)
{
if (*s == c)
return (char *) s;
if (*s == 0)
return 0;
s++;
}
}
#endif
#ifdef NEED_STRPBRK
char *
strpbrk(const char *s1, const char *s2)
{
const char *p;
while (*s1)
{
for (p = s2; *p; p++)
if (*s1 == *p)
return (char *)s1;
s1++;
}
return 0;
}
#endif
#ifdef NEED_STRLEN
size_t
strlen (const char *s)
{
size_t i;
i = 0;
while (s[i] != 0)
i++;
return i;
}
#endif