aboutsummaryrefslogtreecommitdiffstats
path: root/cli_main.c
diff options
context:
space:
mode:
authorPeter Wu <peter@lekensteyn.nl>2018-12-26 18:10:12 +0100
committerAnders Broman <a.broman58@gmail.com>2019-01-02 12:08:20 +0000
commite2e5b01d771339a596a418ec306fe00ab504e593 (patch)
tree69b8cb5383cbb91c6890849194f2852bfeee1a94 /cli_main.c
parent974969cd0650d6c612e035b696b36c1d18b70bc9 (diff)
cli_main: remove real_main from stack traces for non-Windows
Restore the "main" name since that is used everywhere else except for Windows. On Windows, "main" is renamed via a macro to avoid a conflict with "wmain" and to allow it to be called in cli_main.c. For those wondering, GUI applications (such as Qt) have a different entry point, namely WinMain. In Qt5, src/winmain/qtmain_win.cpp defines WinMain, but seems to convert its arguments from Unicode to CP_ACP (ASCII). It might not support UTF-8, but I did not verify this. Change-Id: I93fa59324eb2ef95a305b08fc5ba34d49cc73bf0 Reviewed-on: https://code.wireshark.org/review/31208 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'cli_main.c')
-rw-r--r--cli_main.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/cli_main.c b/cli_main.c
index ee5f67e93c..61c8c58ae7 100644
--- a/cli_main.c
+++ b/cli_main.c
@@ -1,7 +1,7 @@
/*
* Compile and link this with all CLI programs where the main routine
- * should get UTF-8 arguments on Windows. In those programs, declare
- * the main program as real_main() rather than main().
+ * should get UTF-8 arguments on Windows. In those programs, include the
+ * cli_main.h header to rename main to real_main on Windows.
*
* This is used in software licensed under the GPLv2, and its license MUST
* be compatible with that license.
@@ -62,12 +62,11 @@ wmain(int argc, wchar_t *wc_argv[])
argv[i] = utf8_string;
}
argv[i] = NULL;
- return real_main(argc, argv);
-}
-#else /* _WIN32 */
-int
-main(int argc, char *argv[])
-{
+ /*
+ * The original "main" routine was renamed to "real_main" via a macro in
+ * the cli_main.h header file since either "main" or "wmain" can be
+ * defined on Windows, but not both.
+ */
return real_main(argc, argv);
}
#endif