diff options
author | delphij <delphij@FreeBSD.org> | 2009-11-04 23:36:23 +0000 |
---|---|---|
committer | delphij <delphij@FreeBSD.org> | 2009-11-04 23:36:23 +0000 |
commit | 16733ea919f3e2b73c32b38e6a0081afeac627c4 (patch) | |
tree | 9fd0712d995339284c810f12815eef6f48c8a87d | |
parent | 65deb8f266c67ac665711050a2b17ef119abc2ec (diff) | |
download | FreeBSD-src-16733ea919f3e2b73c32b38e6a0081afeac627c4.zip FreeBSD-src-16733ea919f3e2b73c32b38e6a0081afeac627c4.tar.gz |
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
-rw-r--r-- | share/examples/ses/srcs/chpmon.c | 4 | ||||
-rw-r--r-- | share/examples/ses/srcs/eltsub.c | 12 | ||||
-rw-r--r-- | share/examples/ses/srcs/eltsub.h | 36 | ||||
-rw-r--r-- | share/examples/ses/srcs/getencstat.c | 7 | ||||
-rw-r--r-- | share/examples/ses/srcs/getnobj.c | 4 | ||||
-rw-r--r-- | share/examples/ses/srcs/getobjmap.c | 6 | ||||
-rw-r--r-- | share/examples/ses/srcs/getobjstat.c | 4 | ||||
-rw-r--r-- | share/examples/ses/srcs/inienc.c | 4 | ||||
-rw-r--r-- | share/examples/ses/srcs/sesd.c | 9 | ||||
-rw-r--r-- | share/examples/ses/srcs/setencstat.c | 4 | ||||
-rw-r--r-- | share/examples/ses/srcs/setobjstat.c | 4 |
11 files changed, 54 insertions, 40 deletions
diff --git a/share/examples/ses/srcs/chpmon.c b/share/examples/ses/srcs/chpmon.c index 1b537c7..cb78f06 100644 --- a/share/examples/ses/srcs/chpmon.c +++ b/share/examples/ses/srcs/chpmon.c @@ -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; diff --git a/share/examples/ses/srcs/eltsub.c b/share/examples/ses/srcs/eltsub.c index 5fae665..2acf982 100644 --- a/share/examples/ses/srcs/eltsub.c +++ b/share/examples/ses/srcs/eltsub.c @@ -38,9 +38,10 @@ #include <sys/ioctl.h> #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; diff --git a/share/examples/ses/srcs/eltsub.h b/share/examples/ses/srcs/eltsub.h new file mode 100644 index 0000000..3d98572 --- /dev/null +++ b/share/examples/ses/srcs/eltsub.h @@ -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 *); diff --git a/share/examples/ses/srcs/getencstat.c b/share/examples/ses/srcs/getencstat.c index d9f5c6d..3514fe4 100644 --- a/share/examples/ses/srcs/getencstat.c +++ b/share/examples/ses/srcs/getencstat.c @@ -40,13 +40,10 @@ #include <fcntl.h> #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; diff --git a/share/examples/ses/srcs/getnobj.c b/share/examples/ses/srcs/getnobj.c index 680a6cd..17a26c6 100644 --- a/share/examples/ses/srcs/getnobj.c +++ b/share/examples/ses/srcs/getnobj.c @@ -41,9 +41,7 @@ #include SESINC int -main(argc, argv) - int argc; - char **argv; +main(int argc, char **argv) { unsigned int nobj; int fd; diff --git a/share/examples/ses/srcs/getobjmap.c b/share/examples/ses/srcs/getobjmap.c index 7f4d1b7..9798b4c 100644 --- a/share/examples/ses/srcs/getobjmap.c +++ b/share/examples/ses/srcs/getobjmap.c @@ -39,12 +39,10 @@ #include <sys/ioctl.h> #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; diff --git a/share/examples/ses/srcs/getobjstat.c b/share/examples/ses/srcs/getobjstat.c index bf703cf..99fb185 100644 --- a/share/examples/ses/srcs/getobjstat.c +++ b/share/examples/ses/srcs/getobjstat.c @@ -39,9 +39,7 @@ #include SESINC int -main(a, v) - int a; - char **v; +main(int a, char **v) { int fd; int i; diff --git a/share/examples/ses/srcs/inienc.c b/share/examples/ses/srcs/inienc.c index d6fb262..7d6cc22 100644 --- a/share/examples/ses/srcs/inienc.c +++ b/share/examples/ses/srcs/inienc.c @@ -40,9 +40,7 @@ #include SESINC int -main(a, v) - int a; - char **v; +main(int a, char **v) { int fd; diff --git a/share/examples/ses/srcs/sesd.c b/share/examples/ses/srcs/sesd.c index 5262b63..0793077 100644 --- a/share/examples/ses/srcs/sesd.c +++ b/share/examples/ses/srcs/sesd.c @@ -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]); diff --git a/share/examples/ses/srcs/setencstat.c b/share/examples/ses/srcs/setencstat.c index 58e0daf..127f68f 100644 --- a/share/examples/ses/srcs/setencstat.c +++ b/share/examples/ses/srcs/setencstat.c @@ -40,9 +40,7 @@ #include SESINC int -main(a, v) - int a; - char **v; +main(int a, char **v) { int fd; long val; diff --git a/share/examples/ses/srcs/setobjstat.c b/share/examples/ses/srcs/setobjstat.c index 34e8ea6..08fdb7b 100644 --- a/share/examples/ses/srcs/setobjstat.c +++ b/share/examples/ses/srcs/setobjstat.c @@ -40,9 +40,7 @@ #include SESINC int -main(a, v) - int a; - char **v; +main(int a, char **v) { int fd; int i; |