git://git.jankratochvil.net
/
mdsms.git
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
1dfd7e7c2b9f3f64a9830d3c37f3cee1c8c8135c
[mdsms.git]
/
strdup.c
1
#include "config.h"
2
#ifndef lint
3
static char rcsid[] ATTR_UNUSED = "$Id$";
4
#endif
5
6
/* This part of code is a public domain */
7
8
#ifdef HAVE_STDLIB_H
9
#include <stdlib.h>
10
#endif
11
#ifdef HAVE_STRING_H
12
#include <string.h>
13
#endif
14
15
/* CONFORMING TO SVID 3, BSD 4.3 */
16
17
char *strdup(const char *s)
18
{
19
size_t l;
20
char *d;
21
22
if (!(d=malloc(l=strlen(s)+1))) return(NULL);
23
return memcpy(d,s,l);
24
}