#include #include #include /************************************************************************/ /* */ /************************************************************************/ char *fine_dir(char *path, char *cwd) { if(path && *path) { int i = (path[1] == ':') ? 2 : 0; char *cp = path + i; while(*cp) { if(*cp == '/') *cp = '\\'; cp++; } if(*--cp == '\\') { *cp = '\0'; if(path[i] == '\0') strcat(path, "\\"); } if(cwd && *cwd && strchr(path, '\\') == NULL) { cp = strdup(&path[i]); if(cwd[1] == ':') i = 0; path[i] = '\0'; strcat(path, cwd); if(cwd[strlen(cwd) - 1] != '\\') strcat(path, "\\"); strcat(path, cp); free(cp); } return(path); } return(NULL); }