From d41cee3e2d78c68a7368e29d92ccc27530bfa541 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Thu, 21 Jul 2022 15:58:10 +0200 Subject: Add read-file. --- module/hnh/util/io.scm | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/module/hnh/util/io.scm b/module/hnh/util/io.scm index d638ebb4..6aed85ac 100644 --- a/module/hnh/util/io.scm +++ b/module/hnh/util/io.scm @@ -1,10 +1,11 @@ (define-module (hnh util io) :use-module ((hnh util) :select (begin1)) - :use-module ((ice-9 rdelim) :select (read-line)) + :use-module ((ice-9 rdelim) :select (read-line read-string)) :export (open-input-port open-output-port read-lines - with-atomic-output-to-file)) + with-atomic-output-to-file + read-file)) (define (open-input-port str) (if (string=? "-" str) @@ -62,3 +63,7 @@ ;; counted on, since anything with an unspecified return ;; value might as well return #f) #f)))) + + +(define (read-file path) + (call-with-input-file path read-string)) -- cgit v1.2.3