auctex-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [AUCTeX-devel] preview-latex, dvipng, and LyX


From: Enrico Forestieri
Subject: Re: [AUCTeX-devel] preview-latex, dvipng, and LyX
Date: Tue, 10 Jan 2006 13:34:32 +0000 (UTC)
User-agent: Loom/3.14 (http://gmane.org/)

Jan-Åke Larsson <address@hidden> 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: <address@hidden>
 *
 *  (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()");
}







reply via email to

[Prev in Thread] Current Thread [Next in Thread]