From 2a5a899a55fd2bce10efd01c75a4bec5285aa46c Mon Sep 17 00:00:00 2001 From: Tanaka Akira Date: Thu, 15 Apr 1999 18:10:10 +0000 Subject: zsh-3.1.5-pws-4 --- Src/utils.c | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) (limited to 'Src/utils.c') diff --git a/Src/utils.c b/Src/utils.c index af0247ebf..90da15368 100644 --- a/Src/utils.c +++ b/Src/utils.c @@ -427,7 +427,7 @@ get_username(void) cached_username = ztrdup(""); } #else /* !HAVE_GETPWUID */ - cached_uid = current_uid; + cached_uid = getuid(); #endif /* !HAVE_GETPWUID */ return cached_username; } @@ -510,16 +510,13 @@ adduserdir(char *s, char *t, int flags, int always) if ((flags & ND_USERNAME) && nameddirtab->getnode2(nameddirtab, s)) return; - /* Never hash PWD unless it was explicitly requested */ - if (!always && !strcmp(s, "PWD")) - return; - /* Normal parameter assignments generate calls to this function, * * with always==0. Unless the AUTO_NAME_DIRS option is set, we * * don't let such assignments actually create directory names. * * Instead, a reference to the parameter as a directory name can * - * cause the actual creation of the hash table entry. */ - if (!always && unset(AUTONAMEDIRS) && + * cause the actual creation of the hash table entry. Never hash * + * PWD unless it was explicitly requested (or already hashed). */ + if (!always && (unset(AUTONAMEDIRS) || !strcmp(s, "PWD")) && !nameddirtab->getnode2(nameddirtab, s)) return; @@ -633,8 +630,13 @@ preprompt(void) /* If a shell function named "precmd" exists, * * then execute it. */ - if ((list = getshfunc("precmd")) != &dummy_list) + if ((list = getshfunc("precmd")) != &dummy_list) { + int osc = sfcontext; + + sfcontext = SFC_HOOK; doshfunc("precmd", list, NULL, 0, 1); + sfcontext = osc; + } if (errflag) return; @@ -643,7 +645,11 @@ preprompt(void) * executed "periodic", then execute it now. */ if (period && (time(NULL) > lastperiodic + period) && (list = getshfunc("periodic")) != &dummy_list) { + int osc = sfcontext; + + sfcontext = SFC_HOOK; doshfunc("periodic", list, NULL, 0, 1); + sfcontext = osc; lastperiodic = time(NULL); } if (errflag) -- cgit 1.4.1