diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2016-03-02 20:13:26 -0800 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2016-03-02 20:13:26 -0800 |
commit | a4c7c97ed95a884ccf99cf8b3e0dfff715ef100a (patch) | |
tree | 12908a9e725ab752fee7e2c44fbda541eeacc178 | |
parent | a6b21fd386f88454f8c05a690ea309bec32c3857 (diff) | |
download | txr-a4c7c97ed95a884ccf99cf8b3e0dfff715ef100a.tar.gz txr-a4c7c97ed95a884ccf99cf8b3e0dfff715ef100a.tar.bz2 txr-a4c7c97ed95a884ccf99cf8b3e0dfff715ef100a.zip |
Support umask function.
* sysif.c (umask_wrap): New function.
(sysif_init): Register umask intrinsic.
* txr.1: Documented.
-rw-r--r-- | sysif.c | 14 | ||||
-rw-r--r-- | txr.1 | 16 |
2 files changed, 30 insertions, 0 deletions
@@ -668,6 +668,16 @@ val statf(val stream) return stat_impl(stream, w_fstat, lit("fstat")); } +#if HAVE_SYS_STAT + +static val umask_wrap(val mask) +{ + (void) umask(c_num(mask)); + return t; +} + +#endif + #if HAVE_PIPE static val pipe_wrap(void) @@ -1475,4 +1485,8 @@ void sysif_init(void) #if HAVE_POLL reg_fun(intern(lit("poll"), user_package), func_n2o(poll_wrap, 1)); #endif + +#if HAVE_SYS_STAT + reg_fun(intern(lit("umask"), user_package), func_n1(umask_wrap)); +#endif } @@ -35712,6 +35712,22 @@ For example .code (logtest mode s-irgrp) tests for the group read permission. +.coNP Functions @ umask +.synb +.mets (umask << mask ) +.syne +.desc +The +.code umask +function provides access to the Unix C library function of the same name, +which controls which permissions are denied +when files are newly created. If +.meta mask +is a +.code fixnum +integer, this succeeds and returns +.codn t . + .coNP Functions @, makedev @ minor and @ major .synb .mets (makedev < minor << major ) |