require "config.pl";

sub mimeType
{
	($ext)=@_;
	$ok=0;

	open(FM, $mimetypes) or 
		die "Cannot open 'mime.types'";

	while(<FM>)
	{
		next if ( $_=~/^\s*#/ );   # Skip comments
		/^([a-z\/\-\.]*)[\s\t]*(.*)\n$/; # Get (type) (extensions)
		($type, $exts) = ($1,$2);
		foreach $A (split(/\s/,$exts))
		{
			if ($A eq $ext)
			{
				close(FM);
				return $type;
			}
		}
	}
	return "text/plain" if (!$ok);
	close(FM);
}

return 1;
