瀏覽代碼

moved REDIRECT to this file

Mark VandenBrink 12 年之前
父節點
當前提交
ec29820dde
共有 1 個文件被更改,包括 6 次插入0 次删除
  1. 6 0
      utils.lisp

+ 6 - 0
utils.lisp

@@ -42,3 +42,9 @@ to see if it matches. PATHNAME version."
     (if e
       (string= (string-downcase e) (string-downcase ext))
       nil)))
+
+(defmacro redirect (filename &rest body)
+  "Temporarily set *STANDARD-OUTPUT* to FILENAME and execute BODY."
+  `(let ((*standard-output* (open ,filename :direction :output :if-does-not-exist :create :if-exists :supersede)))
+     ,@body
+     (finish-output *standard-output*)))