PERFORCE change 156019 for review
Gabor Kovesdan
gabor at FreeBSD.org
Mon Jan 12 08:58:23 PST 2009
http://perforce.freebsd.org/chv.cgi?CH=156019
Change 156019 by gabor at gabor_server on 2009/01/12 16:58:06
IFC
Affected files ...
.. //depot/projects/soc2008/gabor_textproc/src/share/mk/bsd.own.mk#5 integrate
.. //depot/projects/soc2008/gabor_textproc/src/usr.bin/grep/Makefile#5 integrate
.. //depot/projects/soc2008/gabor_textproc/src/usr.bin/grep/file.c#7 integrate
.. //depot/projects/soc2008/gabor_textproc/src/usr.bin/grep/grep.c#5 integrate
.. //depot/projects/soc2008/gabor_textproc/src/usr.bin/grep/grep.h#5 integrate
Differences ...
==== //depot/projects/soc2008/gabor_textproc/src/share/mk/bsd.own.mk#5 (text+ko) ====
@@ -1,4 +1,4 @@
-# $FreeBSD: src/share/mk/bsd.own.mk,v 1.78 2008/09/21 22:02:26 sam Exp $
+# $FreeBSD: src/share/mk/bsd.own.mk,v 1.79 2009/01/08 12:22:37 bz Exp $
#
# The include file <bsd.own.mk> set common variables for owner,
# group, mode, and directories. Defaults are in brackets.
@@ -44,9 +44,9 @@
# KMODDIR Base path for loadable kernel modules
# (see kld(4)). [/boot/kernel]
#
-# KMODOWN KLD owner. [${BINOWN}]
+# KMODOWN Kernel and KLD owner. [${BINOWN}]
#
-# KMODGRP KLD group. [${BINGRP}]
+# KMODGRP Kernel and KLD group. [${BINGRP}]
#
# KMODMODE KLD mode. [${BINMODE}]
#
==== //depot/projects/soc2008/gabor_textproc/src/usr.bin/grep/Makefile#5 (text+ko) ====
@@ -20,6 +20,12 @@
LDADD= -lz -lbz2
DPADD= ${LIBZ} ${LIBBZ2}
+.if !defined(WITHOUT_GNU_COMPAT)
+CFLAGS+= -I/usr/include/gnu
+LDADD+= -lgnuregex
+DPADD+= ${LIBGNUREGEX}
+.endif
+
.if !defined(WITHOUT_NLS)
NLS= hu_HU.ISO8859-2
NLS+= pt_BR.ISO8859-1
==== //depot/projects/soc2008/gabor_textproc/src/usr.bin/grep/file.c#7 (text+ko) ====
@@ -132,8 +132,10 @@
/* Only pre-read to the buffer if we need the binary check. */
if (binbehave != BINFILE_TEXT) {
- if (stat(fname, &st) != 0)
- errx(2, NULL);
+ if (f->stdin == 1)
+ st.st_size = MAXBUFSIZ;
+ else if (stat(fname, &st) != 0)
+ err(2, NULL);
bufsiz = (MAXBUFSIZ > (st.st_size * PREREAD_M)) ? (st.st_size / 2) : MAXBUFSIZ;
@@ -183,8 +185,10 @@
f = grep_malloc(sizeof *f);
- if ((f->f = fdopen(STDIN_FILENO, "r")) != NULL)
+ if ((f->f = fdopen(STDIN_FILENO, "r")) != NULL) {
+ f->stdin = 1;
return (f);
+ }
free(f);
return (NULL);
@@ -202,6 +206,7 @@
f = grep_malloc(sizeof *f);
+ f->stdin = 0;
switch (filebehave) {
case FILE_STDIO:
if ((f->f = fopen(path, "r")) != NULL)
==== //depot/projects/soc2008/gabor_textproc/src/usr.bin/grep/grep.c#5 (text+ko) ====
@@ -82,7 +82,7 @@
};
/* Flags passed to regcomp() and regexec() */
-int cflags;
+int cflags = 0;
int eflags = REG_STARTEND;
/* Shortcut for matching all cases like empty regex */
@@ -237,27 +237,9 @@
if (len > 0 && pat[len - 1] == '\n')
--len;
/* pat may not be NUL-terminated */
- if (wflag && !(grepbehave == GREP_FIXED)) {
- int bol = 0, eol = 0, extra;
- if (pat[0] == '^')
- bol = 1;
- if (len > 0 && pat[len - 1] == '$')
- eol = 1;
- extra = (grepbehave == GREP_EXTENDED) ? 2 : 4;
- pattern[patterns] = grep_malloc(len + 15 + extra);
- snprintf(pattern[patterns], len + 15 + extra,
- "%s[[:<:]]%s%.*s%s[[:>:]]%s",
- bol ? "^" : "",
- (grepbehave == GREP_EXTENDED) ? "(" : "\\(",
- (int)len - bol - eol, pat + bol,
- (grepbehave == GREP_EXTENDED) ? ")" : "\\)",
- eol ? "$" : "");
- len += 14 + extra;
- } else {
- pattern[patterns] = grep_malloc(len + 1);
- memcpy(pattern[patterns], pat, len);
- pattern[patterns][len] = '\0';
- }
+ pattern[patterns] = grep_malloc(len + 1);
+ memcpy(pattern[patterns], pat, len);
+ pattern[patterns][len] = '\0';
++patterns;
}
@@ -563,10 +545,7 @@
switch (grepbehave) {
case GREP_FIXED:
- cflags |= REG_NOSPEC;
- break;
case GREP_BASIC:
- cflags |= REG_BASIC;
break;
case GREP_EXTENDED:
cflags |= REG_EXTENDED;
==== //depot/projects/soc2008/gabor_textproc/src/usr.bin/grep/grep.h#5 (text+ko) ====
@@ -72,6 +72,7 @@
struct file {
int binary;
+ int stdin;
FILE *f;
struct mmfile *mmf;
gzFile *gzf;
More information about the p4-projects
mailing list