Code

implement some prettyping-inspired display instead of textual
authorAntoine Beaupré <anarcat@koumbit.org>
Tue, 3 Dec 2013 01:45:58 +0000 (20:45 -0500)
committerAntoine Beaupré <anarcat@koumbit.org>
Tue, 3 Dec 2013 01:46:21 +0000 (20:46 -0500)
commit68d713ec1a7027113f1fa20df598a63539511593
tree24326e9ab30e50034bbf9fba2db1e5d51fd46fc4
parent6d493d2cd86d7f0217a06d20789ea06f244389c6
implement some prettyping-inspired display instead of textual

this is a first stab at porting "prettyping.sh" into noping. the idea
is to show a histogram of ping times instead of numerical values. with
some work, we could actually show both, but this focuses on
implementing the hard part (the histogram) properly.

it is very rudimentary for now:

 * the math may be wrong for the size of the bar, I was mostly in a
   rush to make unicode work and have something pretty quickly.

 * all hosts are on the same line: each should have its own line

 * the histogram should be displayed in a separate window

 * it should use background colors as well

 * it should fallback when the terminal is not unicode-capable

 * the scaling logic is fully automatic, which necessarily gives weird
   results at first

this requires switching to the ncursesw library and other unicode
ncurses hackery described in this post:

http://newsgroups.derkeiler.com/Archive/Rec/rec.games.roguelike.development/2010-09/msg00050.html

pretty ping is a awk/bash script, MIT-licensed, available here:

https://bitbucket.org/denilsonsa/small_scripts/src/tip/prettyping.sh
src/Makefile.am
src/oping.c
src/oping.h