• Home
  • Raw
  • Download

Lines Matching refs:opt

376     option_t *opt;  local
385 opt = find_option(arg);
386 if (opt == NULL) {
391 n = n_arguments(opt);
396 if (!process_option(opt, arg, argv))
417 option_t *opt; local
453 opt = find_option(cmd);
454 if (opt == NULL) {
459 n = n_arguments(opt);
469 if (!process_option(opt, cmd, argv))
552 option_t *opt; local
561 opt = find_option(w->word);
562 if (opt == NULL) {
567 n = n_arguments(opt);
579 if (!process_option(opt, w0->word, argv))
593 match_option(name, opt, dowild) in match_option() argument
595 option_t *opt;
600 if (dowild != (opt->type == o_wild))
603 return strcmp(name, opt->name) == 0;
604 match = (int (*) __P((char *, char **, int))) opt->addr;
617 option_t *opt; local
622 for (opt = general_options; opt->name != NULL; ++opt)
623 if (match_option(name, opt, dowild))
624 return opt;
625 for (opt = auth_options; opt->name != NULL; ++opt)
626 if (match_option(name, opt, dowild))
627 return opt;
629 for (opt = list->options; opt->name != NULL; ++opt)
630 if (match_option(name, opt, dowild))
631 return opt;
632 for (opt = the_channel->options; opt->name != NULL; ++opt)
633 if (match_option(name, opt, dowild))
634 return opt;
636 if ((opt = protocols[i]->options) != NULL)
637 for (; opt->name != NULL; ++opt)
638 if (match_option(name, opt, dowild))
639 return opt;
648 process_option(opt, cmd, argv) in process_option() argument
649 option_t *opt; in process_option()
658 char *optopt = (opt->type == o_wild)? "": " option";
660 option_t *mainopt = opt;
662 current_option = opt->name;
663 if ((opt->flags & OPT_PRIVFIX) && privileged_option)
672 opt->name, optopt, mainopt->source);
679 opt->name, optopt, option_source);
682 if ((opt->flags & OPT_INITONLY) && phase != PHASE_INITIALIZE) {
684 opt->name, optopt);
687 if ((opt->flags & OPT_PRIV) && !privileged_option) {
689 opt->name, optopt);
692 if ((opt->flags & OPT_ENABLE) && *(bool *)(opt->addr2) == 0) {
693 option_error("%s%s is disabled", opt->name, optopt);
696 if ((opt->flags & OPT_DEVEQUIV) && devnam_fixed) {
698 opt->name, optopt, option_source);
702 switch (opt->type) {
704 v = opt->flags & OPT_VALUE;
705 *(bool *)(opt->addr) = v;
706 if (opt->addr2 && (opt->flags & OPT_A2COPY))
707 *(bool *)(opt->addr2) = v;
708 else if (opt->addr2 && (opt->flags & OPT_A2CLR))
709 *(bool *)(opt->addr2) = 0;
710 else if (opt->addr2 && (opt->flags & OPT_A2CLRB))
711 *(u_char *)(opt->addr2) &= ~v;
712 else if (opt->addr2 && (opt->flags & OPT_A2OR))
713 *(u_char *)(opt->addr2) |= v;
718 if ((opt->flags & OPT_NOARG) == 0) {
721 if ((((opt->flags & OPT_LLIMIT) && iv < opt->lower_limit)
722 || ((opt->flags & OPT_ULIMIT) && iv > opt->upper_limit))
723 && !((opt->flags & OPT_ZEROOK && iv == 0))) {
724 char *zok = (opt->flags & OPT_ZEROOK)? " zero or": "";
725 switch (opt->flags & OPT_LIMITS) {
728 opt->name, zok, opt->lower_limit);
732 opt->name, zok, opt->upper_limit);
736 opt->name, zok, opt->lower_limit, opt->upper_limit);
742 a = opt->flags & OPT_VALUE;
746 if (opt->flags & OPT_INC)
747 iv += *(int *)(opt->addr);
748 if ((opt->flags & OPT_NOINCR) && !privileged_option) {
749 int oldv = *(int *)(opt->addr);
750 if ((opt->flags & OPT_ZEROINF) ?
752 option_error("%s value cannot be increased", opt->name);
756 *(int *)(opt->addr) = iv;
757 if (opt->addr2 && (opt->flags & OPT_A2COPY))
758 *(int *)(opt->addr2) = iv;
762 if (opt->flags & OPT_NOARG) {
763 v = opt->flags & OPT_VALUE;
768 if (opt->flags & OPT_OR)
769 v |= *(u_int32_t *)(opt->addr);
770 *(u_int32_t *)(opt->addr) = v;
771 if (opt->addr2 && (opt->flags & OPT_A2COPY))
772 *(u_int32_t *)(opt->addr2) = v;
776 if (opt->flags & OPT_STATIC) {
777 strlcpy((char *)(opt->addr), *argv, opt->upper_limit);
779 char **optptr = (char **)(opt->addr);
791 parser = (int (*) __P((char **))) opt->addr;
792 curopt = opt;
795 if (opt->flags & OPT_A2LIST) {
803 if (opt->addr2 == NULL) {
804 opt->addr2 = ovp;
806 for (pp = opt->addr2; pp->next != NULL; pp = pp->next)
815 wildp = (int (*) __P((char *, char **, int))) opt->addr;
825 if (opt->addr2 && (opt->flags & (OPT_A2COPY|OPT_ENABLE
827 *(bool *)(opt->addr2) = !(opt->flags & OPT_A2CLR);
831 mainopt->winner = opt - mainopt;
847 option_t *opt; local
849 opt = find_option(option);
850 if (opt == NULL)
852 while (opt->flags & OPT_PRIOSUB)
853 --opt;
854 if ((opt->flags & OPT_PRIO) && priority < opt->priority)
856 opt->priority = priority;
857 opt->source = source;
858 opt->winner = -1;
866 n_arguments(opt) in n_arguments() argument
867 option_t *opt; in n_arguments()
869 return (opt->type == o_bool || opt->type == o_special_noarg
870 || (opt->flags & OPT_NOARG))? 0: 1;
877 add_options(opt) in add_options() argument
878 option_t *opt; in add_options()
885 list->options = opt;
904 print_option(opt, mainopt, printer, arg) in print_option() argument
905 option_t *opt, *mainopt; in print_option()
912 if (opt->flags & OPT_NOPRINT)
914 switch (opt->type) {
916 v = opt->flags & OPT_VALUE;
917 if (*(bool *)opt->addr != v)
921 printer(arg, "%s", opt->name);
924 v = opt->flags & OPT_VALUE;
927 i = *(int *)opt->addr;
928 if (opt->flags & OPT_NOARG) {
929 printer(arg, "%s", opt->name);
931 if (opt->flags & OPT_INC) {
933 printer(arg, " %s", opt->name);
939 printer(arg, "%s %d", opt->name, i);
943 printer(arg, "%s", opt->name);
944 if ((opt->flags & OPT_NOARG) == 0)
945 printer(arg, " %x", *(u_int32_t *)opt->addr);
949 if (opt->flags & OPT_HIDE) {
952 p = (char *) opt->addr;
953 if ((opt->flags & OPT_STATIC) == 0)
956 printer(arg, "%s %q", opt->name, p);
962 if (opt->type != o_wild) {
963 printer(arg, "%s", opt->name);
964 if (n_arguments(opt) == 0)
968 if (opt->flags & OPT_A2PRINTER) {
971 void *)))opt->addr2;
972 (*oprt)(opt, printer, arg);
973 } else if (opt->flags & OPT_A2STRVAL) {
974 p = (char *) opt->addr2;
975 if ((opt->flags & OPT_STATIC) == 0)
978 } else if (opt->flags & OPT_A2LIST) {
981 ovp = (struct option_value *) opt->addr2;
987 ovp->source, opt->name);
995 printer(arg, "# %s value (type %d\?\?)", opt->name, opt->type);
1006 print_option_list(opt, printer, arg) in print_option_list() argument
1007 option_t *opt; in print_option_list()
1011 while (opt->name != NULL) {
1012 if (opt->priority != OPRIO_DEFAULT
1013 && opt->winner != (short int) -1)
1014 print_option(opt + opt->winner, opt, printer, arg);
1016 ++opt;
1017 } while (opt->flags & OPT_PRIOSUB);
1705 user_setprint(opt, printer, arg) in user_setprint() argument
1706 option_t *opt; in user_setprint()
1721 (*printer)(arg, "\t\t# (from %s)\n%s ", uep->ue_source, opt->name);
1723 opt->source = uep->ue_source;
1777 user_unsetprint(opt, printer, arg) in user_unsetprint() argument
1778 option_t *opt; in user_unsetprint()
1793 (*printer)(arg, "\t\t# (from %s)\n%s ", uep->ue_source, opt->name);
1795 opt->source = uep->ue_source;