gpgconf,w32: New debug command --show-codepages.

* tools/gpgconf.c (aShowCodepages): New.
(opts): New command --show-codepages.
(main) [W32]: Implement
--

This is a Windows helper command to quickly check which code pages are
currently used.  Useful for debugging.  Has no effect on Unix.

Signed-off-by: Werner Koch <wk@gnupg.org>
This commit is contained in:
Werner Koch 2020-08-25 10:38:29 +02:00
parent 633c1fea5f
commit 32021dfa5b
No known key found for this signature in database
GPG Key ID: E3FDFF218E45B72B
2 changed files with 18 additions and 12 deletions

View File

@ -68,7 +68,8 @@ enum cmd_and_opt_values
aCreateSocketDir,
aRemoveSocketDir,
aApplyProfile,
aReload
aReload,
aShowCodepages
};
@ -99,6 +100,7 @@ static gpgrt_opt_t opts[] =
{ aKill, "kill", 256, N_("kill a given component")},
{ aCreateSocketDir, "create-socketdir", 256, "@"},
{ aRemoveSocketDir, "remove-socketdir", 256, "@"},
ARGPARSE_c (aShowCodepages, "show-codepages", "@"),
{ 301, NULL, 0, N_("@\nOptions:\n ") },
@ -107,7 +109,8 @@ static gpgrt_opt_t opts[] =
{ oQuiet, "quiet", 0, N_("quiet") },
{ oDryRun, "dry-run", 0, N_("do not make any changes") },
{ oRuntime, "runtime", 0, N_("activate changes at runtime, if possible") },
ARGPARSE_s_i (oStatusFD, "status-fd", N_("|FD|write status info to this FD")),
ARGPARSE_s_i (oStatusFD, "status-fd",
N_("|FD|write status info to this FD")),
/* hidden options */
{ oHomedir, "homedir", 2, "@" },
{ oBuilddir, "build-prefix", 2, "@" },
@ -600,6 +603,7 @@ main (int argc, char **argv)
case aKill:
case aCreateSocketDir:
case aRemoveSocketDir:
case aShowCodepages:
cmd = pargs.r_opt;
break;
@ -915,6 +919,18 @@ main (int argc, char **argv)
}
break;
case aShowCodepages:
#ifdef HAVE_W32_SYSTEM
{
get_outfp (&outfp);
es_fprintf (outfp, "Console: CP%u\n", GetConsoleOutputCP ());
es_fprintf (outfp, "ANSI: CP%u\n", GetACP ());
es_fprintf (outfp, "OEM: CP%u\n", GetOEMCP ());
}
#endif
break;
}
if (outfp != es_stdout)

View File

@ -795,16 +795,6 @@ gpgtar_create (char **inpattern, const char *files_from, int null_names,
memset (scanctrl, 0, sizeof *scanctrl);
scanctrl->flist_tail = &scanctrl->flist;
/* { unsigned int cpno, cpno2, cpno3; */
/* cpno = GetConsoleOutputCP (); */
/* cpno2 = GetACP (); */
/* cpno3 = GetOEMCP (); */
/* log_debug ("Codepages: Console: %u ANSI: %u OEM: %u\n", */
/* cpno, cpno2, cpno3); */
/* } */
if (!inpattern)
{
if (!files_from || !strcmp (files_from, "-"))