Report an error if neither S_ISREG nor
authorJim Meyering <jim@meyering.net>
Wed, 19 Jun 2002 11:12:59 +0000 (11:12 +0000)
committerJim Meyering <jim@meyering.net>
Wed, 19 Jun 2002 11:12:59 +0000 (11:12 +0000)
S_IFREG is defined, instead of using a test specific to glibc
2.2.  This should be safe, since POSIX requires S_ISREG and
Unix Version 7 had S_IFREG.  We don't need to check for
<sys/types.h> since we don't use any symbols that it defines.

lib/file-type.h

index 765ec89..c766d6c 100644 (file)
 
 /* Written by Paul Eggert and Jim Meyering.  */
 
-/* Include <sys/types.h> and <sys/stat.h> before including this
-   file.  */
-
 #ifndef FILE_TYPE_H
 # define FILE_TYPE_H 1
 
-# if 2 <= __GLIBC__ && 2 <= __GLIBC_MINOR__
-#  if !defined _SYS_STAT_H || !defined _SYS_TYPES_H
-you must include <sys/types.h> and <sys/stat.h> before including this file
-#  endif
+# if ! defined S_ISREG && ! defined S_IFREG
+you must include <sys/stat.h> before including this file
 # endif
 
 char const *file_type (struct stat const *);