#include <string.h>
#include <stdlib.h>
-#include "../lib/sstring.h"
-
#include "helpmod.h"
#include "hcommand.h"
#include "hgen.h"
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));