X-Git-Url: http://git.kpe.io/?p=kmrcl.git;a=blobdiff_plain;f=io.lisp;h=d4c50ef6b28a5e93c960558ffc18fbbcf3b4fc55;hp=292af3c68382cc23da07f6603a1d89ee13a84c72;hb=8513c6f273613b0ceb2b48c07da6a0b1803c32a5;hpb=eb3a19183eef0273cb4bec74259f98802fb141f0 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"