forked from osmocom/wireshark
CMake,editcap: avoid noise with editcap -F and -T options
Avoid printing a noisy "option requires an argument" error when using '-T' and '-F' as documented. Fix warning that started showing on macOS with CMake 3.9.4 about CMP0058 since v2.5.0rc0-1180-g799f4f0e14. Change-Id: Ie0cc352c6b0b2724997e7fe6b49fd5b1f02d1e07 Reviewed-on: https://code.wireshark.org/review/24404 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Reviewed-by: Ahmad Fatoum <ahmad@a3f.at> Tested-by: Petri Dish Buildbot Reviewed-by: Gerald Combs <gerald@wireshark.org>
This commit is contained in:
parent
a595d7326b
commit
3006ffa615
|
@ -81,8 +81,8 @@ foreach(th_command ${WSUG_TOOLS_HELP_COMMANDS})
|
||||||
list(APPEND WSUG_TOOLS_PHONY_DEPS ${th_phony})
|
list(APPEND WSUG_TOOLS_PHONY_DEPS ${th_phony})
|
||||||
add_custom_command(
|
add_custom_command(
|
||||||
OUTPUT ${th_phony}
|
OUTPUT ${th_phony}
|
||||||
COMMAND ${CMAKE_BINARY_DIR}/run/${th_command} -h > ${th_file}
|
COMMAND ${th_command} -h > ${th_file}
|
||||||
DEPENDS ${CMAKE_BINARY_DIR}/run/${th_command}
|
DEPENDS ${th_command}
|
||||||
)
|
)
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
|
@ -95,7 +95,8 @@ list(APPEND WSUG_TOOLS_HELP_FILES ${th_file})
|
||||||
list(APPEND WSUG_TOOLS_PHONY_DEPS ${th_phony})
|
list(APPEND WSUG_TOOLS_PHONY_DEPS ${th_phony})
|
||||||
add_custom_command(
|
add_custom_command(
|
||||||
OUTPUT ${th_phony}
|
OUTPUT ${th_phony}
|
||||||
COMMAND ${CMAKE_BINARY_DIR}/run/editcap -F > ${th_file}
|
COMMAND editcap -F > ${th_file}
|
||||||
|
DEPENDS editcap
|
||||||
)
|
)
|
||||||
set(th_file ${CMAKE_CURRENT_SOURCE_DIR}/wsug_src/editcap-T.txt)
|
set(th_file ${CMAKE_CURRENT_SOURCE_DIR}/wsug_src/editcap-T.txt)
|
||||||
set(th_phony editcap_T_tools_help)
|
set(th_phony editcap_T_tools_help)
|
||||||
|
@ -103,7 +104,8 @@ list(APPEND WSUG_TOOLS_HELP_FILES ${th_file})
|
||||||
list(APPEND WSUG_TOOLS_PHONY_DEPS ${th_phony})
|
list(APPEND WSUG_TOOLS_PHONY_DEPS ${th_phony})
|
||||||
add_custom_command(
|
add_custom_command(
|
||||||
OUTPUT ${th_phony}
|
OUTPUT ${th_phony}
|
||||||
COMMAND ${CMAKE_BINARY_DIR}/run/editcap -T > ${th_file}
|
COMMAND editcap -T > ${th_file}
|
||||||
|
DEPENDS editcap
|
||||||
)
|
)
|
||||||
|
|
||||||
add_custom_target(update_tools_help
|
add_custom_target(update_tools_help
|
||||||
|
|
|
@ -1047,7 +1047,7 @@ main(int argc, char *argv[])
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Process the options */
|
/* Process the options */
|
||||||
while ((opt = getopt_long(argc, argv, "a:A:B:c:C:dD:E:F:hi:I:Lo:rs:S:t:T:vVw:", long_options, NULL)) != -1) {
|
while ((opt = getopt_long(argc, argv, ":a:A:B:c:C:dD:E:F:hi:I:Lo:rs:S:t:T:vVw:", long_options, NULL)) != -1) {
|
||||||
switch (opt) {
|
switch (opt) {
|
||||||
case 0x8100:
|
case 0x8100:
|
||||||
{
|
{
|
||||||
|
@ -1279,6 +1279,7 @@ main(int argc, char *argv[])
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case '?': /* Bad options if GNU getopt */
|
case '?': /* Bad options if GNU getopt */
|
||||||
|
case ':': /* missing option argument */
|
||||||
switch(optopt) {
|
switch(optopt) {
|
||||||
case'F':
|
case'F':
|
||||||
list_capture_types(stdout);
|
list_capture_types(stdout);
|
||||||
|
@ -1287,6 +1288,11 @@ main(int argc, char *argv[])
|
||||||
list_encap_types(stdout);
|
list_encap_types(stdout);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
if (opt == '?') {
|
||||||
|
fprintf(stderr, "editcap: invalid option -- '%c'\n", optopt);
|
||||||
|
} else {
|
||||||
|
fprintf(stderr, "editcap: option requires an argument -- '%c'\n", optopt);
|
||||||
|
}
|
||||||
print_usage(stderr);
|
print_usage(stderr);
|
||||||
ret = INVALID_OPTION;
|
ret = INVALID_OPTION;
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue