]> git.tdb.fi Git - gldbg.git/commitdiff
Support sending glwrap.so output directly into a file
authorMikko Rasa <tdb@tdb.fi>
Mon, 14 Jun 2010 13:12:16 +0000 (13:12 +0000)
committerMikko Rasa <tdb@tdb.fi>
Mon, 14 Jun 2010 13:12:16 +0000 (13:12 +0000)
source/glwrap.c

index 4c17edfca772755f16a983253e96d37cf3ef0de6..f801a20aae2b71b3c4561215da9f250035df2240 100644 (file)
@@ -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;