Esempio n. 1
0
int foo(void) {
	make_config(50);
	cat("test.ini");
	physics_cfg_file f=physics_cfg_file_read("test.ini");
	print(f);
	for (int len=1;len<=10000;len*=10) {
		make_config(len);
		printf("%d line ",len);
		print_time("config",parseconfig);
	}
	return 0;
}
Esempio n. 2
0
void create_account()
{
	make_config();
	gtk_widget_destroy(first_window);
	gtk_main_quit();
	get_user_info(data);
	gnusocialdesktop();
}
Esempio n. 3
0
int main(int argc, char **argv) {
  parse_cli_args(argc, argv);
  if(!config_file) make_config();
  
  mtev_memory_init();
  mtev_main(APPNAME, config_file, debug, foreground,
            MTEV_LOCK_OP_LOCK, NULL, droptouser, droptogroup,
            child_main);
  return 0;
}
Esempio n. 4
0
int logger_init(Logger *logger, 
                 int mode, 
                 const char *log_conf_path, 
                 const char *log_file_dir)
{
    int rc;
    zlog_category_t *zc;

    logger->log_i = my_zlog_info;
    logger->log_d = my_zlog_debug;
    logger->log_e = my_zlog_error;

    int ret = make_config(log_conf_path, log_file_dir);
    if (ret < 0) {
        goto ERROR;
    }

    rc = zlog_init(log_conf_path);
	if (rc) {
        fprintf(stderr, "logger_init: zlog_init error\n");
        goto ERROR;
	}

    if (mode == LOG_STDOUT) {
        zc = zlog_get_category("stdout");
    } else if (mode == LOG_FILE) {
        zc = zlog_get_category("file");
    }

    if (!zc) {
        fprintf(stderr, "logger_init: zlog_get_category error\n");
        goto ERROR;
    }

    logger->zc = zc;
    logger->log_mode = mode;
    logger->log_on = 1;

    s_init_zlog_success = 1;

    return 0;

ERROR:
    logger_destroy(logger);

    return -1;
}
Esempio n. 5
0
static void receive_rcom_status(struct dlm_ls *ls, struct dlm_rcom *rc_in)
{
    struct dlm_rcom *rc;
    struct dlm_mhandle *mh;
    int error, nodeid = rc_in->rc_header.h_nodeid;

    error = create_rcom(ls, nodeid, DLM_RCOM_STATUS_REPLY,
                        sizeof(struct rcom_config), &rc, &mh);
    if (error)
        return;
    rc->rc_id = rc_in->rc_id;
    rc->rc_seq_reply = rc_in->rc_seq;
    rc->rc_result = dlm_recover_status(ls);
    make_config(ls, (struct rcom_config *) rc->rc_buf);

    send_rcom(ls, mh, rc);
}
Esempio n. 6
0
int create_script(jobtype ptype, pkgstate* state, pkg_exec* item, pkgdata* data) {
	stringptr* temp, *config, tb;
	stringptr* set_cc = SPL("if [ -z \"$CC\" ] ; then\n\tCC=cc\nfi\n");
	
	char* prefix;
	char buf[256];
	int hastarball;
	if(ptype == JT_DOWNLOAD) {
		prefix = "dl";
	} else if (ptype == JT_BUILD) {
		prefix = "build";
	} else
		abort();
	
	item->scripts.filename = stringptr_format("%s/%s_%s.sh", state->cfg.builddir.ptr, prefix, item->name->ptr);
	item->scripts.stdoutfn = stringptr_format("%s/%s_%s.log", state->cfg.logdir.ptr, prefix, item->name->ptr); 
	
	config = make_config(&state->cfg);
	hastarball = get_tarball_filename(data, buf, sizeof(buf));
	
	if(ptype == JT_DOWNLOAD) {
		if(!hastarball) abort(); //bug
		temp = stringptr_concat(SPL("#!/bin/sh\n"),
			config,
			SPL("wget -O $C/"),
			stringptr_fromchar(buf, &tb),
			SPL(" "),
			stringptrlist_get(data->mirrors, rand() % stringptrlist_getsize(data->mirrors)),
			//SPL(" --no-check-certificate"),
			NULL);
		
	} else if (ptype == JT_BUILD) {
		stringptr* buildscr = stringptrlist_tostring(data->buildscript);
		
		if(!hastarball) {
			temp = stringptr_concat(SPL("#!/bin/sh\n"), 
				config,
				set_cc,
				buildscr,
				NULL);
		} else {
			if(data->tardir->size && data->tardir->ptr[0] == '/') 
				// prevent erroneus scripts from trash our fs
				abort();
			
			temp = stringptr_concat(SPL("#!/bin/sh\n"), 
				config,
				set_cc,
				SPL("cd $S/build\n"), 
				SPL("[ -e "),
				data->tardir,
				SPL(" ] && rm -rf "),
				data->tardir,
				SPL("\ntar xf $C/"), 
				stringptr_fromchar(buf, &tb),
				SPL(" || (echo tarball error; exit 1)\ncd $S/build/"),
				data->tardir,
				SPL("\n"),
				buildscr,
				NULL);
		}
		
		stringptr_free(buildscr);
		
	} else abort();

	stringptr_tofile(item->scripts.filename->ptr, temp);
	if(chmod(item->scripts.filename->ptr, 0777) == -1) die(SPL("error setting permission"));
	stringptr_free(config);
	stringptr_free(temp);
	return 1;
}