diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 2004-05-06 19:42:17 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 2004-05-06 19:42:17 +0000 |
commit | f6d35be389dbb13c5f8ff1b75b1f4d1ee54dcce7 (patch) | |
tree | d213181e4ca1e42fa447f1105cfd5dbe12db72ab /usr.bin/grep | |
parent | 09f409655da7327df7b5ebb5139e6e72c829a49e (diff) |
Treat ^H as non-binary. OK hshoexer@, brad@ and deraadt@
Diffstat (limited to 'usr.bin/grep')
-rw-r--r-- | usr.bin/grep/binary.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/usr.bin/grep/binary.c b/usr.bin/grep/binary.c index 7c27efab486..8174b926272 100644 --- a/usr.bin/grep/binary.c +++ b/usr.bin/grep/binary.c @@ -1,4 +1,4 @@ -/* $OpenBSD: binary.c,v 1.10 2003/12/29 21:20:55 canacar Exp $ */ +/* $OpenBSD: binary.c,v 1.11 2004/05/06 19:42:16 millert Exp $ */ /*- * Copyright (c) 1999 James Howard and Dag-Erling Coïdan Smørgrav @@ -32,6 +32,8 @@ #include "grep.h" +#define isbinary(ch) (!isprint((ch)) && !isspace((ch)) && (ch) != '\b') + int bin_file(FILE *f) { @@ -46,7 +48,7 @@ bin_file(FILE *f) return 0; for (i = 0; i < m; i++) - if (!isprint(buf[i]) && !isspace(buf[i])) { + if (isbinary(buf[i])) { ret = 1; break; } @@ -70,7 +72,7 @@ gzbin_file(gzFile *f) return 0; for (i = 0; i < m; i++) - if (!isprint(buf[i]) && !isspace(buf[i])) { + if (isbinary(buf[i])) { ret = 1; break; } @@ -87,7 +89,7 @@ mmbin_file(mmf_t *f) /* XXX knows too much about mmf internals */ for (i = 0; i < BUFSIZ && i < f->len; i++) - if (!isprint(f->base[i]) && !isspace(f->base[i])) + if (isbinary(f->base[i])) return 1; return 0; } |