diff options
| author | Kristian Evers <kristianevers@gmail.com> | 2018-04-13 18:11:29 +0200 |
|---|---|---|
| committer | Kristian Evers <kristianevers@gmail.com> | 2018-04-13 18:11:29 +0200 |
| commit | be27d12a028d07ed656080004c949c0da7a6012e (patch) | |
| tree | dfffd333683dd08030a000c2c952eccb6120927c /src | |
| parent | a372a17445018f12acd51f716f3cb5ba5d30e8f7 (diff) | |
| download | PROJ-be27d12a028d07ed656080004c949c0da7a6012e.tar.gz PROJ-be27d12a028d07ed656080004c949c0da7a6012e.zip | |
Always ignore out-commented lines in cct
Previous to this commit cct would return the following
$ cct -c 2,3,4 -t 0 -I +proj=cart +ellps=GRS80
BLAH 3579685.56545 508396.50343 5236837.50646
8.0832413787 55.5578176654 99.9833 0.0000
8.0832413787 55.5578176654 99.9833 0.0000
where the second input should not be parsed as a valid coordinate.
With this commit that no longer happens and the input is returned
verbatim back to the user.
Closes #932
Diffstat (limited to 'src')
| -rw-r--r-- | src/cct.c | 14 |
1 files changed, 7 insertions, 7 deletions
@@ -271,6 +271,7 @@ int main(int argc, char **argv) { while (opt_input_loop (o, optargs_file_format_text)) { int err; void *ret = fgets (buf, 10000, o->input); + char *c = column (buf, 1); opt_eof_handler (o); if (0==ret) { fprintf (stderr, "Read error in record %d\n", (int) o->record_index); @@ -281,15 +282,14 @@ int main(int argc, char **argv) { skip_lines--; continue; } - if (HUGE_VAL==point.xyzt.x) { - char *c = column (buf, 1); - /* if it's a comment or blank line, we reflect it */ - if (c && ((*c=='\0') || (*c=='#'))) { - fprintf (fout, "%s\n", buf); - continue; - } + /* if it's a comment or blank line, we reflect it */ + if (c && ((*c=='\0') || (*c=='#'))) { + fprintf (fout, "%s", buf); + continue; + } + if (HUGE_VAL==point.xyzt.x) { /* otherwise, it must be a syntax error */ fprintf (fout, "# Record %d UNREADABLE: %s", (int) o->record_index, buf); if (verbose) |
