[git] GPGME - branch, json-tool, updated. gpgme-1.10.0-60-ge14f1f6

by Werner Koch cvs at cvs.gnupg.org
Wed Mar 21 19:32:46 CET 2018


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GnuPG Made Easy".

The branch, json-tool has been updated
       via  e14f1f687ff618716ed17e309a0475df95e1c0aa (commit)
      from  6073789a6d3514263404c93fa795a398bfd93d91 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit e14f1f687ff618716ed17e309a0475df95e1c0aa
Author: Werner Koch <wk at gnupg.org>
Date:   Wed Mar 21 19:26:03 2018 +0100

    json: Use gpgrt_argparse instead of argsparse.c
    
    * src/gpgme-json.c: Remove header argparse.h.  Define
    GPGRT_ENABLE_ARGPARSE_MACROS.
    (interactive_repl): Replace strusage by gpgrt_strusage.
    (my_strusage): Add SPDX level.
    (main): Switch to gpgrt_argparse stuff but keep very limited
    functionality when building with an older libgpg-error.
    
    Signed-off-by: Werner Koch <wk at gnupg.org>

diff --git a/src/Makefile.am b/src/Makefile.am
index b5941fc..c2d4a84 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -102,10 +102,10 @@ AM_CFLAGS = @LIBASSUAN_CFLAGS@ @GLIB_CFLAGS@
 gpgme_tool_SOURCES = gpgme-tool.c argparse.c argparse.h
 gpgme_tool_LDADD = libgpgme.la @LIBASSUAN_LIBS@
 
-gpgme_json_SOURCES = gpgme-json.c argparse.c argparse.h cJSON.c cJSON.h
+gpgme_json_SOURCES = gpgme-json.c cJSON.c cJSON.h
 gpgme_json_LDADD = -lm libgpgme.la $(GPG_ERROR_LIBS)
-## We use -no-install temporary during development.
-#gpgme_json_LDFLAGS = -no-install
+# We use -no-install temporary during development.
+gpgme_json_LDFLAGS = -no-install
 
 
 if HAVE_W32_SYSTEM
diff --git a/src/gpgme-json.c b/src/gpgme-json.c
index 00d8110..75f1a09 100644
--- a/src/gpgme-json.c
+++ b/src/gpgme-json.c
@@ -36,8 +36,8 @@
 
 #define GPGRT_ENABLE_ES_MACROS 1
 #define GPGRT_ENABLE_LOG_MACROS 1
+#define GPGRT_ENABLE_ARGPARSE_MACROS 1
 #include "gpgme.h"
-#include "argparse.h"
 #include "cJSON.h"
 
 
@@ -828,8 +828,10 @@ interactive_repl (void)
   int first;
 
   es_setvbuf (es_stdin, NULL, _IONBF, 0);
+#if GPGRT_VERSION_NUMBER >= 0x011d00 /* 1.29 */
   es_fprintf (es_stderr, "%s %s ready (enter \",help\" for help)\n",
-              strusage (11), strusage (13));
+              gpgrt_strusage (11), gpgrt_strusage (13));
+#endif
   do
     {
       es_fputs ("> ", es_stderr);
@@ -1064,6 +1066,7 @@ my_strusage( int level )
 
   switch (level)
     {
+    case  9: p = "LGPL-2.1-or-later"; break;
     case 11: p = "gpgme-json"; break;
     case 13: p = PACKAGE_VERSION; break;
     case 14: p = "Copyright (C) 2018 g10 Code GmbH"; break;
@@ -1083,24 +1086,30 @@ my_strusage( int level )
   return p;
 }
 
-
 int
 main (int argc, char *argv[])
 {
+#if GPGRT_VERSION_NUMBER < 0x011d00 /* 1.29 */
+
+  fprintf (stderr, "WARNING: Old libgpg-error - using limited mode\n");
+  native_messaging_repl ();
+
+#else /* This is a modern libgp-error.  */
+
   enum { CMD_DEFAULT     = 0,
          CMD_INTERACTIVE = 'i',
          CMD_SINGLE      = 's',
          CMD_LIBVERSION  = 501
   } cmd = CMD_DEFAULT;
-  static ARGPARSE_OPTS opts[] = {
+  static gpgrt_opt_t opts[] = {
     ARGPARSE_c  (CMD_INTERACTIVE, "interactive", "Interactive REPL"),
     ARGPARSE_c  (CMD_SINGLE,      "single",      "Single request mode"),
     ARGPARSE_c  (CMD_LIBVERSION,  "lib-version", "Show library version"),
     ARGPARSE_end()
   };
-  ARGPARSE_ARGS pargs = { &argc, &argv, 0 };
+  gpgrt_argparse_t pargs = { &argc, &argv};
 
-  set_strusage (my_strusage);
+  gpgrt_set_strusage (my_strusage);
 
 #ifdef HAVE_SETLOCALE
   setlocale (LC_ALL, "");
@@ -1113,7 +1122,7 @@ main (int argc, char *argv[])
   gpgme_set_locale (NULL, LC_MESSAGES, setlocale (LC_MESSAGES, NULL));
 #endif
 
-  while (arg_parse  (&pargs, opts))
+  while (gpgrt_argparse (NULL, &pargs, opts))
     {
       switch (pargs.r_opt)
         {
@@ -1130,6 +1139,7 @@ main (int argc, char *argv[])
 	  break;
         }
     }
+  gpgrt_argparse (NULL, &pargs, NULL);
 
   switch (cmd)
     {
@@ -1153,5 +1163,6 @@ main (int argc, char *argv[])
       break;
     }
 
+#endif /* This is a modern libgp-error.  */
   return 0;
 }

-----------------------------------------------------------------------

Summary of changes:
 src/Makefile.am  |  6 +++---
 src/gpgme-json.c | 25 ++++++++++++++++++-------
 2 files changed, 21 insertions(+), 10 deletions(-)


hooks/post-receive
-- 
GnuPG Made Easy
http://git.gnupg.org




More information about the Gnupg-commits mailing list