[Git][NTPsec/ntpsec][master] Fix error messages for addvars/rmvars and make pstats checks for arguments

Eric S. Raymond gitlab at mg.gitlab.com
Sun Oct 30 14:50:12 UTC 2016


Eric S. Raymond pushed to branch master at NTPsec / ntpsec


Commits:
80767cb5 by Matt Selsky at 2016-10-30T10:34:39-04:00
Fix error messages for addvars/rmvars and make pstats checks for arguments

- - - - -


1 changed file:

- ntpq/pyntpq


Changes:

=====================================
ntpq/pyntpq
=====================================
--- a/ntpq/pyntpq
+++ b/ntpq/pyntpq
@@ -806,8 +806,8 @@ usage: lpassociations
 
     def do_addvars(self, line):
         "add variables to the variable list or change their values"
-        if line == "":
-            self.warn("usage: addvars name[=value][,...]")
+        if not line:
+            self.warn("usage: addvars name[=value][,...]\n")
             return
         vars_to_add = line.split(',')
         for add_var in vars_to_add:
@@ -825,8 +825,8 @@ usage: addvars name[=value][,...]
 
     def do_rmvars(self, line):
         "remove variables from the variable list"
-        if line == "":
-            self.warn("usage: rmvars name[,...]")
+        if not line:
+            self.warn("usage: rmvars name[,...]\n")
             return
         vars_to_rm = line.split(',')
         for rm_var in vars_to_rm:
@@ -1059,6 +1059,9 @@ usage: cv [ assocID ] [ name=value[,...] ]
             ("selbroken",	"bad reference time:  ", NTP_STR),
             ("candidate",	"candidate order:     ", NTP_STR),
         )
+        if not line:
+                self.warn("usage: pstats assocID\n")
+                return
         associd = self.__assoc_valid(line)
         if associd >= 0:
             self.collect_display(associd=associd,



View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/80767cb56a3fec69269dd8f8fa93a59ce415bd59
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ntpsec.org/pipermail/vc/attachments/20161030/85e1ab99/attachment.html>


More information about the vc mailing list