*** empty log message ***
Showing
2 changed files
with
0 additions
and
319 deletions
include/mailutils/errno.h
deleted
100644 → 0
1 | /* GNU Mailutils -- a suite of utilities for electronic mail | ||
2 | Copyright (C) 1999, 2000, 2001, 2003, 2004 Free Software Foundation, Inc. | ||
3 | |||
4 | This library is free software; you can redistribute it and/or | ||
5 | modify it under the terms of the GNU Lesser General Public | ||
6 | License as published by the Free Software Foundation; either | ||
7 | version 2 of the License, or (at your option) any later version. | ||
8 | |||
9 | This library is distributed in the hope that it will be useful, | ||
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
12 | Lesser General Public License for more details. | ||
13 | |||
14 | You should have received a copy of the GNU Lesser General Public | ||
15 | License along with this library; if not, write to the Free Software | ||
16 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ | ||
17 | |||
18 | #ifndef _MAILUTILS_ERRNO_H | ||
19 | #define _MAILUTILS_ERRNO_H 1 | ||
20 | |||
21 | #include <mailutils/types.h> | ||
22 | |||
23 | #ifdef __cplusplus | ||
24 | extern "C" { | ||
25 | #endif | ||
26 | |||
27 | #define MU_ERR_BASE 0x1000 | ||
28 | |||
29 | #define MU_ERR_FAILURE (MU_ERR_BASE + 1) | ||
30 | #define MU_ERR_NO_HANDLER (MU_ERR_BASE + 2) | ||
31 | #define MU_ERR_EMPTY_VFN (MU_ERR_BASE + 3) | ||
32 | |||
33 | #define MU_ERR_OUT_NULL (MU_ERR_BASE + 4) | ||
34 | #define MU_ERR_OUT_PTR_NULL (MU_ERR_BASE + 5) | ||
35 | |||
36 | #define MU_ERR_MBX_NULL (MU_ERR_BASE + 6) | ||
37 | |||
38 | #define MU_ERR_BAD_822_FORMAT (MU_ERR_BASE + 7) | ||
39 | #define MU_ERR_EMPTY_ADDRESS (MU_ERR_BASE + 8) | ||
40 | |||
41 | #define MU_ERR_LOCKER_NULL (MU_ERR_BASE + 9) | ||
42 | #define MU_ERR_LOCK_CONFLICT (MU_ERR_BASE + 10) | ||
43 | #define MU_ERR_LOCK_BAD_LOCK (MU_ERR_BASE + 11) | ||
44 | #define MU_ERR_LOCK_BAD_FILE (MU_ERR_BASE + 12) | ||
45 | #define MU_ERR_LOCK_NOT_HELD (MU_ERR_BASE + 13) | ||
46 | #define MU_ERR_LOCK_EXT_FAIL (MU_ERR_BASE + 14) | ||
47 | /* external program not found, or lack of system resources */ | ||
48 | #define MU_ERR_LOCK_EXT_ERR (MU_ERR_BASE + 15) | ||
49 | /* external program failed, specific reason unknown */ | ||
50 | #define MU_ERR_LOCK_EXT_KILLED (MU_ERR_BASE + 16) | ||
51 | /* external program was interrupted */ | ||
52 | |||
53 | #define MU_ERR_NO_SUCH_USER (MU_ERR_BASE + 17) | ||
54 | |||
55 | #define MU_ERR_GETHOSTBYNAME (MU_ERR_BASE + 18) | ||
56 | |||
57 | #define MU_ERR_BAD_RESUMPTION (MU_ERR_BASE + 19) | ||
58 | |||
59 | #define MU_ERR_MAILER_BAD_FROM (MU_ERR_BASE + 20) | ||
60 | #define MU_ERR_MAILER_BAD_TO (MU_ERR_BASE + 21) | ||
61 | #define MU_ERR_MAILER_NO_RCPT_TO (MU_ERR_BASE + 22) | ||
62 | #define MU_ERR_MAILER_BAD_URL (MU_ERR_BASE + 23) | ||
63 | #define MU_ERR_SMTP_RCPT_FAILED (MU_ERR_BASE + 24) | ||
64 | |||
65 | #define MU_ERR_TCP_NO_HOST (MU_ERR_BASE + 25) | ||
66 | #define MU_ERR_TCP_NO_PORT (MU_ERR_BASE + 26) | ||
67 | |||
68 | #define MU_ERR_BAD_2047_INPUT (MU_ERR_BASE + 27) | ||
69 | |||
70 | #define MU_ERR_NOUSERNAME (MU_ERR_BASE + 28) | ||
71 | #define MU_ERR_NOPASSWORD (MU_ERR_BASE + 29) | ||
72 | |||
73 | #define MU_ERR_UNSAFE_PERMS (MU_ERR_BASE + 30) | ||
74 | /* unsafe file permissions */ | ||
75 | |||
76 | #define MU_ERR_BAD_AUTH_SCHEME (MU_ERR_BASE + 31) | ||
77 | /* Unsupported authentication scheme */ | ||
78 | |||
79 | #define MU_ERR_AUTH_FAILURE (MU_ERR_BASE + 32) | ||
80 | /* Authentication failed */ | ||
81 | |||
82 | #define MU_ERR_PROCESS_NOEXEC (MU_ERR_BASE + 33) | ||
83 | /* Unable to execute subprocess */ | ||
84 | #define MU_ERR_PROCESS_EXITED (MU_ERR_BASE + 34) | ||
85 | /* Subprocess exited with a non-zero status */ | ||
86 | #define MU_ERR_PROCESS_SIGNALED (MU_ERR_BASE + 35) | ||
87 | /* Subprocess exited on signal */ | ||
88 | |||
89 | #define MU_ERR_PROCESS_UNKNOWN_FAILURE (MU_ERR_BASE + 36) | ||
90 | /* Unknown failure while executing subprocess */ | ||
91 | |||
92 | #define MU_ERR_CONN_CLOSED (MU_ERR_BASE + 37) | ||
93 | /* Connection closed by remote host */ | ||
94 | #define MU_ERR_PARSE (MU_ERR_BASE + 38) | ||
95 | /* Parse error */ | ||
96 | #define MU_ERR_NOENT (MU_ERR_BASE + 39) | ||
97 | /* Requested item not found */ | ||
98 | #define MU_ERR_BUFSPACE (MU_ERR_BASE + 40) | ||
99 | /* Not enough buffer space */ | ||
100 | |||
101 | #define MU_ERR_SQL (MU_ERR_BASE + 41) | ||
102 | /* SQL error */ | ||
103 | #define MU_ERR_DB_ALREADY_CONNECTED (MU_ERR_BASE + 42) | ||
104 | /* Already connected to the database */ | ||
105 | #define MU_ERR_DB_NOT_CONNECTED (MU_ERR_BASE + 43) | ||
106 | /* Not connected to the database */ | ||
107 | #define MU_ERR_RESULT_NOT_RELEASED (MU_ERR_BASE + 44) | ||
108 | /* Result of the previous query is not released */ | ||
109 | #define MU_ERR_NO_QUERY (MU_ERR_BASE + 45) | ||
110 | /* No query was executed */ | ||
111 | #define MU_ERR_BAD_COLUMN (MU_ERR_BASE + 46) | ||
112 | /* Bad column address */ | ||
113 | #define MU_ERR_NO_RESULT (MU_ERR_BASE + 47) | ||
114 | /* No result from the previous query available */ | ||
115 | #define MU_ERR_NO_INTERFACE (MU_ERR_BASE + 48) | ||
116 | /* No such interface */ | ||
117 | |||
118 | const char *mu_errname __P((int e)); | ||
119 | const char *mu_strerror __P((int e)); | ||
120 | |||
121 | #ifdef __cplusplus | ||
122 | } | ||
123 | #endif | ||
124 | |||
125 | #endif /* _MAILUTILS_ERRNO_H */ | ||
126 |
mailbox/muerrno.c
deleted
100644 → 0
1 | /* GNU Mailutils -- a suite of utilities for electronic mail | ||
2 | Copyright (C) 1999, 2000, 2001, 2002, 2003, | ||
3 | 2004 Free Software Foundation, Inc. | ||
4 | |||
5 | This library is free software; you can redistribute it and/or | ||
6 | modify it under the terms of the GNU Lesser General Public | ||
7 | License as published by the Free Software Foundation; either | ||
8 | version 2 of the License, or (at your option) any later version. | ||
9 | |||
10 | This library is distributed in the hope that it will be useful, | ||
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
13 | Lesser General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU Lesser General Public | ||
16 | License along with this library; if not, write to the Free Software | ||
17 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ | ||
18 | |||
19 | #ifdef HAVE_CONFIG_H | ||
20 | # include <config.h> | ||
21 | #endif | ||
22 | |||
23 | #include <stdio.h> | ||
24 | #include <errno.h> | ||
25 | #include <string.h> | ||
26 | |||
27 | #include <mailutils/errno.h> | ||
28 | #include <mailutils/nls.h> | ||
29 | |||
30 | #ifndef EOK | ||
31 | # define EOK 0 | ||
32 | #endif | ||
33 | |||
34 | const char* | ||
35 | mu_errname (int e) | ||
36 | { | ||
37 | static char buf[128]; | ||
38 | |||
39 | switch (e) | ||
40 | { | ||
41 | #define EN(x) case x: return #x | ||
42 | |||
43 | EN(EOK); | ||
44 | EN(EPERM); | ||
45 | EN(ENOENT); | ||
46 | EN(ESRCH); | ||
47 | EN(EINTR); | ||
48 | EN(EAGAIN); | ||
49 | EN(ENOMEM); | ||
50 | EN(EEXIST); | ||
51 | EN(EINVAL); | ||
52 | |||
53 | EN(MU_ERR_FAILURE); | ||
54 | |||
55 | EN(MU_ERR_NO_HANDLER); | ||
56 | EN(MU_ERR_EMPTY_VFN); | ||
57 | |||
58 | EN(MU_ERR_OUT_NULL); | ||
59 | EN(MU_ERR_OUT_PTR_NULL); | ||
60 | |||
61 | EN(MU_ERR_MBX_NULL); | ||
62 | |||
63 | EN(MU_ERR_BAD_822_FORMAT); | ||
64 | EN(MU_ERR_EMPTY_ADDRESS); | ||
65 | |||
66 | EN(MU_ERR_LOCKER_NULL); | ||
67 | EN(MU_ERR_LOCK_CONFLICT); | ||
68 | EN(MU_ERR_LOCK_BAD_LOCK); | ||
69 | EN(MU_ERR_LOCK_BAD_FILE); | ||
70 | EN(MU_ERR_LOCK_NOT_HELD); | ||
71 | EN(MU_ERR_LOCK_EXT_FAIL); | ||
72 | EN(MU_ERR_LOCK_EXT_ERR); | ||
73 | EN(MU_ERR_LOCK_EXT_KILLED); | ||
74 | |||
75 | EN(MU_ERR_NO_SUCH_USER); | ||
76 | EN(MU_ERR_GETHOSTBYNAME); | ||
77 | EN(MU_ERR_BAD_RESUMPTION); | ||
78 | EN(MU_ERR_MAILER_BAD_FROM); | ||
79 | EN(MU_ERR_MAILER_BAD_TO); | ||
80 | EN(MU_ERR_MAILER_BAD_URL); | ||
81 | EN(MU_ERR_MAILER_NO_RCPT_TO); | ||
82 | EN(MU_ERR_SMTP_RCPT_FAILED); | ||
83 | EN(MU_ERR_TCP_NO_HOST); | ||
84 | EN(MU_ERR_TCP_NO_PORT); | ||
85 | EN(MU_ERR_BAD_2047_INPUT); | ||
86 | EN(MU_ERR_NOUSERNAME); | ||
87 | EN(MU_ERR_NOPASSWORD); | ||
88 | |||
89 | EN(MU_ERR_UNSAFE_PERMS); | ||
90 | EN(MU_ERR_BAD_AUTH_SCHEME); | ||
91 | EN(MU_ERR_AUTH_FAILURE); | ||
92 | |||
93 | EN(MU_ERR_PROCESS_NOEXEC); | ||
94 | EN(MU_ERR_PROCESS_EXITED); | ||
95 | EN(MU_ERR_PROCESS_SIGNALED); | ||
96 | EN(MU_ERR_PROCESS_UNKNOWN_FAILURE); | ||
97 | |||
98 | EN(MU_ERR_CONN_CLOSED); | ||
99 | EN(MU_ERR_PARSE); | ||
100 | EN(MU_ERR_NOENT); | ||
101 | EN(MU_ERR_BUFSPACE); | ||
102 | |||
103 | EN(MU_ERR_SQL); | ||
104 | EN(MU_ERR_DB_ALREADY_CONNECTED); | ||
105 | EN(MU_ERR_DB_NOT_CONNECTED); | ||
106 | EN(MU_ERR_RESULT_NOT_RELEASED); | ||
107 | EN(MU_ERR_NO_QUERY); | ||
108 | EN(MU_ERR_BAD_COLUMN); | ||
109 | EN(MU_ERR_NO_RESULT); | ||
110 | EN(MU_ERR_NO_INTERFACE); | ||
111 | } | ||
112 | |||
113 | snprintf (buf, sizeof buf, _("Error %d"), e); | ||
114 | return buf; | ||
115 | } | ||
116 | |||
117 | const char * | ||
118 | mu_strerror (int e) | ||
119 | { | ||
120 | const char *msg = NULL; | ||
121 | |||
122 | switch (e) | ||
123 | { | ||
124 | #define ES(x, d) case x: msg = d; break; | ||
125 | ES(EOK, _("Success")); | ||
126 | |||
127 | ES(MU_ERR_FAILURE, _("Operation failed")); | ||
128 | |||
129 | ES(MU_ERR_NO_HANDLER, _("No registered handler")); | ||
130 | ES(MU_ERR_EMPTY_VFN, _("Empty virtual function")); | ||
131 | |||
132 | ES(MU_ERR_OUT_NULL, _("Pointer to output null")); | ||
133 | ES(MU_ERR_OUT_PTR_NULL, _("Pointer to output pointer null")); | ||
134 | |||
135 | ES(MU_ERR_MBX_NULL, _("Mailbox null")); | ||
136 | |||
137 | ES(MU_ERR_BAD_822_FORMAT, _("Format of RFC822 object is bad")); | ||
138 | ES(MU_ERR_EMPTY_ADDRESS, _("Address contains no addr specs")); | ||
139 | |||
140 | ES(MU_ERR_LOCKER_NULL, _("Locker null")); | ||
141 | ES(MU_ERR_LOCK_CONFLICT, _("Conflict with previous locker")); | ||
142 | ES(MU_ERR_LOCK_BAD_LOCK, _("Lock file check failed")); | ||
143 | ES(MU_ERR_LOCK_BAD_FILE, _("File check failed")); | ||
144 | ES(MU_ERR_LOCK_NOT_HELD, _("Lock not held on file")); | ||
145 | ES(MU_ERR_LOCK_EXT_FAIL, _("Failed to exec external locker")); | ||
146 | ES(MU_ERR_LOCK_EXT_ERR, _("External locker failed")); | ||
147 | ES(MU_ERR_LOCK_EXT_KILLED, _("External locker killed")); | ||
148 | |||
149 | ES(MU_ERR_NO_SUCH_USER, _("No such user name")); | ||
150 | |||
151 | ES(MU_ERR_GETHOSTBYNAME, _("DNS name resolution failed")); | ||
152 | ES(MU_ERR_BAD_RESUMPTION, _("State busy, must resume operation")); | ||
153 | ES(MU_ERR_MAILER_BAD_FROM, _("Not a valid mailer from address")); | ||
154 | ES(MU_ERR_MAILER_BAD_TO, _("Not a valid mailer to address")); | ||
155 | ES(MU_ERR_MAILER_NO_RCPT_TO,_("No receipt addresses found")); | ||
156 | ES(MU_ERR_MAILER_BAD_URL, _("Malformed or unsupported mailer URL")); | ||
157 | ES(MU_ERR_SMTP_RCPT_FAILED, _("SMTP rcpt to command failed")); | ||
158 | ES(MU_ERR_TCP_NO_HOST, _("Tcp connections need a host")); | ||
159 | ES(MU_ERR_TCP_NO_PORT, _("Tcp connections need a postive port")); | ||
160 | |||
161 | ES(MU_ERR_BAD_2047_INPUT, _("Input string is not RFC 2047 encoded")); | ||
162 | |||
163 | ES(MU_ERR_NOUSERNAME, _("User name is not supplied")); | ||
164 | ES(MU_ERR_NOPASSWORD, _("User password is not supplied")); | ||
165 | |||
166 | ES(MU_ERR_UNSAFE_PERMS, _("Unsafe file permissions. Set 0600.")); | ||
167 | ES(MU_ERR_BAD_AUTH_SCHEME, _("Unsupported authentication scheme")); | ||
168 | ES(MU_ERR_AUTH_FAILURE, _("Authentication failed")); | ||
169 | |||
170 | ES(MU_ERR_PROCESS_NOEXEC, _("Cannot execute")); | ||
171 | ES(MU_ERR_PROCESS_EXITED, _("Process exited with a non-zero status")); | ||
172 | ES(MU_ERR_PROCESS_SIGNALED, _("Process exited on signal")); | ||
173 | ES(MU_ERR_PROCESS_UNKNOWN_FAILURE, | ||
174 | _("Unknown failure while executing subprocess")); | ||
175 | ES(MU_ERR_CONN_CLOSED, _("Connection closed by remote host")); | ||
176 | ES(MU_ERR_PARSE, _("Parse error")); | ||
177 | ES(MU_ERR_NOENT, _("Requested item not found")); | ||
178 | ES(MU_ERR_BUFSPACE, _("Not enough buffer space")); | ||
179 | |||
180 | ES(MU_ERR_SQL, _("SQL error")); | ||
181 | ES(MU_ERR_DB_ALREADY_CONNECTED, _("Already connected to the database")); | ||
182 | ES(MU_ERR_DB_NOT_CONNECTED, _("Not connected to the database")); | ||
183 | ES(MU_ERR_RESULT_NOT_RELEASED, _("Result of the previous query is not released")); | ||
184 | ES(MU_ERR_NO_QUERY, _("No query was executed")); | ||
185 | ES(MU_ERR_BAD_COLUMN, _("Bad column address")); | ||
186 | ES(MU_ERR_NO_RESULT, _("No result from the previous query available")); | ||
187 | |||
188 | ES(MU_ERR_NO_INTERFACE, _("No such interface")); | ||
189 | } | ||
190 | |||
191 | return msg ? msg : strerror (e); | ||
192 | } | ||
193 |
-
Please register or sign in to post a comment