]> git.ozlabs.org Git - ppp.git/blob - pppd/plugins/radius/radiusclient/lib/strdup.c
0c487bf3ba1760516d7ebdf66d6c8b971e46e2fd
[ppp.git] / pppd / plugins / radius / radiusclient / lib / strdup.c
1 /*
2  * $Id: strdup.c,v 1.1 2002/01/22 16:03:02 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 }