From: <ai...@us...> - 2010-01-07 07:09:32
|
Revision: 10741 http://plplot.svn.sourceforge.net/plplot/?rev=10741&view=rev Author: airwin Date: 2010-01-07 07:09:26 +0000 (Thu, 07 Jan 2010) Log Message: ----------- 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. Thanks to David MacMahon for this patch. Modified Paths: -------------- trunk/src/plcore.c Modified: trunk/src/plcore.c =================================================================== --- trunk/src/plcore.c 2010-01-07 00:53:13 UTC (rev 10740) +++ trunk/src/plcore.c 2010-01-07 07:09:26 UTC (rev 10741) @@ -3077,7 +3077,20 @@ { 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. */ if ( *( plsc->DevName ) != '\0' && *( plsc->DevName ) != '?' ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |