/*
 * $Log: mime_test,v $
 * Revision 1.2  1998/05/28 19:41:11  joseph
 * Changed all printf()'s to debug_printf(())'s
 *
 * Revision 1.1.1.1  1997/12/29 14:37:55  jogu
 * WebGet Initial CMS Ver
 *
 */

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

#define BOOL int
#include "flex.h"
#undef BOOL

#include "url.h"

void mimetest(char *type)
{
  mimetype_t *result = mimetype_lookup(type);
  if (!result)
  {
    debug_printf(("%s : Not found!\n",type));
    return;
  }

  debug_printf(("%s : %x. Ref = %d. ",type,result->filetype,result->ref));

  result = mimetype_lookupbyref(result->ref);
  if (!result)
  {
    debug_printf(("%s : Not found!\n",type));
    return;
  }

  {
    char *ptr = (char *) result;
    int strsize = sizeof(mimetype_t);
    int len1 = strlen(ptr + strsize) + 1; /* read length of string in this record */
//    int len2 = strlen(ptr + strsize + len1) + 1;

    debug_printf(("Type = %s/%s\n", ptr+strsize, ptr+strsize+len1));
  }

}

int main(void)
{
  flex_init("mime_test", NULL);
  url_init();

  mimetype_load(TASK_DIR".Resources.FileTypes");

  url_dump(MIMETYPES,TASK_DIR".MimeDump");

  mimetest("text/html");
  mimetest("image/gif");
  mimetest("image/wibble");
  mimetest("audio/midi");
  mimetest("bigwibble/gif");
  mimetest("x-world/gif");
  mimetest("x-world-gif");


  return 0;
}
