From owner-freebsd-bugs Tue Aug 24 19:51:25 1999 Delivered-To: freebsd-bugs@freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.ORG [204.216.27.21]) by hub.freebsd.org (Postfix) with ESMTP id 1627E14E18 for ; Tue, 24 Aug 1999 19:51:09 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.9.3/8.9.2) id TAA59215; Tue, 24 Aug 1999 19:50:01 -0700 (PDT) (envelope-from gnats@FreeBSD.org) 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 X-Send-Pr-Version: 3.2 Subject: bin/13364: Patch to wc(1) for Unix 98 compliance. Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org >Number: 13364 >Category: bin >Synopsis: Patch to wc(1) for Unix 98 compliance. >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Tue Aug 24 19:50:01 PDT 1999 >Closed-Date: >Last-Modified: >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: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message