aboutsummaryrefslogtreecommitdiffstats
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2018-12-12 02:53:08 -0800
committerGuy Harris <guy@alum.mit.edu>2018-12-13 00:52:11 +0000
commita34cc98b2ac5a0ad011a1c3a40ce5e59230a9498 (patch)
tree6cff6069cc4b3925fa4af82ce968959444dadd75 /CMakeLists.txt
parent17b721e45180a9decebb70dab77f41d96d5f7a03 (diff)
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@alum.mit.edu> Tested-by: Petri Dish Buildbot Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt16
1 files changed, 16 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 0a26f26b79..dee3c45fa5 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -2304,6 +2304,7 @@ if(BUILD_tshark)
${M_LIBRARIES}
)
set(tshark_FILES
+ cli_main.c
capture_opts.c
tshark-tap-register.c
tshark.c
@@ -2329,6 +2330,7 @@ if(BUILD_tfshark)
${APPLE_SYSTEM_CONFIGURATION_LIBRARY}
)
set(tfshark_FILES
+ cli_main.c
tfshark.c
${TSHARK_TAP_SRC}
${SHARK_COMMON_SRC}
@@ -2352,6 +2354,7 @@ if(BUILD_rawshark AND PCAP_FOUND)
${APPLE_SYSTEM_CONFIGURATION_LIBRARY}
)
set(rawshark_FILES
+ cli_main.c
${SHARK_COMMON_SRC}
rawshark.c
)
@@ -2374,6 +2377,10 @@ if(BUILD_sharkd)
${APPLE_SYSTEM_CONFIGURATION_LIBRARY}
)
set(sharkd_FILES
+ #
+ # XXX - currently doesn't work on Windows if it uses
+ # cli_main.c and has real_main().
+ #
sharkd.c
sharkd_daemon.c
sharkd_session.c
@@ -2419,6 +2426,7 @@ if(BUILD_randpkt)
${ZLIB_LIBRARIES}
)
set(randpkt_FILES
+ cli_main.c
randpkt.c
version_info.c
)
@@ -2441,6 +2449,7 @@ if(BUILD_text2pcap)
${ZLIB_LIBRARIES}
)
set(text2pcap_FILES
+ cli_main.c
text2pcap.c
version_info.c
)
@@ -2464,6 +2473,7 @@ if(BUILD_mergecap)
${CMAKE_DL_LIBS}
)
set(mergecap_FILES
+ cli_main.c
mergecap.c
version_info.c
)
@@ -2483,6 +2493,7 @@ if(BUILD_reordercap)
${CMAKE_DL_LIBS}
)
set(reordercap_FILES
+ cli_main.c
reordercap.c
version_info.c
)
@@ -2504,6 +2515,7 @@ if(BUILD_capinfos)
${CMAKE_DL_LIBS}
)
set(capinfos_FILES
+ cli_main.c
capinfos.c
version_info.c
)
@@ -2524,6 +2536,7 @@ if(BUILD_captype)
${CMAKE_DL_LIBS}
)
set(captype_FILES
+ cli_main.c
captype.c
version_info.c
)
@@ -2544,6 +2557,7 @@ if(BUILD_editcap)
${CMAKE_DL_LIBS}
)
set(editcap_FILES
+ cli_main.c
editcap.c
version_info.c
)
@@ -2571,6 +2585,7 @@ if(BUILD_dumpcap AND PCAP_FOUND)
${NL_LIBRARIES}
)
set(dumpcap_FILES
+ cli_main.c
capture_opts.c
dumpcap.c
ringbuffer.c
@@ -2924,6 +2939,7 @@ install(
set(SHARK_PUBLIC_HEADERS
cfile.h
+ cli_main.h
file.h
globals.h
log.h