aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2022-07-21 15:58:10 +0200
committerHugo Hörnquist <hugo@lysator.liu.se>2022-07-21 15:58:38 +0200
commitd41cee3e2d78c68a7368e29d92ccc27530bfa541 (patch)
tree40a2f6567f7d1aaec412adec902f3b0c59d216bf
parentActually implement parse-c-number. (diff)
downloadcalp-d41cee3e2d78c68a7368e29d92ccc27530bfa541.tar.gz
calp-d41cee3e2d78c68a7368e29d92ccc27530bfa541.tar.xz
Add read-file.
-rw-r--r--module/hnh/util/io.scm9
1 files 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))