Database loading

The following set of functions provides an interface for loading the virus database:
	const char *cl_retdbdir(void);

	int cl_load(const char *path, struct cl_engine *engine,
		    unsigned int *signo, unsigned int options);
cl_retdbdir() returns the default (hardcoded) path to the directory with ClamAV databases. cl_load() loads a single database file or all databases from a given directory (when path points to a directory). The second argument is used for passing in the pointer to the engine that should be previously allocated with cl_engine_new(). A number of loaded signatures will be added to signo 10. The last argument can pass the following flags: cl_load() returns CL_SUCCESS on success and another code on failure.
	    ...
	    struct cl_engine *engine;
	    unsigned int sigs = 0;
	    int ret;

	if((ret = cl_init()) != CL_SUCCESS) {
	    printf("cl_init() error: %s\n", cl_strerror(ret));
	    return 1;
	}

	if(!(engine = cl_engine_new())) {
	    printf("Can't create new engine\n");
	    return 1;
	}

	ret = cl_load(cl_retdbdir(), engine, &sigs, CL_DB_STDOPT);



Tomasz Kojm 2010-05-19