diff options
| author | Even Rouault <even.rouault@spatialys.com> | 2020-03-18 10:27:24 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-03-18 10:27:24 +0100 |
| commit | 3cd1668e0283edaf0c1e31f1c6b9aa6331e5b088 (patch) | |
| tree | bebc72fe639213d002efe6fe64ab3c0ffb25398a /src | |
| parent | 2b4037d7a02598ec7747d2d4ad88c41de08f430f (diff) | |
| parent | 5c7f901bf35a6b4801cecb6c41cc62be2fdb5c94 (diff) | |
| download | PROJ-3cd1668e0283edaf0c1e31f1c6b9aa6331e5b088.tar.gz PROJ-3cd1668e0283edaf0c1e31f1c6b9aa6331e5b088.zip | |
Merge pull request #2081 from PROJ-BOT/backport-2080-to-7.0
[Backport 7.0] cs2cs: don't require +to for '{source_crs} {target_crs} filename...' syntax (fixes #2012)
Diffstat (limited to 'src')
| -rw-r--r-- | src/apps/cs2cs.cpp | 27 |
1 files changed, 11 insertions, 16 deletions
diff --git a/src/apps/cs2cs.cpp b/src/apps/cs2cs.cpp index 6c85d4aa..4ada83b5 100644 --- a/src/apps/cs2cs.cpp +++ b/src/apps/cs2cs.cpp @@ -349,23 +349,14 @@ int main(int argc, char **argv) { exit(0); } - // First pass to check if we have "cs2cs [-bla]* <SRC> <DEST>" syntax - int countNonOptionArg = 0; + // First pass to check if we have "cs2cs [-bla]* <SRC> <DEST> [<filename>]" syntax + bool isProj4StyleSyntax = false; for (int i = 1; i < argc; i++) { - if (argv[i][0] == '-') { - if (argv[i][1] == 'f' || argv[i][1] == 'e' || argv[i][1] == 'd' || - argv[i][1] == 'D' ) { - i++; - } - } else { - if (strcmp(argv[i], "+to") == 0) { - countNonOptionArg = -1; - break; - } - countNonOptionArg++; + if (argv[i][0] == '+') { + isProj4StyleSyntax = true; + break; } } - const bool isSrcDestSyntax = (countNonOptionArg == 2); /* process run line arguments */ while (--argc > 0) { /* collect run line arguments */ @@ -485,11 +476,15 @@ int main(int argc, char **argv) { } break; } - } else if (isSrcDestSyntax) { + } else if (!isProj4StyleSyntax) { if (fromStr.empty()) fromStr = *argv; - else + else if( toStr.empty() ) toStr = *argv; + else { + /* assumed to be input file name(s) */ + eargv[eargc++] = *argv; + } } else if (strcmp(*argv, "+to") == 0) { have_to_flag = 1; |
