Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/hexdump WARNS=2



details:   https://anonhg.NetBSD.org/src/rev/ff8585235591
branches:  trunk
changeset: 518906:ff8585235591
user:      bjh21 <bjh21%NetBSD.org@localhost>
date:      Fri Dec 07 15:14:29 2001 +0000

description:
WARNS=2

diffstat:

 usr.bin/hexdump/Makefile   |   3 ++-
 usr.bin/hexdump/conv.c     |  10 ++++++----
 usr.bin/hexdump/display.c  |  14 +++++++-------
 usr.bin/hexdump/hexdump.h  |   4 ++--
 usr.bin/hexdump/odsyntax.c |  20 ++++++++++----------
 5 files changed, 27 insertions(+), 24 deletions(-)

diffs (187 lines):

diff -r 09437a4c2f06 -r ff8585235591 usr.bin/hexdump/Makefile
--- a/usr.bin/hexdump/Makefile  Fri Dec 07 14:46:24 2001 +0000
+++ b/usr.bin/hexdump/Makefile  Fri Dec 07 15:14:29 2001 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile,v 1.6 2000/10/11 14:46:04 is Exp $
+#      $NetBSD: Makefile,v 1.7 2001/12/07 15:14:29 bjh21 Exp $
 #      from: @(#)Makefile      8.1 (Berkeley) 6/6/93
 
 PROG=  hexdump
@@ -6,5 +6,6 @@
 MAN=   hexdump.1 od.1
 LINKS= ${BINDIR}/hexdump ${BINDIR}/od
 WFORMAT=       1
+WARNS=         2
 
 .include <bsd.prog.mk>
diff -r 09437a4c2f06 -r ff8585235591 usr.bin/hexdump/conv.c
--- a/usr.bin/hexdump/conv.c    Fri Dec 07 14:46:24 2001 +0000
+++ b/usr.bin/hexdump/conv.c    Fri Dec 07 15:14:29 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: conv.c,v 1.6 1997/10/19 02:34:02 lukem Exp $   */
+/*     $NetBSD: conv.c,v 1.7 2001/12/07 15:14:29 bjh21 Exp $   */
 
 /*
  * Copyright (c) 1989, 1993
@@ -38,7 +38,7 @@
 #if 0
 static char sccsid[] = "@(#)conv.c     8.1 (Berkeley) 6/6/93";
 #else
-__RCSID("$NetBSD: conv.c,v 1.6 1997/10/19 02:34:02 lukem Exp $");
+__RCSID("$NetBSD: conv.c,v 1.7 2001/12/07 15:14:29 bjh21 Exp $");
 #endif
 #endif /* not lint */
 
