2024-07-11 04:31:36 +00:00
|
|
|
#include "../../include/all.h"
|
2024-08-03 19:23:32 +00:00
|
|
|
#include "../common.h"
|
2024-07-11 04:31:36 +00:00
|
|
|
|
|
|
|
#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
|
|
|
|
2024-08-03 19:23:32 +00:00
|
|
|
if (!lm_ctx_init(&ctx, NULL, NULL, DATA_DIR)) {
|
2024-07-11 04:31:36 +00:00
|
|
|
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;
|
|
|
|
}
|