/*
 * duplicate a string
 */

#include <stdio.h>
#include <string.h>

static const char rcsid[] =
    "$Header: /afs/sipb.mit.edu/project/discuss/.cvsroot/discuss/source/xdsc/strdup.c,v 1.4 1992/06/26 02:26:03 raeburn Exp $";

extern void *malloc (unsigned);

int strlen (const char *s) {
    const char *s2 = s;
    while (*s2)
	s2++;
    return (s2 - s);
}

char *strdup (const char *s) {
    const char *s1;
    char *s2;
    unsigned len;

    len = 1 + strlen (s);
    s2 = malloc((unsigned) sizeof(char) * len);
    bcopy (s, s2, len);
    return(s2);
}
