I'm looking at what's involved in fixing
 6782154 one copy of parse_output_fields() & friends is enough.
and specifically at generalizing the functionality in ipmpstat's
ofmt_output* functions  so that it can be shared by flowadm
and dladm.

There's a lot of common code here, but ipmpstat has
one new feature: adjusting the output based on window size.
In order to do this, ipmpstat tracks the window size using
TIOCGWINSZ, and also has a signal handler for SIGWINCH to dynamically
track changes to winsize.

The adjustments for winsize are a nice feature, and I would
like to extend this for all the *adm apps. But then the question
arises: who should dynamically track the winsize changes? The
options are
1. tell the app to pass winsize to library when it calls the
   output functions. It's the caller's job to track the changes
   to winsize through signal handlers. This puts a lot of burden
   on the app (to track SIGWINCH) but keeps the library interface
   clean and free of side-effects.

2. have the caller pass a boolean adjust_to_current_winsize 
   parameter when they set up the handle for printing output.
   This means that the library will install a signal handler
   for SIGWINCH (which may clobber user signal handlers for this
   signal). And if adjust_to_current_winsize is set to FALSE,
   then the output will potentially overflow the screen etc. 

Both options have advantages and disadvantages.  
Any opinions onw which one is more attractive?

--Sowmini



Reply via email to