about summary refs log tree commit diff
path: root/Src
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2012-01-08 16:02:54 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2012-01-08 16:02:54 +0000
commitc214b86e9456b2e5eda47bc7710ced0c455df70e (patch)
treeba61292c2eaa78531ac5232d3535334e0d4ab7cf /Src
parent59ff3c692096a671c5b78669f39e7b1e5d00df62 (diff)
downloadzsh-c214b86e9456b2e5eda47bc7710ced0c455df70e.tar.gz
zsh-c214b86e9456b2e5eda47bc7710ced0c455df70e.tar.xz
zsh-c214b86e9456b2e5eda47bc7710ced0c455df70e.zip
30101: add HASH_EXECUTABLES_ONLY option
Diffstat (limited to 'Src')
-rw-r--r--Src/hashtable.c5
-rw-r--r--Src/options.c1
-rw-r--r--Src/zsh.h1
3 files changed, 5 insertions, 2 deletions
diff --git a/Src/hashtable.c b/Src/hashtable.c
index 6fca256e3..775b6a277 100644
--- a/Src/hashtable.c
+++ b/Src/hashtable.c
@@ -663,8 +663,9 @@ hashdir(char **dirp)
 		 * This is the same test as for the glob qualifier for
 		 * executable plain files.
 		 */
-		if (stat(pathbuf, &statbuf) == 0 &&
-		    S_ISREG(statbuf.st_mode) && (statbuf.st_mode & S_IXUGO))
+		if (unset(HASHEXECUTABLESONLY) ||
+		    (stat(pathbuf, &statbuf) == 0 &&
+		     S_ISREG(statbuf.st_mode) && (statbuf.st_mode & S_IXUGO)))
 		    add = 1;
 	    }
 	    if (add) {
diff --git a/Src/options.c b/Src/options.c
index a70d4ff11..5fbb06b11 100644
--- a/Src/options.c
+++ b/Src/options.c
@@ -140,6 +140,7 @@ static struct optname optns[] = {
 {{NULL, "globsubst",	      OPT_EMULATE|OPT_NONZSH},	 GLOBSUBST},
 {{NULL, "hashcmds",	      OPT_ALL},			 HASHCMDS},
 {{NULL, "hashdirs",	      OPT_ALL},			 HASHDIRS},
+{{NULL, "hashexecutablesonly", 0},                       HASHEXECUTABLESONLY},
 {{NULL, "hashlistall",	      OPT_ALL},			 HASHLISTALL},
 {{NULL, "histallowclobber",   0},			 HISTALLOWCLOBBER},
 {{NULL, "histbeep",	      OPT_ALL},			 HISTBEEP},
diff --git a/Src/zsh.h b/Src/zsh.h
index dda2fa91a..29c8a8319 100644
--- a/Src/zsh.h
+++ b/Src/zsh.h
@@ -1986,6 +1986,7 @@ enum {
     GLOBSUBST,
     HASHCMDS,
     HASHDIRS,
+    HASHEXECUTABLESONLY,
     HASHLISTALL,
     HISTALLOWCLOBBER,
     HISTBEEP,