checkcontent.c 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. /*
  2. * This file is part of the UCB release of Plan 9. It is subject to the license
  3. * terms in the LICENSE file found in the top-level directory of this
  4. * distribution and at http://akaros.cs.berkeley.edu/files/Plan9License. No
  5. * part of the UCB release of Plan 9, including this file, may be copied,
  6. * modified, propagated, or distributed except according to the terms contained
  7. * in the LICENSE file.
  8. */
  9. #include <u.h>
  10. #include <libc.h>
  11. #include <bin.h>
  12. #include <httpd.h>
  13. int
  14. hcheckcontent(HContent *me, HContent *oks, char *list, int size)
  15. {
  16. HContent *ok;
  17. if(oks == nil || me == nil)
  18. return 1;
  19. for(ok = oks; ok != nil; ok = ok->next){
  20. if((cistrcmp(ok->generic, me->generic) == 0 || strcmp(ok->generic, "*") == 0)
  21. && (me->specific == nil || cistrcmp(ok->specific, me->specific) == 0 || strcmp(ok->specific, "*") == 0)){
  22. if(ok->mxb > 0 && size > ok->mxb)
  23. return 0;
  24. return 1;
  25. }
  26. }
  27. USED(list);
  28. if(0){
  29. fprint(2, "list: %s/%s not found\n", me->generic, me->specific);
  30. for(; oks != nil; oks = oks->next){
  31. if(oks->specific)
  32. fprint(2, "\t%s/%s\n", oks->generic, oks->specific);
  33. else
  34. fprint(2, "\t%s\n", oks->generic);
  35. }
  36. }
  37. return 0;
  38. }