X-Git-Url: http://winboard.nl/cgi-bin?a=blobdiff_plain;f=util.c;h=28e56b5ad452b0ac6aa7973ab7094054707a0483;hb=c6505b9bddf0ed2f461a473d4be40c98608d9866;hp=a5af1173347ebdb6e4876aa73308250057b7e010;hpb=cd81270f2b1723e0798f4d6dcaee134f0b4aca7f;p=polyglot.git diff --git a/util.c b/util.c index a5af117..28e56b5 100644 --- a/util.c +++ b/util.c @@ -150,6 +150,10 @@ void my_log_open(const char file_name[]) { //line buffering doesn't work too well in MSVC and/or windows if (LogFile != NULL) setvbuf(LogFile,NULL,_IOLBF,0); // line buffering #endif + if(LogFile!=NULL){ + my_log("POLYGLOT *** LOGFILE OPENED ***\n"); + } + } // my_log_close() @@ -316,6 +320,44 @@ bool my_string_case_equal(const char string_1[], const char string_2[]) { return FALSE; } +// my_strtolower() + +void my_string_tolower(char *dst, const char *src){ + int c; + ASSERT(src!=NULL); + ASSERT(dst!=NULL); + while((c=*(src++))){ + *dst=tolower(c); + dst++; + } + *(dst++)='\0'; +} + +// my_string_case_contains() + +const char* my_string_case_contains(const char string_1[], const char string_2[]){ + + char tmp1[StringSize]; + char tmp2[StringSize]; + char *where; + + + ASSERT(string_1!=NULL); + ASSERT(string_2!=NULL); + + my_string_tolower(tmp1,string_1); + my_string_tolower(tmp2,string_2); + + where=strstr(tmp1,tmp2); + if(where){ + return string_1+(where-tmp1); + } + return NULL; + + +} + + // my_strdup() char * my_strdup(const char string[]) { @@ -355,6 +397,8 @@ void my_string_set(const char * * variable, const char string[]) { *variable = my_strdup(string); } +// now_real() + double now_real() { #ifndef _WIN32 struct timeval tv[1];