summaryrefslogtreecommitdiff
path: root/gr-run-waveform/guile/cat.scm
diff options
context:
space:
mode:
authorRob Savoye <rob@welcomehome.org>2010-11-29 07:55:53 -0700
committerRob Savoye <rob@welcomehome.org>2010-11-29 07:55:53 -0700
commit3ecf6fb2c22ecac75e70c9b1b5009cf2b5cf2b5f (patch)
tree87d673258194943f242d64cc794c03329a0968e7 /gr-run-waveform/guile/cat.scm
parent90f6ec6f292a0eca9ce8d63cb56f87ba7f1efae8 (diff)
scheme source test cases
Diffstat (limited to 'gr-run-waveform/guile/cat.scm')
-rw-r--r--gr-run-waveform/guile/cat.scm12
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 0000000000..575f1f5082
--- /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"))
+