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Å
Hi Jan-Åke.
What about freopen? I tested the code below under solaris, linux and
windows with both mingw (gcc -mno-cygwin, really) and the
free MSVC compiler. All tests succeeded!
--
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