X-Git-Url: https://gitweb.ps.run/ps-cgit/blobdiff_plain/537c05f138d59c1eb3ac8e2d8b0dca3a38aa5dd4..eac1b675414722ae90df75abc727b2795bc096f0:/ui-repolist.c diff --git a/ui-repolist.c b/ui-repolist.c index 25f076f..0a0b6ca 100644 --- a/ui-repolist.c +++ b/ui-repolist.c @@ -18,18 +18,20 @@ time_t read_agefile(char *path) { - FILE *f; - static char buf[64], buf2[64]; + time_t result; + size_t size; + char *buf; + static char buf2[64]; - if (!(f = fopen(path, "r"))) + if (readfile(path, &buf, &size)) return -1; - if (fgets(buf, sizeof(buf), f) == NULL) - return -1; - fclose(f); + if (parse_date(buf, buf2, sizeof(buf2))) - return strtoul(buf2, NULL, 10); + result = strtoul(buf2, NULL, 10); else - return 0; + result = 0; + free(buf); + return result; } static int get_repo_modtime(const struct cgit_repo *repo, time_t *mtime) @@ -92,7 +94,7 @@ int is_in_url(struct cgit_repo *repo) void print_sort_header(const char *title, const char *sort) { - htmlf("