checkcontent.c 771 B

123456789101112131415161718192021222324252627282930313233
  1. #include <u.h>
  2. #include <libc.h>
  3. #include <bin.h>
  4. #include <httpd.h>
  5. int
  6. hcheckcontent(HContent *me, HContent *oks, char *list, int size)
  7. {
  8. HContent *ok;
  9. if(oks == nil || me == nil)
  10. return 1;
  11. for(ok = oks; ok != nil; ok = ok->next){
  12. if((cistrcmp(ok->generic, me->generic) == 0 || strcmp(ok->generic, "*") == 0)
  13. && (me->specific == nil || cistrcmp(ok->specific, me->specific) == 0 || strcmp(ok->specific, "*") == 0)){
  14. if(ok->mxb > 0 && size > ok->mxb)
  15. return 0;
  16. return 1;
  17. }
  18. }
  19. USED(list);
  20. if(0){
  21. fprint(2, "list: %s/%s not found\n", me->generic, me->specific);
  22. for(; oks != nil; oks = oks->next){
  23. if(oks->specific)
  24. fprint(2, "\t%s/%s\n", oks->generic, oks->specific);
  25. else
  26. fprint(2, "\t%s\n", oks->generic);
  27. }
  28. }
  29. return 0;
  30. }