/* Convert string to long integer, but handle errors.  */
static int modem_atoi(const char *s, const int err_value, const char *desc, const char *func)
/* Convert string to long integer, but handle errors.  */
static int modem_atoi(const char *s, const int err_value, const char *desc, const char *func)
{
	int ret;
	char *endptr;
	ret = (int)strtol(s, &endptr, 10);
	if (!endptr || *endptr != '\0') {
		LOG_ERR("bad %s '%s' in %s", s, desc,
			func);
		return err_value;
	}
	return ret;
}