summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJan Niklas Hasse <jhasse@bixense.com>2021-02-26 16:08:19 (GMT)
committerGitHub <noreply@github.com>2021-02-26 16:08:19 (GMT)
commit1a8015038d9a8c6bf0c04a42588fb2a26861be63 (patch)
tree78ae9af75529605ffc98631e9a8bd28e9c981b9d /src
parent100efbaf550f07c3b09d67489dad0c0ed5a6e542 (diff)
parent706e16bee5f6b5fccd284476a9157ecc8c39f12c (diff)
downloadNinja-1a8015038d9a8c6bf0c04a42588fb2a26861be63.zip
Ninja-1a8015038d9a8c6bf0c04a42588fb2a26861be63.tar.gz
Ninja-1a8015038d9a8c6bf0c04a42588fb2a26861be63.tar.bz2
Merge pull request #1918 from bradking/windows-code-page
Add tool to print code page information on Windows
Diffstat (limited to 'src')
-rw-r--r--src/ninja.cc17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/ninja.cc b/src/ninja.cc
index 96eac1d..3172ee5 100644
--- a/src/ninja.cc
+++ b/src/ninja.cc
@@ -133,6 +133,7 @@ struct NinjaMain : public BuildLogUser {
int ToolRestat(const Options* options, int argc, char* argv[]);
int ToolUrtle(const Options* options, int argc, char** argv);
int ToolRules(const Options* options, int argc, char* argv[]);
+ int ToolWinCodePage(const Options* options, int argc, char* argv[]);
/// Open the build log.
/// @return LOAD_ERROR on error.
@@ -641,6 +642,18 @@ int NinjaMain::ToolRules(const Options* options, int argc, char* argv[]) {
return 0;
}
+#ifdef _WIN32
+int NinjaMain::ToolWinCodePage(const Options* options, int argc, char* argv[]) {
+ if (argc != 0) {
+ printf("usage: ninja -t wincodepage\n");
+ return 1;
+ }
+ printf("ANSI code page: %u\n", GetACP());
+ printf("Console code page: %u\n", GetConsoleOutputCP());
+ return 0;
+}
+#endif
+
enum PrintCommandMode { PCM_Single, PCM_All };
void PrintCommands(Edge* edge, EdgeSet* seen, PrintCommandMode mode) {
if (!edge)
@@ -1009,6 +1022,10 @@ const Tool* ChooseTool(const string& tool_name) {
Tool::RUN_AFTER_LOGS, &NinjaMain::ToolCleanDead },
{ "urtle", NULL,
Tool::RUN_AFTER_FLAGS, &NinjaMain::ToolUrtle },
+#ifdef _WIN32
+ { "wincodepage", "print the Windows ANSI code page identifier",
+ Tool::RUN_AFTER_FLAGS, &NinjaMain::ToolWinCodePage },
+#endif
{ NULL, NULL, Tool::RUN_AFTER_FLAGS, NULL }
};