From howardjp@wam.umd.edu Tue Aug 24 19:45:11 1999 Return-Path: Received: from majordomo2.umd.edu (majordomo2.umd.edu [128.8.10.7]) by hub.freebsd.org (Postfix) with ESMTP id 1B2D415193 for ; Tue, 24 Aug 1999 19:45:10 -0700 (PDT) (envelope-from howardjp@wam.umd.edu) Received: from rac9.wam.umd.edu (root@rac9.wam.umd.edu [128.8.10.149]) by majordomo2.umd.edu (8.9.3/8.9.3) with ESMTP id WAA20821 for ; Tue, 24 Aug 1999 22:42:11 -0400 (EDT) Received: from rac9.wam.umd.edu (sendmail@localhost [127.0.0.1]) by rac9.wam.umd.edu (8.9.3/8.9.3) with SMTP id WAA07667 for ; Tue, 24 Aug 1999 22:42:13 -0400 (EDT) Received: (from howardjp@localhost) by rac9.wam.umd.edu (8.9.3/8.9.3) id WAA07663 for FreeBSD-gnats-submit@freebsd.org; Tue, 24 Aug 1999 22:42:13 -0400 (EDT) Message-Id: <199908250242.WAA07663@rac9.wam.umd.edu> Date: Tue, 24 Aug 1999 22:42:13 -0400 (EDT) From: James Howard Reply-To: howardjp@wam.umd.edu To: FreeBSD-gnats-submit@freebsd.org Subject: Patch to wc(1) for Unix 98 compliance. X-Send-Pr-Version: 3.2 >Number: 13364 >Category: standards >Synopsis: Patch to wc(1) for Unix 98 compliance. >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-standards >State: closed >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Tue Aug 24 19:50:01 PDT 1999 >Closed-Date: Sat Aug 24 22:58:49 PDT 2002 >Last-Modified: Thu Oct 14 15:38:29 UTC 2010 >Originator: James Howard >Release: FreeBSD 3.2-STABLE i386 >Organization: University of Maryland >Environment: FreeBSD byzantine 3.2-STABLE FreeBSD 3.2-STABLE #5: Sat Aug 7 23:43:54 GMT 1999 root@byzantine:/usr/src/sys/compile/BYZANTINE i386 >Description: 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 >Fix: diff -c /usr/src/usr.bin/wc/wc.1 /usr/local/src/wc/wc.1 *** /usr/src/usr.bin/wc/wc.1 Mon Aug 25 06:44:58 1997 --- /usr/local/src/wc/wc.1 Tue Aug 24 16:26:35 1999 *************** *** 40,49 **** .Os .Sh NAME .Nm wc ! .Nd word, line, and byte count .Sh SYNOPSIS .Nm wc ! .Op Fl clw .Op Ar .Sh DESCRIPTION The --- 40,49 ---- .Os .Sh NAME .Nm wc ! .Nd word, line, byte, and character count .Sh SYNOPSIS .Nm wc ! .Op Fl clmw .Op Ar .Sh DESCRIPTION The *************** *** 71,76 **** --- 71,79 ---- .It Fl l The number of lines in each input file is written to the standard output. + .It Fl m + The number of characters in each input file + is written to the standard output. .It Fl w The number of words in each input file is written to the standard output. *************** *** 80,85 **** --- 83,93 ---- .Nm only reports the information requested by that option. The default action is equivalent to specifying all of the flags. + If + .Fl c + and + .Fl m + are both specified, the information is given only once. .Pp If no files are specified, the standard input is used and no file name is displayed. diff -c /usr/src/usr.bin/wc/wc.c /usr/local/src/wc/wc.c *** /usr/src/usr.bin/wc/wc.c Mon Aug 25 06:44:59 1997 --- /usr/local/src/wc/wc.c Tue Aug 24 16:03:02 1999 *************** *** 74,80 **** (void) setlocale(LC_CTYPE, ""); ! while ((ch = getopt(argc, argv, "lwc")) != -1) switch((char)ch) { case 'l': doline = 1; --- 74,80 ---- (void) setlocale(LC_CTYPE, ""); ! while ((ch = getopt(argc, argv, "lwmc")) != -1) switch((char)ch) { case 'l': doline = 1; *************** *** 82,87 **** --- 82,97 ---- case 'w': doword = 1; break; + case 'm': + /* + * Unix 98 demands that wc accept a -m argument + * which counts the number of characters in + * a file. This is for systems which might + * have a two byte newline or other strange + * characters. Under FreeBSD, this will be + * identical to -c. + */ + /* FALLTHROUGH */ case 'c': dochar = 1; break; *************** *** 236,241 **** void usage() { ! (void)fprintf(stderr, "usage: wc [-clw] [file ...]\n"); exit(1); } --- 246,251 ---- void usage() { ! (void)fprintf(stderr, "usage: wc [-clmw] [file ...]\n"); exit(1); } >Release-Note: >Audit-Trail: From: Sheldon Hearn To: howardjp@wam.umd.edu Cc: FreeBSD-gnats-submit@FreeBSD.ORG Subject: Re: bin/13364: Patch to wc(1) for Unix 98 compliance. Date: Wed, 25 Aug 1999 11:11:41 +0200 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. From: James Howard To: Sheldon Hearn Cc: FreeBSD-gnats-submit@FreeBSD.ORG Subject: Re: bin/13364: Patch to wc(1) for Unix 98 compliance. Date: Wed, 25 Aug 1999 11:37:10 -0400 (EDT) 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 From: Sheldon Hearn To: James Howard Cc: freebsd-gnats-submit@freebsd.org Subject: Re: bin/13364: Patch to wc(1) for Unix 98 compliance. Date: Wed, 25 Aug 1999 17:40:09 +0200 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. From: James Howard To: Sheldon Hearn Cc: freebsd-gnats-submit@freebsd.org Subject: Re: bin/13364: Patch to wc(1) for Unix 98 compliance. Date: Wed, 25 Aug 1999 11:53:29 -0400 (EDT) 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 Responsible-Changed-From-To: freebsd-bugs->freebsd-standards Responsible-Changed-By: johan Responsible-Changed-When: Tue Jun 4 17:38:48 PDT 2002 Responsible-Changed-Why: Standard issue http://www.freebsd.org/cgi/query-pr.cgi?pr=13364 Responsible-Changed-From-To: freebsd-standards->standards Responsible-Changed-By: johan Responsible-Changed-When: Sat Aug 24 19:12:48 PDT 2002 Responsible-Changed-Why: 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. http://www.freebsd.org/cgi/query-pr.cgi?pr=13364 State-Changed-From-To: open->patched State-Changed-By: tjr State-Changed-When: Sat Aug 24 19:28:28 PDT 2002 State-Changed-Why: The -m option has been implemented in -CURRENT. http://www.freebsd.org/cgi/query-pr.cgi?pr=13364 State-Changed-From-To: patched->closed State-Changed-By: tjr State-Changed-When: Sat Aug 24 22:58:25 PDT 2002 State-Changed-Why: -m option has been MFC'd. http://www.freebsd.org/cgi/query-pr.cgi?pr=13364 Responsible-Changed-From-To: standards->freebsd-standards Responsible-Changed-By: arundel Responsible-Changed-When: Thu Oct 14 15:38:02 UTC 2010 Responsible-Changed-Why: Over to maintainer(s). http://www.freebsd.org/cgi/query-pr.cgi?pr=13364 >Unformatted: