]> jfr.im git - irc/quakenet/newserv.git/blobdiff - helpmod2/helpmod_entries.c
CHANSERV: authtracker now keeps 240 days history
[irc/quakenet/newserv.git] / helpmod2 / helpmod_entries.c
index 2d27e54beb9ed1d70245715a00fa0a4d3b62755f..93f0a55ba63f1deb27ed3589d6ef4b6e764cf4cc 100644 (file)
@@ -1,6 +1,6 @@
 #include "helpmod_entries.h"
 #include "helpmod_alias.h"
-#include "../core/error.c"
+#include "../core/error.h"
 #include "helpmod.h"
 
 struct helpmod_parsed_line_struct helpmod_parsed_line;
@@ -8,7 +8,7 @@ struct helpmod_parsed_line_struct helpmod_parsed_line;
 int helpmod_valid_selection(helpmod_entry state, int selection)
 {
     if (selection == -1)
-       return ((int)state->parent);
+       return ((int)((long)state->parent));
     return (selection >= 0 && selection < state->option_count);
 }
 
@@ -119,8 +119,6 @@ void helpmod_load_entries(char* setting_file)
            return;
        if (*buffer == '$')
        {
-           helpmod_base->options = (helpmod_entry*)realloc(helpmod_base->options, sizeof(helpmod_entry) * ++helpmod_base->option_count);
-            helpmod_base->options[helpmod_base->option_count-1] = NULL;
            /* remove the \n, it's not wanted */
            for (i=0;i<strlen(buffer+1);i++)
                if ((buffer+1)[i] == '\n')
@@ -134,6 +132,9 @@ void helpmod_load_entries(char* setting_file)
                Error("helpmod", ERR_ERROR, "File %s specified in %s not found",buffer+1, setting_file);
                return;
            }
+           helpmod_base->options = (helpmod_entry*)realloc(helpmod_base->options, sizeof(helpmod_entry) * ++helpmod_base->option_count);
+            helpmod_base->options[helpmod_base->option_count-1] = NULL;
+
             helpmod_parse_line(tmp_input);
            helpmod_load_entry(&helpmod_base->options[helpmod_base->option_count-1], tmp_input, 0, helpmod_base);
             fclose(tmp_input);