diff --git a/daemon/commands/help.cc b/daemon/commands/help.cc index 329a96359..6fd2850db 100644 --- a/daemon/commands/help.cc +++ b/daemon/commands/help.cc @@ -25,6 +25,10 @@ HelpCommand::HelpCommand() : DaemonCommand("help", "help ", "Show help notice, if command is unspecified or inexistent show all commands.") { } +static bool compareCommand(const DaemonCommand *command1, const DaemonCommand *command2) { + return (command1->getProto() < command2->getProto()); +} + void HelpCommand::exec(Daemon *app, const char *args) { ostringstream ost; list::const_iterator it; @@ -40,7 +44,9 @@ void HelpCommand::exec(Daemon *app, const char *args) { } if (args==NULL){ - for (it = l.begin(); it != l.end(); ++it) { + list lcopy = l; + lcopy.sort(compareCommand); + for (it = lcopy.begin(); it != lcopy.end(); ++it) { ost << (*it)->getProto() << endl; } }