Allow ptree(1) to wrap output
Review Request #2455 - Created Nov. 13, 2019 and submitted
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.
For cstyle this should be
if (wflag == 0), but I accept it matches the style of the rest of the file.
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.