openldap/libraries/liblutil/strdup.c

22 lines
334 B
C
Raw Normal View History

1998-10-25 11:15:45 +08:00
#include "portable.h"
#ifndef HAVE_STRDUP
#include <stdlib.h>
1998-10-25 11:15:45 +08:00
#include <ac/string.h>
#include "lutil.h"
1998-10-25 11:15:45 +08:00
char *(strdup)( const char *s )
1998-10-25 11:15:45 +08:00
{
char *p;
if ( (p = (char *) malloc( strlen( s ) + 1 )) == NULL )
return( (char *)0 );
1998-10-25 11:15:45 +08:00
strcpy( p, s );
return( p );
}
#endif /* !strdup */