add a feature
This commit is contained in:
parent
0dc73354c9
commit
2b8da849ab
|
@ -19,6 +19,7 @@ struct settings {
|
||||||
int b:1; /* ascii bel when done */
|
int b:1; /* ascii bel when done */
|
||||||
int f:1; /* display hours */
|
int f:1; /* display hours */
|
||||||
int t:1; /* tomato timer */
|
int t:1; /* tomato timer */
|
||||||
|
int p:1; /* stop after tomato timer cycle finished */
|
||||||
int s; /* seconds */
|
int s; /* seconds */
|
||||||
} s = {
|
} s = {
|
||||||
.e = 0,
|
.e = 0,
|
||||||
|
@ -27,6 +28,7 @@ struct settings {
|
||||||
.b = 0,
|
.b = 0,
|
||||||
.f = 0,
|
.f = 0,
|
||||||
.t = 0,
|
.t = 0,
|
||||||
|
.p = 0,
|
||||||
.s = 0
|
.s = 0
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -76,6 +78,8 @@ int tomatotimer(struct timer *t) {
|
||||||
if(t->d % 2) t->s = s.s / 2;
|
if(t->d % 2) t->s = s.s / 2;
|
||||||
else t->s = s.s;
|
else t->s = s.s;
|
||||||
t->d++;
|
t->d++;
|
||||||
|
if(s.b) putchar('\a');
|
||||||
|
if(s.p) return 0;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -142,7 +146,7 @@ void timerloop() {
|
||||||
|
|
||||||
int main(int argc, char **argv) {
|
int main(int argc, char **argv) {
|
||||||
char c;
|
char c;
|
||||||
while((c = getopt(argc, argv, "evdbfth:m:s:")) != -1) {
|
while((c = getopt(argc, argv, "evdbftph:m:s:")) != -1) {
|
||||||
switch(c) {
|
switch(c) {
|
||||||
break; case 'e': s.e = 1;
|
break; case 'e': s.e = 1;
|
||||||
break; case 'v': s.v = 1;
|
break; case 'v': s.v = 1;
|
||||||
|
@ -150,6 +154,7 @@ int main(int argc, char **argv) {
|
||||||
break; case 'b': s.b = 1;
|
break; case 'b': s.b = 1;
|
||||||
break; case 'f': s.f = 1;
|
break; case 'f': s.f = 1;
|
||||||
break; case 't': s.t = 1;
|
break; case 't': s.t = 1;
|
||||||
|
break; case 'p': s.p = 1;
|
||||||
break; case 'h': s.s = s.s + (atoi(optarg) * 3600);
|
break; case 'h': s.s = s.s + (atoi(optarg) * 3600);
|
||||||
break; case 'm': s.s = s.s + (atoi(optarg) * 60);
|
break; case 'm': s.s = s.s + (atoi(optarg) * 60);
|
||||||
break; case 's': s.s = s.s + atoi(optarg);
|
break; case 's': s.s = s.s + atoi(optarg);
|
||||||
|
|
|
@ -23,6 +23,9 @@ timer display contains hour slot
|
||||||
.B -t
|
.B -t
|
||||||
use a tomato timer (use -h, -m, -s to set work cycle time, rest cycle time is assumed to be half of the working time)
|
use a tomato timer (use -h, -m, -s to set work cycle time, rest cycle time is assumed to be half of the working time)
|
||||||
.TP
|
.TP
|
||||||
|
.B -p
|
||||||
|
disable pausing after finishing tomato timer cycle (required -t to work)
|
||||||
|
.TP
|
||||||
.B "-h int"
|
.B "-h int"
|
||||||
specify number of hours for timer parameters
|
specify number of hours for timer parameters
|
||||||
.TP
|
.TP
|
||||||
|
@ -75,7 +78,7 @@ $ timer -etm 40
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
.fi
|
.fi
|
||||||
.SH BUGS
|
.SH BUGS
|
||||||
|
- when passing -p each tomato timer cycle is cut short one second
|
||||||
send email to random user at-sign tilde dot club
|
send email to random user at-sign tilde dot club
|
||||||
.SH AUTHOR
|
.SH AUTHOR
|
||||||
randomuser
|
randomuser
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue