summaryrefslogtreecommitdiffstats
path: root/contrib/ntp/libntp/strdup.c
blob: 08ffc2ff031ebd159e60897f65e6e4f36e77a06a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20

#define NULL 0

char *
strdup(
	const char *s
	)
{
        char *cp;

        if (s) {
                cp = (char *) malloc((unsigned) (strlen(s)+1));
                if (cp) {
                        (void) strcpy(cp, s);
		}
        } else {
                cp = (char *) NULL;
	}
        return(cp);
}
OpenPOWER on IntegriCloud