aboutsummaryrefslogtreecommitdiff
path: root/src/msg.c
diff options
context:
space:
mode:
authorRaghuram Subramani <raghus2247@gmail.com>2025-08-02 13:07:41 +0530
committerRaghuram Subramani <raghus2247@gmail.com>2025-08-02 13:07:41 +0530
commit246a95dbd8f79033124a1c8aba8af6ee03a6af8e (patch)
tree16d98d35f19812375f4400015388bd21196c3341 /src/msg.c
parent0f5bde0d9bf98d973012038f8a77183a6e758b21 (diff)
msg: run every 500ms instead of watching for changes
Diffstat (limited to 'src/msg.c')
-rw-r--r--src/msg.c24
1 files changed, 14 insertions, 10 deletions
diff --git a/src/msg.c b/src/msg.c
index 81e6bc0..d59b807 100644
--- a/src/msg.c
+++ b/src/msg.c
@@ -122,13 +122,15 @@ handle_file(const char *path)
}
int
-run(void)
+run(bool log)
{
- time_t rawtime;
- struct tm *timeinfo;
- time(&rawtime);
- timeinfo = localtime(&rawtime);
- printf("Generation started at: %s", asctime(timeinfo));
+ if (log) {
+ time_t rawtime;
+ struct tm *timeinfo;
+ time(&rawtime);
+ timeinfo = localtime(&rawtime);
+ printf("Generation started at: %s", asctime(timeinfo));
+ }
struct stat sb;
if (stat(msg->base_directory, &sb) != 0 || !S_ISDIR(sb.st_mode)) {
@@ -188,10 +190,12 @@ run(void)
for (size_t i = 0; i < resources->size; i++) {
ptr_wrapper_t *value = list_get(resources, i);
char *path = value->ptr;
- if (i < LOG_THRESHOLD || msg->verbose)
- printf("\tProcessing %s\n", path);
- else if (i == LOG_THRESHOLD && !msg->verbose)
- printf("\t...\n");
+ if (log) {
+ if (i < LOG_THRESHOLD || msg->verbose)
+ printf("\tProcessing %s\n", path);
+ else if (i == LOG_THRESHOLD && !msg->verbose)
+ printf("\t...\n");
+ }
handle_file(path);
}