X-Git-Url: https://git.deb.at/w?a=blobdiff_plain;f=misc.c;h=0f96b7a878316948c11d98a70259865d5e70ac55;hb=ca5c3086c7ff9c99645a66fd0c21167ef60ba0e9;hp=9ae0ff7a88db342b49ffc35b6f14f51086e296d6;hpb=7751b3edc145646e6b55e2fda82eb5619fbe0074;p=pkg%2Fabook.git diff --git a/misc.c b/misc.c index 9ae0ff7..0f96b7a 100644 --- a/misc.c +++ b/misc.c @@ -1,6 +1,6 @@ /* - * $Id: misc.c,v 1.22 2005/10/25 23:27:24 cduval Exp $ + * $Id$ * * by JH * @@ -64,6 +64,41 @@ 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; +} + +#ifndef HAVE_STRCASESTR +char * +strcasestr(const char *haystack, const char *needle) +{ + int i; + int k; + + assert(haystack != NULL); + assert(needle != NULL); + + for(i=0; i