Fix warnings on FreeBSD
[oweals/cde.git] / cde / lib / DtSvc / DtUtil2 / UserMsg.h
1 /*
2  * CDE - Common Desktop Environment
3  *
4  * Copyright (c) 1993-2012, The Open Group. All rights reserved.
5  *
6  * These libraries and programs are free software; you can
7  * redistribute them and/or modify them under the terms of the GNU
8  * Lesser General Public License as published by the Free Software
9  * Foundation; either version 2 of the License, or (at your option)
10  * any later version.
11  *
12  * These libraries and programs are distributed in the hope that
13  * they will be useful, but WITHOUT ANY WARRANTY; without even the
14  * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15  * PURPOSE. See the GNU Lesser General Public License for more
16  * details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with these libraries and programs; if not, write
20  * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21  * Floor, Boston, MA 02110-1301 USA
22  */
23 /* $TOG: UserMsg.h /main/6 1998/04/09 17:50:49 mgreess $ */
24 /*
25  * (c) Copyright 1995 Digital Equipment Corporation.
26  * (c) Copyright 1988, 1993, 1994, 1995 Hewlett-Packard Company
27  * (c) Copyright 1993, 1994, 1995 International Business Machines Corp.
28  * (c) Copyright 1993, 1994, 1995 Sun Microsystems, Inc.
29  * (c) Copyright 1993, 1994, 1995 Novell, Inc. 
30  * (c) Copyright 1995 FUJITSU LIMITED.
31  * (c) Copyright 1995 Hitachi.
32  */
33
34 /* -*-C-*-
35 ********************************************************************************
36 *
37 * File:         usermsg.h
38 * Description:  Header for error logging routines
39 * Status:       Experimental (Do Not Distribute)
40 *
41 ********************************************************************************
42 */
43
44 #ifndef _usermsg_h
45 #define _usermsg_h
46
47 #include <X11/Intrinsic.h>
48
49 #ifndef __STDC__
50 #  ifndef const
51 #    define const
52 #  endif
53 #endif
54
55 #include <bms/XeUserMsg.h>
56
57 typedef enum {
58   DtIgnore,
59   DtInformation,
60   DtWarning,
61   DtError,
62   DtFatalError,
63   DtInternalError
64 } DtSeverity;
65
66
67 extern void _DtSimpleError( 
68                         char *progName,
69                         DtSeverity severity,
70                         char *help,
71                         char *format,
72                         ...) ;
73 extern void _DtSimpleErrnoError( 
74                         char *progName,
75                         DtSeverity severity,
76                         char *help,
77                         char *format,
78                         ...) ;
79
80 #define DtProgName  XeProgName
81
82 extern int _DtPrintDefaultError(
83         Display *dpy,
84         XErrorEvent *event,
85         char *msg );
86
87 #define _DTPRINTDEFAULTERROR_BUFSIZE 1024
88
89 extern int _DtPrintDefaultErrorSafe(
90         Display *dpy,
91         XErrorEvent *event,
92         char *msg,
93         int bytes);
94
95 /*
96     DESCRIPTION:
97
98         Supply the standard Xerror output to a buffer (instead of stederr)
99         so client can do what it wants with it.  Also don't exit.  Allow
100 client to decide what to do. 
101
102         An appropriate thing to do would be to pass the buffer to 
103         DtSimpleError() and return. ie. In your error callback:
104
105     {
106     char errmsg[1024];
107     int ret ;
108     ret = _DtPrintDefaultError (style.display, rep, errmsg);
109     DtSimpleError(DtWarning, "><An X Error has occurred...continuing" ,
110                              errmsg, NULL);
111     return ret;
112     }
113
114     SYNOPSIS:
115
116         int _DtPrintDefaultError (dpy, event, msg)
117
118         Display *dpy;       The application's display structure.
119
120         XErrorEvent *event; Error event returned to error callback.
121
122         char *msg;          Buffer returning the formatted text of 
123                             the error message.  It won't be more than
124                             1024 bytes.
125
126 */
127
128 #endif /* _usermsg_h */
129 /* DON'T ADD STUFF AFTER THIS #endif */