Page MenuHomeFreeBSD

column(1): add -l flag
ClosedPublic

Authored by ivy on May 10 2025, 9:38 PM.
Tags
None
Referenced Files
F119642276: D50290.id155369.diff
Tue, Jun 10, 7:48 PM
Unknown Object (File)
Sun, Jun 8, 4:13 AM
Unknown Object (File)
Fri, Jun 6, 12:03 PM
Unknown Object (File)
Thu, Jun 5, 6:46 AM
Unknown Object (File)
Wed, Jun 4, 1:16 PM
Unknown Object (File)
Wed, Jun 4, 8:00 AM
Unknown Object (File)
Sat, May 31, 4:16 PM
Unknown Object (File)
Thu, May 22, 4:21 PM
Subscribers

Details

Reviewers
des
kevans
Group Reviewers
manpages
Commits
rG313713b24c6d: column(1): add -l flag
Summary

the '-l <tblcols>' flag limits the number of columns that column(1) will
produce in -t mode. this is syntax-compatible with the same option in
util-linux's column(1), but due to existing differences between the two
implementations, it's not semantically compatible.

as a side-effect, fix a pre-existing bug where empty fields could cause
incorrect output:

% echo ':' | column -ts:
(null)

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 64123
Build 61007: arc lint + arc unit

Event Timeline

ivy requested review of this revision.May 10 2025, 9:38 PM

will bump Dd before landing

Manual looks fine to me.

des requested changes to this revision.May 11 2025, 12:33 PM
des added inline comments.
usr.bin/column/column.c
100

I'd prefer strtonum() here (and for termwidth above, while you're at it). See for instance rGd7399551b028.

243
259

When breaking an expression across two or more lines, the operator goes at the end of the first line, not the start of the second.

This revision now requires changes to proceed.May 11 2025, 12:33 PM
usr.bin/column/column.c
346–347

if you're in the mood, this blank line is no longer required by style(9)

ivy marked 4 inline comments as done.

review fixes

des added inline comments.
usr.bin/column/column.1
28

don't forget to bump!

usr.bin/column/column.c
72

nit: errstr should come first (size, then name)

104

preexisting nit: this multiplication can overflow, using calloc() instead is safer as it deals with that possibility for you (as long as you don't mind the negligible added cost possibly having to zero the newly allocated memory)

This revision is now accepted and ready to land.Tue, May 13, 10:25 AM
This revision was automatically updated to reflect the committed changes.