Tassilo Horn wrote:
> Hi all,
> currently the sb-posix package is missing `getcwd', so I added it.
> --- contrib/sb-posix/interface.lisp.orig 2007-03-03 21:19:26.000000000
> +++ contrib/sb-posix/interface.lisp 2007-05-09 23:11:09.000000000 +0200
> @@ -96,6 +96,7 @@
> (define-call* "dup" int minusp (oldfd file-descriptor))
> (define-call* "dup2" int minusp (oldfd file-descriptor)
> (newfd file-descriptor))
> +(define-call* "getcwd" c-string numberp)
Umm, on OS X, this function is documented as expecting a buffer and a
buffer size as arguments, neither of which are present in this
definition. Oddly, your definition works on my system, probably thanks
to the omitted buf argument being passed as NULL (which causes a
large-enough buffer to be allocated via malloc on OS X, but has
undefined consequences on linux).
I'd like to suggest you copy the behaviour of readlink (as it has
similar calling characteristics); maybe the
try-to-call-then-allocate-larger-buffer thing can even be abstracted
into a macro for both readlink and getcwd.
> (define-call* ("lseek" :options :largefile)
> off-t minusp (fd file-descriptor) (offset off-t)
> (whence int))
Andreas Fuchs, (http://|im:asf@...>, antifuchs