From dc597140e1005d291509e4aa4f64ef1494c5d665 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Mon, 28 Nov 2016 18:05:25 +0100 Subject: [PATCH] Sort the list of commands when using the help command of linphone-daemon. --- daemon/commands/help.cc | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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; } }