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
--- /dev/null
+! 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 ;