/***************************************************************************** Name: flag_value_maximum( table, flag ) Purpose: Returns the value of the flags entered. Multi-flags accepted. if a bit doesn't exist, we don't return NO_FLAG, we continue Called by: olc.c and olc_act.c. ****************************************************************************/ long flag_value_maximum( struct flag_type *flag_table, const char *argument) { char word[MAX_INPUT_LENGTH]; long bit; long marked = 0; bool found = FALSE; FLAG_VALUE_ERROR = FALSE; if ( flag_table == NULL ) { bug("flag_value_maximum called with a NULL flag_table"); return NO_FLAG; } if ( fBootDb ) return flag_value_maximum_init( flag_table, argument ); if ( is_stat( flag_table ) ) return flag_lookup2(argument,flag_table); for (; ;) { argument = one_argument( argument, word ); if ( word[0] == '\0' ) return found?marked:NO_FLAG; if ( ( bit = flag_lookup2( word, flag_table ) ) != NO_FLAG ) { SET_BIT( marked, bit ); found = TRUE; } else FLAG_VALUE_ERROR = TRUE; } return marked; }
long flag_value_maximum_init( struct flag_type *flag_table, const char *argument) { char word[MAX_INPUT_LENGTH]; long bit; long marked = 0; bool found = FALSE; FLAG_VALUE_ERROR = FALSE; // Added by SinaC 2001 if ( strstr( argument, "none" ) ) return 0; if ( is_stat_init( flag_table ) ) return flag_lookup2(argument,flag_table); for (; ;) { argument = one_argument( argument, word ); if ( word[0] == '\0' ) return found?marked:NO_FLAG; if ( ( bit = flag_lookup2( word, flag_table ) ) != NO_FLAG ) { SET_BIT( marked, bit ); found = TRUE; } else FLAG_VALUE_ERROR = TRUE; } return marked; }
/***************************************************************************** Name: flag_value( table, flag ) Purpose: Returns the value of the flags entered. Multi-flags accepted. Called by: olc.c and olc_act.c. ****************************************************************************/ int flag_value(const struct flag_type *flag_table, char *argument) { char word[MAX_INPUT_LENGTH]; int bit; int marked = 0; bool found = FALSE; if (is_stat(flag_table)) { one_argument(argument, word); if ((bit = flag_lookup2(word, flag_table)) != NO_FLAG) return bit; else return NO_FLAG; } /* * Accept multiple flags. */ for (;;) { argument = one_argument(argument, word); if (word[0] == '\0') break; if ((bit = flag_lookup2(word, flag_table)) != NO_FLAG) { SET_BIT(marked, bit); found = TRUE; } } if (found) return marked; else return NO_FLAG; }