Ejemplo n.º 1
0
int main (int argc, char **argv)
{
	struct gengetopt_args_info opts;
	struct vfi_source *s;
	struct vfi_dev *dev;

	vfi_open(&dev,NULL,opts.timeout_arg);

	cmdline_parser_init(&opts);

	cmdline_parser(argc,argv,&opts);

	if (opts.file_given) {
		vfi_setup_file(dev,&s,fopen(opts.file_arg,"r"));
		process_commands(dev,s,&opts);
	}

	if (opts.inputs_num) {
		setup_inputs(dev,&s,&opts);
		process_commands(dev,s,&opts);
	}

	if (opts.interactive_given) {
		vfi_setup_file(dev,&s,stdin);
		process_commands(dev,s,&opts);
	}

	vfi_close(dev);

	return 0;
}
Ejemplo n.º 2
0
int main(int argc, char *argv[])
{
	struct gengetopt_args_info args_info;
	cmdline_parser_init(&args_info);
	if (cmdline_parser(argc, argv, &args_info) != 0)
		exit(1);

	if (args_info.arg_given)
	{
		printf("arg given: %s\n", args_info.arg_arg);
	}

	if (args_info.grp1c_given)
	{
		printf("Value of group switch: %d\n", args_info.grp1c_arg);
	}
	else
	{
		printf("Value of group switch (not set): %d\n", args_info.grp1c_arg);
	}

	return 0;
}