]> git.ozlabs.org Git - ppp.git/blob - pppd/plugins/radius/radiusclient/lib/strdup.c
Large patch from Frank Cusack <fcusack@fcusack.com> to add proper
[ppp.git] / pppd / plugins / radius / radiusclient / lib / strdup.c
1 /*
2  * $Id: strdup.c,v 1.2 2002/02/27 15:51:20 dfs Exp $
3  *
4  * Copyright (C) 1996 Lars Fenneberg and Christian Graefe
5  *
6  * This file is provided under the terms and conditions of the GNU general
7  * public license, version 2 or any later version, incorporated herein by
8  * reference.
9  *
10  */
11
12 #include "config.h"
13 #include "includes.h"
14
15 /*
16  * Function: strdup
17  *
18  * Purpose:  strdup replacement for systems which lack it
19  *
20  */
21
22 char *strdup(char *str)
23 {
24         char *p;
25
26         if (str == NULL)
27                 return NULL;
28
29         if ((p = (char *)malloc(strlen(str)+1)) == NULL)
30                 return p;
31
32         return strcpy(p, str);
33 }