LCOV - code coverage report
Current view: top level - common - status.c (source / functions) Hit Total Coverage
Test: coverage.info Lines: 4 21 19.0 %
Date: 2016-11-29 15:00:56 Functions: 1 2 50.0 %

          Line data    Source code
       1             : /* status.c - status code helper functions
       2             :  *      Copyright (C) 2007 Free Software Foundation, Inc.
       3             :  *
       4             :  * This file is part of GnuPG.
       5             :  *
       6             :  * This file is free software; you can redistribute it and/or modify
       7             :  * it under the terms of either
       8             :  *
       9             :  *   - the GNU Lesser General Public License as published by the Free
      10             :  *     Software Foundation; either version 3 of the License, or (at
      11             :  *     your option) any later version.
      12             :  *
      13             :  * or
      14             :  *
      15             :  *   - the GNU General Public License as published by the Free
      16             :  *     Software Foundation; either version 2 of the License, or (at
      17             :  *     your option) any later version.
      18             :  *
      19             :  * or both in parallel, as here.
      20             :  *
      21             :  * This file is distributed in the hope that it will be useful,
      22             :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      23             :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      24             :  * GNU General Public License for more details.
      25             :  *
      26             :  * You should have received a copy of the GNU General Public License
      27             :  * along with this program; if not, see <https://www.gnu.org/licenses/>.
      28             :  */
      29             : 
      30             : #include <config.h>
      31             : #include <stdlib.h>
      32             : 
      33             : #include "util.h"
      34             : #include "status.h"
      35             : #include "status-codes.h"
      36             : 
      37             : 
      38             : /* Return the status string for code NO. */
      39             : const char *
      40         110 : get_status_string ( int no )
      41             : {
      42         110 :   int idx = statusstr_msgidxof (no);
      43         110 :   if (idx == -1)
      44           0 :     return "?";
      45             :   else
      46         110 :     return statusstr_msgstr + statusstr_msgidx[idx];
      47             : }
      48             : 
      49             : 
      50             : const char *
      51           0 : get_inv_recpsgnr_code (gpg_error_t err)
      52             : {
      53             :   const char *errstr;
      54             : 
      55           0 :   switch (gpg_err_code (err))
      56             :     {
      57           0 :     case GPG_ERR_NO_PUBKEY:       errstr = "1"; break;
      58           0 :     case GPG_ERR_AMBIGUOUS_NAME:  errstr = "2"; break;
      59           0 :     case GPG_ERR_WRONG_KEY_USAGE: errstr = "3"; break;
      60           0 :     case GPG_ERR_CERT_REVOKED:    errstr = "4"; break;
      61           0 :     case GPG_ERR_CERT_EXPIRED:    errstr = "5"; break;
      62           0 :     case GPG_ERR_NO_CRL_KNOWN:    errstr = "6"; break;
      63           0 :     case GPG_ERR_CRL_TOO_OLD:     errstr = "7"; break;
      64           0 :     case GPG_ERR_NO_POLICY_MATCH: errstr = "8"; break;
      65             : 
      66             :     case GPG_ERR_UNUSABLE_SECKEY:
      67           0 :     case GPG_ERR_NO_SECKEY:       errstr = "9"; break;
      68             : 
      69           0 :     case GPG_ERR_NOT_TRUSTED:     errstr = "10"; break;
      70           0 :     case GPG_ERR_MISSING_CERT:    errstr = "11"; break;
      71           0 :     case GPG_ERR_MISSING_ISSUER_CERT: errstr = "12"; break;
      72           0 :     default:                      errstr = "0"; break;
      73             :     }
      74             : 
      75           0 :   return errstr;
      76             : }

Generated by: LCOV version 1.11