Added error message for missing subparameter.
authorIain Patterson <me@iain.cx>
Mon, 13 Jan 2014 09:30:52 +0000 (09:30 +0000)
committerIain Patterson <me@iain.cx>
Mon, 13 Jan 2014 09:30:52 +0000 (09:30 +0000)
Clarify the output when editing a service on the command line and a
mandatory subparameter was not supplied.

Thanks Chris Blaszczynski.

messages.mc
service.cpp

index d8f6f0e..faa05ad 100644 (file)
Binary files a/messages.mc and b/messages.mc differ
index b8c73ef..8074227 100644 (file)
@@ -701,14 +701,20 @@ int pre_edit_service(int argc, TCHAR **argv) {
       for (i = 0; settings[i].name; i++) _ftprintf(stderr, _T("%s\n"), settings[i].name);\r
       return 1;\r
     }\r
-    if (argc < mandatory) return usage(1);\r
 \r
     additional = 0;\r
     if (additional_mandatory) {\r
+      if (argc < mandatory) {\r
+        print_message(stderr, NSSM_MESSAGE_MISSING_SUBPARAMETER, parameter);\r
+        return 1;\r
+      }\r
       additional = argv[3];\r
       remainder = 4;\r
     }\r
-    else additional = argv[remainder];\r
+    else {\r
+      additional = argv[remainder];\r
+      if (argc < mandatory) return usage(1);\r
+    }\r
   }\r
 \r
   nssm_service_t *service = alloc_nssm_service();\r