Browse Source

g.parser: empty string == NULL (to unset property)

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@51962 15284696-431f-4ddb-bdfa-cd5b030d7da7
Martin Landa 13 years ago
parent
commit
a6d82999df
1 changed files with 5 additions and 0 deletions
  1. 5 0
      general/g.parser/translate.c

+ 5 - 0
general/g.parser/translate.c

@@ -1,4 +1,5 @@
 #include <stdlib.h>
+#include <string.h>
 
 #include "proto.h"
 
@@ -12,6 +13,10 @@ char *translate(const char *arg)
 
     if (arg == NULL)
 	return arg;
+
+    if (strlen(arg) == 0)
+        return NULL; /* unset */
+    
     if (*arg && translate_output) {
 	fputs(arg, stdout);
 	fputs("\n", stdout);