dinitcheck: fix checking of dependencies
authorDavin McCall <davmac@davmac.org>
Sun, 17 Nov 2019 18:39:20 +0000 (18:39 +0000)
committerDavin McCall <davmac@davmac.org>
Sun, 17 Nov 2019 18:39:20 +0000 (18:39 +0000)
src/dinitcheck.cc

index 7fb74f73fbca78f5410efac4b4dcbb9aff699907..37507dd866427c06516211cafc76051be2124cec 100644 (file)
@@ -101,7 +101,9 @@ int main(int argc, char **argv)
 
     // TODO additional: check chain-to, other lint
 
-    for (const auto &name : services_to_check) {
+    for (size_t i = 0; i < services_to_check.size(); ++i) {
+        const std::string &name = services_to_check[i];
+        std::cout << "Checking service: " << name << "...\n";
         try {
             service_record *sr = load_service(service_set, name, service_dir_opts.get_paths());
             service_set[name] = sr;
@@ -122,6 +124,11 @@ int main(int argc, char **argv)
     return 0;
 }
 
+static void report_unknown_setting_error(const std::string &service_name, const char *setting_name)
+{
+    std::cerr << "Service '" << service_name << "', unknown setting: " << setting_name << "\n";
+}
+
 static void report_error(dinit_load::setting_exception &exc, const std::string &service_name, const char *setting_name)
 {
     std::cerr << "Service '" << service_name << "', " << setting_name << ": " << exc.get_info() << "\n";
@@ -505,7 +512,7 @@ service_record *load_service(service_set_t &services, const std::string &name,
                     #endif
                 }
                 else {
-                    throw service_description_exc(name, "Unknown setting: " + setting);
+                    report_unknown_setting_error(name, setting.c_str());
                 }
             }
             catch (setting_exception &exc) {