/[winpt]/trunk/MyGPGME/errors.c
ViewVC logotype

Contents of /trunk/MyGPGME/errors.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 7 - (show annotations)
Mon Apr 4 07:01:43 2005 UTC (19 years, 10 months ago) by twoaday
File MIME type: text/plain
File size: 4721 byte(s)
2005-03-22  Timo Schulz  <twoaday@freakmail.de>
                                                                                
        * editcard.c: Support new status-fd entries SC_OP_SUCCESS
        and SC_OP_FAILURE.
        * editkey.c (cmd_addrev_handler): Check if context != NULL.
        * import.c (import_command_handler): Wrong function signature.
        Noted by Kurt Fitzner.
        * types.h: Fixed encrypt_result_s. Noted by Kurt.
        * gpgme.h (gpgme_editkey_addrev_set): Changed return type.
        Kudos to Kurt.
        * key.c: Removed some unreachable code. By Kurt.
                                                                                


1 /* errors.c - Error numbers
2 * Copyright (C) 2001, 2002, 2003 Timo Schulz
3 *
4 * This file is part of MyGPGME.
5 *
6 * MyGPGME is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * MyGPGME is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
19 */
20
21 #include <stdio.h>
22 #include "gpgme.h"
23
24 static char *(*gpgme_gettext)( const char * msgid ) = NULL;
25 #define _(a) _gpgme_gettext( a )
26
27
28 void
29 gpgme_set_gettext_handler( char *(*gettext)( const char *id ) )
30 {
31 gpgme_gettext = gettext;
32 }
33
34
35 const char*
36 _gpgme_gettext( const char * a )
37 {
38 return gpgme_gettext? gpgme_gettext( a ) : a;
39 }
40
41
42 /**
43 * gpgme_strerror:
44 * @err: Error code
45 *
46 * This function returns a textual representaion of the given
47 * errocode. If this is an unknown value, a string with the value
48 * is returned (which is hold in a static buffer).
49 *
50 * Return value: String with the error description.
51 **/
52 const char *
53 gpgme_strerror (gpgme_error_t err)
54 {
55 const char *s;
56 static char buf[128];
57
58 switch (err) {
59 case GPGME_EOF: s=_("End of file"); break;
60 case GPGME_No_Error: s=_("No Error"); break;
61 case GPGME_General_Error: s=_("General Error"); break;
62 case GPGME_Out_Of_Core: s=_("Out Of Core"); break;
63 case GPGME_Invalid_Value: s=_("Invalid Value"); break;
64 case GPGME_Busy: s=_("Busy"); break;
65 case GPGME_No_Request: s=_("No Request"); break;
66 case GPGME_Exec_Error: s=_("Exec Error"); break;
67 case GPGME_Too_Many_Procs: s=_("Too Many Procs"); break;
68 case GPGME_Pipe_Error: s=_("Pipe Error"); break;
69 case GPGME_No_Recipients: s=_("No Recipients"); break;
70 case GPGME_Inv_Recipients: s=_("Invalid Recipients"); break;
71 case GPGME_No_Data: s=_("No Data"); break;
72 case GPGME_Conflict: s=_("Conflict"); break;
73 case GPGME_Not_Implemented: s=_("Not Implemented"); break;
74 case GPGME_Read_Error: s=_("Read Error"); break;
75 case GPGME_Write_Error: s=_("Write Error"); break;
76 case GPGME_Invalid_Type: s=_("Invalid Type"); break;
77 case GPGME_Invalid_Mode: s=_("Invalid Mode"); break;
78 case GPGME_File_Error: s=_("File Error"); break;
79 case GPGME_Decryption_Failed: s=_("Decryption Failed"); break;
80 case GPGME_Signing_Failed: s=_("Signing Failed"); break;
81 case GPGME_Encryption_Failed: s=_("Encryption Failed"); break;
82 case GPGME_No_Passphrase: s=_("No Passphrase"); break;
83 case GPGME_No_Seckey: s=_("No secret key available"); break;
84 case GPGME_No_Pubkey: s=_("No public key available"); break;
85 case GPGME_Canceled: s=_("Cancelled"); break;
86 case GPGME_Invalid_Key: s=_("Invalid Key"); break;
87 case GPGME_Invalid_Engine: s=_("Invalid Engine"); break;
88 case GPGME_Bad_Signature: s=_("Bad Signature"); break;
89 case GPGME_Bad_Passphrase: s=_("Bad Passphrase"); break;
90 case GPGME_Clip_Open: s=_("Cannot open Clipboard"); break;
91 case GPGME_Clip_Empty: s=_("Clipboard is empty"); break;
92 case GPGME_Clip_Get: s=_("Cannot get Clipboard data"); break;
93 case GPGME_Internal_GPG_Problem: s=_("Internal GPG Problem, no more information available.\n"
94 "Please run GPG on the console to check this."); break;
95 case GPGME_Cipher_IDEA: s=_("Protection algorithm 1 (IDEA) is not supported."); break;
96 case GPGME_Conf_InvOption: s=_("Config file (gpg.conf) contains invalid option."); break;
97 case GPGME_SC_Failure: s=_("Smartcard operation failure"); break;
98 case GPGME_RecpError_NoReason: s = _("No specific reason given"); break;
99 case GPGME_RecpError_NotFound: s = _("Not Found" ); break;
100 case GPGME_RecpError_Ambigious:s = _("Ambigious specification"); break;
101 case GPGME_RecpError_WrongKeyUsage: s = _("Wrong key usage"); break;
102 case GPGME_RecpError_Revoked: s = _("Key revoked"); break;
103 case GPGME_RecpError_Expired: s = _("Key expired"); break;
104 case GPGME_RecpError_NotSecret:s = _("Not a secret key"); break;
105 case GPGME_RecpError_Untrusted:s = _("Key not trusted"); break;
106 default: sprintf( buf, "Unknown error ec=%d", err ); s=buf; break;
107 }
108
109 return s;
110 } /* gpgme_strerror */
111

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26