From deea8dc594ee0aef2edf603075b5af3ad85f6b4c Mon Sep 17 00:00:00 2001 From: Brad Nelson Date: Sat, 27 Feb 2021 00:48:34 -0800 Subject: [PATCH] Fixing telnet. --- ueforth/arduino/telnetd.fs | 4 +++- ueforth/common/boot.fs | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/ueforth/arduino/telnetd.fs b/ueforth/arduino/telnetd.fs index 4bd750e..5b98f16 100644 --- a/ueforth/arduino/telnetd.fs +++ b/ueforth/arduino/telnetd.fs @@ -11,7 +11,9 @@ create client sizeof(sockaddr_in) allot variable client-len defer broker -: telnet-type ( a n -- ) clientfd write-file if broker then ; +: telnet-emit' ( ch -- ) >r rp@ 1 clientfd write-file rdrop if broker then ; +: telnet-emit ( ch -- ) dup nl = if 13 telnet-emit' then telnet-emit' ; +: telnet-type ( a n -- ) for aft dup c@ telnet-emit 1+ then next drop ; : telnet-key ( -- n ) 0 >r rp@ 1 clientfd read-file if drop rdrop broker else drop then r> ; : connection ( n -- ) diff --git a/ueforth/common/boot.fs b/ueforth/common/boot.fs index f797d07..e9030b6 100644 --- a/ueforth/common/boot.fs +++ b/ueforth/common/boot.fs @@ -199,7 +199,7 @@ variable echo -1 echo ! variable arrow -1 arrow ! : ?arrow. arrow @ if >r >r raw.s r> r> ." --> " then ; : accept ( a n -- n ) ?arrow. 0 swap begin 2dup < while key - dup nl = if 13 emit ?echo drop nip exit then + dup nl = if ?echo drop nip exit then dup 8 = over 127 = or if drop over if rot 1- rot 1- rot 8 ?echo bl ?echo 8 ?echo then else