From owner-svn-src-head@FreeBSD.ORG Wed Nov 4 23:36:23 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8E0D61065698; Wed, 4 Nov 2009 23:36:23 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7C3668FC18; Wed, 4 Nov 2009 23:36:23 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nA4NaNnD050451; Wed, 4 Nov 2009 23:36:23 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nA4NaN8Q050439; Wed, 4 Nov 2009 23:36:23 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <200911042336.nA4NaN8Q050439@svn.freebsd.org> From: Xin LI Date: Wed, 4 Nov 2009 23:36:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r198934 - head/share/examples/ses/srcs X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Nov 2009 23:36:23 -0000 Author: delphij Date: Wed Nov 4 23:36:23 2009 New Revision: 198934 URL: http://svn.freebsd.org/changeset/base/198934 Log: Cleanup code to make it WARNS=6 clean: - ANSIfy prototypes; - Add __unused for parameters that is not being currently used; - Add a header for subrountines being called from other modules. Reviewed by: mjacob Added: head/share/examples/ses/srcs/eltsub.h (contents, props changed) Modified: head/share/examples/ses/srcs/chpmon.c head/share/examples/ses/srcs/eltsub.c head/share/examples/ses/srcs/getencstat.c head/share/examples/ses/srcs/getnobj.c head/share/examples/ses/srcs/getobjmap.c head/share/examples/ses/srcs/getobjstat.c head/share/examples/ses/srcs/inienc.c head/share/examples/ses/srcs/sesd.c head/share/examples/ses/srcs/setencstat.c head/share/examples/ses/srcs/setobjstat.c Modified: head/share/examples/ses/srcs/chpmon.c ============================================================================== --- head/share/examples/ses/srcs/chpmon.c Wed Nov 4 23:34:58 2009 (r198933) +++ head/share/examples/ses/srcs/chpmon.c Wed Nov 4 23:36:23 2009 (r198934) @@ -47,9 +47,7 @@ #define BADSTAT \ (SES_ENCSTAT_UNRECOV|SES_ENCSTAT_CRITICAL|SES_ENCSTAT_NONCRITICAL) int -main(a, v) - int a; - char **v; +main(int a, char **v) { int fd, delay, dev; ses_encstat stat, *carray; Modified: head/share/examples/ses/srcs/eltsub.c ============================================================================== --- head/share/examples/ses/srcs/eltsub.c Wed Nov 4 23:34:58 2009 (r198933) +++ head/share/examples/ses/srcs/eltsub.c Wed Nov 4 23:36:23 2009 (r198934) @@ -38,9 +38,10 @@ #include #include SESINC +#include "eltsub.h" + char * -geteltnm(type) - int type; +geteltnm(int type) { static char rbuf[132]; @@ -116,8 +117,7 @@ geteltnm(type) } static char * -scode2ascii(code) - u_char code; +scode2ascii(u_char code) { static char rbuf[32]; switch (code & 0xf) { @@ -154,9 +154,7 @@ scode2ascii(code) char * -stat2ascii(eletype, cstat) - int eletype; - u_char *cstat; +stat2ascii(int eletype __unused, u_char *cstat) { static char ebuf[256], *scode; Added: head/share/examples/ses/srcs/eltsub.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/share/examples/ses/srcs/eltsub.h Wed Nov 4 23:36:23 2009 (r198934) @@ -0,0 +1,36 @@ +/* $FreeBSD$ */ +/* + * Copyright (c) 2000 by Matthew Jacob + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer, + * without modification, immediately at the beginning of the file. + * 2. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * Alternatively, this software may be distributed under the terms of the + * the GNU Public License ("GPL"). + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * Matthew Jacob + * Feral Software + * mjacob@feral.com + */ + +char * geteltnm(int); +char * stat2ascii(int, u_char *); Modified: head/share/examples/ses/srcs/getencstat.c ============================================================================== --- head/share/examples/ses/srcs/getencstat.c Wed Nov 4 23:34:58 2009 (r198933) +++ head/share/examples/ses/srcs/getencstat.c Wed Nov 4 23:36:23 2009 (r198934) @@ -40,13 +40,10 @@ #include #include SESINC -extern char *geteltnm __P((int)); -extern char *stat2ascii __P((int, u_char *)); +#include "eltsub.h" int -main(a, v) - int a; - char **v; +main(int a, char **v) { ses_object *objp; ses_objstat ob; Modified: head/share/examples/ses/srcs/getnobj.c ============================================================================== --- head/share/examples/ses/srcs/getnobj.c Wed Nov 4 23:34:58 2009 (r198933) +++ head/share/examples/ses/srcs/getnobj.c Wed Nov 4 23:36:23 2009 (r198934) @@ -41,9 +41,7 @@ #include SESINC int -main(argc, argv) - int argc; - char **argv; +main(int argc, char **argv) { unsigned int nobj; int fd; Modified: head/share/examples/ses/srcs/getobjmap.c ============================================================================== --- head/share/examples/ses/srcs/getobjmap.c Wed Nov 4 23:34:58 2009 (r198933) +++ head/share/examples/ses/srcs/getobjmap.c Wed Nov 4 23:36:23 2009 (r198934) @@ -39,12 +39,10 @@ #include #include SESINC -extern char *geteltnm __P((int)); +#include "eltsub.h" int -main(a, v) - int a; - char **v; +main(int a, char **v) { ses_object *objp; int nobj, fd, i; Modified: head/share/examples/ses/srcs/getobjstat.c ============================================================================== --- head/share/examples/ses/srcs/getobjstat.c Wed Nov 4 23:34:58 2009 (r198933) +++ head/share/examples/ses/srcs/getobjstat.c Wed Nov 4 23:36:23 2009 (r198934) @@ -39,9 +39,7 @@ #include SESINC int -main(a, v) - int a; - char **v; +main(int a, char **v) { int fd; int i; Modified: head/share/examples/ses/srcs/inienc.c ============================================================================== --- head/share/examples/ses/srcs/inienc.c Wed Nov 4 23:34:58 2009 (r198933) +++ head/share/examples/ses/srcs/inienc.c Wed Nov 4 23:36:23 2009 (r198934) @@ -40,9 +40,7 @@ #include SESINC int -main(a, v) - int a; - char **v; +main(int a, char **v) { int fd; Modified: head/share/examples/ses/srcs/sesd.c ============================================================================== --- head/share/examples/ses/srcs/sesd.c Wed Nov 4 23:34:58 2009 (r198933) +++ head/share/examples/ses/srcs/sesd.c Wed Nov 4 23:36:23 2009 (r198934) @@ -49,13 +49,11 @@ */ int -main(a, v) - int a; - char **v; +main(int a, char **v) { - static char *usage = + static const char *usage = "usage: %s [ -d ] [ -t pollinterval ] device [ device ]\n"; - int fd, polltime, dev, devbase, nodaemon, bpri; + int fd, polltime, dev, devbase, nodaemon; ses_encstat stat, *carray; if (a < 2) { @@ -115,7 +113,6 @@ main(a, v) for (;;) { for (dev = devbase; dev < a; dev++) { - char buf[128]; fd = open(v[dev], O_RDWR); if (fd < 0) { syslog(LOG_ERR, "%s: %m", v[dev]); Modified: head/share/examples/ses/srcs/setencstat.c ============================================================================== --- head/share/examples/ses/srcs/setencstat.c Wed Nov 4 23:34:58 2009 (r198933) +++ head/share/examples/ses/srcs/setencstat.c Wed Nov 4 23:36:23 2009 (r198934) @@ -40,9 +40,7 @@ #include SESINC int -main(a, v) - int a; - char **v; +main(int a, char **v) { int fd; long val; Modified: head/share/examples/ses/srcs/setobjstat.c ============================================================================== --- head/share/examples/ses/srcs/setobjstat.c Wed Nov 4 23:34:58 2009 (r198933) +++ head/share/examples/ses/srcs/setobjstat.c Wed Nov 4 23:36:23 2009 (r198934) @@ -40,9 +40,7 @@ #include SESINC int -main(a, v) - int a; - char **v; +main(int a, char **v) { int fd; int i;