[Xorp-hackers] fix for bug 621

Michael Larson mike at vyatta.com
Tue May 23 10:01:19 PDT 2006


Here's a fix for this bug--it fixes the problem downstream, but this should probably be fixed "upstream" if possible. Diff below

Mike Larson
Vyatta


--- cli_client.cc_old   2006-05-22 18:14:43.000000000 +0000
+++ cli_client.cc_new   2006-05-22 18:14:50.000000000 +0000
@@ -1692,6 +1692,7 @@
        CliCommand *tmp_cli_command = *iter;
        if (! tmp_cli_command->has_cli_completion_func())
            continue;
+
        if (tmp_cli_command->_cli_completion_func(tmp_cli_command,
                                                  cpl, NULL, line, word_end,
                                                  cli_command_match_list)) {
@@ -1708,21 +1709,27 @@
            ret_value = 0;
        }
     }
-
+
     //
     // Separate the type-match commands from the rest
     //
+    set<string> no_type_coll;
     for (iter = cli_command_match_list.begin();
         iter != cli_command_match_list.end();
         ++iter) {
        CliCommand *tmp_cli_command = *iter;
+
        if (tmp_cli_command->has_type_match_cb())
            type_list.push_back(tmp_cli_command);
-       else
-           no_type_list.push_back(tmp_cli_command);
+       else {
+           no_type_coll.insert(tmp_cli_command->_name);
+       }
     }

-    if (no_type_list.size() > 1) {
+
+
+
+    if (no_type_coll.size() > 1) {
        // Prepare and print the initial message(s)
        string token_line = string(line, word_end);
        string token;



More information about the Xorp-hackers mailing list