Ejemplo n.º 1
0
static int show_profile(m_option_t *opt, char* name, char *param)
{
    m_config_t *config = opt->priv;
    m_profile_t *p;
    int i, j;
    if (!param)
        return M_OPT_MISSING_PARAM;
    if (!(p = m_config_get_profile(config, param))) {
        mp_msg(MSGT_CFGPARSER, MSGL_ERR, MSGTR_UnknownProfile, param);
        return M_OPT_EXIT - 1;
    }
    if (!config->profile_depth)
        mp_msg(MSGT_CFGPARSER, MSGL_INFO, MSGTR_Profile, param,
               p->desc ? p->desc : "");
    config->profile_depth++;
    for (i = 0; i < p->num_opts; i++) {
        char spc[config->profile_depth + 1];
        for (j = 0; j < config->profile_depth; j++)
            spc[j] = ' ';
        spc[config->profile_depth] = '\0';

        mp_msg(MSGT_CFGPARSER, MSGL_INFO, "%s%s=%s\n", spc,
               p->opts[2 * i], p->opts[2 * i + 1]);

        if (config->profile_depth < MAX_PROFILE_DEPTH &&
            !strcmp(p->opts[2*i],"profile")) {
            char *e, *list = p->opts[2 * i + 1];
            while ((e = strchr(list, ','))) {
                int l = e-list;
                char tmp[l+1];
                if (!l)
                    continue;
                memcpy(tmp, list, l);
                tmp[l] = '\0';
                show_profile(opt, name, tmp);
                list = e+1;
            }
            if (list[0] != '\0')
                show_profile(opt, name, list);
        }
    }
    config->profile_depth--;
    if (!config->profile_depth)
        mp_msg(MSGT_CFGPARSER, MSGL_INFO, "\n");
    return M_OPT_EXIT - 1;
}
Ejemplo n.º 2
0
/* main test function */
void testOS(){
	
	loadRCconfig();
	show_profile();
	if(config.operation==OVERWRITE) 		testOverwrite1();
	else if(config.operation==APPEND) 		testAppend();
	else if(config.operation==READ) 		testRead();
	else									printf("No such operation test.");
	//sqlite3OsCurrentTime(&BeginTime);
	
    /*
     * Write a file with nPages, then overwrite it, finally delete it
     * Then rewrite it with nPages+1, loop in this way 
     */

 	

}