From 32021dfa5bcaa056c18e4ec40fdcd0f8b7de382b Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Tue, 25 Aug 2020 10:38:29 +0200 Subject: [PATCH] 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 --- tools/gpgconf.c | 20 ++++++++++++++++++-- tools/gpgtar-create.c | 10 ---------- 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/tools/gpgconf.c b/tools/gpgconf.c index e68eecdd7..539461d80 100644 --- a/tools/gpgconf.c +++ b/tools/gpgconf.c @@ -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) diff --git a/tools/gpgtar-create.c b/tools/gpgtar-create.c index 8a54c70ee..0311a465b 100644 --- a/tools/gpgtar-create.c +++ b/tools/gpgtar-create.c @@ -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, "-"))