From ef5baa3143441b46f5d8e515adff16737bb9439d Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Mon, 14 Jun 2010 13:12:16 +0000 Subject: [PATCH] Support sending glwrap.so output directly into a file --- source/glwrap.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/source/glwrap.c b/source/glwrap.c index 4c17edf..f801a20 100644 --- a/source/glwrap.c +++ b/source/glwrap.c @@ -197,7 +197,20 @@ INTERNAL inline int get_out_fd(void) if(var) fd = strtol(var, NULL, 0); else - fd = 2; + { + var = getenv("GLWRAP_FILE"); + if(var) + { + fd = open(var, O_WRONLY|O_CREAT, 0644); + if(fd==-1) + { + fprintf(stderr, "Couldn't open dumpfile %s for output: %s", var, strerror(errno)); + abort(); + } + } + else + fd = 2; + } } return fd; -- 2.45.2