summaryrefslogtreecommitdiff
path: root/tools/list_protos_in_cap.sh
diff options
context:
space:
mode:
authorBill Meier <wmeier@newsguy.com>2011-04-05 18:01:33 +0000
committerBill Meier <wmeier@newsguy.com>2011-04-05 18:01:33 +0000
commit84837d8fcdb987b58f0953b26709d783946aea50 (patch)
tree94ee153feb625d6b3cf8c4af4d85409ac7b96df0 /tools/list_protos_in_cap.sh
parent479d89cef74b6e51a3b137cea981326eb284f518 (diff)
downloadwireshark-84837d8fcdb987b58f0953b26709d783946aea50.tar.gz
1. Remove \r from tshark output so output OK on Windows cygwin bash.
2. Error messsages to stderr. 3. Check capinfos return value to verify that file is a valid capture file. svn path=/trunk/; revision=36478
Diffstat (limited to 'tools/list_protos_in_cap.sh')
-rwxr-xr-xtools/list_protos_in_cap.sh20
1 files changed, 16 insertions, 4 deletions
diff --git a/tools/list_protos_in_cap.sh b/tools/list_protos_in_cap.sh
index 5aff287f41..e831caeb77 100755
--- a/tools/list_protos_in_cap.sh
+++ b/tools/list_protos_in_cap.sh
@@ -27,7 +27,7 @@ for i in "$TSHARK" "$CAPINFOS"
do
if [ ! -x $i ]
then
- echo "Couldn't find $i"
+ echo "Couldn't find $i" 1>&2
NOTFOUND=1
fi
done
@@ -61,15 +61,27 @@ FIN
fi
for CF in "$@" ; do
- "$CAPINFOS" "$CF" > /dev/null
if [ "$OSTYPE" == "cygwin" ] ; then
CF=`cygpath --windows "$CF"`
fi
+
+ if [ ! -f "$CF" ] ; then
+ echo "Doesn't exist or not a file: $CF" 1>&2
+ continue
+ fi
+
+ "$CAPINFOS" "$CF" > /dev/null
+ RETVAL=$?
+ if [ $RETVAL -ne 0 ] ; then
+ echo "Not a valid capture file (or some other problem)" 1>&2
+ continue
+ fi
+
printf "$CF "
# Extract the protocol names.
- $TSHARK -T fields -eframe.protocols -nr "$CF" 2>/dev/null | tr ':' '\n' \
- | sort -u | tr '\n' ' '
+ $TSHARK -T fields -eframe.protocols -nr "$CF" 2>/dev/null | tr ':\r' '\n' \
+ | sort -u | tr '\n\r' ' '
printf "\n"
done