31 lines
569 B
C
31 lines
569 B
C
#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) {
|
|
printf("No PID given\n");
|
|
return(1);
|
|
} else if (argc > 2) {
|
|
printf("Too many arguments\n");
|
|
return(1);
|
|
} else {
|
|
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;
|
|
}
|
|
}
|
|
kill(pid, SIGUSR1);
|
|
return(0);
|
|
}
|
|
|