int is_digit(const char *str)
{
size_t len = strlen(str);
while(len > 0) {
if (*str < '0' || *str > '9') {
return -1;
}
str++;
len--;
}
return 0;
}