summaryrefslogtreecommitdiffstatshomepage
path: root/tekuti/util.scm
diff options
context:
space:
mode:
authorGravatar Andy Wingo2008-02-28 22:14:42 +0100
committerGravatar Andy Wingo2008-02-28 22:14:42 +0100
commit0280eb9bd0deed9864c9009cd57290acf5239fb2 (patch)
tree25d2966bde88f12c9f9ee7b13c780f8072e6d907 /tekuti/util.scm
parent436ef221345ca074ff82115e359c9a85b5c70b1a (diff)
downloadtekuti-0280eb9bd0deed9864c9009cd57290acf5239fb2.tar.gz
tekuti-0280eb9bd0deed9864c9009cd57290acf5239fb2.zip
more cleanups, xhtml sanitization thanks to MikeS, --repl
Diffstat (limited to 'tekuti/util.scm')
-rw-r--r--tekuti/util.scm13
1 files changed, 12 insertions, 1 deletions
diff --git a/tekuti/util.scm b/tekuti/util.scm
index 35c0c78..2dd4240 100644
--- a/tekuti/util.scm
+++ b/tekuti/util.scm
@@ -29,9 +29,20 @@
#:use-module (srfi srfi-1)
#:export (expanduser match-lines dbg unwind-protect dbg dsu-sort
hash-push! list-has-length? list-head-match mapn
- take-max read-hash write-hash
+ take-max read-hash write-hash shell:quote
list-intersperse with-backtrace with-time-debugging define-memoized))
+(define (shell:quote str)
+ (with-output-to-string
+ (lambda ()
+ (display #\')
+ (string-for-each (lambda (ch)
+ (if (eqv? ch #\')
+ (begin (display #\\) (display #\'))
+ (display ch)))
+ str)
+ (display #\'))))
+
(define (expanduser path)
(let ((parts (string-split path #\/)))
(if (eqv? (string-ref (car parts) 0) #\~)