Added strdup()

This commit is contained in:
Michael Brown
2006-12-08 00:34:47 +00:00
parent 1e4a838f55
commit 496563071d
2 changed files with 11 additions and 2 deletions

View File

@@ -21,8 +21,9 @@
* reentrant and should be faster). Use only strsep() in new code, please.
*/
#include "etherboot.h"
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
/* *** FROM string.c *** */
@@ -538,3 +539,10 @@ void * memchr(const void *s, int c, size_t n)
}
#endif
char * strdup(const char *s) {
char *new = malloc(strlen(s)+1);
if (new)
strcpy(new,s);
return new;
}