int s_isdigit(const char* s) {
Name does not fit implementation. Should be "contains_digit".Also I would say almost any "issomething" method involving a loop has an opportunity for an early return.
int s_isdigit(const char* s) {
Name does not fit implementation. Should be "contains_digit".Also I would say almost any "issomething" method involving a loop has an opportunity for an early return.
int s_isnum(const char* s) {
int result = (*s != '\0');
while (*s != '\0') {
if ((*s < '0') || ('9' < *s)) {
result = 0;
}
s++;
}
return result;
}
otherwise, it will choke on directories like `/proc/etc64/` or `/proc/net6/` if any such directory is added. (Plus other bits like early return, but that's not a correctness bug.)