From 0cad011f41fe6cabba1dc6f6186c08556db247d4 Mon Sep 17 00:00:00 2001 From: "B. Watson" Date: Sat, 21 Mar 2026 05:20:18 -0400 Subject: Stop using FujiNet's CRLF translation (set it to "none"), do our own CRLF processing. Allows the ~ character to be sent properly. --- TODO | 4 ---- src/irc.c | 19 ++++++++++--------- src/irc.h | 4 +++- src/main.c | 7 ++++--- 4 files changed, 17 insertions(+), 17 deletions(-) diff --git a/TODO b/TODO index 77797d9..57917d9 100644 --- a/TODO +++ b/TODO @@ -18,10 +18,6 @@ Other stuff: of code on keycode-filtering, and it's not even complete. - Filter out the rest of the keystrokes that causes cgetc() to block. Includes ctrl-/, ctrl-8, ctrl-9, maybe others (The_Doctor__). -- Stop using ASCII translation on the FujiNet. It's turning a outgoing - ~ into a ^H (since ATASCII's backspace is DEL in regular ASCII). In - theory IRC servers always send us \r\n, we can support non-conforming - servers that just use \n without much trouble, too. - Load/save config files to N:SD///.FujiNetChat or such. Since we *have* to have a FujiNet anyway, might as well make better use of it. - Rewrite the incoming message parser! It needs to work more like diff --git a/src/irc.c b/src/irc.c index 137e66c..c07e666 100644 --- a/src/irc.c +++ b/src/irc.c @@ -663,15 +663,16 @@ static void irc_split_Lines(void) { char *p = rx_buf; for(i = 0; i < rxbuflen; i++) { - msgbuf[msgbuf_len] = *p; - if(*p == CH_EOL) { - // msgbuf[msgbuf_len + 1] = '\0'; - /* do not include the EOL */ - msgbuf[msgbuf_len] = '\0'; - parse_msg(); - msgbuf_len = 0; - } else { - msgbuf_len++; + /* skip ASCII \r character */ + if(*p != 0x0d) { + if(*p == 0x0a) { + /* got ASCII \n */ + msgbuf[msgbuf_len] = '\0'; + parse_msg(); + msgbuf_len = 0; + } else { + msgbuf[msgbuf_len++] = *p; + } } p++; } diff --git a/src/irc.h b/src/irc.h index 783c223..6a4770a 100644 --- a/src/irc.h +++ b/src/irc.h @@ -1,4 +1,6 @@ -#define FNET_TRANSLATION 3 +/* 0 = no translation (used to use 3, CRLF) */ +#define FNET_TRANSLATION 0 + #define MAX_IRC_MSG_LEN 512 #define streq(x,y) !strcmp(x,y) diff --git a/src/main.c b/src/main.c index 068322d..b5de37b 100644 --- a/src/main.c +++ b/src/main.c @@ -73,9 +73,10 @@ void txbuf_send(void) { /* don't send empty buffer */ if(!txbuflen) return; - /* always terminate with EOL */ - if(tx_buf[txbuflen - 1] != '\n') - tx_buf[txbuflen++] = '\n'; + /* always terminate with *ASCII* CRLF. + DO NOT USE '\n' or even '\x0a', cc65 turns it into $9b! */ + tx_buf[txbuflen++] = 0x0d; + tx_buf[txbuflen++] = 0x0a; ind_net_tx(); nwrite(conf->url, tx_buf, txbuflen); -- cgit v1.2.3