Ejemplo n.º 1
0
void
parse_args( int argc, char** argv )
{
	int i;

	for( i = 1; i < argc; i++ )
		if(      !strcmp(argv[i], "-h") || !strcmp(argv[i], "--help") )
		{
			printf("%s", usage);
			exit(0);
		}
		else if( !file )
		{
			file = argv[i];
		}
		else if( !policy )
		{
			policy = parse_policy_lang(argv[i]);
		}
		else
			die(usage);
	
	if( !policy )
		policy = parse_policy_lang(suck_stdin());
}
Ejemplo n.º 2
0
void
parse_args( int argc, char** argv )
{
	int i;

	for( i = 1; i < argc; i++ )
		if(      !strcmp(argv[i], "-h") || !strcmp(argv[i], "--help") )
		{
			printf("%s", usage);
			exit(0);
		}
		else if( !strcmp(argv[i], "-v") || !strcmp(argv[i], "--version") )
		{
			printf(CPABE_VERSION, "-enc");
			exit(0);
		}
		else if( !strcmp(argv[i], "-k") || !strcmp(argv[i], "--keep-input-file") )
		{
			keep = 1;
		}
		else if( !strcmp(argv[i], "-o") || !strcmp(argv[i], "--output") )
		{
			if( ++i >= argc )
				die(usage);
			else
				out_file = argv[i];
		}
		else if( !strcmp(argv[i], "-d") || !strcmp(argv[i], "--deterministic") )
		{
			pbc_random_set_deterministic(0);
		}
		else if( !pub_file )
		{
			pub_file = argv[i];
		}
		else if( !in_file )
		{
			in_file = argv[i];
		}
		else if( !policy )
		{
			policy = parse_policy_lang(argv[i]);
		}
		else
			die(usage);

	if( !pub_file || !in_file )
		die(usage);

	if( !out_file )
		out_file = g_strdup_printf("%s.cpabe", in_file);

	if( !policy )
		policy = parse_policy_lang(suck_stdin());
}
Ejemplo n.º 3
0
void
parse_args( int argc, char** argv )
{
    int i;

    for( i = 1; i < argc; i++ )
        if(      !strcmp(argv[i], "-h") || !strcmp(argv[i], "--help") )
        {
            printf("%s", usage);
            exit(0);
        }
        else if( !strcmp(argv[i], "-v") || !strcmp(argv[i], "--version") )
        {
            printf(KPABE_VERSION, "-keygen");
            exit(0);
        }
        else if( !strcmp(argv[i], "-o") || !strcmp(argv[i], "--output") )
        {
            if( ++i >= argc )
                die(usage);
            else
                out_file = argv[i];
        }
        else if( !strcmp(argv[i], "-d") || !strcmp(argv[i], "--deterministic") )
        {
            pbc_random_set_deterministic(0);
        }
        else if( !pub_file )
        {
            pub_file = argv[i];
        }
        else if( !msk_file )
        {
            msk_file = argv[i];
        }
        else if( !policy )
        {
            policy = parse_policy_lang(argv[i]);
        }
        else
            die(usage);

    if( !pub_file || !msk_file )
        die(usage);

    if( !policy )
        policy = parse_policy_lang(suck_stdin());
}