Introduction
Introduction Statistics Contact Development Disclaimer Help
Sanitize status line msg - holymoly - A tor enabled gopher client written in CH…
git clone git://vernunftzentrum.de/holymoly.git
Log
Files
Refs
README
LICENSE
---
commit e85ae8fc44a31816b3b4c1f56756e20cc205b399
parent 76540ec5fe88b93b47c89c9a96c31b3382a87a1c
Author: Christian Kellermann <[email protected]>
Date: Thu, 8 Mar 2018 22:11:47 +0100
Sanitize status line msg
I have found out the hard way that this is passed to snprintf twice so
we need to escape any remaining tildes or this will get interpreted as
control character...
Diffstat:
holymoly.scm | 19 +++++++++----------
1 file changed, 9 insertions(+), 10 deletions(-)
---
diff --git a/holymoly.scm b/holymoly.scm
@@ -1,4 +1,4 @@
-(use tcp miscmacros srfi-13 srfi-4 posix ncurses matchable srfi-71)
+(use irregex tcp miscmacros srfi-13 srfi-4 posix ncurses matchable srfi-71)
(include "proxy.scm")
(include "cursor.scm")
@@ -115,15 +115,14 @@
(input-loop (cons input r))))))))
(define (new-status . msg)
- (let-values (((l c) (getmaxyx (status-win))))
- (let ((m (apply sprintf msg)))
- (wclear (status-win))
- (mvwprintw (status-win) 0 0 (if (> (string-length m) c)
- (string-take m c)
- m))
- (mvwchgat (status-win) 0 0 -1 A_STANDOUT 0 #f)
- (wrefresh (status-win))
- (doupdate))))
+ (let* ((m0 (apply sprintf msg))
+ (m (irregex-replace/all "~" m0 "~~")))
+ (let-values (((l c) (getmaxyx (status-win))))
+ (wclear (status-win))
+ (mvwprintw (status-win) 0 0 m)
+ (mvwchgat (status-win) 0 0 -1 A_STANDOUT 0 #f)
+ (wrefresh (status-win))
+ (doupdate))))
(define-record entry type title selector host port rest)
(define-record-printer entry
You are viewing proxied material from vernunftzentrum.de. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.