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 cf04774209
commit 4568b8434b
No known key found for this signature in database
GPG Key ID: F3C1A0D9C1D65273
1 changed files with 12 additions and 0 deletions

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;
}