- flag = TFOLDER;
- }
-
- if (*name == '/'
- || (flag == TFOLDER
- && (strncmp (name, CWD, NCWD)
- && strcmp (name, DOT)
- && strcmp (name, DOTDOT)
- && strncmp (name, PWD, NPWD))))
- return getcpy (name);
-
- if (pwds == NULL)
- pwds = pwd ();
-
- if (strcmp (name, DOT) == 0 || strcmp (name, CWD) == 0)
- return getcpy (pwds);
-
- ep = pwds + strlen (pwds);
- if ((cp = strrchr(pwds, '/')) == NULL)
- cp = ep;
- else
- if (cp == pwds)
- cp++;
-
- if (strncmp (name, CWD, NCWD) == 0)
- name += NCWD;
-
- if (strcmp (name, DOTDOT) == 0 || strcmp (name, PWD) == 0) {
- snprintf (buffer, sizeof(buffer), "%.*s", cp - pwds, pwds);
- return getcpy (buffer);
- }
-
- if (strncmp (name, PWD, NPWD) == 0)
- name += NPWD;
- else
- cp = ep;
-
- snprintf (buffer, sizeof(buffer), "%.*s/%s", cp - pwds, pwds, name);
- return getcpy (buffer);