This repository has been archived on 2026-07-28. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
cmc/3sem/cnts/contest14/t1.c
T
2025-04-13 21:48:15 +03:00

35 lines
466 B
C
Executable File

#include <stdio.h>
#include <unistd.h>
#include <signal.h>
#include <stdlib.h>
volatile int count = 0;
void
func(int sign)
{
if (count < 5) {
printf("%d\n", count);
fflush(stdout);
count++;
} else {
exit(0);
}
}
int
main(int argc, char *argv[])
{
printf("%d\n", getpid());
fflush(stdout);
if (signal(SIGHUP, func) == SIG_ERR) {
exit(1);
}
for (;;) {
pause();
}
return 0;
}