40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
+
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
|
set retval [expr {$retval % $mod}]
return $retval
}
# Read contents of mime types file
catch {
set fd [open $mimeinfofile]
set mimeinfo [read $fd]
close $fd
set fd [open $mimeinfofile]
set mimeinfo [read $fd]
close $fd
}
if {![info exists mimeinfo]} {
puts stderr "Not using $mimeinfofile, unreadable."
exit 1
}
puts stderr "Using $mimeinfofile as mime.types"
# Parse into type and extensions pairs
foreach line [split $mimeinfo "\n"] {
regsub {#.*} $line {} line
set line [string trim $line]
if {$line == ""} {
|