aboutsummaryrefslogtreecommitdiffstats
path: root/pc
diff options
context:
space:
mode:
Diffstat (limited to 'pc')
-rw-r--r--pc/ChangeLog8
-rw-r--r--pc/Makefile24
-rw-r--r--pc/config.h4
-rw-r--r--pc/gawkmisc.pc31
4 files changed, 61 insertions, 6 deletions
diff --git a/pc/ChangeLog b/pc/ChangeLog
index da02a048..9143dee5 100644
--- a/pc/ChangeLog
+++ b/pc/ChangeLog
@@ -1,3 +1,11 @@
+Sun Feb 13 20:23:07 2011 Eli Zaretskii <eliz@gnu.org>
+
+ * gawkmisc.pc (files_are_same): Change arguments. Compare file
+ names and modification times in addition to devices and inodes.
+ * Makefile (LIBOBJS): Add hard-locale$O.
+ Update prerequisites.
+ * config.h (ISATTY) [__MINGW32__ || _MSC_VER]: Define.
+
Mon Feb 7 22:45:28 2011 Arnold Robbins <arnold@skeeve.com>
* Makefile.tst: Sync with mainline version.
diff --git a/pc/Makefile b/pc/Makefile
index 8a8888e0..9d681458 100644
--- a/pc/Makefile
+++ b/pc/Makefile
@@ -188,7 +188,7 @@ ALLOBJS = $(AWKOBJS) awkgram$O getid$O $(OBJ)
# LIBOBJS
# GNU and other stuff that gawk uses as library routines.
-LIBOBJS= getopt$O getopt1$O dfa$O regex$O random$O
+LIBOBJS= getopt$O getopt1$O dfa$O regex$O random$O hard-locale$O
GAWKOBJS = $(ALLOBJS) $(LIBOBJS)
PGAWKOBJS = $(PAWKOBJS1) $(PAWKOBJS2) $(LIBOBJS) awkgram$O getid$O $(OBJ)
@@ -231,16 +231,32 @@ $(DRSPFILE) : $(DGAWKOBJS)
echo $(DAWKOBJS2)$P >> $@
echo awkgram$O getid$O $(OBJ) $(LIBOBJS)$P >> $@
-$(ALLOBJS) eval_p$O profile_p$O: awk.h regex.h config.h
+# Notes to dependencies:
+# 1. The dependency on getopt.h is because unistd.h includes it,
+# and we have -I. on the compiler command line. unistd.h is
+# included by awk.h.
+# 2. custom.h is not mentioned because pc ports don't use it.
+$(ALLOBJS) $(LIBOBJS) eval_p$O profile_p$O: \
+ awk.h regex.h config.h gettext.h mbsupport.h protos.h dfa.h getopt.h
+
+builtin$O random$O: awkprintf.h floatmagic.h random.h
+
+debug$O: awkprintf.h floatmagic.h
+
+command$O debug$O: cmd.h
+
+dfa$O: hard-locale.h xalloc.h
gawkmisc$O: pc/gawkmisc.pc
-getopt$O: getopt.h
+getopt$O getopt1$O : getopt_int.h
-getopt1$O: getopt.h
+hard-locale$O: hard-locale.h
io$O: popen.h
+regex$O: regcomp.c regexec.c regex_internal.h
+
eval_p$O: eval.c
profile_p$O: profile.c
diff --git a/pc/config.h b/pc/config.h
index 4dd797c1..4ec2d711 100644
--- a/pc/config.h
+++ b/pc/config.h
@@ -518,4 +518,8 @@
#define HAVE_USLEEP 1
#endif
+#if defined(__MINGW32__) || defined(_MSC_VER)
+# define ISATTY(fd) (isatty(fd) && lseek(fd,SEEK_CUR,0) == -1)
+#endif
+
/* #define NO_LINT 1 */
diff --git a/pc/gawkmisc.pc b/pc/gawkmisc.pc
index 74a2d7db..67760676 100644
--- a/pc/gawkmisc.pc
+++ b/pc/gawkmisc.pc
@@ -284,9 +284,36 @@ int fd;
/* files_are_same --- return true if files are identical */
int
-files_are_same(struct stat *f1, struct stat *f2)
+files_are_same(char *path, SRCFILE *src)
{
- return (f1->st_dev == f2->st_dev && f1->st_ino == f2->st_ino);
+ struct stat st;
+ size_t pathlen;
+ char *p, *s;
+
+ if (stat (path, & st) == 0) {
+ /* If they have a working `stat', honor that. */
+ if (!(st.st_dev == src->sbuf.st_dev
+ && st.st_ino == src->sbuf.st_ino))
+ return 0;
+
+ /* Compare modification times. */
+ if (st.st_mtime != src->mtime)
+ return 0;
+
+ /* Compare absolute file names case-insensitively, and
+ treat forward- and back-slashes as equal. */
+ pathlen = strlen(path);
+ for (p = path, s = src->fullpath;
+ p <= path + pathlen;
+ p++, s++) {
+ if (tolower(*p) != tolower(*s)
+ && !((*p == '/' || *p == '\\')
+ && (*s == '/' || *s == '\\')))
+ return 0;
+ }
+ return 1;
+ }
+ return 0;
}