Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: S_IXUSR & Co macro problem - zsh does not compile under current cygwin.



On Apr 27, 12:27pm, Andrej Borsenkow wrote:
}
} #if defined (__CYGWIN__) && !defined (__INSIDE_CYGWIN__)
} extern unsigned const _cygwin_S_IEXEC, _cygwin_S_IXUSR, _cygwin_S_IXGRP, _cygwin_S_IXOTH;

Do we need to fix this in zsh, or do you think it'll be treated as a bug
by the cygwin folks?

Index: Src/Modules/stat.c
===================================================================
@@ -54,12 +54,32 @@
     }
     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';


-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com

Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net   



Messages sorted by: Reverse Date, Date, Thread, Author