[Git][NTPsec/ntpsec][master] 2 commits: ntpmon: allow 'h' in addition to '?' to display help screen.
Gary E. Miller
gitlab at mg.gitlab.com
Tue Aug 8 22:52:34 UTC 2017
Gary E. Miller pushed to branch master at NTPsec / ntpsec
Commits:
9c9cf63a by Gary E. Miller at 2017-08-08T15:45:16-07:00
ntpmon: allow 'h' in addition to '?' to display help screen.
Adjsut docs to match.
- - - - -
e7a4dbfb by Gary E. Miller at 2017-08-08T15:51:50-07:00
More hardening for f8dot3() and f8dot4().
- - - - -
3 changed files:
- docs/includes/ntpmon-body.txt
- ntpclients/ntpmon
- pylib/util.py
Changes:
=====================================
docs/includes/ntpmon-body.txt
=====================================
--- a/docs/includes/ntpmon-body.txt
+++ b/docs/includes/ntpmon-body.txt
@@ -49,6 +49,8 @@ a:: Change peer display to apeers mode, showing association IDs.
d:: Toggle detail mode (some peer will be reverse-video highlighted when on).
+h:: Display help screen
+
j:: Select next peer (in select mode); arrow down also works.
k:: Select previous peer (in select mode); arrow up also works.
@@ -77,7 +79,7 @@ x:: Cleanly terminate the program.
-:: Decrease debugging level.
-?:: List these commands.
+?:: Display help screen
== Options ==
=====================================
ntpclients/ntpmon
=====================================
--- a/ntpclients/ntpmon
+++ b/ntpclients/ntpmon
@@ -7,6 +7,7 @@ Any keystroke causes a poll and update. Keystroke commands:
'a': Change peer display to apeers mode, showing association IDs.
'd': Toggle detail mode (some peer will be reverse-video highlighted when on).
+'h': Display helpscreen.
'j': Select next peer (in select mode); arrow down also works.
'k': Select previous peer (in select mode); arrow up also works.
'm': Disable peers display, showing only MRU list
@@ -389,7 +390,7 @@ if __name__ == '__main__':
session.debug -= 1
peer_report.debug = session.debug
mru_report.debug = session.debug
- elif key == '?':
+ elif key in ['?','h']:
helpmode = True
except curses.error:
pass
=====================================
pylib/util.py
=====================================
--- a/pylib/util.py
+++ b/pylib/util.py
@@ -387,11 +387,15 @@ def unitify(value, startingunit, baseunit=None, width=8):
def f8dot4(f):
"Scaled floating point formatting to fit in 8 characters"
+ if isinstance(f, basestring):
+ # a string? pass it on as a signal
+ return "%8s" % f
+ if not isinstance(f, (int, long, float)):
+ # huh?
+ return " X"
if str(float(f)).lower() == 'nan':
# yes, this is a better test than math.isnan()
# it also catches None, strings, etc.
- if isinstance(s, basestring):
- return "%8s" % f
return " nan"
fmt = "%8d" # xxxxxxxx
@@ -420,11 +424,15 @@ def f8dot4(f):
def f8dot3(f):
"Scaled floating point formatting to fit in 8 characters"
+ if isinstance(f, basestring):
+ # a string? pass it on as a signal
+ return "%8s" % f
+ if not isinstance(f, (int, long, float)):
+ # huh?
+ return " X"
if str(float(f)).lower() == 'nan':
# yes, this is a better test than math.isnan()
# it also catches None, strings, etc.
- if isinstance(s, basestring):
- return "%8s" % f
return " nan"
fmt = "%8d" % f # xxxxxxxx or -xxxxxxx
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/compare/68863d4b9f152f0a06e4029af1f5c85a843c9712...e7a4dbfba04bc7d8d402a37d6437f7b5e8e4f7bc
---
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/compare/68863d4b9f152f0a06e4029af1f5c85a843c9712...e7a4dbfba04bc7d8d402a37d6437f7b5e8e4f7bc
You're receiving this email because of your account on gitlab.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ntpsec.org/pipermail/vc/attachments/20170808/452f5b50/attachment.html>
More information about the vc
mailing list