/* this should be in <sys/stat.h> !! */
/* $Id: statx.h,v 1.4 2000/04/03 18:16:13 veit Exp $ */

#ifndef _SYS_STATX_H
#define _SYS_STATX_H

#include <sys/stat.h>

#if defined(__cplusplus)
# ifndef __inline__ 
#  define __inline__ inline
# endif
extern "C" {
#endif

/* Is the character C a path name separator?  Under OS/2, you can use
   either / or \.  */
#define _ISDIRSEP(c) (c == '/' || c == '\\')
#define _ISABSPATH(s) ( _ISDIRSEP(s[0]) || (s[0] != '\0' && 				\
                         s[1] == ':' && _ISDIRSEP(s[2])) )

extern int _lstat(__const__ char*, struct stat*);
extern int _fchmod(__const__ int,__const__ mode_t);
extern int _lchmod(__const__ char*,__const__ mode_t);
/* lchmod(): a wrapper for chmod, until we implement symlinks 
 */

extern int _isdir(__const__ char*);
extern int _isfile(__const__ char*);
extern int _islink(__const__ char*);
extern int _isdevice(__const__ char*);
extern int _isreadable(__const__ char*);
extern int _iswritable(__const__ char*);
extern int _isaccessible(__const__ char*,__const__ mode_t);
extern int _isabsolute(__const__ char*);

/* Machine-dependent inline versions */
#if (!__GNUC__ || __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ <= 7))
  extern int lstat(__const__ char *path, struct stat *buf);
  extern int lchmod(__const__ char*,__const__ mode_t);
  extern int fchmod(__const__ int,__const__ mode_t);
#else
  extern __inline__ int fchmod(__const__ int,__const__ mode_t);
  extern __inline__ int lchmod(__const__ char*,__const__ mode_t);
  extern __inline__ int stat(__const__ char*,struct stat*);
  extern __inline__ int lstat(__const__ char*,struct stat*);
		extern __inline__ int 
  stat(__const__ char*p,struct stat*b){return _stat(p,b);}
		extern __inline__ int 
  lstat(__const__ char*p,struct stat*b){return _lstat(p,b);}
  	extern __inline__ int
  fchmod(__const__ int f,__const__ mode_t m){return _fchmod(f,m);}
	extern __inline__ int 
  lchmod(__const__ char*p,__const__ mode_t m){return _chmod(p,m);}
#endif
# if defined (__cplusplus)
 }
#endif

#ifdef _DEBUG
# include <sys/debugx.h>
#endif

#endif /* not _SYS_STAT_H */
