1 /* error.c - Error handling for GPGME.
2 Copyright (C) 2003 g10 Code GmbH
4 This file is part of GPGME.
6 GPGME is free software; you can redistribute it and/or modify it
7 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.
11 GPGME is distributed in the hope that it will be useful, but
12 WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with GPGME; if not, write to the Free Software Foundation,
18 Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
26 /* Return a pointer to a string containing a description of the error
27 code in the error value ERR. */
29 gpgme_strerror (gpgme_error_t err)
31 return gpg_strerror (err);
35 /* Return the error string for ERR in the user-supplied buffer BUF of
36 size BUFLEN. This function is, in contrast to gpg_strerror,
37 thread-safe if a thread-safe strerror_r() function is provided by
38 the system. If the function succeeds, 0 is returned and BUF
39 contains the string describing the error. If the buffer was not
40 large enough, ERANGE is returned and BUF contains as much of the
41 beginning of the error string as fits into the buffer. */
43 gpgme_strerror_r (gpg_error_t err, char *buf, size_t buflen)
45 return gpg_strerror_r (err, buf, buflen);
49 /* Return a pointer to a string containing a description of the error
50 source in the error value ERR. */
52 gpgme_strsource (gpgme_error_t err)
54 return gpg_strsource (err);
58 /* Retrieve the error code for the system error ERR. This returns
59 GPG_ERR_UNKNOWN_ERRNO if the system error is not mapped (report
62 gpgme_err_code_from_errno (int err)
64 return gpg_err_code_from_errno (err);
68 /* Retrieve the system error for the error code CODE. This returns 0
69 if CODE is not a system error code. */
71 gpgme_err_code_to_errno (gpgme_err_code_t code)
73 return gpg_err_code_from_errno (code);
77 /* Return an error value with the error source SOURCE and the system
80 gpgme_err_make_from_errno (gpg_err_source_t source, int err)
82 return gpg_err_make_from_errno (source, err);
86 /* Return an error value with the system error ERR. */
88 gpgme_error_from_errno (int err)
90 return gpgme_error (gpg_err_code_from_errno (err));