36 char * res = (
char*)
"text/html";
37 l = strlen(unix_path);
39 NSLOG(netsurf, INFO,
"unix path: %s", unix_path);
42 if( strchr( unix_path, (
int)
'.' ) ){
43 if (2 < l && strcasecmp(unix_path + l - 3,
"f79") == 0)
44 res = (
char*)
"text/css";
45 else if (2 < l && strcasecmp(unix_path + l - 3,
"css") == 0)
46 res = (
char*)
"text/css";
47 else if (2 < l && strcasecmp(unix_path + l - 3,
"jpg") == 0)
48 res = (
char*)
"image/jpeg";
49 else if (3 < l && strcasecmp(unix_path + l - 4,
"jpeg") == 0)
50 res = (
char*)
"image/jpeg";
51 else if (2 < l && strcasecmp(unix_path + l - 3,
"gif") == 0)
52 res = (
char*)
"image/gif";
53 else if (2 < l && strcasecmp(unix_path + l - 3,
"png") == 0)
54 res = (
char*)
"image/png";
55 else if (2 < l && strcasecmp(unix_path + l - 3,
"jng") == 0)
56 res = (
char*)
"image/jng";
57 else if (2 < l && strcasecmp(unix_path + l - 3,
"svg") == 0)
58 res = (
char*)
"image/svg";
59 else if (2 < l && strcasecmp(unix_path + l - 3,
"txt") == 0)
60 res = (
char*)
"text/plain";
64 fp = fopen( unix_path,
"r" );
75 }
while (c != EOF && n<15);
78 if( n > 5 && strncasecmp(
"GIF89",
buffer, 5) == 0 )
79 res = (
char*)
"image/gif";
80 else if( n > 4 && strncasecmp(
"PNG", &
buffer[1], 3) ==0 )
81 res = (
char*)
"image/png";
82 else if( n > 10 && strncasecmp(
"JFIF", &
buffer[5], 4) == 0 )
83 res = (
char*)
"image/jpeg";
88 NSLOG(netsurf, INFO,
"mime type: %s", res);
const char * fetch_filetype(const char *unix_path)
Determine the MIME type of a local file.
static osspriteop_area * buffer
The buffer characteristics.
#define NSLOG(catname, level, logmsg, args...)
Localised message support (interface).
Interface to utility string handling.
Interface to a number of general purpose functionality.