diff options
author | Ariadna Vigo <arivigodr@gmail.com> | 2020-07-04 03:57:23 +0200 |
---|---|---|
committer | Ariadna Vigo <arivigodr@gmail.com> | 2020-07-04 03:57:23 +0200 |
commit | b89dbe00ecc7a64e57a9293077edc7dbe734e2d7 (patch) | |
tree | d1f528f5e2c215307b78a957d978d626fa911a93 | |
parent | 09298c5c5dd328a2f1e5108938c9586be6a3485e (diff) |
Expiration now configurable by user
-rw-r--r-- | config.def.h | 6 | ||||
-rw-r--r-- | cras.c | 2 | ||||
-rw-r--r-- | tasklst.c | 4 | ||||
-rw-r--r-- | tasklst.h | 3 |
4 files changed, 10 insertions, 5 deletions
diff --git a/config.def.h b/config.def.h index 14c59a0..5f1677d 100644 --- a/config.def.h +++ b/config.def.h @@ -1,6 +1,12 @@ /* See LICENSE file for copyright and license details. */ /* + * crasfile_expiry: sets the amount of time after which a task file expires, in + * seconds. + */ +static const int64_t crasfile_expiry = 86400; /* 86400 secs = 24 hrs */ + +/* * task_todo_color, task_done_color: colors in which task_todo_str and * task_done_str, respectively, are to be printed in. Colors must be set using * ANSI escape codes. @@ -173,7 +173,7 @@ set_tasks_mode(const char *crasfile) tasklst_init(&tasks); read_user_input(&tasks, stdin); /* Only stdin for now */ - tasklst_set_expiration(&tasks); + tasklst_set_expiration(&tasks, crasfile_expiry); write_crasfile(crasfile, tasks); } @@ -37,9 +37,9 @@ tasklst_init(TaskLst *tasks) } void -tasklst_set_expiration(TaskLst *tasks) +tasklst_set_expiration(TaskLst *tasks, int64_t delta) { - tasks->expiry = time(NULL) + TASK_LST_EXPIRY; + tasks->expiry = time(NULL) + delta; } int @@ -2,7 +2,6 @@ #define TASK_LST_MAX_NUM 11 #define TASK_LST_DESC_MAX_SIZE 64 -#define TASK_LST_EXPIRY 86400 /* 86400 secs = 24 hrs */ enum { TASK_VOID, @@ -17,7 +16,7 @@ typedef struct { } TaskLst; void tasklst_init(TaskLst *tasks); -void tasklst_set_expiration(TaskLst *tasks); +void tasklst_set_expiration(TaskLst *tasks, int64_t delta); int tasklst_expired(TaskLst tasks); int tasklst_tasks_total(TaskLst tasks); int tasklst_tasks_todo(TaskLst tasks); |