int main(int argc, char **argv)
{
	char *cfgfile;
	
	if (sock_start())
		return -1;
	vlist_init(&pipes, pipe_destroy);
	cfg_init(&cfg, 0);
	atexit(cleanup);

	/* Look for the config file in the executable directory.  Windows
	 * uses it as the working directory, so we can use a relative
	 * filename.  On UNIX or the Mac, use the executable path and
	 * filename from argv[0].
	 */
#ifdef __WIN32__
	cfgfile = defcfgfile;
#else
	cfgfile = malloc(strlen(argv[0]) + 4 + 1);
	strcpy(cfgfile, argv[0]);
	strcat(cfgfile, ".cfg");
#endif
	/* Prefer a config file specified on the command line */
	readcfg(argc > 1 ? argv[argc - 1] : cfgfile);
#ifdef DEBUG
	debug();
#endif
	waitclients();
	
	return 0;
}
示例#2
0
文件: main.c 项目: darknrgy/6WD-Robot
int main(int argc, char **argv)
{
	if (sock_start())
		return -1;
	vlist_init(&pipes, pipe_destroy);
	cfg_init(&cfg, 0);
	atexit(cleanup);
	readcfg();
#ifdef DEBUG
	debug();
#endif
	waitclients();
	
	return 0;
}
示例#3
0
文件: service.c 项目: asac/procd
static struct service *
service_alloc(const char *name)
{
	struct service *s;
	char *new_name;

	s = calloc_a(sizeof(*s), &new_name, strlen(name) + 1);
	strcpy(new_name, name);

	vlist_init(&s->instances, avl_strcmp, service_instance_update);
	s->instances.keep_old = true;
	s->name = new_name;
	s->avl.key = s->name;
	INIT_LIST_HEAD(&s->validators);

	return s;
}
示例#4
0
static void __init
iprule_init_list(void)
{
	vlist_init(&iprules, rule_cmp, iprule_update_rule);
}