-static unsigned int sstrtoui (const char *str) /* {{{ */
-{
- unsigned int ret;
- char *endptr;
-
- if (str == NULL)
- return (0);
-
- errno = 0;
- endptr = NULL;
- ret = (unsigned int) strtoul (str, &endptr, /* base = */ 10);
- if ((endptr == str) || (errno != 0))
- return (0);
-
- return (ret);
-} /* }}} unsigned int sstrtoui */
-
-static _Bool sstrtob (const char *str) /* {{{ */
-{
- if (str == NULL)
- return (false);
-
- if (strcasecmp ("true", str) == 0)
- return (true);
- return (false);
-} /* }}} _Bool sstrtob */
-
-static int string_to_rx_tx_counters (const char *str, /* {{{ */
- uint64_t *rx, uint64_t *tx)
-{
- const char *ptr;
- char *endptr;
-
- if ((rx == NULL) || (tx == NULL))
- return (EINVAL);
-
- *rx = 0;
- *tx = 0;
-
- if (str == NULL)
- return (EINVAL);
-
- ptr = str;
- errno = 0;
- endptr = NULL;
- *rx = (uint64_t) strtoull (ptr, &endptr, /* base = */ 10);
- if ((endptr == str) || (errno != 0))
- return (EIO);
-
- assert (endptr != NULL);
- if (*endptr != '/')
- return (EIO);
-
- ptr = endptr + 1;
- errno = 0;
- endptr = NULL;
- *tx = (uint64_t) strtoull (ptr, &endptr, /* base = */ 10);
- if ((endptr == str) || (errno != 0))
- return (EIO);
-
- return (0);
-} /* }}} int string_to_rx_tx_counters */
-