Fixing lookup of command name in table
authorNathael Pajani <nathael.pajani@ed3l.fr>
Mon, 16 Apr 2012 17:15:03 +0000 (19:15 +0200)
committerNathael Pajani <nathael.pajani@ed3l.fr>
Mon, 16 Apr 2012 17:15:03 +0000 (19:15 +0200)
isp_commands.c

index 8c886ab..35ac62a 100644 (file)
@@ -784,15 +784,14 @@ int isp_handle_command(char* cmd, int arg_count, char** args)
                }
                index++;
        }
-       if (arg_count != isp_cmds_list[cmd_found].nb_args) {
-               isp_warn_trailing_args(cmd_found, arg_count, args);
-       }
-       ret = isp_cmds_list[cmd_found].handler(arg_count, args);
-       
        if (cmd_found == -1) {
                printf("Unknown command \"%s\", use -h or --help for a list.\n", cmd);
                return -2;
        }
+       if (arg_count != isp_cmds_list[cmd_found].nb_args) {
+               isp_warn_trailing_args(cmd_found, arg_count, args);
+       }
+       ret = isp_cmds_list[cmd_found].handler(arg_count, args);
 
        return ret;
 }