3 int int_strtoul(const char *str
, unsigned long *val
)
7 unsigned long ret
= strtoul(str
, &tmp
, 10);
8 if((str
== tmp
) || (*tmp
!= '\0'))
9 /* The value didn't parse cleanly */
18 unsigned long ret
= 0;
21 /* An empty string ... */
24 /* We have to multiply 'ret' by 10 before absorbing the next
25 * digit. If this will overflow, catch it now. */
26 if(ret
&& (((ULONG_MAX
+ 10) / ret
) < 10))
41 char *int_strstr(const char *haystack
, const char *needle
)
43 const char *sub_haystack
= haystack
, *sub_needle
= needle
;
44 unsigned int offset
= 0;
49 while((*sub_haystack
!= '\0') && (*sub_needle
!= '\0')) {
50 if(sub_haystack
[offset
] == sub_needle
) {
51 /* sub_haystack is still a candidate */
55 /* sub_haystack is no longer a possibility */
61 if(*sub_haystack
== '\0')