Some stuff

This commit is contained in:
Јован Ђокић-Шумарац 2021-09-27 21:34:47 +02:00
parent 03b49dd075
commit f96bf2bafa

View file

@ -1,7 +1,6 @@
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <string.h>
#include "config.h"
#if STUDY_SESSION_25
@ -23,16 +22,19 @@
#define TIMER_B 10
#endif
#define STUDY 0
#define BREAK 1
char help_msg[] = "\n-s integer\t\tsets length of studying session, in minutes\n"
"-b integer\t\tsets length of breaks, in minutes\n"
"-r integer\t\tnumber of sessions\n"
"-h \t\tprints help message lol \n\n";
int n_repeat = 0, time_elapsed = 0, timer_s = TIMER_S, timer_b = TIMER_B, check = 0;
int n_repeat = 4, time_elapsed = 0, timer_s = TIMER_S, timer_b = TIMER_B, check = 0;
long time_started = 0;
void get_stuff(void);
void start_timer(int);
void countdown(long, short, char*);
@ -50,19 +52,28 @@ int main(int argc, char *argv[]){
if( *(argv[i]+1) == 'b' )
timer_b = atoi(argv[i+1]);
if( *(argv[i]+1) == 'r' )
n_repeat = atoi(argv[i+1]);
if( *(argv[i]+1) == 'h'){
printf("%s", help_msg);
exit(0);
}
}
}
get_stuff();
system("clear");
for(int i = 1; i <= n_repeat; i++){
printf("Session %d\n\n", i);
printf("Session %d of %d\n\n", i, n_repeat);
start_timer(STUDY);
system("notify-send 'POMODORO' 'IT IS TIME FOR A BREAK' ");
start_timer(BREAK);
printf("%c[3F%c[2K%c[G", 27, 27, 27);
@ -76,16 +87,6 @@ int main(int argc, char *argv[]){
void get_stuff(void){
printf("Enter number of pomodoro sessions (%d minute periods with %d minute breaks) : ", timer_s, timer_b);
if ( !(scanf("%d", &n_repeat)) ){
printf("\n\nThat's not a number you globussaire\n\n");
fprintf(stderr, 0);
}
}
void start_timer(int x){