diff --git a/lib/parse.h b/lib/parse.h index a6c0af9efb..b9dcb71be3 100644 --- a/lib/parse.h +++ b/lib/parse.h @@ -24,6 +24,7 @@ #include #include "miofile.h" +#include "str_util.h" class XML_PARSER { bool scan_nonws(int&); @@ -76,6 +77,25 @@ inline bool match_tag(const std::string &s, const char* tag) { return match_tag(s.c_str(), tag); } +#ifndef strtoull +inline unsigned long long strtoull(const char *s, char **, int) { + char buf[64]; + char *p; + unsigned long long y; + strncpy(buf, s, sizeof(buf)-1); + strip_whitespace(buf); + p = buf; + p = strstr(buf, "0x"); + if (!p) p = strstr(buf, "0X"); + if (p) { + sscanf(p, "llx", &y); + } else { + sscanf(buf, "llu", &y); + } + return y; +} +#endif + // parse an integer of the form 1234 // return true if it's there // Note: this doesn't check for the end tag