| ... | 
... | 
@@ -2871,7 +2871,10 @@ | 
| 
2871
 | 
2871
 | 
   (int-syscall ("fork")))
 | 
| 
2872
 | 
2872
 | 
 
  | 
| 
2873
 | 
2873
 | 
 (defun unix-setlocale ()
  | 
| 
2874
 | 
 
 | 
-  _N"Call setlocale(3c) with fixed args.  Returns 0 on success."
  | 
| 
 
 | 
2874
 | 
+  _N"Set all the categories of the locale according to the values of
  | 
| 
 
 | 
2875
 | 
+  the environment variables by calling setlocale(LC_ALL, \"\").
  | 
| 
 
 | 
2876
 | 
+
  | 
| 
 
 | 
2877
 | 
+  Returns 0 on success and -1 if setlocale failed."
  | 
| 
2875
 | 
2878
 | 
   (alien:alien-funcall
  | 
| 
2876
 | 
2879
 | 
    (alien:extern-alien "os_setlocale"
  | 
| 
2877
 | 
2880
 | 
 		       (function c-call:int))))
  | 
| ... | 
... | 
@@ -2899,6 +2902,35 @@ | 
| 
2899
 | 
2902
 | 
 			  (function (* char))))
  | 
| 
2900
 | 
2903
 | 
 	c-string))
  | 
| 
2901
 | 
2904
 | 
 
  | 
| 
 
 | 
2905
 | 
+(defun unix-mkstemp (template)
  | 
| 
 
 | 
2906
 | 
+  _N"Generates a unique temporary file name from TEMPLATE, and creates
  | 
| 
 
 | 
2907
 | 
+  and opens the file.  On success, the corresponding file descriptor
  | 
| 
 
 | 
2908
 | 
+  and name of the file is returned.
  | 
| 
 
 | 
2909
 | 
+
  | 
| 
 
 | 
2910
 | 
+ The last six characters of the template must be \"XXXXXX\"."
  | 
| 
 
 | 
2911
 | 
+  ;; Hope this buffer is large enough!
  | 
| 
 
 | 
2912
 | 
+  (let ((octets (%name->file template)))
  | 
| 
 
 | 
2913
 | 
+    (syscall ("mkstemp" c-call:c-string)
 | 
| 
 
 | 
2914
 | 
+	       (values result
  | 
| 
 
 | 
2915
 | 
+		       ;; Convert the file name back to a Lisp string.
  | 
| 
 
 | 
2916
 | 
+		       (%file->name octets))
  | 
| 
 
 | 
2917
 | 
+	       octets)))
  | 
| 
 
 | 
2918
 | 
+
  | 
| 
 
 | 
2919
 | 
+(defun unix-mkdtemp (template)
  | 
| 
 
 | 
2920
 | 
+  _N"Generate a uniquely named temporary directory from Template,
  | 
| 
 
 | 
2921
 | 
+  which must have \"XXXXXX\" as the last six characters.  The
  | 
| 
 
 | 
2922
 | 
+  directory is created with permissions 0700.  The name of the
  | 
| 
 
 | 
2923
 | 
+  directory is returned."
  | 
| 
 
 | 
2924
 | 
+  (let* ((octets (%name->file template))
  | 
| 
 
 | 
2925
 | 
+	 (result (alien-funcall
  | 
| 
 
 | 
2926
 | 
+		  (extern-alien "mkdtemp"
  | 
| 
 
 | 
2927
 | 
+				(function (* char)
  | 
| 
 
 | 
2928
 | 
+					  c-call:c-string))
  | 
| 
 
 | 
2929
 | 
+		  octets)))
  | 
| 
 
 | 
2930
 | 
+    (if (null-alien result)
  | 
| 
 
 | 
2931
 | 
+	(values nil (unix-errno))
  | 
| 
 
 | 
2932
 | 
+	(%file->name octets))))
  | 
| 
 
 | 
2933
 | 
+
  | 
| 
2902
 | 
2934
 | 
 (defun unix-strerror (errno)
  | 
| 
2903
 | 
2935
 | 
   _N"Returns a string that describes the error code Errno"
  | 
| 
2904
 | 
2936
 | 
   (cast
  |