8000 minix/lib/other/strdup.c at R3.1.3 · dtytomi/minix · GitHub
[go: up one dir, main page]

Skip to content

Latest commit

 

History

History
23 lines (17 loc) · 231 Bytes

strdup.c

File metadata and controls

23 lines (17 loc) · 231 Bytes
/*
lib/other/strdup.c
*/
#include <stdlib.h>
#include <string.h>
char *strdup(s1)
const char *s1;
{
size_t len;
char *s2;
len= strlen(s1)+1;
s2= malloc(len);
if (s2 == NULL)
return NULL;
strcpy(s2, s1);
return s2;
}
0