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