1/* $OpenBSD: util.c,v 1.39 2010/07/02 22:18:03 tedu Exp $ */
2
3/*-
4 * Copyright (c) 1999 James Howard and Dag-Erling Co�dan Sm�rgrav
5 * Copyright (C) 2008-2010 Gabor Kovesdan <gabor@FreeBSD.org>
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
--- 14 unchanged lines hidden (view full) ---
23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 */
29
30#include <sys/cdefs.h>
31__FBSDID("$FreeBSD: head/usr.bin/grep/util.c 210461 2010-07-25 08:42:18Z gabor $");
32
33#include <sys/stat.h>
34#include <sys/types.h>
35
36#include <ctype.h>
37#include <err.h>
38#include <errno.h>
39#include <fnmatch.h>
--- 298 unchanged lines hidden (view full) ---
338 }
339 } else
340 c = !vflag;
341
342 if (c && binbehave == BINFILE_BIN && nottext)
343 return (c); /* Binary file */
344
345 /* Dealing with the context */
346 if ((tail || c) && !cflag && !qflag) {
347 if (c) {
348 if (!first && !prev && !tail && Aflag)
349 printf("--\n");
350 tail = Aflag;
351 if (Bflag > 0) {
352 if (!first && !prev)
353 printf("--\n");
354 printqueue();
--- 116 unchanged lines hidden ---
2
3/*-
4 * Copyright (c) 1999 James Howard and Dag-Erling Co�dan Sm�rgrav
5 * Copyright (C) 2008-2010 Gabor Kovesdan <gabor@FreeBSD.org>
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
--- 14 unchanged lines hidden (view full) ---
23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 */
29
30#include <sys/cdefs.h>
31__FBSDID("$FreeBSD: head/usr.bin/grep/util.c 210461 2010-07-25 08:42:18Z gabor $");
32
33#include <sys/stat.h>
34#include <sys/types.h>
35
36#include <ctype.h>
37#include <err.h>
38#include <errno.h>
39#include <fnmatch.h>
--- 298 unchanged lines hidden (view full) ---
338 }
339 } else
340 c = !vflag;
341
342 if (c && binbehave == BINFILE_BIN && nottext)
343 return (c); /* Binary file */
344
345 /* Dealing with the context */
346 if ((tail || c) && !cflag && !qflag) {
347 if (c) {
348 if (!first && !prev && !tail && Aflag)
349 printf("--\n");
350 tail = Aflag;
351 if (Bflag > 0) {
352 if (!first && !prev)
353 printf("--\n");
354 printqueue();
--- 116 unchanged lines hidden ---