#include "cinema.h"
+#include "cross.h"
#include "config.h"
#include "dkdm_wrapper.h"
#include "email.h"
kdm_cli (int argc, char* argv[], std::function<void (string)> out)
try
{
+ ArgFixer fixer(argc, argv);
+
boost::filesystem::path output = dcp::filesystem::current_path();
auto container_name_format = Config::instance()->kdm_container_name_format();
auto filename_format = Config::instance()->kdm_filename_format();
{ 0, 0, 0, 0 }
};
- int c = getopt_long (argc, argv, "ho:K:Z:f:t:d:F:pae::zvc:S:C:T:BDE:G", long_options, &option_index);
+ int c = getopt_long(fixer.argc(), fixer.argv(), "ho:K:Z:f:t:d:F:pae::zvc:S:C:T:BDE:G", long_options, &option_index);
if (c == -1) {
break;
throw KDMCLIError ("you must specify --valid-from");
}
- if (optind >= argc) {
+ if (optind >= fixer.argc()) {
throw KDMCLIError ("no film, CPL ID or DKDM specified");
}
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;
{ 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;
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";
exit (EXIT_SUCCESS);
}
- if (optind >= argc) {
- help (argv[0]);
+ if (optind >= fixer.argc()) {
+ help(program_name);
exit (EXIT_FAILURE);
}
exit (EXIT_FAILURE);
}
- film_dir = argv[optind];
+ film_dir = fixer.argv()[optind];
dcpomatic_setup_path_encoding ();
dcpomatic_setup ();
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);
}
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);
}
}
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);
int
main (int argc, char* argv[])
{
+ ArgFixer fixer(argc, argv);
+ auto const program_name = fixer.argv()[0];
+
dcpomatic_setup_path_encoding ();
dcpomatic_setup ();
{ 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;
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);
server.run ();
} catch (boost::system::system_error& e) {
if (e.code() == boost::system::errc::address_in_use) {
- cerr << argv[0] << ": address already in use. Is another DCP-o-matic server instance already running?\n";
+ cerr << program_name << ": address already in use. Is another DCP-o-matic 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;
}