#include "../../include/all.h" #include "./common.h" #include #include #include int main(int argc, char *argv[]) { lm_ctx_t ctx; lm_pkg_t pkg; int ret = EXIT_FAILURE; 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, &pkg)) printf("%s (%s)\n", pkg.name, pkg.version); end: lm_ctx_database_next_free(&ctx, &pkg); return ret; }