X-Git-Url: http://git.tdb.fi/?p=gldbg.git;a=blobdiff_plain;f=source%2Fglwrap.c;h=f801a20aae2b71b3c4561215da9f250035df2240;hp=4c17edfca772755f16a983253e96d37cf3ef0de6;hb=ef5baa3143441b46f5d8e515adff16737bb9439d;hpb=4aba13fc7690cf79e949d9765b371e85e7530207 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;