add "default settings" feature

This commit is contained in:
randomuser 2021-06-20 10:46:53 -05:00
parent 1ce81cb3e7
commit 34d673bf72
2 changed files with 11 additions and 1 deletions

View File

@ -92,6 +92,12 @@ char *timerdisp(struct timer *t) {
return str; return str;
} }
void defaultSettings(struct settings s) {
s.e = 1;
s.b = 1;
s.f = 1;
}
void timerloop() { void timerloop() {
struct timer *t = timerinit(); struct timer *t = timerinit();
if(s.d) { if(s.d) {
@ -146,7 +152,7 @@ void timerloop() {
int main(int argc, char **argv) { int main(int argc, char **argv) {
char c; char c;
while((c = getopt(argc, argv, "evdbftph:m:s:")) != -1) { while((c = getopt(argc, argv, "evdbftpzh: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;
@ -155,6 +161,7 @@ int main(int argc, char **argv) {
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 'p': s.p = 1;
break; case 'z': s.e = 1; s.b = 1; s.f = 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);

View File

@ -26,6 +26,9 @@ use a tomato timer (use -h, -m, -s to set work cycle time, rest cycle time is as
.B -p .B -p
disable pausing after finishing tomato timer cycle (required -t to work) disable pausing after finishing tomato timer cycle (required -t to work)
.TP .TP
.B -z
enable build-specific runtime settings (default -ebf)
.TP
.B "-h int" .B "-h int"
specify number of hours for timer parameters specify number of hours for timer parameters
.TP .TP