4.lika.18_test.coder 4.karina.18_test.coder

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