guile-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

doc system-error-errno


From: Kevin Ryde
Subject: doc system-error-errno
Date: Wed, 28 Jul 2004 11:08:04 +1000
User-agent: Gnus/5.110003 (No Gnus v0.3) Emacs/21.3 (gnu/linux)

A tweak to the wording at the end of the posix "Conventions" node,
using @defun for system-error-errno instead of just describing it in
words.


   Errors which the C library would report by returning a null pointer
or through some other means are reported by raising a `system-error'
exception.  The parameters to this exception are the function name (a
string), a message format string and argument list, and the Unix
`errno' variable (an integer).

     (define (my-handler key func fmt fmtargs errno)
       ...)

     (catch 'system-error
       (lambda () ...)
       my-handler)


 -- Function: system-error-errno arglist
     Return the `errno' value exception arguments, or `#f' if not
     available (if not a `system-error' exception).

          (catch
           'system-error
           (lambda ()
             (mkdir "/this-ought-to-fail-if-I'm-not-root"))
           (lambda stuff
             (let ((errno (system-error-errno stuff)))
               (cond
                ((= errno EACCES)
                 (display "You're not allowed to do that."))
                ((= errno EEXIST)
                 (display "Already exists."))
                (#t
                 (display (strerror errno))))
               (newline))))




reply via email to

[Prev in Thread] Current Thread [Next in Thread]