API int
LQU_cknatstr
(str)
CONST char *str;
Purpose
Checks whether the given string argument represents a natural number; that is, an optional plus or minus sign followed by one or more decimal digits. Leading whitespace, as reported by the isspace macro, is ignored, but no trailing whitespace is allowed.Returns
Zero if the match fails, and one if it succeeds.
Bugs
- Should return a pointer to the first implausible character.
- Should probably allow trailing whitespace.
- Does not check its argument for a NULL pointer.