--- 4.karina.18_test.coder.fmt.c 2020-06-08 11:39:11.758115926 +0300
+++ 4.egor.18_test.coder.fmt.c 2020-06-08 11:39:11.727115591 +0300
@@ -1,29 +1,29 @@
#1 "<stdin>"
-#include <stdio.h>
#include <string.h>
-#include <signal.h>
+#include <errno.h>
#include <sys/types.h>
#include <unistd.h>
+#include <stdio.h>
+#include <signal.h>
#include <stdlib.h>
-#include <errno.h>
int main(int argc, char *argv[]) {
- int signal = 0;
+ int sygnal = 0;
while (1) {
- char c0 = argv[2][signal];
- char c1 = argv[2][signal];
- int PID = (atoi(argv[1]));
- for (int i = 7; i >= 0; i--) {
- int a = (c0 >> (i)) & 0x1;
- if (a == 1)
- kill(PID, SIGUSR2);
+ char zero = argv[2][sygnal];
+ char one = argv[2][sygnal];
+ int pid = (atoi(argv[1]));
+ for (int k = 7; k >= 0; k--) {
+ int x = (zero >> (k)) & 0x1;
+ if (x == 1)
+ kill(pid, SIGUSR2);
else
- kill(PID, SIGUSR1);
+ kill(pid, SIGUSR1);
usleep(10000);
- c0 = c0 << 1;
+ zero = zero << 1;
}
- if (c1 == 0)
+ if (one == 0)
break;
- signal++;
+ sygnal++;
}
return 0;
}