mirror of
git://git.gnupg.org/gnupg.git
synced 2024-12-22 10:19:57 +01:00
gpgtar: Read common.conf for the log-file option.
* common/util.h (GNUPG_MODULE_NAME_GPGTAR): New. * common/homedir.c (gnupg_module_name): Add it. * tools/gpgtar.c: Include comopt.h. (enum cmd_and_opt_values): Add oDebug. (opts): Add --debug. (any_debug): New. (main): Parse common.conf. -- Having a way to see the output of gpgtar is often useful for debugging. The only effect of the debug option is to show whether common.conf was read.
This commit is contained in:
parent
2c12970550
commit
ba67fea5b9
@ -1657,6 +1657,9 @@ gnupg_module_name (int which)
|
||||
case GNUPG_MODULE_NAME_CARD:
|
||||
X(bindir, "tools", "gpg-card");
|
||||
|
||||
case GNUPG_MODULE_NAME_GPGTAR:
|
||||
X(bindir, "tools", "gpgtar");
|
||||
|
||||
default:
|
||||
BUG ();
|
||||
}
|
||||
|
@ -298,6 +298,7 @@ char *_gnupg_socketdir_internal (int skip_checks, unsigned *r_info);
|
||||
#define GNUPG_MODULE_NAME_KEYBOXD 13
|
||||
#define GNUPG_MODULE_NAME_TPM2DAEMON 14
|
||||
#define GNUPG_MODULE_NAME_CARD 15
|
||||
#define GNUPG_MODULE_NAME_GPGTAR 16
|
||||
const char *gnupg_module_name (int which);
|
||||
void gnupg_module_name_flush_some (void);
|
||||
void gnupg_set_builddir (const char *newdir);
|
||||
|
@ -42,6 +42,7 @@
|
||||
#include "../common/openpgpdefs.h"
|
||||
#include "../common/init.h"
|
||||
#include "../common/strlist.h"
|
||||
#include "../common/comopt.h"
|
||||
|
||||
#include "gpgtar.h"
|
||||
|
||||
@ -89,6 +90,7 @@ enum cmd_and_opt_values
|
||||
oTarProgram,
|
||||
|
||||
/* Debugging. */
|
||||
oDebug,
|
||||
oDryRun
|
||||
};
|
||||
|
||||
@ -145,6 +147,8 @@ static gpgrt_opt_t opts[] = {
|
||||
ARGPARSE_s_s (oTarArgs, "tar-args", "@"),
|
||||
ARGPARSE_s_s (oTarProgram, "tar", "@"),
|
||||
|
||||
ARGPARSE_s_s (oDebug, "debug", "@"),
|
||||
|
||||
ARGPARSE_end ()
|
||||
};
|
||||
|
||||
@ -166,7 +170,7 @@ static enum cmd_and_opt_values cmd = 0;
|
||||
static int skip_crypto = 0;
|
||||
static const char *files_from = NULL;
|
||||
static int null_names = 0;
|
||||
|
||||
static int any_debug;
|
||||
|
||||
|
||||
|
||||
@ -438,6 +442,10 @@ parse_arguments (gpgrt_argparse_t *pargs, gpgrt_opt_t *popts)
|
||||
}
|
||||
break;
|
||||
|
||||
case oDebug:
|
||||
any_debug = 1;
|
||||
break;
|
||||
|
||||
case oDryRun:
|
||||
opt.dry_run = 1;
|
||||
break;
|
||||
@ -471,6 +479,10 @@ main (int argc, char **argv)
|
||||
/* Set default options */
|
||||
opt.status_fd = -1;
|
||||
|
||||
/* The configuraton directories for use by gpgrt_argparser. */
|
||||
gpgrt_set_confdir (GPGRT_CONFDIR_SYS, gnupg_sysconfdir ());
|
||||
gpgrt_set_confdir (GPGRT_CONFDIR_USER, gnupg_homedir ());
|
||||
|
||||
/* Parse the command line. */
|
||||
pargs.argc = &argc;
|
||||
pargs.argv = &argv;
|
||||
@ -481,6 +493,10 @@ main (int argc, char **argv)
|
||||
if (log_get_errorcount (0))
|
||||
exit (2);
|
||||
|
||||
/* Get a log file from common.conf. */
|
||||
if (!parse_comopt (GNUPG_MODULE_NAME_GPGTAR, any_debug) && comopt.logfile)
|
||||
log_set_file (comopt.logfile);
|
||||
|
||||
/* Print a warning if an argument looks like an option. */
|
||||
if (!opt.quiet && !(pargs.flags & ARGPARSE_FLAG_STOP_SEEN))
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user