#include #include #include static char hardcopy[] = "screendump | lpr -v"; hardcp_() { int status, pid, w, (*istat)(), (*qstat)(); char *getenv(); if ((pid = vfork()) == 0) { execl("/bin/sh", "sh", "-c", getenv("HARDCOPY") ? getenv("HARDCOPY") : hardcopy, 0); _exit(127); } istat = signal(SIGINT, SIG_IGN); qstat = signal(SIGQUIT, SIG_IGN); while ((w = wait((union wait *)&status)) != pid && w != -1) ; signal(SIGINT, istat); signal(SIGQUIT, qstat); if (w == -1 || status != 0) fprintf(stderr, " Hard copy error status: %d\n", status); }