]> jfr.im git - irc/quakenet/newserv.git/blobdiff - helpmod2/hcommand.c
Large reorganisation of all Makefiles, including new configure script.
[irc/quakenet/newserv.git] / helpmod2 / hcommand.c
index 411fff6dcdfd59dd3c2dc9fc692528c2c63d422f..7119265e2ed108b23b81812afd3b5e79cf9611fa 100644 (file)
@@ -2,8 +2,6 @@
 #include <string.h>
 #include <stdlib.h>
 
-#include "../lib/sstring.h"
-
 #include "helpmod.h"
 #include "hcommand.h"
 #include "hgen.h"
@@ -14,7 +12,9 @@ hcommand* hcommand_add(const char *str, hlevel lvl, hcommand_function func, cons
 
     assert(hcommand_get(str, lvl) == NULL);
 
-    for (;*ptr && (*ptr)->level <= lvl;ptr = &(*ptr)->next);
+    /* Find the position */
+    for (;*ptr && (*ptr)->level < lvl;ptr = &(*ptr)->next);
+    for (;*ptr && (*ptr)->level <= lvl && strcmp(str, (*ptr)->name->content) > 0;ptr = &(*ptr)->next);
 
     tmp = *ptr;
     *ptr = (hcommand*)malloc(sizeof (hcommand));