Bug 292408 - synopsis of wc command
Summary: synopsis of wc command
Status: Closed FIXED
Alias: None
Product: Documentation
Classification: Unclassified
Component: Manual Pages (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Many People
Assignee: Alexander Ziaee
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2026-01-12 15:02 UTC by Sebastian
Modified: 2026-02-05 22:01 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Sebastian 2026-01-12 15:02:41 UTC
(so less priority as available)

The synopsis of wc command is not correct, because c and m flag are not together usable.

Manual file part...

SYNOPSIS
     wc [--libxo] [-Lclmw] [file ...]
...

-c      ... This will cancel out any prior usage of the -m option.
...
-m      ... This will cancel out any prior usage of the -c option.


This is different to GNU implementation, because GNU wc supports both flags together. But the problem is only the not clarify SYNOPSIS or the implementation allow both together


Source code part /usr/bin/wc/wc.c lines 104 / 111:
while ((ch = getopt(argc, argv, "clmwL")) != -1)
		switch((char)ch) {
		case 'l':
			doline = true;
			break;
		case 'w':
			doword = true;
			break;
		case 'c':
			dochar = true;
			domulti = false;
			break;
		case 'L':
			dolongline = true;
			break;
		case 'm':
			domulti = true;
			dochar = false;
			break;
		case '?':
		default:
			usage();
		}
Comment 1 commit-hook freebsd_committer freebsd_triage 2026-01-12 21:18:52 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=4cb65fde79a2412558d10fdbf3427fc0e4536d80

commit 4cb65fde79a2412558d10fdbf3427fc0e4536d80
Author:     Alexander Ziaee <ziaee@FreeBSD.org>
AuthorDate: 2026-01-12 21:04:54 +0000
Commit:     Alexander Ziaee <ziaee@FreeBSD.org>
CommitDate: 2026-01-12 21:18:04 +0000

    wc: Fix usage and manual SYNOPSIS + nits

    The -c and -m flags are mututally exclusive. Also minor manual fixes:

    + Angle quotes do not work in prose, use double quote matching extant
    + Align manual page options list
    + Tag SPDX license identifier for manual

    PR:             292408
    MFC after:      3 days

 usr.bin/wc/wc.1 | 12 ++++++++----
 usr.bin/wc/wc.c |  2 +-
 2 files changed, 9 insertions(+), 5 deletions(-)
Comment 2 commit-hook freebsd_committer freebsd_triage 2026-02-05 21:51:42 UTC
A commit in branch stable/15 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=093b16a63674a8ac3087020b92072936d15df7bf

commit 093b16a63674a8ac3087020b92072936d15df7bf
Author:     Alexander Ziaee <ziaee@FreeBSD.org>
AuthorDate: 2026-01-12 21:04:54 +0000
Commit:     Alexander Ziaee <ziaee@FreeBSD.org>
CommitDate: 2026-02-05 21:49:54 +0000

    wc: Fix usage and manual SYNOPSIS + nits

    The -c and -m flags are mututally exclusive. Also minor manual fixes:

    + Angle quotes do not work in prose, use double quote matching extant
    + Align manual page options list
    + Tag SPDX license identifier for manual

    PR:             292408
    MFC after:      3 days

    (cherry picked from commit 4cb65fde79a2412558d10fdbf3427fc0e4536d80)

 usr.bin/wc/wc.1 | 12 ++++++++----
 usr.bin/wc/wc.c |  2 +-
 2 files changed, 9 insertions(+), 5 deletions(-)
Comment 3 commit-hook freebsd_committer freebsd_triage 2026-02-05 21:54:45 UTC
A commit in branch stable/14 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=e1eb82fb18446995359cffcb66162ec1f462ed88

commit e1eb82fb18446995359cffcb66162ec1f462ed88
Author:     Alexander Ziaee <ziaee@FreeBSD.org>
AuthorDate: 2026-01-12 21:04:54 +0000
Commit:     Alexander Ziaee <ziaee@FreeBSD.org>
CommitDate: 2026-02-05 21:53:35 +0000

    wc: Fix usage and manual SYNOPSIS + nits

    The -c and -m flags are mututally exclusive. Also minor manual fixes:

    + Angle quotes do not work in prose, use double quote matching extant
    + Align manual page options list
    + Tag SPDX license identifier for manual

    PR:             292408
    MFC after:      3 days

    (cherry picked from commit 4cb65fde79a2412558d10fdbf3427fc0e4536d80)

 usr.bin/wc/wc.1 | 12 ++++++++----
 usr.bin/wc/wc.c |  2 +-
 2 files changed, 9 insertions(+), 5 deletions(-)
Comment 4 Alexander Ziaee freebsd_committer freebsd_triage 2026-02-05 22:01:25 UTC
Thanks for reporting this Sebastian!