From 1a289f60003b4301538b02e17ecc39b92982fea5 Mon Sep 17 00:00:00 2001 From: Joseph Hunkeler Date: Wed, 6 May 2026 09:29:48 -0400 Subject: Fix duplicate records in output --- CMakeLists.txt | 2 +- main.c | 12 ++---------- system.c | 3 +-- weekly.h | 1 + 4 files changed, 5 insertions(+), 13 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c81ef79..01e3dc4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.0) +cmake_minimum_required(VERSION 3.16) project(weekly C) if(MSVC) diff --git a/main.c b/main.c index c3400ad..442594e 100644 --- a/main.c +++ b/main.c @@ -236,16 +236,8 @@ int main(int argc, char *argv[]) { exit(1); } if (do_all) { - struct dirent *dp; - DIR *dir; - dir = opendir(journalroot); - while ((dp = readdir(dir)) != NULL) { - if (!strcmp(dp->d_name, ".") || !strcmp(dp->d_name, "..")) - continue; - if (isdigit(*dp->d_name)) { - for (int w = week; w < WEEK_MAX; w++) - dump_week(journalroot, year, w, style); - } + for (int w = week; w < WEEK_MAX; w++) { + dump_week(journalroot, year, w, style); } } else { if (dump_week(journalroot, year, week, style) < 0) { diff --git a/system.c b/system.c index 0894f20..779ea76 100644 --- a/system.c +++ b/system.c @@ -170,5 +170,4 @@ char *make_output_path(char *basepath, char *path, int year, int week, int day_o sprintf(path + strlen(path), "%d", day_of_week); return path; -} - +} \ No newline at end of file diff --git a/weekly.h b/weekly.h index e834606..e2e876c 100644 --- a/weekly.h +++ b/weekly.h @@ -100,5 +100,6 @@ int dir_empty(const char *path); char *find_program(const char *name); int make_path(char *basepath); char *make_output_path(char *basepath, char *path, int year, int week, int day_of_week); +int isdigit_s(const char *s); #endif // WEEKLY_H \ No newline at end of file -- cgit