diff options
author | Ted Unangst <tedu@cvs.openbsd.org> | 2003-07-23 22:01:37 +0000 |
---|---|---|
committer | Ted Unangst <tedu@cvs.openbsd.org> | 2003-07-23 22:01:37 +0000 |
commit | 26663ca3acb8e283d5dd460ed33ff13d743223ee (patch) | |
tree | 9cb27162a9148e47831c15ad5920bf3004428967 | |
parent | b155ddcf158fee38f74937a2a24448d7a3b2eab0 (diff) |
better ascii test for fewer false negatives. ok millert@
-rw-r--r-- | usr.bin/diff/diffreg.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/usr.bin/diff/diffreg.c b/usr.bin/diff/diffreg.c index e9ae0767967..2d71a665583 100644 --- a/usr.bin/diff/diffreg.c +++ b/usr.bin/diff/diffreg.c @@ -1,4 +1,4 @@ -/* $OpenBSD: diffreg.c,v 1.41 2003/07/22 01:16:01 millert Exp $ */ +/* $OpenBSD: diffreg.c,v 1.42 2003/07/23 22:01:36 tedu Exp $ */ /* * Copyright (C) Caldera International Inc. 2001-2002. @@ -65,7 +65,7 @@ */ #ifndef lint -static const char rcsid[] = "$OpenBSD: diffreg.c,v 1.41 2003/07/22 01:16:01 millert Exp $"; +static const char rcsid[] = "$OpenBSD: diffreg.c,v 1.42 2003/07/23 22:01:36 tedu Exp $"; #endif /* not lint */ #include <sys/param.h> @@ -1171,7 +1171,7 @@ int asciifile(FILE *f) { char buf[BUFSIZ], *cp; - int cnt; + int i, cnt; if (aflag || f == NULL) return (1); @@ -1179,8 +1179,8 @@ asciifile(FILE *f) rewind(f); cnt = fread(buf, 1, sizeof(buf), f); cp = buf; - while (--cnt >= 0) - if (*cp++ & 0200) + for (i = 0; i < cnt; i++) + if (!isprint(*cp) && !isspace(*cp)) return (0); return (1); } |