openldap/libraries/liblutil/strdup.c

22 lines
332 B
C
Raw Normal View History

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