X-Git-Url: https://git.deb.at/w?a=blobdiff_plain;f=misc.c;h=f72475da74287ffee67c43666fc49e6a91dc7283;hb=3370ba68ac9cbbd583da6997c039b29b0fc43b7a;hp=01bdd545095073254211065d076f4930a9b11b3f;hpb=6f27db4afffc464b91c1ef23b0b5d85322e8d9b8;p=pkg%2Fabook.git diff --git a/misc.c b/misc.c index 01bdd54..f72475d 100644 --- a/misc.c +++ b/misc.c @@ -64,6 +64,19 @@ strtrim(char *s) return s; } +int +is_number(char *p) +{ + if(!p || !*p || (*p == '-' && !*++p)) + return 0; + + for(; *p; p++) + if(!isdigit(*p)) + return 0; + + return 1; +} + #ifdef HAVE_CONFIG_H # include "config.h"