# HG changeset patch # User bertrand # Date 991676863 0 # Node ID 647f5781d49082022b00fa3959b50a7a9f71af14 # Parent a97eb50a2c3ba6fb1151217942e4cc8dbccb4ebf Modified code for path/filename extraction. diff -r a97eb50a2c3b -r 647f5781d490 url.c --- a/url.c Mon Jun 04 17:42:09 2001 +0000 +++ b/url.c Mon Jun 04 17:47:43 2001 +0000 @@ -39,7 +39,7 @@ // extract the protocol ptr1 = strstr(url, "://"); if( ptr1==NULL ) { - printf("Malformed URL or not an URL!\n"); + printf("Not an URL!\n"); return NULL; } pos1 = ptr1-url; @@ -68,7 +68,7 @@ pos2 = ptr2-url; } // copy the hostname in the URL container - Curl->hostname = (char*)malloc(strlen(url)+1); + Curl->hostname = (char*)malloc(pos2-pos1-3+1); if( Curl->hostname==NULL ) { printf("Memory allocation failed!\n"); exit(1); @@ -88,11 +88,10 @@ printf("Memory allocation failed!\n"); exit(1); } - Curl->file[0]='/'; - strcpy(Curl->file+1, ptr2+1); + strcpy(Curl->file, ptr2); } } - // Check if a filenme was given or set else set it with '/' + // Check if a filenme was given or set, else set it with '/' if( Curl->file==NULL ) { Curl->file = (char*)malloc(2); if( Curl->file==NULL ) {