From 267802c97c4a19354647eb96893429d5c67214df Mon Sep 17 00:00:00 2001 From: Kaz Kyheku Date: Wed, 15 Jan 2020 20:07:06 -0800 Subject: chmod: work on streams and descriptors using fchmod. * configure: extend chmod detection to cover fchmod. * sysif.c (get_fd): New static functions. (chmod_wrap): Include fchmod wrapping for integer or stream argument. (sysif_init): Register fchmod intrinsic. --- txr.1 | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) (limited to 'txr.1') diff --git a/txr.1 b/txr.1 index 33a4a197..af6cd8a8 100644 --- a/txr.1 +++ b/txr.1 @@ -57880,15 +57880,18 @@ from a combined device number. .coNP Function @ chmod .synb -.mets (chmod < path << mode ) +.mets (chmod < target << mode ) .syne .desc The .code chmod -function changes the permissions of the filesystem objects +function changes the permissions of the filesystem object specified by -.metn path . -It is a direct wrapper for the POSIX C library function of the same name. +.metn target . +It is implemented in terms of the POSIX functions +.code chmod +and +.codn fchmod . The permissions are specified by .metn mode , @@ -57903,6 +57906,24 @@ The function throws a exception if an error occurs, otherwise it returns .codn t . +The +.meta target +argument may be a character string, in which case it specifies a pathname in +the filesystem. In this case, the POSIX function +.code chmod +is invoked. + +The +.meta target +argument may also be an integer file descriptor, or a stream. In these two +cases, the POSIX +.code fchmod +function is invoked. For a stream +.metn target , +the integer file descriptor is retrieved from the stream using +.code fileno +function. + .TP* Example: .verb ;; Set permissions of foo.txt to "rw-r--r--" -- cgit v1.2.3