#include <stdio.h> 
#include <string.h>

#include <curl/curl.h>

void ourWriteOut(CURL *curl)
{
  FILE *stream = stdout;
  char *stringp=NULL;
  long longinfo=0;
  double doubleinfo=0.0;
  
  if(CURLE_OK == curl_easy_getinfo(curl, CURLINFO_EFFECTIVE_URL, &stringp))
                  fputs(stringp, stream); 
  fputc('|', stream);
  if(CURLE_OK == curl_easy_getinfo(curl, CURLINFO_FILETIME, &longinfo))
                  fprintf(stream, "%li", longinfo); 
  fputc('|', stream);
  if(CURLE_OK == curl_easy_getinfo(curl, CURLINFO_HTTP_CODE, &longinfo))
                  fprintf(stream, "%03ld", longinfo);
  fputc('|', stream);
  if(CURLE_OK == curl_easy_getinfo(curl, CURLINFO_TOTAL_TIME, &doubleinfo))
                  fprintf(stream, "%.3f", doubleinfo);
  fputc('|', stream);
  if(CURLE_OK == curl_easy_getinfo(curl, CURLINFO_NAMELOOKUP_TIME,&doubleinfo))
                  fprintf(stream, "%.3f", doubleinfo);
  fputc('|', stream);
  if(CURLE_OK == curl_easy_getinfo(curl, CURLINFO_CONNECT_TIME, &doubleinfo))
                  fprintf(stream, "%.3f", doubleinfo);
  fputc('|', stream);
  if(CURLE_OK == curl_easy_getinfo(curl, CURLINFO_PRETRANSFER_TIME, &doubleinfo))
                  fprintf(stream, "%.3f", doubleinfo);
  fputc('|', stream);
  if(CURLE_OK == curl_easy_getinfo(curl, CURLINFO_SIZE_DOWNLOAD, &doubleinfo))
                  fprintf(stream, "%.0f", doubleinfo);
  fputc('|', stream);
  if(CURLE_OK == curl_easy_getinfo(curl, CURLINFO_SPEED_DOWNLOAD, &doubleinfo))
                  fprintf(stream, "%.3f", doubleinfo);
  fputc('\n', stream);
}
