addrtoname.h - address to hostname definitions
ah.h - IPSEC Authentication Header definitions
appletalk.h - AppleTalk definitions
+ascii_strcasecmp.c - locale-independent case-independent string comparison
+ routines
atime.awk - TCP ack awk script
atm.h - ATM traffic type definitions
bpf_dump.c - BPF program printing routines, in case libpcap doesn't
smb.h - SMB/CIFS definitions
smbutil.c - SMB/CIFS utility routines
stime.awk - TCP send awk script
-strcasecmp.c - missing routine
tcp.h - TCP definitions
tcpdump.1 - manual entry
tcpdump.c - main program
LIBNETDISSECT_SRC=\
addrtoname.c \
af.c \
+ ascii_strcasecmp.c \
checksum.c \
cpack.c \
gmpls.c \
af.h \
ah.h \
appletalk.h \
+ ascii_strcasecmp.h \
atm.h \
chdlc.h \
cpack.h \
send-ack.awk \
smbutil.c \
stime.awk \
- strcasecmp.c \
tcpdump.1.in \
vfprintf.c \
win32/Include/w32_fzs.h \
* is provided ``as is'' without express or implied warranty.
*/
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <tcpdump-stdinc.h>
-
-#include "interface.h"
+#include "ascii_strcasecmp.h"
/*
- * This array is designed for mapping upper and lower case letter
+ * This array is designed for mapping upper and lower case letters
* together for a case independent comparison. The mappings are
- * based upon ascii character sequences.
+ * based upon ASCII character sequences; all values other than
+ * ASCII letters are mapped to themselves, so this is locale-
+ * independent and intended to be locale-independent, to avoid
+ * issues with, for example, "i" and "I" not being lower-case
+ * and upper-case versions of the same letter in Turkish, where
+ * there are separate "i with dot" and "i without dot" letters.
*/
-static const u_char charmap[] = {
+static const unsigned char charmap[] = {
'\000', '\001', '\002', '\003', '\004', '\005', '\006', '\007',
'\010', '\011', '\012', '\013', '\014', '\015', '\016', '\017',
'\020', '\021', '\022', '\023', '\024', '\025', '\026', '\027',
};
int
-strcasecmp(s1, s2)
+ascii_strcasecmp(s1, s2)
const char *s1, *s2;
{
- register const u_char *cm = charmap,
- *us1 = (u_char *)s1,
- *us2 = (u_char *)s2;
+ register const unsigned char *cm = charmap,
+ *us1 = (const unsigned char *)s1,
+ *us2 = (const unsigned char *)s2;
while (cm[*us1] == cm[*us2++])
if (*us1++ == '\0')
}
int
-strncasecmp(s1, s2, n)
+ascii_strncasecmp(s1, s2, n)
const char *s1, *s2;
- register int n;
+ register size_t n;
{
- register const u_char *cm = charmap,
- *us1 = (u_char *)s1,
- *us2 = (u_char *)s2;
+ register const unsigned char *cm = charmap,
+ *us1 = (const unsigned char *)s1,
+ *us2 = (const unsigned char *)s2;
- while (--n >= 0 && cm[*us1] == cm[*us2++])
- if (*us1++ == '\0')
+ for (;;) {
+ if (n == 0) {
+ /*
+ * We've run out of characters that we should
+ * compare, and they've all been equal; return
+ * 0, to indicate that the prefixes are the
+ * same.
+ */
return(0);
- return(n < 0 ? 0 : cm[*us1] - cm[*--us2]);
+ }
+ if (cm[*us1] != cm[*us2++]) {
+ /*
+ * We've found a mismatch.
+ */
+ break;
+ }
+ if (*us1++ == '\0') {
+ /*
+ * We've run out of characters *to* compare,
+ * and they've all been equal; return 0, to
+ * indicate that the strings are the same.
+ */
+ return(0);
+ }
+ n--;
+ }
+ return(cm[*us1] - cm[*--us2]);
}
--- /dev/null
+/*
+ * Copyright (c) 1988-1997
+ * The Regents of the University of California. All rights reserved.
+ *
+ * The TCPDUMP project
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that: (1) source code distributions
+ * retain the above copyright notice and this paragraph in its entirety, (2)
+ * distributions including binary code include the above copyright notice and
+ * this paragraph in its entirety in the documentation or other materials
+ * provided with the distribution, and (3) all advertising materials mentioning
+ * features or use of this software display the following acknowledgement:
+ * ``This product includes software developed by the University of California,
+ * Lawrence Berkeley Laboratory and its contributors.'' Neither the name of
+ * the University nor the names of its contributors may be used to endorse
+ * or promote products derived from this software without specific prior
+ * written permission.
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+ */
+
+#ifndef tcpdump_ascii_strcasecmp_h
+#define tcpdump_ascii_strcasecmp_h
+
+#include <stddef.h>
+
+extern int ascii_strcasecmp(const char *, const char *);
+extern int ascii_strncasecmp(const char *, const char *, size_t);
+
+#endif /* tcpdump_ascii_strcasecmp_h */
/* Define to 1 if you have the <stdlib.h> header file. */
#undef HAVE_STDLIB_H
-/* Define to 1 if you have the `strcasecmp' function. */
-#undef HAVE_STRCASECMP
-
/* Define to 1 if you have the `strdup' function. */
#undef HAVE_STRDUP
fi
-ac_fn_c_check_func "$LINENO" "strcasecmp" "ac_cv_func_strcasecmp"
-if test "x$ac_cv_func_strcasecmp" = xyes; then :
- $as_echo "#define HAVE_STRCASECMP 1" >>confdefs.h
-
-else
- case " $LIBOBJS " in
- *" strcasecmp.$ac_objext "* ) ;;
- *) LIBOBJS="$LIBOBJS strcasecmp.$ac_objext"
- ;;
-esac
-
-fi
-
ac_fn_c_check_func "$LINENO" "strlcat" "ac_cv_func_strlcat"
if test "x$ac_cv_func_strlcat" = xyes; then :
$as_echo "#define HAVE_STRLCAT 1" >>confdefs.h
missing_includes=yes
fi
-AC_REPLACE_FUNCS(vfprintf strcasecmp strlcat strlcpy strdup strsep getopt_long)
+AC_REPLACE_FUNCS(vfprintf strlcat strlcpy strdup strsep getopt_long)
AC_CHECK_FUNCS(fork vfork strftime)
AC_CHECK_FUNCS(setlinebuf alarm)
#endif
char *strerror(int);
int snprintf(char *, size_t, const char *, ...);
-int strcasecmp(const char *, const char *);
int stat(const char *, struct stat *);
int statfs(char *, struct statfs *);
char *strerror(int);
-int strcasecmp(const char *, const char *);
#ifdef __STDC__
struct tm;
#endif
int strftime(char *, int, char *, struct tm *);
-int strncasecmp(const char *, const char *, int);
long strtol(const char *, char **, int);
void sync(void);
void syslog(int, const char *, ...);
int pfopen(char *, int);
int setlinebuf(FILE *);
int socket(int, int, int);
-int strcasecmp(const char *, const char *);
#include <string.h>
#include "pcap-missing.h"
+#include "ascii_strcasecmp.h"
struct dlt_choice {
const char *name;
int i;
for (i = 0; dlt_choices[i].name != NULL; i++) {
- if (strcasecmp(dlt_choices[i].name + sizeof("DLT_") - 1,
+ if (ascii_strcasecmp(dlt_choices[i].name + sizeof("DLT_") - 1,
name) == 0)
return (dlt_choices[i].dlt);
}
#include "interface.h"
#include "extract.h"
+#include "ascii_strcasecmp.h"
+
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
* All rights reserved.
}
*colon = '\0';
- if(strcasecmp(colon,"sha1") == 0 ||
- strcasecmp(colon,"md5") == 0) {
+ if(ascii_strcasecmp(colon,"sha1") == 0 ||
+ ascii_strcasecmp(colon,"md5") == 0) {
sa->authlen = 12;
}
return 1;
} else
decode = line;
- if (spikey && strcasecmp(spikey, "file") == 0) {
+ if (spikey && ascii_strcasecmp(spikey, "file") == 0) {
/* open file and read it */
FILE *secretfile;
char fileline[1024];
return;
}
- if (spikey && strcasecmp(spikey, "ikev2") == 0) {
+ if (spikey && ascii_strcasecmp(spikey, "ikev2") == 0) {
esp_print_decode_ikeline(ndo, line, file, lineno);
return;
}
#ifdef WIN32
#include "w32_fzs.h"
-extern int strcasecmp (const char *__s1, const char *__s2);
extern int SIZE_BUF;
#define off_t long
#define uint UINT
#include "setsignal.h"
#include "gmt2local.h"
#include "pcap-missing.h"
+#include "ascii_strcasecmp.h"
#include "print.h"
#ifdef HAVE_PCAP_SETDIRECTION
case 'Q':
- if (strcasecmp(optarg, "in") == 0)
+ if (ascii_strcasecmp(optarg, "in") == 0)
Qflag = PCAP_D_IN;
- else if (strcasecmp(optarg, "out") == 0)
+ else if (ascii_strcasecmp(optarg, "out") == 0)
Qflag = PCAP_D_OUT;
- else if (strcasecmp(optarg, "inout") == 0)
+ else if (ascii_strcasecmp(optarg, "inout") == 0)
Qflag = PCAP_D_INOUT;
else
error("unknown capture direction `%s'", optarg);
break;
case 'T':
- if (strcasecmp(optarg, "vat") == 0)
+ if (ascii_strcasecmp(optarg, "vat") == 0)
ndo->ndo_packettype = PT_VAT;
- else if (strcasecmp(optarg, "wb") == 0)
+ else if (ascii_strcasecmp(optarg, "wb") == 0)
ndo->ndo_packettype = PT_WB;
- else if (strcasecmp(optarg, "rpc") == 0)
+ else if (ascii_strcasecmp(optarg, "rpc") == 0)
ndo->ndo_packettype = PT_RPC;
- else if (strcasecmp(optarg, "rtp") == 0)
+ else if (ascii_strcasecmp(optarg, "rtp") == 0)
ndo->ndo_packettype = PT_RTP;
- else if (strcasecmp(optarg, "rtcp") == 0)
+ else if (ascii_strcasecmp(optarg, "rtcp") == 0)
ndo->ndo_packettype = PT_RTCP;
- else if (strcasecmp(optarg, "snmp") == 0)
+ else if (ascii_strcasecmp(optarg, "snmp") == 0)
ndo->ndo_packettype = PT_SNMP;
- else if (strcasecmp(optarg, "cnfp") == 0)
+ else if (ascii_strcasecmp(optarg, "cnfp") == 0)
ndo->ndo_packettype = PT_CNFP;
- else if (strcasecmp(optarg, "tftp") == 0)
+ else if (ascii_strcasecmp(optarg, "tftp") == 0)
ndo->ndo_packettype = PT_TFTP;
- else if (strcasecmp(optarg, "aodv") == 0)
+ else if (ascii_strcasecmp(optarg, "aodv") == 0)
ndo->ndo_packettype = PT_AODV;
- else if (strcasecmp(optarg, "carp") == 0)
+ else if (ascii_strcasecmp(optarg, "carp") == 0)
ndo->ndo_packettype = PT_CARP;
- else if (strcasecmp(optarg, "radius") == 0)
+ else if (ascii_strcasecmp(optarg, "radius") == 0)
ndo->ndo_packettype = PT_RADIUS;
- else if (strcasecmp(optarg, "zmtp1") == 0)
+ else if (ascii_strcasecmp(optarg, "zmtp1") == 0)
ndo->ndo_packettype = PT_ZMTP1;
- else if (strcasecmp(optarg, "vxlan") == 0)
+ else if (ascii_strcasecmp(optarg, "vxlan") == 0)
ndo->ndo_packettype = PT_VXLAN;
- else if (strcasecmp(optarg, "pgm") == 0)
+ else if (ascii_strcasecmp(optarg, "pgm") == 0)
ndo->ndo_packettype = PT_PGM;
- else if (strcasecmp(optarg, "pgm_zmtp1") == 0)
+ else if (ascii_strcasecmp(optarg, "pgm_zmtp1") == 0)
ndo->ndo_packettype = PT_PGM_ZMTP1;
- else if (strcasecmp(optarg, "lmp") == 0)
+ else if (ascii_strcasecmp(optarg, "lmp") == 0)
ndo->ndo_packettype = PT_LMP;
else
error("unknown packet type `%s'", optarg);
#include <string.h>
#include "interface.h"
+#include "ascii_strcasecmp.h"
int32_t thiszone; /* seconds offset from gmt to local time */
if (idx != 0) {
/* Is this a valid request name? */
while ((cmd = *cmds++) != NULL) {
- if (strcasecmp((const char *)token, cmd) == 0) {
+ if (ascii_strcasecmp((const char *)token, cmd) == 0) {
/* Yes. */
is_reqresp = 1;
break;
# End Source File
# Begin Source File
+SOURCE=..\..\ascii_strcasecmp.c
+# End Source File
+# Begin Source File
+
SOURCE=..\..\bpf_dump.c
# End Source File
# Begin Source File
# End Source File
# Begin Source File
-SOURCE=..\..\strcasecmp.c
-# End Source File
-# Begin Source File
-
SOURCE=..\..\missing\strlcat.c
# End Source File
# Begin Source File
/>
</FileConfiguration>
</File>
+ <File
+ RelativePath="..\..\ascii_strcasecmp.c"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
<File
RelativePath="..\..\bpf_dump.c"
>
/>
</FileConfiguration>
</File>
- <File
- RelativePath="..\..\strcasecmp.c"
- >
- <FileConfiguration
- Name="Debug|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories=""
- PreprocessorDefinitions=""
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Release|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories=""
- PreprocessorDefinitions=""
- />
- </FileConfiguration>
- </File>
<File
RelativePath="..\..\missing\strlcat.c"
>