From e142bdeb17005fdb974b0352c743f9da68dbb8aa Mon Sep 17 00:00:00 2001 From: Tanaka Akira Date: Fri, 14 Jan 2000 19:14:40 +0000 Subject: zsh-workers/9322 --- Src/init.c | 48 +++++++++++++++++++++++++++++++++++------------- Src/zsh.mdd | 3 +++ 2 files changed, 38 insertions(+), 13 deletions(-) (limited to 'Src') diff --git a/Src/init.c b/Src/init.c index 11d9ab65c..e213db0cb 100644 --- a/Src/init.c +++ b/Src/init.c @@ -546,6 +546,18 @@ setupvals(void) char *ptr; #ifdef HAVE_GETRLIMIT int i; +#endif +#if defined(SITEFPATH_DIR) || defined(FPATH_DIR) + char **fpathptr; +# if defined(FPATH_DIR) && defined(FPATH_SUBDIRS) + char *fpath_subdirs[] = FPATH_SUBDIRS; + int j; +# endif +# ifdef SITEPATH_DIR + int fpathlen = 1; +# else + int fpathlen = 0; +# endif #endif getkeyptr = NULL; @@ -581,23 +593,33 @@ setupvals(void) cdpath = mkarray(NULL); manpath = mkarray(NULL); fignore = mkarray(NULL); -#ifdef FPATH_DIR -# ifdef FPATH_SUBDIRS - { - char *fpath_subdirs[] = FPATH_SUBDIRS; - int len = sizeof(fpath_subdirs)/sizeof(char *), j; - - fpath = zalloc((len+1)*sizeof(char *)); - for (j = 0; j < len; j++) - fpath[j] = tricat(FPATH_DIR, "/", fpath_subdirs[j]); - fpath[len] = NULL; - } -# else - fpath = mkarray(ztrdup(FPATH_DIR)); + +#if defined(SITEFPATH_DIR) || defined(FPATH_DIR) +# ifdef FPATH_DIR +# ifdef FPATH_SUBDIRS + fpathlen += sizeof(fpath_subdirs)/sizeof(char *); +# else + fpathlen++; +# endif +# endif + fpath = fpathptr = (char **)zalloc((fpathlen+1)*sizeof(char *)); +# ifdef SITEFPATH_DIR + *fpathptr++ = ztrdup(SITEFPATH_DIR); + fpathlen--; # endif +# ifdef FPATH_DIR +# ifdef FPATH_SUBDIRS + for (j = 0; j < fpathlen; j++) + *fpathptr++ = tricat(FPATH_DIR, "/", fpath_subdirs[j]); +# else + *fpathptr++ = ztrdup(FPATH_DIR); +# endif +# endif + *fpathptr = NULL; #else fpath = mkarray(NULL); #endif + mailpath = mkarray(NULL); watch = mkarray(NULL); psvar = mkarray(NULL); diff --git a/Src/zsh.mdd b/Src/zsh.mdd index cca6ec8f9..f78e0694e 100644 --- a/Src/zsh.mdd +++ b/Src/zsh.mdd @@ -34,6 +34,9 @@ version.h: $(sdir_top)/Config/version.mk zshpaths.h: Makemod $(CONFIG_INCS) @echo '#define MODULE_DIR "'$(MODDIR)'"' > zshpaths.h.tmp + @if test x$(sitefndir) != xno; then \ + echo '#define SITEFPATH_DIR "'$(sitefndir)'"' >> zshpaths.h.tmp; \ + fi @if test x$(fndir) != xno; then \ echo '#define FPATH_DIR "'$(fndir)'"' >> zshpaths.h.tmp; \ if test x$(FUNCTIONS_SUBDIRS) != x -a \ -- cgit 1.4.1