zsh-workers
 help / color / mirror / code / Atom feed
* S_IXUSR & Co macro problem - zsh does not compile under current cygwin.
@ 2001-04-27  8:27 Andrej Borsenkow
  2001-04-27 17:46 ` Bart Schaefer
  0 siblings, 1 reply; 5+ messages in thread
From: Andrej Borsenkow @ 2001-04-27  8:27 UTC (permalink / raw)
  To: ZSH Workers Mailing List, Cygwin Mailing List


Just updated to the lates cygwin-1.3.1-1

gcc -c -I.  -DHAVE_CONFIG_H -DMODULE -Wall -Wno-implicit -Wmissing-prototypes 
-O
2  -o stat..o /tools/src/zsh/Src/Modules/stat.c
/tools/src/zsh/Src/Modules/stat.c: In function `statmodeprint':
/tools/src/zsh/Src/Modules/stat.c:57: initializer element is not constant
/tools/src/zsh/Src/Modules/stat.c:57: (near initialization for `mflags[2]')
/tools/src/zsh/Src/Modules/stat.c:58: initializer element is not constant
/tools/src/zsh/Src/Modules/stat.c:58: (near initialization for `mflags[5]')
/tools/src/zsh/Src/Modules/stat.c:59: initializer element is not constant
/tools/src/zsh/Src/Modules/stat.c:59: (near initialization for `mflags[8]')

relevat part of stat.c:

    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 };

And from /usr/include/sys/stat.h:

#if defined (__CYGWIN__) && !defined (__INSIDE_CYGWIN__)
extern unsigned const _cygwin_S_IEXEC, _cygwin_S_IXUSR, _cygwin_S_IXGRP,
_cygwin
_S_IXOTH;
#undef S_IEXEC
#undef S_IXUSR
#undef S_IXGRP
#undef S_IXOTH
#define S_IEXEC         _cygwin_S_IEXEC
#define S_IXUSR         _cygwin_S_IXUSR
#define S_IXGRP         _cygwin_S_IXGRP
#define S_IXOTH         _cygwin_S_IXOTH
#endif


SUS does not clear specify if these macros should be #defines. But, is it
necessary to make them external variables? const is real const in C++ but not
in C, sigh.

-andrej

Have a nice DOS!
B >>


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: S_IXUSR & Co macro problem - zsh does not compile under current cygwin.
  2001-04-27  8:27 S_IXUSR & Co macro problem - zsh does not compile under current cygwin Andrej Borsenkow
@ 2001-04-27 17:46 ` Bart Schaefer
  2001-04-28  8:52   ` Andrej Borsenkow
  0 siblings, 1 reply; 5+ messages in thread
From: Bart Schaefer @ 2001-04-27 17:46 UTC (permalink / raw)
  To: Andrej Borsenkow, ZSH Workers Mailing List

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   


^ permalink raw reply	[flat|nested] 5+ messages in thread

* RE: S_IXUSR & Co macro problem - zsh does not compile under current cygwin.
  2001-04-27 17:46 ` Bart Schaefer
@ 2001-04-28  8:52   ` Andrej Borsenkow
  2001-04-28 18:18     ` Bart Schaefer
  0 siblings, 1 reply; 5+ messages in thread
From: Andrej Borsenkow @ 2001-04-28  8:52 UTC (permalink / raw)
  To: ZSH Workers Mailing List

>
> 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?
>

If I understand the following correctly , it was deliberate change:

>SUS does not clear specify if these macros should be #defines. But, is it
>necessary to make them external variables? const is real const in C++ but not
>in C, sigh.

Nope, not necessary at all.

This is just part of a massive "Arbitrarily make everything a global variable"
campaign.  Phase two will be to have Cygwin prompt you for the values of
the variables whenever you want to use them.

-andrej


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: S_IXUSR & Co macro problem - zsh does not compile under current cygwin.
  2001-04-28  8:52   ` Andrej Borsenkow
@ 2001-04-28 18:18     ` Bart Schaefer
  2001-04-30 10:42       ` Andrej Borsenkow
  0 siblings, 1 reply; 5+ messages in thread
From: Bart Schaefer @ 2001-04-28 18:18 UTC (permalink / raw)
  To: ZSH Workers Mailing List

On Apr 28, 12:52pm, Andrej Borsenkow wrote:
} Subject: RE: S_IXUSR & Co macro problem - zsh does not compile under curre
}
} > Do we need to fix this in zsh, or do you think it'll be treated as a bug
} > by the cygwin folks?
} 
} If I understand the following correctly , it was deliberate change:

Let me rephrase the question.  Should I commit that patch?

-- 
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   


^ permalink raw reply	[flat|nested] 5+ messages in thread

* RE: S_IXUSR & Co macro problem - zsh does not compile under current cygwin.
  2001-04-28 18:18     ` Bart Schaefer
@ 2001-04-30 10:42       ` Andrej Borsenkow
  0 siblings, 0 replies; 5+ messages in thread
From: Andrej Borsenkow @ 2001-04-30 10:42 UTC (permalink / raw)
  To: ZSH Workers Mailing List

}
> } > Do we need to fix this in zsh, or do you think it'll be treated as a bug
> } > by the cygwin folks?
> }
> } If I understand the following correctly , it was deliberate change:
>
> Let me rephrase the question.  Should I commit that patch?
>

I have committed it with a single fix __CYGWIN -> __CYGWIN__

-andrej


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2001-04-30 10:42 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-04-27  8:27 S_IXUSR & Co macro problem - zsh does not compile under current cygwin Andrej Borsenkow
2001-04-27 17:46 ` Bart Schaefer
2001-04-28  8:52   ` Andrej Borsenkow
2001-04-28 18:18     ` Bart Schaefer
2001-04-30 10:42       ` Andrej Borsenkow

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).