+
+#********************************************************************************
+# DESTROY-Session module logic.
+#********************************************************************************
+cat <<EOF >> $H_FILE
+
+/* Session destroy Hooks: */
+EOF
+cat <<EOF >>$C_FILE
+}
+
+
+void session_destroy_modules (wcsession **sess)
+{
+
+EOF
+for HOOK in $SESS_DESTROY_FUNCS; do
+HOOKNAME=`echo $HOOK |sed "s;SessionDestroyModule_;;"`
+# Add this entry point to the .c file
+cat <<EOF >> $C_FILE
+#ifdef DBG_PRINNT_HOOKS_AT_START
+ syslog(CTDL_INFO, "Initializing $HOOKNAME\n");
+#endif
+ $HOOK(*sess);
+EOF
+# Add this entry point to the .h file
+cat <<EOF >> $H_FILE
+extern void $HOOK(wcsession *sess);
+EOF
+done
+
+
+cat <<EOF >>$C_FILE
+ free((*sess));
+ (*sess) = NULL;
+}
+
+
+EOF
+
+
+
+
+
+#********************************************************************************
+# NEW-Httprequest module logic.
+#********************************************************************************
+cat <<EOF >> $C_FILE
+
+void http_new_modules (ParsedHttpHdrs *httpreq)
+{
+EOF
+
+for HOOK in $HTTP_NEW_FUNCS; do
+HOOKNAME=`echo $HOOK |sed "s;HttpNewModule_;;"`
+# Add this entry point to the .c file
+cat <<EOF >> $C_FILE
+#ifdef DBG_PRINNT_HOOKS_AT_START
+ syslog(CTDL_INFO, "NEW $HOOKNAME\n");
+#endif
+ $HOOK(httpreq);
+EOF
+# Add this entry point to the .h file
+cat <<EOF >> $H_FILE
+extern void $HOOK(ParsedHttpHdrs *httpreq);
+EOF
+done
+
+cat <<EOF >>$C_FILE
+}
+EOF
+
+#********************************************************************************
+# DETACH-Httprequest module logic.
+#********************************************************************************
+cat <<EOF >> $C_FILE
+
+void http_detach_modules (ParsedHttpHdrs *httpreq)
+{
+EOF
+
+for HOOK in $HTTP_DETACH_FUNCS; do
+HOOKNAME=`echo $HOOK |sed "s;HttpDetachModule_;;"`
+# Add this entry point to the .c file
+cat <<EOF >> $C_FILE
+#ifdef DBG_PRINNT_HOOKS_AT_START
+ syslog(CTDL_INFO, "Detaching $HOOKNAME\n");
+#endif
+ $HOOK(httpreq);
+EOF
+# Add this entry point to the .h file
+cat <<EOF >> $H_FILE
+extern void $HOOK(ParsedHttpHdrs *httpreq);
+EOF
+done
+
+cat <<EOF >>$C_FILE
+}
+EOF
+
+
+#********************************************************************************
+# DESTROY-Httprequest module logic.
+#********************************************************************************
+cat <<EOF >> $C_FILE
+
+void http_destroy_modules (ParsedHttpHdrs *httpreq)
+{
+EOF
+
+for HOOK in $HTTP_DESTROY_FUNCS; do
+HOOKNAME=`echo $HOOK |sed "s;HttpDestroyModule_;;"`
+# Add this entry point to the .c file
+cat <<EOF >> $C_FILE
+#ifdef DBG_PRINNT_HOOKS_AT_START
+ syslog(CTDL_INFO, "Destructing $HOOKNAME\n");
+#endif
+ $HOOK(httpreq);
+EOF
+# Add this entry point to the .h file
+cat <<EOF >> $H_FILE
+extern void $HOOK(ParsedHttpHdrs *httpreq);
+EOF
+done
+
+cat <<EOF >>$C_FILE
+}
+EOF
+
+
+
+
+
+
+
+cat <<EOF >> $H_FILE
+
+#endif /* MODULES_INIT_H */
+
+EOF
+
+
+### Now see what language modules we have installed ###
+/usr/bin/printf "Scanning language modules.\n"
+
+cat >$L_FILE <<EOF
+/* This file is generated automatically by mk_module_init.sh
+ * Editing it by hand would be an exercise in futility.
+ */
+const char *AvailLang[] = {
+ "C",
+EOF
+
+for x in po/webcit/*.po
+do
+ echo \ \"`basename $x | sed s/\.po\$//g`\",
+done >>$L_FILE
+
+cat >>$L_FILE <<EOF
+ ""
+};
+EOF