From 185f3a5026ec9f2106c01ad45d60b58e815feb74 Mon Sep 17 00:00:00 2001 From: Aleteoryx Date: Fri, 19 Sep 2025 19:12:14 -0400 Subject: [PATCH] scrollbackup --- README.md | 7 +++++++ ntalk.tcl | 9 ++++++--- scrollbackup.sh | 4 ++++ 3 files changed, 17 insertions(+), 3 deletions(-) create mode 100755 scrollbackup.sh diff --git a/README.md b/README.md index 6477fd070bf81bfaf12fe89012956f22383086cf..8c7d7ab6b8f2347eca1af4d617732a03174cc8b2 100644 --- a/README.md +++ b/README.md @@ -13,6 +13,7 @@ probably there's a chance of the file being clobbered. will get slower with more scrollback, cause it's just implemented with tail and head and wc. :P + ## `ntalk.tcl`: tcl/tk nanotalk client requires you have wish(1) installed. @@ -36,5 +37,11 @@ Ctrl-Shift-R will restart the client, allowing you to test config changes rapidly. Ctrl-Q exits. +## `scrollbackup.sh`: simple backup script + +just sends HIST and QUIT and logs it to a file whose name indicates +when it was generated and from what server + + [src]: https://git.phial.org/d6/nanochat [100r]: https://git.sr.ht/~rabbits/nanotalk diff --git a/ntalk.tcl b/ntalk.tcl index 9a2135c7e4fcd521b35cd93071fe09318c06686b..79dadf7aa08e290d440a360a03d034b96b09c05b 100755 --- a/ntalk.tcl +++ b/ntalk.tcl @@ -182,22 +182,22 @@ proc sendmsg {msg} { set msgid [send $msg] if {$msgid == $lastmsg} { bufpush "$msg\n" + bufdown } else { skip } - bufdown } proc pollmsgs {} { - if {[poll] != "0"} { skip } + skip after 10000 pollmsgs } ### BOOT ### -focus .foot.input set lastmsg 0 last 16 after 10000 pollmsgs + bind .foot.input [concat [bind .foot.input ] ";" { set line [.foot.input get] .foot.input delete 0 end @@ -241,3 +241,6 @@ bind .foot.input [concat [bind .foot.input ] ";" { } }] }] + +focus .foot.input + diff --git a/scrollbackup.sh b/scrollbackup.sh new file mode 100755 index 0000000000000000000000000000000000000000..ee9b2194277009639005ebddb96478463b8b4529 --- /dev/null +++ b/scrollbackup.sh @@ -0,0 +1,4 @@ +#!/bin/sh + +SERVER=$1 +printf "HIST\nQUIT\n" | nc "$@" > $SERVER-`date +%Y-%m-%d_%H-%M.txt`