Allow ptree(1) to wrap output

Review Request #2455 — Created Nov. 14, 2019 and submitted

jbk
illumos-gate
11963
general

Currently ptree(1) truncates each line at the current width of the terminal. The -w option disables this behavior and allows the lines to wrap.

Run versions of ptree(1) with and without this patch and compared output and verified lines being truncated without the -w option matched between versions, and were not truncated when run with the -w on the patched binary.

  • 0
  • 0
  • 1
  • 1
  • 2
Description From Last Updated
andy_js
  1. 
      
  2. usr/src/cmd/ptools/ptree/ptree.c (Diff revision 1)
     
     

    I think "wrap lines instead of truncating" would be clearer, but I can live with this.

  3. 
      
citrus
  1. 
      
  2. usr/src/cmd/ptools/ptree/ptree.c (Diff revision 1)
     
     

    For cstyle this should be if (wflag == 0), but I accept it matches the style of the rest of the file.

  3. usr/src/cmd/ptools/ptree/ptree.c (Diff revision 1)
     
     

    Since you aren't even setting columns any more if wflag is not set, why do this calculation in that case?

    I'd just move the whole thing down inside if (p->pid >=0) and only do this is wflag is not set.

  4. 
      
jbk
andy_js
  1. Ship It!
  2. 
      
citrus
  1. Ship It!
  2. 
      
jbk
Review request changed

Status: Closed (submitted)

Loading...