Selaa lähdekoodia

skip empty and comment lines (merge from devbr6)

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@38853 15284696-431f-4ddb-bdfa-cd5b030d7da7
Hamish Bowman 15 vuotta sitten
vanhempi
commit
7ee3ba95b2
2 muutettua tiedostoa jossa 12 lisäystä ja 2 poistoa
  1. 1 1
      lib/symbol/README
  2. 11 1
      lib/symbol/read.c

+ 1 - 1
lib/symbol/README

@@ -27,7 +27,7 @@ POLYGONS and STRINGS are drawn using the default color and fill color
 (specified in module options such as 'd.vect color='). This color may be 
 overwritten by using the COLOR and FCOLOR keywords.
 
-
+Blank lines and lines starting with a #hash will be ignored.
 
 ---- DESCRIPTION OF OBJECTS ----
 

+ 11 - 1
lib/symbol/read.c

@@ -195,6 +195,11 @@ void read_coor(FILE * fp, SYMBEL * e)
 
     while (G_getl2(buf, 500, fp) != 0) {
 	G_chop(buf);
+
+	/* skip empty and comment lines */
+	if ((buf[0] == '#') || (buf[0] == '\0'))
+	    continue;
+
 	get_key_data(buf);
 
 	if (strcmp(key, "END") == 0) {
@@ -288,7 +293,12 @@ SYMBOL *S_read(char *sname)
     /* read file */
     while (G_getl2(buf, 2000, fp) != 0) {
 	G_chop(buf);
-	G_debug(3, "  BUF: %s", buf);
+	G_debug(3, "  BUF: [%s]", buf);
+
+	/* skip empty and comment lines */
+	if ((buf[0] == '#') || (buf[0] == '\0'))
+	    continue;
+
 	get_key_data(buf);
 
 	if (strcmp(key, "VERSION") == 0) {