[Bug 286373] Teach fmt(1) to query stdout's width

From: <bugzilla-noreply_at_freebsd.org>
Date: Sat, 26 Apr 2025 22:04:54 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=286373

            Bug ID: 286373
           Summary: Teach fmt(1) to query stdout's width
           Product: Base System
           Version: Unspecified
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: bin
          Assignee: bugs@FreeBSD.org
          Reporter: freebsd-2024@virtual-estates.net

Created attachment 259899
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=259899&action=edit
The patch for fmt.1 and fmt.c

The simple patch adds options -A and -a, which would cause fmt to set the
maximum and goal widths to that of the TTY used for output.

If querying of the TTY fails -- such as because stdout is not, actually, a TTY
-- the flags are ignored. In case of -A the failure will emit a warning,
whereas using -a will cause fmt to ignore the failure quietly.

The idea is to allow formatting texts sensibly both for wide windows and narrow
windows.

-- 
You are receiving this mail because:
You are the assignee for the bug.