int PHYSFSEXT_locateCorrectCase(char *buf) { int rc; char *ptr; char *prevptr; while (*buf == '/') /* skip any '/' at start of string... */ buf++; ptr = prevptr = buf; if (*ptr == '\0') return 0; /* Uh...I guess that's success. */ while (ptr = strchr(ptr + 1, '/')) { *ptr = '\0'; /* block this path section off */ rc = locateOneElement(buf); *ptr = '/'; /* restore path separator */ if (!rc) return -2; /* missing element in path. */ } /* while */ /* check final element... */ return locateOneElement(buf) ? 0 : -1; } /* PHYSFSEXT_locateCorrectCase */
static int locateCorrectCase(char *buf) { char *ptr = buf; char *prevptr = buf; while (ptr = strchr(ptr + 1, '/')) { *ptr = '\0'; /* block this path section off */ if (!locateOneElement(buf)) { *ptr = '/'; /* restore path separator */ return -2; /* missing element in path. */ } *ptr = '/'; /* restore path separator */ } /* check final element... */ return locateOneElement(buf) ? 0 : -1; }