Plan 9 from User Space's /usr/local/plan9/src/lib9/strdup.c

#include <u.h>
#include <libc.h>

char*
strdup(char *s)
{
	char *t;
	int l;

	l = strlen(s);
	t = malloc(l+1);
	if(t == nil)
		return nil;
	memmove(t, s, l+1);
	return t;
}


Space Glenda

Copyright © 2005 Lucent Technologies, Russ Cox, MIT.
See license for details.