diff options
author | bertrand <bertrand@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2001-06-04 17:47:43 +0000 |
---|---|---|
committer | bertrand <bertrand@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2001-06-04 17:47:43 +0000 |
commit | 4b793fee5eec3d5cb98dcadc0809338876f55e88 (patch) | |
tree | c1f1c6ee5d3450ad789aa222e99aa717a54c4b13 /url.c | |
parent | 70faf50935741eccc31853b09bec99692cfe0527 (diff) | |
download | mpv-4b793fee5eec3d5cb98dcadc0809338876f55e88.tar.bz2 mpv-4b793fee5eec3d5cb98dcadc0809338876f55e88.tar.xz |
Modified code for path/filename extraction.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@998 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'url.c')
-rw-r--r-- | url.c | 9 |
1 files changed, 4 insertions, 5 deletions
@@ -39,7 +39,7 @@ url_new(char* url) { // 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 @@ url_new(char* url) { 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 @@ url_new(char* url) { 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 ) { |