/
| 363 | |
| 364 | /*****************************************************************************/ |
| 365 | char *pj_make_args (size_t argc, char **argv) { |
| 366 | /****************************************************************************** |
| 367 | pj_make_args is the inverse of the pj_trim_argc/pj_trim_argv combo: It |
| 368 | converts free format command line input to something proj_create can consume. |
| 369 | |
| 370 | Allocates, and returns, an array of char, large enough to hold a whitespace |
| 371 | separated copy of the args in argv. It is the duty of the caller to free this |
| 372 | array. |
| 373 | ******************************************************************************/ |
| 374 | |
| 375 | try |
| 376 | { |
| 377 | std::string s; |
| 378 | for( size_t i = 0; i < argc; i++ ) |
| 379 | { |
| 380 | const char* equal = strchr(argv[i], '='); |
| 381 | if( equal ) { |
| 382 | s += std::string(argv[i], equal - argv[i] + 1); |
| 383 | s += pj_double_quote_string_param_if_needed(equal + 1); |
| 384 | } else { |
| 385 | s += argv[i]; |
| 386 | } |
| 387 | s += ' '; |
| 388 | } |
| 389 | |
| 390 | char* p = pj_strdup(s.c_str()); |
| 391 | return pj_shrink (p); |
| 392 | } |
| 393 | catch( const std::exception& ) { |
| 394 | return nullptr; |
| 395 | } |
| 396 | } |
| 397 | |
| 398 | |
| 399 |
no test coverage detected