Wireshark-commits: [Wireshark-commits] master a34cc98: Put the main() and wmain() routines for CLI
URL: https://code.wireshark.org/review/gitweb?p=wireshark.git;a=commit;h=a34cc98b2ac5a0ad011a1c3a40ce5e59230a9498
Submitter: "Guy Harris <guy@xxxxxxxxxxxx>"
Changed: branch: master
Repository: wireshark
Commits:
a34cc98 by Guy Harris (guy@xxxxxxxxxxxx):
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
arguments.
Change-Id: I8b11f01dbc5c63fce599d1bef9ad96cd92c3c01e
Reviewed-on: https://code.wireshark.org/review/31017
Petri-Dish: Guy Harris <guy@xxxxxxxxxxxx>
Tested-by: Petri Dish Buildbot
Reviewed-by: Guy Harris <guy@xxxxxxxxxxxx>
Actions performed:
from 17b721e 2.9.0 → 2.9.1.
add a34cc98 Put the main() and wmain() routines for CLI programs into a separate file.
Summary of changes:
CMakeLists.txt | 16 ++++++++++
capinfos.c | 24 ++-------------
captype.c | 24 ++-------------
cli_main.c | 73 ++++++++++++++++++++++++++++++++++++++++++++
cli_main.h | 19 ++++++++++++
dumpcap.c | 24 ++-------------
editcap.c | 21 ++-----------
extcap/CMakeLists.txt | 5 +++
extcap/androiddump.c | 19 ++----------
extcap/ciscodump.c | 19 ++----------
extcap/extcap-base.h | 1 -
extcap/randpktdump.c | 19 ++----------
extcap/sshdump.c | 19 ++----------
extcap/udpdump.c | 19 ++----------
mergecap.c | 25 ++-------------
randpkt.c | 21 ++-----------
rawshark.c | 23 ++------------
reordercap.c | 21 ++-----------
text2pcap.c | 24 ++-------------
tfshark.c | 24 ++-------------
tools/pre-commit-ignore.conf | 1 +
tshark.c | 21 ++-----------
22 files changed, 148 insertions(+), 314 deletions(-)
create mode 100644 cli_main.c
create mode 100644 cli_main.h