bug in STk-2.1: (expand-file-name "/.../") mungs pathname.
(expand-file-name "/.../") evaluates to "/..", which is obviously wrong.
Here's my fix; I fixed it by rewriting the absolute() function in
Src/unix.c:
*** /view/sommerfeld_toys/vob/sommerfeld/lib/STk/Src/unix.c_at_@/main/sommerfeld_port_fix/0 Wed Feb 1 17:26:53 1995
--- /view/sommerfeld_toys/vob/sommerfeld/lib/STk/Src/unix.c Wed Feb 1 19:02:59 1995
***************
*** 31,36 ****
--- 31,37 ----
/* Returns (mostly clean) absolute pathname of s */
{
char *p = pathname;
+ char *t;
if (s[0] != '/') {
getcwd(pathname, MAX_PATH_LENGTH);
***************
*** 38,66 ****
}
*p = '/';
! for ( ; *s; s++) {
! switch (*s) {
! case '.' : if (*(s+1)) {
! switch (*++s) {
! case '.' : if (*(s+1) == '\0' || *(s+1) == '/') {
! /* We must go back to the parent */
! if (*p == '/' && p > pathname) p--;
! while (p > pathname && *p != '/') p--;
! }
! else {
! *++p = '.';
! *++p = '.';
! }
! break;
! case '/' : if (*p != '/') *++p = '/';
! break;
! default : *++p = '.'; *++p = *s; break;
! }
! }
! break;
! case '/' : if (*p != '/') *++p = '/'; break;
! default : *++p = *s;
! }
}
/* Place a \0 at end. If path ends with a "/", delete it */
--- 39,67 ----
}
*p = '/';
! for (; *s; s=t)
! {
! if (*p != '/') abort();
!
! while (*s=='/') s++;
! for (t = s; *t && (*t != '/'); t++)
! continue;
! if (*s == '.')
! {
! if ((t-s)==1)
! continue;
! if (((t-s)==2) && s[1] == '.')
! {
! /* We must go back to the parent */
! if (*p == '/' && p > pathname) p--;
! while (p > pathname && *p != '/') p--;
! continue;
! }
! }
! ++p;
! memcpy(p, s, t-s);
! p += t-s;
! *p = '/';
}
/* Place a \0 at end. If path ends with a "/", delete it */
Received on Thu Feb 02 1995 - 01:09:48 CET
This archive was generated by hypermail 2.3.0
: Mon Jul 21 2014 - 19:38:59 CEST