unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
* doc system-error-errno
@ 2004-07-28  1:08 Kevin Ryde
  0 siblings, 0 replies; only message in thread
From: Kevin Ryde @ 2004-07-28  1:08 UTC (permalink / raw)


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))))


_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-devel


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2004-07-28  1:08 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-07-28  1:08 doc system-error-errno Kevin Ryde

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).