Example #1
0
void SearchPkcs11::loadItem(QListWidgetItem *lib)
{
	emit addLib(lib->text());
	delete lib;
}
Example #2
0
int execute(int argc, char *argv[])
{
	FILE	*dbFile;
	int	i;
	char	*c, *d;

	/* open output driver DB file */
	if (argc < 2 || argc > 3)
	{
		fprintf(stderr, "usage: make_driver_db <db_directory> [output_filename]\n");
		return -1;
	}
	if (argc == 3)
	{
		dbFile = fopen(argv[2], "w");
		if (dbFile == NULL)
		{
			fprintf(stderr, "unable to open DB file for writing\n");
			return -1;
		}
	}
	else
		dbFile = stdout;

	/* init parsing */
	c = argv[1];
	do
	{
		d = strchr(c, ':');
		if (d != NULL)
			*d = 0;
		if (strncmp(c, "module:", 7) == 0)
		{
			addLib(c+7);
		}
		else
		{
			for (i=0; i<nhandlers; i++)
			{
				(*(handlers[i]->init))(c);
			}
		}
		if (d != NULL)
			c = d+1;
	} while (d && *c);


	/* do actual parsing */
	fprintf(stdout, "%d\n", nfiles);
	fflush(stdout);
	for (i=0; i<nfiles; i++)
	{
		int	hi;
		for (hi=0; hi<nhandlers; hi++)
			if (strncmp(files[i], handlers[hi]->name, handlers[hi]->namelen) == 0)
			{
				handlers[hi]->parse(files[i]+handlers[hi]->namelen, dbFile);
				break;
			}
		fprintf(stdout, "%d\n", i);
		fflush(stdout);
	}

	/* free everything */
	freeFiles();
	freeHandlers();
	freeLibs();
	if (dbFile != stdout)
		fclose(dbFile);

	return 0;
}