Beispiel #1
0
int main(int argc, char * const argv[])
{
	int run_daemon = 1;
	int c;

#ifdef CW_DEBUGGING
	const struct rlimit rlim = {
		.rlim_cur = RLIM_INFINITY,
		.rlim_max = RLIM_INFINITY
	};

	/* unlimited size for cores */
	setrlimit(RLIMIT_CORE, &rlim);
#endif

	printf("AC, v%s, %s, %s\n", PACKAGE_VERSION, __DATE__, __TIME__);

	while (-1 != (c = getopt(argc, argv, "hfc:s:"))) {
		switch(c) {
		case 'h':
			usage();
			exit(1);
			break;

		case 'f':
			run_daemon = 0;
			break;

		case 'c':
			gCWConfigFileName = optarg;
			break;

		case 's':
			gCWSettingsFileName = optarg;
			break;

		default:
			usage();
			exit(1);
			break;
		}
	}

	/* Daemon Mode */
	if (run_daemon)
		if (daemon(1, 0) != 0) {
			fprintf(stderr, "daemon failed: %s\n", strerror(errno));
			exit(1);

		}

	CWACInit();
	CWCreateConnectionWithHostapdAC();
	CWACEnterMainLoop();
	CWACDestroy();

	return 0;
}
Beispiel #2
0
/*  *******************___FUNCTIONS___*******************  */
int main (int argc, const char * argv[]) {

	/* Daemon mode */
	
	if (argc <= 1)
		printf("Usage: AC working_path\n");

	if (daemon(1, 0) < 0)
		exit(1);

	if (chdir(argv[1]) != 0)
		exit(1);
	

	CWACInit();
	CWACEnterMainLoop();
	CWACDestroy();  
	
	return 0;
}