Better keyword (timer->timers)
- sizeof(a)[0]->sizeof(a[0]) thanks to ekleog - Add more work to TODO
This commit is contained in:
parent
8c0cb46576
commit
bf41fc8e6c
9
TODO
9
TODO
|
@ -1,8 +1,9 @@
|
||||||
major
|
1. Show remaining time to the next timer (using SIGUSR1)
|
||||||
-----
|
2. Add #ifdef to make libnotify an optional dependency
|
||||||
- Add options to start and stop spt with only one process
|
3. Add more support for non-libnotify such as echo(1)
|
||||||
|
4. Pause and continue the timer
|
||||||
|
|
||||||
misc
|
Misc
|
||||||
----
|
----
|
||||||
$ grep -n 'TODO' spt.c
|
$ grep -n 'TODO' spt.c
|
||||||
|
|
||||||
|
|
22
config.def.h
22
config.def.h
|
@ -8,15 +8,15 @@ static char *notifyext = ""; /* Notify with extra command (eg. play an alarm) */
|
||||||
* This is the array which defines all the timer that will be used.
|
* This is the array which defines all the timer that will be used.
|
||||||
* It will be repeated after all of it is executed.
|
* It will be repeated after all of it is executed.
|
||||||
*/
|
*/
|
||||||
static Timer timer[] = {
|
static Timers timers[] = {
|
||||||
/* timer comment */
|
/* timer(s) comment */
|
||||||
{ 1500, "Time to start working!"},
|
{ 1500, "Time to start working!"},
|
||||||
{ 300, "Time to start resting!"},
|
{ 300, "Time to start resting!"},
|
||||||
{ 1500, "Time to start working!"},
|
{ 1500, "Time to start working!"},
|
||||||
{ 300, "Time to start resting!"},
|
{ 300, "Time to start resting!"},
|
||||||
{ 1500, "Time to start working!"},
|
{ 1500, "Time to start working!"},
|
||||||
{ 300, "Time to start resting!"},
|
{ 300, "Time to start resting!"},
|
||||||
{ 1500, "Time to start working!"},
|
{ 1500, "Time to start working!"},
|
||||||
{ 300, "Time to start resting!"},
|
{ 300, "Time to start resting!"},
|
||||||
{ 900, "Time to take some nap!"},
|
{ 900, "Time to take some nap!"},
|
||||||
};
|
};
|
||||||
|
|
10
spt.c
10
spt.c
|
@ -12,12 +12,12 @@
|
||||||
char *argv0;
|
char *argv0;
|
||||||
|
|
||||||
/* macros */
|
/* macros */
|
||||||
#define LEN(a) (sizeof(a) / sizeof(a)[0])
|
#define LEN(a) (sizeof(a) / sizeof(a[0]))
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
unsigned int tmr;
|
unsigned int tmr;
|
||||||
char *cmt;
|
char *cmt;
|
||||||
} Timer;
|
} Timers;
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
|
@ -102,9 +102,9 @@ main(int argc, char *argv[])
|
||||||
} ARGEND;
|
} ARGEND;
|
||||||
|
|
||||||
run:
|
run:
|
||||||
notify_send(timer[i].cmt);
|
notify_send(timers[i].cmt);
|
||||||
sleep(timer[i].tmr);
|
sleep(timers[i].tmr);
|
||||||
i + 1 >= LEN(timer) ? i = 0 : i++; /* i infinal loop */
|
i + 1 >= LEN(timers) ? i = 0 : i++; /* i infinal loop */
|
||||||
goto run;
|
goto run;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user