On Jan 5, 2010, at 16:55 , Alan W. Irwin wrote:

> On 2010-01-05 15:35-0800 David MacMahon wrote:
>
>> export PLPLOT_DEV=xcairo
>
> That feature does appear to be useful, and I would be happy to  
> receive a
> patch implementing that.

Great!  I've tested the attached patch and it seems to do the trick.   
Let me know if subversion doesn't like the git patch format and I'll  
try to redo it in a more subversion friendly way.  The git/case-1/ 
README file was very helpful in setting up and working with a git-svn  
clone of the repository, but it doesn't say anything about creating  
patches that can be used with subversion.

Thanks,
Dave

 From 739a7843b92ce70ac678f6332c9d17a2521c18c2 Mon Sep 17 00:00:00 2001
From: David MacMahon <dav...@astro.berkeley.edu>
Date: Wed, 6 Jan 2010 16:03:01 -0800
Subject: [PATCH] Get default device from PLPLOT_DEV environment var

If a device is not explicitly specified (e.g. via "-dev ..." on the
command line), the device given by the value of the PLPLOT_DEV
environment variable, if defined and non-empty, will be used.
---
  src/plcore.c |   13 +++++++++++++
  1 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/src/plcore.c b/src/plcore.c
index c40db01..c3aa678 100644
--- a/src/plcore.c
+++ b/src/plcore.c
@@ -3077,6 +3077,19 @@ plSelectDev()
  {
      int  dev, i, count, length;
      char response[80];
+    char * devname_env;
+
+/* If device name is not already specified, try to get it from  
environment */
+
+    if ( plsc->DevName[0] == '\0' )
+    {
+        devname_env = getenv( "PLPLOT_DEV" );
+        if( devname_env )
+        {
+            strncpy( plsc->DevName, devname_env, sizeof ( plsc- 
 >DevName ) - 1 );
+            plsc->DevName[sizeof ( plsc->DevName ) - 1] = '\0';
+        }
+    }

  /* Device name already specified.  See if it is valid. */

-- 
1.6.6


------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev 
_______________________________________________
Plplot-devel mailing list
Plplot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/plplot-devel

Reply via email to