Staging
v0.8.1
Revision 399502c0ba39f545fcdf6230e2e163961c655480 authored by cvs2svn on 09 October 1997, 23:32:24 UTC, committed by cvs2svn on 09 October 1997, 23:32:24 UTC
1 parent 9a513ef
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