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 librararies and programs; if not, write
20 * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21 * Floor, Boston, MA 02110-1301 USA
25 * $XConsortium: util_err.c /main/4 1995/11/06 18:53:42 rswiston $
27 * @(#)util_err.c 1.7 09 Jan 1995 cde_app_builder/src/libAButil
29 * RESTRICTED CONFIDENTIAL INFORMATION:
31 * The information in this document is subject to special
32 * restrictions in a confidential disclosure agreement between
33 * HP, IBM, Sun, USL, SCO and Univel. Do not distribute this
34 * document outside HP, IBM, Sun, USL, SCO, or Univel without
35 * Sun's specific written approval. This document and all copies
36 * and derivative works thereof must be returned or destroyed at
39 * Copyright 1993 Sun Microsystems, Inc. All rights reserved.
48 #include <ab_private/util_err.h>
51 /*************************************************************************
53 ** Private Function Declarations **
55 **************************************************************************/
58 /*************************************************************************
62 **************************************************************************/
64 /*************************************************************************
66 ** Function Definitions **
68 **************************************************************************/
71 util_err_string(int errCode)
78 err= catgets(UTIL_MESSAGE_CATD, UTIL_MESSAGE_SET, 4, "Internal error");
81 err= catgets(UTIL_MESSAGE_CATD, UTIL_MESSAGE_SET, 5, "Recursive function calls");
84 err= catgets(UTIL_MESSAGE_CATD, UTIL_MESSAGE_SET, 6, "Permission denied");
86 case ERR_DATA_SPACE_FULL:
87 err= catgets(UTIL_MESSAGE_CATD, UTIL_MESSAGE_SET, 8, "Data space is full");
89 case ERR_BUFFER_TOO_SMALL:
90 err= catgets(UTIL_MESSAGE_CATD, UTIL_MESSAGE_SET, 9, "Buffer is too small");
92 case ERR_NOT_IMPLEMENTED:
93 err= catgets(UTIL_MESSAGE_CATD, UTIL_MESSAGE_SET, 10, "Functionality is not implemented");
95 case ERR_NOT_INITIALIZED:
96 err= catgets(UTIL_MESSAGE_CATD, UTIL_MESSAGE_SET, 11, "Not initialized");
99 err= catgets(UTIL_MESSAGE_CATD, UTIL_MESSAGE_SET, 12, "Client error");
102 err= catgets(UTIL_MESSAGE_CATD, UTIL_MESSAGE_SET, 13, "Not found");
104 case ERR_DUPLICATE_KEY:
105 err= catgets(UTIL_MESSAGE_CATD, UTIL_MESSAGE_SET, 14, "Duplicate key");
108 err= catgets(UTIL_MESSAGE_CATD, UTIL_MESSAGE_SET, 15, "Bad parameter");
111 err= catgets(UTIL_MESSAGE_CATD, UTIL_MESSAGE_SET, 16, "I/O error");
113 case ERR_FILE_NOT_FOUND:
114 err= catgets(UTIL_MESSAGE_CATD, UTIL_MESSAGE_SET, 17, "File not found");
117 err= catgets(UTIL_MESSAGE_CATD, UTIL_MESSAGE_SET, 18, "Could not open file");
120 err= catgets(UTIL_MESSAGE_CATD, UTIL_MESSAGE_SET, 19, "Could not write to file");
123 err= catgets(UTIL_MESSAGE_CATD, UTIL_MESSAGE_SET, 20, "Could not read file");
126 err= catgets(UTIL_MESSAGE_CATD, UTIL_MESSAGE_SET, 21, "End of file");
128 case ERR_BAD_FILE_FORMAT:
129 err= catgets(UTIL_MESSAGE_CATD, UTIL_MESSAGE_SET, 22, "Bad file format");
132 err= catgets(UTIL_MESSAGE_CATD, UTIL_MESSAGE_SET, 23, "Could not rename file");
135 err= catgets(UTIL_MESSAGE_CATD, UTIL_MESSAGE_SET, 24, "Memory error");
138 err= catgets(UTIL_MESSAGE_CATD, UTIL_MESSAGE_SET, 25, "No memory");
140 case ERR_MEMORY_CORRUPT:
141 err= catgets(UTIL_MESSAGE_CATD, UTIL_MESSAGE_SET, 26, "Memory is corrupt");
143 case ERR_MULTIPLE_FREE:
144 err= catgets(UTIL_MESSAGE_CATD, UTIL_MESSAGE_SET, 27, "Multiple free of memory");
147 err= catgets(UTIL_MESSAGE_CATD, UTIL_MESSAGE_SET, 28, "Read-only file");
150 err= catgets(UTIL_MESSAGE_CATD, UTIL_MESSAGE_SET, 29, "Could not backup file");
155 * An error has already occurred. Don't return NULL and cause a
158 return err == NULL?"":err;
167 STRING errmsg = NULL;
169 errmsg = util_err_string(errCode);
171 util_printf_err("%s: %s\n", string, errmsg);
173 util_printf_err("%s\n", errmsg);