comparison src/core/ngx_conf_file.c @ 265:6468241715e6

nginx-0.0.2-2004-02-20-19:48:59 import
author Igor Sysoev <igor@sysoev.ru>
date Fri, 20 Feb 2004 16:48:59 +0000
parents 70e1c7d2b83d
children 87e73f067470
comparison
equal deleted inserted replaced
264:cd009bf7400d 265:6468241715e6
580 580
581 char *ngx_conf_set_flag_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) 581 char *ngx_conf_set_flag_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
582 { 582 {
583 char *p = conf; 583 char *p = conf;
584 584
585 int flag; 585 ngx_flag_t flag;
586 ngx_str_t *value; 586 ngx_str_t *value;
587 587
588 588
589 if (*(int *) (p + cmd->offset) != NGX_CONF_UNSET) { 589 if (*(ngx_flag_t *) (p + cmd->offset) != NGX_CONF_UNSET) {
590 return "is duplicate"; 590 return "is duplicate";
591 } 591 }
592 592
593 value = (ngx_str_t *) cf->args->elts; 593 value = (ngx_str_t *) cf->args->elts;
594 594
604 "it must be \"on\" or \"off\"", 604 "it must be \"on\" or \"off\"",
605 value[1].data, cmd->name.data); 605 value[1].data, cmd->name.data);
606 return NGX_CONF_ERROR; 606 return NGX_CONF_ERROR;
607 } 607 }
608 608
609 *(int *) (p + cmd->offset) = flag; 609 *(ngx_flag_t *) (p + cmd->offset) = flag;
610 610
611 return NGX_CONF_OK; 611 return NGX_CONF_OK;
612 } 612 }
613 613
614 614
634 634
635 char *ngx_conf_set_num_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) 635 char *ngx_conf_set_num_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
636 { 636 {
637 char *p = conf; 637 char *p = conf;
638 638
639 int *np; 639 ngx_int_t *np;
640 ngx_str_t *value; 640 ngx_str_t *value;
641 ngx_conf_post_t *post; 641 ngx_conf_post_t *post;
642 642
643 643
644 np = (int *) (p + cmd->offset); 644 np = (ngx_int_t *) (p + cmd->offset);
645 645
646 if (*np != NGX_CONF_UNSET) { 646 if (*np != NGX_CONF_UNSET) {
647 return "is duplicate"; 647 return "is duplicate";
648 } 648 }
649 649
664 664
665 char *ngx_conf_set_size_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) 665 char *ngx_conf_set_size_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
666 { 666 {
667 char *p = conf; 667 char *p = conf;
668 668
669 int *np; 669 ssize_t *sp;
670 ngx_str_t *value; 670 ngx_str_t *value;
671 ngx_conf_post_t *post; 671 ngx_conf_post_t *post;
672 672
673 673
674 np = (int *) (p + cmd->offset); 674 sp = (ssize_t *) (p + cmd->offset);
675 if (*np != NGX_CONF_UNSET) { 675 if (*sp != NGX_CONF_UNSET) {
676 return "is duplicate"; 676 return "is duplicate";
677 } 677 }
678 678
679 value = (ngx_str_t *) cf->args->elts; 679 value = (ngx_str_t *) cf->args->elts;
680 680
681 *np = ngx_parse_size(&value[1]); 681 *sp = ngx_parse_size(&value[1]);
682 if (*np == NGX_ERROR) { 682 if (*sp == NGX_ERROR) {
683 return "invalid value"; 683 return "invalid value";
684 } 684 }
685 685
686 if (cmd->post) { 686 if (cmd->post) {
687 post = cmd->post; 687 post = cmd->post;
688 return post->post_handler(cf, post, np); 688 return post->post_handler(cf, post, sp);
689 } 689 }
690 690
691 return NGX_CONF_OK; 691 return NGX_CONF_OK;
692 } 692 }
693 693
694 694
695 char *ngx_conf_set_msec_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) 695 char *ngx_conf_set_msec_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
696 { 696 {
697 char *p = conf; 697 char *p = conf;
698 698
699 int *np; 699 ngx_msec_t *msp;
700 ngx_str_t *value; 700 ngx_str_t *value;
701 ngx_conf_post_t *post; 701 ngx_conf_post_t *post;
702 702
703 703
704 np = (int *) (p + cmd->offset); 704 msp = (ngx_msec_t *) (p + cmd->offset);
705 if (*np != NGX_CONF_UNSET) { 705 if (*msp != (ngx_msec_t) NGX_CONF_UNSET) {
706 return "is duplicate"; 706 return "is duplicate";
707 } 707 }
708 708
709 value = (ngx_str_t *) cf->args->elts; 709 value = (ngx_str_t *) cf->args->elts;
710 710
711 *np = ngx_parse_time(&value[1], 0); 711 *msp = ngx_parse_time(&value[1], 0);
712 if (*np == NGX_ERROR) { 712 if (*msp == (ngx_msec_t) NGX_ERROR) {
713 return "invalid value"; 713 return "invalid value";
714 } 714 }
715 715
716 if (*np == NGX_PARSE_LARGE_TIME) { 716 if (*msp == (ngx_msec_t) NGX_PARSE_LARGE_TIME) {
717 return "value must be less than 597 hours"; 717 return "value must be less than 597 hours";
718 } 718 }
719 719
720 if (cmd->post) { 720 if (cmd->post) {
721 post = cmd->post; 721 post = cmd->post;
722 return post->post_handler(cf, post, np); 722 return post->post_handler(cf, post, msp);
723 } 723 }
724 724
725 return NGX_CONF_OK; 725 return NGX_CONF_OK;
726 } 726 }
727 727
728 728
729 char *ngx_conf_set_sec_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) 729 char *ngx_conf_set_sec_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
730 { 730 {
731 char *p = conf; 731 char *p = conf;
732 732
733 int *np; 733 time_t *sp;
734 ngx_str_t *value; 734 ngx_str_t *value;
735 ngx_conf_post_t *post; 735 ngx_conf_post_t *post;
736 736
737 737
738 np = (int *) (p + cmd->offset); 738 sp = (time_t *) (p + cmd->offset);
739 if (*np != NGX_CONF_UNSET) { 739 if (*sp != NGX_CONF_UNSET) {
740 return "is duplicate"; 740 return "is duplicate";
741 } 741 }
742 742
743 value = (ngx_str_t *) cf->args->elts; 743 value = (ngx_str_t *) cf->args->elts;
744 744
745 *np = ngx_parse_time(&value[1], 1); 745 *sp = ngx_parse_time(&value[1], 1);
746 if (*np == NGX_ERROR) { 746 if (*sp == NGX_ERROR) {
747 return "invalid value"; 747 return "invalid value";
748 } 748 }
749 749
750 if (*np == NGX_PARSE_LARGE_TIME) { 750 if (*sp == NGX_PARSE_LARGE_TIME) {
751 return "value must be less than 68 years"; 751 return "value must be less than 68 years";
752 } 752 }
753 753
754 if (cmd->post) { 754 if (cmd->post) {
755 post = cmd->post; 755 post = cmd->post;
756 return post->post_handler(cf, post, np); 756 return post->post_handler(cf, post, sp);
757 } 757 }
758 758
759 return NGX_CONF_OK; 759 return NGX_CONF_OK;
760 } 760 }
761 761
791 791
792 char *ngx_conf_set_bitmask_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) 792 char *ngx_conf_set_bitmask_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
793 { 793 {
794 char *p = conf; 794 char *p = conf;
795 795
796 int *np, i, m; 796 ngx_int_t *np, i, m;
797 ngx_str_t *value; 797 ngx_str_t *value;
798 ngx_conf_bitmask_t *mask; 798 ngx_conf_bitmask_t *mask;
799 799
800 800
801 np = (int *) (p + cmd->offset); 801 np = (ngx_int_t *) (p + cmd->offset);
802 value = (ngx_str_t *) cf->args->elts; 802 value = (ngx_str_t *) cf->args->elts;
803 mask = cmd->post; 803 mask = cmd->post;
804 804
805 for (i = 1; i < cf->args->nelts; i++) { 805 for (i = 1; i < cf->args->nelts; i++) {
806 for (m = 0; mask[m].name.len != 0; m++) { 806 for (m = 0; mask[m].name.len != 0; m++) {
841 841
842 842
843 char *ngx_conf_check_num_bounds(ngx_conf_t *cf, void *post, void *data) 843 char *ngx_conf_check_num_bounds(ngx_conf_t *cf, void *post, void *data)
844 { 844 {
845 ngx_conf_num_bounds_t *bounds = post; 845 ngx_conf_num_bounds_t *bounds = post;
846 int *np = data; 846 ngx_int_t *np = data;
847 847
848 if (bounds->high == -1) { 848 if (bounds->high == -1) {
849 if (*np >= bounds->low) { 849 if (*np >= bounds->low) {
850 return NGX_CONF_OK; 850 return NGX_CONF_OK;
851 } 851 }