Bug 13364

Summary: Patch to wc(1) for Unix 98 compliance.
Product: Base System Reporter: howardjp <howardjp>
Component: standardsAssignee: freebsd-standards (Nobody) <standards>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: 3.2-STABLE   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
file.diff none

Description howardjp 1999-08-25 03:50:01 UTC
Unix 98 requires wc(1) to accept a -m argument.  -m makes wc print out
the number of characters in file in place of the bytes (-c).  This is 
for systems (like DOS) which use two characters for a newline.  Under
FreeBSD and other Unices, this will simply be a synonym for -c.  This
diff will add a -m to wc (which falls through to the -c code) and a 
comment explaing why it is there.  The man page is also updated.

How-To-Repeat: 
wc -m gives an illegal option error
Comment 1 Sheldon Hearn 1999-08-25 10:11:41 UTC
On Tue, 24 Aug 1999 22:42:13 -0400, James Howard wrote:

> ! .Nd word, line, and byte count
> ! .Nd word, line, byte, and character count

Since the manpage is read in the context of FreeBSD, the distinction
between bytes and characters is weird. I'd leave that change out.

> + .It Fl m
> + The number of characters in each input file
> + is written to the standard output.

The same reasoing applies here. I'd say

.It Fl m
Identical to -c, for compatibility with systems which distinguish
between bytes and characters.

While your change is cool now, you're putting worms in a can that
someone's going to have to open up one day when we use two-byte
characters. :)

> + If 
> + .Fl c 
> + and 
> + .Fl m
> + are both specified, the information is given only once.

With the change of wording I've suggested above, this text is probably
unnecessary and certainly confusing.

> + 		case 'm':
> + 			/*
> + 			 * Unix 98 demands that wc accept a -m argument

Far too respectful towards the OpenGroup spec. ;-)

		case 'm':	/* Unix 98 compatibility option */
			/* FALLTHROUGH */

If you don't like the side-by-side comment, there seems to be a healthy
precedent in the source tree for having the comment immediately _above_
the case line.

Later,
Sheldon.
Comment 2 howardjp 1999-08-25 16:37:10 UTC
On Wed, 25 Aug 1999, Sheldon Hearn wrote:

> 
> 
> On Tue, 24 Aug 1999 22:42:13 -0400, James Howard wrote:
> 
> > ! .Nd word, line, and byte count
> > ! .Nd word, line, byte, and character count
> 
> Since the manpage is read in the context of FreeBSD, the distinction
> between bytes and characters is weird. I'd leave that change out.

I added that at the last minute even though I didn't like it so there are
no problems here.

> While your change is cool now, you're putting worms in a can that
> someone's going to have to open up one day when we use two-byte
> characters. :)

Uhg, I was totally blind-sided by that one.  How far is FreeBSD from
Unicode support?  Has anyoen started?  Anyone talking about it?
 
> With the change of wording I've suggested above, this text is probably
> unnecessary and certainly confusing.

We had the discussion on FreeBSD documentation being correct yesterday.  I
am sure everyone can agree the manpages for any Unix are confusing :)
 
> 		case 'm':	/* Unix 98 compatibility option */
> 			/* FALLTHROUGH */
> 
> If you don't like the side-by-side comment, there seems to be a healthy
> precedent in the source tree for having the comment immediately _above_
> the case line.

You're the boss, however you see is fit.  :)

Jamie
Comment 3 Sheldon Hearn 1999-08-25 16:40:09 UTC
On Wed, 25 Aug 1999 11:37:10 -0400, James Howard wrote:

> Uhg, I was totally blind-sided by that one.  How far is FreeBSD from
> Unicode support?  Has anyoen started?  Anyone talking about it?

Not sure how far away it is. I'm almost sure _someone_ is working on it.
I just know that I've been shot down a couple of times for making things
worse for that fateful day. :-)

> You're the boss, however you see is fit.  :)

Hardly. I'm just passing on what I've learned over the last few months.
Remember, this is _peer_ review. ;-)

Ciao,
Sheldon.
Comment 4 howardjp 1999-08-25 16:53:29 UTC
On Wed, 25 Aug 1999, Sheldon Hearn wrote:

> Not sure how far away it is. I'm almost sure _someone_ is working on it.
> I just know that I've been shot down a couple of times for making things
> worse for that fateful day. :-)

Okay, I looked at this.  It will be broken, sort of, until wchar_t
supporting functions are added.  Then I don't think the change will be
that big.  Basically, you'll add another variable.  Then break apart -c
and -m.  One will read a byte, the other a character.

> Hardly. I'm just passing on what I've learned over the last few months.
> Remember, this is _peer_ review. ;-)

It was comment structure.  If I had my way, there would be no comments at
all :)

Jamie
Comment 5 Johan Karlsson freebsd_committer freebsd_triage 2002-06-05 01:38:48 UTC
Responsible Changed
From-To: freebsd-bugs->freebsd-standards

Standard issue
Comment 6 Johan Karlsson freebsd_committer freebsd_triage 2002-08-25 03:12:48 UTC
Responsible Changed
From-To: freebsd-standards->standards

Use short names for mailing list to make searches    
using the web query form work with the shown responsible. 

This also makes open PRs show up in the summery mail.
Comment 7 Tim Robbins freebsd_committer freebsd_triage 2002-08-25 03:28:28 UTC
State Changed
From-To: open->patched

The -m option has been implemented in -CURRENT.
Comment 8 Tim Robbins freebsd_committer freebsd_triage 2002-08-25 06:58:25 UTC
State Changed
From-To: patched->closed

-m option has been MFC'd.
Comment 9 Alexander Best freebsd_committer freebsd_triage 2010-10-14 16:38:02 UTC
Responsible Changed
From-To: standards->freebsd-standards

Over to maintainer(s).