mirror of
git://git.gnupg.org/gnupg.git
synced 2025-01-03 12:11:33 +01:00
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:
parent
9e2307ddf0
commit
f357a5f239
@ -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) };
|
||||
|
Loading…
x
Reference in New Issue
Block a user