/* @(#)strdup.c	1.2	2/10/93 */
#include <stdio.h>

char *strdup( char *s)              /* save string s somewhere */
{
      register char *p, *q;
      extern char *malloc();

      if((p=malloc((unsigned) strlen(s)+1)) == NULL) {
              return(NULL);           /* no room */
      }
      q = p;
      while(*q++ = *s++);             /* copy string s into p */
      return(p);                      /* return pointer to copy */
}

