summaryrefslogtreecommitdiff
path: root/gr-run-waveform/guile/cat.scm
blob: 575f1f5082cd10c9e35e16589ccfe3adb6e238c1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
;;; This is non-idiomatic, but will exercise the port...
(define (cat input-port)
  (let loop ((ch (read-char input-port)))
      (if (not (eof-object? ch))
        (begin
              (write-char ch (current-output-port))
                  (loop (read-char input-port))))))

;; # Then start guile and use it
;; guile> (load "/tmp/cat.scm")
;; guile> (cat (open-file "/etc/passwd" "r"))