+static void killrunning(char *pidfile)
+{
+ FILE *pidfd;
+ int pid;
+
+ if((pidfd = fopen(pidfile, "r")) == NULL) {
+ fprintf(stderr, "mctab -k: could not read PID file %s: %s\n", pidfile, strerror(errno));
+ exit(1);
+ }
+ fscanf(pidfd, "%i", &pid);
+ if(kill(pid, SIGTERM)) {
+ fprintf(stderr, "mctab -k: could not kill %i: %s\n", pid, strerror(errno));
+ exit(1);
+ }
+ fclose(pidfd);
+}
+