💾 Archived View for thrig.me › blog › 2024 › 11 › 30 › pa.c captured on 2024-12-17 at 12:07:45.
-=-=-=-=-=-=-
// pa - yes(1) but with logging of signals #include <signal.h> #include <stdio.h> #include <stdlib.h> #include <unistd.h> void ouch(int signo) { fprintf(stderr, "pa (%d) pid=%d pgrp=%d\n", signo, getpid(), tcgetpgrp(STDERR_FILENO)); exit(1); } int main(void) { signal(SIGINT, ouch); signal(SIGPIPE, ouch); while (1) puts("y"); }