-static char* stripfilename(char*filename, char*newext)
-{
- char*last1 = strrchr(filename, '/');
- char*last2 = strrchr(filename, '\\');
- char*pos = filename;
- char*name;
- char*dot;
- if(last1>pos) pos = last1 + 1;
- if(last2>pos) pos = last2 + 1;
- name = (char*)malloc(strlen(pos)+5);
- strcpy(name, pos);
- dot = strrchr(name, '.');
- if(dot) {
- *dot = 0;
- }
- strcat(name, newext);
- return name;
-}
-