diff --git a/src/common/conf.h b/src/common/conf.h
index 666853b..d223505 100644
--- a/src/common/conf.h
+++ b/src/common/conf.h
@@ -5,7 +5,7 @@
#define _CONF_H_
#include "../common/cbasetypes.h"
-#include "libconfig.h"
+#include "../../3rdparty/libconfig/libconfig.h"
int conf_read_file(config_t *config, const char *config_filename);
int config_setting_copy(config_setting_t *parent, const config_setting_t *src);
diff --git a/src/common/utils.c b/src/common/utils.c
index d799285..6986d9a 100644
--- a/src/common/utils.c
+++ b/src/common/utils.c
@@ -321,3 +321,15 @@ unsigned int get_percentage(const unsigned int A, const unsigned int B)
return (unsigned int)floor(result);
}
+
+///comparator for qsort
+//comparing int
+int compare_int(const void *a,const void *b) {
+ int *x = (int *) a;
+ int *y = (int *) b;
+ return *x - *y;
+}
+//comparing string
+int compare_str(const void *a,const void *b) {
+ return (strcmp((char *)a,(char *)b));
+}
diff --git a/src/common/utils.h b/src/common/utils.h
index 6ce1639..b98452d 100644
--- a/src/common/utils.h
+++ b/src/common/utils.h
@@ -30,5 +30,7 @@ extern uint16 MakeWord(uint8 byte0, uint8 byte1);
extern uint32 MakeDWord(uint16 word0, uint16 word1);
int date2version(int date);
+int compare_int(const void *a,const void *b);
+int compare_str(const void *a,const void *b);
#endif /* _UTILS_H_ */
diff --git a/src/map/atcommand.c b/src/map/atcommand.c
index 80bc5d0..97b187f 100644
--- a/src/map/atcommand.c
+++ b/src/map/atcommand.c
@@ -9033,6 +9033,11 @@ static inline void atcmd_channel_help(struct map_session_data *sd, const char *c
return -1;
}
+//comparing atcommand
+int compare_atc(const void *a,const void *b) {
+ return compare_str(((struct AtCommandInfo*)a)->command,((struct AtCommandInfo*)b)->command);
+}
+
/**
* Fills the reference of available commands in atcommand DBMap
**/
@@ -9307,8 +9312,10 @@ void atcommand_basecommands(void) {
ACMD_DEF(langtype),
};
AtCommandInfo* atcommand;
- int i;
+ int i = ARRAYLENGTH(atcommand_base);
+ ShowInfo("List of atcommand\n");
+ qsort(atcommand_base,i,sizeof(struct AtCommandInfo),compare_atc);
for( i = 0; i < ARRAYLENGTH(atcommand_base); i++ ) {
if(atcommand_exists(atcommand_base[i].command)) { // Should not happen if atcommand_base[] array is OK
ShowDebug("atcommand_basecommands: duplicate ACMD_DEF for '%s'.\n", atcommand_base[i].command);
@@ -9318,6 +9325,7 @@ void atcommand_basecommands(void) {
safestrncpy(atcommand->command, atcommand_base[i].command, sizeof(atcommand->command));
atcommand->func = atcommand_base[i].func;
strdb_put(atcommand_db, atcommand->command, atcommand);
+ ShowInfo("cmd = %s\n",atcommand_base[i].command);
}
return;
}