#include <stdlib.h>
#include <string.h>
+int nloaded_mods = 0;
+int nerror_mods = 0;
+
void mandshurica_add_mod(void* lib) {
struct mandshurica_mod** old_mods = loaded_mods;
int i;
ret = init_func(&config);
}
if(ret == 0) {
+ nloaded_mods++;
mandshurica_add_mod(lib);
} else {
+ nerror_mods++;
char* str = mandshurica_strcat3("Could not load the module `", path, "`");
mandshurica_log(MS_ERROR, str);
free(str);
extern struct mandshurica_config config;
+extern int nloaded_mods;
+extern int nerror_mods;
+
int main(int argc, char** argv) {
int i;
bool loaded_config = false;
int ret = mandshurica_load_config(PREFIX "/etc/mandshurica.conf");
if(ret != 0) return ret;
}
+ char* log = malloc(1024);
+ sprintf(log, "Loaded %d module(s) successfully, failed to load %d module(s)", nloaded_mods, nerror_mods);
+ mandshurica_log(MS_INFO, log);
+ free(log);
mandshurica_log(MS_INFO, "Hello World, initialization done");
if(loaded_mods != NULL) {
mandshurica_log(MS_INFO, "Starting server");