aboutsummaryrefslogtreecommitdiffstats
path: root/src/visibility.h
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2020-02-18 15:47:05 +0000
committerWerner Koch <[email protected]>2020-02-18 15:50:46 +0000
commit933eb9346a84c87f83f77d990be2f66e2f7b62e7 (patch)
tree4560fa9440d0e98f8662eb737c56d40d4499dab9 /src/visibility.h
parentcore: Add gpgrt_fnameconcat and gpgrt_absfnameconcat. (diff)
downloadlibgpg-error-933eb9346a84c87f83f77d990be2f66e2f7b62e7.tar.gz
libgpg-error-933eb9346a84c87f83f77d990be2f66e2f7b62e7.zip
core: Add a high level option/argument parser.
* gpg-error.h.in (GPGRT_CONFDIR_USER, GPGRT_CONFDIR_SYS): New consts. (ARGPARSE_FLAG_SYS, ARGPARSE_FLAG_USER, ARGPARSE_FLAG_VERBOSE) (ARGPARSE_NO_CONFFILE, ARGPARSE_CONFFILE, ARGPARSE_OPT_CONFFILE): New consts. (ARGPARSE_conffile, ARGPARSE_noconffile): New macros. (gpgrt_set_confdir): New func. (gpgrt_argparser): New func. * src/argparse.c (confdir): New var. (enum argparser_states): New. (struct _gpgrt_argparse_internal_s): Add a couple of new fields. (initialize): Init them. (any_opt_conffile): New. (_gpgrt_argparser): New. (_gpgrt_set_confdir): New. * src/visibility.c (gpgrt_argparser): New. (gpgrt_set_confdir): New. * src/gpg-error.def.in, src/gpg-error.vers: Add those functions. * tests/t-argparse.c (main): Reworked. * tests/etc/t-argparse.conf: New file. * tests/t-argparse.conf: New file. -- gpgrt_argparser is a high level version of gpgrt_argparse. It handles reading of configuration files internally and allows allows for a global configuration file. The design is so that it minimizes the work to replace the existing option parsing in gpg and friends by this one and to allow global configuration files for them. This is the just the basic code which should allow replacement of the parsers. A forthcoming patch will implement flags for options given in the global config file. GnuPG-bug-id: 4788 Signed-off-by: Werner Koch <[email protected]>
Diffstat (limited to 'src/visibility.h')
-rw-r--r--src/visibility.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/visibility.h b/src/visibility.h
index 192f733..0759d2f 100644
--- a/src/visibility.h
+++ b/src/visibility.h
@@ -208,11 +208,13 @@ MARK_VISIBLE (gpgrt_release_process)
#endif
MARK_VISIBLE (gpgrt_argparse)
+MARK_VISIBLE (gpgrt_argparser)
MARK_VISIBLE (gpgrt_usage)
MARK_VISIBLE (gpgrt_strusage)
MARK_VISIBLE (gpgrt_set_strusage)
MARK_VISIBLE (gpgrt_set_fixed_string_mapper);
MARK_VISIBLE (gpgrt_set_usage_outfnc);
+MARK_VISIBLE (gpgrt_set_confdir);
MARK_VISIBLE (gpgrt_cmp_version);
@@ -389,11 +391,13 @@ MARK_VISIBLE (gpgrt_absfnameconcat);
#define gpgrt_release_process _gpgrt_USE_UNDERSCORED_FUNCTION
#define gpgrt_argparse _gpgrt_USE_UNDERSCORED_FUNCTION
+#define gpgrt_argparser _gpgrt_USE_UNDERSCORED_FUNCTION
#define gpgrt_usage _gpgrt_USE_UNDERSCORED_FUNCTION
#define gpgrt_set_strusage _gpgrt_USE_UNDERSCORED_FUNCTION
#define gpgrt_strusage _gpgrt_USE_UNDERSCORED_FUNCTION
#define gpgrt_set_usage_outfnc _gpgrt_USE_UNDERSCORED_FUNCTION
#define gpgrt_set_fixed_string_mapper _gpgrt_USE_UNDERSCORED_FUNCTION
+#define gpgrt_set_confdir _gpgrt_USE_UNDERSCORED_FUNCTION
#define gpgrt_cmp_version _gpgrt_USE_UNDERSCORED_FUNCTION