OpenBSD CVS

CVS log for src/usr.bin/grep/binary.c


[BACK] Up to [local] / src / usr.bin / grep

Request diff between arbitrary revisions


Default branch: MAIN


Revision 1.20 / (download) - annotate - [select for diffs], Wed Dec 15 19:22:44 2021 UTC (2 years, 5 months ago) by tb
Branch: MAIN
CVS Tags: OPENBSD_7_5_BASE, OPENBSD_7_5, OPENBSD_7_4_BASE, OPENBSD_7_4, OPENBSD_7_3_BASE, OPENBSD_7_3, OPENBSD_7_2_BASE, OPENBSD_7_2, OPENBSD_7_1_BASE, OPENBSD_7_1, HEAD
Changes since 1.19: +2 -1 lines
Diff to previous 1.19 (colored)

grep: Add missing unistd.h and limits.h includes

Both binary.c and file.c currently pull in unistd.h via zlib's zconf.h.
binary.c uses SEEK_SET and file.c a bunch of things like close(), isatty(),
lseek(). In addition file.c needs limits.h for PATH_MAX.

ok deraadt

Revision 1.19 / (download) - annotate - [select for diffs], Wed Mar 10 21:55:22 2021 UTC (3 years, 2 months ago) by millert
Branch: MAIN
CVS Tags: OPENBSD_7_0_BASE, OPENBSD_7_0, OPENBSD_6_9_BASE, OPENBSD_6_9
Changes since 1.18: +2 -2 lines
Diff to previous 1.18 (colored)

zlib functions take a gzFile not gzFile * (gzFile is already a pointer).
From Josh Rickmar.

