core: Add dup, dup2.

* src/posix.c (dup_, dup2_): New function.
This commit is contained in:
Jan Nieuwenhuizen 2018-11-11 10:18:50 +01:00
parent 7c63d3df47
commit 35c8408df4
No known key found for this signature in database
GPG key ID: F3C1A0D9C1D65273

View file

@ -380,3 +380,15 @@ getcwd_ () ///((name . "getcwd"))
return MAKE_STRING (cstring_to_list (getcwd (buf, PATH_MAX)));
}
SCM
dup_ (SCM port) ///((name . "dup"))
{
return MAKE_NUMBER (dup (VALUE (port)));
}
SCM
dup2_ (SCM old, SCM new) ///((name . "dup2"))
{
dup2 (VALUE (old), VALUE (new));
return cell_unspecified;
}