~lastrosade/jsthttpd

jsthttpd/src/make_mime.pl -rwxr-xr-x 907 bytes
690a22c5Jeremy Lee Shields LICENSE 1 year, 6 days ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/usr/bin/perl

#Run this on developer side, whenever you update
#your mime encodings, or mime types.

open(ENCODINGS, '<', "mime_encodings.txt");
@encoding=<ENCODINGS>;
close(ENCODINGS);

open(ENCHEADER, '>', "mime_encodings.h");
foreach (@encoding)
{
	chomp($_);
	@element = split(/\t+/,$_);
	next if $element[0] =~ /#/ ;
	next if $element[1] =~ /#/ ;
	next if length($element[0]) == 0 || length($element[1]) == 0 ;
	print ENCHEADER '{ "', $element[0], '", 0, "', $element[1], '", 0 },', "\n";
}
close(ENCHEADER);


open(TYPES, '<', "mime_types.txt");
@type=<TYPES>;
close(TYPES);

open(TYPEHEADER, '>', "mime_types.h");
foreach (@type)
{
	chomp($_);
	@element = split(/\t+/,$_);
	next if $element[0] =~ /#/ ;
	next if $element[1] =~ /#/ ;
	next if length($element[0]) == 0 || length($element[1]) == 0 ;
	print TYPEHEADER '{ "', $element[0], '", 0, "', $element[1], '", 0 },', "\n";
}
close(TYPEHEADER);