29 lines
598 B
C
29 lines
598 B
C
#include "../../include/all.h"
|
|
#include "../common.h"
|
|
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
|
|
int main(int argc, char *argv[]) {
|
|
lm_ctx_t ctx;
|
|
lm_entry_t entry;
|
|
int ret = EXIT_FAILURE;
|
|
|
|
lm_entry_init(&entry);
|
|
|
|
if (!lm_ctx_new(&ctx, NULL, NULL, 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;
|
|
}
|