Module Name: src
Committed By: dholland
Date: Fri Mar 4 02:54:38 UTC 2016
Modified Files:
src/usr.bin/hexdump: display.c hexdump.c hexdump.h
Log Message:
Don't use one function for two different things. Two functions is the
ticket.
To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/usr.bin/hexdump/display.c
cvs rdiff -u -r1.18 -r1.19 src/usr.bin/hexdump/hexdump.c
cvs rdiff -u -r1.14 -r1.15 src/usr.bin/hexdump/hexdump.h
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/usr.bin/hexdump/display.c
diff -u src/usr.bin/hexdump/display.c:1.23 src/usr.bin/hexdump/display.c:1.24
--- src/usr.bin/hexdump/display.c:1.23 Fri Mar 4 02:46:19 2016
+++ src/usr.bin/hexdump/display.c Fri Mar 4 02:54:38 2016
@@ -1,4 +1,4 @@
-/* $NetBSD: display.c,v 1.23 2016/03/04 02:46:19 dholland Exp $ */
+/* $NetBSD: display.c,v 1.24 2016/03/04 02:54:38 dholland 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.23 2016/03/04 02:46:19 dholland Exp $");
+__RCSID("$NetBSD: display.c,v 1.24 2016/03/04 02:54:38 dholland Exp $");
#endif
#endif /* not lint */
@@ -254,7 +254,7 @@ get(void)
* and no other files are available, zero-pad the rest of the
* block and set the end flag.
*/
- if (!length || (ateof && !next(NULL))) {
+ if (!length || (ateof && !next())) {
if (need == blocksize)
return(NULL);
if (!need && vflag != ALL &&
@@ -297,16 +297,18 @@ get(void)
}
}
+void
+stashargv(char **argv)
+{
+ _argv = argv;
+}
+
int
-next(char **argv)
+next(void)
{
static int done;
int statok;
- if (argv) {
- _argv = argv;
- return(1);
- }
for (;;) {
if (*_argv) {
if (!(freopen(*_argv, "r", stdin))) {
Index: src/usr.bin/hexdump/hexdump.c
diff -u src/usr.bin/hexdump/hexdump.c:1.18 src/usr.bin/hexdump/hexdump.c:1.19
--- src/usr.bin/hexdump/hexdump.c:1.18 Fri Jul 6 09:06:43 2012
+++ src/usr.bin/hexdump/hexdump.c Fri Mar 4 02:54:38 2016
@@ -1,4 +1,4 @@
-/* $NetBSD: hexdump.c,v 1.18 2012/07/06 09:06:43 wiz Exp $ */
+/* $NetBSD: hexdump.c,v 1.19 2016/03/04 02:54:38 dholland Exp $ */
/*
* Copyright (c) 1989, 1993
@@ -40,7 +40,7 @@ __COPYRIGHT("@(#) Copyright (c) 1989, 19
#if 0
static char sccsid[] = "@(#)hexdump.c 8.1 (Berkeley) 6/6/93";
#else
-__RCSID("$NetBSD: hexdump.c,v 1.18 2012/07/06 09:06:43 wiz Exp $");
+__RCSID("$NetBSD: hexdump.c,v 1.19 2016/03/04 02:54:38 dholland Exp $");
#endif
#endif /* not lint */
@@ -88,7 +88,7 @@ main(int argc, char *argv[])
for (tfs = fshead; tfs; tfs = tfs->nextfs)
rewrite(tfs);
- (void)next(argv);
+ stashargv(argv);
display();
exit(exitval);
}
Index: src/usr.bin/hexdump/hexdump.h
diff -u src/usr.bin/hexdump/hexdump.h:1.14 src/usr.bin/hexdump/hexdump.h:1.15
--- src/usr.bin/hexdump/hexdump.h:1.14 Fri Mar 4 02:46:19 2016
+++ src/usr.bin/hexdump/hexdump.h Fri Mar 4 02:54:38 2016
@@ -1,4 +1,4 @@
-/* $NetBSD: hexdump.h,v 1.14 2016/03/04 02:46:19 dholland Exp $ */
+/* $NetBSD: hexdump.h,v 1.15 2016/03/04 02:54:38 dholland Exp $ */
/*
* Copyright (c) 1989, 1993
@@ -88,7 +88,8 @@ void display(void);
void doskip(const char *, int);
void escape(char *);
void hexsyntax(int, char ***);
-int next(char **);
+void stashargv(char **);
+int next(void);
void odsyntax(int, char ***);
void rewrite(FS *);
int size(FS *);