OwnCode/HttpFetcher/http-fetcher-orig/HttpFetcher.cpp
/* Depending on the source of error, calls either perror() or prints
 *  an HTTP Fetcher error message to stdout */
Depending on the source of error, calls either perror() or prints
an HTTP Fetcher error message to stdout
Depending on the source of error calls either perror () or prints an HTTP Fetcher error message to stdout
void http_perror(const char *string)
{
    if (errorSource == ERRNO)
        perror(string);
    else if (errorSource == H_ERRNO)
        herror(string);
    else if (errorSource == FETCHER_ERROR) {
        char *stringIndex;
        if (strstr(http_errlist[http_errno], "%d") == NULL) {
            fputs(string, stderr);
            fputs(": ", stderr);
            fputs(http_errlist[http_errno], stderr);
            fputs("\n", stderr);
        } else {
            stringIndex = (char *)http_errlist[http_errno];
            while (*stringIndex != '%') {       
                fputc(*stringIndex, stderr);
                stringIndex++;
            }
            fprintf(stderr, "%d", errorInt);    
            stringIndex += 2;                   
            while (*stringIndex != 0) {         
                fputc(*stringIndex, stderr);
                stringIndex++;
            }
            fputs("\n", stderr);
        }
    }
}
void http_perror ( const char * string ) { if ( errorSource == ERRNO ) perror ( string ) ; else if ( errorSource == H_ERRNO ) herror ( string ) ; else if ( errorSource == FETCHER_ERROR ) { char * stringIndex ; if ( strstr ( http_errlist [ http_errno ] , " " ) == NULL ) { fputs ( string , stderr ) ; fputs ( " " , stderr ) ; fputs ( http_errlist [ http_errno ] , stderr ) ; fputs ( " \n " , stderr ) ; } else { stringIndex = ( char * ) http_errlist [ http_errno ] ; while ( * stringIndex != ' ' ) { fputc ( * stringIndex , stderr ) ; stringIndex ++ ; } fprintf ( stderr , " " , errorInt ) ; stringIndex += 2 ; while ( * stringIndex != 0 ) { fputc ( * stringIndex , stderr ) ; stringIndex ++ ; } fputs ( " \n " , stderr ) ; } } }
Depending on the source of error, calls either perror() or prints
  an HTTP Fetcher error message to stdout
Depending on the source of error calls either perror () or prints an HTTP Fetcher error message to stdout
/* The error string has a %d in it, we need to insert errorInt */ /* Print up to the %d */ /* Print the number */ /* Skip past the %d */ /* Print up to the end NULL */