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