X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fros_parse.c;h=b9d7e9908b4c254872cc7279bd067ea6480f7177;hb=d0e5281499b711d9c03bf0e60a4c117d4dc950be;hp=d2367393a2cd96f55bc5b1b008ae46557e7c9c9c;hpb=0444981b9b06a05776b2081889c0f7916aa718f6;p=routeros-api.git diff --git a/src/ros_parse.c b/src/ros_parse.c index d236739..b9d7e99 100644 --- a/src/ros_parse.c +++ b/src/ros_parse.c @@ -68,6 +68,23 @@ unsigned int sstrtoui (const char *str) /* {{{ */ return (ret); } /* }}} unsigned int sstrtoui */ +uint64_t sstrtoui64 (const char *str) /* {{{ */ +{ + uint64_t ret; + char *endptr; + + if (str == NULL) + return (0); + + errno = 0; + endptr = NULL; + ret = (uint64_t) strtoull (str, &endptr, /* base = */ 10); + if ((endptr == str) || (errno != 0)) + return (0); + + return (ret); +} /* }}} uint64_t sstrtoui64 */ + double sstrtod (const char *str) /* {{{ */ { double ret;