int main(int argc, char const *argv[]) { glyr_init(); atexit(glyr_cleanup); if(argc > 1) { GlyrDatabase *db = glyr_db_init(argv[1]); if(db != NULL) { if(argv[2] != NULL && strcmp(argv[2], "delete") == 0) { do_delete = true; } glyr_db_foreach(db, foreach_callback, db); } else { g_message("Could not open DB at %s", argv[1]); } } else { g_message("Usage: %s /path/to/db/directory [delete]", argv[0]); } return EXIT_SUCCESS; }
static int count_db_items (GlyrDatabase * db) { int c = 0; glyr_db_foreach (db,counter_callback,&c); return c; }