home *** CD-ROM | disk | FTP | other *** search
- #include <stdlib.h>
-
- char *__amigapath(const char *path)
- {
- static char *amipath=NULL;
- char *temp=NULL;
- int ucur=0,acur=0;
-
- if (amipath)
- free(amipath);
-
- temp=(char *)(malloc(strlen(path)+1));
- if (temp==NULL)
- return(NULL);
-
- for (;path[ucur]!='\0';acur++,ucur++) {
- if (path[ucur]=='.') {
- if ((path[ucur+1]=='.')&&(path[ucur+2]=='/')) {
- acur--;
- ucur++;
- continue;
- }
- if (path[ucur+1]=='/') {
- acur--;
- ucur++;
- continue;
- }
- }
- temp[acur]=path[ucur];
- }
- temp[acur]='\0';
-
- amipath=(char *)(malloc(strlen(temp)+1));
- if (amipath)
- strcpy(amipath,temp);
- free(temp);
-
- return(amipath);
- }
-