home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-385-Vol-1of3.iso / x / xtici.zip / xtici / error.c < prev    next >
C/C++ Source or Header  |  1991-08-28  |  4KB  |  128 lines

  1. /*
  2.  * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc.
  3.  *     All Rights Reserved
  4.  * 
  5.  * This file is a component of an X Window System client which uses the Xcms 
  6.  * Color Management System.  TekColor is a trademark of Tektronix, Inc.  The
  7.  * TekColor Editor is the subject of U.S. and foreign patents pending.  The
  8.  * term "TekHVC" designates a particular color space that is the subject of
  9.  * U.S. Patent No. 4,985,853 (equivalent foreign patents pending).
  10.  * Permission is hereby granted to use, copy, modify, sell, and otherwise
  11.  * distribute this software and its documentation for the X Window System
  12.  * environment, for any purpose and without fee, provided that:
  13.  * 
  14.  * 1.    The code and documentation are only used to implement a 
  15.  *      TekColor Editor in an X Window System environment; and
  16.  * 2.    This copyright and permission notice is reproduced in all copies
  17.  *     of the code and in supporting documentation.
  18.  * 
  19.  * Permission is granted to modify this code as required to allow it to
  20.  * be compiled on any host computer, provided that the functionality of
  21.  * the TekColor Editor is not modified in any way.  A description of any 
  22.  * modifications must be sent to Tektronix, Inc.  Contact 
  23.  * Tektronix Inc., P.O. Box 1000, Mail Station 60-850, 
  24.  * Network Displays Division Engineering, Wilsonville, OR 97070.
  25.  *
  26.  * Tektronix makes no representation about the suitability of this software
  27.  * for any purpose.  It is provided "as is" and with all faults.
  28.  * 
  29.  * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE,
  30.  * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
  31.  * PARTICULAR PURPOSE.  IN NO EVENT SHALL TEKTRONIX BE LIABLE FOR ANY
  32.  * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
  33.  * RESULTING FROM LOSS OF USE, DATA, OR PROFITS, WHETHER IN AN ACTION OF
  34.  * CONTRACT, NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
  35.  * CONNECTION WITH THE USE OR THE PERFORMANCE OF THIS SOFTWARE.
  36.  * 
  37.  *    NAME
  38.  *        error.c - an event error and an io error handler
  39.  *
  40.  *    DESCRIPTION
  41.  *        These routines are general purpose error handlers.
  42.  */
  43. #ifndef LINT
  44. static char *copy_notice = "Copyright 1991 Tektronix, Inc.";
  45. #ifdef RCS_ID
  46. static char *rcsid=  "$Header: error.c,v 1.1 91/08/22 11:14:52 adamsc Exp $";
  47. #endif /* RCS_ID */
  48. #endif /* LINT */
  49.  
  50. /*
  51.  *      EXTERNAL INCLUDES
  52.  */
  53.  
  54. /*
  55.  *      INTERNAL INCLUDES
  56.  */
  57. #include <stdio.h>
  58. #include <X11/Xlib.h>
  59.  
  60. /*
  61.  *      EXTERNS
  62.  */
  63. extern char *exeName;
  64. extern char *XDisplayString();
  65.  
  66. /*
  67.  *      GLOBALS
  68.  */
  69. #ifdef DEC
  70. #  define GLOBAL    global
  71. #else
  72. #  define GLOBAL
  73. #endif
  74.  
  75. /*
  76.  *      LOCAL DEFINES
  77.  */
  78.  
  79. /*
  80.  *      LOCAL TYPEDEFS
  81.  */
  82.  
  83. /*
  84.  *      LOCALS VARIABLES
  85.  */
  86. #ifdef DEBUG
  87. #  define STATIC
  88. #else
  89. #  define STATIC        static
  90. #endif
  91.  
  92.  
  93. /************************************************************************
  94.  *                                    *
  95.  *            PRIVATE ROUTINES                *
  96.  *                                    *
  97.  ************************************************************************/
  98.  
  99.  
  100. /************************************************************************
  101.  *                                    *
  102.  *            PUBLIC ROUTINES                 *
  103.  *                                    *
  104.  ************************************************************************/
  105.  
  106. int event_error_handler (pDsp, pErrEvent)
  107.     Display *pDsp;
  108.     XErrorEvent *pErrEvent;
  109. {
  110.     char msg[120];
  111.  
  112.     XGetErrorText (pDsp, pErrEvent->error_code, msg, 119);
  113.     fprintf (stderr, "Error: %s\n", msg);
  114.     fprintf (stderr, "       display      %s\n", XDisplayString (pDsp));
  115.     fprintf (stderr, "       serial #     %d\n", pErrEvent->serial);
  116.     fprintf (stderr, "       request code %d\n", pErrEvent->request_code);
  117.     fprintf (stderr, "       minor code   %d\n", pErrEvent->minor_code);
  118.     fprintf (stderr, "       resourceid   %d\n", (int) pErrEvent->resourceid);
  119.     return (0);
  120. }
  121.  
  122. int io_error_handler (pDsp)
  123.     Display *pDsp;
  124. {
  125.     fprintf (stderr, "Fatal Error:  Display %s\n", XDisplayString (pDsp));
  126.     exit (1);
  127. }
  128.