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 ... */
23 while (*str
!= '\0') {
25 * We have to multiply 'ret' by 10 before absorbing the next digit.
26 * If this will overflow, catch it now.
28 if (ret
&& (((ULONG_MAX
+ 10) / ret
) < 10))
43 char *int_strstr(const char *haystack
, const char *needle
)
45 const char *sub_haystack
= haystack
, *sub_needle
= needle
;
46 unsigned int offset
= 0;
51 while ((*sub_haystack
!= '\0') && (*sub_needle
!= '\0')) {
52 if (sub_haystack
[offset
] == sub_needle
) {
53 /* sub_haystack is still a candidate */
57 /* sub_haystack is no longer a possibility */
63 if (*sub_haystack
== '\0')