X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=lib%2Ffilemode.c;h=91373de34bd513e8e2c57394edf087105588cec3;hb=27cdfa27fdd803212e2cb88148fb578c9312a85f;hp=838f49af0c6a2a6f2eecca3ec80815be7280a464;hpb=bea3493f472ff6e99100c15887dff7caca81489e;p=gnulib.git diff --git a/lib/filemode.c b/lib/filemode.c index 838f49af0..91373de34 100644 --- a/lib/filemode.c +++ b/lib/filemode.c @@ -12,33 +12,38 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ + along with this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, 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 @@ -193,6 +198,17 @@ ftypelet (bits) if (S_ISNWK (bits)) return 'n'; #endif + +#ifdef S_ISOFD + /* Cray migrated dmf file. */ + if (S_ISOFD (bits)) + return 'M'; +#endif +#ifdef S_ISOFL + /* Cray migrated dmf file. */ + if (S_ISOFL (bits)) + return 'M'; +#endif return '?'; } @@ -204,9 +220,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,