about summary refs log tree commit diff
path: root/Src/mkmodindex.sh
diff options
context:
space:
mode:
authorTanaka Akira <akr@users.sourceforge.net>1999-04-15 18:05:35 +0000
committerTanaka Akira <akr@users.sourceforge.net>1999-04-15 18:05:35 +0000
commit32c2ebbaa5d7927f33ee0ecf98472a71cf902cf3 (patch)
tree212c29fe244d0222bab8efe3032e7fa965842945 /Src/mkmodindex.sh
parentc175751b501a3a4cb40ad4787340a597ea769be4 (diff)
downloadzsh-32c2ebbaa5d7927f33ee0ecf98472a71cf902cf3.tar.gz
zsh-32c2ebbaa5d7927f33ee0ecf98472a71cf902cf3.tar.xz
zsh-32c2ebbaa5d7927f33ee0ecf98472a71cf902cf3.zip
zsh-3.1.5 zsh-3.1.5
Diffstat (limited to 'Src/mkmodindex.sh')
-rw-r--r--Src/mkmodindex.sh43
1 files changed, 43 insertions, 0 deletions
diff --git a/Src/mkmodindex.sh b/Src/mkmodindex.sh
new file mode 100644
index 000000000..b4616f638
--- /dev/null
+++ b/Src/mkmodindex.sh
@@ -0,0 +1,43 @@
+#!/bin/sh
+#
+# mkmodindex.sh: search for *.mdd files, and index the modules
+#
+# $@ = directories to search from
+#
+
+echo "# module index generated by mkmodindex.sh"
+echo
+
+module_list=' '
+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
+    done
+    $dosubs && set `echo $dir/*/. '' | sed 's,/\. , ,g'` "$@"
+done
+
+echo
+echo $module_list | sed 's/^/module_list="/;s/$/"/'
+
+exit 0