1a90e161bSBill Fenner /*
2a90e161bSBill Fenner * Copyright (c) 1988, 1993
3a90e161bSBill Fenner * The Regents of the University of California. All rights reserved.
4a90e161bSBill Fenner *
5a90e161bSBill Fenner * Redistribution and use in source and binary forms, with or without
6a90e161bSBill Fenner * modification, are permitted provided that the following conditions
7a90e161bSBill Fenner * are met:
8a90e161bSBill Fenner * 1. Redistributions of source code must retain the above copyright
9a90e161bSBill Fenner * notice, this list of conditions and the following disclaimer.
10a90e161bSBill Fenner * 2. Redistributions in binary form must reproduce the above copyright
11a90e161bSBill Fenner * notice, this list of conditions and the following disclaimer in the
12a90e161bSBill Fenner * documentation and/or other materials provided with the distribution.
13a90e161bSBill Fenner * 3. All advertising materials mentioning features or use of this software
14a90e161bSBill Fenner * must display the following acknowledgement:
15a90e161bSBill Fenner * This product includes software developed by the University of
16a90e161bSBill Fenner * California, Berkeley and its contributors.
17a90e161bSBill Fenner * 4. Neither the name of the University nor the names of its contributors
18a90e161bSBill Fenner * may be used to endorse or promote products derived from this software
19a90e161bSBill Fenner * without specific prior written permission.
20a90e161bSBill Fenner *
21a90e161bSBill Fenner * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
22a90e161bSBill Fenner * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23a90e161bSBill Fenner * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24a90e161bSBill Fenner * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
25a90e161bSBill Fenner * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26a90e161bSBill Fenner * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27a90e161bSBill Fenner * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28a90e161bSBill Fenner * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29a90e161bSBill Fenner * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30a90e161bSBill Fenner * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31a90e161bSBill Fenner * SUCH DAMAGE.
32a90e161bSBill Fenner */
33a90e161bSBill Fenner
34a90e161bSBill Fenner #include <stddef.h>
35a90e161bSBill Fenner #include <stdlib.h>
36a90e161bSBill Fenner #include <string.h>
37a90e161bSBill Fenner
38*3340d773SGleb Smirnoff #include "netdissect.h"
39a90e161bSBill Fenner
40a90e161bSBill Fenner char *
strdup(str)41a90e161bSBill Fenner strdup(str)
42a90e161bSBill Fenner const char *str;
43a90e161bSBill Fenner {
44a90e161bSBill Fenner size_t len;
45a90e161bSBill Fenner char *copy;
46a90e161bSBill Fenner
47a90e161bSBill Fenner len = strlen(str) + 1;
48a90e161bSBill Fenner if ((copy = malloc(len)) == NULL)
49a90e161bSBill Fenner return (NULL);
50a90e161bSBill Fenner memcpy(copy, str, len);
51a90e161bSBill Fenner return (copy);
52a90e161bSBill Fenner }
53