#include "../../include/all.h" #include "./common.h" #include #include #include int main(int argc, char *argv[]) { lm_ctx_t ctx; lm_entry_t entry; int ret = EXIT_FAILURE; lm_entry_init(&entry); lm_ctx_init(&ctx); if (!lm_ctx_set_data(&ctx, DATA_DIR)) { printf("failed to set data dir: %s (%d)\n", lm_strerror(), lm_error()); goto end; } printf("listing installed packages:\n"); while (lm_ctx_database_next(&ctx, &entry)) printf("%s (%s)\n", entry.name, entry.version); end: lm_ctx_database_next_free(&ctx, &entry); return ret; }