From: Carl Hetherington Date: Wed, 14 Feb 2018 23:10:45 +0000 (+0000) Subject: Tidy up option parsing a little. X-Git-Tag: v2.13.0~73 X-Git-Url: https://main.carlh.net/gitweb/?p=dcpomatic.git;a=commitdiff_plain;h=85d72a25071f7b5a5d93a2d91f245b0cc7ffbe3b Tidy up option parsing a little. --- diff --git a/src/tools/dcpomatic_kdm_cli.cc b/src/tools/dcpomatic_kdm_cli.cc index 055170441..fbd6bb870 100644 --- a/src/tools/dcpomatic_kdm_cli.cc +++ b/src/tools/dcpomatic_kdm_cli.cc @@ -390,7 +390,6 @@ int main (int argc, char* argv[]) shared_ptr cinema; string screen_description = ""; list > screens; - optional certificate; optional dkdm; optional valid_from; optional valid_to; @@ -488,25 +487,29 @@ int main (int argc, char* argv[]) verbose = true; break; case 'c': + /* This could be a cinema to search for in the configured list or the name of a cinema being + built up on-the-fly in the option. Cater for both possilibities here by storing the name + (for lookup) and by creating a Cinema which the next Screen will be added to. + */ cinema_name = optarg; - cinema = shared_ptr (new Cinema (cinema_name, list(), "", 0, 0)); + cinema = shared_ptr (new Cinema (optarg, list(), "", 0, 0)); break; case 'S': screen_description = optarg; break; case 'C': - { - certificate = dcp::Certificate (dcp::file_to_string (optarg)); - vector trusted_devices; - shared_ptr screen (new Screen (screen_description, certificate, trusted_devices)); + /* Make a new screen and add it to the current cinema */ + shared_ptr screen (new Screen (screen_description, dcp::Certificate (dcp::file_to_string (optarg)), vector())); if (cinema) { cinema->add_screen (screen); } screens.push_back (screen); break; - } case 'T': - screens.back()->trusted_devices.push_back (dcp::Certificate (dcp::file_to_string (optarg))); + /* A trusted device ends up in the last screen we made */ + if (!screens.empty ()) { + screens.back()->trusted_devices.push_back (dcp::Certificate (dcp::file_to_string (optarg))); + } break; case 'B': list_cinemas = true;