Index | Thread | Search

From:
Stuart Henderson <stu@spacehopper.org>
Subject:
Re: fold(1): document -width option
To:
Alexander Farber <alexander.farber@gmail.com>
Cc:
tech@openbsd.org
Date:
Tue, 6 Jan 2026 15:16:43 +0000

Download raw body.

Thread
On 2026/01/06 16:04, Alexander Farber wrote:
> Hi,
> 
> fold(1) accepts -72 as shorthand for -w 72, same as fmt(1), but it's
> not documented. This adds it to the man page and usage().

iirc there are various utilities which accept this format for legacy
reasons but it's intentionally undocumented

> ok?
> 
> Index: src/usr.bin/fold/fold.1
> ===================================================================
> RCS file: /cvs/src/usr.bin/fold/fold.1,v
> retrieving revision 1.19
> diff -u -r1.19 fold.1
> --- src/usr.bin/fold/fold.1 24 Oct 2016 13:46:58 -0000 1.19
> +++ src/usr.bin/fold/fold.1 6 Jan 2026 13:46:25 -0000
> @@ -39,7 +39,7 @@
>  .Sh SYNOPSIS
>  .Nm fold
>  .Op Fl bs
> -.Op Fl w Ar width
> +.Op Fl w Ar width | Fl Ar width
>  .Op Ar
>  .Sh DESCRIPTION
>  .Nm
> @@ -59,8 +59,14 @@
>  after the last blank character.
>  This is useful to avoid line breaks in the middle of words, if
>  possible.
> -.It Fl w Ar width
> +.It Fl w Ar width | Fl Ar width
>  Specifies a line width to use instead of the default of 80.
> +The
> +.Fl Ar width
> +form (e.g.,
> +.Fl 72 )
> +is equivalent to
> +.Fl w Ar width .
>  .El
>  .Pp
>  Unless
> Index: src/usr.bin/fold/fold.c
> ===================================================================
> RCS file: /cvs/src/usr.bin/fold/fold.c,v
> retrieving revision 1.18
> diff -u -r1.18 fold.c
> --- src/usr.bin/fold/fold.c 23 May 2016 10:31:42 -0000 1.18
> +++ src/usr.bin/fold/fold.c 6 Jan 2026 13:46:25 -0000
> @@ -268,6 +268,6 @@
>  static __dead void
>  usage(void)
>  {
> - (void)fprintf(stderr, "usage: fold [-bs] [-w width] [file ...]\n");
> + (void)fprintf(stderr, "usage: fold [-bs] [-w width | -width] [file ...]\n");
>   exit(1);
>  }
>