2 Copyright (C) 2006 The AROS Development Team. All rights reserved.
5 Desc: A very primitive clib replacements.
11 void *memset(void *ptr
, int c
, long len
)
14 long c32
= c
| (c
<< 8) | (c
<< 16) | (c
<< 24);
18 *(unsigned long *)ptr
= c32
;
24 *(unsigned short *)ptr
= c32
;
30 *(unsigned char *)ptr
= c32
;
35 void *bzero(void *ptr
, long len
)
37 return memset(ptr
, 0, len
);
40 void memcpy(void *dest
, const void *src
, long len
)
44 *(unsigned long *)dest
= *(unsigned long *)src
;
51 *(unsigned short *)dest
= *(unsigned short *)src
;
58 *(unsigned char *)dest
= *(unsigned char *)src
;
62 int strncmp(const char *s1
, const char*s2
, long length
)
67 while (length
-- && *s1
&& *s2
)
69 if (*s1
!= *s2
) return (*s1
-*s2
);
75 int strlen(const char *s
)
78 while(*s
++ != 0) len
++;
82 const char *remove_path(const char *in
)
84 const char *p
= &in
[strlen(in
)-1];
85 while (p
> in
&& p
[-1] != '/' && p
[-1] != ':') p
--;
89 char *strstr (const char * str
, const char * search
)
92 long len_s
= strlen(search
);
104 while ((--done
) && (*t
== *str
))
113 return ((char *)str
);