Main Page   Data Structures   File List   Data Fields   Globals   Related Pages  

mime.c File Reference

mime type helper function. More...

#include "common.h"
#include <errno.h>
#include <string.h>
#include "mime.h"
#include "char_xhash.h"
#include "conftable.h"
#include "logger.h"
#include "misc.h"
#include "xmalloc.h"

Include dependency graph for mime.c:

Include dependency graph

Go to the source code of this file.

Functions

int mimeInit (const char *mime_types_file)
 initialise global MIME table. More...

char * mimeLookup (const char *file_ext)
 look up the MIME type for a given file extension. More...

int mimeTerminate ()
 destroys the gobal MIME type table. More...


Variables

CharHashTab mime_tab
 hash table storing file extensions and the corresponding mime types.


Detailed Description

mime type helper function.

Todo:
Allocate and copy mime types only once.

Definition in file mime.c.


Function Documentation

int mimeInit (  const char *    mime_types_file ) 
 

initialise global MIME table.

mimeInit reads the mime.types definition file and creates the global file extension to MIME type mapping table.

Returns:
0 on success, -1 on failure

Definition at line 41 of file mime.c.

char* mimeLookup (  const char *    file_ext ) 
 

look up the MIME type for a given file extension.

Parameters:
file_ext  a file extension without the leading "."
Returns:
a char* pointing to the MIME type or NULL if no MIME type could be found

Definition at line 98 of file mime.c.

int mimeTerminate (    ) 
 

destroys the gobal MIME type table.

This destroys the global MIME type table and frees all of it's allocated ressources.

Returns:
0 on success, -1 on failure

Definition at line 103 of file mime.c.


Generated on Fri Jan 25 22:40:52 2002 for PDepp Webserver by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001