2021-12-31 15:47:35 +00:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
#include <signal.h>
|
|
|
|
#include <ctype.h>
|
|
|
|
|
|
|
|
int main(int argc, char*argv[])
|
|
|
|
{
|
|
|
|
int pid;
|
|
|
|
if (argc <= 1) {
|
2023-01-06 19:41:31 +00:00
|
|
|
printf("No PID given\n");
|
|
|
|
return(1);
|
2021-12-31 15:47:35 +00:00
|
|
|
} else if (argc > 2) {
|
2023-01-06 19:41:31 +00:00
|
|
|
printf("Too many arguments\n");
|
|
|
|
return(1);
|
2021-12-31 15:47:35 +00:00
|
|
|
} else {
|
2023-01-06 19:41:31 +00:00
|
|
|
long val;
|
|
|
|
char *next;
|
|
|
|
val = strtol(argv[1], &next, 10);
|
|
|
|
if ((next == argv[1]) || (*next != '\0')) {
|
|
|
|
printf("Argument '%s' is not a number\n", argv[1]);
|
|
|
|
return(1);
|
|
|
|
} else {
|
|
|
|
pid = val;
|
|
|
|
}
|
2021-12-31 15:47:35 +00:00
|
|
|
}
|
|
|
|
kill(pid, SIGUSR1);
|
|
|
|
return(0);
|
|
|
|
}
|
|
|
|
|