medit/winbuild/grep.patch

107 lines
3.4 KiB
Diff

Index: m4/dosfile.m4
===================================================================
RCS file: /sources/grep/grep/m4/dosfile.m4,v
retrieving revision 1.5
diff -u -p -r1.5 dosfile.m4
--- m4/dosfile.m4 25 Sep 2001 12:16:48 -0000 1.5
+++ m4/dosfile.m4 13 Jan 2008 08:57:35 -0000
@@ -6,11 +6,22 @@ dnl AC_DOSFILE()
AC_DEFUN(AC_DOSFILE,
[
AC_CACHE_CHECK([for dos file convention], ac_cv_dosfile,
- [if test -d ".\."; then
- ac_cv_dosfile=yes
- else
- ac_cv_dosfile=no
- fi
+ [if test "x$cross_compiling" = x; then
+ if test -d ".\."; then
+ ac_cv_dosfile=yes
+ else
+ ac_cv_dosfile=no
+ fi
+ else
+ case $host in
+ *-*-mingw32*)
+ ac_cv_dosfile=yes
+ ;;
+ *)
+ ac_cv_dosfile=no
+ ;;
+ esac
+ fi
])
if test $ac_cv_dosfile = yes; then
Index: src/Makefile.am
===================================================================
RCS file: /sources/grep/grep/src/Makefile.am,v
retrieving revision 1.34
diff -u -p -r1.34 Makefile.am
--- src/Makefile.am 9 Nov 2005 02:47:35 -0000 1.34
+++ src/Makefile.am 13 Jan 2008 08:57:36 -0000
@@ -9,7 +9,7 @@ egrep_SOURCES = egrep.c esearch.c kwset.
fgrep_SOURCES = fgrep.c fsearch.c kwset.c
noinst_HEADERS = grep.h dfa.h kwset.h getpagesize.h system.h mbsupport.h
-LDADD = @INTLLIBS@ ../lib/libgreputils.a
+LDADD = ../lib/libgreputils.a @INTLLIBS@
datadir = $(prefix)/@DATADIRNAME@
localedir = $(datadir)/locale
INCLUDES = -I../intl -I$(top_srcdir)/lib -DLOCALEDIR=\"$(localedir)\"
Index: src/grep.c
===================================================================
RCS file: /sources/grep/grep/src/grep.c,v
retrieving revision 1.125
diff -u -p -r1.125 grep.c
--- src/grep.c 10 Oct 2007 04:29:47 -0000 1.125
+++ src/grep.c 13 Jan 2008 08:57:39 -0000
@@ -1231,7 +1231,7 @@ grepfile (char const *file, struct stats
}
if (directories == SKIP_DIRECTORIES && S_ISDIR (stats->stat.st_mode))
return 1;
-#ifndef DJGPP
+#if !defined(DJGPP) && !defined(__MINGW32__)
if (devices == SKIP_DEVICES && (S_ISCHR(stats->stat.st_mode) || S_ISBLK(stats->stat.st_mode) || S_ISSOCK(stats->stat.st_mode) || S_ISFIFO(stats->stat.st_mode)))
#else
if (devices == SKIP_DEVICES && (S_ISCHR(stats->stat.st_mode) || S_ISBLK(stats->stat.st_mode)))
@@ -1382,7 +1382,7 @@ grepdir (char const *dir, struct stats c
size_t namelen = strlen (namep);
file = xrealloc (file, dirlen + 1 + namelen + 1);
strcpy (file, dir);
- file[dirlen] = '/';
+ file[dirlen] = FILENAME_SEPARATOR;
strcpy (file + dirlen + needs_slash, namep);
namep += namelen + 1;
status &= grepfile (file, &child);
Index: src/system.h
===================================================================
RCS file: /sources/grep/grep/src/system.h,v
retrieving revision 1.18
diff -u -p -r1.18 system.h
--- src/system.h 28 Jun 2007 19:10:46 -0000 1.18
+++ src/system.h 13 Jan 2008 08:57:40 -0000
@@ -68,6 +68,11 @@ extern char *sys_errlist[];
#ifdef HAVE_DOS_FILE_NAMES
# define IS_SLASH(c) ((c) == '/' || (c) == '\\')
# define FILESYSTEM_PREFIX_LEN(f) ((f)[0] && (f)[1] == ':' ? 2 : 0)
+# define FILENAME_SEPARATOR '\\'
+#endif
+
+#ifndef FILENAME_SEPARATOR
+# define FILENAME_SEPARATOR '/'
#endif
#ifndef IS_SLASH
@@ -80,6 +85,10 @@ extern char *sys_errlist[];
int isdir PARAMS ((char const *));
+#ifdef __MINGW32__
+#define HAVE_DIR_EACCES_BUG
+#endif
+
#ifdef HAVE_DIR_EACCES_BUG
# ifdef EISDIR
# define is_EISDIR(e, f) \