Permalink
Browse files

More DWIM in MKSTEMP: it will concatenate XXXXXX to the template, ins…

…tead of requiring the user to do so.

Signed-off-by: Stelian Ionescu <sionescu@common-lisp.net>
  • Loading branch information...
1 parent ce8f596 commit ce69b05b60f85fcfa347aa3aa6a6ca002beddea3 @sionescu sionescu committed Feb 4, 2008
Showing with 4 additions and 3 deletions.
  1. +4 −3 posix/unix.lisp
View
@@ -36,9 +36,10 @@
(defsyscall ("mkstemp" %mkstemp) :int
(template :pointer))
-(defun mkstemp (template)
- (with-foreign-string (ptr (filename template))
- (values (%mkstemp ptr) (foreign-string-to-lisp ptr))))
+(defun mkstemp (&optional (template ""))
+ (let ((template (concatenate 'string template "XXXXXX")))
+ (with-foreign-string (ptr (filename template))
+ (values (%mkstemp ptr) (foreign-string-to-lisp ptr)))))
(defsyscall "mkdtemp" :string
(template filename-designator))

0 comments on commit ce69b05

Please sign in to comment.