summaryrefslogtreecommitdiffstats
path: root/contrib/tcpdump/missing
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/tcpdump/missing')
-rw-r--r--contrib/tcpdump/missing/snprintf.c8
-rw-r--r--contrib/tcpdump/missing/strdup.c57
2 files changed, 63 insertions, 2 deletions
diff --git a/contrib/tcpdump/missing/snprintf.c b/contrib/tcpdump/missing/snprintf.c
index 176636f..1d4ab71 100644
--- a/contrib/tcpdump/missing/snprintf.c
+++ b/contrib/tcpdump/missing/snprintf.c
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*/
-/* $Id: snprintf.c,v 1.4 2001/01/02 22:33:04 guy Exp $ */
+/* $Id: snprintf.c,v 1.5 2001/01/12 10:14:40 guy Exp $ */
#ifdef HAVE_CONFIG_H
#include <config.h>
@@ -39,7 +39,7 @@
#ifndef lint
static const char rcsid[] =
- "@(#) $Header: /tcpdump/master/tcpdump/missing/snprintf.c,v 1.4 2001/01/02 22:33:04 guy Exp $";
+ "@(#) $Header: /tcpdump/master/tcpdump/missing/snprintf.c,v 1.5 2001/01/12 10:14:40 guy Exp $";
#endif
#include <stdio.h>
@@ -93,6 +93,7 @@ sn_append_char (struct state *state, unsigned char c)
}
#endif
+#if 0
static int
as_reserve (struct state *state, size_t n)
{
@@ -126,6 +127,7 @@ as_append_char (struct state *state, unsigned char c)
return 0;
}
}
+#endif
static int
append_number(struct state *state,
@@ -490,6 +492,7 @@ snprintf (char *str, size_t sz, const char *format, ...)
}
#endif
+#if 0
#ifndef HAVE_ASPRINTF
int
asprintf (char **ret, const char *format, ...)
@@ -600,6 +603,7 @@ vasnprintf (char **ret, size_t max_sz, const char *format, va_list args)
}
}
#endif
+#endif
#ifndef HAVE_VSNPRINTF
int
diff --git a/contrib/tcpdump/missing/strdup.c b/contrib/tcpdump/missing/strdup.c
new file mode 100644
index 0000000..103c3b2
--- /dev/null
+++ b/contrib/tcpdump/missing/strdup.c
@@ -0,0 +1,57 @@
+/*
+ * 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);
+}
OpenPOWER on IntegriCloud