From f25555aed0da7f0492b68efb789dbe3e03ec7fe8 Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Tue, 25 Feb 2020 12:17:25 +0100 Subject: core: New pseudo option ARGPARSE_PERMISSION_ERROR. * src/gpg-error.h.in (ARGPARSE_PERMISSION_ERROR): New. * src/argparse.c (initialize): Add code to print this error. -- We need this option to reject certain config files if we detect a permission problem. Signed-off-by: Werner Koch --- src/argparse.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/argparse.c') diff --git a/src/argparse.c b/src/argparse.c index 837d153..04c8291 100644 --- a/src/argparse.c +++ b/src/argparse.c @@ -386,6 +386,8 @@ initialize (gpgrt_argparse_t *arg, gpgrt_opt_t *opts, estream_t fp) s = _("invalid command"); else if ( arg->r_opt == ARGPARSE_INVALID_ALIAS ) s = _("invalid alias definition"); + else if ( arg->r_opt == ARGPARSE_PERMISSION_ERROR ) + s = _("permission error"); else if ( arg->r_opt == ARGPARSE_OUT_OF_CORE ) s = _("out of core"); else if ( arg->r_opt == ARGPARSE_NO_CONFFILE ) @@ -415,6 +417,8 @@ initialize (gpgrt_argparse_t *arg, gpgrt_opt_t *opts, estream_t fp) _gpgrt_log_error (_("command \"%.50s\" is ambiguous\n"),s ); else if ( arg->r_opt == ARGPARSE_OUT_OF_CORE ) _gpgrt_log_error ("%s\n", _("out of core")); + else if ( arg->r_opt == ARGPARSE_PERMISSION_ERROR ) + _gpgrt_log_error ("%s\n", _("permission error")); else if ( arg->r_opt == ARGPARSE_NO_CONFFILE) ; /* Error has already been printed. */ else -- cgit v1.2.3