X-Git-Url: https://git.deb.at/w?p=pkg%2Fabook.git;a=blobdiff_plain;f=misc.c;h=0f96b7a878316948c11d98a70259865d5e70ac55;hp=9ae0ff7a88db342b49ffc35b6f14f51086e296d6;hb=HEAD;hpb=c0b0c6c7a0971525558239e544212589fbbac58b 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