diff options
| author | Arslaan Pathan <[email protected]> | 2026-06-22 13:24:58 +1200 |
|---|---|---|
| committer | Arslaan Pathan <[email protected]> | 2026-06-22 13:24:58 +1200 |
| commit | cb430971bb21d7902817838a46d05deb8cc2f39e (patch) | |
| tree | 1d47fdd3015ec52a3fbf8677bd850ef56b850020 /src/libmbpk.c | |
| parent | e9dd7eec231edfd631cc19f164bba6506f96384b (diff) | |
| download | mbpk-cb430971bb21d7902817838a46d05deb8cc2f39e.tar.xz mbpk-cb430971bb21d7902817838a46d05deb8cc2f39e.zip | |
Finish mbpk_init and fix libmbpk.h
Diffstat (limited to 'src/libmbpk.c')
| -rw-r--r-- | src/libmbpk.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/src/libmbpk.c b/src/libmbpk.c index ee7fe75..dd93565 100644 --- a/src/libmbpk.c +++ b/src/libmbpk.c @@ -1,26 +1,32 @@ #include <stdio.h> #include <stdlib.h> +#include "libmbpk.h" #include <string.h> #include <errno.h> #include <sys/stat.h> +#define MBPK_DB_DIR "/var/lib/mbpk" +#define MBPK_REPO_DIR "/var/lib/mbpk-repo" +#define MBPK_REPO_CONFIG "/etc/mbpk-repos.ini" + typedef struct { const char* name; const char* desc; const char* url; } mbpk_repository; -#define MBPK_DB_DIR "/var/lib/mbpk" -#define MBPK_REPO_DIR "/var/lib/mbpk-repo" -#define MBPK_REPO_CONFIG "/etc/mbpk-repos.ini" +mbpk_repository **repos; int mbpk_init(void) { struct stat st; if (stat(MBPK_DB_DIR, &st) == -1) { if (mkdir(MBPK_DB_DIR, 0755) == -1) { - fprintf(stderr, "mbpk: failed to create %s: %s\n", MBPK_DB_DIR, strerror(errno)); + fprintf(stderr, "mbpk [err]: failed to create %s: %s\n", MBPK_DB_DIR, strerror(errno)); + return MBPK_DB_FAIL; } - return 1; } - return 0; + if (stat(MBPK_REPO_DIR, &st) == -1) { + fprintf(stderr, "mbpk [warn]: no repositories found! you might want to sync all repositories using mbpk-update.\n"); + } + return MBPK_OK; } |
