#include <signal.h>
#include <sys/errno.h>
#include <stdio.h>
#include <sys/types.h>
#include <unistd.h>
#include <stdlib.h>

int a=1;
int b=0;

void sini(){
	b=1;
	a=a+1;
	printf("Zwiększam a o 1\n");
}
void ststp(){
	b=1;
	a=1;
	printf("Przywracam wartosc domyslna a=1\n");
}

int main(){

	while (1) {
		if(signal(SIGINT,sini)==SIG_ERR){
			printf("problem z sygnalem\n");
		}
		if(signal(SIGQUIT,SIG_DFL)==SIG_ERR){
			printf("problem z sygnalem\n");
		}
		if(signal(SIGTSTP,ststp)==SIG_ERR){
			printf("problem z sygnalem\n");
		}
		while (1){
			if (b==1){
				printf("%d\n",a);
				b=0;
			}

		}
			

	}
	return 1;
}
