summaryrefslogtreecommitdiff
path: root/usr.bin/grep
diff options
context:
space:
mode:
authorTed Unangst <tedu@cvs.openbsd.org>2003-09-07 07:53:45 +0000
committerTed Unangst <tedu@cvs.openbsd.org>2003-09-07 07:53:45 +0000
commit5215469caf7cf816ef552a677fc89fa6f3be5806 (patch)
treefdca038a3862db662e6cd3e816ab939a8514f688 /usr.bin/grep
parent8da91410af0718410e112d3f98e0f9036c332627 (diff)
extend ascii test for more accuracy. ok deraadt@ pb@
Diffstat (limited to 'usr.bin/grep')
-rw-r--r--usr.bin/grep/binary.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/usr.bin/grep/binary.c b/usr.bin/grep/binary.c
index 8ea47a6316e..82ffe94b499 100644
--- a/usr.bin/grep/binary.c
+++ b/usr.bin/grep/binary.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: binary.c,v 1.7 2003/06/25 17:28:00 millert Exp $ */
+/* $OpenBSD: binary.c,v 1.8 2003/09/07 07:53:44 tedu Exp $ */
/*-
* Copyright (c) 1999 James Howard and Dag-Erling Coïdan Smørgrav
@@ -32,18 +32,16 @@
#include "grep.h"
-#define BUFFER_SIZE 32
-
int
bin_file(FILE *f)
{
- char buf[BUFFER_SIZE];
+ char buf[BUFSIZ];
int i, m;
if (fseek(f, 0L, SEEK_SET) == -1)
return 0;
- if ((m = (int)fread(buf, 1, BUFFER_SIZE, f)) == 0)
+ if ((m = (int)fread(buf, 1, BUFSIZ, f)) == 0)
return 0;
for (i = 0; i < m; i++)
@@ -58,13 +56,13 @@ bin_file(FILE *f)
int
gzbin_file(gzFile *f)
{
- char buf[BUFFER_SIZE];
+ char buf[BUFSIZ];
int i, m;
if (gzseek(f, 0L, SEEK_SET) == -1)
return 0;
- if ((m = gzread(f, buf, BUFFER_SIZE)) == 0)
+ if ((m = gzread(f, buf, BUFSIZ)) == 0)
return 0;
for (i = 0; i < m; i++)
@@ -82,7 +80,7 @@ mmbin_file(mmf_t *f)
int i;
/* XXX knows too much about mmf internals */
- for (i = 0; i < BUFFER_SIZE && i < f->len; i++)
+ for (i = 0; i < BUFSIZ && i < f->len; i++)
if (!isprint(f->base[i]) && !isspace(f->base[i]))
return 1;
mmrewind(f);