[GRASS-dev] MASK_OVERRIDE

Ivan Shmakov ivan at theory.asu.ru
Wed Feb 20 05:54:46 EST 2008


>>>>> Paul Kelly <paul-grass at stjohnspoint.co.uk> writes:

 >>> For this feature to be of real use, you need to allow MASK_OVERRIDE
 >>> to be used to disable reading a mask altogether. E.g. if
 >>> MASK_OVERRIDE is defined but empty, no mask should be used rather
 >>> than falling back to MASK. This would allow the GUI to operate
 >>> without a mask even when MASK has been created via the command
 >>> line.

[...]

 >> It seems to be usual in the Unix world to ignore the environment
 >> variable's value if it's an empty string.  Using a non-existing
 >> raster (say, `.') is probably a better idea.

 > On Windows, an environment variable is unset by setting it to an
 > empty string. There seems to be no difference between the two. So I
 > don't think we could rely on the behaviour caused by MASK_OVERRIDE
 > being an empty string.

	If it's so, there should probably a GRASS-wide policy on
	ignoring environment variables set to an empty string.  Why not
	a libgis function?

const char *
getenv_nonempty (const char *name)
{
  const char *value = getenv (name);
  return (value && *value != '\0') ? value : 0;
}

 > OTOH setting it to some garbage value seems a little unelegant, but
 > as long as it's not a valid raster name there should be no problem I
 > suppose.

	I'm still open to suggestions.

	If none, I'd probably add a `.'-check to the code in order to
	avoid a bogus warning.



More information about the grass-dev mailing list