diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2020-04-15 11:40:23 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2020-04-15 11:40:23 -0700 |
commit | 9e9513462ff0f82854dbc9d3f8bd42cd2ed8766e (patch) | |
tree | 5d9977ff20d29f39d351254e3bb9930ef2144915 /share | |
parent | 3f83104f00ce3818a3ea257be7ea8a7b4134e9be (diff) | |
download | txr-9e9513462ff0f82854dbc9d3f8bd42cd2ed8766e.tar.gz txr-9e9513462ff0f82854dbc9d3f8bd42cd2ed8766e.tar.bz2 txr-9e9513462ff0f82854dbc9d3f8bd42cd2ed8766e.zip |
New function: touch.
* lisplib.c (copy_file_set_entries): Register autoload for
touch.
* share/txr/stdlib/copy-file.tl (touch): New function.
* txr.1: Documented.
Diffstat (limited to 'share')
-rw-r--r-- | share/txr/stdlib/copy-file.tl | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/share/txr/stdlib/copy-file.tl b/share/txr/stdlib/copy-file.tl index 52125fd4..5c67a254 100644 --- a/share/txr/stdlib/copy-file.tl +++ b/share/txr/stdlib/copy-file.tl @@ -212,5 +212,12 @@ (retry `retry chown @path` (exc . args))))) (logior ftw-phys))) +(defun touch (path : ref-path) + (with-stream (s (or (ignerr (open-file path "mn")) (open-file path "n"))) + (if ref-path + (let ((rst (stat ref-path))) + (utimes s 0 nil rst.mtime rst.mtime-nsec)) + (utimes s 0 nil 0 t)))) + (eval-only (merge-delete-package 'sys)) |