This is p-stat.h in view mode; [Download] [Up]
/*+++* * RCS $Id: p-stat.h,v 1.6 1993/02/02 21:00:42 gerben Exp $ * title: p-stat.h * abstract: portable Posix-compliant <sys/stat.h>. * author: T.R.Hageman, Groningen, The Netherlands * created: September 1992 * modified: (see RCS Log at end) * copyleft: * * Copyright (C) 1992 Tom R. Hageman. * * This is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this software; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * description: * * This is a Posix-compatible version of <sys/stat.h> for both Posix * and non-Posix systems. * * o Include this BEFORE all other "p-<header>" files, since otherwise * the catch-all types defined in "p-types.h" may conflict with * the actual types in `struct stat'. ("p-types.h" is silently included * by a number of other "p-<header>" files.) * * o The constants S_ISUID and S_ISGRP (which are required by Posix) * are deliberately left undefined for systems that do not define * these, so aplications can check their existence. * * o `lstat' is aliased to `stat' if S_ISLNK is undefined. * *--*/ #ifndef _P_STAT_H_ #define _P_STAT_H_ 0x104 #ifndef _PORTDEFS_H_ # include "portdefs.h" #endif #if __STRICT_ANSI__ #error "You shouldn't use this header in strict ANSI C code" #endif #ifndef _SYS_TYPES_H_ # if _I_SYS_TYPES - -1 # include <sys/types.h> # else # if _I_TYPES # include <types.h> # endif # endif # define _SYS_TYPES_H_ #endif #ifndef _SYS_STAT_H_ # if _I_SYS_STAT - -1 # include <sys/stat.h> # else # if _I_STAT # include <stat.h> # else #error "both <sys/stat.h> and <stat.h> are absent" \ "(according to portdefs.h)" # endif # endif # define _SYS_STAT_H_ #endif /* Include our own ``sys/types.h'' AFTER <sys/stat.h> so that incorrect type definitions there at least will not affect struct stat. */ #ifndef _P_TYPES_H_ # include "p-types.h" #endif /* Now, provide Posix-style S_IS* and S_I[RWX]* macros if undefined. */ /* {{Should we also try to provide backwards-compatibility??}} */ #ifndef S_ISREG /* Allow either traditional unix S_IF* or wannabe Posix _S_IF* masks. */ # if (!(S_IFMT && S_IFREG != S_IFDIR) && !(_S_IFMT && _S_IFREG != _S_IFDIR)) #error "st_mode macros undefined--check <sys/stat.h>!" # endif # ifdef S_IFREG # define S_ISREG(m) (((m)&S_IFMT)==S_IFREG) # else # ifdef _S_IFREG # define S_ISREG(m) (((m)&_S_IFMT)==_S_IFREG) # endif # endif #endif #ifndef S_ISDIR # ifdef S_IFDIR # define S_ISDIR(m) (((m)&S_IFMT)==S_IFDIR) # else # ifdef _S_IFDIR # define S_ISDIR(m) (((m)&_S_IFMT)==_S_IFDIR) # endif # endif #endif #ifndef S_ISCHR # ifdef S_IFCHR # define S_ISCHR(m) (((m)&S_IFMT)==S_IFCHR) # else # ifdef _S_IFCHR # define S_ISCHR(m) (((m)&_S_IFMT)==_S_IFCHR) # endif # endif #endif #ifndef S_ISBLK # ifdef S_IFBLK # define S_ISBLK(m) (((m)&S_IFMT)==S_IFBLK) # else # ifdef _S_IFBLK # define S_ISBLK(m) (((m)&_S_IFMT)==_S_IFBLK) # endif # endif #endif #ifndef S_ISFIFO # ifdef S_IFIFO # define S_ISFIFO(m) (((m)&S_IFMT)==S_IFIFO) # else # ifdef _S_IFIFO # define S_ISFIFO(m) (((m)&_S_IFMT)==_S_IFIFO) # endif # endif #endif #ifndef S_ISLNK # ifdef S_IFLNK # define S_ISLNK(m) (((m)&S_IFMT)==S_IFLNK) # else # ifdef _S_IFLNK # define S_ISLNK(m) (((m)&_S_IFMT)==_S_IFLNK) # endif # endif #endif #ifndef S_ISNAM # ifdef S_IFNAM # define S_ISNAM(m) (((m)&S_IFMT)==S_IFNAM) # else # ifdef _S_IFNAM # define S_ISNAM(m) (((m)&_S_IFMT)==_S_IFNAM) # endif # endif #endif #ifndef S_ISSOCK # ifdef S_IFSOCK # define S_ISSOCK(m) (((m)&S_IFMT)==S_IFSOCK) # else # ifdef _S_IFSOCK # define S_ISSOCK(m) (((m)&_S_IFMT)==_S_IFSOCK) # endif # endif #endif #ifndef S_IRUSR # ifdef S_IREAD # define S_IRUSR S_IREAD # else # ifdef _S_IREAD # define S_IRUSR _S_IREAD # else # define S_IRUSR 0400 # endif # endif #endif #ifndef S_IRGRP # define S_IRGRP (S_IRUSR>>3) #endif #ifndef S_IROTH # define S_IROTH (S_IRUSR>>6) #endif #ifndef S_IWUSR # ifdef S_IWRITE # define S_IWUSR S_IWRITE # else # ifdef _S_IWRITE # define S_IWUSR _S_IWRITE # else # define S_IWUSR 0200 # endif # endif #endif #ifndef S_IWGRP # define S_IWGRP (S_IWUSR>>3) #endif #ifndef S_IWOTH # define S_IWOTH (S_IWUSR>>6) #endif #ifndef S_IXUSR # ifdef S_IEXEC # define S_IXUSR S_IEXEC # else # ifdef _S_IEXEC # define S_IXUSR _S_IEXEC # else # define S_IXUSR 0100 # endif # endif #endif #ifndef S_IXGRP # define S_IXGRP (S_IXUSR>>3) #endif #ifndef S_IXOTH # define S_IXOTH (S_IXUSR>>6) #endif #ifndef S_IRWXU # define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR) #endif #ifndef S_IRWXG # define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP) #endif #ifndef S_IRWXO # define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH) #endif #if !__POSIX__ #if !__NO_PROTO__ && !__NO_TRIV_PROTO__ extern int stat __(( const char *_(name), struct stat *_(buf) )); extern int fstat __(( int _(fd), struct stat *_(buf) )); extern int mkdir __(( const char *_(name), mode_t _(mode) )); extern int mkfifo __(( const char *_(name), mode_t _(mode) )); extern int chmod __(( const char *_(name), mode_t _(mode) )); #ifndef umask extern mode_t umask __(( mode_t _(newmask) )); #endif #endif /* !__NO_PROTO__ */ #endif /* !__POSIX__ */ #if !__STRICT_POSIX__ #ifdef S_ISLNK # if !__NO_PROTO__ && !__NO_TRIV_PROTO__ extern int lstat __(( const char *_(name), struct stat *_(buf) )); # endif #else # define lstat stat #endif #endif #endif /* _P_STAT_H_ */ /*======================================================================* * $Log: p-stat.h,v $ * Revision 1.6 1993/02/02 21:00:42 gerben * *** empty log message *** * * Revision 1.5 1992/10/23 04:56:47 tom * fix typo in declaration of lstat(). * * Revision 1.4 1992/10/23 04:11:15 tom * add __STRICT_ANSI__ check; describe BUGS; add __NO_TRIV_PROTO__. * * Revision 1.3 1992/10/21 19:40:23 tom * don't include function prototypes if __POSIX__. * * Revision 1.2 1992/10/20 16:52:19 tom * make __NO_PROTO__ consistent with other headers. * * Revision 1.1 1992/10/14 13:38:20 tom * rename to "p-<header>". * * Revision 1.0 1992/10/09 07:07:34 tom * Initial revision * *======================================================================*/
These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.