From: Mikko Rasa Date: Mon, 14 Jun 2010 13:12:16 +0000 (+0000) Subject: Support sending glwrap.so output directly into a file X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=ef5baa3143441b46f5d8e515adff16737bb9439d;p=gldbg.git Support sending glwrap.so output directly into a file --- 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;