Staging
v0.8.1
Revision 5c38bf6c62eb9590fb0616120e51aeac220bfc0a authored by Barry Warsaw on 02 December 1997, 22:01:04 UTC, committed by Barry Warsaw on 02 December 1997, 22:01:04 UTC
1 parent 673d05f
Raw File
strdup.c
/* strdup() replacement (from stdwin, if you must know) */

#include "config.h"
#include "myproto.h"
#include "mymalloc.h"

#include <string.h>

char *
strdup(str)
	const char *str;
{
	if (str != NULL) {
		register char *copy = malloc(strlen(str) + 1);
		if (copy != NULL)
			return strcpy(copy, str);
	}
	return NULL;
}
back to top