libc: Fix strerror for unix.

db4
Doug Coleman 2014-07-04 03:25:57 -07:00
parent df452dfb91
commit dbba9f931b
4 changed files with 16 additions and 0 deletions

View File

@ -9,6 +9,10 @@ IN: libc
HOOK: strerror os ( errno -- str )
! For strerror on Unix all platforms
<< os windows? [ "libc.unix" require ] unless >>
! For libc.linux, libc.windows, libc.macosx...
<< "libc." os unparse append require >>
LIBRARY: factor

View File

@ -0,0 +1 @@
Doug Coleman

View File

@ -0,0 +1 @@
unix

View File

@ -0,0 +1,10 @@
! Copyright (C) 2014 Doug Coleman.
! See http://factorcode.org/license.txt for BSD license.
USING: alien.strings destructors kernel libc system ;
IN: libc.unix
M: unix strerror ( errno -- str )
[
1024 [ malloc &free ] keep [ strerror_r ] 2keep drop nip
alien>native-string
] with-destructors ;