diff options
author | Alexei Starovoitov <ast@fb.com> | 2021-10-27 14:46:36 -0700 |
---|---|---|
committer | Daniel Borkmann <daniel@iogearbox.net> | 2021-10-27 23:54:19 +0200 |
commit | 9db252bc1716ebaf0abd3a47a59ea78e4e6253d6 (patch) | |
tree | 084777578df64175dfe78d69207f6d91509fb045 | |
parent | c98664189f440a7c86dcfc526b3bbf168be0d7c0 (diff) | |
download | l2md-9db252bc1716ebaf0abd3a47a59ea78e4e6253d6.tar.gz |
Few tweaks to make the code compile on MacOS. As a prerequisite to get
it running, `brew install libgit2` is needed.
Signed-off-by: Alexei Starovoitov <ast@fb.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
-rw-r--r-- | README | 1 | ||||
-rw-r--r-- | config.c | 10 | ||||
-rw-r--r-- | l2md.h | 2 | ||||
-rw-r--r-- | maildir.c | 2 | ||||
-rw-r--r-- | repo.c | 2 | ||||
-rw-r--r-- | utils.c | 4 |
6 files changed, 12 insertions, 9 deletions
@@ -27,6 +27,7 @@ Links to -lgit2 which is shipped by pretty much all major distros. Fedora: libgit2-devel Ubuntu: libgit2-dev +MacOS: brew install libgit2 To build, just type: @@ -71,7 +71,7 @@ static void config_set_basedir(struct config *cfg, const char *dir) wordexp(dir, &p, 0); dir = p.we_wordv[0]; - strlcpy(cfg->general.base, dir, sizeof(cfg->general.base)); + __strlcpy(cfg->general.base, dir, sizeof(cfg->general.base)); wordfree(&p); } @@ -105,7 +105,7 @@ static void config_set_out(struct config *cfg, const char *ctx, bool root) wordexp(ctx, &p, 0); ctx = p.we_wordv[0]; - strlcpy(out, ctx, sizeof(repo->out)); + __strlcpy(out, ctx, sizeof(repo->out)); wordfree(&p); } @@ -135,7 +135,7 @@ static void config_new_url(struct config *cfg, const char *git_url) repo->urls_num); url = url_last(repo); memset(url, 0, sizeof(*url)); - strlcpy(url->path, git_url, sizeof(url->path)); + __strlcpy(url->path, git_url, sizeof(url->path)); } static void config_new_repo(struct config *cfg, const char *name) @@ -149,7 +149,7 @@ static void config_new_repo(struct config *cfg, const char *name) memset(repo, 0, sizeof(*repo)); config_set_out(cfg, cfg->general.out, false); config_set_repo_status(cfg, true); - strlcpy(repo->name, name, sizeof(repo->name)); + __strlcpy(repo->name, name, sizeof(repo->name)); } static void config_set_defaults(struct config *cfg, const char *homedir) @@ -174,7 +174,7 @@ static void config_set_defaults(struct config *cfg, const char *homedir) } verbose("Using base dir %s\n", default_data_dir); - strlcpy(cfg->general.base, data_dir, sizeof(cfg->general.base)); + __strlcpy(cfg->general.base, data_dir, sizeof(cfg->general.base)); config_set_ops(cfg, &ops_maildir); cfg->ops->set_defaults(cfg); @@ -145,7 +145,7 @@ int xwrite_file(const char *file, const char *to, size_t len, bool fatal); int timeval_sub(struct timeval *res, struct timeval *x, struct timeval *y); -size_t strlcpy(char *dest, const char *src, size_t size); +size_t __strlcpy(char *dest, const char *src, size_t size); int slprintf(char *dst, size_t size, const char *fmt, ...); void verbose(const char *format, ...) __check_format_printf(1, 2); @@ -38,7 +38,7 @@ static void maildir_set_defaults(struct config *cfg) char path[PATH_MAX]; slprintf(path, sizeof(path), "%s/maildir", cfg->general.base); - strlcpy(cfg->general.out, path, sizeof(cfg->general.out)); + __strlcpy(cfg->general.out, path, sizeof(cfg->general.out)); } const struct mail_ops ops_maildir = { @@ -274,7 +274,7 @@ skip: git_oid_tostr(oid_curr, sizeof(oid_curr), &loid); printf("Processed %u new mail(s) for %s. %s: %s -> %s in %ld.%02lds.\n", count, repo->name, repo->urls[url].path, oid_last ? oid_curr : - "[none]", oid_done, res.tv_sec, res.tv_usec); + "[none]", oid_done, res.tv_sec, (long)res.tv_usec); } git_revwalk_free(walker); @@ -94,6 +94,8 @@ void xmkdir2(const char *base, const char *name) xmkdir1(path); } +typedef off_t loff_t; + int xread_file(const char *file, char *to, size_t len, bool fatal) { loff_t ret; @@ -208,7 +210,7 @@ int timeval_sub(struct timeval *res, struct timeval *x, return x->tv_sec < y->tv_sec; } -size_t strlcpy(char *dest, const char *src, size_t size) +size_t __strlcpy(char *dest, const char *src, size_t size) { size_t ret = strlen(src); |