home *** CD-ROM | disk | FTP | other *** search
/ Amiga Elysian Archive / AmigaElysianArchive.iso / prog / utils / sercli.shr / sercli / src / errors.c < prev    next >
Encoding:
C/C++ Source or Header  |  1993-06-16  |  783 b   |  40 lines

  1. /*
  2. **  $Source: WB_2.1:homes/rkr/prog/sercli/src/RCS/errors.c,v $
  3. **  $Author: rkr $
  4. **  $Revision: 1.5 $
  5. **  $Locker: rkr $
  6. **  $State: Exp $
  7. **  $Date: 1993/06/16 23:30:56 $
  8. **
  9. **  sercli (an Amiga .device <-> FIFO interface tool)
  10. **  Copyright (C) 1993  Richard Rauch
  11. **
  12. **  See /doc/sercli.doc and /COPYING for use and distribution license.
  13. **
  14. */
  15.  
  16. #include "errors.h"
  17.  
  18. static error_handler handlers [num_error_types];
  19.  
  20. error_handler set_error_handler (error_type type, error_handler new_handler)
  21. {
  22.     error_handler old_handler;
  23.  
  24.     old_handler = handlers [type];
  25.     handlers [type] = new_handler;
  26.  
  27.     return (old_handler);
  28. }
  29.  
  30.  
  31.  
  32. void handle_error (error_type type, void *error)
  33. {
  34.     error_handler handler;
  35.  
  36.     handler = handlers [type];
  37.     if (handler)
  38.     handler (error);
  39. }
  40.