aboutsummaryrefslogtreecommitdiffstats
path: root/tests/t-version.c
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2013-02-26 16:10:18 +0000
committerWerner Koch <[email protected]>2013-02-26 16:10:18 +0000
commitd8b46c919f45666af0d541e00dcedf57e6c4b66f (patch)
tree7f07e8e93a55790df77ae6839fc32aebb4200198 /tests/t-version.c
parentUpdate GnuPG related m4 files. (diff)
downloadgpgme-d8b46c919f45666af0d541e00dcedf57e6c4b66f.tar.gz
gpgme-d8b46c919f45666af0d541e00dcedf57e6c4b66f.zip
Change the various version numbers to the new scheme.
* configure.ac: Rename my_foo variables to mym4_foo variables to make clear that they are processed by m4. (VERSION_NUMBER): New ac_subst. (AH_BOTTOM): Add CRIGHTBLURB macro. (BUILD_REVISION, BUILD_FILEVERSION, BUILD_TIMESTAMP): Change them to work similar to libgpg-error et al. * src/versioninfo.rc.in: Remove use of BUILD_NUMBER and get it in line with gpg-error et al. * src/version.c (cright_blurb): New. (gpgme_check_version_internal): Add magic to display the above information. * tests/t-version.c (main): Add option --verbose.
Diffstat (limited to 'tests/t-version.c')
-rw-r--r--tests/t-version.c57
1 files changed, 52 insertions, 5 deletions
diff --git a/tests/t-version.c b/tests/t-version.c
index 97d55a9f..2782ca39 100644
--- a/tests/t-version.c
+++ b/tests/t-version.c
@@ -22,24 +22,71 @@
#include <config.h>
#endif
+#include <stdio.h>
+#include <stdlib.h>
#include <string.h>
#include <gpgme.h>
+static int verbose;
+static int debug;
+
+
int
main (int argc, char **argv)
{
+ int ret;
const char *null_result;
const char *current_result;
const char *future_result;
+ int last_argc = -1;
+
+ if (argc)
+ {
+ argc--; argv++;
+ }
+ while (argc && last_argc != argc )
+ {
+ last_argc = argc;
+ if (!strcmp (*argv, "--help"))
+ {
+ puts ("usage: ./t-version [options]\n"
+ "\n"
+ "Options:\n"
+ " --verbose Show what is going on\n"
+ );
+ exit (0);
+ }
+ if (!strcmp (*argv, "--verbose"))
+ {
+ verbose = 1;
+ argc--; argv++;
+ }
+ else if (!strcmp (*argv, "--debug"))
+ {
+ verbose = debug = 1;
+ argc--; argv++;
+ }
+ }
+
null_result = gpgme_check_version (NULL);
current_result = gpgme_check_version (VERSION);
future_result = gpgme_check_version (VERSION ".1");
- return !(null_result
- && ! strcmp (null_result, VERSION)
- && current_result
- && ! strcmp (current_result, VERSION)
- && ! future_result);
+ ret = !(null_result
+ && ! strcmp (null_result, VERSION)
+ && current_result
+ && ! strcmp (current_result, VERSION)
+ && ! future_result);
+
+ if (verbose || ret)
+ {
+ printf ("Version from header: %s (0x%06x)\n",
+ GPGME_VERSION, GPGME_VERSION_NUMBER);
+ printf ("Version from binary: %s\n", gpgme_check_version (NULL));
+ printf ("Copyright blurb ...:%s\n", gpgme_check_version ("\x01\x01"));
+ }
+
+ return ret;
}