Advertisement
RemigiuszP

Klient

Nov 17th, 2019
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.62 KB | None | 0 0
  1. #include<stdio.h>
  2. #include<signal.h>
  3. #include<unistd.h>
  4. #include<signal.h>
  5. #include<sys/types.h>
  6. #include<sys/wait.h>
  7. #include<stdio.h>
  8. #include<pwd.h>
  9.  
  10. int main()
  11. {
  12.     int pid, S = 1;
  13.     printf("%s", "Podaj pid serwera: ");
  14.     scanf("%d", &pid);
  15.    
  16.     while(S)
  17.     {
  18.         printf("Wybierz typ akcji:\n0 - zakoncz\n1 - SIGUSR1\n2 - SIGUSR2\n");
  19.         printf("Twoj wybor: ");
  20.         scanf("%d", &S);
  21.        
  22.         switch(S)
  23.         {
  24.             case 0:
  25.                 return 0;
  26.             break;
  27.             case 1:
  28.                 kill(pid, SIGUSR1);
  29.             break;
  30.             case 2:
  31.                 kill(pid, SIGUSR2);
  32.             break;
  33.             default: printf("Niepoprawna opcja!\n");
  34.            
  35.            
  36.            
  37.         }
  38.     }
  39.  
  40.  
  41.     return 0;
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement