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;
}
Example #2
0
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;
}