gpgconf: New short options -V and -X

* tools/gpgconf.c: Assign short options -X and -V
(show_version_gnupg): Print the vsd version if available.
--

These changes are helpful for phone support.
This commit is contained in:
Werner Koch 2022-06-29 13:14:35 +02:00
parent 9e2307ddf0
commit f357a5f239
No known key found for this signature in database
GPG Key ID: E3FDFF218E45B72B
1 changed files with 40 additions and 5 deletions

View File

@ -49,6 +49,8 @@ enum cmd_and_opt_values
aListDirs = 'L',
aKill = 'K',
aReload = 'R',
aShowVersions = 'V',
aShowConfigs = 'X',
oNoVerbose = 500,
oHomedir,
@ -68,9 +70,7 @@ enum cmd_and_opt_values
aLaunch,
aCreateSocketDir,
aRemoveSocketDir,
aApplyProfile,
aShowVersions,
aShowConfigs
aApplyProfile
};
@ -101,8 +101,8 @@ static ARGPARSE_OPTS opts[] =
{ aKill, "kill", 256, N_("kill a given component")},
{ aCreateSocketDir, "create-socketdir", 256, "@"},
{ aRemoveSocketDir, "remove-socketdir", 256, "@"},
ARGPARSE_c (aShowVersions, "show-versions", "@"),
ARGPARSE_c (aShowConfigs, "show-configs", "@"),
ARGPARSE_c (aShowVersions, "show-versions", ""),
ARGPARSE_c (aShowConfigs, "show-configs", ""),
{ 301, NULL, 0, N_("@\nOptions:\n ") },
@ -1042,8 +1042,43 @@ get_revision_from_blurb (const char *blurb, int *r_len)
static void
show_version_gnupg (estream_t fp, const char *prefix)
{
char *fname, *p;
size_t n;
estream_t verfp;
char line[100];
es_fprintf (fp, "%s%sGnuPG %s (%s)\n%s%s\n", prefix, *prefix?"":"* ",
strusage (13), BUILD_REVISION, prefix, strusage (17));
/* Show the GnuPG VS-Desktop version in --show-configs mode */
if (prefix && *prefix == '#')
{
fname = make_filename (gnupg_bindir (), NULL);
n = strlen (fname);
if (n > 10 && (!ascii_strcasecmp (fname + n - 10, "/GnuPG/bin")
|| !ascii_strcasecmp (fname + n - 10, "\\GnuPG\\bin")))
{
/* Append VERSION to the ../../ direcory. Note that VERSION
* is only 7 bytes and thus fits. */
strcpy (fname + n - 9, "VERSION");
verfp = es_fopen (fname, "r");
if (!verfp)
es_fprintf (fp, "%s[VERSION file not found]\n", prefix);
else if (!es_fgets (line, sizeof line, verfp))
es_fprintf (fp, "%s[VERSION file is empty]\n", prefix);
else
{
trim_spaces (line);
for (p=line; *p; p++)
if (*p < ' ' || *p > '~' || *p == '[')
*p = '?';
es_fprintf (fp, "%s%s\n", prefix, line);
}
es_fclose (verfp);
}
xfree (fname);
}
#ifdef HAVE_W32_SYSTEM
{
OSVERSIONINFO osvi = { sizeof (osvi) };