From 392da7ebc70c68183577d567b6481c5bd86d8652 Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Thu, 3 Nov 1994 22:03:54 +0000 Subject: [PATCH] (rwx): Use S_IRUSR, S_IWUSR, S_IXUSR instead of obsolete S_IREAD, S_IWRITE, S_IEXEC. Make sure the former three are defined. --- lib/filemode.c | 32 +++++++++++++++++++++++++------- 1 file changed, 25 insertions(+), 7 deletions(-) diff --git a/lib/filemode.c b/lib/filemode.c index c86ee2ff5..20c65c4b0 100644 --- a/lib/filemode.c +++ b/lib/filemode.c @@ -22,10 +22,28 @@ #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 !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 @@ -191,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, -- 2.11.0