1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2024-06-01 04:46:08 +02:00

12823: use zsh heap in lieu of perm. heap in bin_dot

This commit is contained in:
Clint Adams 2000-09-18 03:31:31 +00:00
parent 2abf9db381
commit 04bf2c822f
3 changed files with 21 additions and 4 deletions

View File

@ -1,5 +1,8 @@
2000-09-17 Clint Adams <schizo@debian.org>
* 12823: Src/builtin.c, Src/utils.c: use zsh heap instead of
permanent heap.
* 12821: Src/builtin.c: bin_dot is now independent of PATH_MAX.
2000-09-16 Bart Schaefer <schaefer@zsh.org>

View File

@ -3297,25 +3297,25 @@ bin_dot(char *name, char **argv, char *ops, int func)
break;
}
if (!*s || (ret && isset(PATHDIRS) && diddot < 2 && dotdot == 0)) {
pushheap();
/* search path for script */
for (t = path; *t; t++) {
if (!(*t)[0] || ((*t)[0] == '.' && !(*t)[1])) {
if (diddot)
continue;
diddot = 1;
buf = ztrdup(arg0);
buf = dupstring(arg0);
} else
buf = tricat(*t, "/", arg0);
buf = zhtricat(*t, "/", arg0);
s = unmeta(buf);
if (access(s, F_OK) == 0 && stat(s, &st) >= 0
&& !S_ISDIR(st.st_mode)) {
ret = source(enam = buf);
zsfree(buf);
break;
}
zsfree(buf);
}
popheap();
}
}
/* clean up and return */

View File

@ -3472,6 +3472,20 @@ appstr(char *base, char const *append)
return strcat(realloc(base, strlen(base) + strlen(append) + 1), append);
}
/**/
mod_export char *
zhtricat(char const *s1, char const *s2, char const *s3)
{
char *ptr;
ptr = (char *)zhalloc(strlen(s1) + strlen(s2) + strlen(s3) + 1);
strcpy(ptr, s1);
strcat(ptr, s2);
strcat(ptr, s3);
return ptr;
}
/**/
static int
upchdir(int n)