=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/hexdump/display.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- src/usr.bin/hexdump/display.c 1997/01/17 07:12:37 1.4 +++ src/usr.bin/hexdump/display.c 1998/12/16 01:28:24 1.5 @@ -1,4 +1,4 @@ -/* $OpenBSD: display.c,v 1.4 1997/01/17 07:12:37 millert Exp $ */ +/* $OpenBSD: display.c,v 1.5 1998/12/16 01:28:24 deraadt Exp $ */ /* * Copyright (c) 1989 The Regents of the University of California. @@ -35,7 +35,7 @@ #ifndef lint /*static char sccsid[] = "from: @(#)display.c 5.11 (Berkeley) 3/9/91";*/ -static char rcsid[] = "$OpenBSD: display.c,v 1.4 1997/01/17 07:12:37 millert Exp $"; +static char rcsid[] = "$OpenBSD: display.c,v 1.5 1998/12/16 01:28:24 deraadt Exp $"; #endif /* not lint */ #include @@ -216,6 +216,7 @@ static u_char *curp, *savp; register int n; int need, nread; + int valid_save = 0; u_char *tmpp; if (!curp) { @@ -226,6 +227,7 @@ curp = savp; savp = tmpp; address = savaddress += blocksize; + valid_save = 1; } for (need = blocksize, nread = 0;;) { /* @@ -236,7 +238,8 @@ if (!length || ateof && !next((char **)NULL)) { if (need == blocksize) return((u_char *)NULL); - if (vflag != ALL && !bcmp(curp, savp, nread)) { + if (vflag != ALL && valid_save && + !bcmp(curp, savp, nread)) { if (vflag != DUP) (void)printf("*\n"); return((u_char *)NULL); @@ -258,7 +261,7 @@ if (length != -1) length -= n; if (!(need -= n)) { - if (vflag == ALL || vflag == FIRST || + if (vflag == ALL || vflag == FIRST || !valid_save || bcmp(curp, savp, blocksize)) { if (vflag == DUP || vflag == FIRST) vflag = WAIT;