about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAndrey Borzenkov <bor@users.sourceforge.net>2001-04-30 10:40:50 +0000
committerAndrey Borzenkov <bor@users.sourceforge.net>2001-04-30 10:40:50 +0000
commitcd5e39ef5066d8b11d5c5c5dd0023efdd94631f1 (patch)
tree2b29ec0e2cd1e92bc2a6ee0ec2a6b93064c12a21
parentbb694bad4722e7078093d710dcff165b5c5a3f8f (diff)
downloadzsh-cd5e39ef5066d8b11d5c5c5dd0023efdd94631f1.tar.gz
zsh-cd5e39ef5066d8b11d5c5c5dd0023efdd94631f1.tar.xz
zsh-cd5e39ef5066d8b11d5c5c5dd0023efdd94631f1.zip
Bart 14144: fix compilation problem on current Cygwin 1.3.1 (macros were
changed to external variables and cannot be used to initialize static array).
Modified by me __CYGWIN -> __CYGWIN__
-rw-r--r--ChangeLog7
-rw-r--r--Src/Modules/stat.c26
2 files changed, 30 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 5a7ec89e5..cbdd5bb3d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2001-04-30  Andrej Borsenkow <bor@zsh.org>
+
+	* Bart: 14144 (modified):  Src/Modules/stat.c
+	The S_IXUSR, S_IXGRP, S_IXOTH are made external variables in
+	Cygwin 1.3.1 and cannot be used as static array initializer
+	anymore.
+
 2001-04-29  Bart Schaefer  <schaefer@zsh.org>
 
 	* users/3837: Completion/compinit: Add `NO_kshglob' to
diff --git a/Src/Modules/stat.c b/Src/Modules/stat.c
index d0f80829c..053d0ace0 100644
--- a/Src/Modules/stat.c
+++ b/Src/Modules/stat.c
@@ -54,13 +54,33 @@ statmodeprint(mode_t mode, char *outbuf, int flags)
     }
     if (flags & STF_STRING) {
 	static const char *modes = "?rwxrwxrwx";
-	static const mode_t mflags[] = { S_IRUSR, S_IWUSR, S_IXUSR,
-					 S_IRGRP, S_IWGRP, S_IXGRP,
-					 S_IROTH, S_IWOTH, S_IXOTH };
+	static const mode_t mflags[9] = {
+#ifdef __CYGWIN__
+	    0
+#else
+	    S_IRUSR, S_IWUSR, S_IXUSR,
+	    S_IRGRP, S_IWGRP, S_IXGRP,
+	    S_IROTH, S_IWOTH, S_IXOTH
+#endif
+	};
 	const mode_t *mfp = mflags;
 	char pm[11];
 	int i;
 
+#ifdef __CYGWIN__
+	if (mflags[0] == 0) {
+	    mflags[0] = S_IRUSR;
+	    mflags[1] = S_IWUSR;
+	    mflags[2] = S_IXUSR;
+	    mflags[3] = S_IRGRP;
+	    mflags[4] = S_IWGRP;
+	    mflags[5] = S_IXGRP;
+	    mflags[6] = S_IROTH;
+	    mflags[7] = S_IWOTH;
+	    mflags[8] = S_IXOTH;
+	}
+#endif
+
 	if (S_ISBLK(mode))
 	    *pm = 'b';
 	else if (S_ISCHR(mode))