Mercurial > hg > octave-kai > gnulib-hg
changeset 297:28d847a96824
.
author | Jim Meyering <jim@meyering.net> |
---|---|
date | Sat, 27 Aug 1994 21:23:07 +0000 |
parents | 7e6ce7784c6f |
children | e42fe3ec73f5 |
files | lib/filemode.c lib/isdir.c lib/makepath.c lib/rename.c |
diffstat | 4 files changed, 40 insertions(+), 17 deletions(-) [+] |
line wrap: on
line diff
--- a/lib/filemode.c +++ b/lib/filemode.c @@ -1,5 +1,5 @@ /* filemode.c -- make a string describing file modes - Copyright (C) 1985, 1990 Free Software Foundation, Inc. + Copyright (C) 1985, 1990, 1993 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -15,36 +15,65 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ +#ifdef HAVE_CONFIG_H +#if defined (emacs) || defined (CONFIG_BROKETS) +#include <config.h> +#else +#include "config.h" +#endif +#endif + #include <sys/types.h> #include <sys/stat.h> + #ifndef S_IREAD #define S_IREAD S_IRUSR #define S_IWRITE S_IWUSR #define S_IEXEC S_IXUSR #endif -#ifndef S_ISREG /* Doesn't have POSIX.1 stat stuff. */ + +#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 #endif +#endif + +#ifdef STAT_MACROS_BROKEN +#undef S_ISBLK +#undef S_ISCHR +#undef S_ISDIR +#undef S_ISFIFO +#undef S_ISLNK +#undef S_ISMPB +#undef S_ISMPC +#undef S_ISNWK +#undef S_ISREG +#undef S_ISSOCK +#endif /* STAT_MACROS_BROKEN. */ + #if !defined(S_ISBLK) && defined(S_IFBLK) -#define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK) +#define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK) #endif #if !defined(S_ISCHR) && defined(S_IFCHR) -#define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR) +#define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR) #endif #if !defined(S_ISDIR) && defined(S_IFDIR) -#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR) +#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR) #endif #if !defined(S_ISREG) && defined(S_IFREG) -#define S_ISREG(m) (((m) & S_IFMT) == S_IFREG) +#define S_ISREG(m) (((m) & S_IFMT) == S_IFREG) #endif #if !defined(S_ISFIFO) && defined(S_IFIFO) -#define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO) +#define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO) #endif #if !defined(S_ISLNK) && defined(S_IFLNK) -#define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK) +#define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK) #endif #if !defined(S_ISSOCK) && defined(S_IFSOCK) -#define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK) +#define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK) #endif #if !defined(S_ISMPB) && defined(S_IFMPB) /* V7 */ #define S_ISMPB(m) (((m) & S_IFMT) == S_IFMPB) @@ -111,7 +140,7 @@ unsigned short mode; char *str; { - str[0] = ftypelet (mode); + str[0] = ftypelet ((long) mode); rwx ((mode & 0700) << 0, &str[1]); rwx ((mode & 0070) << 3, &str[4]); rwx ((mode & 0007) << 6, &str[7]); @@ -132,7 +161,7 @@ static char ftypelet (bits) - mode_t bits; + long bits; { #ifdef S_ISBLK if (S_ISBLK (bits))
--- a/lib/isdir.c +++ b/lib/isdir.c @@ -32,9 +32,7 @@ #include "safe-stat.h" #ifdef STAT_MACROS_BROKEN -#ifdef S_ISDIR #undef S_ISDIR -#endif #endif /* STAT_MACROS_BROKEN. */ #if !defined(S_ISDIR) && defined(S_IFDIR)