diff options
author | cinap_lenrek <cinap_lenrek@felloff.net> | 2013-12-28 05:14:10 +0100 |
---|---|---|
committer | cinap_lenrek <cinap_lenrek@felloff.net> | 2013-12-28 05:14:10 +0100 |
commit | 7143b286b7b57eed2b49ba143dcae90be3716b0e (patch) | |
tree | 51d097b34895fd2e86dd76e37a78792aadf49638 /sys/src/ape/lib/ap | |
parent | 4aa68d2f3a10b81fecc27550c9e1bb05b7b74887 (diff) |
ape: move strdup() from libbsd to libap (from sources)
including <string.h> should be enougth to make strdup()
available.
Diffstat (limited to 'sys/src/ape/lib/ap')
-rw-r--r-- | sys/src/ape/lib/ap/gen/mkfile | 1 | ||||
-rw-r--r-- | sys/src/ape/lib/ap/gen/strdup.c | 16 |
2 files changed, 17 insertions, 0 deletions
diff --git a/sys/src/ape/lib/ap/gen/mkfile b/sys/src/ape/lib/ap/gen/mkfile index 970e04aff..6594587f4 100644 --- a/sys/src/ape/lib/ap/gen/mkfile +++ b/sys/src/ape/lib/ap/gen/mkfile @@ -55,6 +55,7 @@ ALLOFILES=\ strtoull.$O\ strxfrm.$O\ toupper.$O\ + strdup.$O\ # cull things in the per-machine directories from this list OFILES= `{rc ./reduce $O $objtype $ALLOFILES} diff --git a/sys/src/ape/lib/ap/gen/strdup.c b/sys/src/ape/lib/ap/gen/strdup.c new file mode 100644 index 000000000..5e4a3759e --- /dev/null +++ b/sys/src/ape/lib/ap/gen/strdup.c @@ -0,0 +1,16 @@ +#include <string.h> +#include <ctype.h> +#include <stdlib.h> + +char* +strdup(char *p) +{ + int n; + char *np; + + n = strlen(p)+1; + np = malloc(n); + if(np) + memmove(np, p, n); + return np; +} |