Exemplo n.º 1
0
Arquivo: mhtest.c Projeto: ella13/nmh
static int
write_content (CT *cts, char *outfile)
{
    CT ct, *ctp;

    for (ctp = cts; *ctp; ctp++) {
	ct = *ctp;
	output_message (ct, outfile);
    }

    flush_errors ();
    return OK;
}
Exemplo n.º 2
0
static void
show_single_message (CT ct, char *form)
{
    sigset_t set, oset;

    int status;

    /* Allow user executable bit so that temporary directories created by
     * the viewer (e.g., lynx) are going to be accessible */
    umask (ct->c_umask & ~(0100));

    /*
     * If you have a format file, then display
     * the message headers.
     */
    if (form)
	DisplayMsgHeader(ct, form);
    else
	xpid = 0;

    /* Show the body of the message */
    show_switch (ct, 1, 0);

    if (ct->c_fp) {
	fclose (ct->c_fp);
	ct->c_fp = NULL;
    }
    if (ct->c_ceclosefnx)
	(*ct->c_ceclosefnx) (ct);

    /* block a few signals */
    sigemptyset (&set);
    sigaddset (&set, SIGHUP);
    sigaddset (&set, SIGINT);
    sigaddset (&set, SIGQUIT);
    sigaddset (&set, SIGTERM);
    sigprocmask (SIG_BLOCK, &set, &oset);

    while (wait (&status) != NOTOK) {
	pidcheck (status);
	continue;
    }

    /* reset the signal mask */
    sigprocmask (SIG_SETMASK, &oset, &set);

    xpid = 0;
    flush_errors ();
}