]> The Tcpdump Group git mirrors - tcpdump/commitdiff
Don't use strcasecmp(), use ascii_strcasecmp().
authorGuy Harris <[email protected]>
Fri, 1 Jul 2016 20:58:52 +0000 (13:58 -0700)
committerGuy Harris <[email protected]>
Fri, 1 Jul 2016 20:58:52 +0000 (13:58 -0700)
Not all platforms have strcasecmp() (yes, it's in the Single UNIX
Specification, but not all platforms are UNIX or even UN*X; there's some
obscure company in Redmond, Washington who have an OS on which we run),
and on those that do, there's no guarantee that strcasecmp() will treate
A-Z and a-z as being equivalent ("I" and "i" aren't equivalent in a
Turkish locale, for example).

Fix indentation while we're at it.

tcpdump.c

index 282d44c96ffa88a3d3467101aa9cc63147cc7eae..5598ec282f2dff91f000a78075325c85ba319022 100644 (file)
--- a/tcpdump.c
+++ b/tcpdump.c
@@ -1115,8 +1115,8 @@ main(int argc, char **argv)
                                ndo->ndo_packettype = PT_PGM_ZMTP1;
                        else if (ascii_strcasecmp(optarg, "lmp") == 0)
                                ndo->ndo_packettype = PT_LMP;
                                ndo->ndo_packettype = PT_PGM_ZMTP1;
                        else if (ascii_strcasecmp(optarg, "lmp") == 0)
                                ndo->ndo_packettype = PT_LMP;
-            else if (strcasecmp(optarg, "resp") == 0)
-                ndo->ndo_packettype = PT_RESP;
+                       else if (ascii_strcasecmp(optarg, "resp") == 0)
+                               ndo->ndo_packettype = PT_RESP;
                        else
                                error("unknown packet type `%s'", optarg);
                        break;
                        else
                                error("unknown packet type `%s'", optarg);
                        break;