* [9fans] inconsistent comparison?
@ 2014-11-16 4:36 arisawa
0 siblings, 0 replies; only message in thread
From: arisawa @ 2014-11-16 4:36 UTC (permalink / raw)
To: Fans of the OS Plan 9 from Bell Labs
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?
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2014-11-16 4:36 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-11-16 4:36 [9fans] inconsistent comparison? arisawa
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).