1/* $NetBSD: util.c,v 1.9 2011/02/27 17:33:37 joerg Exp $ */ |
2/* $FreeBSD: head/usr.bin/grep/util.c 226273 2011-10-12 01:09:57Z gabor $ */ |
3/* $OpenBSD: util.c,v 1.39 2010/07/02 22:18:03 tedu Exp $ */ 4 5/*- 6 * Copyright (c) 1999 James Howard and Dag-Erling Co��dan Sm��rgrav 7 * Copyright (C) 2008-2010 Gabor Kovesdan <gabor@FreeBSD.org> 8 * All rights reserved. 9 * 10 * Redistribution and use in source and binary forms, with or without --- 14 unchanged lines hidden (view full) --- 25 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 26 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 27 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 28 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 29 * SUCH DAMAGE. 30 */ 31 32#include <sys/cdefs.h> |
33__FBSDID("$FreeBSD: head/usr.bin/grep/util.c 226273 2011-10-12 01:09:57Z gabor $"); |
34 35#include <sys/stat.h> 36#include <sys/types.h> 37 38#include <ctype.h> 39#include <err.h> 40#include <errno.h> 41#include <fnmatch.h> --- 186 unchanged lines hidden (view full) --- 228 return (0); 229 } 230 /* Process the file line-by-line */ 231 if ((t = procline(&ln, f->binary)) == 0 && Bflag > 0) { 232 enqueue(&ln); 233 linesqueued++; 234 } 235 c += t; |
236 if (mflag && mcount <= 0) |
237 break; 238 } 239 if (Bflag > 0) 240 clearqueue(); 241 grep_close(f); 242 243 if (cflag) { 244 if (!hflag) --- 248 unchanged lines hidden --- |