diff options
author | Kent Williams <norman-k-williams@uiowa.edu> | 2003-04-11 20:22:57 (GMT) |
---|---|---|
committer | Kent Williams <norman-k-williams@uiowa.edu> | 2003-04-11 20:22:57 (GMT) |
commit | ac440aa321225dfe49d9fcdad0d8fd3af9fdb7f1 (patch) | |
tree | 991d97f627859fd78c59823b7845a70734ce5028 | |
parent | 5e04f6cbb4e2759b389849bf356899884ac7cee3 (diff) | |
download | CMake-ac440aa321225dfe49d9fcdad0d8fd3af9fdb7f1.zip CMake-ac440aa321225dfe49d9fcdad0d8fd3af9fdb7f1.tar.gz CMake-ac440aa321225dfe49d9fcdad0d8fd3af9fdb7f1.tar.bz2 |
remove redundant function and eliminate need for strcasecmp
-rw-r--r-- | Source/kwsys/SystemTools.cxx | 58 | ||||
-rw-r--r-- | Source/kwsys/SystemTools.hxx.in | 5 |
2 files changed, 12 insertions, 51 deletions
diff --git a/Source/kwsys/SystemTools.cxx b/Source/kwsys/SystemTools.cxx index 5f6b93f..624df6d 100644 --- a/Source/kwsys/SystemTools.cxx +++ b/Source/kwsys/SystemTools.cxx @@ -1032,14 +1032,18 @@ unsigned long SystemTools::FileLength(const char* filename) int SystemTools::Strucmp(const char *s1, const char *s2) { -#if defined(_WIN32) -#ifdef __BORLANDC__ - return stricmp(s1,s2); -#else - return _stricmp(s1,s2); -#endif -#else - return strcasecmp(s1,s2); +// return strcasecmp(s1,s2); +// +// lifted from Graphvis http://www.graphviz.org + while ((*s1 != '\0') + && (tolower(*(unsigned char *)s1) == tolower(*(unsigned char *)s2))) + { + s1++; + s2++; + } + + return tolower(*(unsigned char *) s1) - tolower(*(unsigned char *) s2); + #endif } @@ -1069,44 +1073,6 @@ bool SystemTools::RemoveFile(const char* source) return unlink(source) != 0 ? false : true; } -char *SystemTools -::RealPath(const char *path, char *resolved_path) -{ -#if defined(_WIN32) - char pathpart[4096]; - strcpy(pathpart,path); - char fnamepart[4096]; - char *slash; - - if((slash = strrchr(pathpart,'/')) == NULL) - { - slash = strrchr(pathpart,'\\'); - } - - if(slash == NULL) // no path part, so just use current dir. - { - Getcwd(pathpart,sizeof(pathpart)); - strcpy(fnamepart,path); - } - else // change directory to path part, getcwd to find OS resolved path - { - *slash = '\0'; - strcpy(fnamepart,slash+1); - - char savedir[4096]; - Getcwd(savedir,sizeof(savedir)); - Chdir(pathpart); - Getcwd(pathpart,sizeof(pathpart)); - Chdir(savedir); - } - strcpy(resolved_path,pathpart); - strcat(resolved_path,"/"); - strcat(resolved_path,fnamepart); - return resolved_path; -#else - return realpath(path,resolved_path); -#endif -} /** * Find the file the given name. Searches the given path and then diff --git a/Source/kwsys/SystemTools.hxx.in b/Source/kwsys/SystemTools.hxx.in index 82e1627..7c7d302 100644 --- a/Source/kwsys/SystemTools.hxx.in +++ b/Source/kwsys/SystemTools.hxx.in @@ -130,11 +130,6 @@ public: static unsigned long FileLength(const char *filename); /** - * given a (possibly) relative path, return the completely - * qualified path to a file system entity - */ - static char *RealPath(const char *path, char *resolved_path); - /** * Add the paths from the environment variable PATH to the * string vector passed in. */ |