Przeglądaj źródła

moved REDIRECT to this file

Mark VandenBrink 12 lat temu
rodzic
commit
ec29820dde
1 zmienionych plików z 6 dodań i 0 usunięć
  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*)))