aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorB. Watson <urchlay@slackware.uk>2026-03-19 04:29:39 -0400
committerB. Watson <urchlay@slackware.uk>2026-03-19 04:29:39 -0400
commit685c14f1f9673842ab92ec00c3542e61c4be9cd2 (patch)
treedcef3ff65c28f02ffccbdb8fe1f7b95d15da68f1
parentdf6181a60dcff1badefaefc1d3148d0dc9246739 (diff)
downloadfujinet-chat-685c14f1f9673842ab92ec00c3542e61c4be9cd2.tar.gz
Add /reboot command.
-rw-r--r--doc/commands.txt6
-rw-r--r--src/cmd.c20
2 files changed, 25 insertions, 1 deletions
diff --git a/doc/commands.txt b/doc/commands.txt
index da820d4..7635ecd 100644
--- a/doc/commands.txt
+++ b/doc/commands.txt
@@ -154,3 +154,9 @@ in a channel. 0 = none, 1 = beep, 2 = flash, 3 = beep and flash.
Send a SIO command to the FujiNet to reset it. This does the same
thing as pressing the FujiNet's reset button. This command is
for testing, and may be removed at some point.
+
+--------------------------------------------------------------------
+/reboot
+
+Quits IRC, resets the FujiNet (as /reset does), then reboots
+the Atari.
diff --git a/src/cmd.c b/src/cmd.c
index 1042197..106eda8 100644
--- a/src/cmd.c
+++ b/src/cmd.c
@@ -34,6 +34,7 @@ static void do_quote(void);
static void do_topic(void);
static void do_ver(void);
static void do_reset(void);
+static void do_reboot(void);
typedef struct {
char *cmd;
@@ -67,6 +68,7 @@ cmd_t command_defs[] = {
{ "QUIT", do_quit, 0 },
{ "QUOTE", do_quote, 1 },
{ "TOPIC", do_topic, 0 },
+ { "REBOOT", do_reboot, 0 },
{ "RESET", do_reset, 0 },
{ "VER", do_ver, 0 },
{ "VERSION", do_ver, 0 },
@@ -194,11 +196,27 @@ static void do_j(void) {
static void do_quit(void) {
reconnect_timeout = 0; /* do not reconnect on /quit */
txbuf_set_str("QUIT");
- if(arg1)
+ if(arg1) {
txbuf_append_str2(" :", arg1);
+ }
txbuf_send();
}
+static void pause(void) {
+ OS.rtclok[2] = 0;
+ while(OS.rtclok[2] < hz)
+ /* NOP */;
+}
+
+static void do_reboot(void) {
+ arg1 = "Rebooting again...";
+ do_quit();
+ pause();
+ do_reset();
+ pause();
+ asm("jmp $e477");
+}
+
static void do_part(void) {
if(arg1[0] == '#') {
target = arg1;