mount does now work in server and standalone mode.
[gnupg.git] / common / status.c
blobe9f84bfd1690252fa054447bd5a128f6c17b17f1
1 /* status.c - status code helper functions
2 * Copyright (C) 2007 Free Software Foundation, Inc.
4 * This file is part of GnuPG.
6 * GnuPG 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 3 of the License, or
9 * (at your option) any later version.
11 * GnuPG 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.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, see <http://www.gnu.org/licenses/>.
20 #include <config.h>
21 #include <stdlib.h>
23 #include "util.h"
24 #include "status.h"
25 #include "status-codes.h"
28 /* Return the status string for code NO. */
29 const char *
30 get_status_string ( int no )
32 int idx = statusstr_msgidxof (no);
33 if (idx == -1)
34 return "?";
35 else
36 return statusstr_msgstr + statusstr_msgidx[idx];
40 const char *
41 get_inv_recpsgnr_code (gpg_error_t err)
43 const char *errstr;
45 switch (gpg_err_code (err))
47 case GPG_ERR_NO_PUBKEY: errstr = "1"; break;
48 case GPG_ERR_AMBIGUOUS_NAME: errstr = "2"; break;
49 case GPG_ERR_WRONG_KEY_USAGE: errstr = "3"; break;
50 case GPG_ERR_CERT_REVOKED: errstr = "4"; break;
51 case GPG_ERR_CERT_EXPIRED: errstr = "5"; break;
52 case GPG_ERR_NO_CRL_KNOWN: errstr = "6"; break;
53 case GPG_ERR_CRL_TOO_OLD: errstr = "7"; break;
54 case GPG_ERR_NO_POLICY_MATCH: errstr = "8"; break;
56 case GPG_ERR_UNUSABLE_SECKEY:
57 case GPG_ERR_NO_SECKEY: errstr = "9"; break;
59 case GPG_ERR_NOT_TRUSTED: errstr = "10"; break;
60 case GPG_ERR_MISSING_CERT: errstr = "11"; break;
61 default: errstr = "0"; break;
64 return errstr;