111
/* Read an integer from str. If it parses okay, store it in *result
112
* and return TRUE; otherwise, return FALSE. */
113
bool parse_num(const char *str, ssize_t *result)
111
/* Read an integer from the given string. If it parses okay,
112
* store it in *result and return TRUE; otherwise, return FALSE. */
113
bool parse_num(const char *string, ssize_t *result)
118
/* The manual page for strtol() says this is required. */
118
/* Clear the error number so that we can check it afterward. */
121
value = (ssize_t)strtol(str, &first_error, 10);
121
value = (ssize_t)strtol(string, &excess, 10);
123
if (errno == ERANGE || *str == '\0' || *first_error != '\0')
123
if (errno == ERANGE || *string == '\0' || *excess != '\0')