@@ -54,7 +54,8 @@
        PR *pr;
        u_char *p;
 {
-       char buf[10], *str;
+       char buf[10];
+       char const *str;
 
        switch(*p) {
        case '\0':
@@ -93,7 +94,8 @@
                *pr->cchar = 'c';
                (void)printf(pr->fmt, *p);
        } else {
-               (void)sprintf(str = buf, "%03o", (int)*p);
+               (void)sprintf(buf, "%03o", (int)*p);
+               str = buf;
 strpr:         *pr->cchar = 's';
                (void)printf(pr->fmt, str);
        }
diff -r 09437a4c2f06 -r ff8585235591 usr.bin/hexdump/display.c
--- a/usr.bin/hexdump/display.c Fri Dec 07 14:46:24 2001 +0000
+++ b/usr.bin/hexdump/display.c Fri Dec 07 15:14:29 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: display.c,v 1.11 2001/12/07 13:37:39 bjh21 Exp $       */
+/*     $NetBSD: display.c,v 1.12 2001/12/07 15:14:29 bjh21 Exp $       */
 
 /*
  * Copyright (c) 1989, 1993
@@ -38,7 +38,7 @@
 #if 0
 static char sccsid[] = "@(#)display.c  8.1 (Berkeley) 6/6/93";
 #else
-__RCSID("$NetBSD: display.c,v 1.11 2001/12/07 13:37:39 bjh21 Exp $");
+__RCSID("$NetBSD: display.c,v 1.12 2001/12/07 15:14:29 bjh21 Exp $");
 #endif
 #endif /* not lint */
 
@@ -334,7 +334,7 @@
 
 void
 doskip(fname, statok)
-       char *fname;
+       const char *fname;
        int statok;
 {
        int cnt;
@@ -364,14 +364,14 @@
 }
 
 void *
-emalloc(size)
-       int size;
+emalloc(allocsize)
+       int allocsize;
 {
        void *p;
 
-       if ((p = malloc((u_int)size)) == NULL)
+       if ((p = malloc((u_int)allocsize)) == NULL)
                nomem();
-       memset(p, 0, size);
+       memset(p, 0, allocsize);
        return(p);
 }
 
diff -r 09437a4c2f06 -r ff8585235591 usr.bin/hexdump/hexdump.h
--- a/usr.bin/hexdump/hexdump.h Fri Dec 07 14:46:24 2001 +0000
+++ b/usr.bin/hexdump/hexdump.h Fri Dec 07 15:14:29 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: hexdump.h,v 1.6 2001/02/07 18:32:07 christos Exp $     */
+/*     $NetBSD: hexdump.h,v 1.7 2001/12/07 15:14:29 bjh21 Exp $        */
 
 /*
  * Copyright (c) 1989, 1993
@@ -93,7 +93,7 @@
 void    conv_c __P((PR *, u_char *));
 void    conv_u __P((PR *, u_char *));
 void    display __P((void));
-void    doskip __P((char *, int));
+void    doskip __P((const char *, int));
 /*void  err __P((const char *, ...));*/
 void   *emalloc __P((int));
 void    escape __P((char *));
diff -r 09437a4c2f06 -r ff8585235591 usr.bin/hexdump/odsyntax.c
--- a/usr.bin/hexdump/odsyntax.c        Fri Dec 07 14:46:24 2001 +0000
+++ b/usr.bin/hexdump/odsyntax.c        Fri Dec 07 15:14:29 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: odsyntax.c,v 1.14 2001/12/07 01:23:42 bjh21 Exp $      */
+/*     $NetBSD: odsyntax.c,v 1.15 2001/12/07 15:14:29 bjh21 Exp $      */
 
 /*-
  * Copyright (c) 1990, 1993
@@ -38,7 +38,7 @@
 #if 0
 static char sccsid[] = "@(#)odsyntax.c 8.2 (Berkeley) 5/4/95";
 #else
-__RCSID("$NetBSD: odsyntax.c,v 1.14 2001/12/07 01:23:42 bjh21 Exp $");
+__RCSID("$NetBSD: odsyntax.c,v 1.15 2001/12/07 15:14:29 bjh21 Exp $");
 #endif
 #endif /* not lint */
 
@@ -216,7 +216,7 @@
 posixtypes(type_string)
        char *type_string;
 {
-       int x, y, size;
+       int x, y, nbytes;
 
        while (*type_string) {
                odprecede();
@@ -262,16 +262,16 @@
                        if (isupper(*type_string)) {
                                switch(*type_string) {
                                case 'C':
-                                       size = sizeof(char);
+                                       nbytes = sizeof(char);
                                        break;
                                case 'S':
-                                       size = sizeof(short);
+                                       nbytes = sizeof(short);
                                        break;
                                case 'I':
-                                       size = sizeof(int);
+                                       nbytes = sizeof(int);
                                        break;
                                case 'L':
-                                       size = sizeof(long);
+                                       nbytes = sizeof(long);
                                        break;
                                default:
                                        warnx("Bad type-size qualifier '%c'",
@@ -280,9 +280,9 @@
                                }
                                type_string++;
                        } else if (isdigit(*type_string))
-                               size = strtol(type_string, &type_string, 10);
+                               nbytes = strtol(type_string, &type_string, 10);
 
-                       switch (size) {
+                       switch (nbytes) {
                        case 1:
                                y = 0;
                                break;
@@ -297,7 +297,7 @@
                                break;
                        default:
                                warnx("%d-byte integer formats are not "
-                                   "supported", size);
+                                   "supported", nbytes);
                                usage();
                        }
                        add(fmt[x][y]);



Home | Main Index | Thread Index | Old Index