OwnCode/HttpFetcher/http-fetcher-orig/HttpFetcher.cpp
/*
 * Returns a pointer to the current error description message. The
 *  message pointed to is only good until the next call to http_strerror(),
 *  so if you need to hold on to the message for a while you should make
 *  a copy of it
 */
Returns a pointer to the current error description message. The
message pointed to is only good until the next call to http_strerror(),
so if you need to hold on to the message for a while you should make
a copy of it
Returns a pointer to the current error description message . The message pointed to is only good until the next call to http_strerror () so if you need to hold on to the message for a while you should make a copy of it
const char *http_strerror(void)
{
    extern int errno;
    if (errorSource == ERRNO)
        return strerror(errno);
    else if (errorSource == H_ERRNO)
#ifdef HAVE_HSTRERROR
        return hstrerror(h_errno);
#else
        return http_errlist[HF_HERROR];
#endif
    else if (errorSource == FETCHER_ERROR) {
        if (strstr(http_errlist[http_errno], "%d") == NULL)
            return http_errlist[http_errno];
        else {
            char *stringIndex, *originalError;
            originalError = (char *)http_errlist[http_errno];
            convertedError[0] = 0;      
            stringIndex = strstr(originalError, "%d");
            strncat(convertedError, originalError,      
                    abs(stringIndex - originalError));
            sprintf(&convertedError[strlen(convertedError)], "%d", errorInt);
            stringIndex += 2;       
            strcat(convertedError, stringIndex);
            return convertedError;
        }
    }
    return http_errlist[HF_METAERROR];  
}
const char * http_strerror ( void ) { extern int errno ; if ( errorSource == ERRNO ) return strerror ( errno ) ; else if ( errorSource == H_ERRNO ) #ifdef HAVE_HSTRERROR return hstrerror ( h_errno ) ; #else return http_errlist [ HF_HERROR ] ; #endif else if ( errorSource == FETCHER_ERROR ) { if ( strstr ( http_errlist [ http_errno ] , " " ) == NULL ) return http_errlist [ http_errno ] ; else { char * stringIndex , * originalError ; originalError = ( char * ) http_errlist [ http_errno ] ; convertedError [ 0 ] = 0 ; stringIndex = strstr ( originalError , " " ) ; strncat ( convertedError , originalError , abs ( stringIndex - originalError ) ) ; sprintf ( & convertedError [ strlen ( convertedError ) ] , " " , errorInt ) ; stringIndex += 2 ; strcat ( convertedError , stringIndex ) ; return convertedError ; } } return http_errlist [ HF_METAERROR ] ; }
Returns a pointer to the current error description message.
Returns a pointer to the current error description message .
/* The error string has a %d in it, we need to insert errorInt.
             *  convertedError[128] has been declared for that purpose */ /* Start off with NULL */ /* Copy up to %d */ /* Skip past the %d */ /* Should NEVER happen */