mirror of
https://github.com/janet-lang/janet
synced 2024-12-01 12:29:54 +00:00
Add os/umask.
This commit is contained in:
parent
5b6b9f1597
commit
3c2b1baff2
@ -797,6 +797,16 @@ static Janet os_symlink(int32_t argc, Janet *argv) {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static Janet os_umask(int32_t argc, Janet *argv) {
|
||||||
|
janet_fixarity(argc, 1);
|
||||||
|
#ifdef JANET_WINDOWS
|
||||||
|
janet_panicf("os/umask not supported on Windows");
|
||||||
|
#else
|
||||||
|
int32_t mask = janet_getinteger(argv, 0);
|
||||||
|
return janet_wrap_integer(umask(mask));
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
static Janet os_mkdir(int32_t argc, Janet *argv) {
|
static Janet os_mkdir(int32_t argc, Janet *argv) {
|
||||||
janet_fixarity(argc, 1);
|
janet_fixarity(argc, 1);
|
||||||
const char *path = janet_getcstring(argv, 0);
|
const char *path = janet_getcstring(argv, 0);
|
||||||
@ -1285,6 +1295,11 @@ static const JanetReg os_cfuns[] = {
|
|||||||
JDOC("(os/cd path)\n\n"
|
JDOC("(os/cd path)\n\n"
|
||||||
"Change current directory to path. Returns nil on success, errors on failure.")
|
"Change current directory to path. Returns nil on success, errors on failure.")
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"os/umask", os_umask,
|
||||||
|
JDOC("(os/umask mask)\n\n"
|
||||||
|
"Set a new umask, returns the old umask.")
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"os/mkdir", os_mkdir,
|
"os/mkdir", os_mkdir,
|
||||||
JDOC("(os/mkdir path)\n\n"
|
JDOC("(os/mkdir path)\n\n"
|
||||||
|
Loading…
Reference in New Issue
Block a user