about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2014-04-09 21:38:42 +0100
committerJames Booth <boothj5@gmail.com>2014-04-09 21:38:57 +0100
commit26216f6c17d0662e5c1bc9535e3af6655acf352c (patch)
tree56aedff3f55133225323220ea201cc87509ab62b /src
parentc3e3759256bc9b8f53f1334c3a352877d28846e1 (diff)
downloadprofani-tty-26216f6c17d0662e5c1bc9535e3af6655acf352c.tar.gz
Refactored cmd_execute
Diffstat (limited to 'src')
-rw-r--r--src/command/command.c25
1 files changed, 13 insertions, 12 deletions
diff --git a/src/command/command.c b/src/command/command.c
index bea347e7..8b4a936d 100644
--- a/src/command/command.c
+++ b/src/command/command.c
@@ -1251,18 +1251,19 @@ cmd_execute(const char * const command, const char * const inp)
 
     if (cmd != NULL) {
         gchar **args = cmd->parser(inp, cmd->min_args, cmd->max_args, &result);
-        if ((result == FALSE) && (cmd->setting_func != NULL)) {
-            cons_show("");
-            (*cmd->setting_func)();
-            cons_show("Usage: %s", cmd->help.usage);
-            return TRUE;
-        } else if (result == FALSE) {
-            cons_show("");
-            cons_show("Usage: %s", cmd->help.usage);
-            if (ui_current_win_type() == WIN_CHAT) {
-                char usage[strlen(cmd->help.usage) + 8];
-                sprintf(usage, "Usage: %s", cmd->help.usage);
-                ui_current_print_line(usage);
+        if (result == FALSE) {
+            if (cmd->setting_func != NULL) {
+                cons_show("");
+                (*cmd->setting_func)();
+                cons_show("Usage: %s", cmd->help.usage);
+            } else {
+                cons_show("");
+                cons_show("Usage: %s", cmd->help.usage);
+                if (ui_current_win_type() == WIN_CHAT) {
+                    char usage[strlen(cmd->help.usage) + 8];
+                    sprintf(usage, "Usage: %s", cmd->help.usage);
+                    ui_current_print_line(usage);
+                }
             }
             return TRUE;
         } else {