summaryrefslogtreecommitdiff
path: root/Src/builtin.c
diff options
context:
space:
mode:
Diffstat (limited to 'Src/builtin.c')
-rw-r--r--Src/builtin.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/Src/builtin.c b/Src/builtin.c
index b1b6e2e30..7a04a79a7 100644
--- a/Src/builtin.c
+++ b/Src/builtin.c
@@ -3369,6 +3369,31 @@ bin_functions(char *name, char **argv, Options ops, int func)
removetrapnode(signum);
}
+ if (**argv == '/') {
+ char *base = strrchr(*argv, '/') + 1;
+ if (*base &&
+ (shf = (Shfunc) shfunctab->getnode(shfunctab, base))) {
+ char *dir;
+ /* turn on/off the given flags */
+ shf->node.flags =
+ (shf->node.flags | (on & ~PM_UNDEFINED)) & ~off;
+ if (shf->node.flags & PM_UNDEFINED) {
+ /* update path if not yet loaded */
+ if (base == *argv + 1)
+ dir = "/";
+ else {
+ dir = *argv;
+ base[-1] = '\0';
+ }
+ dircache_set(&shf->filename, NULL);
+ dircache_set(&shf->filename, dir);
+ }
+ if (check_autoload(shf, shf->node.nam, ops, func))
+ returnval = 1;
+ continue;
+ }
+ }
+
/* Add a new undefined (autoloaded) function to the *
* hash table with the corresponding flags set. */
shf = (Shfunc) zshcalloc(sizeof *shf);