]> CyberLeo.Net >> Repos - FreeBSD/releng/10.0.git/blob - contrib/ntp/libntp/strdup.c
- Copy stable/10 (r259064) to releng/10.0 as part of the
[FreeBSD/releng/10.0.git] / contrib / ntp / libntp / strdup.c
1 #include "ntp_malloc.h"
2
3 #if !HAVE_STRDUP
4
5 #define NULL 0
6
7 char *strdup(const char *s);
8
9 char *
10 strdup(
11         const char *s
12         )
13 {
14         char *cp;
15
16         if (s) {
17                 cp = (char *) malloc((unsigned) (strlen(s)+1));
18                 if (cp) {
19                         (void) strcpy(cp, s);
20                 }
21         } else {
22                 cp = (char *) NULL;
23         }
24         return(cp);
25 }
26 #else
27 int strdup_bs;
28 #endif