2 Copyright © 2008-2014, The AROS Development Team. All rights reserved.
10 char *remove_path(const char *in
)
12 char *p
= (char *)&in
[strlen(in
)-1];
14 while (p
> in
&& p
[-1] != '/' && p
[-1] != ':') p
--;
18 int32_t strlen(const char *c
)
29 return (c
== ' ' || c
== '\t');
34 return (c
== ' ' || c
== '\t' || c
== '\f' || c
== '\n' || c
== '\r' || c
== '\v');
39 return (c
>= '0' && c
<= '9');
44 return isdigit(c
) || (c
>= 'A' && c
<= 'F') || (c
>= 'a' && c
<= 'f');
49 if (c
>= 'A' && c
<= 'Z')
55 int strncasecmp(const char *s1
, const char *s2
, int max
)
58 for (; max
&& !(diff
= tolower(*s2
)-tolower(*s1
)) && *s1
; max
--, s1
++, s2
++);
62 int strcasecmp(const char *s1
, const char *s2
)
65 for (; !(diff
= tolower(*s2
)-tolower(*s1
)) && *s1
; s1
++, s2
++);
69 int strncmp(const char *s1
, const char *s2
, int max
)
72 for (; max
&& !(diff
= *s2
-*s1
) && *s1
; max
--, s1
++, s2
++);
76 void bzero(void *dest
, int length
)
84 void memcpy(void *dest
, const void *src
, int length
)
94 void __itoa(char *buf
, intptr_t val
, char code
)
96 static const char convtbl
[] = "0123456789ABCDEF";
100 for (i
=0; i
< 8; i
++, val
<<= 4)
101 *buf
++ = convtbl
[(val
>> 28) & 0xf];
113 if (code
== 'd' && val
< 0)
124 *p
++ = convtbl
[ud
% divisor
];
125 } while(ud
/= divisor
);
144 void sprintf(char *dest
, char *str
, ...)
152 while ((c
= *str
++) != 0)
166 tmp
= va_arg(a
, int);
175 intptr_t val
= va_arg(a
, intptr_t);
180 p
= va_arg(a
, char *);
200 void printf(char *str
, ...)
208 while ((c
= *str
++) != 0)
211 ofw_write(stdout
, &c
, 1);
222 tmp
= va_arg(a
, int);
223 ofw_write(stdout
, &tmp
, 1);
231 intptr_t val
= va_arg(a
, intptr_t);
236 p
= va_arg(a
, char *);
240 ofw_write(stdout
, p
, strlen(p
));
244 ofw_write(stdout
, &c
, 1);
253 int atoi(const char *str
)
257 if ((str
[0] == '0') && (tolower(str
[1]) == 'x'))
261 while (*str
&& isxdigit(*str
))
263 char c
= tolower(*str
++);
273 while(*str
&& isdigit(*str
))