diff options
Diffstat (limited to 'gr-run-waveform/guile/cat.scm')
-rw-r--r-- | gr-run-waveform/guile/cat.scm | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/gr-run-waveform/guile/cat.scm b/gr-run-waveform/guile/cat.scm new file mode 100644 index 000000000..575f1f508 --- /dev/null +++ b/gr-run-waveform/guile/cat.scm @@ -0,0 +1,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")) + |