diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2020-01-31 23:44:53 -0800 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2020-01-31 23:44:53 -0800 |
commit | c176ee050e0ce0010802154ff3e588aab3a67ae3 (patch) | |
tree | 557d268670a4e5f7bd96ce6e6e49c54fa5bd9019 /share | |
parent | 7e2addeabe1056da2a94ec8f6302c13bf916a1dc (diff) | |
download | txr-c176ee050e0ce0010802154ff3e588aab3a67ae3.tar.gz txr-c176ee050e0ce0010802154ff3e588aab3a67ae3.tar.bz2 txr-c176ee050e0ce0010802154ff3e588aab3a67ae3.zip |
New functions chmod-rec and chown-rec.
* lisplib.c (copy_file_set_entries): Add chown-rec and
chmod-rec to list of symbols that trigger auto-load of
copy-file.tl.
* share/txr/stdlib/copy-file.tl (chmod-rec, chown-rec): Neew
functions.
* txr.1: Documented.
Diffstat (limited to 'share')
-rwxr-xr-x | share/txr/stdlib/copy-file.tl | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/share/txr/stdlib/copy-file.tl b/share/txr/stdlib/copy-file.tl index 4f3eabb5..52125fd4 100755 --- a/share/txr/stdlib/copy-file.tl +++ b/share/txr/stdlib/copy-file.tl @@ -183,5 +183,34 @@ (retry `retry copying @path` (exc . args))))) (logior ftw-phys ftw-depth))) +(defun chmod-rec (path perm) + (ftw path + (lambda (path type stat . rest) + (while t + (catch** + (return + (caseql* type + ((ftw-dnr ftw-ns) (error "~s: unable to access ~s" + 'remove-rec path)) + (ftw-sl) + (t (chmod path perm)))) + (skip `skip chmod @path` (exc . args) (return)) + (retry `retry chmod @path` (exc . args))))) + (logior ftw-phys))) + +(defun chown-rec (path uid gid) + (ftw path + (lambda (path type stat . rest) + (while t + (catch** + (return + (caseql* type + ((ftw-dnr ftw-ns) (error "~s: unable to access ~s" + 'remove-rec path)) + (t (lchown path uid gid)))) + (skip `skip chown @path` (exc . args) (return)) + (retry `retry chown @path` (exc . args))))) + (logior ftw-phys))) + (eval-only (merge-delete-package 'sys)) |