1/*
2 * $Id: strdup.c,v 1.1.1.1 2008/10/15 03:30:50 james26_jang 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
22char *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}
34