git-svn-id: https://svn.osgeo.org/grass/grass/branches/releasebranch_7_0@64071 15284696-431f-4ddb-bdfa-cd5b030d7da7
@@ -295,15 +295,17 @@ char *G_chop(char *line)
return (line);
}
- for (t = line; *t; t++) /* go to end */
+ for (t = f; *t; t++) /* go from first non white-space char to end */
;
while (isspace(*--t)) ;
*++t = '\0'; /* remove trailing white-spaces */
- t = line;
- while (*f) /* copy */
- *t++ = *f++;
- *t = '\0';
+ if (f != line) {
+ t = line;
+ while (*f) /* leading white spaces, shift */
+ *t++ = *f++;
+ *t = '\0';
+ }