On Wed, May 15, 2013 at 13:25, Stefan Sperling wrote: > This should make it work. See also r1.82 of usr.bin/diff/diffreg.c.
I love this bug! There's lots of copies so everybody gets a chance to fix it. > > Index: diff.c > =================================================================== > RCS file: /cvs/src/usr.bin/rcs/diff.c,v > retrieving revision 1.33 > diff -u -p -r1.33 diff.c > --- diff.c 20 Apr 2011 19:34:16 -0000 1.33 > +++ diff.c 15 May 2013 11:24:13 -0000 > @@ -1132,17 +1132,14 @@ static int > asciifile(FILE *f) > { > unsigned char buf[BUFSIZ]; > - size_t i, cnt; > + size_t cnt; > > if (f == NULL) > return (1); > > rewind(f); > cnt = fread(buf, 1, sizeof(buf), f); > - for (i = 0; i < cnt; i++) > - if (!isprint(buf[i]) && !isspace(buf[i])) > - return (0); > - return (1); > + return (memchr(buf, '\0', cnt) == NULL); > } > > #define begins_with(s, pre) (strncmp(s, pre, sizeof(pre)-1) == 0)