Exemple #1
0
int main(int argc, char **argv)
{
	if(argc == 1) {
		readline_main();
	}else if(argc == 2) {
		file_main(argv);
	}else{
		printf("Error.\n");
	}

	return 0;
}
Exemple #2
0
/**
 * Main function ran initially
 */
int main(int argc, char** argv)
{
	// Check parameters number
	if(argc < 2)
	{
		dis_usage();
		exit(EXIT_FAILURE);
	}
	
	int param_idx = 0;
	int ret       = 0;
	
	dis_context_t dis_ctx;
	memset(&dis_ctx, 0, sizeof(dis_context_t));
	
	
	/* Get command line options */
	param_idx = dis_parse_args(&dis_ctx.cfg, argc, argv);
	
	/* Check that we have the file where to put NTFS data */
	if(param_idx >= argc || param_idx <= 0)
	{
		fprintf(stderr, "Error, no file given. Abort.\n");
		return EXIT_FAILURE;
	}
	
	/* Initialize dislocker */
	if(dis_initialize(&dis_ctx) == EXIT_FAILURE)
	{
		xprintf(L_CRITICAL, "Can't initialize dislocker. Abort.\n");
		return EXIT_FAILURE;
	}
	
	/*
	 * Create a NTFS file which could be mounted using `mount -o loop...`
	 */
	
	char* ntfs_file = argv[param_idx];
	xprintf(L_INFO, "Putting NTFS data into '%s'...\n", ntfs_file);
	
	/* Run the decryption */
	ret = file_main(ntfs_file, &dis_ctx);
	
	dis_destroy(&dis_ctx);
	
	return ret;
}