3 * push.c -- push a fork into the background
7 * This code is Copyright (c) 2002, by the authors of nmh. See the
8 * COPYRIGHT file in the root directory of the nmh distribution for
9 * complete copyright information.
13 #include <h/signals.h>
23 for (i = 0; (pid = fork()) == -1 && i < 5; i++)
29 advise (NULL, "unable to fork, so can't push...");
33 /* child, block a few signals and continue */
34 SIGNAL (SIGHUP, SIG_IGN);
35 SIGNAL (SIGINT, SIG_IGN);
36 SIGNAL (SIGQUIT, SIG_IGN);
37 SIGNAL (SIGTERM, SIG_IGN);
39 SIGNAL (SIGTSTP, SIG_IGN);
40 SIGNAL (SIGTTIN, SIG_IGN);
41 SIGNAL (SIGTTOU, SIG_IGN);
43 freopen ("/dev/null", "r", stdin);
44 freopen ("/dev/null", "w", stdout);
48 /* parent, just exit */