OwnCode/HttpFetcher/http-fetcher-orig/HttpFetcher.cpp
/*
 * Puts the filename portion of the url into 'filename'.
 * Returns:
 *  0 on success
 *  1 when url contains no end filename (i.e., 'www.foo.com/'),
 *      and **filename should not be assumed to be valid
 *  -1 on error
 */
Puts the filename portion of the url into 'filename'.
Returns:
0 on success
1 when url contains no end filename ,
and **filename should not be assumed to be valid
-1 on error
Puts the filename portion of the url into ' filename ' . Returns : 0 on success 1 when url contains no end filename and ** filename should not be assumed to be valid - 1 on error
int http_parseFilename(const char *url, char **filename)
{
    char *ptr;
    if (url == NULL) {
        errorSource = FETCHER_ERROR;
        http_errno = HF_NULLURL;
        return -1;
    }
    ptr = (char *)rindex(url, '/');
    if (ptr == NULL)
        return 1;
    ptr++;
    if (*ptr == '\0') return 1;
    *filename = (char *)malloc(strlen(ptr));
    if (*filename == NULL) {
        errorSource = ERRNO;
        return -1;
    }
    strcpy(*filename, ptr);
    return 0;
}
int http_parseFilename ( const char * url , char * * filename ) { char * ptr ; if ( url == NULL ) { errorSource = FETCHER_ERROR ; http_errno = HF_NULLURL ; return -1 ; } ptr = ( char * ) rindex ( url , ' ' ) ; if ( ptr == NULL ) return 1 ; ptr ++ ; if ( * ptr == ' \0 ' ) return 1 ; * filename = ( char * ) malloc ( strlen ( ptr ) ) ; if ( * filename == NULL ) { errorSource = ERRNO ; return -1 ; } strcpy ( * filename , ptr ) ; return 0 ; }
Puts the filename portion of the url into 'filename'.
Puts the filename portion of the url into ' filename ' .
/* Root level request, apparently */