X-Git-Url: https://jfr.im/git/irc/quakenet/newserv.git/blobdiff_plain/c86edd1d9e5994aea33cfad3164e4827e591e7e6..e2527cba3979ffb1f5e9dfae3c8701f046ffee35:/helpmod2/hcommand.c?ds=sidebyside diff --git a/helpmod2/hcommand.c b/helpmod2/hcommand.c index 411fff6d..7119265e 100644 --- a/helpmod2/hcommand.c +++ b/helpmod2/hcommand.c @@ -2,8 +2,6 @@ #include #include -#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));