1
0
Fork 0
mirror of git://git.gnupg.org/gnupg.git synced 2025-07-02 22:46:30 +02:00

gpg: Use gpgrt's new option parser to provide a global conf file.

* common/util.h: Remove argparse.h.
* common/argparse.c: Undef GPGRT_ENABLE_ARGPARSE_MACROS.
* configure.ac (GPGRT_ENABLE_ARGPARSE_MACROS): Define.
* agent/gpg-agent.c: Undef GPGRT_ENABLE_ARGPARSE_MACROS and include
argparse.h.  Do this also for all main modules which use our option
parser except for gpg.  Replace calls to strusage by calls to
gpgrt_strusage everywhere.

* g10/gpg.c (opts): Change type to gpgrt_opt_t.  Flag oOptions and
oNoOptions with ARGPARSE_conffile and ARGPARSE_no_conffile.
(main): Change type of pargs to gpgrt_argparse_t.  Rework the option
parser to make use of the new gpgrt_argparser.
--

This is not yet finished but a make check works.  gpg has the most
complex and oldest option handling and thus this is the first
migration target.  SE-Linux checks and version-ed config files are
missing and will be added later.

GnuPG-bug-id: 4788
Signed-off-by: Werner Koch <wk@gnupg.org>
This commit is contained in:
Werner Koch 2020-02-20 10:03:11 +01:00
parent ccdf988b40
commit 0e8f6e2aa9
No known key found for this signature in database
GPG key ID: E3FDFF218E45B72B
32 changed files with 268 additions and 166 deletions

View file

@ -269,7 +269,7 @@ warn_version_mismatch (assuan_context_t ctx, const char *servername, int mode)
{
gpg_error_t err;
char *serverversion;
const char *myversion = strusage (13);
const char *myversion = gpgrt_strusage (13);
err = get_assuan_server_version (ctx, mode, &serverversion);
if (err)

View file

@ -19,6 +19,9 @@
*/
#include <config.h>
/* We don't want to have the macros from gpgrt here until we have
* completely replaced this module by the one from gpgrt. */
#undef GPGRT_ENABLE_ARGPARSE_MACROS
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@ -41,6 +44,7 @@
#include "../common/ttyio.h"
#include "../common/server-help.h"
#include "../common/openpgpdefs.h"
#include "../common/argparse.h" /* temporary hack. */
#include "gpg-card.h"

View file

@ -18,6 +18,9 @@
*/
#include <config.h>
/* We don't want to have the macros from gpgrt here until we have
* completely replaced this module by the one from gpgrt. */
#undef GPGRT_ENABLE_ARGPARSE_MACROS
#include <stdio.h>
#include <stdlib.h>
@ -44,6 +47,7 @@
#include "../common/i18n.h"
#include "../common/sysutils.h"
#include "../common/init.h"
#include "../common/argparse.h" /* temporary hack. */
enum cmd_and_opt_values
@ -491,4 +495,3 @@ process (FILE *fp, pattern_t *patarray)
if (opt.verbose)
log_info ("no input line matches the pattern - accepted\n");
}

View file

@ -19,6 +19,9 @@
*/
#include <config.h>
/* We don't want to have the macros from gpgrt here until we have
* completely replaced this module by the one from gpgrt. */
#undef GPGRT_ENABLE_ARGPARSE_MACROS
#include <stdio.h>
#include <stdlib.h>
@ -31,6 +34,7 @@
#include "../common/i18n.h"
#include "../common/util.h"
#include "../common/argparse.h" /* temporary hack. */
#include "../common/asshelp.h"
#include "../common/sysutils.h"
#include "../common/membuf.h"

View file

@ -119,8 +119,10 @@
*
*/
#include <config.h>
/* We don't want to have the macros from gpgrt here until we have
* completely replaced this module by the one from gpgrt. */
#undef GPGRT_ENABLE_ARGPARSE_MACROS
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@ -136,6 +138,7 @@
#include "../common/sysutils.h"
#include "../common/init.h"
#include "../common/name-value.h"
#include "../common/argparse.h" /* temporary hack. */
/* Constants to identify the commands and options. */

View file

@ -19,6 +19,9 @@
*/
#include <config.h>
/* We don't want to have the macros from gpgrt here until we have
* completely replaced this module by the one from gpgrt. */
#undef GPGRT_ENABLE_ARGPARSE_MACROS
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@ -41,6 +44,7 @@
#include "mime-maker.h"
#include "send-mail.h"
#include "gpg-wks.h"
#include "../common/argparse.h" /* temporary hack. */
/* Constants to identify the commands and options. */

View file

@ -24,6 +24,9 @@
*/
#include <config.h>
/* We don't want to have the macros from gpgrt here until we have
* completely replaced this module by the one from gpgrt. */
#undef GPGRT_ENABLE_ARGPARSE_MACROS
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@ -45,6 +48,7 @@
#include "mime-maker.h"
#include "send-mail.h"
#include "gpg-wks.h"
#include "../common/argparse.h" /* temporary hack. */
/* The time we wait for a confirmation response. */

View file

@ -19,6 +19,9 @@
*/
#include <config.h>
/* We don't want to have the macros from gpgrt here until we have
* completely replaced this module by the one from gpgrt. */
#undef GPGRT_ENABLE_ARGPARSE_MACROS
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
@ -31,6 +34,7 @@
#include "../common/sysutils.h"
#include "../common/init.h"
#include "../common/status.h"
#include "../common/argparse.h" /* temporary hack. */
/* Constants to identify the commands and options. */

View file

@ -18,6 +18,9 @@
*/
#include <config.h>
/* We don't want to have the macros from gpgrt here until we have
* completely replaced this module by the one from gpgrt. */
#undef GPGRT_ENABLE_ARGPARSE_MACROS
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
@ -39,6 +42,7 @@
#define INCLUDED_BY_MAIN_MODULE 1
#include "../common/util.h"
#include "../common/openpgpdefs.h"
#include "../common/argparse.h" /* temporary hack. */
#ifdef HAVE_BZIP2
# include <bzlib.h>

View file

@ -27,6 +27,9 @@
gpg. So here we go. */
#include <config.h>
/* We don't want to have the macros from gpgrt here until we have
* completely replaced this module by the one from gpgrt. */
#undef GPGRT_ENABLE_ARGPARSE_MACROS
#include <ctype.h>
#include <errno.h>
#include <stdio.h>
@ -41,6 +44,7 @@
#include "../common/openpgpdefs.h"
#include "../common/init.h"
#include "../common/strlist.h"
#include "../common/argparse.h" /* temporary hack. */
#include "gpgtar.h"