Rocco Rutte:
[apps/madmutt.git] / strdup.c
1 /*
2  * Copyright notice from original mutt:
3  * [none]
4  *
5  * This file is part of mutt-ng, see http://www.muttng.org/.
6  * It's licensed under the GNU General Public License,
7  * please see the file GPL in the top level source directory.
8  */
9
10 /* ultrix doesn't have strdup */
11
12 #include <string.h>
13 #include <stdlib.h>
14
15 char *strdup (const char *s)
16 {                               /* __MEM_CHECKED__ */
17   char *d;
18
19   if (s == NULL)
20     return NULL;
21
22   if ((d = malloc (mutt_strlen (s) + 1)) == NULL)    /* __MEM_CHECKED__ */
23     return NULL;
24
25   memcpy (d, s, mutt_strlen (s) + 1);
26   return d;
27 }