From f8d11de72ddbefd87532102f04cf182a3f122529 Mon Sep 17 00:00:00 2001 From: "B. Watson" Date: Sat, 28 Mar 2026 06:35:19 -0400 Subject: Save a few bytes... --- src/cmd.c | 37 ++++++++++++++----------------------- 1 file changed, 14 insertions(+), 23 deletions(-) (limited to 'src/cmd.c') diff --git a/src/cmd.c b/src/cmd.c index e0481c5..b7d9e68 100644 --- a/src/cmd.c +++ b/src/cmd.c @@ -9,7 +9,7 @@ #include "config.h" /* A "command" is actually anything the user types, whether or - not it starts with a /character. */ + not it starts with a / character. */ char *command, *arg1, *arg2, *arg3; static char *target; @@ -88,14 +88,7 @@ static void cmd_chan_text(void) { /* 0x02 = ^B = enable bold */ scr_print_active("<\x02"); scr_print_active(conf->nick); - scr_print_active("\x02"); - - /* - if(!scr_current) { - scr_print_active("/"); - scr_print_active(target); - } - */ + scr_putc_active('\x02'); scr_print_active("> "); scr_print_active(command); @@ -314,16 +307,18 @@ void cmd_ctcp_ping(char *nick) { do_ctcp_ping(); } -static void do_ctcp_info(void) { - arg2 = "CLIENTINFO"; +static void do_no_arg_ctcp(char *type) { + arg2 = type; arg3 = 0; send_ctcp(); } +static void do_ctcp_info(void) { + do_no_arg_ctcp("CLIENTINFO"); +} + static void do_ctcp_ver(void) { - arg2 = "VERSION"; - arg3 = 0; - send_ctcp(); + do_no_arg_ctcp("VERSION"); } static void do_ctcp(void) { @@ -486,29 +481,25 @@ static void cmd_slash(void) { cmd_remote(); } -void cmd_command(char *cmd) { - command = cmd; +void cmd_execute(void) { + if(!*edit_box) return; + command = edit_box; if(scr_current > 1) target = scr_get_cur_name(); else target = 0; - if(cmd[0] == '/' && cmd[1] && cmd[1] != '/') + if(command[0] == '/' && command[1] && command[1] != '/') cmd_slash(); else if(target) cmd_chan_text(); else if(scr_current == SCR_PRIV || scr_current == SCR_SERVER) - cmd_send_pm(cmd); + cmd_send_pm(command); else err_no_scr_target(); } -void cmd_execute(void) { - if(!*edit_box) return; - cmd_command(edit_box); -} - void cmd_rejoin_chans(void) { char i; -- cgit v1.2.3