about summary refs log tree commit diff
path: root/Src
diff options
context:
space:
mode:
authorTanaka Akira <akr@users.sourceforge.net>1999-12-14 18:04:06 +0000
committerTanaka Akira <akr@users.sourceforge.net>1999-12-14 18:04:06 +0000
commitd5fbda44c32c6d9905406b074ebeccb26e263055 (patch)
tree9fde7cd6d8a52dfbffd38c28788be142697b6f80 /Src
parent82b1d142358a804375d2bf821ae4d1e840797dbd (diff)
downloadzsh-d5fbda44c32c6d9905406b074ebeccb26e263055.tar.gz
zsh-d5fbda44c32c6d9905406b074ebeccb26e263055.tar.xz
zsh-d5fbda44c32c6d9905406b074ebeccb26e263055.zip
zsh-workers/9046
Diffstat (limited to 'Src')
-rw-r--r--Src/Builtins/rlimits.c8
-rw-r--r--Src/Builtins/rlimits.mdd2
-rw-r--r--Src/Builtins/sched.c8
-rw-r--r--Src/Builtins/sched.mdd2
-rw-r--r--Src/Makemod.in.in15
-rw-r--r--Src/Modules/cap.c8
-rw-r--r--Src/Modules/cap.mdd2
-rw-r--r--Src/Modules/clone.c8
-rw-r--r--Src/Modules/clone.mdd2
-rw-r--r--Src/Modules/example.c10
-rw-r--r--Src/Modules/example.mdd2
-rw-r--r--Src/Modules/files.c8
-rw-r--r--Src/Modules/files.mdd2
-rw-r--r--Src/Modules/mapfile.c8
-rw-r--r--Src/Modules/mapfile.mdd2
-rw-r--r--Src/Modules/mathfunc.c8
-rw-r--r--Src/Modules/mathfunc.mdd2
-rw-r--r--Src/Modules/parameter.c8
-rw-r--r--Src/Modules/parameter.mdd2
-rw-r--r--Src/Modules/stat.c8
-rw-r--r--Src/Modules/stat.mdd2
-rw-r--r--Src/Modules/zftp.c8
-rw-r--r--Src/Modules/zftp.mdd2
-rw-r--r--Src/Modules/zprof.c8
-rw-r--r--Src/Modules/zprof.mdd2
-rw-r--r--Src/Modules/zutil.c8
-rw-r--r--Src/Modules/zutil.mdd2
-rw-r--r--Src/Zle/compctl.c8
-rw-r--r--Src/Zle/compctl.mdd4
-rw-r--r--Src/Zle/complete.c8
-rw-r--r--Src/Zle/complete.mdd6
-rw-r--r--Src/Zle/complist.c8
-rw-r--r--Src/Zle/complist.mdd4
-rw-r--r--Src/Zle/computil.c8
-rw-r--r--Src/Zle/computil.mdd4
-rw-r--r--Src/Zle/deltochar.c8
-rw-r--r--Src/Zle/deltochar.mdd4
-rw-r--r--Src/Zle/zle.mdd2
-rw-r--r--Src/Zle/zle_main.c8
-rw-r--r--Src/Zle/zle_thingy.c2
-rw-r--r--Src/Zle/zleparameter.c8
-rw-r--r--Src/Zle/zleparameter.mdd4
-rw-r--r--Src/init.c16
-rw-r--r--Src/makepro.awk9
-rw-r--r--Src/mkbltnmlst.sh24
-rw-r--r--Src/mkmakemod.sh174
-rw-r--r--Src/mkmodindex.sh39
-rw-r--r--Src/module.c144
-rw-r--r--Src/xmods.conf20
-rw-r--r--Src/zsh.mdd13
50 files changed, 348 insertions, 324 deletions
diff --git a/Src/Builtins/rlimits.c b/Src/Builtins/rlimits.c
index 8a13fefdf..f81ce2412 100644
--- a/Src/Builtins/rlimits.c
+++ b/Src/Builtins/rlimits.c
@@ -625,21 +625,21 @@ static struct builtin bintab[] = {
 
 /**/
 int
-setup_rlimits(Module m)
+setup_(Module m)
 {
     return 0;
 }
 
 /**/
 int
-boot_rlimits(Module m)
+boot_(Module m)
 {
     return !addbuiltins(m->nam, bintab, sizeof(bintab)/sizeof(*bintab));
 }
 
 /**/
 int
-cleanup_rlimits(Module m)
+cleanup_(Module m)
 {
     deletebuiltins(m->nam, bintab, sizeof(bintab)/sizeof(*bintab));
     return 0;
@@ -647,7 +647,7 @@ cleanup_rlimits(Module m)
 
 /**/
 int
-finish_rlimits(Module m)
+finish_(Module m)
 {
     return 0;
 }
diff --git a/Src/Builtins/rlimits.mdd b/Src/Builtins/rlimits.mdd
index 129adf901..44a92906c 100644
--- a/Src/Builtins/rlimits.mdd
+++ b/Src/Builtins/rlimits.mdd
@@ -1,3 +1,5 @@
+name=zsh/rlimits
+
 autobins="limit ulimit unlimit"
 
 objects="rlimits.o"
diff --git a/Src/Builtins/sched.c b/Src/Builtins/sched.c
index 77cc27261..9dcdd9ece 100644
--- a/Src/Builtins/sched.c
+++ b/Src/Builtins/sched.c
@@ -185,14 +185,14 @@ static struct builtin bintab[] = {
 
 /**/
 int
-setup_sched(Module m)
+setup_(Module m)
 {
     return 0;
 }
 
 /**/
 int
-boot_sched(Module m)
+boot_(Module m)
 {
     if(!addbuiltins(m->nam, bintab, sizeof(bintab)/sizeof(*bintab)))
 	return 1;
@@ -202,7 +202,7 @@ boot_sched(Module m)
 
 /**/
 int
-cleanup_sched(Module m)
+cleanup_(Module m)
 {
     struct schedcmd *sch, *schn;
 
@@ -218,7 +218,7 @@ cleanup_sched(Module m)
 
 /**/
 int
-finish_sched(Module m)
+finish_(Module m)
 {
     return 0;
 }
diff --git a/Src/Builtins/sched.mdd b/Src/Builtins/sched.mdd
index 6ed749f32..7f150f4a7 100644
--- a/Src/Builtins/sched.mdd
+++ b/Src/Builtins/sched.mdd
@@ -1,3 +1,5 @@
+name=zsh/sched
+
 autobins="sched"
 
 objects="sched.o"
diff --git a/Src/Makemod.in.in b/Src/Makemod.in.in
index 050a0682e..6d6e6af05 100644
--- a/Src/Makemod.in.in
+++ b/Src/Makemod.in.in
@@ -128,20 +128,7 @@ install.modules: install.modules-here
 uninstall.modules: uninstall.modules-here
 
 install.bin-here uninstall.bin-here:
-
-install.modules-here:
-	modules='$(MODULES)'; \
-	if test -n "$$modules"; then $(sdir_top)/mkinstalldirs $(DESTDIR)$(MODDIR); fi; \
-	for mod in $$modules; do \
-	    $(INSTALL_PROGRAM) $$mod $(DESTDIR)$(MODDIR)/$$mod; \
-	done
-
-uninstall.modules-here:
-	modules='$(MODULES)'; for mod in $$modules; do \
-	    if test -f $(DESTDIR)$(MODDIR)/$$mod; then \
-		rm -f $(DESTDIR)$(MODDIR)/$$mod; \
-	    else :; fi; \
-	done
+install.modules-here uninstall.modules-here:
 
 # ========== DEPENDENCIES FOR CLEANUP ==========
 
diff --git a/Src/Modules/cap.c b/Src/Modules/cap.c
index e2f01ddee..bc8fb5b8c 100644
--- a/Src/Modules/cap.c
+++ b/Src/Modules/cap.c
@@ -124,21 +124,21 @@ static struct builtin bintab[] = {
 
 /**/
 int
-setup_cap(Module m)
+setup_(Module m)
 {
     return 0;
 }
 
 /**/
 int
-boot_cap(Module m)
+boot_(Module m)
 {
     return !addbuiltins(m->nam, bintab, sizeof(bintab)/sizeof(*bintab));
 }
 
 /**/
 int
-cleanup_cap(Module m)
+cleanup_(Module m)
 {
     deletebuiltins(m->nam, bintab, sizeof(bintab)/sizeof(*bintab));
     return 0;
@@ -146,7 +146,7 @@ cleanup_cap(Module m)
 
 /**/
 int
-finish_cap(Module m)
+finish_(Module m)
 {
     return 0;
 }
diff --git a/Src/Modules/cap.mdd b/Src/Modules/cap.mdd
index 97f377e9d..07d46f252 100644
--- a/Src/Modules/cap.mdd
+++ b/Src/Modules/cap.mdd
@@ -1,3 +1,5 @@
+name=zsh/cap
+
 autobins="cap getcap setcap"
 
 objects="cap.o"
diff --git a/Src/Modules/clone.c b/Src/Modules/clone.c
index 59f66e1b5..112c5a51a 100644
--- a/Src/Modules/clone.c
+++ b/Src/Modules/clone.c
@@ -98,21 +98,21 @@ static struct builtin bintab[] = {
 
 /**/
 int
-setup_clone(Module m)
+setup_(Module m)
 {
     return 0;
 }
 
 /**/
 int
-boot_clone(Module m)
+boot_(Module m)
 {
     return !addbuiltins(m->nam, bintab, sizeof(bintab)/sizeof(*bintab));
 }
 
 /**/
 int
-cleanup_clone(Module m)
+cleanup_(Module m)
 {
     deletebuiltins(m->nam, bintab, sizeof(bintab)/sizeof(*bintab));
     return 0;
@@ -120,7 +120,7 @@ cleanup_clone(Module m)
 
 /**/
 int
-finish_clone(Module m)
+finish_(Module m)
 {
     return 0;
 }
diff --git a/Src/Modules/clone.mdd b/Src/Modules/clone.mdd
index 5277d3151..f5c673977 100644
--- a/Src/Modules/clone.mdd
+++ b/Src/Modules/clone.mdd
@@ -1,3 +1,5 @@
+name=zsh/clone
+
 autobins="clone"
 
 objects="clone.o"
diff --git a/Src/Modules/example.c b/Src/Modules/example.c
index 43199e350..bf4ad60fb 100644
--- a/Src/Modules/example.c
+++ b/Src/Modules/example.c
@@ -159,7 +159,7 @@ ex_wrapper(List list, FuncWrap w, char *name)
 }
 
 /*
- * boot_example is executed when the module is loaded.
+ * boot_ is executed when the module is loaded.
  */
 
 static struct builtin bintab[] = {
@@ -188,7 +188,7 @@ static struct funcwrap wrapper[] = {
 
 /**/
 int
-setup_example(Module m)
+setup_(Module m)
 {
     printf("The example module has now been set up.\n");
     fflush(stdout);
@@ -197,7 +197,7 @@ setup_example(Module m)
 
 /**/
 int
-boot_example(Module m)
+boot_(Module m)
 {
     intparam = 42;
     strparam = ztrdup("example");
@@ -214,7 +214,7 @@ boot_example(Module m)
 
 /**/
 int
-cleanup_example(Module m)
+cleanup_(Module m)
 {
     deletebuiltins(m->nam, bintab, sizeof(bintab)/sizeof(*bintab));
     deleteconddefs(m->nam, cotab, sizeof(cotab)/sizeof(*cotab));
@@ -226,7 +226,7 @@ cleanup_example(Module m)
 
 /**/
 int
-finish_example(Module m)
+finish_(Module m)
 {
     printf("Thank you for using the example module.  Have a nice day.\n");
     fflush(stdout);
diff --git a/Src/Modules/example.mdd b/Src/Modules/example.mdd
index e32e8182e..fdaf01888 100644
--- a/Src/Modules/example.mdd
+++ b/Src/Modules/example.mdd
@@ -1,3 +1,5 @@
+name=zsh/example
+
 autobins="example"
 
 autoinfixconds="ex"
diff --git a/Src/Modules/files.c b/Src/Modules/files.c
index ac3bedd04..24cc66a2b 100644
--- a/Src/Modules/files.c
+++ b/Src/Modules/files.c
@@ -714,21 +714,21 @@ static struct builtin bintab[] = {
 
 /**/
 int
-setup_files(Module m)
+setup_(Module m)
 {
     return 0;
 }
 
 /**/
 int
-boot_files(Module m)
+boot_(Module m)
 {
     return !addbuiltins(m->nam, bintab, sizeof(bintab)/sizeof(*bintab));
 }
 
 /**/
 int
-cleanup_files(Module m)
+cleanup_(Module m)
 {
     deletebuiltins(m->nam, bintab, sizeof(bintab)/sizeof(*bintab));
     return 0;
@@ -736,7 +736,7 @@ cleanup_files(Module m)
 
 /**/
 int
-finish_files(Module m)
+finish_(Module m)
 {
     return 0;
 }
diff --git a/Src/Modules/files.mdd b/Src/Modules/files.mdd
index 171790b43..508f6b9b5 100644
--- a/Src/Modules/files.mdd
+++ b/Src/Modules/files.mdd
@@ -1,3 +1,5 @@
+name=zsh/files
+
 autobins="chgrp chown ln mkdir mv rm rmdir sync"
 
 objects="files.o"
diff --git a/Src/Modules/mapfile.c b/Src/Modules/mapfile.c
index 11553609c..5bbc17eca 100644
--- a/Src/Modules/mapfile.c
+++ b/Src/Modules/mapfile.c
@@ -329,14 +329,14 @@ scanpmmapfile(HashTable ht, ScanFunc func, int flags)
 
 /**/
 int
-setup_mapfile(Module m)
+setup_(Module m)
 {
     return 0;
 }
 
 /**/
 int
-boot_mapfile(Module m)
+boot_(Module m)
 {
     /* Create the special associative array. */
 
@@ -348,7 +348,7 @@ boot_mapfile(Module m)
 
 /**/
 int
-cleanup_mapfile(Module m)
+cleanup_(Module m)
 {
     Param pm;
 
@@ -364,7 +364,7 @@ cleanup_mapfile(Module m)
 
 /**/
 int
-finish_mapfile(Module m)
+finish_(Module m)
 {
     return 0;
 }
diff --git a/Src/Modules/mapfile.mdd b/Src/Modules/mapfile.mdd
index 9adb36162..6bdd26afc 100644
--- a/Src/Modules/mapfile.mdd
+++ b/Src/Modules/mapfile.mdd
@@ -1,3 +1,5 @@
+name=zsh/mapfile
+
 autoparams="mapfile"
 
 objects="mapfile.o"
diff --git a/Src/Modules/mathfunc.c b/Src/Modules/mathfunc.c
index 06184fd96..392424a48 100644
--- a/Src/Modules/mathfunc.c
+++ b/Src/Modules/mathfunc.c
@@ -450,21 +450,21 @@ math_func(char *name, int argc, mnumber *argv, int id)
 
 /**/
 int
-setup_mathfunc(Module m)
+setup_(Module m)
 {
     return 0;
 }
 
 /**/
 int
-boot_mathfunc(Module m)
+boot_(Module m)
 {
     return !addmathfuncs(m->nam, mftab, sizeof(mftab)/sizeof(*mftab));
 }
 
 /**/
 int
-cleanup_mathfunc(Module m)
+cleanup_(Module m)
 {
     deletemathfuncs(m->nam, mftab, sizeof(mftab)/sizeof(*mftab));
     return 0;
@@ -472,7 +472,7 @@ cleanup_mathfunc(Module m)
 
 /**/
 int
-finish_mathfunc(Module m)
+finish_(Module m)
 {
     return 0;
 }
diff --git a/Src/Modules/mathfunc.mdd b/Src/Modules/mathfunc.mdd
index 33a861f77..a06d20c6d 100644
--- a/Src/Modules/mathfunc.mdd
+++ b/Src/Modules/mathfunc.mdd
@@ -1,3 +1,5 @@
+name=zsh/mathfunc
+
 autobins="mathfunc"
 
 objects="mathfunc.o"
diff --git a/Src/Modules/parameter.c b/Src/Modules/parameter.c
index 0169b4654..cd5b580ce 100644
--- a/Src/Modules/parameter.c
+++ b/Src/Modules/parameter.c
@@ -1940,7 +1940,7 @@ static struct funcwrap wrapper[] = {
 
 /**/
 int
-setup_parameter(Module m)
+setup_(Module m)
 {
     incleanup = 0;
 
@@ -1949,7 +1949,7 @@ setup_parameter(Module m)
 
 /**/
 int
-boot_parameter(Module m)
+boot_(Module m)
 {
     /* Create the special associative arrays.
      * As an example for autoloaded parameters, this is probably a bad
@@ -1987,7 +1987,7 @@ boot_parameter(Module m)
 
 /**/
 int
-cleanup_parameter(Module m)
+cleanup_(Module m)
 {
     Param pm;
     struct pardef *def;
@@ -2009,7 +2009,7 @@ cleanup_parameter(Module m)
 
 /**/
 int
-finish_parameter(Module m)
+finish_(Module m)
 {
     return 0;
 }
diff --git a/Src/Modules/parameter.mdd b/Src/Modules/parameter.mdd
index 1ee48f859..122f72bd2 100644
--- a/Src/Modules/parameter.mdd
+++ b/Src/Modules/parameter.mdd
@@ -1,3 +1,5 @@
+name=zsh/parameter
+
 autoparams="parameters commands functions dis_functions funcstack builtins dis_builtins reswords dis_reswords options modules dirstack history historywords jobtexts jobdirs jobstates nameddirs userdirs aliases dis_aliases galiases dis_galiases"
 
 objects="parameter.o"
diff --git a/Src/Modules/stat.c b/Src/Modules/stat.c
index 3a98db0e3..7e7463bb7 100644
--- a/Src/Modules/stat.c
+++ b/Src/Modules/stat.c
@@ -590,21 +590,21 @@ static struct builtin bintab[] = {
 
 /**/
 int
-setup_stat(Module m)
+setup_(Module m)
 {
     return 0;
 }
 
 /**/
 int
-boot_stat(Module m)
+boot_(Module m)
 {
     return !addbuiltins(m->nam, bintab, sizeof(bintab)/sizeof(*bintab));
 }
 
 /**/
 int
-cleanup_stat(Module m)
+cleanup_(Module m)
 {
     deletebuiltins(m->nam, bintab, sizeof(bintab)/sizeof(*bintab));
     return 0;
@@ -612,7 +612,7 @@ cleanup_stat(Module m)
 
 /**/
 int
-finish_stat(Module m)
+finish_(Module m)
 {
     return 0;
 }
diff --git a/Src/Modules/stat.mdd b/Src/Modules/stat.mdd
index b775fda09..81f73f482 100644
--- a/Src/Modules/stat.mdd
+++ b/Src/Modules/stat.mdd
@@ -1,3 +1,5 @@
+name=zsh/stat
+
 autobins="stat"
 
 objects="stat.o"
diff --git a/Src/Modules/zftp.c b/Src/Modules/zftp.c
index cf024643d..debb1a6bb 100644
--- a/Src/Modules/zftp.c
+++ b/Src/Modules/zftp.c
@@ -3201,14 +3201,14 @@ bin_zftp(char *name, char **args, char *ops, int func)
 
 /**/
 int
-setup_zftp(Module m)
+setup_(Module m)
 {
     return 0;
 }
 
 /**/
 int
-boot_zftp(Module m)
+boot_(Module m)
 {
     int ret;
     if ((ret = addbuiltins(m->nam, bintab,
@@ -3232,7 +3232,7 @@ boot_zftp(Module m)
 
 /**/
 int
-cleanup_zftp(Module m)
+cleanup_(Module m)
 {
     /*
      * There are various parameters hanging around, but they're
@@ -3260,7 +3260,7 @@ cleanup_zftp(Module m)
 
 /**/
 int
-finish_zftp(Module m)
+finish_(Module m)
 {
     return 0;
 }
diff --git a/Src/Modules/zftp.mdd b/Src/Modules/zftp.mdd
index 83051ae54..98f29b13f 100644
--- a/Src/Modules/zftp.mdd
+++ b/Src/Modules/zftp.mdd
@@ -1,3 +1,5 @@
+name=zsh/zftp
+
 autobins="zftp"
 
 objects="zftp.o"
diff --git a/Src/Modules/zprof.c b/Src/Modules/zprof.c
index 2dacd45a2..276ada4d6 100644
--- a/Src/Modules/zprof.c
+++ b/Src/Modules/zprof.c
@@ -291,14 +291,14 @@ static struct funcwrap wrapper[] = {
 
 /**/
 int
-setup_zprof(Module m)
+setup_(Module m)
 {
     return 0;
 }
 
 /**/
 int
-boot_zprof(Module m)
+boot_(Module m)
 {
     calls = NULL;
     ncalls = 0;
@@ -311,7 +311,7 @@ boot_zprof(Module m)
 
 /**/
 int
-cleanup_zprof(Module m)
+cleanup_(Module m)
 {
     freepfuncs(calls);
     freeparcs(arcs);
@@ -322,7 +322,7 @@ cleanup_zprof(Module m)
 
 /**/
 int
-finish_zprof(Module m)
+finish_(Module m)
 {
     return 0;
 }
diff --git a/Src/Modules/zprof.mdd b/Src/Modules/zprof.mdd
index de473cbba..fad9a1dbf 100644
--- a/Src/Modules/zprof.mdd
+++ b/Src/Modules/zprof.mdd
@@ -1,3 +1,5 @@
+name=zsh/zprof
+
 autobins="zprof"
 
 objects="zprof.o"
diff --git a/Src/Modules/zutil.c b/Src/Modules/zutil.c
index 590678f98..065b027ce 100644
--- a/Src/Modules/zutil.c
+++ b/Src/Modules/zutil.c
@@ -729,7 +729,7 @@ static struct builtin bintab[] = {
 
 /**/
 int
-setup_zutil(Module m)
+setup_(Module m)
 {
     zstyles = NULL;
 
@@ -738,14 +738,14 @@ setup_zutil(Module m)
 
 /**/
 int
-boot_zutil(Module m)
+boot_(Module m)
 {
     return !addbuiltins(m->nam, bintab, sizeof(bintab)/sizeof(*bintab));
 }
 
 /**/
 int
-cleanup_zutil(Module m)
+cleanup_(Module m)
 {
     deletebuiltins(m->nam, bintab, sizeof(bintab)/sizeof(*bintab));
     return 0;
@@ -753,7 +753,7 @@ cleanup_zutil(Module m)
 
 /**/
 int
-finish_zutil(Module m)
+finish_(Module m)
 {
     freestypat(zstyles);
 
diff --git a/Src/Modules/zutil.mdd b/Src/Modules/zutil.mdd
index edc1f0d32..30cd1576a 100644
--- a/Src/Modules/zutil.mdd
+++ b/Src/Modules/zutil.mdd
@@ -1,3 +1,5 @@
+name=zsh/zutil
+
 objects="zutil.o"
 
 autobins="zformat zstyle"
diff --git a/Src/Zle/compctl.c b/Src/Zle/compctl.c
index d13bc2252..69db9e04a 100644
--- a/Src/Zle/compctl.c
+++ b/Src/Zle/compctl.c
@@ -3732,7 +3732,7 @@ static struct builtin bintab[] = {
 
 /**/
 int
-setup_compctl(Module m)
+setup_(Module m)
 {
     compctlreadptr = compctlread;
     createcompctltable();
@@ -3752,7 +3752,7 @@ setup_compctl(Module m)
 
 /**/
 int
-boot_compctl(Module m)
+boot_(Module m)
 {
     addhookfunc("compctl_make", (Hookfn) ccmakehookfn);
     addhookfunc("compctl_before", (Hookfn) ccbeforehookfn);
@@ -3762,7 +3762,7 @@ boot_compctl(Module m)
 
 /**/
 int
-cleanup_compctl(Module m)
+cleanup_(Module m)
 {
     deletehookfunc("compctl_make", (Hookfn) ccmakehookfn);
     deletehookfunc("compctl_before", (Hookfn) ccbeforehookfn);
@@ -3773,7 +3773,7 @@ cleanup_compctl(Module m)
 
 /**/
 int
-finish_compctl(Module m)
+finish_(Module m)
 {
     deletehashtable(compctltab);
 
diff --git a/Src/Zle/compctl.mdd b/Src/Zle/compctl.mdd
index a76fef3a0..6da7e002b 100644
--- a/Src/Zle/compctl.mdd
+++ b/Src/Zle/compctl.mdd
@@ -1,4 +1,6 @@
-moddeps="complete zle"
+name=zsh/compctl
+
+moddeps="zsh/complete zsh/zle"
 
 autobins="compctl"
 
diff --git a/Src/Zle/complete.c b/Src/Zle/complete.c
index a78a12058..bf3102972 100644
--- a/Src/Zle/complete.c
+++ b/Src/Zle/complete.c
@@ -1350,7 +1350,7 @@ struct hookdef comphooks[] = {
 
 /**/
 int
-setup_complete(Module m)
+setup_(Module m)
 {
     hasperm = 0;
 
@@ -1371,7 +1371,7 @@ setup_complete(Module m)
 
 /**/
 int
-boot_complete(Module m)
+boot_(Module m)
 {
     addhookfunc("complete", (Hookfn) do_completion);
     addhookfunc("before_complete", (Hookfn) before_complete);
@@ -1391,7 +1391,7 @@ boot_complete(Module m)
 
 /**/
 int
-cleanup_complete(Module m)
+cleanup_(Module m)
 {
     deletehookfunc("complete", (Hookfn) do_completion);
     deletehookfunc("before_complete", (Hookfn) before_complete);
@@ -1410,7 +1410,7 @@ cleanup_complete(Module m)
 
 /**/
 int
-finish_complete(Module m)
+finish_(Module m)
 {
     if (compwords)
 	freearray(compwords);
diff --git a/Src/Zle/complete.mdd b/Src/Zle/complete.mdd
index 70e275b4e..8e9796d86 100644
--- a/Src/Zle/complete.mdd
+++ b/Src/Zle/complete.mdd
@@ -1,6 +1,8 @@
-moddeps="zle"
+name=zsh/complete
 
-autobins="compgen compadd compset"
+moddeps="zsh/zle"
+
+autobins="compadd compset"
 
 autoprefixconds="prefix suffix between after"
 
diff --git a/Src/Zle/complist.c b/Src/Zle/complist.c
index 32a2d99f3..ce00ed240 100644
--- a/Src/Zle/complist.c
+++ b/Src/Zle/complist.c
@@ -1196,14 +1196,14 @@ menuselect(char **args)
 
 /**/
 int
-setup_complist(Module m)
+setup_(Module m)
 {
     return 0;
 }
 
 /**/
 int
-boot_complist(Module m)
+boot_(Module m)
 {
     mtab = NULL;
     mgtab = NULL;
@@ -1237,7 +1237,7 @@ boot_complist(Module m)
 
 /**/
 int
-cleanup_complist(Module m)
+cleanup_(Module m)
 {
     free(mtab);
     free(mgtab);
@@ -1251,7 +1251,7 @@ cleanup_complist(Module m)
 
 /**/
 int
-finish_complist(Module m)
+finish_(Module m)
 {
     return 0;
 }
diff --git a/Src/Zle/complist.mdd b/Src/Zle/complist.mdd
index 4b6a5afe8..a7d85fad7 100644
--- a/Src/Zle/complist.mdd
+++ b/Src/Zle/complist.mdd
@@ -1,3 +1,5 @@
-moddeps="complete zle"
+name=zsh/complist
+
+moddeps="zsh/complete zsh/zle"
 
 objects="complist.o"
diff --git a/Src/Zle/computil.c b/Src/Zle/computil.c
index bb69e5bf8..6b946de93 100644
--- a/Src/Zle/computil.c
+++ b/Src/Zle/computil.c
@@ -2444,7 +2444,7 @@ static struct builtin bintab[] = {
 
 /**/
 int
-setup_computil(Module m)
+setup_(Module m)
 {
     memset(cadef_cache, 0, sizeof(cadef_cache));
     memset(cvdef_cache, 0, sizeof(cvdef_cache));
@@ -2458,14 +2458,14 @@ setup_computil(Module m)
 
 /**/
 int
-boot_computil(Module m)
+boot_(Module m)
 {
     return !addbuiltins(m->nam, bintab, sizeof(bintab)/sizeof(*bintab));
 }
 
 /**/
 int
-cleanup_computil(Module m)
+cleanup_(Module m)
 {
     deletebuiltins(m->nam, bintab, sizeof(bintab)/sizeof(*bintab));
     return 0;
@@ -2473,7 +2473,7 @@ cleanup_computil(Module m)
 
 /**/
 int
-finish_computil(Module m)
+finish_(Module m)
 {
     int i;
 
diff --git a/Src/Zle/computil.mdd b/Src/Zle/computil.mdd
index cf2a13b60..d8190580b 100644
--- a/Src/Zle/computil.mdd
+++ b/Src/Zle/computil.mdd
@@ -1,4 +1,6 @@
-moddeps="complete zle"
+name=zsh/computil
+
+moddeps="zsh/complete zsh/zle"
 
 objects="computil.o"
 
diff --git a/Src/Zle/deltochar.c b/Src/Zle/deltochar.c
index e3f9def0c..5badca411 100644
--- a/Src/Zle/deltochar.c
+++ b/Src/Zle/deltochar.c
@@ -75,14 +75,14 @@ deltochar(char **args)
 
 /**/
 int
-setup_deltochar(Module m)
+setup_(Module m)
 {
     return 0;
 }
 
 /**/
 int
-boot_deltochar(Module m)
+boot_(Module m)
 {
     w_deletetochar = addzlefunction("delete-to-char", deltochar,
                                     ZLE_KILL | ZLE_KEEPSUFFIX);
@@ -100,7 +100,7 @@ boot_deltochar(Module m)
 
 /**/
 int
-cleanup_deltochar(Module m)
+cleanup_(Module m)
 {
     deletezlefunction(w_deletetochar);
     deletezlefunction(w_zaptochar);
@@ -109,7 +109,7 @@ cleanup_deltochar(Module m)
 
 /**/
 int
-finish_deltochar(Module m)
+finish_(Module m)
 {
     return 0;
 }
diff --git a/Src/Zle/deltochar.mdd b/Src/Zle/deltochar.mdd
index 4d1f89d1c..38cedb2a7 100644
--- a/Src/Zle/deltochar.mdd
+++ b/Src/Zle/deltochar.mdd
@@ -1,3 +1,5 @@
-moddeps="zle"
+name=zsh/deltochar
+
+moddeps="zsh/zle"
 
 objects="deltochar.o"
diff --git a/Src/Zle/zle.mdd b/Src/Zle/zle.mdd
index a5307084a..23292dfb3 100644
--- a/Src/Zle/zle.mdd
+++ b/Src/Zle/zle.mdd
@@ -1,3 +1,5 @@
+name=zsh/zle
+
 autobins="bindkey vared zle"
 
 objects="zle_bindings.o zle_hist.o zle_keymap.o zle_main.o \
diff --git a/Src/Zle/zle_main.c b/Src/Zle/zle_main.c
index 420494a52..4b572be25 100644
--- a/Src/Zle/zle_main.c
+++ b/Src/Zle/zle_main.c
@@ -1003,7 +1003,7 @@ mod_export struct hookdef zlehooks[] = {
 
 /**/
 int
-setup_zle(Module m)
+setup_(Module m)
 {
     /* Set up editor entry points */
     trashzleptr = trashzle;
@@ -1036,7 +1036,7 @@ setup_zle(Module m)
 
 /**/
 int
-boot_zle(Module m)
+boot_(Module m)
 {
     addbuiltins(m->nam, bintab, sizeof(bintab)/sizeof(*bintab));
     addhookdefs(m->nam, zlehooks, sizeof(zlehooks)/sizeof(*zlehooks));
@@ -1045,7 +1045,7 @@ boot_zle(Module m)
 
 /**/
 int
-cleanup_zle(Module m)
+cleanup_(Module m)
 {
     if(zleactive) {
 	zerrnam(m->nam, "can't unload the zle module while zle is active",
@@ -1059,7 +1059,7 @@ cleanup_zle(Module m)
 
 /**/
 int
-finish_zle(Module m)
+finish_(Module m)
 {
     int i;
 
diff --git a/Src/Zle/zle_thingy.c b/Src/Zle/zle_thingy.c
index 3d8eb41b2..2066fe2ed 100644
--- a/Src/Zle/zle_thingy.c
+++ b/Src/Zle/zle_thingy.c
@@ -546,7 +546,7 @@ bin_zle_complete(char *name, char **args, char *ops, char func)
     Thingy t;
     Widget w, cw;
 
-    if (!require_module(name, "complete", 0, 0)) {
+    if (!require_module(name, "zsh/complete", 0, 0)) {
 	zerrnam(name, "can't load complete module", NULL, 0);
 	return 1;
     }
diff --git a/Src/Zle/zleparameter.c b/Src/Zle/zleparameter.c
index c4347de6b..d10fe99b1 100644
--- a/Src/Zle/zleparameter.c
+++ b/Src/Zle/zleparameter.c
@@ -198,14 +198,14 @@ static struct pardef partab[] = {
 
 /**/
 int
-setup_zleparameter(Module m)
+setup_(Module m)
 {
     return 0;
 }
 
 /**/
 int
-boot_zleparameter(Module m)
+boot_(Module m)
 {
     struct pardef *def;
 
@@ -232,7 +232,7 @@ boot_zleparameter(Module m)
 
 /**/
 int
-cleanup_zleparameter(Module m)
+cleanup_(Module m)
 {
     Param pm;
     struct pardef *def;
@@ -249,7 +249,7 @@ cleanup_zleparameter(Module m)
 
 /**/
 int
-finish_zleparameter(Module m)
+finish_(Module m)
 {
     return 0;
 }
diff --git a/Src/Zle/zleparameter.mdd b/Src/Zle/zleparameter.mdd
index d18b89662..6c88db966 100644
--- a/Src/Zle/zleparameter.mdd
+++ b/Src/Zle/zleparameter.mdd
@@ -1,4 +1,6 @@
-moddeps="zle"
+name=zsh/zleparameter
+
+moddeps="zsh/zle"
 
 autoparams="widgets keymaps"
 
diff --git a/Src/init.c b/Src/init.c
index c53c81622..5c2a68728 100644
--- a/Src/init.c
+++ b/Src/init.c
@@ -943,7 +943,7 @@ init_bltinmods(void)
 
 #include "bltinmods.list"
 
-    load_module("zsh");
+    load_module("zsh/main");
 }
 
 /**/
@@ -965,7 +965,7 @@ noop_function_int(int nothing)
  * avoid wasting space with the fallback functions.  No other source    *
  * file needs to know which modules are linked in.                      */
 
-#ifdef LINKED_XMOD_zle
+#ifdef LINKED_XMOD_zshQszle
 
 /**/
 mod_export ZleVoidFn trashzleptr = noop_function;
@@ -978,26 +978,26 @@ mod_export ZleVoidIntFn spaceinlineptr = noop_function_int;
 /**/
 mod_export ZleReadFn zlereadptr = autoload_zleread;
 
-#else /* !LINKED_XMOD_zle */
+#else /* !LINKED_XMOD_zshQszle */
 
 mod_export ZleVoidFn trashzleptr = noop_function;
 mod_export ZleVoidFn gotwordptr = noop_function;
 mod_export ZleVoidFn refreshptr = noop_function;
 mod_export ZleVoidIntFn spaceinlineptr = noop_function_int;
-# ifdef UNLINKED_XMOD_zle
+# ifdef UNLINKED_XMOD_zshQszle
 mod_export ZleReadFn zlereadptr = autoload_zleread;
-# else /* !UNLINKED_XMOD_zle */
+# else /* !UNLINKED_XMOD_zshQszle */
 mod_export ZleReadFn zlereadptr = fallback_zleread;
-# endif /* !UNLINKED_XMOD_zle */
+# endif /* !UNLINKED_XMOD_zshQszle */
 
-#endif /* !LINKED_XMOD_zle */
+#endif /* !LINKED_XMOD_zshQszle */
 
 /**/
 unsigned char *
 autoload_zleread(char *lp, char *rp, int ha)
 {
     zlereadptr = fallback_zleread;
-    load_module("zle");
+    load_module("zsh/zle");
     return zleread(lp, rp, ha);
 }
 
diff --git a/Src/makepro.awk b/Src/makepro.awk
index 350b2f9c8..eb063f092 100644
--- a/Src/makepro.awk
+++ b/Src/makepro.awk
@@ -109,15 +109,6 @@ BEGIN {
 	gsub(/@>/, ")", dcltor)
 	gsub(/@!/, ",", dcltor)
 
-	# If this is a module boot/cleanup function, conditionally rename it.
-	if(" " dtype " " ~ / int / && dcltor ~ / *@\+(boot|cleanup|setup|finish)_[_0-9A-Za-z]+@- *_\(\( *Module +[_0-9A-Za-z]+ *\)\) */) {
-	    modtype = dnam
-	    sub(/_.*$/, "", modtype)
-	    printf "%s# if defined(DYNAMIC_NAME_CLASH_OK) && defined(MODULE)\n", locality
-	    printf "%s#  define " dnam " " modtype "_\n", locality
-	    printf "%s# endif\n", locality
-	}
-
 	# If this is exported, add it to the exported symbol list.
 	if(exported)
 	    printf "X%s\n", dnam
diff --git a/Src/mkbltnmlst.sh b/Src/mkbltnmlst.sh
index 8e970d45e..94043cb9c 100644
--- a/Src/mkbltnmlst.sh
+++ b/Src/mkbltnmlst.sh
@@ -11,7 +11,7 @@ test "x$srcdir" = "x"   && srcdir=.
 MODBINS=${MODBINS-modules-bltin}
 XMODCF=${XMODCF-$srcdir/xmods.conf}
 
-bin_mods=" zsh "`sed 's/^/ /;s/$/ /' $MODBINS`
+bin_mods=" zsh/main "`sed 's/^/ /;s/$/ /' $MODBINS`
 x_mods=`cat $XMODCF`
 . ./modules.index
 
@@ -20,6 +20,7 @@ trap "rm -f $1; exit 1" 1 2 15
 exec > $1
 
 for x_mod in $x_mods; do
+    q_x_mod=`echo $x_mod | sed 's,Q,Qq,g;s,_,Qu,g;s,/,Qs,g'`
     case "$bin_mods" in
     *" $x_mod "*)
         echo "/* linked-in known module \`$x_mod' */"
@@ -30,10 +31,10 @@ for x_mod in $x_mods; do
         echo "/* non-linked-in known module \`$x_mod' */"
 	linked=no
     esac
-    eval "loc=\$loc_$x_mod"
+    eval "modfile=\$modfile_$q_x_mod"
     unset moddeps autobins autoinfixconds autoprefixconds autoparams
     unset automathfuncs
-    . $srcdir/../$loc/${x_mod}.mdd
+    . $srcdir/../$modfile
     for bin in $autobins; do
 	echo "    add_autobin(\"$bin\", \"$x_mod\");"
     done
@@ -58,10 +59,11 @@ done
 echo
 done_mods=" "
 for bin_mod in $bin_mods; do
+    q_bin_mod=`echo $bin_mod | sed 's,Q,Qq,g;s,_,Qu,g;s,/,Qs,g'`
     echo "/* linked-in module \`$bin_mod' */"
-    eval "loc=\$loc_$bin_mod"
+    eval "modfile=\$modfile_$q_bin_mod"
     unset moddeps
-    . $srcdir/../$loc/${bin_mod}.mdd
+    . $srcdir/../$modfile
     for dep in $moddeps; do
 	case $done_mods in
 	    *" $dep "*)
@@ -72,14 +74,14 @@ for bin_mod in $bin_mods; do
 	esac
     done
     echo "    {"
-    echo "        extern int setup_${bin_mod} _((Module));"
-    echo "        extern int boot_${bin_mod} _((Module));"
-    echo "        extern int cleanup_${bin_mod} _((Module));"
-    echo "        extern int finish_${bin_mod} _((Module));"
+    echo "        extern int setup_${q_bin_mod} _((Module));"
+    echo "        extern int boot_${q_bin_mod} _((Module));"
+    echo "        extern int cleanup_${q_bin_mod} _((Module));"
+    echo "        extern int finish_${q_bin_mod} _((Module));"
     echo
     echo "        register_module(\"$bin_mod\","
-    echo "                        setup_${bin_mod}, boot_${bin_mod},"
-    echo "                        cleanup_${bin_mod}, finish_${bin_mod});"
+    echo "                        setup_${q_bin_mod}, boot_${q_bin_mod},"
+    echo "                        cleanup_${q_bin_mod}, finish_${q_bin_mod});"
     echo "    }"
     done_mods="$done_mods$bin_mod "
 done
diff --git a/Src/mkmakemod.sh b/Src/mkmakemod.sh
index aa7558452..e8005dea7 100644
--- a/Src/mkmakemod.sh
+++ b/Src/mkmakemod.sh
@@ -17,8 +17,9 @@
 # defines one module.  The .mdd file is actually a shell script, which will
 # be sourced.  It may define the following shell variables:
 #
+#   name            name of this module
 #   moddeps         modules on which this module depends (default none)
-#   nozshdep        non-empty indicates no dependence on the `zsh' pseudo-module
+#   nozshdep        non-empty indicates no dependence on the `zsh/main' pseudo-module
 #   alwayslink      if non-empty, always link the module into the executable
 #   autobins        builtins defined by the module, for autoloading
 #   autoinfixconds  infix condition codes defined by the module, for
@@ -103,14 +104,14 @@ if $first_stage; then
     echo
 
     . Src/modules.index
-    bin_mods=" zsh "`sed 's/^/ /;s/$/ /' Src/modules-bltin`
+    bin_mods=" zsh/main "`sed 's/^/ /;s/$/ /' Src/modules-bltin`
     if grep '%@D@%D%' config.status >/dev/null; then
 	is_dynamic=true
     else
 	is_dynamic=false
     fi
 
-    here_modules=
+    here_mddnames=
     all_subdirs=
     all_modobjs=
     all_modules=
@@ -119,30 +120,31 @@ if $first_stage; then
     all_proto=
     lastsub=//
     for module in $module_list; do
-	eval "loc=\$loc_$module"
-	case $loc in
-	    $the_subdir)
-		here_modules="$here_modules $module"
+	q_module=`echo $module | sed 's,Q,Qq,g;s,_,Qu,g;s,/,Qs,g'`
+	eval "modfile=\$modfile_$q_module"
+	case $modfile in
+	    $the_subdir/$lastsub/*) ;;
+	    $the_subdir/*/*)
+		lastsub=`echo $modfile | sed 's,^'$the_subdir'/,,;s,/[^/]*$,,'`
+		all_subdirs="$all_subdirs $lastsub"
+		;;
+	    $the_subdir/*)
+		mddname=`echo $modfile | sed 's,^.*/,,;s,\.mdd$,,'`
+		here_mddnames="$here_mddnames $mddname"
 		build=$is_dynamic
 		case $is_dynamic@$bin_mods in
 		    *" $module "*)
 			build=true
-			all_modobjs="$all_modobjs modobjs.${module}" ;;
+			all_modobjs="$all_modobjs modobjs.${mddname}" ;;
 		    true@*)
-			all_modules="$all_modules ${module}.\$(DL_EXT)" ;;
+			all_modules="$all_modules ${mddname}.\$(DL_EXT)" ;;
 		esac
-		all_mdds="$all_mdds ${module}.mdd"
-		$build && all_mdhs="$all_mdhs ${module}.mdh"
-		$build && all_proto="$all_proto proto.${module}"
-		;;
-	    $lastsub | $lastsub/*) ;;
-	    $the_subdir/*)
-		all_subdirs="$all_subdirs $loc"
-		lastsub=$loc
+		all_mdds="$all_mdds ${mddname}.mdd"
+		$build && all_mdhs="$all_mdhs ${mddname}.mdh"
+		$build && all_proto="$all_proto proto.${mddname}"
 		;;
 	esac
     done
-    all_subdirs=`echo "$all_subdirs" | sed "s' $the_subdir/' 'g"`
     echo "MODOBJS =$all_modobjs"
     echo "MODULES =$all_modules"
     echo "MDDS    =$all_mdds"
@@ -169,36 +171,41 @@ if $first_stage; then
 
     other_mdhs=
     remote_mdhs=
-    for module in $here_modules; do
+    for mddname in $here_mddnames; do
 
-	unset moddeps nozshdep alwayslink hasexport
+	unset name moddeps nozshdep alwayslink hasexport
 	unset autobins autoinfixconds autoprefixconds autoparams automathfuncs
 	unset objects proto headers hdrdeps otherincs
-	. $top_srcdir/$the_subdir/${module}.mdd
+	. $top_srcdir/$the_subdir/${mddname}.mdd
+	q_name=`echo $name | sed 's,Q,Qq,g;s,_,Qu,g;s,/,Qs,g'`
 	test -n "${moddeps+set}" || moddeps=
-	test -n "$nozshdep" || moddeps="$moddeps zsh"
+	test -n "$nozshdep" || moddeps="$moddeps zsh/main"
 	test -n "${proto+set}" ||
 	    proto=`echo $objects '' | sed 's,\.o ,.syms ,g'`
 
 	dobjects=`echo $objects '' | sed 's,\.o ,..o ,g'`
 	modhdeps=
 	imports=
+	q_moddeps=
 	for dep in $moddeps; do
-	    eval "loc=\$loc_$dep"
-	    imports="$imports \$(IMPOPT)\$(dir_top)/$loc/$dep.export"
+	    q_dep=`echo $dep | sed 's,Q,Qq,g;s,_,Qu,g;s,/,Qs,g'`
+	    q_moddeps="$q_moddeps $q_dep"
+	    eval "depfile=\$modfile_$q_dep"
+	    eval `echo $depfile | sed 's,/\([^/]*\)\.mdd$,;depbase=\1,;s,^,loc=,'`
+	    imports="$imports \$(IMPOPT)\$(dir_top)/$loc/${depbase}.export"
 	    case $the_subdir in
 		$loc)
-		    mdh="${dep}.mdh"
+		    mdh="${depbase}.mdh"
 		    ;;
 		$loc/*)
-		    mdh="\$(dir_top)/$loc/${dep}.mdh"
+		    mdh="\$(dir_top)/$loc/${depbase}.mdh"
 		    case "$other_mdhs " in
 			*" $mdh "*) ;;
 			*) other_mdhs="$other_mdhs $mdh" ;;
 		    esac
 		    ;;
 		*)
-		    mdh="\$(dir_top)/$loc/${dep}.mdh"
+		    mdh="\$(dir_top)/$loc/${depbase}.mdh"
 		    case "$remote_mdhs " in
 			*" $mdh "*) ;;
 			*) remote_mdhs="$remote_mdhs $mdh" ;;
@@ -208,64 +215,91 @@ if $first_stage; then
 	    modhdeps="$modhdeps $mdh"
 	done
 
-	echo "##### ===== DEPENDENCIES GENERATED FROM ${module}.mdd ===== #####"
+	echo "##### ===== DEPENDENCIES GENERATED FROM ${mddname}.mdd ===== #####"
 	echo
-	echo "MODOBJS_${module} = $objects"
-	echo "MODDOBJS_${module} = $dobjects \$(@E@NTRYOBJ)"
-	echo "SYMS_${module} = $proto"
-	echo "EPRO_${module} = "`echo $proto '' | sed 's,\.syms ,.epro ,g'`
-	echo "INCS_${module} = \$(EPRO_${module}) $otherincs"
-	echo "EXPIMP_${module} = $imports \$(EXPOPT)$module.export"
-	echo "NXPIMP_${module} ="
+	echo "MODOBJS_${mddname} = $objects"
+	echo "MODDOBJS_${mddname} = $dobjects \$(@E@NTRYOBJ)"
+	echo "SYMS_${mddname} = $proto"
+	echo "EPRO_${mddname} = "`echo $proto '' | sed 's,\.syms ,.epro ,g'`
+	echo "INCS_${mddname} = \$(EPRO_${mddname}) $otherincs"
+	echo "EXPIMP_${mddname} = $imports \$(EXPOPT)$mddname.export"
+	echo "NXPIMP_${mddname} ="
 	echo
-	echo "proto.${module}: \$(EPRO_${module})"
-	echo "\$(SYMS_${module}): \$(PROTODEPS)"
+	echo "proto.${mddname}: \$(EPRO_${mddname})"
+	echo "\$(SYMS_${mddname}): \$(PROTODEPS)"
 	echo
-	echo "${module}.export: \$(SYMS_${module})"
-	echo "	( echo '#!'; cat \$(SYMS_${module}) | sed -n '/^X/{s/^X//;p;}' | sort -u ) > \$@"
+	echo "${mddname}.export: \$(SYMS_${mddname})"
+	echo "	( echo '#!'; cat \$(SYMS_${mddname}) | sed -n '/^X/{s/^X//;p;}' | sort -u ) > \$@"
 	echo
-	echo "modobjs.${module}: \$(MODOBJS_${module})"
-	echo "	echo '' \$(MODOBJS_${module}) $modobjs_sed>> \$(dir_src)/stamp-modobjs.tmp"
+	echo "modobjs.${mddname}: \$(MODOBJS_${mddname})"
+	echo "	echo '' \$(MODOBJS_${mddname}) $modobjs_sed>> \$(dir_src)/stamp-modobjs.tmp"
 	echo
 	if test -z "$alwayslink"; then
-	    echo "${module}.\$(DL_EXT): \$(MODDOBJS_${module}) ${module}.export"
+	    case " $all_modules" in *" ${mddname}."*)
+		echo "install.modules-here: install.modules.${mddname}"
+		echo "uninstall.modules-here: uninstall.modules.${mddname}"
+		echo
+	    ;; esac
+	    instsubdir=`echo $name | sed 's,^,/,;s,/[^/]*$,,'`
+	    echo "install.modules.${mddname}: ${mddname}.\$(DL_EXT)"
+	    echo "	\$(sdir_top)/mkinstalldirs \$(DESTDIR)\$(MODDIR)${instsubdir}"
+	    echo "	\$(INSTALL_PROGRAM) ${mddname}.\$(DL_EXT) \$(DESTDIR)\$(MODDIR)/${name}.\$(DL_EXT)"
+	    echo
+	    echo "uninstall.modules.${mddname}:"
+	    echo "	rm -f \$(DESTDIR)\$(MODDIR)/${name}.\$(DL_EXT)"
+	    echo
+	    echo "${mddname}.\$(DL_EXT): \$(MODDOBJS_${mddname}) ${mddname}.export"
 	    echo '	rm -f $@'
-	    echo "	\$(DLLINK) \$(@E@XPIMP_$module) \$(@E@NTRYOPT) \$(MODDOBJS_${module}) \$(LIBS)"
+	    echo "	\$(DLLINK) \$(@E@XPIMP_$mddname) \$(@E@NTRYOPT) \$(MODDOBJS_${mddname}) \$(LIBS)"
 	    echo
 	fi
-	echo "${module}.mdhi: ${module}.mdhs \$(INCS_${module})"
+	echo "${mddname}.mdhi: ${mddname}.mdhs \$(INCS_${mddname})"
 	echo "	@test -f \$@ || echo 'do not delete this file' > \$@"
 	echo
-	echo "${module}.mdhs: ${module}.mdd"
-	echo "	@\$(MAKE) -f \$(makefile) \$(MAKEDEFS) ${module}.mdh.tmp"
-	echo "	@if cmp -s ${module}.mdh ${module}.mdh.tmp; then \\"
-	echo "	    rm -f ${module}.mdh.tmp; \\"
-	echo "	    echo \"\\\`${module}.mdh' is up to date.\"; \\"
+	echo "${mddname}.mdhs: ${mddname}.mdd"
+	echo "	@\$(MAKE) -f \$(makefile) \$(MAKEDEFS) ${mddname}.mdh.tmp"
+	echo "	@if cmp -s ${mddname}.mdh ${mddname}.mdh.tmp; then \\"
+	echo "	    rm -f ${mddname}.mdh.tmp; \\"
+	echo "	    echo \"\\\`${mddname}.mdh' is up to date.\"; \\"
 	echo "	else \\"
-	echo "	    mv -f ${module}.mdh.tmp ${module}.mdh; \\"
-	echo "	    echo \"Updated \\\`${module}.mdh'.\"; \\"
+	echo "	    mv -f ${mddname}.mdh.tmp ${mddname}.mdh; \\"
+	echo "	    echo \"Updated \\\`${mddname}.mdh'.\"; \\"
 	echo "	fi"
-	echo "	echo 'timestamp for ${module}.mdh against ${module}.mdd' > \$@"
+	echo "	echo 'timestamp for ${mddname}.mdh against ${mddname}.mdd' > \$@"
 	echo
-	echo "${module}.mdh: ${modhdeps} ${headers} ${hdrdeps} ${module}.mdhi"
-	echo "	@\$(MAKE) -f \$(makefile) \$(MAKEDEFS) ${module}.mdh.tmp"
-	echo "	@mv -f ${module}.mdh.tmp ${module}.mdh"
-	echo "	@echo \"Updated \\\`${module}.mdh'.\""
+	echo "${mddname}.mdh: ${modhdeps} ${headers} ${hdrdeps} ${mddname}.mdhi"
+	echo "	@\$(MAKE) -f \$(makefile) \$(MAKEDEFS) ${mddname}.mdh.tmp"
+	echo "	@mv -f ${mddname}.mdh.tmp ${mddname}.mdh"
+	echo "	@echo \"Updated \\\`${mddname}.mdh'.\""
 	echo
-	echo "${module}.mdh.tmp:"
+	echo "${mddname}.mdh.tmp:"
 	echo "	@( \\"
-	echo "	    echo '#ifndef have_${module}_module'; \\"
-	echo "	    echo '#define have_${module}_module'; \\"
+	echo "	    echo '#ifndef have_${q_name}_module'; \\"
+	echo "	    echo '#define have_${q_name}_module'; \\"
+	echo "	    echo; \\"
+	echo "	    echo '# ifndef IMPORTING_MODULE_${q_name}'; \\"
+	echo "	    if test @SHORTBOOTNAMES@ = yes; then \\"
+	echo "		echo '#  ifndef MODULE'; \\"
+	echo "	    fi; \\"
+	echo "	    echo '#   define boot_ boot_${q_name}'; \\"
+	echo "	    echo '#   define cleanup_ cleanup_${q_name}'; \\"
+	echo "	    echo '#   define setup_ setup_${q_name}'; \\"
+	echo "	    echo '#   define finish_ finish_${q_name}'; \\"
+	echo "	    if test @SHORTBOOTNAMES@ = yes; then \\"
+	echo "		echo '#  endif /* !MODULE */'; \\"
+	echo "	    fi; \\"
+	echo "	    echo '# endif /* !IMPORTING_MODULE_${q_name} */'; \\"
 	echo "	    echo; \\"
-	if test -n "$moddeps"; then
+	if test -n "$moddeps"; then (
+	    set x $q_moddeps
 	    echo "	    echo '/* Module dependencies */'; \\"
-	    echo "	    for mod in $modhdeps; do \\"
-	    echo "		echo '# define USING_MODULE'; \\"
-	    echo "		echo '# include \"'\$\$mod'\"'; \\"
-	    echo "	    done; \\"
-	    echo "	    echo '# undef USING_MODULE'; \\"
+	    for hdep in $modhdeps; do
+		shift
+		echo "	    echo '# define IMPORTING_MODULE_${1} 1'; \\"
+		echo "	    echo '# include \"${hdep}\"'; \\"
+	    done
 	    echo "	    echo; \\"
-	fi
+	) fi
 	if test -n "$headers"; then
 	    echo "	    echo '/* Extra headers for this module */'; \\"
 	    echo "	    for hdr in $headers; do \\"
@@ -278,18 +312,18 @@ if $first_stage; then
 	    echo "	    echo; \\"
 	fi
 	if test -n "$proto"; then
-	    echo "	    for epro in \$(EPRO_${module}); do \\"
+	    echo "	    for epro in \$(EPRO_${mddname}); do \\"
 	    echo "		echo '# include \"'\$\$epro'\"'; \\"
 	    echo "	    done; \\"
 	    echo "	    echo; \\"
 	fi
-	echo "	    echo '#endif /* !have_${module}_module */'; \\"
+	echo "	    echo '#endif /* !have_${q_name}_module */'; \\"
 	echo "	) > \$@"
 	echo
-	echo "\$(MODOBJS_${module}) \$(MODDOBJS_${module}): ${module}.mdh"
+	echo "\$(MODOBJS_${mddname}) \$(MODDOBJS_${mddname}): ${mddname}.mdh"
 	sed -e '/^ *: *<< *\\Make *$/,/^Make$/!d' \
 	    -e 's/^ *: *<< *\\Make *$//; /^Make$/d' \
-	    < $top_srcdir/$the_subdir/${module}.mdd
+	    < $top_srcdir/$the_subdir/${mddname}.mdd
 	echo
 
     done
diff --git a/Src/mkmodindex.sh b/Src/mkmodindex.sh
index b4616f638..75a7e43bc 100644
--- a/Src/mkmodindex.sh
+++ b/Src/mkmodindex.sh
@@ -13,28 +13,25 @@ while test $# -ne 0; do
     dir=$1
     shift
     ( set $dir/*.mdd; test -f $1 ) || continue
-    dosubs=false
-    for mod in `echo '' $dir/*.mdd '' | sed 's, [^ ]*/, ,g;s,\.mdd , ,g'`; do
-	case `echo "$mod@ $module_list " | sed 's,^.*[^_0-9A-Za-z].*@,@@,'` in
-	    @@*)
-		echo >&2 "WARNING: illegally named module \`$mod' in $dir"
-		echo >&2 "         (ignoring it)"
-		;;
-	    *@*" $mod "*)
-		eval "loc=\$loc_$mod"
-		echo >&2 "WARNING: module \`$mod' (in $loc) duplicated in $dir"
-		echo >&2 "         (ignoring duplicate)"
-		dosubs=true
-		;;
-	    *)
-		module_list="$module_list$mod "
-		echo "loc_$mod=$dir"
-		eval "loc_$mod=\$dir"
-		dosubs=true
-		;;
-	esac
+    for modfile in $dir/*.mdd; do
+	name=`( . $modfile; echo $name )`
+	case "$name" in *[!/_0-9A-Za-z]* | /* | */ | *//*)
+	    echo >&2 "WARNING: illegally named module \`$name' in $modfile"
+	    echo >&2 "         (ignoring it)"
+	    continue
+	;; esac
+	q_name=`echo $name | sed 's,Q,Qq,g;s,_,Qu,g;s,/,Qs,g'`
+	case " $module_list " in *" $name "*)
+	    eval "omodfile=\$modfile_$q_name"
+	    echo >&2 "WARNING: module \`$name' (in $omodfile) duplicated in $modfile"
+	    echo >&2 "         (ignoring duplicate)"
+	    continue
+	;; esac
+	module_list="$module_list$name "
+	echo "modfile_$q_name=$modfile"
+	eval "modfile_$q_name=\$modfile"
     done
-    $dosubs && set `echo $dir/*/. '' | sed 's,/\. , ,g'` "$@"
+    set `echo $dir/*/. '' | sed 's,/\. , ,g'` "$@"
 done
 
 echo
diff --git a/Src/module.c b/Src/module.c
index 09507d73f..fc7f7a722 100644
--- a/Src/module.c
+++ b/Src/module.c
@@ -36,34 +36,34 @@
 LinkList linkedmodules;
 
 
-/* The `zsh' module contains all the base code that can't actually be built *
- * as a separate module.  It is initialised by main(), so there's nothing   *
- * for the boot function to do.                                             */
+/* The `zsh/main' module contains all the base code that can't actually be *
+ * built as a separate module.  It is initialised by main(), so there's    *
+ * nothing for the boot function to do.                                    */
 
 /**/
 int
-setup_zsh(Module m)
+setup_(Module m)
 {
     return 0;
 }
 
 /**/
 int
-boot_zsh(Module m)
+boot_(Module m)
 {
     return 0;
 }
 
 /**/
 int
-cleanup_zsh(Module m)
+cleanup_(Module m)
 {
     return 0;
 }
 
 /**/
 int
-finish_zsh(Module m)
+finish_(Module m)
 {
     return 0;
 }
@@ -358,22 +358,14 @@ hpux_dlsym(void *handle, char *name)
 
 #ifdef DLSYM_NEEDS_UNDERSCORE
 # define STR_SETUP     "_setup_"
-# define STR_SETUP_S   "_setup_%s"
 # define STR_BOOT      "_boot_"
-# define STR_BOOT_S    "_boot_%s"
 # define STR_CLEANUP   "_cleanup_"
-# define STR_CLEANUP_S "_cleanup_%s"
 # define STR_FINISH    "_finish_"
-# define STR_FINISH_S  "_finish_%s"
 #else /* !DLSYM_NEEDS_UNDERSCORE */
 # define STR_SETUP     "setup_"
-# define STR_SETUP_S   "setup_%s"
 # define STR_BOOT      "boot_"
-# define STR_BOOT_S    "boot_%s"
 # define STR_CLEANUP   "cleanup_"
-# define STR_CLEANUP_S "cleanup_%s"
 # define STR_FINISH    "finish_"
-# define STR_FINISH_S  "finish_%s"
 #endif /* !DLSYM_NEEDS_UNDERSCORE */
 
 /**/
@@ -395,21 +387,11 @@ try_load_module(char const *name)
     void *ret = NULL;
     int l;
 
-    if (strchr(name, '/')) {
-	ret = dlopen(unmeta(name), RTLD_LAZY | RTLD_GLOBAL);
-	if (ret || 
-	    unset(PATHDIRS) ||
-	    (*name == '/') ||
-	    (*name == '.' && name[1] == '/') ||
-	    (*name == '.' && name[1] == '.' && name[2] == '/'))
-	    return ret;
-    }
-
-    l = strlen(name) + 1;
+    l = 1 + strlen(name) + 1 + strlen(DL_EXT);
     for (pp = module_path; !ret && *pp; pp++) {
 	if (l + (**pp ? strlen(*pp) : 1) > PATH_MAX)
 	    continue;
-	sprintf(buf, "%s/%s", **pp ? *pp : ".", name);
+	sprintf(buf, "%s/%s.%s", **pp ? *pp : ".", name, DL_EXT);
 	ret = dlopen(unmeta(buf), RTLD_LAZY | RTLD_GLOBAL);
     }
 
@@ -420,15 +402,9 @@ try_load_module(char const *name)
 static void *
 do_load_module(char const *name)
 {
-    void *ret = NULL;
-    char buf[PATH_MAX + 1];
+    void *ret;
 
-    if (strlen(name) + strlen(DL_EXT) < PATH_MAX) {
-	sprintf(buf, "%s.%s", name, DL_EXT);
-	ret = try_load_module(buf);
-    }
-    if (!ret)
-	ret = try_load_module(name);
+    ret = try_load_module(name);
     if (!ret) {
 	int waserr = errflag;
 	zerr("failed to load module: %s", name, 0);
@@ -505,37 +481,39 @@ dyn_finish_module(Module m)
 #else
 
 static Module_func
-module_func(Module m, char *name, char *name_s)
+module_func(Module m, char *name)
 {
-    char *s, *t;
-#ifndef DYNAMIC_NAME_CLASH_OK
-    char buf[PATH_MAX + 1];
-#endif
-    Module_func fn;
-
-    s = strrchr(m->nam, '/');
-    if (s)
-	s = dupstring(++s);
-    else
-	s = m->nam;
-    if ((t = strrchr(s, '.')))
-	*t = '\0';
 #ifdef DYNAMIC_NAME_CLASH_OK
-    fn = (Module_func) dlsym(m->u.handle, name);
+    return (Module_func) dlsym(m->u.handle, name);
 #else /* !DYNAMIC_NAME_CLASH_OK */
-    if (strlen(s) + 6 > PATH_MAX)
-	return NULL;
-    sprintf(buf, name_s, s);
-    fn = (Module_func) dlsym(m->u.handle, buf);
+    VARARR(char, buf, strlen(name) + strlen(m->nam)*2 + 1);
+    char const *p;
+    char *q;
+    strcpy(buf, name);
+    q = strchr(buf, 0);
+    for(p = m->nam; *p; p++) {
+	if(*p == '/') {
+	    *q++ = 'Q';
+	    *q++ = 's';
+	} else if(*p == '_') {
+	    *q++ = 'Q';
+	    *q++ = 'u';
+	} else if(*p == 'Q') {
+	    *q++ = 'Q';
+	    *q++ = 'q';
+	} else
+	    *q++ = *p;
+    }
+    *q = 0;
+    return (Module_func) dlsym(m->u.handle, buf);
 #endif /* !DYNAMIC_NAME_CLASH_OK */
-    return fn;
 }
 
 /**/
 static int
 dyn_setup_module(Module m)
 {
-    Module_func fn = module_func(m, STR_SETUP, STR_SETUP_S);
+    Module_func fn = module_func(m, STR_SETUP);
 
     if (fn)
 	return fn(m);
@@ -547,7 +525,7 @@ dyn_setup_module(Module m)
 static int
 dyn_boot_module(Module m)
 {
-    Module_func fn = module_func(m, STR_BOOT, STR_BOOT_S);
+    Module_func fn = module_func(m, STR_BOOT);
 
     if(fn)
 	return fn(m);
@@ -559,7 +537,7 @@ dyn_boot_module(Module m)
 static int
 dyn_cleanup_module(Module m)
 {
-    Module_func fn = module_func(m, STR_CLEANUP, STR_CLEANUP_S);
+    Module_func fn = module_func(m, STR_CLEANUP);
 
     if(fn)
 	return fn(m);
@@ -574,7 +552,7 @@ dyn_cleanup_module(Module m)
 static int
 dyn_finish_module(Module m)
 {
-    Module_func fn = module_func(m, STR_FINISH, STR_FINISH_S);
+    Module_func fn = module_func(m, STR_FINISH);
     int r;
 
     if (fn)
@@ -657,6 +635,22 @@ finish_module(Module m)
 #endif /* !DYNAMIC */
 
 /**/
+static int
+modname_ok(char const *p)
+{
+    do {
+	if(*p != '_' && !ialnum(*p))
+	    return 0;
+	do {
+	    p++;
+	} while(*p == '_' || ialnum(*p));
+	if(!*p)
+	    return 1;
+    } while(*p++ == '/');
+    return 0;
+}
+
+/**/
 int
 load_module(char const *name)
 {
@@ -666,6 +660,10 @@ load_module(char const *name)
     LinkNode node, n;
     int set;
 
+    if (!modname_ok(name)) {
+	zerr("invalid module name `%s'", name, 0);
+	return 0;
+    }
     if (!(node = find_module(name))) {
 	if (!(linked = module_linked(name)) &&
 	    !(handle = do_load_module(name)))
@@ -778,9 +776,6 @@ require_module(char *nam, char *module, int res, int test)
 	    zwarnnam(nam, "module %s already loaded.", module, 0);
 	    return 0;
 	}
-    } else if (res && isset(RESTRICTED) && strchr(module, '/')) {
-	zwarnnam(nam, "%s: restricted", module, 0);
-	return 0;
     } else
 	return load_module(module);
 
@@ -984,13 +979,8 @@ bin_zmodload_dep(char *nam, char **args, char *ops)
 	int ret = 0;
 	char *tnam = *args++;
 
-	for(; *args; args++) {
-	    if(isset(RESTRICTED) && strchr(*args, '/')) {
-		zwarnnam(nam, "%s: restricted", *args, 0);
-		ret = 1;
-	    } else
-		add_dep(tnam, *args);
-	}
+	for(; *args; args++)
+	    add_dep(tnam, *args);
 	return ret;
     }
 }
@@ -1025,10 +1015,6 @@ bin_zmodload_auto(char *nam, char **args, char *ops)
 	/* add autoloaded builtins */
 	char *modnam;
 	modnam = *args++;
-	if(isset(RESTRICTED) && strchr(modnam, '/')) {
-	    zwarnnam(nam, "%s: restricted", modnam, 0);
-	    return 1;
-	}
 	do {
 	    char *bnam = *args ? *args++ : modnam;
 	    if (strchr(bnam, '/')) {
@@ -1092,10 +1078,6 @@ bin_zmodload_cond(char *nam, char **args, char *ops)
 	char *modnam;
 
 	modnam = *args++;
-	if(isset(RESTRICTED) && strchr(modnam, '/')) {
-	    zwarnnam(nam, "%s: restricted", modnam, 0);
-	    return 1;
-	}
 	do {
 	    char *cnam = *args ? *args++ : modnam;
 	    if (strchr(cnam, '/')) {
@@ -1152,10 +1134,6 @@ bin_zmodload_math(char *nam, char **args, char *ops)
 	char *modnam;
 
 	modnam = *args++;
-	if(isset(RESTRICTED) && strchr(modnam, '/')) {
-	    zwarnnam(nam, "%s: restricted", modnam, 0);
-	    return 1;
-	}
 	do {
 	    char *fnam = *args ? *args++ : modnam;
 	    if (strchr(fnam, '/')) {
@@ -1215,10 +1193,6 @@ bin_zmodload_param(char *nam, char **args, char *ops)
 	char *modnam;
 
 	modnam = *args++;
-	if(isset(RESTRICTED) && strchr(modnam, '/')) {
-	    zwarnnam(nam, "%s: restricted", modnam, 0);
-	    return 1;
-	}
 	do {
 	    char *pnam = *args ? *args++ : modnam;
 	    if (strchr(pnam, '/')) {
diff --git a/Src/xmods.conf b/Src/xmods.conf
index ed7769dbc..a26e22d6b 100644
--- a/Src/xmods.conf
+++ b/Src/xmods.conf
@@ -1,10 +1,10 @@
-rlimits
-zle
-complete
-compctl
-sched
-complist
-zutil
-computil
-parameter
-zleparameter
+zsh/rlimits
+zsh/zle
+zsh/complete
+zsh/compctl
+zsh/sched
+zsh/complist
+zsh/zutil
+zsh/computil
+zsh/parameter
+zsh/zleparameter
diff --git a/Src/zsh.mdd b/Src/zsh.mdd
index 61672611b..e93b6d00f 100644
--- a/Src/zsh.mdd
+++ b/Src/zsh.mdd
@@ -1,3 +1,5 @@
+name=zsh/main
+
 nozshdep=1
 alwayslink=1
 
@@ -61,18 +63,15 @@ zshxmods.h: modules-bltin xmods.conf
 	@( \
 	    binmods=`sed 's/^/ /;s/$$/ /' modules-bltin`; \
 	    for mod in `cat $(sdir_src)/xmods.conf`; do \
+		q_mod=`echo $$mod | sed 's,Q,Qq,g;s,_,Qu,g;s,/,Qs,g'`; \
 		case $$binmods in \
 		    *" $$mod "*) \
-			echo "#define    LINKED_XMOD_$$mod 1" ;; \
+			echo "#define    LINKED_XMOD_$$q_mod 1" ;; \
 		    *)  echo "#ifdef DYNAMIC"; \
-			echo "# define UNLINKED_XMOD_$$mod 1"; \
+			echo "# define UNLINKED_XMOD_$$q_mod 1"; \
 			echo "#endif" ;; \
 		esac; \
-	    done; \
-	    echo; \
-	    for mod in $$binmods; do \
-		echo "int boot_$$mod _((Module));"; \
-	    done; \
+	    done \
 	) > $@
 
 clean-here: clean.zsh