From 8bec423b9f1beceb32bde6cd795db350f7dfeaf8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sven=20M=C3=A4der?= <maeder@phys.ethz.ch> Date: Wed, 17 Jul 2024 16:27:08 +0200 Subject: [PATCH] Update prettyping --- profile/_assets/bin/prettyping | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/profile/_assets/bin/prettyping b/profile/_assets/bin/prettyping index 8a22efd..cd93a24 100755 --- a/profile/_assets/bin/prettyping +++ b/profile/_assets/bin/prettyping @@ -9,11 +9,14 @@ # * ping (from iputils) # # More information: -# http://denilsonsa.github.io/prettyping/ +# https://denilsonsa.github.io/prettyping/ # https://github.com/denilsonsa/prettyping -# http://www.reddit.com/r/linux/comments/1op98a/prettypingsh_a_better_ui_for_watching_ping/ +# https://old.reddit.com/r/linux/comments/1op98a/prettypingsh_a_better_ui_for_watching_ping/ # Third-party demonstration video: https://www.youtube.com/watch?v=ziEMY1BcikM +# TODO: Test in original-awk: +# https://aur.archlinux.org/packages/original-awk +# https://sources.debian.org/src/original-awk/ # TODO: Adjust how many items in the legend are printed based on the terminal width. # # TODO: Detect the following kinds of message and avoid printing it repeatedly. @@ -35,7 +38,7 @@ # TODO: Autodetect the width of printf numbers, so they will always line up correctly. # # TODO: Test the behavior of this script upon receiving out-of-order packets, like these: -# http://www.blug.linux.no/rfc1149/pinglogg.txt +# https://web.archive.org/web/20130531083142/http://www.blug.linux.no/rfc1149/pinglogg.txt # # TODO? How will prettyping behave if it receives a duplicate response? @@ -75,7 +78,7 @@ EOF } # Thanks to people at #bash who pointed me at -# http://bash-hackers.org/wiki/doku.php/scripting/posparams +# https://web.archive.org/web/20100301171512/https://bash-hackers.org/wiki/doku.php/scripting/posparams parse_arguments() { USE_COLOR=1 USE_MULTICOLOR=1 @@ -176,7 +179,7 @@ parse_arguments() { fi # Workaround for mawk: - # http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=593504 + # https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=593504 local version="$(echo | "${AWK_BIN}" -W version 2>&1)" if [[ "${version}" == mawk* ]] ; then AWK_PARAMS+=(-W interactive) @@ -639,8 +642,8 @@ BEGIN { ESC_RED_ON_YELLOW = "\033[43;31m" } # Other escape codes, see: - # http://en.wikipedia.org/wiki/ANSI_escape_code - # http://invisible-island.net/xterm/ctlseqs/ctlseqs.html + # https://en.wikipedia.org/wiki/ANSI_escape_code + # https://invisible-island.net/xterm/ctlseqs/ctlseqs.html ESC_NEXTLINE = "\n" ESC_CURSORUP = "\033[A" ESC_CURSORDOWN = "\033[B" @@ -652,7 +655,7 @@ BEGIN { ESC_UNSAVEPOS = "\0338" # I am avoiding these escapes as they are not listed in: - # http://vt100.net/docs/vt100-ug/chapter3.html + # https://vt100.net/docs/vt100-ug/chapter3.html #ESC_PREVLINE = "\033[F" #ESC_SAVEPOS = "\033[s" #ESC_UNSAVEPOS = "\033[u" @@ -742,7 +745,7 @@ BEGIN { ############################################################ # Main loop { - if ( $0 ~ /^[0-9]+ bytes from .*: icmp_[rs]eq=[0-9]+ ttl=[0-9]+ time=[0-9.]+ *ms/ ) { + if ( $0 ~ /^[0-9]+ bytes from .*[:,] icmp_[rs]eq=[0-9]+ (ttl|hlim)=[0-9]+ time=[0-9.]+ *ms/ ) { # Sample line from ping: # 64 bytes from 8.8.8.8: icmp_seq=1 ttl=49 time=184 ms if ( other_line_times >= 2 ) { @@ -751,7 +754,7 @@ BEGIN { # $1 = useless prefix string # $2 = icmp_seq - # $3 = ttl + # $3 = ttl/hlim # $4 = time # This must be called before incrementing the last_seq variable! @@ -778,7 +781,7 @@ BEGIN { print_statistics_bar_if_terminal() } else if ( $0 ~ /^.*onnected to.*, seq=[0-9]+ time=[0-9.]+ *ms/ ) { # Sample line from httping: - # connected to 200.149.119.168:80 (273 bytes), seq=0 time=129.86 ms + # connected to 200.149.119.168:80 (273 bytes), seq=0 time=129.86 ms if ( other_line_times >= 2 ) { other_line_finished_repeating() } -- GitLab