Hello,
/sys/lib/mimetype is referenced in three files:
/sys/src/cmd/ip/httpd/content.c # for outgoing file
/sys/src/cmd/upas/marshal/marshal.c # for outgoing file
/usr/arisawa/src/upas/vf/vf.c # for incoming file
the codes are as follows.
/sys/src/cmd/ip/httpd/content.c
/sys/src/cmd/ip/httpd/content.c
while((p = strrchr(buf, '.')) != nil){
for(s = suffixes; s; s = s->next){
if(strcmp(p, s->suffix) == 0){
if(s->generic != nil && type == nil)
type = hmkcontent(hc, s->generic,
s->specific, nil);
if(s->encoding != nil && enc == nil)
enc = hmkcontent(hc, s->encoding, nil,
nil);
}
}
*p = 0;
}
/sys/src/cmd/upas/marshal/marshal.c
/* try the mime types file */
if(p != nil){
if(mimetypes == nil)
readmimetypes();
for(c = mimetypes; c != nil && c->ext != nil; c++)
if(strcmp(p, c->ext) == 0){
a->type = c->type;
a->ctype = c;
return a;
}
}
/sys/src/cmd/upas/vf/vf.c
for(m = mtypes; m != nil; m = m->next)
if(cistrcmp(p, m->ext) == 0){
switch(m->class){
case 'm':
case 'y':
return 0;
case 'p':
*p = 0;
rv = badfile(name);
*p = '.';
return rv;
case 'r':
return 2;
}
}
these codes are in 9front but probably same as both official plan9 and 9atom.
note that vf.c uses cistrcmp() but others use strcmp().
this these are intensional?