diff options
author | Dario Lombardo <lomato@gmail.com> | 2017-02-20 16:35:32 +0100 |
---|---|---|
committer | Dario Lombardo <lomato@gmail.com> | 2017-02-24 13:49:56 +0000 |
commit | f22c7139e06f46685384d7ac22f4c0279cc13195 (patch) | |
tree | fdafce82bd47591af326209503f16ce9d70b3240 /tools | |
parent | 8e6b5c14fadafa9541347b715f0fead2eb4702f7 (diff) |
tools: add options validation.
This prevents to call the apps with incongruent options.
Change-Id: I76919a2da141bd277c06e708548c971c19dd7af7
Reviewed-on: https://code.wireshark.org/review/20211
Reviewed-by: Dario Lombardo <lomato@gmail.com>
Diffstat (limited to 'tools')
-rwxr-xr-x | tools/valgrind-wireshark.sh | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/tools/valgrind-wireshark.sh b/tools/valgrind-wireshark.sh index 8328370183..1ffdc7530e 100755 --- a/tools/valgrind-wireshark.sh +++ b/tools/valgrind-wireshark.sh @@ -62,7 +62,7 @@ while getopts ":2a:b:C:lmnpP:rstTYwcevWdG" OPTCHAR ; do COMMAND_ARGS="-E 0.02" # We don't care about the output of editcap COMMAND_ARGS2="/dev/null" ;; - v) VERBOSE="--num-callers=256" ;; + v) VERBOSE="--num-callers=256 -v" ;; W) COMMAND=wireshark COMMAND_ARGS="" VALID=1 ;; @@ -78,6 +78,13 @@ while getopts ":2a:b:C:lmnpP:rstTYwcevWdG" OPTCHAR ; do done shift $(($OPTIND - 1)) +# Sanitize parameters +if [ "$COMMAND" != "tshark" ] && [[ $COMMAND_ARGS =~ Vx ]] +then + printf "\nYou can't use -T if you're not using tshark\n\n" >&2 + exit 1 +fi + if [ $# -ge 1 ] then PCAP=$1 @@ -135,7 +142,7 @@ cmdline="$LIBTOOL valgrind --suppressions=`dirname $0`/vg-suppressions $ADDITION --tool=$TOOL $CALLGRIND_OUT_FILE $VERBOSE $LEAK_CHECK $REACHABLE $GEN_SUPPRESSIONS $TRACK_ORIGINS \ $COMMAND $COMMAND_ARGS $PCAP $COMMAND_ARGS2" -if [ $VERBOSE ];then +if [ "$VERBOSE" != "" ];then echo -e "\n$cmdline\n" fi |