2 * CDE - Common Desktop Environment
4 * Copyright (c) 1993-2012, The Open Group. All rights reserved.
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)
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
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
23 /*%% (c) Copyright 1993, 1994 Hewlett-Packard Company */
24 /*%% (c) Copyright 1993, 1994 International Business Machines Corp. */
25 /*%% (c) Copyright 1993, 1994 Sun Microsystems, Inc. */
26 /*%% (c) Copyright 1993, 1994 Novell, Inc. */
27 /*%% $XConsortium: iserror.c /main/3 1995/10/23 11:38:16 rswiston $ */
29 * Copyright (c) 1988 by Sun Microsystems, Inc.
36 * NetISAM error handling functions.
40 #include "isam_impl.h"
46 #define LOG_USER LOG_INFO
51 * Fatal error. Display message and terminate program.
54 static int (*fatal_error_user_handler)(); /* set by iscntl(..,ISCNTL_FATAL,..) */
57 _isfatal_error(char *msg)
61 if (fatal_error_user_handler) {
62 logerr = fatal_error_user_handler(msg); /* User returns 1 in order
70 openlog("NetISAM", LOG_PID, LOG_USER);
72 /* Free one UNIX for syslog */
75 syslog(LOG_ERR, "Fatal error: %s - UNIX errno %d", msg, errno);
83 _isfatal_error1(char *msg)
87 if (fatal_error_user_handler) {
88 logerr = fatal_error_user_handler(msg); /* User returns 1 in order
96 openlog("NetISAM", LOG_PID, LOG_USER);
98 /* Free one UNIX for syslog */
101 syslog(LOG_ERR, "Fatal error: %s - UNIX errno %d", msg, errno);
108 _isam_warning(char *msg)
110 openlog("NetISAM", LOG_PID, LOG_USER);
111 syslog(LOG_ERR, "%s", msg);
114 /* Set user specified fatal_error handler */
115 int _isfatal_error_set_func(int(*func)())
120 oldfunc = fatal_error_user_handler;
123 fatal_error_user_handler = func;
129 * _setiserrno2(error, isstat1, isstat2)
131 * Set iserrno variable.
135 _setiserrno2(int error, int is1, int is2)
143 * _seterr_errcode(errcode)
145 * Set all error and status variable from errcode structure.
149 _seterr_errcode(struct errcode *errcode)
151 iserrno = errcode->iserrno;
152 isstat1 = errcode->isstat[0];
153 isstat2 = errcode->isstat[1];
154 isstat3 = errcode->isstat[2];
155 isstat4 = errcode->isstat[3];