Commit Graph

1 Commits (974969cd0650d6c612e035b696b36c1d18b70bc9)

Author SHA1 Message Date
Guy Harris a34cc98b2a Put the main() and wmain() routines for CLI programs into a separate file.
That means that code is only in one place, rather than having copies of
it in each of those programs.

CLI programs that, on Windows, should get UTF-8 arguments rather than
arguments in the local code page should:

	include the top-level cli_main.h header;

	define the main function as real_main();

	be built with the top-level cli_main.c file.

On UN*X, cli_main.c has a main() program, and just passes the arguments
on to real_main().

On Windows, cli_main.c has a wmain() function that converts the UTF-16
arguments it's handed to UTF-8 arguments, using WideCharToMultiByte() so
that it doesn't use any functions other than those provided by the
system, and then calls real_main() with the argument count and UTF-8

Change-Id: I8b11f01dbc5c63fce599d1bef9ad96cd92c3c01e
Petri-Dish: Guy Harris <>
Tested-by: Petri Dish Buildbot
Reviewed-by: Guy Harris <>
2018-12-13 00:52:11 +00:00