source: trunk/minix/lib/other/strdup.c@ 9

Last change on this file since 9 was 9, checked in by Mattia Monga, 13 years ago

Minix 3.1.2a

File size: 231 bytes
RevLine 
[9]1/*
2lib/other/strdup.c
3*/
4
5#include <stdlib.h>
6#include <string.h>
7
8char *strdup(s1)
9const char *s1;
10{
11 size_t len;
12 char *s2;
13
14 len= strlen(s1)+1;
15
16 s2= malloc(len);
17 if (s2 == NULL)
18 return NULL;
19 strcpy(s2, s1);
20
21 return s2;
22}
23
Note: See TracBrowser for help on using the repository browser.