aboutsummaryrefslogtreecommitdiff
path: root/src/cmd.c
diff options
context:
space:
mode:
authorB. Watson <urchlay@slackware.uk>2026-03-28 06:35:19 -0400
committerB. Watson <urchlay@slackware.uk>2026-03-28 06:35:19 -0400
commitf8d11de72ddbefd87532102f04cf182a3f122529 (patch)
tree3e71fc341357d2908be3f5b7b63bc9e472be408b /src/cmd.c
parentb6a51ea52ab2b58e9b6687170547be7536c0fa9c (diff)
downloadfujinet-chat-f8d11de72ddbefd87532102f04cf182a3f122529.tar.gz
Save a few bytes...
Diffstat (limited to 'src/cmd.c')
-rw-r--r--src/cmd.c37
1 files changed, 14 insertions, 23 deletions
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;