77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
|
set hash_id [filed_hash $extension $modulus]
lappend hashinfo($hash_id) $extension
}
# Emit a C fragment to take a pointer (p) to an extension determine the mime type
puts "\tswitch (filed_hash((const unsigned char *) p, $modulus)) \{"
foreach hash [lsort -integer -increasing [array names hashinfo]] {
puts "\t\tcase $hash:"
foreach extension $hashinfo($hash) {
puts "\t\t\tif (strcmp(p, \"$extension\") == 0) \{"
puts "\t\t\t\treturn(\"$extensioninfo($extension)\");"
puts "\t\t\t\}"
}
puts "\t\t\treturn(FILED_DEFAULT_TYPE);"
}
puts "\t\}"
# Declare victory
exit 0
|
>
|
|
|
|
|
|
|
|
|
|
|
>
|
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
|
set hash_id [filed_hash $extension $modulus]
lappend hashinfo($hash_id) $extension
}
# Emit a C fragment to take a pointer (p) to an extension determine the mime type
if {[llength [array names hashinfo]] > 0} {
puts "\tswitch (filed_hash((const unsigned char *) p, $modulus)) \{"
foreach hash [lsort -integer -increasing [array names hashinfo]] {
puts "\t\tcase $hash:"
foreach extension $hashinfo($hash) {
puts "\t\t\tif (strcmp(p, \"$extension\") == 0) \{"
puts "\t\t\t\treturn(\"$extensioninfo($extension)\");"
puts "\t\t\t\}"
}
puts "\t\t\treturn(FILED_DEFAULT_TYPE);"
}
puts "\t\}"
}
# Declare victory
exit 0
|