Schily's LIBRARY FUNCTIONS                              HANDLE(3)


NAME

     handle() - sets a function to handle a condition


SYNOPSIS

     #include <sigblk.h>
     handle(signame, sp, func, arg1)
          char *signame;
          SIGBLK    *sp;
          int  (*func)();
          long arg1;


DESCRIPTION

     handle() sets up a handler for a condition.  The  user  must
     explicitly  allocate  the condition block and pass it to the
     function.

     handle() establishes function func as the condition  handler
     for  the  condition  signame.  arg1 is passed to func at the
     time of condition signalling. signame  "any_other",  catches
     all conditions.

     The specified function is called with the  actual  condition
     being  signalled,  with  arguments  from the latest handle()
     call for that function in the given frame and from the  call
     to raise(). For instance:

     int func (signame, arg1, arg2)
          char *signame; /* the actual condition being
                    /* signalled */
          int arg1; /* arg1 comes from the handle
                    /* call that set up the handler */
          int arg2; /* arg2 comes from the raise call */

     If the function returns TRUE (non-zero), it is assumed  that
     the  condition has been successfully handled; otherwise, the
     condition is signalled farther down the stack.


RETURNS

     none


NOTES

     Be careful when declaring args to func if they are not long;
     both args will occupy sizeof(long) bytes in the arglist.  If
     FALSE is returned by a condition handler, and  there  is  an
     any_other  handler  in the same block, the any_other handler
     will be invoked (only once, since it too may return FALSE).

     To revert a condition handler simply use NULL as func.

     SIGBLK, defined in <sigblk.h>, must be  included.   handle()
     is frequently used with longjmp() and setjmp().

Joerg Schilling    Last change: 15. Juli 1988                   1


Schily's LIBRARY FUNCTIONS                              HANDLE(3)

     Eah function  which  calls  handle()  must  call  unhandle()
     before it returns. Otherwise the return will fail.


BUGS

     Handle() makes the framepointer odd,  to  mark  the  current
     stack frame.

     This confuses programs like adb(1) and dbx(1).

Joerg Schilling    Last change: 15. Juli 1988                   2


Man(1) output converted with man2html


FhG Schily's Home VED powered