From owner-freebsd-audit Tue Aug 21 12: 1:30 2001 Delivered-To: freebsd-audit@freebsd.org Received: from coffee.q9media.com (coffee.q9media.com [216.94.229.19]) by hub.freebsd.org (Postfix) with ESMTP id E359437B40C for ; Tue, 21 Aug 2001 12:01:13 -0700 (PDT) (envelope-from mike@coffee.q9media.com) Received: (from mike@localhost) by coffee.q9media.com (8.11.2/8.11.3) id f7LJNeR54813 for audit@FreeBSD.org; Tue, 21 Aug 2001 15:23:40 -0400 (EDT) (envelope-from mike) Date: Tue, 21 Aug 2001 15:23:39 -0400 From: Mike Barcroft To: audit@FreeBSD.org Subject: wc(1) warns patch Message-ID: <20010821152339.A54793@coffee.q9media.com> Mail-Followup-To: Mike Barcroft , audit@FreeBSD.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i Organization: The FreeBSD Project Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG I would appreciate comments on the following patch to wc(1). I would like to commit it shortly. Best regards, Mike Barcroft ---------------------------------------------------------------------- wc.20010821.patch o Quiet warnings on alpha o Constify, staticize, set WARNS=2 Index: wc/Makefile =================================================================== RCS file: /home/ncvs/src/usr.bin/wc/Makefile,v retrieving revision 1.1.1.1 diff -u -r1.1.1.1 Makefile --- wc/Makefile 1994/05/27 12:33:28 1.1.1.1 +++ wc/Makefile 2001/08/20 03:47:24 @@ -1,5 +1,6 @@ # @(#)Makefile 8.1 (Berkeley) 6/6/93 PROG= wc +WARNS?= 2 .include Index: wc/wc.c =================================================================== RCS file: /home/ncvs/src/usr.bin/wc/wc.c,v retrieving revision 1.11 diff -u -r1.11 wc.c --- wc/wc.c 1999/08/28 01:07:34 1.11 +++ wc/wc.c 2001/08/20 03:47:24 @@ -58,11 +58,11 @@ #include #include -u_quad_t tlinect, twordct, tcharct; +unsigned long long tlinect, twordct, tcharct; int doline, doword, dochar; -int cnt __P((char *)); -void usage __P((void)); +static int cnt __P((const char *)); +static void usage __P((void)); int main(argc, argv) @@ -113,22 +113,22 @@ if (total > 1) { if (doline) - (void)printf(" %7qu", tlinect); + (void)printf(" %7llu", tlinect); if (doword) - (void)printf(" %7qu", twordct); + (void)printf(" %7llu", twordct); if (dochar) - (void)printf(" %7qu", tcharct); + (void)printf(" %7llu", tcharct); (void)printf(" total\n"); } exit(errors == 0 ? 0 : 1); } -int +static int cnt(file) - char *file; + const char *file; { struct stat sb; - u_quad_t linect, wordct, charct; + unsigned long long linect, wordct, charct; int fd, len; short gotsp; u_char *p; @@ -163,10 +163,10 @@ ++linect; } tlinect += linect; - (void)printf(" %7qu", linect); + (void)printf(" %7llu", linect); if (dochar) { tcharct += charct; - (void)printf(" %7qu", charct); + (void)printf(" %7llu", charct); } (void)close(fd); return (0); @@ -217,21 +217,21 @@ } if (doline) { tlinect += linect; - (void)printf(" %7qu", linect); + (void)printf(" %7llu", linect); } if (doword) { twordct += wordct; - (void)printf(" %7qu", wordct); + (void)printf(" %7llu", wordct); } if (dochar) { tcharct += charct; - (void)printf(" %7qu", charct); + (void)printf(" %7llu", charct); } (void)close(fd); return (0); } -void +static void usage() { (void)fprintf(stderr, "usage: wc [-clw] [file ...]\n"); To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message