int cw_dbg_set_level_from_str(const char *level)
{
	int blevel,on;
	const char *slevel;
	
	switch(*level){
		case '-':
		case '!':
			on =0;
			slevel=level+1;
			break;
		case '+':
			slevel=level+1;
			on=1;
			break;
		default:
			slevel=level;
			on=1;
	}

	blevel = cw_strlist_get_id(cw_dbg_strings, slevel);
	if (blevel==-1)
		return 0;
		
	cw_dbg_set_level(blevel,on);
	return 1;
}
Exemple #2
0
static void set_dbg_opt(struct uci_context *ctx,struct uci_section * section,int opt,const char * optstr)
{

    const char *str = uci_lookup_option_string(ctx,section,optstr);
    if (!str) {
        return;
    }

    if ((strcmp(str,"1")==0) || (strcmp(str,"true")==0))
        //conf_dbg_level |= opt;
        cw_dbg_set_level(opt,1);

    if ((strcmp(str,"0")==0) || (strcmp(str,"false")==0))
        cw_dbg_set_level(opt,0);


}