2024-07-11 04:31:36 +00:00
|
|
|
#include "../../include/all.h"
|
|
|
|
#include "./common.h"
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
int main(int argc, char *argv[]) {
|
2024-07-31 18:16:19 +00:00
|
|
|
lm_ctx_t ctx;
|
|
|
|
lm_entry_t entry;
|
|
|
|
int ret = EXIT_FAILURE;
|
2024-07-11 04:31:36 +00:00
|
|
|
|
2024-07-31 18:16:19 +00:00
|
|
|
lm_entry_init(&entry);
|
2024-07-11 04:31:36 +00:00
|
|
|
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");
|
|
|
|
|
2024-07-31 18:16:19 +00:00
|
|
|
while (lm_ctx_database_next(&ctx, &entry))
|
|
|
|
printf("%s (%s)\n", entry.name, entry.version);
|
2024-07-11 04:31:36 +00:00
|
|
|
|
|
|
|
end:
|
2024-07-31 18:16:19 +00:00
|
|
|
lm_ctx_database_next_free(&ctx, &entry);
|
2024-07-11 04:31:36 +00:00
|
|
|
return ret;
|
|
|
|
}
|