Revision 1.18 / (download) - annotate - [select for diffs], Tue Nov 12 22:50:42 2013 UTC (10 years, 6 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_6_8_BASE, OPENBSD_6_8, OPENBSD_6_7_BASE, OPENBSD_6_7, OPENBSD_6_6_BASE, OPENBSD_6_6, OPENBSD_6_5_BASE, OPENBSD_6_5, OPENBSD_6_4_BASE, OPENBSD_6_4, OPENBSD_6_3_BASE, OPENBSD_6_3, OPENBSD_6_2_BASE, OPENBSD_6_2, OPENBSD_6_1_BASE, OPENBSD_6_1, OPENBSD_6_0_BASE, OPENBSD_6_0, OPENBSD_5_9_BASE, OPENBSD_5_9, OPENBSD_5_8_BASE, OPENBSD_5_8, OPENBSD_5_7_BASE, OPENBSD_5_7, OPENBSD_5_6_BASE, OPENBSD_5_6, OPENBSD_5_5_BASE, OPENBSD_5_5
Changes since 1.17: +2 -2 lines
Diff to previous 1.17 (colored)

simple prototype repairs

Revision 1.17 / (download) - annotate - [select for diffs], Mon Jun 20 18:14:01 2011 UTC (12 years, 11 months ago) by stsp
Branch: MAIN
CVS Tags: OPENBSD_5_4_BASE, OPENBSD_5_4, OPENBSD_5_3_BASE, OPENBSD_5_3, OPENBSD_5_2_BASE, OPENBSD_5_2, OPENBSD_5_1_BASE, OPENBSD_5_1, OPENBSD_5_0_BASE, OPENBSD_5_0
Changes since 1.16: +14 -20 lines
Diff to previous 1.16 (colored)

Switch binary file detection from !(isprint() || isspace()) to checking
for embedded NULs. Matches GNU and FreeBSD grep, and avoids problems with
e.g. latin1-encoded files being treated as binary in the UTF-8 locale once
grep calls setlocale() (which it does not, yet).
OK millert@ tedu@

Revision 1.16 / (download) - annotate - [select for diffs], Fri Jul 2 20:48:48 2010 UTC (13 years, 10 months ago) by nicm
Branch: MAIN
CVS Tags: OPENBSD_4_9_BASE, OPENBSD_4_9, OPENBSD_4_8_BASE, OPENBSD_4_8
Changes since 1.15: +3 -1 lines
Diff to previous 1.15 (colored)

Do not include mmap support with -DSMALL.

ok millert

Revision 1.15 / (download) - annotate - [select for diffs], Mon Apr 25 08:21:20 2005 UTC (19 years ago) by otto
Branch: MAIN
CVS Tags: OPENBSD_4_7_BASE, OPENBSD_4_7, OPENBSD_4_6_BASE, OPENBSD_4_6, OPENBSD_4_5_BASE, OPENBSD_4_5, OPENBSD_4_4_BASE, OPENBSD_4_4, OPENBSD_4_3_BASE, OPENBSD_4_3, OPENBSD_4_2_BASE, OPENBSD_4_2, OPENBSD_4_1_BASE, OPENBSD_4_1, OPENBSD_4_0_BASE, OPENBSD_4_0, OPENBSD_3_9_BASE, OPENBSD_3_9, OPENBSD_3_8_BASE, OPENBSD_3_8
Changes since 1.14: +4 -4 lines
Diff to previous 1.14 (colored)

- use size_t where appropriate.
- check for <= 0 in gzread; it returns -1 on error.
From christos@netbsd; ok millert@

Revision 1.14 / (download) - annotate - [select for diffs], Mon Feb 7 08:47:18 2005 UTC (19 years, 3 months ago) by otto
Branch: MAIN
CVS Tags: OPENBSD_3_7_BASE, OPENBSD_3_7
Changes since 1.13: +5 -3 lines
Diff to previous 1.13 (colored)

Due to a braindead zlib, the test for seekability of a gzstream using
gzseek(f, 0L, SEEK_CUR) does not work as expected. Instead test the
underlying stream and remember that. This repairs echo foo | gzip | zgrep foo.
Problem spotted by Han Boetes in PR 4089; ok millert@

Revision 1.13 / (download) - annotate - [select for diffs], Wed Sep 15 22:35:36 2004 UTC (19 years, 8 months ago) by deraadt
Branch: MAIN
Changes since 1.12: +2 -2 lines
Diff to previous 1.12 (colored)

cast offset value correctly for gzseek

Revision 1.12 / (download) - annotate - [select for diffs], Thu May 6 20:18:51 2004 UTC (20 years ago) by otto
Branch: MAIN
CVS Tags: OPENBSD_3_6_BASE, OPENBSD_3_6
Changes since 1.11: +2 -2 lines
Diff to previous 1.11 (colored)

Don't fseek() on stdin if it is a terminal. It does not fail, but
what's more more important, it does not work either.

ok millert@ tedu@

Revision 1.11 / (download) - annotate - [select for diffs], Thu May 6 19:42:16 2004 UTC (20 years ago) by millert
Branch: MAIN
Changes since 1.10: +6 -4 lines
Diff to previous 1.10 (colored)

Treat ^H as non-binary.  OK hshoexer@, brad@ and deraadt@

Revision 1.10 / (download) - annotate - [select for diffs], Mon Dec 29 21:20:55 2003 UTC (20 years, 4 months ago) by canacar
Branch: MAIN
CVS Tags: OPENBSD_3_5_BASE, OPENBSD_3_5
Changes since 1.9: +13 -8 lines
Diff to previous 1.9 (colored)

fix zgrep failure when the uncompressed file begins with a newline
also, search from the beginning if a stream or compressed file is
identified as 'binary'.
ok millert@, reported by tedu@, tested by jose@

Revision 1.9 / (download) - annotate - [select for diffs], Thu Sep 18 22:29:30 2003 UTC (20 years, 8 months ago) by beck
Branch: MAIN
Changes since 1.8: +2 -2 lines
Diff to previous 1.8 (colored)

make this test look for spaces as well, to match other cases
ok fgs@ ok deraadt@

Revision 1.8 / (download) - annotate - [select for diffs], Sun Sep 7 07:53:44 2003 UTC (20 years, 8 months ago) by tedu
Branch: MAIN
CVS Tags: OPENBSD_3_4_BASE, OPENBSD_3_4
Changes since 1.7: +6 -8 lines
Diff to previous 1.7 (colored)

extend ascii test for more accuracy.  ok deraadt@ pb@

Revision 1.7 / (download) - annotate - [select for diffs], Wed Jun 25 17:28:00 2003 UTC (20 years, 10 months ago) by millert
Branch: MAIN
Changes since 1.6: +2 -2 lines
Diff to previous 1.6 (colored)

o remove useless cast to int from gzread() call
o maxPatternLen should be size_t since that's what it is compared against
o remove useless casts of NULL to various pointer types

Revision 1.6 / (download) - annotate - [select for diffs], Wed Jun 25 04:03:47 2003 UTC (20 years, 10 months ago) by tedu
Branch: MAIN
Changes since 1.5: +2 -2 lines
Diff to previous 1.5 (colored)

backwards args to gzseek

Revision 1.5 / (download) - annotate - [select for diffs], Mon Jun 23 00:55:09 2003 UTC (20 years, 11 months ago) by tedu
Branch: MAIN
Changes since 1.4: +2 -2 lines
Diff to previous 1.4 (colored)

better detetection/handling of binary files.
make -a do the right thing, doc and implement -U, -I.
add --help and --mmap for compatibility.
some other minor fixes.

some from NetBSD.  ok deraadt@

Revision 1.4 / (download) - annotate - [select for diffs], Sun Jun 22 22:38:50 2003 UTC (20 years, 11 months ago) by deraadt
Branch: MAIN
Changes since 1.3: +2 -2 lines
Diff to previous 1.3 (colored)

proper $OpenBSD$

Revision 1.3 / (download) - annotate - [select for diffs], Sun Jun 22 22:24:13 2003 UTC (20 years, 11 months ago) by deraadt
Branch: MAIN
Changes since 1.2: +4 -2 lines
Diff to previous 1.2 (colored)

-DNOZ flag to be used by install media for removing z*grep support, if
needed.  (and knf)

Revision 1.2 / (download) - annotate - [select for diffs], Sun Jun 22 22:21:50 2003 UTC (20 years, 11 months ago) by deraadt
Branch: MAIN
Changes since 1.1: +2 -2 lines
Diff to previous 1.1 (colored)

correct fseek() parameters

Revision 1.1 / (download) - annotate - [select for diffs], Sun Jun 22 22:20:07 2003 UTC (20 years, 11 months ago) by deraadt
Branch: MAIN

freegrep 0.16

This form allows you to request diff's between any two revisions of a file. You may select a symbolic revision name using the selection box or you may type in a numeric name using the type-in text box.