X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=lib%2Ffilemode.c;h=20c65c4b06e239a9640414d6abfaec76d6ff0005;hb=84fdd39f05ad45f6126fa58023fd73a876c85733;hp=838f49af0c6a2a6f2eecca3ec80815be7280a464;hpb=bea3493f472ff6e99100c15887dff7caca81489e;p=gnulib.git diff --git a/lib/filemode.c b/lib/filemode.c index 838f49af0..20c65c4b0 100644 --- a/lib/filemode.c +++ b/lib/filemode.c @@ -16,29 +16,34 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifdef HAVE_CONFIG_H -#if defined (emacs) || defined (CONFIG_BROKETS) #include -#else -#include "config.h" -#endif #endif #include #include -#ifndef S_IREAD -#define S_IREAD S_IRUSR -#define S_IWRITE S_IWUSR -#define S_IEXEC S_IXUSR +#if !S_IRUSR +# if S_IREAD +# define S_IRUSR S_IREAD +# else +# define S_IRUSR 00400 +# endif #endif -#if 0 /* This is unreliable, since GCC 2.5 always has S_ISREG in its - fixed headers but it does not always have mode_t. - It seems safer not to try to use mode_t ever. */ -#if !defined(S_ISREG) || defined(NO_MODE_T) -/* Doesn't have POSIX.1 stat stuff or doesn't have mode_t. */ -#define mode_t unsigned short +#if !S_IWUSR +# if S_IWRITE +# define S_IWUSR S_IWRITE +# else +# define S_IWUSR 00200 +# endif #endif + +#if !S_IXUSR +# if S_IEXEC +# define S_IXUSR S_IEXEC +# else +# define S_IXUSR 00100 +# endif #endif #ifdef STAT_MACROS_BROKEN @@ -204,9 +209,9 @@ rwx (bits, chars) unsigned short bits; char *chars; { - chars[0] = (bits & S_IREAD) ? 'r' : '-'; - chars[1] = (bits & S_IWRITE) ? 'w' : '-'; - chars[2] = (bits & S_IEXEC) ? 'x' : '-'; + chars[0] = (bits & S_IRUSR) ? 'r' : '-'; + chars[1] = (bits & S_IWUSR) ? 'w' : '-'; + chars[2] = (bits & S_IXUSR) ? 'x' : '-'; } /* Set the 's' and 't' flags in file attributes string CHARS,