--- parser3/src/main/pa_common.C 2001/04/07 10:34:45 1.40 +++ parser3/src/main/pa_common.C 2001/04/10 07:40:50 1.43 @@ -6,7 +6,7 @@ Author: Alexander Petrosyan (http://design.ru/paf) - $Id: pa_common.C,v 1.40 2001/04/07 10:34:45 paf Exp $ + $Id: pa_common.C,v 1.43 2001/04/10 07:40:50 paf Exp $ */ #include "pa_config_includes.h" @@ -16,6 +16,7 @@ #include #include #include +#include #include "pa_common.h" #include "pa_types.h" @@ -141,6 +142,9 @@ void file_delete(Pool& pool, const Strin bool file_readable(const String& file_spec) { return access(file_spec.cstr(String::UL_FILE_NAME), R_OK)==0; } +bool file_executable(const String& file_spec) { + return access(file_spec.cstr(String::UL_FILE_NAME), X_OK)==0; +} char *getrow(char **row_ref, char delim) { char *result=*row_ref; @@ -298,4 +302,31 @@ void back_slashes_to_slashes(char *s) { if(*s=='\\') *s='/'; } +/* +void slashes_to_back_slashes(char *s) { + if(s) + for(; *s; s++) + if(*s=='/') + *s='\\'; +} +*/ #endif + +bool StrEqNc(const char *s1, const char *s2, bool strict) { + while(true) { + if(!(*s1)) { + if(!(*s2)) + return true; + else + return !strict; + } else if(!(*s2)) + return !strict; + if(isalpha(*s1)) { + if(tolower(*s1) !=tolower(*s2)) + return false; + } else if((*s1) !=(*s2)) + return false; + s1++; + s2++; + } +}