aboutsummaryrefslogtreecommitdiff
path: root/src/apps/proj.cpp
diff options
context:
space:
mode:
authorAndrew Bell <andrew.bell.ia@gmail.com>2019-05-15 10:47:03 -0400
committerAndrew Bell <andrew.bell.ia@gmail.com>2019-05-15 10:47:03 -0400
commit8f268409d37cea329d263e177b83e42f8384d3c7 (patch)
treec4d0f3dd19456600f718a6e0c8573577f433549b /src/apps/proj.cpp
parent886ced02f0aaab5d66d16459435f7447cf976650 (diff)
parentd67203a6f76a74f5ac029ff052dbcc72e3b59624 (diff)
downloadPROJ-8f268409d37cea329d263e177b83e42f8384d3c7.tar.gz
PROJ-8f268409d37cea329d263e177b83e42f8384d3c7.zip
Merge remote-tracking branch 'origin/master'
Diffstat (limited to 'src/apps/proj.cpp')
-rw-r--r--src/apps/proj.cpp14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/apps/proj.cpp b/src/apps/proj.cpp
index 298a44e8..888d723f 100644
--- a/src/apps/proj.cpp
+++ b/src/apps/proj.cpp
@@ -7,6 +7,7 @@
#include <string.h>
#include <math.h>
#include "emess.h"
+#include "utils.h"
#if defined(MSDOS) || defined(OS2) || defined(WIN32) || defined(__WIN32__)
# include <fcntl.h>
@@ -22,7 +23,6 @@
static PJ *Proj;
static union {
- PJ_UV (*generic)(PJ_UV, PJ *);
PJ_XY (*fwd)(PJ_LP, PJ *);
PJ_LP (*inv)(PJ_XY, PJ *);
} proj;
@@ -46,7 +46,7 @@ static char oform_buffer[16]; /* Buffer for oform when using -d */
static const char
*oterr = "*\t*", /* output line for unprojectable input */
- *usage = "%s\nusage: %s [ -bdeEfiIlmorsStTvVwW [args] ] [ +opts[=arg] ] [ files ]\n";
+ *usage = "%s\nusage: %s [-bdeEfiIlmorsStTvVwW [args]] [+opt[=arg] ...] [file ...]\n";
static PJ_FACTORS facs;
@@ -462,6 +462,13 @@ int main(int argc, char **argv) {
if (eargc == 0) /* if no specific files force sysin */
eargv[eargc++] = const_cast<char*>("-");
+ if( oform ) {
+ if( !validate_form_string_for_numbers(oform) ) {
+ emess(3, "invalid format string");
+ exit(0);
+ }
+ }
+
/* done with parameter and control input */
if (inverse && postscale) {
prescale = 1;
@@ -488,7 +495,6 @@ int main(int argc, char **argv) {
proj.inv = pj_inv;
} else
proj.fwd = pj_fwd;
-
/* set input formatting control */
if (mon) {
pj_pr_list(Proj);
@@ -533,7 +539,7 @@ int main(int argc, char **argv) {
} else {
if ((fid = fopen(*eargv, "rb")) == nullptr) {
- emess(-2, *eargv, "input file");
+ emess(-2, "input file: %s", *eargv);
continue;
}
emess_dat.File_name = *eargv;