3 # Script to generate $C_FILE
8 #MINUS_e=X`$ECHO -n -e`
9 #if [ $MINUS_e != "X" ] ; then
15 #MINUS_E=X`$ECHO -n -E`
16 #if [ $MINUS_E != "X" ] ; then
24 C_FILE="$CUR_DIR/modules_init.c"
25 H_FILE="$CUR_DIR/modules_init.h"
26 MOD_FILE="$CUR_DIR/Make_modules"
27 SRC_FILE="$CUR_DIR/Make_sources"
30 /usr/bin/printf "Scanning extension modules for entry points.\n"
33 #start of the files which inturn removes any existing file
36 # start the Makefile included file for $SERV_MODULES
40 # This file is to be included by Makefile to dynamically add modules to the build process
41 # THIS FILE WAS AUTO GENERATED BY mk_modules_init.sh DO NOT EDIT THIS FILE
46 # start the Makefile included file for $SOURCES
50 # This file is to be included by Makefile to dynamically add modules to the build process
51 # THIS FILE WAS AUTO GENERATED BY mk_modules_init.sh DO NOT EDIT THIS FILE
60 * Auto generated by mk_modules_init.sh DO NOT EDIT THIS FILE
70 #include <sys/types.h>
73 #include "modules_init.h"
74 #include "sysdep_decls.h"
77 void LogPrintMessages(long err);
78 extern long DetailErrorFlags;
82 void initialise_modules (void)
87 lprintf (CTDL_INFO, "New citadel module init proceedure.\n");
91 #start the header file
95 * Auto generated by mk_modules_init.sh DO NOT EDIT THIS FILE
99 #ifndef MODULES_INIT_H
100 #define MODULES_INIT_H
101 #include "ctdl_module.h"
102 extern size_t nSizErrmsg;
103 void initialise_modules (void);
109 RES=X`grep CTDL_MODULE_INIT $i | cut -f2 -d\( | cut -f1 -d\)`
110 if [ $RES != "X" ] ; then
111 RES_OUT=`echo $RES | cut -b2-`
112 /usr/bin/printf "Found entry point in file $i\n"
114 lprintf (CTDL_INFO, "%%s\n", CTDL_INIT_CALL($RES_OUT));
118 CTDL_MODULE_INIT($RES_OUT);
124 if [ -d "modules" ] ; then
132 if [ -f "$k" ] ; then
133 # Add this .c file to the Makefile included list of SOURCES
134 cat <<EOF >> $SRC_FILE
135 SOURCES += modules/$j/$k
138 # Generate a .o file name
139 O_FILE=`basename $k .c`
141 # Add this .o file to the Makefile included list of SERV_MODULES
142 cat <<EOF >> $MOD_FILE
143 SERV_MODULES += modules/$j/$O_FILE
146 RES=X`grep CTDL_MODULE_INIT $k | cut -f2 -d\( | cut -f1 -d\)`
147 if [ $RES != "X" ] ; then
148 RES_OUT=`echo $RES | cut -b2-`
149 /usr/bin/printf "Found entry point in file modules/$j/$k\n"
150 # Add this entry point to the .c file
152 lprintf (CTDL_INFO, "%s\n", CTDL_INIT_CALL($RES_OUT));
154 # Add this entry point to the .h file
156 CTDL_MODULE_INIT($RES_OUT);
168 if [ -d "user_modules" ] ; then
176 if [ -f "$k" ] ; then
177 # Add this .c file to the Makefile included list of SOURCES
178 cat <<EOF >> $SRC_FILE
179 SOURCES=\$(SOURCES) user_modules/$j/$k
182 # Generate a .o file name
183 O_FILE=`basename $k .c`
185 # Add this .o file to the Makefile included list of SERV_MODULES
186 cat <<EOF >> $MOD_FILE
187 SERV_MODULES += user_modules/$j/$O_FILE
190 RES=X`grep CTDL_MODULE_INIT $k | cut -f2 -d\( | cut -f1 -d\)`
191 if [ $RES != "X" ] ; then
192 RES_OUT=`echo $RES | cut -b2-`
193 /usr/bin/printf "Found entry point in file user_modules/$j/$k\n"
195 lprintf (CTDL_INFO, "%s\n", CTDL_INIT_CALL($RES_OUT));
198 CTDL_MODULE_INIT($RES_OUT);
210 /usr/bin/printf "\n\n" >> $C_FILE
211 /usr/bin/printf "\tfor (filter = 1; filter != 0; filter = filter << 1)\n" >> $C_FILE
212 /usr/bin/printf "\t\tif ((filter & DetailErrorFlags) != 0)\n" >> $C_FILE
213 /usr/bin/printf "\t\t\tLogPrintMessages(filter);\n" >> $C_FILE
214 /usr/bin/printf "}\n" >> $C_FILE
217 /usr/bin/printf "\n#endif /* MODULES_INIT_H */\n" >> $H_FILE