X-Git-Url: http://git.kpe.io/?p=kmrcl.git;a=blobdiff_plain;f=io.lisp;h=d4c50ef6b28a5e93c960558ffc18fbbcf3b4fc55;hp=292af3c68382cc23da07f6603a1d89ee13a84c72;hb=6173eb9ecdf840a556a60092c2f458860709cfd1;hpb=24b653b1cd1fa25c23b8c56a944152cf3e1fbe2e diff --git a/io.lisp b/io.lisp index 292af3c..d4c50ef 100644 --- a/io.lisp +++ b/io.lisp @@ -21,12 +21,13 @@ (defun print-file-contents (file &optional (strm *standard-output*)) "Opens a reads a file. Returns the contents as a single string" (when (probe-file file) - (with-open-file (in file :direction :input) - (let ((eof (gensym))) - (do ((line (read-line in nil eof) - (read-line in nil eof))) - ((eq line eof)) - (format strm "~A~%" line)))))) + (let ((eof (cons 'eof nil))) + (with-open-file (in file :direction :input) + (do ((line (read-line in nil eof) + (read-line in nil eof))) + ((eq line eof)) + (write-string line strm) + (write-char #\newline strm)))))) (defun read-file-to-string (file) "Opens a reads a file. Returns the contents as a single string"