int main(int argc, char *argv[]) {
	if(argc != 4) {
		show_usage(argc, argv);
		return -1;
	}
	
	lpc2xml_context *ctx = lpc2xml_context_new(cb_function, NULL);
	LpConfig *lpc = lp_config_new(argv[2]);
	lpc2xml_set_lpc(ctx, lpc);
	if(strcmp("convert", argv[1]) == 0) {
		lpc2xml_convert_file(ctx, argv[3]);
	} else {
		show_usage(argc, argv);
	}
	lp_config_destroy(lpc);
	lpc2xml_context_destroy(ctx);
	return 0;
}
Example #2
0
int main(int argc, char *argv[]) {
	lpc2xml_context *ctx;
	LpConfig *lpc;
	if(argc > 4 || argc < 3) {
		show_usage(argc, argv);
		return -1;
	}

	lpc = lp_config_new(argv[2]);
	if(strcmp("convert", argv[1]) == 0 && argc == 4) {
		ctx = lpc2xml_context_new(cb_function, NULL);
		lpc2xml_convert_file(ctx, argv[3]);
		lpc2xml_set_lpc(ctx, lpc);
		lpc2xml_context_destroy(ctx);
	} else if (strcmp("dump", argv[1]) == 0 && argc == 3) {
		char *dump = lp_config_dump_as_xml(lpc);
		fprintf(stdout, "%s", dump);
	} else {
		show_usage(argc, argv);
	}
	lp_config_destroy(lpc);
	return 0;
}