Commit dc597140 authored by Ghislain MARY's avatar Ghislain MARY

Sort the list of commands when using the help command of linphone-daemon.

parent 26aa7123
......@@ -25,6 +25,10 @@ HelpCommand::HelpCommand() :
DaemonCommand("help", "help <command>", "Show <command> 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<DaemonCommand*>::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<DaemonCommand*> lcopy = l;
lcopy.sort(compareCommand);
for (it = lcopy.begin(); it != lcopy.end(); ++it) {
ost << (*it)->getProto() << endl;
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment