~mdw
/
lisp
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
base: New macro setf-default.
[lisp]
/
unix.lisp
diff --git
a/unix.lisp
b/unix.lisp
index
4465740
..
b4d0208
100644
(file)
--- a/
unix.lisp
+++ b/
unix.lisp
@@
-37,7
+37,7
@@
(defmacro with-buffer ((var len) &body body)
"Evaluate BODY with VAR bound to a pointer (a SAP, if you must know) to a
(defmacro with-buffer ((var len) &body body)
"Evaluate BODY with VAR bound to a pointer (a SAP, if you must know) to a
-buffer of LEN bytes."
+
buffer of LEN bytes."
(with-gensyms lenvar
`(let ((,lenvar ,len)
(,var nil))
(with-gensyms lenvar
`(let ((,lenvar ,len)
(,var nil))
@@
-69,8
+69,8
@@
buffer of LEN bytes."
errstring)
form &rest clauses)
"Evaluate FORM but trap Unix errors according to CLAUSES. Each clause has
errstring)
form &rest clauses)
"Evaluate FORM but trap Unix errors according to CLAUSES. Each clause has
-the form of a `case' clause, but may contain symbolic errno names as well as
-numbers."
+ the form of a `case' clause, but may contain symbolic errno names as well
+
as
numbers."
(flet ((fix (sw)
(cond ((eq sw t) 't)
((atom sw) (list (errno-value sw)))
(flet ((fix (sw)
(cond ((eq sw t) 't)
((atom sw) (list (errno-value sw)))
@@
-111,7
+111,7
@@
numbers."
(defun syscall* (name func &rest args)
"Call Unix system call FUNC, passing it ARGS. If it returns an error,
(defun syscall* (name func &rest args)
"Call Unix system call FUNC, passing it ARGS. If it returns an error,
-signal the unix-error condition, with NAME and ARGS."
+
signal the unix-error condition, with NAME and ARGS."
(multiple-value-call (lambda (rc &rest stuff)
(unless rc
(error 'unix-error
(multiple-value-call (lambda (rc &rest stuff)
(unless rc
(error 'unix-error
@@
-122,8
+122,9
@@
signal the unix-error condition, with NAME and ARGS."
(apply func args)))
(defmacro syscall (func &rest args)
"Call Unix system call FUNC, passing it ARGS. If it returns an error,
(apply func args)))
(defmacro syscall (func &rest args)
"Call Unix system call FUNC, passing it ARGS. If it returns an error,
-signal the unix-error condition, with FUNC and ARGS."
- `(syscall* ',func #',func ,@args))
+ signal the unix-error condition, with FUNC and ARGS."
+ `(syscall* ',func
+ #',func ,@args))
(macrolet ((doit (doc slots)
`(defstruct (stat (:predicate statp)
(macrolet ((doit (doc slots)
`(defstruct (stat (:predicate statp)
@@
-132,12
+133,12
@@
signal the unix-error condition, with FUNC and ARGS."
,doc
,@slots)))
(doit
,doc
,@slots)))
(doit
- "Structure representing all the useful information `stat' returns about
-
a
file."
+ "Structure representing all the useful information `stat' returns about
a
+
file."
(dev ino mode nlink uid gid rdev size atime mtime ctime blksize blocks)))
(defun sys-stat (file)
"Return information about FILE in a structure rather than as inconvenient
(dev ino mode nlink uid gid rdev size atime mtime ctime blksize blocks)))
(defun sys-stat (file)
"Return information about FILE in a structure rather than as inconvenient
-multiple values."
+
multiple values."
(multiple-value-call
(lambda (rc &rest results)
(unless rc
(multiple-value-call
(lambda (rc &rest results)
(unless rc
@@
-164,8
+165,8
@@
multiple values."
(defmacro with-unix-open ((fd file how &optional (mode #o666)) &body body)
"Evaluate BODY with FD bound to a file descriptor obtained from a Unix
(defmacro with-unix-open ((fd file how &optional (mode #o666)) &body body)
"Evaluate BODY with FD bound to a file descriptor obtained from a Unix
-`open' syscall with arguments FILE, HOW and MODE. Close the file descriptor
-when BODY is done."
+ `open' syscall with arguments FILE, HOW and MODE. Close the file
+
descriptor
when BODY is done."
`(let (,fd)
(unwind-protect
(progn
`(let (,fd)
(unwind-protect
(progn
@@
-175,8
+176,8
@@
when BODY is done."
(defun copy-file (from to &optional (how 0))
"Make a copy of the file FROM called TO. The copy has the same permissions
(defun copy-file (from to &optional (how 0))
"Make a copy of the file FROM called TO. The copy has the same permissions
-and timestamps (except for ctime) and attempts to have the same owner and
-group as the original."
+
and timestamps (except for ctime) and attempts to have the same owner and
+
group as the original."
(let ((st (sys-stat from)))
(with-unix-open (in from unix:O_RDONLY)
(with-unix-open (out
(let ((st (sys-stat from)))
(with-unix-open (in from unix:O_RDONLY)
(with-unix-open (out