Parsee/tools/noavatars.c

35 lines
781 B
C

/* noavatars.c - Clean up the avatar cache
* ============================================================
* Under CC0, as its a rather useful example of a Parsee tool.
* See LICENSE for more information about Parsee's licensing. */
#include "common.h"
int
Main(Array *args, HashMap *env)
{
char *db_path, *exec;
Db *parsee;
exec = ArrayGet(args, 0);
if (ArraySize(args) < 2)
{
Log(LOG_ERR, "Usage: %s [config]", exec);
return EXIT_FAILURE;
}
db_path = ArrayGet(args, 1);
parsee = GetDB(db_path);
if (parsee)
{
DbDelete(parsee, 1, "avatars");
DbClose(parsee);
return EXIT_SUCCESS;
}
Log(LOG_ERR, "%s: couldn't open DB '%s'", exec, db_path);
(void) env;
return EXIT_FAILURE;
}