1996-11-27 02:46:52 +01:00
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
*
|
|
|
|
* strdup.c--
|
1997-09-07 07:04:48 +02:00
|
|
|
* copies a null-terminated string.
|
1996-11-27 02:46:52 +01:00
|
|
|
*
|
|
|
|
* Copyright (c) 1994, Regents of the University of California
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* IDENTIFICATION
|
1997-09-08 04:41:22 +02:00
|
|
|
* $Header: /cvsroot/pgsql/src/utils/Attic/strdup.c,v 1.4 1997/09/08 02:41:21 momjian Exp $
|
1996-11-27 02:46:52 +01:00
|
|
|
*
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
#include <string.h>
|
1996-11-28 04:32:18 +01:00
|
|
|
#include <stdlib.h>
|
1996-11-27 02:46:52 +01:00
|
|
|
#include "strdup.h"
|
|
|
|
|
1997-09-08 04:41:22 +02:00
|
|
|
char *
|
1997-09-07 07:04:48 +02:00
|
|
|
strdup(char const * string)
|
1996-11-27 02:46:52 +01:00
|
|
|
{
|
1997-09-08 04:41:22 +02:00
|
|
|
char *nstr;
|
1996-11-27 02:46:52 +01:00
|
|
|
|
1997-09-07 07:04:48 +02:00
|
|
|
nstr = strcpy((char *) malloc(strlen(string) + 1), string);
|
|
|
|
return nstr;
|
1996-11-27 02:46:52 +01:00
|
|
|
}
|