Memory Fault

Sys Admin gh at S5000.UUCP
Thu Jul 26 08:49:29 AEST 1990


Thanks to all who responded

here's the code that worked
My system is a AT&T 3b1 System V 3.51m

#include "simped.h"

char *strdup(string)
char *string;
{
/*static char *buffer;*/
char *buffer, *malloc();

int stringinx;

if ((buffer = (char *) malloc(strlen(string) + 1)) == NULL)
    {
    fprintf(stderr, "malloc: in strdup, error\n");
    exit(2);
    }

   return strcpy(buffer, string);
}
-- 

_____________________________________Glen_______________________________________
______________________________Lexington__Oklahoma_______________________________
______________________{uunet uunet.uu.net}!uokmax!S5000!gh______________________



More information about the Comp.lang.c mailing list