Jan-Åke Larsson <[EMAIL PROTECTED]> writes:

> Anyhow, the font-generating call is internal to kpathsea, it is not as
> if I get to choose where to send output. With glibc redirection should
> be easy, but without glibc I think I'll need to fork for every call to
> kpse_find_pk, and redirect or gobble output and _then_ call kpse_find_pk
> _again_ in the parent. Hmmmmmmmmm. Some overhead, but possible.
> 
> Opinions?
> /JÅ

(sorry for the possible duplication, but my previous post doesn't seem
to have got through the gmane interface)

Hi, Jan-Åke.

What about freopen? I tested the code pasted below in Solaris, Linux
and Windows (with both mingw and the free MSVC compiler), and it worked
in all cases.

--
Enrico


$ cat rd.kirby.c
/*
 *  Sample code posted by Lawrence Kirby
 *  Date: Mon, 02 Mar 98 01:51:38 GMT
 *  Subject: temporarily reassigning stdout/stderr
 *  Message-ID: <[EMAIL PROTECTED]>
 *
 *  (Nonportable: uses dup() and dup2() system calls for
 *  duplicating underlying file descriptors, which are
 *  present in Unix but not necessarily anywhere else.)
 */

#include <stdio.h>

main()
{
    int    fd;
    fpos_t pos;

    printf("stdout, ");

    fflush(stdout);
    fgetpos(stdout, &pos);
    fd = dup(fileno(stdout));
    freopen("stdout.out", "w", stdout);
    
    f();

    fflush(stdout);
    dup2(fd, fileno(stdout));
    close(fd);
    clearerr(stdout);
    fsetpos(stdout, &pos);        /* for C9X */

    printf("stdout again\n");
}

f()
{
printf("stdout in f()");
}





_______________________________________________
auctex-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/auctex-devel

Reply via email to