Add a --version command to the openpgp utility, and document it. The
version is grabbed from the openpgpsdk library. Make openpgp just include the one catch-all openpgpsdk header file.
This commit is contained in:
parent
c145c58334
commit
40cade5517
|
@ -53,6 +53,12 @@ const char *ops_str_from_map(int, ops_map_t *);
|
|||
int ops_set_debug_level(const char *);
|
||||
int ops_get_debug_level(const char *);
|
||||
|
||||
#ifndef PACKAGE_VERSION
|
||||
#define PACKAGE_VERSION "20090201"
|
||||
#endif
|
||||
|
||||
const char *ops_get_version(void);
|
||||
|
||||
#ifndef __UNCONST
|
||||
#define __UNCONST(a) ((void *)(unsigned long)(const void *)(a))
|
||||
#endif
|
||||
|
|
|
@ -30,14 +30,7 @@
|
|||
#include <libgen.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <openpgpsdk/keyring.h>
|
||||
#include <openpgpsdk/crypto.h>
|
||||
#include <openpgpsdk/signature.h>
|
||||
#include <openpgpsdk/validate.h>
|
||||
#include <openpgpsdk/readerwriter.h>
|
||||
#include <openpgpsdk/std_print.h>
|
||||
#include <openpgpsdk/packet-show.h>
|
||||
#include <openpgpsdk/util.h>
|
||||
#include <openpgpsdk/openpgpsdk.h>
|
||||
|
||||
#define DEFAULT_NUMBITS 2048
|
||||
|
||||
|
@ -65,6 +58,7 @@ enum optdefs {
|
|||
CLEARSIGN,
|
||||
VERIFY,
|
||||
LIST_PACKETS,
|
||||
VERSION,
|
||||
|
||||
/* options */
|
||||
KEYRING,
|
||||
|
@ -102,6 +96,8 @@ static struct option long_options[] = {
|
|||
|
||||
{"list-packets", no_argument, NULL, LIST_PACKETS},
|
||||
|
||||
{"version", no_argument, NULL, VERSION},
|
||||
|
||||
/* options */
|
||||
{"keyring", required_argument, NULL, KEYRING},
|
||||
{"userid", required_argument, NULL, USERID},
|
||||
|
@ -458,6 +454,10 @@ main(int argc, char **argv)
|
|||
p.cmd = long_options[optindex].val;
|
||||
break;
|
||||
|
||||
case VERSION:
|
||||
printf("%s version: %s\n", *argv, ops_get_version());
|
||||
exit(EXIT_SUCCESS);
|
||||
|
||||
/* option */
|
||||
|
||||
case KEYRING:
|
||||
|
|
|
@ -542,7 +542,9 @@ ops_rsa_private_decrypt(unsigned char *out, const unsigned char *in,
|
|||
|
||||
n = RSA_private_decrypt(length, in, out, orsa, RSA_NO_PADDING);
|
||||
|
||||
/* printf("ops_rsa_private_decrypt: n=%d\n",n); */
|
||||
if (ops_get_debug_level(__FILE__)) {
|
||||
printf("ops_rsa_private_decrypt: n=%d\n",n);
|
||||
}
|
||||
|
||||
errbuf[0] = '\0';
|
||||
if (n == -1) {
|
||||
|
|
|
@ -239,3 +239,10 @@ ops_get_debug_level(const char *f)
|
|||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* return the version for the library */
|
||||
const char *
|
||||
ops_get_version(void)
|
||||
{
|
||||
return PACKAGE_VERSION;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue