diff options
| author | Carl Hetherington <cth@carlh.net> | 2024-07-06 21:48:01 +0200 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2024-07-06 21:48:01 +0200 |
| commit | 3317a9b30752e2e311e7bfe36a8ce8201b07636a (patch) | |
| tree | beb12e51bab665f17f04f9aea503dd4ca2311d16 /src/tools | |
| parent | 5696315078be7a3f61763690ddc201c558ddcd5a (diff) | |
| parent | fefcccd526bd4cf12dfdf43ce36ccb62b044528e (diff) | |
Merge remote-tracking branch 'origin/main' into v2.17.x
Diffstat (limited to 'src/tools')
| -rw-r--r-- | src/tools/dcpomatic_cli.cc | 17 | ||||
| -rw-r--r-- | src/tools/dcpomatic_create.cc | 4 | ||||
| -rw-r--r-- | src/tools/dcpomatic_server_cli.cc | 13 |
3 files changed, 21 insertions, 13 deletions
diff --git a/src/tools/dcpomatic_cli.cc b/src/tools/dcpomatic_cli.cc index 49caf5cb2..8b55d6205 100644 --- a/src/tools/dcpomatic_cli.cc +++ b/src/tools/dcpomatic_cli.cc @@ -264,6 +264,9 @@ show_jobs_on_console (bool progress) int main (int argc, char* argv[]) { + ArgFixer fixer(argc, argv); + auto const program_name = fixer.argv()[0]; + boost::filesystem::path film_dir; bool progress = true; bool no_remote = false; @@ -304,7 +307,7 @@ main (int argc, char* argv[]) { 0, 0, 0, 0 } }; - int c = getopt_long (argc, argv, "vhfnrt:j:kAs:ldc:BC:D:E", long_options, &option_index); + int c = getopt_long(fixer.argc(), fixer.argv(), "vhfnrt:j:kAs:ldc:BC:D:E", long_options, &option_index); if (c == -1) { break; @@ -315,7 +318,7 @@ main (int argc, char* argv[]) cout << "dcpomatic version " << dcpomatic_version << " " << dcpomatic_git_commit << "\n"; exit (EXIT_SUCCESS); case 'h': - help (argv[0]); + help(program_name); exit (EXIT_SUCCESS); case 'f': cout << dcpomatic_cxx_flags << "\n"; @@ -391,8 +394,8 @@ main (int argc, char* argv[]) exit (EXIT_SUCCESS); } - if (optind >= argc) { - help (argv[0]); + if (optind >= fixer.argc()) { + help(program_name); exit (EXIT_FAILURE); } @@ -411,7 +414,7 @@ main (int argc, char* argv[]) exit (EXIT_FAILURE); } - film_dir = argv[optind]; + film_dir = fixer.argv()[optind]; dcpomatic_setup_path_encoding (); dcpomatic_setup (); @@ -434,7 +437,7 @@ main (int argc, char* argv[]) film.reset (new Film (film_dir)); film->read_metadata (); } catch (std::exception& e) { - cerr << argv[0] << ": error reading film `" << film_dir.string() << "' (" << e.what() << ")\n"; + cerr << program_name << ": error reading film `" << film_dir.string() << "' (" << e.what() << ")\n"; exit (EXIT_FAILURE); } @@ -449,7 +452,7 @@ main (int argc, char* argv[]) auto paths = i->paths(); for (auto j: paths) { if (!dcp::filesystem::exists(j)) { - cerr << argv[0] << ": content file " << j << " not found.\n"; + cerr << program_name << ": content file " << j << " not found.\n"; exit (EXIT_FAILURE); } } diff --git a/src/tools/dcpomatic_create.cc b/src/tools/dcpomatic_create.cc index 5b5f4dba2..e0d5b3973 100644 --- a/src/tools/dcpomatic_create.cc +++ b/src/tools/dcpomatic_create.cc @@ -70,10 +70,12 @@ public: int main (int argc, char* argv[]) { + ArgFixer fixer(argc, argv); + dcpomatic_setup_path_encoding (); dcpomatic_setup (); - CreateCLI cc (argc, argv); + CreateCLI cc(fixer.argc(), fixer.argv()); if (cc.error) { cerr << *cc.error << "\n"; exit (1); diff --git a/src/tools/dcpomatic_server_cli.cc b/src/tools/dcpomatic_server_cli.cc index 25fe59fc7..ea78d41a5 100644 --- a/src/tools/dcpomatic_server_cli.cc +++ b/src/tools/dcpomatic_server_cli.cc @@ -66,6 +66,9 @@ help (string n) int main (int argc, char* argv[]) { + ArgFixer fixer(argc, argv); + auto const program_name = fixer.argv()[0]; + dcpomatic_setup_path_encoding (); dcpomatic_setup (); @@ -84,7 +87,7 @@ main (int argc, char* argv[]) { 0, 0, 0, 0 } }; - int c = getopt_long (argc, argv, "vht:AB", long_options, &option_index); + int c = getopt_long(fixer.argc(), fixer.argv(), "vht:AB", long_options, &option_index); if (c == -1) { break; @@ -95,7 +98,7 @@ main (int argc, char* argv[]) cout << "dcpomatic version " << dcpomatic_version << " " << dcpomatic_git_commit << "\n"; exit (EXIT_SUCCESS); case 'h': - help (argv[0]); + help(program_name); exit (EXIT_SUCCESS); case 't': num_threads = atoi (optarg); @@ -124,12 +127,12 @@ main (int argc, char* argv[]) server.run (); } catch (boost::system::system_error& e) { if (e.code() == boost::system::errc::address_in_use) { - cerr << argv[0] << variant::insert_dcpomatic(": address already in use. Is another %1 server instance already running?\n"); + cerr << program_name << variant::insert_dcpomatic(": address already in use. Is another %1 server instance already running?\n"); exit (EXIT_FAILURE); } - cerr << argv[0] << ": " << e.what() << "\n"; + cerr << program_name << ": " << e.what() << "\n"; } catch (std::exception& e) { - cerr << argv[0] << ": failed to start server; " << e.what() << "\n"; + cerr << program_name << ": failed to start server; " << e.what() << "\n"; } return 0; } |
