From 04e021eb363798e4ab01777ac0bc725994d8bd3a Mon Sep 17 00:00:00 2001 From: James Booth Date: Tue, 24 Apr 2012 01:02:22 +0100 Subject: [PATCH] Usage of gboolean in command.c --- command.c | 48 ++++++++++++++++++++++++++---------------------- command.h | 2 +- profanity.c | 3 ++- 3 files changed, 29 insertions(+), 24 deletions(-) diff --git a/command.c b/command.c index 7f45a445..11e4667d 100644 --- a/command.c +++ b/command.c @@ -22,6 +22,9 @@ #include #include + +#include + #include "command.h" #include "contact_list.h" #include "history.h" @@ -29,19 +32,20 @@ #include "windows.h" #include "util.h" -static int _handle_command(const char * const command, const char * const inp); -static int _cmd_quit(void); -static int _cmd_help(void); -static int _cmd_who(void); -static int _cmd_ros(void); -static int _cmd_connect(const char * const inp); -static int _cmd_msg(const char * const inp); -static int _cmd_close(const char * const inp); -static int _cmd_default(const char * const inp); +static gboolean _handle_command(const char * const command, + const char * const inp); +static gboolean _cmd_quit(void); +static gboolean _cmd_help(void); +static gboolean _cmd_who(void); +static gboolean _cmd_ros(void); +static gboolean _cmd_connect(const char * const inp); +static gboolean _cmd_msg(const char * const inp); +static gboolean _cmd_close(const char * const inp); +static gboolean _cmd_default(const char * const inp); -int process_input(char *inp) +gboolean process_input(char *inp) { - int result = FALSE; + gboolean result = FALSE; if (strlen(inp) > 0) history_append(inp); @@ -65,9 +69,9 @@ int process_input(char *inp) return result; } -static int _handle_command(const char * const command, const char * const inp) +static gboolean _handle_command(const char * const command, const char * const inp) { - int result = FALSE; + gboolean result = FALSE; if (strcmp(command, "/quit") == 0) { result = _cmd_quit(); @@ -90,9 +94,9 @@ static int _handle_command(const char * const command, const char * const inp) return result; } -static int _cmd_connect(const char * const inp) +static gboolean _cmd_connect(const char * const inp) { - int result = FALSE; + gboolean result = FALSE; jabber_status_t conn_status = jabber_connection_status(); if ((conn_status != JABBER_DISCONNECTED) && (conn_status != JABBER_STARTED)) { @@ -123,19 +127,19 @@ static int _cmd_connect(const char * const inp) return result; } -static int _cmd_quit(void) +static gboolean _cmd_quit(void) { return FALSE; } -static int _cmd_help(void) +static gboolean _cmd_help(void) { cons_help(); return TRUE; } -static int _cmd_ros(void) +static gboolean _cmd_ros(void) { jabber_status_t conn_status = jabber_connection_status(); @@ -147,7 +151,7 @@ static int _cmd_ros(void) return TRUE; } -static int _cmd_who(void) +static gboolean _cmd_who(void) { jabber_status_t conn_status = jabber_connection_status(); @@ -161,7 +165,7 @@ static int _cmd_who(void) return TRUE; } -static int _cmd_msg(const char * const inp) +static gboolean _cmd_msg(const char * const inp) { char *usr = NULL; char *msg = NULL; @@ -195,7 +199,7 @@ static int _cmd_msg(const char * const inp) return TRUE; } -static int _cmd_close(const char * const inp) +static gboolean _cmd_close(const char * const inp) { if (!win_close_win()) cons_bad_command(inp); @@ -203,7 +207,7 @@ static int _cmd_close(const char * const inp) return TRUE; } -static int _cmd_default(const char * const inp) +static gboolean _cmd_default(const char * const inp) { if (win_in_chat()) { char *recipient = win_get_recipient(); diff --git a/command.h b/command.h index 7efc4acf..d0d57022 100644 --- a/command.h +++ b/command.h @@ -24,6 +24,6 @@ #define COMMAND_H void cmd_init(void); -int process_input(char *inp); +gboolean process_input(char *inp); #endif diff --git a/profanity.c b/profanity.c index 6e9c70cf..de26f8b8 100644 --- a/profanity.c +++ b/profanity.c @@ -22,6 +22,7 @@ #include #include +#include #include "profanity.h" #include "log.h" @@ -34,7 +35,7 @@ static void _profanity_shutdown(void); void profanity_run(void) { - int cmd_result = TRUE; + gboolean cmd_result = TRUE; inp_non_block(); while(cmd_result == TRUE) {