diff options
| author | B. Watson <urchlay@slackware.uk> | 2026-03-02 03:26:47 -0500 |
|---|---|---|
| committer | B. Watson <urchlay@slackware.uk> | 2026-03-02 03:26:47 -0500 |
| commit | eb932c7c313b5461ffaee0fd6ed0db1e9f5ca32b (patch) | |
| tree | 1357027992f6cb148ace39edde21687a93418460 /src | |
| parent | 4c28ddf7f0d33451b88e6061308a620f6701f145 (diff) | |
| download | fujinet-chat-eb932c7c313b5461ffaee0fd6ed0db1e9f5ca32b.tar.gz | |
Go back to loading at $2000, make stack 1 page, protocol decoding WIP.
Diffstat (limited to 'src')
| -rw-r--r-- | src/atari.cfg | 4 | ||||
| -rw-r--r-- | src/irc.c | 35 |
2 files changed, 22 insertions, 17 deletions
diff --git a/src/atari.cfg b/src/atari.cfg index 97b265e..38e166a 100644 --- a/src/atari.cfg +++ b/src/atari.cfg @@ -1,10 +1,10 @@ FEATURES { - STARTADDRESS: default = $0700; + STARTADDRESS: default = $2000; } SYMBOLS { __EXEHDR__: type = import; __AUTOSTART__: type = import; # force inclusion of autostart "trailer" - __STACKSIZE__: type = weak, value = $0800; # 2k stack + __STACKSIZE__: type = weak, value = $0200; __STARTADDRESS__: type = export, value = %S; __RESERVED_MEMORY__: type = weak, value = $0000; } @@ -33,9 +33,8 @@ static void print_reason(void) { if(msg_text) { scr_print_active(": "); scr_print_active(msg_text); - } else { - scr_print_active("\n"); } + scr_eol_active(); } static void do_pong(void) { @@ -46,6 +45,7 @@ static void do_pong(void) { static void do_chan_nick(void) { scr_print_active("<"); + scr_print_active(msg_src); if(scr_active == SCR_SERVER) { /* if we don't have a window for it */ scr_print_active("/"); @@ -66,7 +66,8 @@ static void do_privmsg(void) { else do_priv_nick(); - scr_print_active(msg_text); /* text ends with an EOL, don't print another */ + scr_print_active(msg_text); + scr_eol_active(); } static void do_join(void) { @@ -79,7 +80,7 @@ static void do_join(void) { scr_print_active(msg_src); scr_print_active(" has joined "); scr_print_active(msg_dest); - scr_print_active("\n"); + scr_eol_active(); } } @@ -93,7 +94,7 @@ static void do_nick(void) { } scr_print_active(" now known as "); scr_print_active(msg_dest); - scr_print_active("\n"); + scr_eol_active(); } static void do_quit(void) { @@ -109,9 +110,8 @@ static void do_part(void) { if(msg_text) { scr_print_active(": "); scr_print_active(msg_text); - } else { - scr_print_active("\n"); } + scr_eol_active(); } static void do_topic(void) { @@ -120,6 +120,7 @@ static void do_topic(void) { scr_print_active(msg_dest); scr_print_active(" to: "); scr_print_active(msg_text); + scr_eol_active(); /* TODO: set topic in the screen! */ } @@ -140,7 +141,7 @@ static void do_mode(void) { scr_print_active(" "); scr_print_active(msg_args[i]); } - scr_print_active("\n"); + scr_eol_active(); } /* numerics call this with arg==1, since arg 0 is always our nick. @@ -163,6 +164,7 @@ static void do_catchall(int arg) { scr_print_active(" "); scr_print_active(msg_text); } + scr_eol_active(); } /* permutes last character (doesn't add one), so for "Bob" you get: @@ -256,6 +258,7 @@ static void do_numeric(void) { scr_print(s, msg_args[1]); scr_print(s, ": "); scr_print(s, msg_text); + scr_putc(s, '\n'); break; case RPL_TOPICWHOTIME: @@ -317,8 +320,8 @@ static void dispatch_msg(void) { } /* msgbuf contains a complete message from the server, whose - length is msgbuf_len. the last character *must* be CH_EOL, - and the last argument ends with CH_EOL. */ + length is msgbuf_len. The EOL that was at the end of the message + is *not* present here (been replaced with a null already). */ static void parse_msg(void) { char *p; @@ -326,7 +329,7 @@ static void parse_msg(void) { msg = msgbuf; /* ignore empty message */ - if(*msg == CH_EOL) return; + if(!*msg) return; /* if there's a final multiword arg... */ /* FIXME: channel names can have colons, which breaks this... */ @@ -378,7 +381,7 @@ static void parse_msg(void) { if((p = strstr(msg_src, "!"))) { msg_src++; *p = '\0'; - } else { + } else if(strstr(msg_src, ".")) { msg_src = 0; } } @@ -396,7 +399,9 @@ static void irc_split_Lines(void) { for(i = 0; i < rxbuflen; i++) { msgbuf[msgbuf_len] = *p; if(*p == CH_EOL) { - msgbuf[msgbuf_len + 1] = '\0'; + // msgbuf[msgbuf_len + 1] = '\0'; + /* do not include the EOL */ + msgbuf[msgbuf_len] = '\0'; parse_msg(); msgbuf_len = 0; } else { @@ -434,8 +439,8 @@ int irc_read(void) { // Get # of bytes waiting, no more than size of rx_buf rxbuflen = OS.dvstat[1] * 256 + OS.dvstat[0]; - if(rxbuflen > sizeof(rx_buf)) - rxbuflen = sizeof(rx_buf); + if(rxbuflen > MAX_MSG) + rxbuflen = MAX_MSG; if(rxbuflen > 0) { err = nread(url, rx_buf, rxbuflen); |
