[Git][NTPsec/ntpsec][master] 2 commits: Typo fix.

Eric S. Raymond gitlab at mg.gitlab.com
Tue Dec 13 15:31:18 UTC 2016


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


Commits:
522536dd by Eric S. Raymond at 2016-12-13T10:08:29-05:00
Typo fix.

- - - - -
91c6391e by Eric S. Raymond at 2016-12-13T10:28:40-05:00
Give ntpmon some commands to alter report formatting.

- - - - -


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
@@ -39,4 +39,23 @@ Command line options are described following.
 
 If no hostname is specified on the command line, localhost is monitored.
 
+== Commands ==
+
+A few single-keystroke commands are available.
+
+a:: Change peer display to apeers mode, showing association IDs.
+
+n:: Toggle display of hostnames (vs. IP addresses).
+
+o:: Change peer display to opeers mode, showing destination address.
+
+p:: Change peer display to default mode, showing refid
+
+q:: Cleanly terminate the program.
+
+w:: Toggle wide mode.
+
+x:: Cleanly terminate the program.
+
+
 // end


=====================================
ntpclients/ntpmon
=====================================
--- a/ntpclients/ntpmon
+++ b/ntpclients/ntpmon
@@ -57,6 +57,7 @@ class OutputContext:
         global stdscr
         stdscr = curses.initscr()
         curses.curs_set(0)
+        curses.cbreak()
     def __exit__(self, extype_unused, value_unused, traceback_unused):
         curses.endwin()
 
@@ -152,8 +153,26 @@ if __name__ == '__main__':
                     pass
                 # Display all
                 stdscr.refresh()
-                # Nyquist-interval sampling
-                time.sleep(min(hpolls) / 2)
+                # Nyquist-interval sampling - half the smallest poll interval
+                # seen in the last cycle, rounded up to 1 second.
+                stdscr.timeout(int((min(hpolls) / 2) + 0.5))
+                try:
+                    key = stdscr.getkey()
+                    if key == 'q' or key == 'x':
+                        raise SystemExit(0)
+                    elif key == 'a':
+                        peer_report.displaymode = 'apeers'
+                    elif key == 'o':
+                        peer_report.displaymode = 'opeers'
+                    elif key == 'p':
+                        peer_report.displaymode = 'peers'
+                    elif key == 'w':
+                        peer_report.wideremote = not peer_report.wideremote
+                    elif key == 'n':
+                        peer_report.showhostnames = not peer_report.showhostnames
+                        mru_report.showhostnames = not mru_report.showhostnames
+                except curses.error:
+                    pass
     except KeyboardInterrupt:
         print("")
     except (Fatal, ntp.packet.ControlException) as e:


=====================================
pylib/util.py
=====================================
--- a/pylib/util.py
+++ b/pylib/util.py
@@ -100,7 +100,7 @@ def termsize():
 class PeerSummary:
     "Reusable report generator for peer statistics"
     def __init__(self, displaymode, pktversion, showhostnames, wideremote, termwidth=None, debug=0):
-        self.displaymode = displaymode		# peers/apeers.opeers
+        self.displaymode = displaymode		# peers/apeers/opeers
         self.pktversion = pktversion		# interpretation of flash bits
         self.showhostnames = showhostnames	# If false, display numeric IPs
         self.wideremote = wideremote		# show wide remote names?



View it on GitLab: https://gitlab.com/NTPsec/ntpsec/compare/c998b665b959ec77abf6941399c4e9093e25b71c...91c6391ec2bb6083749922568cd76caaedabd4f4
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ntpsec.org/pipermail/vc/attachments/20161213/ec0eddd3/attachment.html>


More information about the vc mailing list