HomeFreeBSD

ps(1): Move 'width' field from VAR to VARENT; Remove sizevars()

Description

ps(1): Move 'width' field from VAR to VARENT; Remove sizevars()

Some column's width depends not only on the information displayed but
also on the its header, which may have been customized. Consequently,
that width is a property of the actual column and should not be attached
to the keyword specifying which information to print.

This change fixes a bug where multiple columns displaying the same
information (same keyword) but with different headers would have the
same width, although they should not if they have long enough headers
that have different lengths (the width computed from the largest header
would be applied to all the corresponding keyword's columns).

Remove sizevars(), as the 'width' field is now initialized directly in
parsefmt(), which creates the VARENT structures.

While here, remove var[]'s sentinel line, and consequently adjust the
upper limit in showkey()'s loop and findvar()'s binary search.

MFC after: 3 days
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D49610

Details

Provenance
olceAuthored on Feb 28 2025, 6:30 PM
Differential Revision
D49610: ps(1): Move 'width' field from VAR to VARENT; Remove sizevars()
Parents
rGc1e5a7fdad63: ps(1): find_varentry() to take a name instead of a VAR
Branches
Unknown
Tags
Unknown