diff options
author | Ariadna Vigo <arivigodr@gmail.com> | 2020-12-11 02:01:13 +0100 |
---|---|---|
committer | Ariadna Vigo <arivigodr@gmail.com> | 2020-12-11 02:01:13 +0100 |
commit | 1b984138943954c653ce62c1ab1061a8fa7de94a (patch) | |
tree | 6d8b3185612ac53a205ad44dcb6cb5c37eef959c | |
parent | 23e7d86accde787066fdc0551f4f8156eefb94c2 (diff) |
Added a new lap indicator
-rw-r--r-- | config.def.h | 12 | ||||
-rw-r--r-- | minitimer.c | 7 |
2 files changed, 13 insertions, 6 deletions
diff --git a/config.def.h b/config.def.h index e36700e..aac98dc 100644 --- a/config.def.h +++ b/config.def.h @@ -14,10 +14,16 @@ static const char fifobase[] = "/tmp/minitimer."; static const char outputfmt[] = "%02d:%02d:%02d"; /* - * status_ind: This character is printed before the timer when running (also - * when running in the background when showing a lap). + * run_ind: This character is printed before the timer when running (also + * when running in the background when showing a lap). */ -static const char status_ind = '*'; +static const char run_ind = '*'; + +/* + * lap_ind: This character is printed before the timer to show that the time + * currently shown is a lap. + */ +static const char lap_ind = '+'; /* * time_incr_secs: Increment the timer by how many seconds when pressing '+'. diff --git a/minitimer.c b/minitimer.c index 8627f76..b53b19e 100644 --- a/minitimer.c +++ b/minitimer.c @@ -39,7 +39,7 @@ static void time_inc(struct time *the_time, int secs); static int parse_time(char *time_str, struct time *the_time); static struct termios ui_setup(struct termios *old); -static void ui_update(const struct time *the_time, int status); +static void ui_update(const struct time *the_time, int run_status); static int poll_event(int fifofd); static void @@ -160,7 +160,7 @@ ui_setup(struct termios *old) } static void -ui_update(const struct time *the_time, int status) +ui_update(const struct time *the_time, int run_status) { static struct time output; @@ -168,7 +168,8 @@ ui_update(const struct time *the_time, int status) output = *the_time; printf("\r"); - putchar((status > 0) ? status_ind : ' '); + putchar((run_status > 0) ? run_ind : ' '); + putchar((the_time == NULL) ? lap_ind : ' '); printf(outputfmt, output.hrs, output.mins, output.secs); fflush(stdout); |