missing/sockstorage.h
missing/strlcat.c
missing/strlcpy.c
+missing/strdup.c
mkdep
nameser.h
netbios.h
print-wb.c
route6d.h
rx.h
-savestr.c
-savestr.h
send-ack.awk
setsignal.c
setsignal.h
*/
#ifndef lint
static const char rcsid[] =
- "@(#) $Header: /tcpdump/master/tcpdump/addrtoname.c,v 1.70 2001-01-17 18:27:36 guy Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/addrtoname.c,v 1.71 2001-01-20 07:22:21 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
#include "interface.h"
#include "addrtoname.h"
#include "llc.h"
-#include "savestr.h"
#include "setsignal.h"
/* Forwards */
if (hp) {
char *dotp;
- p->name = savestr(hp->h_name);
+ p->name = strdup(hp->h_name);
if (Nflag) {
/* Remove domain qualifications */
dotp = strchr(p->name, '.');
}
}
}
- p->name = savestr(intoa(addr));
+ p->name = strdup(intoa(addr));
return (p->name);
}
if (hp) {
char *dotp;
- p->name = savestr(hp->h_name);
+ p->name = strdup(hp->h_name);
if (Nflag) {
/* Remove domain qualifications */
dotp = strchr(p->name, '.');
}
}
cp = (char *)inet_ntop(AF_INET6, &addr, ntop_buf, sizeof(ntop_buf));
- p->name = savestr(cp);
+ p->name = strdup(cp);
return (p->name);
}
#endif /* INET6 */
if (!nflag) {
char buf[128];
if (ether_ntohost(buf, (struct ether_addr *)ep) == 0) {
- tp->e_name = savestr(buf);
+ tp->e_name = strdup(buf);
return (tp->e_name);
}
}
*cp++ = hex[*ep++ & 0xf];
}
*cp = '\0';
- tp->e_name = savestr(buf);
+ tp->e_name = strdup(buf);
return (tp->e_name);
}
*cp++ = hex[port >> 4 & 0xf];
*cp++ = hex[port & 0xf];
*cp++ = '\0';
- tp->name = savestr(buf);
+ tp->name = strdup(buf);
return (tp->name);
}
*cp++ = hex[*pi++ & 0xf];
}
*cp = '\0';
- tp->p_name = savestr(buf);
+ tp->p_name = strdup(buf);
return (tp->p_name);
}
tp->nxt = newhnamemem();
snprintf(buf, sizeof(buf), "sap %02x", sap & 0xff);
- tp->name = savestr(buf);
+ tp->name = strdup(buf);
return (tp->name);
}
tp->nxt = newhnamemem();
(void)snprintf(buf, sizeof(buf), "%u", i);
- tp->name = savestr(buf);
+ tp->name = strdup(buf);
return (tp->name);
}
tp->nxt = newhnamemem();
(void)snprintf(buf, sizeof(buf), "%u", i);
- tp->name = savestr(buf);
+ tp->name = strdup(buf);
return (tp->name);
}
table = table->nxt;
if (nflag) {
(void)snprintf(buf, sizeof(buf), "%d", port);
- table->name = savestr(buf);
+ table->name = strdup(buf);
} else
- table->name = savestr(sv->s_name);
+ table->name = strdup(sv->s_name);
table->addr = port;
table->nxt = newhnamemem();
}
memcpy((char *)&protoid[3], (char *)&etype, 2);
tp = lookup_protoid(protoid);
- tp->p_name = savestr(eproto_db[i].s);
+ tp->p_name = strdup(eproto_db[i].s);
}
}
if (fp != NULL) {
while ((ep = pcap_next_etherent(fp)) != NULL) {
tp = lookup_emem(ep->addr);
- tp->e_name = savestr(ep->name);
+ tp->e_name = strdup(ep->name);
}
(void)fclose(fp);
}
#ifdef HAVE_ETHER_NTOHOST
/* Use yp/nis version of name if available */
if (ether_ntohost(name, (struct ether_addr *)el->addr) == 0) {
- tp->e_name = savestr(name);
+ tp->e_name = strdup(name);
continue;
}
#endif
/* Define if you have the strcasecmp function. */
#undef HAVE_STRCASECMP
+/* Define if you have the strdup function. */
+#undef HAVE_STRDUP
+
/* Define if you have the strlcat function. */
#undef HAVE_STRLCAT
#! /bin/sh
-# From configure.in Revision: 1.133
+# From configure.in Revision: 1.134
fi
-for ac_func in vfprintf strcasecmp strlcat strlcpy
+for ac_func in vfprintf strcasecmp strlcat strlcpy strdup
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
echo "configure:2839: checking for $ac_func" >&5
-dnl @(#) $Header: /tcpdump/master/tcpdump/configure.in,v 1.133 2001-01-17 18:27:36 guy Exp $ (LBL)
+dnl @(#) $Header: /tcpdump/master/tcpdump/configure.in,v 1.134 2001-01-20 07:22:22 guy Exp $ (LBL)
dnl
dnl Copyright (c) 1994, 1995, 1996, 1997
dnl The Regents of the University of California. All rights reserved.
dnl Process this file with autoconf to produce a configure script.
dnl
-AC_REVISION($Revision: 1.133 $)
+AC_REVISION($Revision: 1.134 $)
AC_PREREQ(2.13)
AC_INIT(tcpdump.c)
fi
-AC_REPLACE_FUNCS(vfprintf strcasecmp strlcat strlcpy)
+AC_REPLACE_FUNCS(vfprintf strcasecmp strlcat strlcpy strdup)
AC_CHECK_FUNCS(ether_ntohost setlinebuf)
usegetipnodeby=yes
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
- * @(#) $Header: /tcpdump/master/tcpdump/interface.h,v 1.151 2001-01-15 03:59:13 guy Exp $ (LBL)
+ * @(#) $Header: /tcpdump/master/tcpdump/interface.h,v 1.152 2001-01-20 07:22:22 guy Exp $ (LBL)
*/
#ifndef tcpdump_interface_h
extern size_t strlcpy (char *, const char *, size_t);
#endif
+#ifndef HAVE_STRDUP
+extern char *strdup (const char *str);
+#endif
+
struct tok {
int v; /* value */
char *s; /* string */
--- /dev/null
+/*
+ * Copyright (c) 1988, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. 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 BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#if defined(LIBC_SCCS) && !defined(lint)
+static const char rcsid[] =
+ "@(#) $Header: /tcpdump/master/tcpdump/missing/strdup.c,v 1.1 2001-01-20 07:26:08 guy Exp $ (LBL)";
+#endif /* LIBC_SCCS and not lint */
+
+#include <stddef.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "interface.h"
+
+char *
+strdup(str)
+ const char *str;
+{
+ size_t len;
+ char *copy;
+
+ len = strlen(str) + 1;
+ if ((copy = malloc(len)) == NULL)
+ return (NULL);
+ memcpy(copy, str, len);
+ return (copy);
+}
#ifndef lint
static const char rcsid[] =
- "@(#) $Header: /tcpdump/master/tcpdump/print-atalk.c,v 1.64 2000-10-30 06:22:14 guy Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-atalk.c,v 1.65 2001-01-20 07:22:23 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
#include "ethertype.h"
#include "extract.h" /* must come after interface.h */
#include "appletalk.h"
-#include "savestr.h"
static struct tok type2str[] = {
{ ddpRTMP, "rtmp" },
;
tp->addr = i3;
tp->nxt = newhnamemem();
- tp->name = savestr(nambuf);
+ tp->name = strdup(nambuf);
}
fclose(fp);
}
tp->nxt = newhnamemem();
(void)snprintf(nambuf, sizeof(nambuf), "%s.%d",
tp2->name, athost);
- tp->name = savestr(nambuf);
+ tp->name = strdup(nambuf);
return (tp->name);
}
else
(void)snprintf(nambuf, sizeof(nambuf), "%d.%d", atnet >> 8,
atnet & 0xff);
- tp->name = savestr(nambuf);
+ tp->name = strdup(nambuf);
return (tp->name);
}
#ifndef lint
static const char rcsid[] =
- "@(#) $Header: /tcpdump/master/tcpdump/print-decnet.c,v 1.30 2000-09-28 06:42:57 guy Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-decnet.c,v 1.31 2001-01-20 07:22:24 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
dna.a_len = sizeof(short);
memcpy((char *)dna.a_addr, (char *)&dnaddr, sizeof(short));
- return (savestr(dnet_htoa(&dna)));
+ return (strdup(dnet_htoa(&dna)));
#else
return(dnnum_string(dnaddr)); /* punt */
#endif
+++ /dev/null
-/*
- * Copyright (c) 1997
- * The Regents of the University of California. All rights reserved.
- *
- * 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 lint
-static const char rcsid[] =
- "@(#) $Header: /tcpdump/master/tcpdump/Attic/savestr.c,v 1.6 2000-07-11 00:49:02 assar Exp $ (LBL)";
-#endif
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <sys/types.h>
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#ifdef HAVE_OS_PROTO_H
-#include "os-proto.h"
-#endif
-
-#include "savestr.h"
-
-/* A replacement for strdup() that cuts down on malloc() overhead */
-char *
-savestr(register const char *str)
-{
- register u_int size;
- register char *p;
- static char *strptr = NULL;
- static u_int strsize = 0;
-
- size = strlen(str) + 1;
- if (size > strsize) {
- strsize = 1024;
- if (strsize < size)
- strsize = size;
- strptr = (char *)malloc(strsize);
- if (strptr == NULL) {
- fprintf(stderr, "savestr: malloc\n");
- exit(1);
- }
- }
- (void)strcpy(strptr, str);
- p = strptr;
- strptr += size;
- strsize -= size;
- return (p);
-}
+++ /dev/null
-/*
- * Copyright (c) 1997
- * The Regents of the University of California. All rights reserved.
- *
- * 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.
- *
- * @(#) $Header: /tcpdump/master/tcpdump/Attic/savestr.h,v 1.1 1999-10-07 23:47:12 mcr Exp $ (LBL)
- */
-
-extern char *savestr(const char *);