Esempio n. 1
0
File: init.c Progetto: naudhr/tup
int tup_init(void)
{
	if(find_tup_dir() != 0) {
		fprintf(stderr, "tup %s usage: tup [args]\n", tup_version());
		fprintf(stderr, "For information on Tupfiles and other commands, see the tup(1) man page.\n");
		fprintf(stderr, "No .tup directory found. Either create a Tupfile.ini file at the top of your project, or manually run 'tup init' there.\n");
		return -1;
	}
	if(tup_entry_init() < 0) {
		return -1;
	}
	if(server_pre_init() < 0) {
		return -1;
	}
	if(tup_drop_privs() < 0) {
		goto out_err;
	}
	if(open_tup_top() < 0) {
		goto out_err;
	}
	if(tup_lock_init() < 0) {
		goto out_err;
	}
	color_init();
	if(tup_db_open() != 0) {
		goto out_unlock;
	}
	return 0;

out_unlock:
	tup_lock_exit();
out_err:
	server_post_exit();
	return -1;
}
Esempio n. 2
0
File: init.c Progetto: Rendaw/tup
int tup_cleanup(void)
{
	tup_db_close();
	tup_option_exit();
	tup_lock_exit();
	if(close(tup_top_fd()) < 0)
		perror("close(tup_top_fd())");
	if(server_post_exit() < 0)
		return -1;
	return 0;
}