[Git][cmucl/cmucl][issue-365-add-strerror] 5 commits: Fix #364: Add interface to mkstemp and mkdtemp
Raymond Toy pushed to branch issue-365-add-strerror at cmucl / cmucl Commits: 9ea51cb2 by Raymond Toy at 2025-01-28T14:14:09+00:00 Fix #364: Add interface to mkstemp and mkdtemp - - - - - 98961a8b by Raymond Toy at 2025-01-28T14:14:10+00:00 Merge branch 'issue-364-add-mkstemp-mkdtemp' into 'master' Fix #364: Add interface to mkstemp and mkdtemp Closes #364 See merge request cmucl/cmucl!260 - - - - - 5f94e404 by Raymond Toy at 2025-01-28T15:50:59+00:00 Fix #369: Better docstring for unix-setlocale - - - - - 4bc3e3f4 by Raymond Toy at 2025-01-28T15:50:59+00:00 Merge branch 'issue-369-unix-setlocale-docstring' into 'master' Fix #369: Better docstring for unix-setlocale Closes #369 See merge request cmucl/cmucl!263 - - - - - 3c324a95 by Raymond Toy at 2025-01-28T08:34:18-08:00 Merge branch 'master' into issue-365-add-strerror Fixing conflict in unix.lisp - - - - - 2 changed files: - src/code/unix.lisp - src/i18n/locale/cmucl-unix.pot Changes: ===================================== src/code/unix.lisp ===================================== @@ -2871,7 +2871,10 @@ (int-syscall ("fork"))) (defun unix-setlocale () - _N"Call setlocale(3c) with fixed args. Returns 0 on success." + _N"Set all the categories of the locale according to the values of + the environment variables by calling setlocale(LC_ALL, \"\"). + + Returns 0 on success and -1 if setlocale failed." (alien:alien-funcall (alien:extern-alien "os_setlocale" (function c-call:int)))) @@ -2899,6 +2902,35 @@ (function (* char)))) c-string)) +(defun unix-mkstemp (template) + _N"Generates a unique temporary file name from TEMPLATE, and creates + and opens the file. On success, the corresponding file descriptor + and name of the file is returned. + + The last six characters of the template must be \"XXXXXX\"." + ;; Hope this buffer is large enough! + (let ((octets (%name->file template))) + (syscall ("mkstemp" c-call:c-string) + (values result + ;; Convert the file name back to a Lisp string. + (%file->name octets)) + octets))) + +(defun unix-mkdtemp (template) + _N"Generate a uniquely named temporary directory from Template, + which must have \"XXXXXX\" as the last six characters. The + directory is created with permissions 0700. The name of the + directory is returned." + (let* ((octets (%name->file template)) + (result (alien-funcall + (extern-alien "mkdtemp" + (function (* char) + c-call:c-string)) + octets))) + (if (null-alien result) + (values nil (unix-errno)) + (%file->name octets)))) + (defun unix-strerror (errno) _N"Returns a string that describes the error code Errno" (cast ===================================== src/i18n/locale/cmucl-unix.pot ===================================== @@ -1418,7 +1418,11 @@ msgid "" msgstr "" #: src/code/unix.lisp -msgid "Call setlocale(3c) with fixed args. Returns 0 on success." +msgid "" +"Set all the categories of the locale from the values of the\n" +" environment variables using setlocale(LC_ALL, \"\").\n" +"\n" +" Returns 0 on success and -1 if setlocale failed." msgstr "" #: src/code/unix.lisp View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/compare/c8e3b367dc215677f8e4453... -- View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/compare/c8e3b367dc215677f8e4453... You're receiving this email because of your account on gitlab.common-lisp.net.
participants (1)
-
Raymond Toy (@rtoy)