diff options
author | dwmalone <dwmalone@FreeBSD.org> | 2002-09-04 23:29:10 +0000 |
---|---|---|
committer | dwmalone <dwmalone@FreeBSD.org> | 2002-09-04 23:29:10 +0000 |
commit | b4339b74aded4c38ebcfe3a2a9b37b900abb8874 (patch) | |
tree | fb230419005f211ecea1e667385bde9886dbf0d8 /usr.bin/hexdump | |
parent | 228b93ce829543fee06561687a63c17a7e821dfd (diff) | |
download | FreeBSD-src-b4339b74aded4c38ebcfe3a2a9b37b900abb8874.zip FreeBSD-src-b4339b74aded4c38ebcfe3a2a9b37b900abb8874.tar.gz |
ANSIify function definitions.
Add some constness to avoid some warnings.
Remove use register keyword.
Deal with missing/unneeded extern/prototypes.
Some minor type changes/casts to avoid warnings.
Reviewed by: md5
Diffstat (limited to 'usr.bin/hexdump')
-rw-r--r-- | usr.bin/hexdump/conv.c | 8 | ||||
-rw-r--r-- | usr.bin/hexdump/display.c | 36 | ||||
-rw-r--r-- | usr.bin/hexdump/hexdump.c | 6 | ||||
-rw-r--r-- | usr.bin/hexdump/hexdump.h | 2 | ||||
-rw-r--r-- | usr.bin/hexdump/hexsyntax.c | 6 | ||||
-rw-r--r-- | usr.bin/hexdump/odsyntax.c | 8 | ||||
-rw-r--r-- | usr.bin/hexdump/parse.c | 40 |
7 files changed, 40 insertions, 66 deletions
diff --git a/usr.bin/hexdump/conv.c b/usr.bin/hexdump/conv.c index eea03be..581b666 100644 --- a/usr.bin/hexdump/conv.c +++ b/usr.bin/hexdump/conv.c @@ -44,9 +44,7 @@ __FBSDID("$FreeBSD$"); #include "hexdump.h" void -conv_c(pr, p) - PR *pr; - u_char *p; +conv_c(PR *pr, u_char *p) { char buf[10]; char const *str; @@ -92,9 +90,7 @@ strpr: *pr->cchar = 's'; } void -conv_u(pr, p) - PR *pr; - u_char *p; +conv_u(PR *pr, u_char *p) { static char const * list[] = { "nul", "soh", "stx", "etx", "eot", "enq", "ack", "bel", diff --git a/usr.bin/hexdump/display.c b/usr.bin/hexdump/display.c index f2eb93b..2ab34a4 100644 --- a/usr.bin/hexdump/display.c +++ b/usr.bin/hexdump/display.c @@ -58,14 +58,13 @@ static off_t eaddress; /* end address */ static __inline void print(PR *, u_char *); void -display() +display(void) { - extern FU *endfu; - register FS *fs; - register FU *fu; - register PR *pr; - register int cnt; - register u_char *bp; + FS *fs; + FU *fu; + PR *pr; + int cnt; + u_char *bp; off_t saveaddress; u_char savech, *savebp; @@ -113,9 +112,7 @@ display() } static __inline void -print(pr, bp) - PR *pr; - u_char *bp; +print(PR *pr, u_char *bp) { long double ldbl; double f8; @@ -212,11 +209,10 @@ print(pr, bp) } void -bpad(pr) - PR *pr; +bpad(PR *pr) { static char const *spec = " -0+#"; - register char *p1, *p2; + char *p1, *p2; /* * Remove all conversion flags; '-' is the only one valid @@ -233,11 +229,11 @@ bpad(pr) static char **_argv; u_char * -get() +get(void) { static int ateof = 1; static u_char *curp, *savp; - register int n; + int n; int need, nread; int valid_save = 0; u_char *tmpp; @@ -308,10 +304,8 @@ get() } int -next(argv) - char **argv; +next(char **argv) { - extern int exitval; static int done; int statok; @@ -344,11 +338,9 @@ next(argv) } void -doskip(fname, statok) - const char *fname; - int statok; +doskip(const char *fname, int statok) { - register int cnt; + int cnt; struct stat sb; if (statok) { diff --git a/usr.bin/hexdump/hexdump.c b/usr.bin/hexdump/hexdump.c index 660a2d9..2ed7c4b 100644 --- a/usr.bin/hexdump/hexdump.c +++ b/usr.bin/hexdump/hexdump.c @@ -58,11 +58,9 @@ int exitval; /* final exit value */ int length = -1; /* max bytes to read */ int -main(argc, argv) - int argc; - char *argv[]; +main(int argc, char *argv[]) { - register FS *tfs; + FS *tfs; char *p; (void)setlocale(LC_ALL, ""); diff --git a/usr.bin/hexdump/hexdump.h b/usr.bin/hexdump/hexdump.h index 360fe5d..cf3b79c 100644 --- a/usr.bin/hexdump/hexdump.h +++ b/usr.bin/hexdump/hexdump.h @@ -72,7 +72,9 @@ typedef struct _fs { /* format strings */ } FS; extern FS *fshead; /* head of format strings list */ +extern FU *endfu; /* format at end-of-data */ extern int blocksize; /* data block size */ +extern int exitval; /* final exit value */ extern int odmode; /* are we acting as od(1)? */ extern int length; /* amount of data to read */ extern off_t skip; /* amount of data to skip at start */ diff --git a/usr.bin/hexdump/hexsyntax.c b/usr.bin/hexdump/hexsyntax.c index fad2fa8..4d21611 100644 --- a/usr.bin/hexdump/hexsyntax.c +++ b/usr.bin/hexdump/hexsyntax.c @@ -52,9 +52,7 @@ __FBSDID("$FreeBSD$"); off_t skip; /* bytes to skip */ void -newsyntax(argc, argvp) - int argc; - char ***argvp; +newsyntax(int argc, char ***argvp) { int ch; char *p, **argv; @@ -135,7 +133,7 @@ newsyntax(argc, argvp) } void -usage() +usage(void) { (void)fprintf(stderr, "%s\n%s\n%s\n%s\n", "usage: hexdump [-bcCdovx] [-e fmt] [-f fmt_file] [-n length]", diff --git a/usr.bin/hexdump/odsyntax.c b/usr.bin/hexdump/odsyntax.c index 0a37d01..19684bf 100644 --- a/usr.bin/hexdump/odsyntax.c +++ b/usr.bin/hexdump/odsyntax.c @@ -64,9 +64,7 @@ static void odoffset(int, char ***); static void odusage(void); void -oldsyntax(argc, argvp) - int argc; - char ***argvp; +oldsyntax(int argc, char ***argvp) { static char empty[] = "", padding[] = PADDING; int ch; @@ -193,9 +191,7 @@ odusage(void) } static void -odoffset(argc, argvp) - int argc; - char ***argvp; +odoffset(int argc, char ***argvp) { unsigned char *p, *num, *end; int base; diff --git a/usr.bin/hexdump/parse.c b/usr.bin/hexdump/parse.c index 25ef032..7b7f8e7 100644 --- a/usr.bin/hexdump/parse.c +++ b/usr.bin/hexdump/parse.c @@ -52,10 +52,9 @@ __FBSDID("$FreeBSD$"); FU *endfu; /* format at end-of-data */ void -addfile(name) - char *name; +addfile(char *name) { - register unsigned char *p; + unsigned char *p; FILE *fp; int ch; char buf[2048 + 1]; @@ -78,8 +77,7 @@ addfile(name) } void -add(fmt) - const char *fmt; +add(const char *fmt) { unsigned const char *p, *savep; static FS **nextfs; @@ -154,12 +152,11 @@ add(fmt) static const char *spec = ".#-+ 0123456789"; int -size(fs) - FS *fs; +size(FS *fs) { - register FU *fu; - register int bcnt, cursize; - register unsigned char *fmt; + FU *fu; + int bcnt, cursize; + unsigned char *fmt; int prec; /* figure out the data block size needed for each format unit */ @@ -208,12 +205,11 @@ size(fs) } void -rewrite(fs) - FS *fs; +rewrite(FS *fs) { enum { NOTOKAY, USEBCNT, USEPREC } sokay; - register PR *pr, **nextpr; - register FU *fu; + PR *pr, **nextpr; + FU *fu; unsigned char *p1, *p2, *fmtp; char savech, cs[3]; int nconv, prec; @@ -449,10 +445,9 @@ isint2: switch(fu->bcnt) { } void -escape(p1) - register char *p1; +escape(char *p1) { - register char *p2; + char *p2; /* alphabetic escape sequences have to be done in place */ for (p2 = p1;; ++p1, ++p2) { @@ -492,28 +487,25 @@ escape(p1) } void -badcnt(s) - char *s; +badcnt(char *s) { errx(1, "%s: bad byte count", s); } void -badsfmt() +badsfmt(void) { errx(1, "%%s: requires a precision or a byte count"); } void -badfmt(fmt) - const char *fmt; +badfmt(const char *fmt) { errx(1, "\"%s\": bad format", fmt); } void -badconv(ch) - char *ch; +badconv(char *ch) { errx(1, "%%%s: bad conversion character", ch); } |