예제 #1
0
static void parse_options(int argc, char** const argv)
{
	long c;

	add_defaults();

	while ((c = getopt_long(argc, argv, "hvU:", options, NULL))
	       != EOF) {
		switch (c) {
		case 'h':
			fputs(USAGE, stdout);
			exit(EXIT_SUCCESS);
		case 'v':
			printf("%s\n", "irw " VERSION);
			exit(EXIT_SUCCESS);
		case 'U':
			options_set_opt("lircd:plugindir", optarg);
			break;
		case '?':
			fprintf(stderr, "unrecognized option: -%c\n", optopt);
			fputs("Try `irsimsend -h' for more information.\n",
			      stderr);
			exit(EXIT_FAILURE);
		}
	}
	if (argc != optind + 2) {
		fputs(USAGE, stderr);
		exit(EXIT_FAILURE);
	}
}
예제 #2
0
int main(int argc, char* argv[])
{
	long c;
	struct ir_remote* remotes;
	char path[128];

	while ((c = getopt_long(argc, argv, "hvc:U:", options, NULL))
	       != EOF) {
		switch (c) {
		case 'h':
			fputs(USAGE, stdout);
			return EXIT_SUCCESS;
		case 'v':
			printf("%s\n", "irw " VERSION);
			return EXIT_SUCCESS;
		case 'U':
			options_set_opt("lircd:pluginpath", optarg);
			break;
		case '?':
			fprintf(stderr, "unrecognized option: -%c\n", optopt);
			fputs("Try `irsimsend -h' for more information.\n",
			      stderr);
			return EXIT_FAILURE;
		}
	}
	if (argc != optind + 2) {
		fputs(USAGE, stderr);
		return EXIT_FAILURE;
	}
	lirc_log_get_clientlog("irsimreceive", path, sizeof(path));
	lirc_log_set_file(path);
	lirc_log_open("irsimreceive", 1, LIRC_ERROR);
	setup(argv[optind + 1]);
	remotes = read_lircd_conf(argv[optind]);
	return simreceive(remotes);
}