diff options
author | Marius Vollmer <mvo@zagadka.de> | 2001-06-16 20:16:12 +0000 |
---|---|---|
committer | Marius Vollmer <mvo@zagadka.de> | 2001-06-16 20:16:12 +0000 |
commit | daabbf15d70430e8c042be71d8757f8f813cfa7d (patch) | |
tree | 330fa1cbdd6970e54fcffb14e5d88814d9f768ca | |
parent | 019ac1c98780291cb3732fc5cc501118f3567893 (diff) | |
download | guile-daabbf15d70430e8c042be71d8757f8f813cfa7d.tar.gz |
(Conventions): Use `system-error-errno' instead of explicit code
-rw-r--r-- | doc/posix.texi | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/doc/posix.texi b/doc/posix.texi index e16d0307a..300a7057b 100644 --- a/doc/posix.texi +++ b/doc/posix.texi @@ -68,15 +68,12 @@ the documentation. For ways to deal with exceptions, @ref{Exceptions}. -Errors which the C-library would report by returning a NULL -pointer or through some other means are reported by raising a -@code{system-error} exception. -The value of the Unix @code{errno} variable is available +Errors which the C-library would report by returning a NULL pointer or +through some other means are reported by raising a @code{system-error} +exception. The value of the Unix @code{errno} variable is available in the data passed by the exception. -Here's an ad-hoc@footnote{This may be changed in the future; be prepared -to rewrite this sort of code.} way to extract the @code{errno} value -from an exception: +It can be extracted with the function @code{system-error-errno}: @example (catch @@ -84,7 +81,7 @@ from an exception: (lambda () (mkdir "/this-ought-to-fail-if-I'm-not-root")) (lambda stuff - (let ((errno (car (list-ref stuff 4)))) + (let ((errno (system-error-errno 4))) (cond ((= errno EACCES) (display "You're not allowed to do that.")) @@ -95,9 +92,6 @@ from an exception: (newline)))) @end example -The important thing to note is that the @code{errno} value can be -extracted with @code{(car (list-ref stuff 4))}. - @node Ports and File Descriptors @section Ports and File Descriptors |